def test_reset_all_states(simple_plan): for n in simple_plan: n.status == states.ERROR.name graph.reset(simple_plan) for n in simple_plan: assert n.status == states.PENDING.name
def test_reset_resets_times(): g = nx.MultiDiGraph() g.add_node('task1', task=mock.Mock(), status='status', errmsg='', start_time=1, end_time=4) graph.reset(g) assert int(g.node['task1']['start_time']) == 0 assert int(g.node['task1']['start_time']) == 0
def test_reset_all_states(simple_plan): for n in simple_plan: simple_plan.node[n]['status'] == states.ERROR.name graph.reset(simple_plan) for n in simple_plan: assert simple_plan.node[n]['status'] == states.PENDING.name
def test_reset_all_states(simple): for n in simple: simple.node[n]["status"] == states.ERROR.name graph.reset(simple) for n in simple: assert simple.node[n]["status"] == states.PENDING.name
def test_reset_only_provided(simple_plan): simple_plan.node['just_fail']['status'] = states.ERROR.name simple_plan.node['echo_stuff']['status'] = states.SUCCESS.name graph.reset(simple_plan, [states.ERROR.name]) assert simple_plan.node['just_fail']['status'] == states.PENDING.name assert simple_plan.node['echo_stuff']['status'] == states.SUCCESS.name
def test_reset_only_provided(simple): simple.node["just_fail"]["status"] = states.ERROR.name simple.node["echo_stuff"]["status"] = states.SUCCESS.name graph.reset(simple, [states.ERROR.name]) assert simple.node["just_fail"]["status"] == states.PENDING.name assert simple.node["echo_stuff"]["status"] == states.SUCCESS.name
def test_reset_resets_times(): g = nx.MultiDiGraph() task = mock.Mock( name='task1', status='status', errmsg='', start_time=1, end_time=4) g.add_node(task) graph.reset(g) for n in g.nodes(): assert n.start_time == 0
def test_reset_only_provided(simple_plan): for n in simple_plan.nodes(): if n.name == 'just_fail': n.status = states.ERROR.name elif n.name == 'echo_stuff': n.status = states.SUCCESS.name graph.reset(simple_plan, [states.ERROR.name]) for n in simple_plan.nodes(): if n.name == 'just_fail': assert n.status == states.PENDING.name elif n.name == 'echo_stuff': assert n.status == states.SUCCESS.name
def reset(uid): graph.reset(uid)
def restart(uid): graph.reset(uid) tasks.schedule_start.apply_async(args=[uid], queue='scheduler')
def retry(uid): graph.reset(uid, ['ERROR']) tasks.schedule_start.apply_async(args=[uid], queue='scheduler')
def resume(uid): graph.reset(uid, ['SKIPPED']) tasks.schedule_start.apply_async(args=[uid], queue='scheduler')