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

Feature to exclude future jobs from queue depth #68

Conversation

George9Waller
Copy link
Contributor

New feature: exclude_future_jobs for get_queue_depths

When using get_queue_depths to get the queue depth health for metrics and health it includes all READY/NEW jobs regardless of run_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 a run_after and it is in the future are ignored. This is available both via the model API and through the queue_depth management command.

To maintain existing compatability this is optional and by default continues to use existing behaviour.

New arg exclude_future_jobs filters the READY and NEW jobs to only be ones without a run_after or the run_after is now/in the past
The queue_depth command can call get_queue_depths with the option to exclude jobs in the future
Copy link
Member

@j4mie j4mie left a comment

Choose a reason for hiding this comment

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

Nice, thank you! Arguably this should be the default behaviour (this was definitely an oversight) but let's merge this as-is so we don't need a major version bump, and consider reversing the default in a future version.

@j4mie j4mie merged commit 2fc1b10 into dabapps:master Feb 25, 2025
33 checks passed
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.

2 participants