Esempio n. 1
0
def test_walked_only_when_all_predecessors_visited(dg):
    dg.add_path(['t1', 't3', 't4', 't5'])
    dg.add_path(['t2', 't3'])

    dg.node['t1']['status'] = 'SUCCESS'
    dg.node['t2']['status'] = 'INPROGRESS'

    assert set(traverse(dg)) == set()

    dg.node['t2']['status'] = 'SUCCESS'

    assert set(traverse(dg)) == {'t3'}
Esempio n. 2
0
 def _next(self, plan):
     tasks = traverse(plan)
     filtered_tasks = list(
         limits.get_default_chain(plan, [
             t for t in plan
             if plan.node[t]['status'] == states.INPROGRESS.name
         ], tasks))
     return filtered_tasks
Esempio n. 3
0
 def _next(self, plan):
     tasks = traverse(plan)
     filtered_tasks = list(limits.get_default_chain(
         plan,
         [t for t in plan
          if plan.node[t]['status'] == states.INPROGRESS.name],
         tasks))
     return filtered_tasks
Esempio n. 4
0
def schedule(plan_uid, dg):
    tasks = traverse(dg)
    limit_chain = limits.get_default_chain(
        dg, [t for t in dg if dg.node[t]['status'] == 'INPROGRESS'], tasks)
    execution = executor.celery_executor(dg,
                                         limit_chain,
                                         control_tasks=('fault_tolerance', ))
    graph.save_graph(dg)
    execution()
Esempio n. 5
0
def schedule(plan_uid, dg):
    tasks = traverse(dg)
    limit_chain = limits.get_default_chain(
        dg,
        [t for t in dg if dg.node[t]['status'] == 'INPROGRESS'],
        tasks)
    execution = executor.celery_executor(
        dg, limit_chain, control_tasks=('fault_tolerance',))
    graph.save_graph(dg)
    execution()
Esempio n. 6
0
def test_node_will_be_walked_if_parent_is_noop(dg):
    dg.add_path(['t1', 't2', 't3', 't4', 't5'])
    dg.node['t1']['status'] = 'NOOP'

    assert set(traverse(dg)) == {'t2'}
Esempio n. 7
0
def test_nothing_will_be_walked_if_parent_is_skipped(dg):
    dg.add_path(['t1', 't2', 't3', 't4', 't5'])
    dg.node['t1']['status'] = 'SKIPPED'

    assert set(traverse(dg)) == set()
Esempio n. 8
0
def test_parallel(dg):
    dg.add_path(['t1', 't3', 't4', 't5'])
    dg.add_path(['t2', 't3'])

    assert set(traverse(dg)) == {'t1', 't2'}