From 273b388d8e15b7e4acdba806e0708228b9a11a4d Mon Sep 17 00:00:00 2001 From: Matthew Evans Date: Wed, 1 Nov 2023 16:57:14 +0000 Subject: [PATCH] Add 'real' use case tests that currently fail --- tests/integration/test_slurm.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/tests/integration/test_slurm.py b/tests/integration/test_slurm.py index ede4293e..e5d82f75 100644 --- a/tests/integration/test_slurm.py +++ b/tests/integration/test_slurm.py @@ -43,13 +43,14 @@ def test_lpad(fw_lpad): @pytest.mark.parametrize("worker", ["test_local_worker", "test_remote_worker"]) -def test_submit_flow(runner, fw_lpad, worker): +def test_submit_flow(fw_lpad, worker): from jobflow import Flow from jobflow_remote import submit_flow from jobflow_remote.testing import add + from jobflow_remote.jobs.runner import Runner - count = fw_lpad.get_fw_ids(count_only=True) + count = fw_lpad.get_fw_ids({"state": "COMPLETED"}, count_only=True) add_first = add(1, 5) add_second = add(add_first.output, 5) @@ -57,17 +58,21 @@ def test_submit_flow(runner, fw_lpad, worker): flow = Flow([add_first, add_second]) submit_flow(flow, worker=worker) - new_count = fw_lpad.get_fw_ids(count_only=True) + runner = Runner() + runner.tick_delay = 0.2 + runner.run(ticks=100) + new_count = fw_lpad.get_fw_ids({"state": "COMPLETED"}, count_only=True) assert new_count == count + 2 @pytest.mark.parametrize("worker", ["test_local_worker", "test_remote_worker"]) -def test_submit_flow_with_dependencies(runner, fw_lpad, worker): +def test_submit_flow_with_dependencies(fw_lpad, worker): from jobflow import Flow from jobflow_remote import submit_flow from jobflow_remote.testing import add, write_file + from jobflow_remote.jobs.runner import Runner count = fw_lpad.get_fw_ids(count_only=True) add_parent_1 = add(1, 1) @@ -78,5 +83,9 @@ def test_submit_flow_with_dependencies(runner, fw_lpad, worker): flow = Flow([add_parent_1, add_parent_2, add_children, write]) submit_flow(flow, worker=worker) + runner = Runner() + runner.tick_delay = 0.2 + runner.run(ticks=10) + new_count = fw_lpad.get_fw_ids(count_only=True) assert new_count == count + 4