Example #1
0
def test_readd_subtask(app1, job_id1, job_id2):
    # readding the same job twice should result in error and 1 queued job
    tt.validate_zero_queued_task(app1)
    api.readd_subtask(app1, job_id1)
    tt.validate_one_queued_task(app1, job_id1)
    with nt.assert_raises(JobAlreadyQueued):
        api.readd_subtask(app1, job_id1)
    tt.validate_one_queued_task(app1, job_id1)

    # setting task pending but not queueing it.
    api.maybe_add_subtask(app1, job_id2, queue=False)
    tt.validate_one_queued_task(app1, job_id1)
    # then queueing it.
    api.readd_subtask(app1, job_id2)
    tt.validate_n_queued_task(app1, job_id1, job_id2)
Example #2
0
def test_readd_subtask(app1, job_id1, job_id2):
    # readding the same job twice should result in error and 1 queued job
    tt.validate_zero_queued_task(app1)
    api.readd_subtask(app1, job_id1)
    tt.validate_one_queued_task(app1, job_id1)
    with nt.assert_raises(JobAlreadyQueued):
        api.readd_subtask(app1, job_id1)
    tt.validate_one_queued_task(app1, job_id1)

    # setting task pending but not queueing it.
    api.maybe_add_subtask(app1, job_id2, queue=False)
    tt.validate_one_queued_task(app1, job_id1)
    # then queueing it.
    api.readd_subtask(app1, job_id2)
    tt.validate_n_queued_task(app1, job_id1, job_id2)
Example #3
0
def test_stolos_submit_multiple_jobs(app1, app2, job_id1, job_id2,
                                     tasks_json_tmpfile):
    validate_zero_queued_task(app1)
    validate_zero_queued_task(app2)
    run("stolos-submit -a %s %s -j %s %s" % (app1, app2, job_id1, job_id2),
        tasks_json_tmpfile)
    validate_n_queued_task(app1, job_id1, job_id2)
    validate_n_queued_task(app2, job_id1, job_id2)
    run("stolos-submit -a %s %s -j %s %s" % (app1, app2, job_id1, job_id2),
        tasks_json_tmpfile)
    validate_n_queued_task(app1, job_id1, job_id2)
    validate_n_queued_task(app2, job_id1, job_id2)
Example #4
0
def test_stolos_submit_multiple_jobs(app1, app2, job_id1, job_id2,
                                     tasks_json_tmpfile):
    validate_zero_queued_task(app1)
    validate_zero_queued_task(app2)
    run("stolos-submit -a %s %s -j %s %s" % (app1, app2, job_id1, job_id2),
        tasks_json_tmpfile)
    validate_n_queued_task(app1, job_id1, job_id2)
    validate_n_queued_task(app2, job_id1, job_id2)
    run("stolos-submit -a %s %s -j %s %s" % (app1, app2, job_id1, job_id2),
        tasks_json_tmpfile)
    validate_n_queued_task(app1, job_id1, job_id2)
    validate_n_queued_task(app2, job_id1, job_id2)
Example #5
0
def test_complex_dependencies_readd(depends_on1, depends_on_job_id1,
                                    log, tasks_json_tmpfile):
    job_id = depends_on_job_id1

    # mark everything completed. ensure only last completed parent queues child
    parents = list(api.topological_sort(api.get_parents(depends_on1, job_id)))
    for parent, pjob_id in parents[:-1]:
        qb.set_state(parent, pjob_id, completed=True)
    validate_zero_queued_task(depends_on1)
    qb.set_state(parents[-1][0], parents[-1][1], completed=True)
    validate_one_queued_task(depends_on1, job_id)
    # --> parents should queue our app

    consume_queue(depends_on1)
    qb.set_state(depends_on1, job_id, completed=True)
    validate_one_completed_task(depends_on1, job_id)

    # ok great - ran through pipeline once.
    log.warn("OK... Now try complex dependency test with a readd")
    # re-complete the very first parent.
    # we assume that this parent is a root task
    parent, pjob_id = parents[0]
    qb.readd_subtask(parent, pjob_id)
    validate_one_queued_task(parent, pjob_id)
    validate_zero_queued_task(depends_on1)
    consume_queue(parent)
    qb.set_state(parent, pjob_id, completed=True)
    validate_one_completed_task(parent, pjob_id)
    # since the parent that re-queues children that may be depends_on1's
    # parents, complete those too!
    for p2, pjob2 in api.get_children(parent, pjob_id, False):
        if p2 == depends_on1:
            continue
        consume_queue(p2)
        qb.set_state(p2, pjob2, completed=True)
    # now, that last parent should have queued our application
    validate_n_queued_task(
        depends_on1, job_id,
        job_id.replace('testID1', 'testID3'))  # this replace is a hack
    run_code(log, tasks_json_tmpfile, depends_on1, '--bash_cmd echo 123')
    run_code(log, tasks_json_tmpfile, depends_on1, '--bash_cmd echo 123')
    validate_one_completed_task(depends_on1, job_id)