Ejemplo n.º 1
0
def test_job_configuration__shuffle_jobs(job_fixture):
    num_jobs = 10
    with open(TEST_FILENAME, "w") as f_out:
        for i in range(num_jobs):
            f_out.write("echo hello world\n")

    inputs = GenericCommandInputs(TEST_FILENAME)
    config = GenericCommandConfiguration(job_inputs=inputs)
    for job_param in inputs.iter_jobs():
        config.add_job(job_param)
    assert config.get_num_jobs() == num_jobs
    assert [x.name for x in config.iter_jobs()] == [str(x) for x in range(1, num_jobs + 1)]
    config.shuffle_jobs()
    assert [x.name for x in config.iter_jobs()] != [str(x) for x in range(1, num_jobs + 1)]
Ejemplo n.º 2
0
def test_sorted_order(generic_command_fixture):
    with open(TEST_FILENAME, "w") as f_out:
        pass

    config = GenericCommandConfiguration()
    num_jobs = 20
    for i in range(num_jobs):
        job = GenericCommandParameters(command="echo hello")
        config.add_job(job)

    assert config.get_num_jobs() == num_jobs

    job_ids = [job.job_id for job in config.iter_jobs()]
    assert job_ids == list(range(1, num_jobs + 1))