aviraj

aviraj

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?

Showing Posts 1 to 3

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.

aviraj

aviraj OP

Thanks for the response. Yes, I am aware of the compile time config. This is a production system and right now we cannot do a deployment. When the application is launched, it picks the config file from a specified location

/xyz/beam -config /opt/config/sys.config

The point is, this config file is read every time and it is editable. I am able to change the pool_timeout values in the configuration file and it applies when the application is restarted. However the changes made to scheduled jobs do not apply. I want to know if there is any way to stop scheduled jobs either by adding something additional to the config files or from the iex command line on the server

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

— All posts loaded —

Where Next? Top

Trending in Questions Top

Blokh
Hey guys, I’ve got a huge CSV ( around 10 GB ) that needs to be processed hourly Do you guys have any suggestions what is the best prac...
New
kszambelanczyk
Hello! Could someone please give me a help/sample code, how to delete a file from s3 using waffle/waffle_ecto from Phoenix app. I creat...
New
Onor.io
I have what I’ve heard referred to as a “lookup table” in my database. This is a way of assigning codes to common values. One common lo...
New
Trolleger
What approach to take when sending live updates to “random” users Hi! I have a question, I have a little chat app, and when I create a DM...
New
matt-savvy
Anyone here using Honeybadger? My Honeybadger account is being overwhelmed with noise from some bots. Seeing a lot of Bandit.HTTPError...
New
RemyXRenard
I’m seeing that a list inside a Kino.DataTable will be interpreted as a charlist, even if the Kino.configure() is set to charlists: :as_l...
New
samoloth
Hi, I’ve just set up an application with ash_authentication. There is only magic link strategy for now, so there is no confirmation add o...
New

Other Trending Topics Top

mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
garrison
Hobbes is a low-level distributed database for the Elixir programming language. Hobbes provides a simple, safe, and scalable storage lay...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge &amp; Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
wintermeyer
There are three potential reasons for members of this forum to have a look at https://vutuv.de You are tired or annoyed of LinkedIn. Yo...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews