-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
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
Class method to process crontab string #8250
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8250 +/- ##
==========================================
- Coverage 77.80% 77.79% -0.01%
==========================================
Files 150 150
Lines 18680 18684 +4
Branches 3192 3193 +1
==========================================
+ Hits 14534 14536 +2
- Misses 3854 3856 +2
Partials 292 292
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to know more context and examples and unit tests for the proposed change
I can give at least one example where this would be useful. In paperless-ngx, the user is able to control the timing of tasks by providing a cron expression to overwrite the default scheduling. We manually process what they give us here to create a celery crontab to configure celery beat. Having a convenient method built in (and tested by) celery would be useful for us as a celrey beat user. |
we need proper unit tests for considering that, also wait for feedback from more users |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I too think having a convenience method to get a crontab
from a cron expression would be helpful in cases where you use configration (e.g. enviroment variable) to define a schedule for some tasks. We use this quite a lot to have different schedules for different runtime enviroments
I would suggest to use the official cron format though as per suggestion
@auvipy In case you give a go ahead I could update the format and add some unit tests to this PR so that it can be merged
Co-authored-by: Johannes Faigle <jo-f@gmx.at>
sorry for the late response. Please give it a shot if you can! |
Convenience method for creating a crontab object from a string. Many configurations in systems are written as a cron string, so adding a helper function for this would make reading schedules easier.