Skip to content

Commit

Permalink
close worker after job is cancelled
Browse files Browse the repository at this point in the history
  • Loading branch information
sverhoeven committed Feb 29, 2024
1 parent 05e9048 commit 5e18bfd
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions tests/schedulers/test_arq.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def test_has_output(self, completed_job_id: str, job_dir: Path) -> None:


@pytest.mark.anyio
async def test_cancelling_queued_job(
async def test_cancelling_queued_job( # noqa: WPS217
scheduler: ArqScheduler,
tmp_path: Path,
config: ArqSchedulerConfig,
Expand All @@ -135,9 +135,12 @@ async def test_cancelling_queued_job(

await scheduler.cancel(submitted_job_id)

# Run worker as it does aborting
worker = arq_worker(config, burst=True)
await worker.main()
try:
# Run worker as it does aborting
worker = arq_worker(config, burst=True)
await worker.main()

state = await scheduler.state(submitted_job_id)
assert state == "error"
state = await scheduler.state(submitted_job_id)
assert state == "error"
finally:
await worker.close()

0 comments on commit 5e18bfd

Please sign in to comment.