Need help with Quantum


I can’t get Quantum to work. It does not execute my “cron job”.

I’m using v2.0.0

Below are relevant code bits.


  def start(_type, _args) do
    import Supervisor.Spec, warn: false
    # ....
    children = [
     worker(EbssUtbuSyncer.Scheduler, []),
  # ....  


defmodule EbssUtbuSyncer.Scheduler do
  @moduledoc """
  Cronjob like scheduler for this application.
  use Quantum.Scheduler,
    otp_app: :ebss_utbu_syncer


config :ebss_utbu_syncer, EbssUtbuSyncer.Scheduler,
  jobs: [
    # Every day
    {"@daily", {EbssUtbuSyncer.Engine, :start}}

It does not execute EbssUtbuSyncer.Engine.start.
Yet if I login with --remsh to the application and run EbssUtbuSyncer.Engine.start manualy - all works fine.
I can see (with :observer) that EbssUtbuSyncer.Scheduler is started and has two workers: Runner and Task.Supervisor.

What am I missing?

Maybe a stupid question, but have you checked at midnight? Isn’t “@daily” at 00:00?

Best regards,

Yes it is and yes I did.
This application is supposed to sync some databases once a month (Engine.start() checks if sync is needed). So it was running for a month+few days before I’ve noticed that Quantum isn’t working.
Since all my tests passes I just configured Quantum, deployed it and forgot :slight_smile:

How do you actually start the supervisor?


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

in application.ex

And you do not fiddle around with children in between? can you show us the full code of your application Start?

Sure, here is full application.ex

defmodule EbssUtbuSyncer.Application do
  # See
  # for more information on OTP Applications
  @moduledoc false

  use Application

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

    # Define workers and child supervisors to be supervised
    children = [
      # Starts a worker by calling: EbssUtbuSyncer.Worker.start_link(arg1, arg2, arg3)
      # worker(EbssUtbuSyncer.Worker, [arg1, arg2, arg3]),
      supervisor(EbssUtbuSyncer.Repo.Utbu, [], restart: :temporary),
      supervisor(EbssUtbuSyncer.Repo.Ebss, [], restart: :temporary),
      worker(EbssUtbuSyncer.Scheduler, []),

    # See
    # for other strategies and supported options
    opts = [strategy: :one_for_one, name: EbssUtbuSyncer.Supervisor]
    Supervisor.start_link(children, opts)

Also here is a screenshot from :observer.start (Applications):

Your screenshot produces that the workers init function has been called. It has spawned some own child processes…

And also I misread parts of your problem… It’s that your task has not been started and not the supervisor… Should have taken more time to read in the busses…

Try using a full MFA-tuple here. ({EbssUtbuSyncer.Engine, :start, []})

This exactly.

Yes, that was it. Thanks!

Can you please check if you got any logged errors when you expected your jobs to run or if they failed silently? Or if you get a warning/error when starting the Quantum-Supervisor?

If there is no warning, I’d suggest to file a bugreport at to encourage a sanity checking of the configured jobs at startup.

I’m not sure were to look for logs (this is my first elixir project).
I did look into project_dir/var/logs/erlang.log.x (on production machine), but there are no related errors.

Also, when I try to start the application on development machine without MFA tuple - it does not start (gives “no matching function” error). So yeah, quantum gives error when starting Quantum Supervisor with wrong configuration.

P.s. I’ve deployed application with edelivery.

1 Like