Nextdoor / ndscheduler

A flexible python library for building your own cron-like system, with REST APIs and a Web UI.
BSD 2-Clause "Simplified" License
1.08k stars 202 forks source link

Wrong time #21

Closed balaCode63 closed 6 years ago

balaCode63 commented 7 years ago

When I create a new job in ndscheduler with 10 mins, its not scheduled to run on 10 mins.

Ex:

  1. Consider current system time is 19:21 IST
  2. Create a new job with 30 mins interval
  3. The next time to run should be 19:51 IST. But ndscheduler shows 20:00 IST

Ex2:

  1. Consider current system time is 19:32 IST
  2. create a new job with 9 mins interval
  3. The next time to run should be 19:41 IST. But ndscheduler shows 19:39 IST

My parameters are, Mins hour (UTC) day month day of week /30 *

Please help me to run the scheduler at the desired time. Thanks in advance Bala

bkline commented 7 years ago

As the documentation states, this package provides a "cron-like system to schedule jobs" and cron doesn't work the way you think it does. You might want to start by reading about the semantics of cron expressions. It is possible to manually specify non-default step values using the comma operator. For example, the correct expression for your first example would be:

21,51 * * * *

balaCode63 commented 6 years ago

Thanks @bkline. It works with starttime/interval.

Thanks for the support

bkline commented 6 years ago

Glad I was able to help. Note, however, that there was a typo in my example (fixed now), which wasn't really supposed to be starttime/interval, but instead seconds,seconds,....

balaCode63 commented 6 years ago

Thanks @bkline, I resolved the issue by 21/5. Start @ 21st minute and execute for every 5 minutes.

bkline commented 6 years ago

Interesting. Looks like you figured out something that wasn't described in the documentation to which I linked. Well done!

On Sat, Jul 8, 2017 at 9:24 AM, Balamurugan notifications@github.com wrote:

Thanks @bkline https://github.com/bkline, I resolved the issue by 21/5. Start @ 21st minute and execute for every 5 minutes.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Nextdoor/ndscheduler/issues/21#issuecomment-313855778, or mute the thread https://github.com/notifications/unsubscribe-auth/ABjxRHtEyQ_x2mub8csRBG1Yvb1EaDYjks5sL4MrgaJpZM4OA1Tw .

-- Bob Kline http://www.rksystems.com mailto:bkline@rksystems.com

balaCode63 commented 6 years ago

:)