Skip to content

Commit

Permalink
Test num_cpu from Realization to driver
Browse files Browse the repository at this point in the history
This is untested for job.py/scheduler.py, while an analogue for it
exists in the job_queue_node tests.
  • Loading branch information
berland committed Jun 17, 2024
1 parent 054d9aa commit 4ebe463
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/unit_tests/scheduler/test_job.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,26 @@ async def test_job_run_sends_expected_events(
assert scheduler.driver.submit.call_count == max_submit


@pytest.mark.usefixtures("use_tmpdir")
@pytest.mark.asyncio
async def test_num_cpu_is_propagated_to_driver(realization: Realization):
realization.num_cpu = 8
scheduler = create_scheduler()
job = Job(scheduler, realization)
job_run_task = asyncio.create_task(job.run(asyncio.Semaphore(), max_submit=1))
job.started.set()
job.returncode.set_result(0)
await job_run_task
scheduler.driver.submit.assert_called_with(
realization.iens,
realization.job_script,
realization.run_arg.runpath,
name=realization.run_arg.job_name,
runpath=Path(realization.run_arg.runpath),
num_cpu=8,
)


@pytest.mark.asyncio
async def test_when_waiting_for_disk_sync_times_out_an_error_is_logged(
realization: Realization, monkeypatch
Expand Down

0 comments on commit 4ebe463

Please sign in to comment.