Skip to content

Commit

Permalink
Merge pull request #23 from 0xDEC0DE/issue/20
Browse files Browse the repository at this point in the history
Make the Redis broker clean up aborted jobs
  • Loading branch information
bigjools committed May 2, 2022
2 parents 35d3928 + ace8026 commit 7c8c0c6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion spinach/job.py
Expand Up @@ -189,7 +189,7 @@ def advance_job_status(namespace: str, job: Job, duration: float,
return

if isinstance(err, AbortException):
job.max_retries = 0
job.retries = job.max_retries
logger.error(
'Fatal error during execution of %s after %s, canceling retries',
job, duration, exc_info=err
Expand Down
5 changes: 4 additions & 1 deletion tests/test_job.py
Expand Up @@ -118,10 +118,13 @@ def test_advance_job_status(job):
RetryException('Must retry', at=now))
assert job.status is JobStatus.FAILED

# The job should have retried twice due to previous tests, ensure that
# an AbortException tops off the retry counter
job.status = JobStatus.RUNNING
job.max_retries = 10
assert job.retries == 2
advance_job_status('namespace', job, 1.0, AbortException('kaboom'))
assert job.max_retries == 0
assert job.retries == 10
assert job.status is JobStatus.FAILED


Expand Down

0 comments on commit 7c8c0c6

Please sign in to comment.