Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set job to failed when task raises and job is aborting (regardless retry) #1133

Merged
merged 2 commits into from
Jul 31, 2024

Conversation

medihack
Copy link
Member

Closes #1131

Successful PR Checklist:

  • Tests
    • (not applicable?)
  • Documentation
    • (not applicable?)

PR label(s):

This time, a job with the status aborting of a task that raises is set to failed (regardless of whether it should be retried or not). It feels a bit more consistent to me, but somehow, there is no optimal way. If we set a to-be-retried job in status aborting to aborted when the task raises, but one to failed that should not be retried, it seems somehow inconsistent to me.

@ewjoachim A note in the documentation is still missing. Just want to hear what you think.

@medihack medihack requested a review from a team as a code owner July 29, 2024 23:15
@github-actions github-actions bot added the PR type: bugfix 🕵️ Contains bug fix label Jul 29, 2024
Copy link

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  procrastinate
  worker.py
Project Total  

This report was generated by python-coverage-comment-action

Copy link
Member

@ewjoachim ewjoachim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's great! I believe there may be a bit of conflict when we merge the worker refactor, though.

Thank you so much for the time you spent and doing it all over again after my comment!

@@ -385,6 +385,7 @@ def job_func(a, b): # pylint: disable=unused-argument
task_name="job",
queue="yay",
)
app.job_manager.get_job_status_async = mocker.AsyncMock(return_value="doing")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just curious: what happens if we don't mock? The InMemory implementation doesn't answer correctly ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'll throw. The job is not put into the worker queue. The run_job method is tested in isolation.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, makes sense!

@medihack
Copy link
Member Author

That's great! I believe there may be a bit of conflict when we merge the worker refactor, though.

@onlyann When I commit this (later today), can you include it in the worker refactoring?

Thank you so much for the time you spent and doing it all over again after my comment!

No prob, the comment was very relevant. And I am happy that we don't need a migration 🙂.

@onlyann
Copy link
Contributor

onlyann commented Jul 31, 2024

That's not a problem, I will resolve the conflict.

I think it's fine to merge this fix but wanted to highlight that there can still be a race condition where the job is changed to "aborting" between the check and the moment the job is set to retry.

Something we can look at improving if we end up removing that extra status in v3

@medihack
Copy link
Member Author

Alright, I will write a note in the documentation, merge it, and make a patch release.

@medihack medihack merged commit 73ba60a into procrastinate-org:main Jul 31, 2024
11 checks passed
@ewjoachim
Copy link
Member

👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR type: bugfix 🕵️ Contains bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Retrying a task, that has been aborted
3 participants