Lightning.Invocation.Query (Lightning v2.15.0-pre5)

View Source

Query 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

Work orders for a specific project, or all runs available to the requesting user

Functions

any_step()

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?"

dataclip_with_body()

By default, the dataclip body is not returned via a query. This query selects the body specifically.

filter_log_lines(query, params)

@spec filter_log_lines(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()

Filter log lines by various criteria

filter_runs(query, params)

@spec filter_runs(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()

Filter runs by various criteria

filter_runs_by_date(query, params)

@spec filter_runs_by_date(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()

Filter runs by inserted_at date range

filter_work_orders(query, params)

@spec filter_work_orders(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()

Filter work orders by various criteria

filter_work_orders_by_date(query, params)

@spec filter_work_orders_by_date(Ecto.Queryable.t(), map()) :: Ecto.Queryable.t()

Filter work orders by date range

last_n_for_job(job_id, limit)

last_step_for_job(job)

@spec last_step_for_job(Lightning.Workflows.Job.t()) :: Ecto.Queryable.t()

The last step for a job

last_successful_step_for_job(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

log_lines_for(user)

@spec log_lines_for(Lightning.Accounts.User.t()) :: Ecto.Queryable.t()

Log lines for a specific user, filtered by their accessible projects

runs_for(user)

Runs for a specific project, or all runs available to the requesting user

select_as_input_text(query)

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).

steps_for(user)

Steps for a specific user

steps_with_reason(query, exit_reason)

@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_params(params, keys)

@spec validate_datetime_params(map(), [String.t()]) :: :ok | {:error, String.t()}

Validate datetime parameters for filtering

wipe_dataclips(query \\ Dataclip)

work_orders_for(user)

@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