ExGcloudPubsubPuller v1.1.2 ExGcloudPubsubPuller.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 ExGcloudPubsubPuller.Scheduler do
use Quantum.Scheduler, otp_app: ex_gcloud_pubsub_puller
end
Could be configured with:
config ex_gcloud_pubsub_puller, ExGcloudPubsubPuller.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
Functions
Activates a job by name
Adds a new job
Returns the configuration stored in the :otp_app environment.
Deactivates a job by name
Deletes all jobs
Deletes a job by name
Resolves a job by name
Returns the list of currently defined jobs
Creates a new Job. The job can be added by calling add_job/1.
Starts supervision and return {:ok, pid}
or just :ok if nothing needs to be done.
Shuts down the quantum represented by the given pid.
Link to this section Functions
activate_job(server \\ __job_broadcaster__(), name) View Source
Activates a job by name
Callback implementation for Quantum.Scheduler.activate_job/2.
add_job(server \\ __job_broadcaster__(), job) View Source
Adds a new job
Callback implementation for Quantum.Scheduler.add_job/2.
config(custom \\ []) View Source
Returns the configuration stored in the :otp_app environment.
Callback implementation for Quantum.Scheduler.config/1.
deactivate_job(server \\ __job_broadcaster__(), name) View Source
Deactivates a job by name
Callback implementation for Quantum.Scheduler.deactivate_job/2.
delete_all_jobs(server \\ __job_broadcaster__()) View Source
Deletes all jobs
Callback implementation for Quantum.Scheduler.delete_all_jobs/1.
delete_job(server \\ __job_broadcaster__(), name) View Source
Deletes a job by name
Callback implementation for Quantum.Scheduler.delete_job/2.
find_job(server \\ __job_broadcaster__(), name) View Source
Resolves a job by name
Callback implementation for Quantum.Scheduler.find_job/2.
jobs(server \\ __job_broadcaster__()) View Source
Returns the list of currently defined jobs
Callback implementation for Quantum.Scheduler.jobs/1.
new_job(config \\ config()) View Source
Creates a new Job. The job can be added by calling add_job/1.
Callback implementation for Quantum.Scheduler.new_job/1.
start_link(opts \\ [name: __MODULE__]) View Source
Starts supervision and return {:ok, pid}
or just :ok if nothing needs to be done.
Returns {:error, {:already_started, pid}} if the repo is already
started or {:error, term} in case anything else goes wrong.
Options
See the configuration in the moduledoc for options.
Callback implementation for Quantum.Scheduler.start_link/1.
stop(server \\ __MODULE__, timeout \\ 5000) View Source
Shuts down the quantum represented by the given pid.
Callback implementation for Quantum.Scheduler.stop/2.