register_models.py

Go to the documentation of this file.
00001 from GBSModelRegistry     import  GetModelRegistry
00002 from GBSModel             import  GBSModel
00003 
00004 from GBSJobAnalyser       import GBSJobAnalyser
00005 from GBSJob               import GBSJob
00006 from GBSManager           import GBSManager
00007 from GBSTask              import GBSTask
00008 
00009 ##  Register default model
00010 
00011 description = """The default model which provides the core functionality.
00012 Other models should only need fine tune to experiment
00013 specific needs.
00014 """
00015 
00016 m = GBSModel("default","The default model",description)
00017 
00018 m.AddMapping("Manager", GBSManager, {})
00019 m.AddMapping("Task",GBSTask,{})
00020 m.AddMapping("Job", GBSJob, {})
00021 m.AddMapping("JobAnalyser", GBSJobAnalyser,{})
00022 
00023 GetModelRegistry().AddModel(m)
00024 
00025 ##  If the configuration variable UserModelsPath is defined, try to
00026 ##  add user extensions.
00027 
00028 import os
00029 from GBSConfig import GetConfigValue
00030 
00031 user_path = GetConfigValue("UserModelsPath")
00032 if user_path:
00033     user_path = os.path.expandvars(user_path)
00034     if not os.path.isdir(user_path):
00035         print "Warning: Cannot load user extensions, unable to find directory "\
00036               + user_path
00037     else:
00038         import sys
00039         sys.path.append(user_path)
00040         try:
00041             import register_user_models
00042             print "Loaded user extensions from " + user_path 
00043         except ImportError:
00044             print "Warning: Cannot load user extensions, No file register_user_models.py in "\
00045                   + user_path

Generated on Fri Mar 5 09:25:41 2010 for gbs by  doxygen 1.4.7