Que v0.10.0 Que.Job View Source

Module to manage a Job's state and execute the worker's callbacks.

Defines a Que.Job struct an keeps track of the Job's worker, arguments, status and more. Meant for internal usage, so you shouldn't use this unless you absolutely know what you're doing.

Link to this section Summary

Types

One of the atoms in [:queued, :started, :failed, :completed]

t()

A Que.Job struct

Functions

Handles Job Failure, Calls appropriate worker method and updates the job status to :failed

Handles Job Success, Calls appropriate worker method and updates the job status to :completed

Returns a new Job struct with defaults

Updates the Job struct with new status and spawns & monitors a new Task under the TaskSupervisor which executes the perform method with supplied arguments

Update the Job status to one of the predefined values in @statuses

Link to this section Types

One of the atoms in [:queued, :started, :failed, :completed]

Link to this type

t() View Source
t() :: %Que.Job{
  arguments: term(),
  created_at: term(),
  id: term(),
  pid: term(),
  ref: term(),
  status: term(),
  updated_at: term(),
  worker: term()
}

A Que.Job struct

Link to this section Functions

Link to this function

handle_failure(job, error) View Source
handle_failure(job :: Que.Job.t(), error :: term()) :: Que.Job.t()

Handles Job Failure, Calls appropriate worker method and updates the job status to :failed

Link to this function

handle_success(job) View Source
handle_success(job :: Que.Job.t()) :: Que.Job.t()

Handles Job Success, Calls appropriate worker method and updates the job status to :completed

Link to this function

new(worker, args \\ nil) View Source
new(worker :: Que.Worker.t(), args :: list()) :: Que.Job.t()

Returns a new Job struct with defaults

Link to this function

perform(job) View Source
perform(job :: Que.Job.t()) :: Que.Job.t()

Updates the Job struct with new status and spawns & monitors a new Task under the TaskSupervisor which executes the perform method with supplied arguments

Link to this function

set_status(job, status) View Source
set_status(job :: Que.Job.t(), status :: status()) :: Que.Job.t()

Update the Job status to one of the predefined values in @statuses