helen v0.0.3 Helen.Scheduler View Source

Defines a quantum Scheduler.

When used, the quantum scheduler expects the :otp_app as option. The :otp_app should point to an OTP application that has the quantum runner configuration. For example, the quantum scheduler:

defmodule Helen.Scheduler do
  use Quantum.Scheduler, otp_app: helen
end

Could be configured with:

config helen, Helen.Scheduler,
  jobs: [
    {"@daily", {Backup, :backup, []}},
  ]

Configuration:

  • :timeout - Sometimes, you may come across GenServer timeout errors esp. when you have too many jobs or high load. The default GenServer.call timeout is 5000.

  • :jobs - list of cron jobs to execute

  • :global - When you have a cluster of nodes, you may not want same jobs to be generated on every single node, e.g. jobs involving db changes.

    In this case, you may choose to run Quantum as a global process, thus preventing same job being run multiple times because of it being generated on multiple nodes. With the following configuration, Quantum will be run as a globally unique process across the cluster.

  • :schedule - Default schedule of new Job

  • :run_strategy - Default Run Strategy of new Job

  • :overlap - Default overlap of new Job,

  • :timezone - Default timezone of new Job

Link to this section Summary

Link to this section Functions

Link to this function

activate_job(server \\ __job_broadcaster__(), name)

View Source

Callback implementation for Quantum.Scheduler.activate_job/2.

Link to this function

add_job(server \\ __job_broadcaster__(), job)

View Source

Callback implementation for Quantum.Scheduler.add_job/2.

Callback implementation for Quantum.Scheduler.config/1.

Link to this function

deactivate_job(server \\ __job_broadcaster__(), name)

View Source

Callback implementation for Quantum.Scheduler.deactivate_job/2.

Link to this function

delete_all_jobs(server \\ __job_broadcaster__())

View Source

Callback implementation for Quantum.Scheduler.delete_all_jobs/1.

Link to this function

delete_job(server \\ __job_broadcaster__(), name)

View Source

Callback implementation for Quantum.Scheduler.delete_job/2.

Link to this function

find_job(server \\ __job_broadcaster__(), name)

View Source

Callback implementation for Quantum.Scheduler.find_job/2.

Link to this function

jobs(server \\ __job_broadcaster__())

View Source

Callback implementation for Quantum.Scheduler.jobs/1.

Link to this function

new_job(config \\ config())

View Source

Callback implementation for Quantum.Scheduler.new_job/1.

Link to this function

start_link(opts \\ [name: __MODULE__])

View Source

Callback implementation for Quantum.Scheduler.start_link/1.

Link to this function

stop(server \\ __MODULE__, timeout \\ 5000)

View Source

Callback implementation for Quantum.Scheduler.stop/2.