Feature to exclude future jobs from queue depth #68
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New feature:
exclude_future_jobs
forget_queue_depths
When using
get_queue_depths
to get the queue depth health for metrics and health it includes all READY/NEW jobs regardless ofrun_after
. This is artificially inflating the depth for our use case where many jobs are being created to run at a time in the future and are not really contributing to the current queue backlog.As an option to handle this, in this PR I have added a kwarg
exclude_future_jobs
which applies a filter to the jobs contributing to the queue depth count where jobs with arun_after
and it is in the future are ignored. This is available both via the model API and through thequeue_depth
management command.To maintain existing compatability this is optional and by default continues to use existing behaviour.