Skip to content

Commit

Permalink
Unify test cases for remote/local workers in case of failure
Browse files Browse the repository at this point in the history
  • Loading branch information
ml-evs committed Jan 12, 2024
1 parent ecdb141 commit 64117bc
Showing 1 changed file with 17 additions and 13 deletions.
30 changes: 17 additions & 13 deletions tests/integration/test_slurm.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ def test_project_check(job_controller):
assert check(print_errors=True) is None


@pytest.mark.parametrize("worker", ["test_local_worker", "test_remote_worker"])
@pytest.mark.parametrize(
"worker",
["test_local_worker", "test_remote_worker"],
)
def test_submit_flow(worker, job_controller):
from jobflow import Flow

Expand All @@ -39,7 +42,10 @@ def test_submit_flow(worker, job_controller):
assert job_controller.count_flows({}) == 1


@pytest.mark.parametrize("worker", ["test_local_worker", "test_remote_worker"])
@pytest.mark.parametrize(
"worker",
["test_local_worker", "test_remote_worker"],
)
def test_submit_flow_with_dependencies(worker, job_controller):
from jobflow import Flow

Expand All @@ -63,7 +69,10 @@ def test_submit_flow_with_dependencies(worker, job_controller):
assert job_controller.count_flows({}) == 1


@pytest.mark.parametrize("worker", ["test_local_worker", "test_remote_worker"])
@pytest.mark.parametrize(
"worker",
["test_local_worker", "test_remote_worker"],
)
def test_expected_failure(worker, job_controller):
from jobflow import Flow

Expand All @@ -78,17 +87,12 @@ def test_expected_failure(worker, job_controller):
flow = Flow([job_1, job_2])
submit_flow(flow, worker=worker)

runner = Runner()
runner.run(ticks=10)

assert job_controller.count_jobs({}) == 2
assert len(job_controller.get_jobs({})) == 2
assert job_controller.count_flows({}) == 1

if worker == "test_local_worker":
assert job_controller.count_jobs(state=JobState.FAILED) == 2
assert job_controller.count_flows(state=FlowState.FAILED) == 1
else:
# The remote flow will be left in a running state until the remote errors can be rectified
assert job_controller.count_jobs(state=JobState.REMOTE_ERROR) == 2
assert job_controller.count_flows(state=FlowState.RUNNING) == 1
runner = Runner()
runner.run(ticks=10)

assert job_controller.count_jobs(state=JobState.FAILED) == 2
assert job_controller.count_flows(state=FlowState.FAILED) == 1

0 comments on commit 64117bc

Please sign in to comment.