Lightning.Invocation.Query (Lightning v2.16.3)
View SourceQuery functions for working with Steps and Dataclips
Summary
Functions
To be used in preloads for workflow > job > step when the presence of any
step is all the information we need. As in, "Does this job have any steps?"
By default, the dataclip body is not returned via a query. This query selects the body specifically.
Filter log lines by various criteria
Filter runs by various criteria
Filter runs by inserted_at date range
Filter work orders by various criteria
Filter work orders by date range
The last step for a job
The last successful step for a job, used in scheduler to enable downstream runs to access a previous run's state
Log lines for a specific user, filtered by their accessible projects
Runs for a specific project, or all runs available to the requesting user
Returns a dataclip formatted for use as an input state.
Steps for a specific user
The last step for a job for a particular exit reason, used in scheduler
Validate datetime parameters for filtering
Validates the state query parameter against known run states.
Validates the state query parameter against known work order states.
Work orders for a specific project, or all runs available to the requesting user
Functions
To be used in preloads for workflow > job > step when the presence of any
step is all the information we need. As in, "Does this job have any steps?"
By default, the dataclip body is not returned via a query. This query selects the body specifically.
@spec filter_log_lines(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()
Filter log lines by various criteria
@spec filter_runs(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()
Filter runs by various criteria
@spec filter_runs_by_date(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()
Filter runs by inserted_at date range
@spec filter_work_orders(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()
Filter work orders by various criteria
@spec filter_work_orders_by_date(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()
Filter work orders by date range
@spec last_step_for_job(Lightning.Workflows.Job.t()) :: Ecto.Queryable.t()
The last step for a job
@spec last_successful_step_for_job(Lightning.Workflows.Job.t()) :: Ecto.Queryable.t()
The last successful step for a job, used in scheduler to enable downstream runs to access a previous run's state
@spec log_lines_for(Lightning.Accounts.User.t()) :: Ecto.Queryable.t()
Log lines for a specific user, filtered by their accessible projects
@spec runs_for(Lightning.Accounts.User.t()) :: Ecto.Queryable.t()
@spec runs_for(Lightning.Projects.Project.t()) :: Ecto.Queryable.t()
Runs for a specific project, or all runs available to the requesting user
Returns a dataclip formatted for use as an input state.
Only http_request dataclips are changed, their body is nested inside a
"data" key and request data is added as a "request" key.
Like select_as_input/1, but returns body as JSON text string to avoid
expensive deserialization to Elixir map (saves ~38x memory amplification).
@spec steps_for(Lightning.Accounts.User.t()) :: Ecto.Queryable.t()
Steps for a specific user
@spec steps_with_reason(Ecto.Queryable.t(), String.t()) :: Ecto.Queryable.t()
The last step for a job for a particular exit reason, used in scheduler
Validate datetime parameters for filtering
Validates the state query parameter against known run states.
Returns :ok or {:error, message}.
Validates the state query parameter against known work order states.
Returns :ok or {:error, message}.
@spec work_orders_for(Lightning.Accounts.User.t()) :: Ecto.Queryable.t()
@spec work_orders_for(Lightning.Projects.Project.t()) :: Ecto.Queryable.t()
Work orders for a specific project, or all runs available to the requesting user