-
Notifications
You must be signed in to change notification settings - Fork 1.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
pass day_or croniter argument to CronClock & CronSchedule #3612
Conversation
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.
Thanks @sp1thas. Looking at the croniter
docs, it looks like the only kwarg to croniter
that it makes sense for us to expose is day_or
- perhaps adding that as a top-level kwarg to CronClock
/CronSchedule
would make more sense than exposing all of cron-iter's kwargs?
Other than that, this seems fine to me. cc'ing @cicdw for a 2nd glance-over just to be sure (schedules also need to be supported by cloud
, so there's some extra nuance here when making changes to them).
Yup this can be supportable by Cloud (once the serializer changes have been released) with no additional work needed as all of the work is handled by the (de)serialization of the schedule / clock itself. I think I agree with you @jcrist that |
Co-authored-by: Jim Crist-Harif <jcrist@users.noreply.github.com>
Co-authored-by: Jim Crist-Harif <jcrist@users.noreply.github.com>
Co-authored-by: Jim Crist-Harif <jcrist@users.noreply.github.com>
Co-authored-by: Jim Crist-Harif <jcrist@users.noreply.github.com>
…ss-croniter-kwargs
…o pass-croniter-kwargs
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.
Thanks! This looks good to me.
Summary
The purpose of this PR is to allow to
day_or
croniter onCronClock
andCronSchedule
instantiation.Changes
This PR changes the
CronClockSchema
andCronScheduleSchema
by adding the newday_or
field.day_or
has been added toCronClock.__init__
andCronSchedule
. Some tests for have also been added.Importance
This change makes every cron clock more configurable, therefore, the whole procedure of scheduling can become more flexible.
This PR was inspired by the following case:
Let's suppose that we have a scheduler with multiple clocks. We want to add a clock that creates events every first Thursday of the month, this periodicity can be achived by this cron:
0 0 1-7 * 4
.Unfortunately, this cron will not work out of the box:
because of legacy/problematic behavior: so link.
To fix this issue,
day_or=False
should be pass on initialization.Checklist
This PR:
changes/
directory (if appropriate)docs/outline.toml
for API reference docs (if appropriate)