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

Add attempt_count to limit the number of times a filed task will be re-attempted #466

Merged
merged 7 commits into from Aug 15, 2020

Conversation

timomeara
Copy link
Contributor

Limit the number of retries for a failed task.

  • add attempt_count = models.IntegerField(default=0) to Task model
  • add attempt_count to configuration
  • check value in cluster.save_task and acknowledge the task when attempt_count is > 0 and task.attempt_count == Conf.ATTEMPT_COUNT

@codecov-commenter
Copy link

codecov-commenter commented Aug 11, 2020

Codecov Report

Merging #466 into master will increase coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #466      +/-   ##
==========================================
+ Coverage   91.03%   91.18%   +0.15%     
==========================================
  Files          46       47       +1     
  Lines        3022     3051      +29     
==========================================
+ Hits         2751     2782      +31     
+ Misses        271      269       -2     
Impacted Files Coverage Δ
django_q/tests/test_admin.py 100.00% <ø> (ø)
django_q/admin.py 98.14% <100.00%> (ø)
django_q/cluster.py 92.20% <100.00%> (+0.50%) ⬆️
django_q/conf.py 73.45% <100.00%> (+0.23%) ⬆️
django_q/migrations/0013_task_attempt_count.py 100.00% <100.00%> (ø)
django_q/models.py 98.22% <100.00%> (+0.01%) ⬆️
django_q/tests/test_cluster.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 07d0a8c...655f0aa. Read the comment docs.

@Koed00
Copy link
Owner

Koed00 commented Aug 12, 2020

I'll review this in the next days. but I see you've been adding some more commits. Should I postpone reviewing it?

@timomeara
Copy link
Contributor Author

I'll review this in the next days. but I see you've been adding some more commits. Should I postpone reviewing it?

cool!
no, no need to wait. that was me being stupid. i was playing w/ something else on the wrong branch.
that commit is reverted.

django_q/admin.py Outdated Show resolved Hide resolved
Copy link
Owner

@Koed00 Koed00 left a comment

Choose a reason for hiding this comment

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

Looks good. Thanks for the work on this. It was never on my priority list cause all the brokers I work with have their own max retry setting independent of django-q.

For now I would remove the attempt count from the fail admin, until at some point we have individual attempt counts per task.

@timomeara
Copy link
Contributor Author

Looks good. Thanks for the work on this. It was never on my priority list cause all the brokers I work with have their own max retry setting independent of django-q.

For now I would remove the attempt count from the fail admin, until at some point we have individual attempt counts per task.

thanks-
i'll push that in a few
i added it to the admin because i thought it'd be useful in setups that have high attempt_count and retry values.
maybe a little addition to the readme that shows how to customize the admin would be nice

@Koed00
Copy link
Owner

Koed00 commented Aug 13, 2020 via email

@timomeara timomeara requested a review from Koed00 August 13, 2020 16:59
@Koed00 Koed00 merged commit 80aa160 into Koed00:master Aug 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants