Example #1
0
 def close(self):
     self.dot.append("{0} -> END".format(self.last_task))
     self.dot.append("}")
     path, ext = os.path.splitext(self.config.get_yaml_file())
     with open(path + ".dot", "w") as text_file:
         print("\n".join(self.dot), file=text_file)
     log.info("generated dot file '" + path + ".dot'")
Example #2
0
    def _handle_task(self, task_dict: Dict) -> OrcaTask:
        name = task_dict.get('task', None)

        # check the symbol table for task name to be an unique and valid name
        self._check_symtable(name, task_dict)

        # task_locals are the resolved inputs, they will be used for
        # execution
        task_locals = self.resolve_task_inputs(task_dict)
        _task = OrcaTask(task_dict, task_locals)

        log.debug("task '{0}' locals pre: {1}".format(_task.name, _task.locals))

        # select the handler and call handle
        handle = self.select_handler(task_dict)
        log.info('Starting task {0}'.format(name))
        handle(_task)
        log.info('Task {0} completed'.format(name, ))

        log.debug("task '{0}' locals post: {1}".format(
            _task.name, _task.locals))

        # put the task_locals into the global task dictonary
        # this includes input and outputs
        task[_task.name] = {}
        for k, v in _task.locals.items():
            task[_task.name][k] = v

        return _task
Example #3
0
 def handle(self, config: OrcaConfig) -> None:
     log.info('Executing workflow...')
     self.ledger.set_config(config)
     super().handle(config)