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

Class method to process crontab string #8250

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

padgy
Copy link

@padgy padgy commented May 14, 2023

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.

@codecov
Copy link

codecov bot commented May 15, 2023

Codecov Report

Attention: Patch coverage is 50.00000% with 2 lines in your changes missing coverage. Please review.

Project coverage is 77.79%. Comparing base (54f3824) to head (8113e5a).
Report is 1 commits behind head on main.

Files Patch % Lines
celery/schedules.py 50.00% 2 Missing ⚠️
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              
Flag Coverage Δ
unittests 77.77% <50.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@auvipy auvipy left a 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

@stumpylog
Copy link
Contributor

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.

@auvipy
Copy link
Member

auvipy commented Jun 7, 2023

we need proper unit tests for considering that, also wait for feedback from more users

@Nusnus Nusnus self-requested a review June 16, 2023 00:29
Copy link

@jayeff jayeff left a 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

celery/schedules.py Outdated Show resolved Hide resolved
Co-authored-by: Johannes Faigle <jo-f@gmx.at>
@auvipy
Copy link
Member

auvipy commented May 26, 2024

@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

sorry for the late response. Please give it a shot if you can!

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

5 participants