Пример #1
0
def test_worker_estimate_earliest_time_offset_now():
    tg = TaskGraph()
    t0 = tg.new_task(expected_duration=3, cpus=1)
    t1 = tg.new_task(expected_duration=5, cpus=1)
    t2 = tg.new_task(expected_duration=3, cpus=2)

    worker = Worker(cpus=2)
    worker.assignments = [
        TaskAssignment(worker, t0),
        TaskAssignment(worker, t1)
    ]
    worker.running_tasks[t0] = RunningTask(t0, 0)
    worker.running_tasks[t1] = RunningTask(t1, 0)

    assert worker_estimate_earliest_time(worker, t2, 2) == 3
Пример #2
0
def test_worker_estimate_earliest_time():
    tg = TaskGraph()
    t0 = tg.new_task(expected_duration=3, cpus=2)
    t1 = tg.new_task(expected_duration=5, cpus=1)
    t2 = tg.new_task(expected_duration=4, cpus=3)
    t4 = tg.new_task(expected_duration=4, cpus=2)
    t5 = tg.new_task(expected_duration=4, cpus=2)

    worker = Worker(cpus=4)
    worker.assignments = [
        TaskAssignment(worker, t0),
        TaskAssignment(worker, t1),
        TaskAssignment(worker, t2),
        TaskAssignment(worker, t4)
    ]
    worker.running_tasks[t0] = RunningTask(t0, 0)
    worker.running_tasks[t1] = RunningTask(t1, 0)

    assert worker_estimate_earliest_time(worker, t5, 0) == 7