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

It seems to trigger every day regardless of the cron day range #17

Closed
amanica opened this issue Dec 29, 2024 · 2 comments
Closed

It seems to trigger every day regardless of the cron day range #17

amanica opened this issue Dec 29, 2024 · 2 comments

Comments

@amanica
Copy link

amanica commented Dec 29, 2024

Hi,
I'm using version 0.10.7
and it seems that no matter what day I specify (0,1,2,4) it happily triggers today which is a Monday for me:

using JobSchedulers
@show cron = Cron(0, *, *, *, *, 4)
until = Minute(5)
recurring_job = submit!(cron = cron, until = until) do
    println("hi, $(cron), $(now())")
end

cron = Cron(0, *, *, *, *, 4) = Cron(0x0000000000000001, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0000000000000010)
Job:
  id            → 7978603201232900
  name          → ""
  user          → ""
  ncpu          → 1.0
  mem           → 0 B
  schedule_time → 01:45:00
  submit_time   → 01:44:38
  start_time    → na
  stop_time     → na
  wall_time     → 1 year
  cron          → Cron(every minute at 0 second on Thu)
  until         → 01:49:38
  state         → :queuing
  priority      → 20
  dependency    → []
  task          → Task
  stdout        → ""
  stderr        → ""


julia> hi, Cron(0x0000000000000001, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0000000000000010), 2024-12-30T01:45:00.073
@cihga39871
Copy link
Owner

Thank you for reporting this. I will take a look when I come back from vacation.

@cihga39871
Copy link
Owner

Hello @amanica ,

This issue was fixed in v0.11.

The bug was there because the implementation of Cron was different from Linux's Crontab. In your case, it takes union of month-day and day-of-week, which is weird for someone who's familiar with crontab.

In v0.11, I rewrote the implementation of Cron based on Linux's crontab. Your example works well. Also, the documentation of Cron is more straightforward:

Jobs are executed when the second, minute, hour and month fields match the current time. If neither day_of_month nor day_of_week starts with *, cron takes the union (∪) of their values day_of_month ∪ day_of_week. Otherwise cron takes the intersection (∩) of their values day_of_month ∩ day_of_week.

Thank you for supporting JobSchedulers.

Eric

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

2 participants