Need help with understanding Quantum Scheduler tasks run time?

I have a quantum scheduler setup with jobs that need to be run on a monthly basis. I deployed my code to production today. Will the job run after a month now? or on the 30th of this month?

Totally depends. How have you set up the job?

That’s how setup scheduler:

 def start(_type, _args) do
   import Supervisor.Spec, warn: false

   children = [
     worker(ModuleName.Scheduler, [])

   SystemVariables.set_variables_from_system(:module_name, @env_vars)

   opts = [strategy: :one_for_one, name: ModuleName.Supervisor]
   Supervisor.start_link(children, opts)

That’s how I set up jobs:

config:module_name, ModuleName.Scheduler,
global: true,
jobs: [
{"@daily", {ModuleName.Module1, :module1_method, []}},
{"@daily", {ModuleName.Module2, :module_2_method, []}},
{"@daily", {ModuleName.Module3, :module_3_moethod, []}},
{"@daily", {ModuleName.Module4, :module_4_method, []}},
{"@daily", {ModuleName.Module5, :module_5_method, []}},
{"@daily", {ModuleName.Module6, :module_6_mothod, []}},
{"@monthly", {ModuleName.Module7, :module_7_method, []}}

@daily and @monthly are interpreted as ~e["0 0 * * *"] and ~e["0 0 1 * *"] respectively according to the special expression docs.

Meaning @daily means every day at hour 0 and minute 0, while @monthly means every month at day 1, hour 0, minute 0.

So it basically means, the task will run in the next 24 hours, depending on the timezone the servers clock is set to.

So, if i deploy on 2nd Oct, then it will run for the first time on 1st November? I want it to run once before running on 1st November.

Then you’ll probably need to run it manually once.

1 Like

Yes, that’s the only solution. Thanks for help!