Exemple #1
0
 def convert(_log):
     if _log.__class__ == Log:
         return
     _log.__class__ = Log
     for machine in _log.machine_list:
         Machine.convert(machine)
     for workflow_exec in _log.workflow_execs:
         WorkflowExec.convert(workflow_exec)
 def convert(_wf_exec):
     if _wf_exec.__class__ == WorkflowExec:
         return
     _wf_exec.__class__ = WorkflowExec
     for annotation in _wf_exec.annotations:
         Annotation.convert(annotation)
     for machine in _wf_exec.machine_list:
         Machine.convert(machine)
     for item_exec in _wf_exec.item_execs:
         if item_exec.vtType == ModuleExec.vtType:
             ModuleExec.convert(item_exec)
         elif item_exec.vtType == GroupExec.vtType:
             GroupExec.convert(item_exec)
         elif item_exec.vtType == LoopExec.vtType:
             LoopExec.convert(item_exec)
Exemple #3
0
 def get_local_machine(cls):
     if cls._local_machine is None:
         cls._local_machine = Machine(
             id=-1,
             name=vistrails.core.system.current_machine(),
             os=vistrails.core.system.systemType,
             architecture=vistrails.core.system.current_architecture(),
             processor=vistrails.core.system.current_processor(),
             ram=vistrails.core.system.guess_total_memory())
     return copy.copy(cls._local_machine)
Exemple #4
0
class LogController(object):
    """The top-level log controller.

    This holds a log.
    """
    local_machine = Machine(
        id=-1,
        name=vistrails.core.system.current_machine(),
        os=vistrails.core.system.systemType,
        architecture=vistrails.core.system.current_architecture(),
        processor=vistrails.core.system.current_processor(),
        ram=vistrails.core.system.guess_total_memory())

    def __init__(self, log, machine=None):
        self.log = log
        self.module_execs = {}  # vistrails_module -> *Exec
        self.parent_execs = {}  # vistrails_module -> *Exec
        self.children_execs = {}  # vistrails_module -> [*Exec]
        if machine is not None:
            self.machine = machine
        else:
            self.machine = copy.copy(self.local_machine)
            self.machine.id = self.log.id_scope.getNewId(Machine.vtType)

    def _create_module_exec(self, module, module_id, module_name, cached):
        m_exec_id = self.log.id_scope.getNewId(ModuleExec.vtType)
        module_exec = ModuleExec(id=m_exec_id,
                                 machine_id=self.machine.id,
                                 module_id=module_id,
                                 module_name=module_name,
                                 cached=cached,
                                 ts_start=vistrails.core.system.current_time(),
                                 completed=0)
        return module_exec

    def _create_group_exec(self, group, module_id, group_name, cached):
        g_exec_id = self.log.id_scope.getNewId(GroupExec.vtType)
        if isinstance(group, Abstraction):
            group_type = 'SubWorkflow'
        else:
            group_type = 'Group'
        group_exec = GroupExec(id=g_exec_id,
                               machine_id=self.machine.id,
                               module_id=module_id,
                               group_name=group_name,
                               group_type=group_type,
                               cached=cached,
                               ts_start=vistrails.core.system.current_time(),
                               completed=0)
        return group_exec

    def _create_loop_exec(self):
        l_exec_id = self.log.id_scope.getNewId(LoopExec.vtType)
        loop_exec = LoopExec(id=l_exec_id,
                             ts_start=vistrails.core.system.current_time())
        return loop_exec

    def start_workflow_execution(self,
                                 parent_exec,
                                 vistrail=None,
                                 pipeline=None,
                                 currentVersion=None):
        """Signals the start of the execution of a pipeline.
        """
        return LogWorkflowExecController(self.log, self.machine, parent_exec,
                                         vistrail, pipeline, currentVersion)