Citrine v0.1.4 Citrine.Job View Source

Link to this section Summary

Types

A unique ID for this job.

Cron-based schedule specification.

t()

The job task to run.

Functions

Struct that describes a job. Must specify a unique :id, a :schedule using cron syntax, and a task. If :extended_syntax is set to true, the schedule will be parsed as extended cron syntax by Crontab.CronExpression.Parser.

Link to this section Types

Specs

jobid() :: String.t()

A unique ID for this job.

Specs

schedule() :: String.t()

Cron-based schedule specification.

Specs

t() :: %Citrine.Job{
  extended_syntax: boolean(),
  id: jobid(),
  schedule: String.t(),
  task: task()
}

Specs

task() :: {module(), atom(), [term()]} | {atom(), [term()]} | (() -> any())

The job task to run.

Link to this section Functions

Struct that describes a job. Must specify a unique :id, a :schedule using cron syntax, and a task. If :extended_syntax is set to true, the schedule will be parsed as extended cron syntax by Crontab.CronExpression.Parser.

Example

iex(1)> job = %Citrine.Job{
...(1)>   id: "my-job-id",
...(1)>   schedule: "* * * * * *",
...(1)>   task: fn -> nil end,
...(1)>   extended_syntax: true
...(1)> }