quantum-elixir / quantum-core

:watch: Cron-like job scheduler for Elixir
https://hexdocs.pm/quantum/
Apache License 2.0
2.32k stars 148 forks source link

How to check when a job will be run next? #419

Closed sheharyarn closed 5 years ago

sheharyarn commented 5 years ago

Pretty much as it says on the can. For example, given a config like this:

config :my_app, MyApp.Cron.Scheduler,
  jobs: [
    {"@hourly", {MyApp.Cron.JobA, :run, []}},
    {"@daily", {MyApp.Cron.JobB, :do_something, []}},
  ]

How can I check when each of the jobs will be run next? Getting the next run datetime for a named job will also be helpful.

maennchen commented 5 years ago

For this you can use crontab directly: https://hexdocs.pm/crontab/Crontab.Scheduler.html#get_next_run_date/3

sheharyarn commented 5 years ago

Ah, I see. I came across the crontab package earlier but didn't realize that's what quantum uses underneath. This is exactly what I needed.

Thanks!