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

    t1.status = 'SUCCESS'
    t2.status = 'INPROGRESS'

    assert set(find_visitable_tasks(dg)) == set()

    t2.status = 'SUCCESS'

    assert set(find_visitable_tasks(dg)) == {t3}
Ejemplo n.º 2
0
def test_node_will_be_walked_if_parent_is_noop(dg, t1, t2, t3, t4, t5):
    dg.add_path([t1, t2, t3, t4, t5])
    t1.status = 'NOOP'

    assert set(find_visitable_tasks(dg)) == {t2}
Ejemplo n.º 3
0
def test_nothing_will_be_walked_if_parent_is_skipped(dg, t1, t2, t3, t4, t5):
    dg.add_path([t1, t2, t3, t4, t5])
    t1.status = 'SKIPPED'

    assert set(find_visitable_tasks(dg)) == set()
Ejemplo n.º 4
0
def test_parallel(dg, t1, t2, t3, t4, t5):
    dg.add_path([t1, t3, t4, t5])
    dg.add_path([t2, t3])

    assert set(find_visitable_tasks(dg)) == {t1, t2}
Ejemplo n.º 5
0
 def _next(self, plan):
     return list(limits.get_default_chain(
         plan,
         [t for t in plan if t.status == states.INPROGRESS.name],
         sorted(find_visitable_tasks(plan),
                key=attrgetter('weight'), reverse=True)))