Lightning.Jobs (Lightning v2.19.0-pre)
View SourceThe Jobs context.
Summary
Functions
Returns an %Ecto.Changeset{} for tracking job changes.
Creates a job.
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.
Gets a single job.
Gets the name of a job in a project.
Gets a job by id, scoped to a workflow, with its credential preloaded.
Returns the list of jobs excluding the one given.
Returns true when the job belongs to the given project (via its workflow).
Returns the list of jobs.
Updates a job.
Functions
Returns an %Ecto.Changeset{} for tracking job changes.
Examples
iex> change_job(job)
%Ecto.Changeset{data: %Job{}}
Creates a job.
Examples
iex> create_job(%{field: value})
{:ok, %Job{}}
iex> create_job(%{field: bad_value})
{:error, %Ecto.Changeset{}}
@spec get_downstream_jobs_for( Lightning.Workflows.Job.t() | Ecto.UUID.t(), Lightning.Workflows.Edge.edge_condition() | nil ) :: [Lightning.Workflows.Job.t()]
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 {:ok, job} if found, {:error, :not_found} otherwise.
Options
:include- list of associations to preload (default:[])
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)
Gets the name of a job in a project.
Returns nil when the id names no job in that project — including when it
is not a UUID at all, since it reaches here from a query string.
Gets a job by id, scoped to a workflow, with its credential preloaded.
Returns nil when the job does not exist or belongs to another workflow, so a
caller cannot read a job (and resolve its credential) outside the workflow it
supplies.
@spec get_upstream_jobs_for(Lightning.Workflows.Job.t()) :: [ Lightning.Workflows.Job.t() ]
Returns the list of jobs excluding the one given.
@spec job_in_project?(Ecto.UUID.t(), Lightning.Projects.Project.t()) :: boolean()
Returns true when the job belongs to the given project (via its workflow).
A non-UUID job_id returns false rather than raising, so malformed, missing
and cross-project ids are all handled uniformly.
@spec jobs_for_project(Lightning.Projects.Project.t()) :: [ Lightning.Workflows.Job.t() ]
@spec jobs_for_project_query(Lightning.Projects.Project.t()) :: Ecto.Queryable.t()
Returns the list of jobs.
@spec list_jobs_for_workflow(Lightning.Workflows.Workflow.t()) :: [Lightning.Workflows.Job.t(), ...] | []
Updates a job.
Examples
iex> update_job(job, %{field: new_value})
{:ok, %Job{}}
iex> update_job(job, %{field: bad_value})
{:error, %Ecto.Changeset{}}