Gust.Flows (gust v0.1.25)
The Flows context.
This module serves as the boundary for accessing and manipulating Flow-related data, such as DAGs, Runs, Tasks, and Secrets.
Summary
Functions
Returns an %Ecto.Changeset{} for tracking secret changes.
Returns the number of runs associated with a given DAG.
Creates a DAG.
Creates a log.
Creates a run.
Creates a secret.
Creates a task.
Creates a test run.
Creates a test task.
Deletes a DAG.
Deletes all DAGs whose IDs are not in the provided list.
Deletes the given run from the database.
Deletes a secret.
Gets a single DAG.
Gets a DAG by name.
Gets a DAG by name with its runs preloaded, with pagination for runs.
Gets a DAG with its runs preloaded.
Gets a DAG with its runs and tasks preloaded, with pagination for runs.
Gets a single log.
Gets a single run.
Gets a single run with its tasks preloaded.
Gets runs for a list of DAG IDs with the given statuses.
Gets a single secret.
Gets a single secret by name.
Gets a single task.
Gets a task by name and run ID.
Gets a task by name and run ID, with logs preloaded.
Gets a task with its logs preloaded.
Lists all DAGs.
Lists all secrets.
Toggles the enabled status of a DAG.
Updates a run status.
Updates a secret.
Updates a task attempt count.
Updates a task error.
Updates a task result.
Updates a task result and error.
Updates a task status.
Functions
Returns an %Ecto.Changeset{} for tracking secret changes.
Examples
iex> change_secret(secret)
%Ecto.Changeset{data: %Secret{}}
Returns the number of runs associated with a given DAG.
Parameters
dag_id- The identifier of the DAG whose runs should be counted.
Returns
- The integer count of runs associated with the specified DAG.
Creates a DAG.
Examples
iex> create_dag(%{field: value})
{:ok, %Dag{}}
iex> create_dag(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Creates a log.
Creates a run.
Examples
iex> create_run(%{field: value})
{:ok, %Run{}}
iex> create_run(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Creates a secret.
Examples
iex> create_secret(%{field: value})
{:ok, %Secret{}}
iex> create_secret(%{field: bad_value})
{:error, %Ecto.Changeset{}}
Creates a task.
Creates a test run.
Creates a test task.
Deletes a DAG.
Deletes all DAGs whose IDs are not in the provided list.
Deletes the given run from the database.
The run must be a persisted %Run{} struct. This function delegates to
Repo.delete/1 and returns {:ok, %Run{}} if the run is successfully
deleted, or {:error, %Ecto.Changeset{}} if the delete operation fails.
Examples
iex> delete_run(run)
{:ok, %Run{}}
iex> delete_run(invalid_run)
{:error, %Ecto.Changeset{}}
Deletes a secret.
Gets a single DAG.
Raises Ecto.NoResultsError if the Dag does not exist.
Gets a DAG by name.
Gets a DAG by name with its runs preloaded, with pagination for runs.
The DAG is looked up by its name. The associated runs are ordered by
descending inserted_at and paginated using the provided limit and
offset keyword arguments.
Parameters
name- The name of the DAG to retrieve.limit- The maximum number of runs to preload.offset- The number of runs to skip before starting to preload.
Returns
Returns the %Dag{} struct with its :runs association preloaded according
to the given pagination options. Raises Ecto.NoResultsError if no DAG
with the given name exists.
Gets a DAG with its runs preloaded.
Gets a DAG with its runs and tasks preloaded, with pagination for runs.
Gets a single log.
Raises Ecto.NoResultsError if the Log does not exist.
Gets a single run.
Raises Ecto.NoResultsError if the Run does not exist.
Examples
iex> get_run!(123)
%Run{}
iex> get_run!(456)
** (Ecto.NoResultsError)
Gets a single run with its tasks preloaded.
Gets runs for a list of DAG IDs with the given statuses.
Parameters
dag_ids: List of DAG IDs to filter runs by.statuses: List of statuses (atoms) to filter runs by (e.g., [:running, :queued]).
Examples
iex> get_running_runs_by_dag([1, 2, 3], [:running, :retrying])
[%Run{}, ...]
Gets a single secret.
Raises Ecto.NoResultsError if the Secret does not exist.
Gets a single secret by name.
Gets a single task.
Raises Ecto.NoResultsError if the Task does not exist.
Gets a task by name and run ID.
Gets a task by name and run ID, with logs preloaded.
Accepts an optional log_level argument:
- When
log_levelisnil(the default), all logs for the task are preloaded. - When
log_levelis provided, only logs with the matching level are preloaded.
Logs are ordered by their inserted_at timestamp in ascending order.
Gets a task with its logs preloaded.
Lists all DAGs.
Lists all secrets.
Toggles the enabled status of a DAG.
Updates a run status.
Updates a secret.
Updates a task attempt count.
Updates a task error.
Updates a task result.
Updates a task result and error.
Updates a task status.