-
Notifications
You must be signed in to change notification settings - Fork 714
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
Cron trigger support for step values greater than the maximum #509
Comments
I don't know about Vixie, but AFAIK |
*/90 runs the job every 90 minutes which is useful. |
OK, it's not mentioned in the vixie crontab man page, and both wikipidia and chatgpt say otherwise, but they are both often wrong. Since aps is stateful, it makes perfect sense to support it. |
Indeed. I discovered this behavior when I migrated a production workload from vixie cron to apscheduler, keeping the crontab entries intact. One of them failed because it relied on this (apparently undocumented) behavior |
This is not trivial to implement, but if somebody comes up with a PR that includes updated tests and documentation, I'm willing to consider it. |
How about something similar to AllTrigger from 3.x, substituting fields for combined triggers: min_time = last_fire_time+1 second # the minimum resolution
for _ in range(max_iterations):
next_times = [field.next_value(min_time) for field in self.fields]
max_time = max(next_times)
if min(next_times) == max_time:
min_time = max_time
break
else:
return None
return max_time Every field returns min_value if it matches its expression, or the next smallest time that does. For expression * * 1 ... For expression with day_of_month and day_of_week, it will iterate over days until it finds the right date.
|
Is your feature request related to a problem? Please describe.
I recently migrated a workload from Vixie cron to APScheduler, and discovered that the cron trigger only supports a subset of the Vixie crontab format.
Specifically, we had a couple of jobs configured with
*/60 * * * *
to run every 60 minutes. I assume this is equivalent to0 * * * *
. cron accepted this, but APScheduler rejects it:apscheduler/apscheduler/triggers/cron/expressions.py
Line 34 in d10f202
That particular example isn't that useful, but it turns out that things like
*/90 * * * *
are also allowed.Describe the solution you'd like
It would be nice to support this in APScheduler for greater compatibility with cron.
The text was updated successfully, but these errors were encountered: