示例#1
0
def tick_workflow_engine(registry=None):
    if registry is None:
        import aiida.workflows2.defaults
        registry = aiida.workflows2.defaults.registry

    engine = TickingEngine(defaults.factory, registry)
    run_all_saved_processes(engine, registry)
    return engine.tick()
示例#2
0
    def _run_with_checkpoints(self, wf_class, inputs=None):
        finished_steps = {}

        te = TickingEngine()
        fut = te.submit(wf_class, inputs)
        while not fut.done():
            pid = fut.pid
            te.tick()
            finished_steps.update(wf_class.finished_steps)
        te.shutdown()

        return finished_steps
示例#3
0
    def test_simple_run(self):
        """
        Run the workchain which should hit the exception and therefore end
        up in the FAILED state
        """
        engine = TickingEngine()
        future = engine.submit(TestWorkChainAbortChildren.MainWorkChain)

        while not future.done():
            engine.tick()

        self.assertEquals(future.process.calc.has_finished_ok(), False)
        self.assertEquals(future.process.calc.has_failed(), True)
        self.assertEquals(future.process.calc.has_aborted(), False)
        engine.shutdown()
示例#4
0
    def _run_with_checkpoints(self, wf_class, inputs=None):
        finished_steps = {}

        te = TickingEngine()
        fut = te.submit(wf_class, inputs)
        while not fut.done():
            pid = fut.pid
            te.tick()
            finished_steps.update(wf_class.finished_steps)
            # if not fut.done():
            #     te.stop(pid)
            #     fut = te.run_from(storage.load_checkpoint(pid))
        te.shutdown()

        return finished_steps
示例#5
0
    def test_simple_kill_through_process(self):
        """
        Run the workchain for one step and then kill it by calling kill
        on the workchain itself. This should have the workchain end up
        in the ABORTED state.
        """
        engine = TickingEngine()
        future = engine.submit(TestWorkChainAbort.AbortableWorkChain)

        while not future.done():
            engine.tick()
            future.process.abort()

        self.assertEquals(future.process.calc.has_finished_ok(), False)
        self.assertEquals(future.process.calc.has_failed(), False)
        self.assertEquals(future.process.calc.has_aborted(), True)
        engine.shutdown()
示例#6
0
    def test_simple_kill_through_node(self):
        """
        Run the workchain for one step and then kill it by calling kill
        on the underlying WorkCalculation node. This should have the
        workchain end up in the ABORTED state.
        """
        engine = TickingEngine()
        future = engine.submit(TestWorkChainAbortChildren.MainWorkChain, {'kill': Bool(True)})

        while not future.done():
            engine.tick()

        child = future.process.calc.get_outputs(link_type=LinkType.CALL)[0]
        self.assertEquals(child.has_finished_ok(), False)
        self.assertEquals(child.has_failed(), False)
        self.assertEquals(child.has_aborted(), True)

        self.assertEquals(future.process.calc.has_finished_ok(), False)
        self.assertEquals(future.process.calc.has_failed(), False)
        self.assertEquals(future.process.calc.has_aborted(), True)
        engine.shutdown()
示例#7
0
 def setUp(self):
     super(TestTickingEngine, self).setUp()
     self.assertEquals(len(util.ProcessStack.stack()), 0)
     self.ticking_engine = TickingEngine()
     self.executor = ThreadPoolExecutor(max_workers=1)
示例#8
0
 def setUp(self):
     self.ticking_engine = TickingEngine()
     self.executor = ThreadPoolExecutor(max_workers=1)