Example #1
0
def get_dispatcher():
    from mobyle.execution_engine.systems.execution_system import load_execution_classes
    from mobyle.common.job_routing_model import ExecutionSystem
    exec_klass = load_execution_classes()
    exec_systems = {}
    all_exec_in_conf = connection.ExecutionSystem.fetch({})
    for exec_conf in all_exec_in_conf:
        try:
            klass = exec_klass[exec_conf["class"]]
        except KeyError, err:
            raise MobyleError('class {0} does not exist check your config'.format(exec_conf["class"]))
        opts = exec_conf["drm_options"]
        if opts is None:
            opts = {}
        native_specifications = exec_conf["native_specifications"]
        if native_specifications:
            opts["native_specifications"] = native_specifications
        try:
            exec_systems[exec_conf["_id"]] = klass(exec_conf["_id"], **opts)
        except Exception, err:
            msg = 'cannot instantiate class {0} : {1}'.format(exec_conf["class"]), err
            _log.error(msg)
            raise MobyleError(msg)
Example #2
0
 
 
 def get_execution_system(self, exec_name):
     """
     fetch the execution systems configuration corresponding to exec_name from DB
     
     :param exec_name: the name of the Execution system to fetch
     :type exec_name: string
     :returns: :class:`mobyle.executon_engine.systems.exceution_system.ExecutionSytem` object
     """  
     try:
         exec_conf = connection.ExecutionSystem.fetch_one({'_id' : exec_name})
     except Exception, err:
         self._log.error(str(err), exc_info = True)
         raise err
     exec_klasses = load_execution_classes()
     try:
         klass = exec_klasses[exec_conf["class"]]
     except KeyError, err:
         raise MobyleError('class {0} does not exist check your config'.format(exec_conf["class"]))
     opts = exec_conf["drm_options"]
     if opts is None:
         opts = {}
     native_specifications = exec_conf["native_specifications"]
     if native_specifications:
         opts["native_specifications"] = native_specifications
     try:
         execution_system = klass(exec_conf["_id"], **opts)
     except Exception, err:
         msg = 'cannot instantiate class {0} : {1}'.format(exec_conf["class"]), err
         self._log.error(msg)