StepFlow.Jobs (StepFlow v0.2.7) View Source

The Jobs context.

Link to this section Summary

Functions

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

Creates a job with a completed status.

Creates a job with an error status.

Creates a job.

Creates a job with a skipped status.

Deletes a Job.

Gets a single job.

Gets a single job.

Gets a single job with its related status.

Returns a formatted message for AMQP orders.

Returns the list of jobs.

Set skipped status to all queued jobs.

Updates a job.

Link to this section Functions

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

Examples

iex> change_job(job)
%Ecto.Changeset{source: %Job{}}
Link to this function

create_completed_job(workflow, step_id, action)

View Source

Creates a job with a completed status.

Examples

iex> create_completed_job(workflow, step_id, "webhook_notification")
{:ok, "completed"}
Link to this function

create_error_job(workflow, step_id, action, description)

View Source

Creates a job with an error status.

Examples

iex> create_error_job(workflow, step_id, "download_http", "unsupported step")
{:ok, "created"}
Link to this function

create_job(attrs \\ %{})

View Source

Creates a job.

Examples

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

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

create_skipped_job(workflow, step_id, action)

View Source

Creates a job with a skipped status.

Examples

iex> create_skipped_job(workflow, 1, "download_http")
{:ok, "skipped"}

Deletes a Job.

Examples

iex> delete_job(job)
{:ok, %Job{}}

iex> delete_job(job)
{:error, %Ecto.Changeset{}}

Gets a single job.

Examples

iex> get_job(123)
%Job{}

iex> get_job(456)
nil

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)
Link to this function

get_job_with_status!(id)

View Source

Gets a single job with its related status.

Raises Ecto.NoResultsError if the Job does not exist.

Examples

iex> get_job_with_status!(123)
%Job{}

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

Returns a formatted message for AMQP orders.

Examples

iex> get_message(job)
%{job_id: 123, parameters: [{id: "input", type: "string", value: "/path/to/input"}]}
Link to this function

list_jobs(params \\ %{})

View Source

Returns the list of jobs.

Examples

iex> list_jobs()
[%Job{}, ...]
Link to this function

skip_jobs(workflow, step_id, action)

View Source

Set skipped status to all queued jobs.

Examples

iex> skip_jobs(workflow, step_id, "download_http")
:ok

Updates a job.

Examples

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

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