aviraj

aviraj

Deactivating quantum jobs

I have some quantum jobs configured as part of the elixir configuration

{‘MyJobs.Scheduler’,
[{timeout,10000},
{global,true},
{jobs,
[{post_schedule,
[{schedule,<<“10 7 * * *”>>},
{task,
{‘Post.PostSchedule’,
post_schedules,}}]},
{job_schedule,
[{schedule,<<“1 3 * * *”>>},
{task,
{‘Post.Reminders’,
post_reminders,}}]}]}]}

This is deployed on a server and all jobs run as per schedule. My requirement is to disable/deactivate these jobs on the server without doing a re-deployment of code. I have tried modifying the config file to remove this entire section from the config file, but even after restarting the server and starting the application again, it still runs the jobs at the scheduled times. Does quantum job scheduler pick the job configuration from some other location apart from the config files. Is it possible to stop/deactivate the jobs by making a configuration change or from the command line?

First Post!

derek-zhou

derek-zhou

I am not familiar with quantum per se, but i suspect you hit a typical newbie problem like most of us encountered at some stage.
Whatever you put in config/config.exs are compile time config. What you want here is run time config, which you need to fetch the config data yourself, call whatever api yourself.

Last Post!

hassanRsiddiqi

hassanRsiddiqi

you can always activate and deactivate jobs runtime on server, YourApp.Scheduler.deactivate_job(:ticker) or YourApp.Scheduler.activate_job(:ticker) Only thing you need, is to set the name of your job.

YourApp.Scheduler.new_job()
|> Quantum.Job.set_name(:ticker)
|> Quantum.Job.set_schedule(~e[1 * * * *])
|> Quantum.Job.set_task(fn -> :ok end)
|> YourApp.Scheduler.add_job()

Or from config you can set this way,

config :your_app, YourApp.Scheduler,
  jobs: [
    news_letter: [
      schedule: "@weekly",
      task: {Heartbeat, :send, [:arg1]},
    ]
  ]

more

Where Next?

Popular in Questions Top

vegabook
I’m brand new to Phoenix and I have stripped one of the demo applications to the bone. I just want to get an svg up on the screen. Here i...
New
ashish173
I am using Ecto timestamps with postgres, I can see the timestamps() use the :naive_dateime but for my use case I wanted to store the ti...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
siddhant3030
Hi, I have to write a raw query for one of my project. But till now I have used ecto queries and don’t have much experience writing raw ...
New
marius95
Hello everyone, I try to use an Javascript Event Handler in my root.html.leex file. Therefore I created a function in the app.js file: ...
New

Other popular topics Top

JeremM34
Hello, how can I check the Phoenix version ? Thanks !
New
grych
Hi folks, Few months ago I have announced the proof-of-concept of the library to manipulate the browsers DOM objects directly from Elixi...
639 54260 488
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" =&gt; #BSON.ObjectId&lt;58eb1a7a9ad169198c3dXXXX&gt;, "email" =&gt; ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID&lt;0.412.0&gt; terminating ** (Postgrex.Error) FATAL...
New
senggen
Erlang/OTP 25 [erts-13.2.2] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:1] 15:22:35.803 [error] gen_event {lager_file_backend...
New

We're in Beta

About us Mission Statement