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

Is it possible to support cron divisions? #1

Closed
tcql opened this issue Sep 30, 2017 · 2 comments
Closed

Is it possible to support cron divisions? #1

tcql opened this issue Sep 30, 2017 · 2 comments

Comments

@tcql
Copy link

tcql commented Sep 30, 2017

In true cron, to schedule something bi-hourly, you'd set the hours column to "*/2"

As far as I can tell, in ananas, the only way to do it is by setting

@schedule(hour=2)
@schedule(hour=4)
@schedule(hour=6)
@schedule(hour=8)
# etc...

or by using an interval of 3600*2

It'd be nice if ananas could support either */2 syntax, or at least passing lists so you could supply the hours in one statement like:

@schedule(hour=[hour for hour in range(0, 24, 2)])
@fwenzel
Copy link

fwenzel commented Jun 2, 2018

FWIW, no need for the list comprehension there. range just returns a list (or a generator in Python 3).

Seems easy to add.

@chr-1x
Copy link
Owner

chr-1x commented Jul 31, 2018

This is now supported as of 1.0.0b15, both with the cron syntax and with a list comprehension (or any other iterable, for that matter):

@schedule(hour="*/3", minute="*/10")
def foo(...):
   ...

The above snippet will cause foo to be run every 10 minutes on hours which are multiples of 3

If any additional cron features are desired please open a new issue!

@chr-1x chr-1x closed this as completed Jul 31, 2018
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

No branches or pull requests

3 participants