Lightning.Jobs (Lightning v2.14.5-pre1)

View Source

The Jobs context.

Summary

Functions

Returns an %Ecto.Changeset{} for tracking job changes.

Returns the list of downstream jobs for a given job, optionally matching a specific trigger type. When downstream_jobs_for is called without a trigger that means its between jobs when it called with a trigger that means we are starting from outside the pipeline

Gets a single job.

Returns the list of jobs excluding the one given.

Returns the list of jobs.

Updates a job.

Functions

change_job(job, attrs \\ %{})

Returns an %Ecto.Changeset{} for tracking job changes.

Examples

iex> change_job(job)
%Ecto.Changeset{data: %Job{}}

create_job(attrs \\ %{}, actor)

Creates a job.

Examples

iex> create_job(%{field: value})
{:ok, %Job{}}

iex> create_job(%{field: bad_value})
{:error, %Ecto.Changeset{}}

get_downstream_jobs_for(job, edge_condition \\ nil)

Returns the list of downstream jobs for a given job, optionally matching a specific trigger type. When downstream_jobs_for is called without a trigger that means its between jobs when it called with a trigger that means we are starting from outside the pipeline

get_job!(id)

Gets a single job.

Raises Ecto.NoResultsError if the Job does not exist.

Examples

iex> get_job!(123)
%Job{}

iex> get_job!(456)
** (Ecto.NoResultsError)

get_job_with_credential(id)

get_upstream_jobs_for(map)

@spec get_upstream_jobs_for(Lightning.Workflows.Job.t()) :: [
  Lightning.Workflows.Job.t()
]

Returns the list of jobs excluding the one given.

jobs_for_project(project)

@spec jobs_for_project(Lightning.Projects.Project.t()) :: [
  Lightning.Workflows.Job.t()
]

jobs_for_project_query(project)

@spec jobs_for_project_query(Lightning.Projects.Project.t()) :: Ecto.Queryable.t()

list_active_cron_jobs()

list_jobs()

Returns the list of jobs.

list_jobs_for_workflow(workflow)

@spec list_jobs_for_workflow(Lightning.Workflows.Workflow.t()) ::
  [Lightning.Workflows.Job.t(), ...] | []

update_job(job, attrs)

Updates a job.

Examples

iex> update_job(job, %{field: new_value})
{:ok, %Job{}}

iex> update_job(job, %{field: bad_value})
{:error, %Ecto.Changeset{}}