Lightning.Runs (Lightning v2.13.5)

View Source

Gathers operations to create, update and delete Runs.

Summary

Functions

Enqueue a run to be processed.

Get a run by id.

Returns only the dataclip body as a string

Returns only the dataclip request as a string

Get a run by id, preloading the snapshot and its credential.

Returns a run's dataclip formatted for use as state.

Creates a Step for a given run and job.

See Lightning.Runs.Events.subscribe/1.

Clears the body and request fields of the dataclip associated with the given run.

Functions

append_run_log(run, params, scrubber \\ nil)

complete_run(run, params)

@spec complete_run(Lightning.Run.t(), %{optional(any()) => any()}) ::
  {:ok, Lightning.Run.t()} | {:error, Ecto.Changeset.t(Lightning.Run.t())}

complete_step(params, options \\ Lightning.Runs.RunOptions)

@spec complete_step(map(), Lightning.Runs.RunOptions) ::
  {:ok, Lightning.Invocation.Step.t()} | {:error, Ecto.Changeset.t()}

enqueue(run)

Enqueue a run to be processed.

get(id, opts \\ [])

@spec get(Ecto.UUID.t(), [{:include, term()}]) :: Lightning.Run.t() | nil

Get a run by id.

Optionally preload associations by passing a list of atoms to :include.

Lightning.Runs.get(id, include: [:workflow])

get_credential(run, id)

@spec get_credential(Lightning.Run.t(), Ecto.UUID.t()) ::
  Lightning.Credentials.Credential.t() | nil

get_dataclip_body(run)

Returns only the dataclip body as a string

get_dataclip_request(run)

Returns only the dataclip request as a string

get_for_worker(id)

@spec get_for_worker(Ecto.UUID.t()) :: Lightning.Run.t() | nil

Get a run by id, preloading the snapshot and its credential.

get_input(run)

@spec get_input(Lightning.Run.t()) :: String.t() | nil

Returns a run's dataclip formatted for use as state.

Only http_request and kafka dataclips are changed, their body is nested inside a "data" key and request data is added as a "request" key.

See LightingWeb.RunChannel.handlein("fetch:dataclip", , _) for more details.

get_log_lines(run, order \\ :asc)

get_project_id_for_run(run)

@spec get_project_id_for_run(Lightning.Run.t()) :: Ecto.UUID.t() | nil

get_run_options(workflow_id, project_id)

@spec get_run_options(
  workflow_id :: Ecto.UUID.t(),
  project_id :: Ecto.UUID.t()
) :: Lightning.Runs.RunOptions.t()

mark_run_lost(run)

@spec mark_run_lost(Lightning.Run.t()) :: {:ok, any()} | {:error, any()}

mark_steps_lost(steps_query)

@spec mark_steps_lost(Ecto.Queryable.t()) :: {:ok, non_neg_integer()}

start_run(run, params \\ %{})

start_step(run, params)

@spec start_step(Lightning.Run.t(), map()) ::
  {:ok, Lightning.Invocation.Step.t()} | {:error, Ecto.Changeset.t()}

Creates a Step for a given run and job.

The Step is created and marked as started at the current time.

subscribe(run)

See Lightning.Runs.Events.subscribe/1.

update_run(changeset)

@spec update_run(Ecto.Changeset.t(Lightning.Run.t())) ::
  {:ok, Lightning.Run.t()} | {:error, Ecto.Changeset.t(Lightning.Run.t())}

update_runs(update_query, updates)

wipe_dataclips(run)

@spec wipe_dataclips(Lightning.Run.t()) :: :ok

Clears the body and request fields of the dataclip associated with the given run.