PgFlowDashboard.Queries.Runs (PgFlow v0.1.0)

Copy Markdown View Source

Database queries for run-related data.

Summary

Functions

Counts runs matching the given filters.

Gets the adjacent run (next or previous by started_at).

Gets a single run with full details.

Lists runs with progress information.

Lists step states for a run.

Lists tasks for a specific step in a run.

Functions

count_runs(repo, opts \\ [])

@spec count_runs(
  module(),
  keyword()
) :: integer()

Counts runs matching the given filters.

Options

  • :flow_slug - Filter by flow slug
  • :status - Filter by status (started, completed, failed)
  • :time_range - Filter by time range (:last_hour, :last_24h, :last_7d, :last_30d)
  • :flow_type - Filter by type ("flow" or "job")

get_adjacent_run(repo, run_id, direction)

@spec get_adjacent_run(module(), String.t(), :next | :prev) ::
  {:ok, String.t()} | {:error, :not_found}

Gets the adjacent run (next or previous by started_at).

Direction can be :next or :prev. Returns {:ok, run_id} or {:error, :not_found}.

get_run(repo, run_id)

@spec get_run(module(), String.t()) :: {:ok, map()} | {:error, :not_found | term()}

Gets a single run with full details.

list_runs(repo, opts \\ [])

@spec list_runs(
  module(),
  keyword()
) :: [map()]

Lists runs with progress information.

Options

  • :flow_slug - Filter by flow slug
  • :status - Filter by status (started, completed, failed)
  • :time_range - Filter by time range (:last_hour, :last_24h, :last_7d, :last_30d)
  • :limit - Maximum number of runs to return (default: 50)
  • :cursor - Cursor for pagination (run_id to start after)
  • :flow_type - Filter by type ("flow" or "job")

list_step_states(repo, run_id)

@spec list_step_states(module(), String.t()) :: [map()]

Lists step states for a run.

list_step_tasks(repo, run_id, step_slug)

@spec list_step_tasks(module(), String.t(), String.t()) :: [map()]

Lists tasks for a specific step in a run.