---
question: Which pipeline runs are recorded, and where do I see them?
kind: task
via_web: available
via_cli: na
via_python: available
via_api: available
via_config: na
ref_web: System › Jobs
ref_python: JobContext
ref_api: GET /api/admin/system/jobs/runs
prereq: You need a pipeline in a module that runs, started as `pipeline.<slug>` or called by a job, and a platform super admin account for the System app and its API. See [Run a pipeline](/capabilities/build/pipelines/run-a-pipeline).
next:
  - /capabilities/build/pipelines/schedule-a-pipeline
  - /capabilities/build/workflows/monitor-and-cancel-a-run
  - /capabilities/build/modules/module-jobs
---

# Monitor runs

Runs are recorded by the jobs runtime, so what shows depends on how the pipeline was started:

| Started by | Recorded |
|---|---|
| A start of `pipeline.<slug>`: System › Jobs **Run now**, `/api/workflows`, `get_workflow(...).start()` or `.run()`, `ctx.call`, the class's own `job` triggers | Yes, as a run of `pipeline.<slug>`: status, input, its one step `run`, output (the triple count and the Turtle), trace |
| A `@job` or a `@workflow` of the module that calls `run` | Yes, as a run of that job or workflow: status, payload, logs, result |
| A direct `await run(...)`: the module's own code, an agent tool | No |

Run statuses are `QUEUED`, `RUNNING`, `RETRYING`, `SUCCEEDED`, `SKIPPED`, `FAILED`, `TIMED_OUT` and `CANCELLED`.

## Web UI

### Open the Jobs tab

Open the **System** app from the sidebar, then the **Jobs** tab. It lists every job and workflow of the modules: **Job**, **Schedule**, **Recent runs**, **Last run** and **Now**. A red count on the tab is the number of failed runs; **Show failed runs** filters to them.

![System app on the Jobs tab, filtered](/abi/Screenshot_System_Jobs.png)

*System › Jobs, filtered to one module's jobs: schedule, recent runs, last run and Run.*

### Open the job

Click the job, or the pipeline's `pipeline.<slug>` (the **Workflows** kind filter lists the workflows only). Its page shows the **Schedule**, **Health**, **Now** and **Settings** (concurrency, attempts, timeout), then its **Runs**. **Run now** starts a run: a job takes an optional JSON payload that reaches the handler as `ctx.payload`, a pipeline a form built from its parameters model.

### Read a run

Click a run. The panel shows the timeline and the **Logs**, **Payload**, **Result** (**Output** when the run did not succeed) and **Trace** tabs. A `pipeline.<slug>` run adds **Steps** and shows **Input** instead of **Payload**. **Re-run** starts it again; **Cancel** stops a running one. Steps and cancels are on [Monitor and cancel a run](/capabilities/build/workflows/monitor-and-cancel-a-run?via=web).

The System app is for platform super admins only.

## CLI

Not applicable. No `abi` command lists jobs or their runs. Use the Web UI or the REST API. Under `abi dev up`, `abi dev logs <name> -f` follows the log of a module that `dev.modules` runs: it has what the pipeline writes with `logging`, not the run records.

## Python

### Write to the run's log

A `@job` handler gets a `JobContext`. What it logs and returns is what the Jobs tab shows:

```python title="src/catalog/__init__.py"
from naas_abi_sdk.jobs import Every, JobContext, job

from catalog.pipelines.ItemsPipeline import ItemsPipelineParameters


class ABIModule(BaseModule):
    @job(triggers=(Every("1h"),))
    async def sync_items(self, ctx: JobContext) -> dict:
        pipeline = self.get_pipeline_instance("items_pipeline")
        graph = await pipeline.run(ItemsPipelineParameters())
        if len(graph) == 0:
            ctx.skip("no new items")
            return {}
        ctx.log(f"inserted {len(graph)} triples")
        return {"triples": len(graph)}
```

A `pipeline.<slug>` run needs none of this: its one step, `run`, and its output are recorded on their own.

### Know what each field does

- `ctx.log(message)`: a line in the run's **Logs** tab, up to 200 lines of 2,000 characters.
- `ctx.skip(reason)`: ends the run as `SKIPPED`. Skipped runs are kept for an hour, so polls with nothing to do do not fill the history.
- The return value: the run's **Result**. An exception fails the attempt, and its error shows instead.
- `ctx.cancelled`: an `asyncio.Event`, set on a timeout or a cancel. In a long loop, test `ctx.cancelled.is_set()` (the event object itself is always truthy), or `await ctx.cancelled.wait()`.

### Read a run from code

`await self.get_workflow("pipeline.items_pipeline").start(...)` returns a `WorkflowRun`: `await run.status()`, `await run.steps()`, `await run.wait(timeout=...)` and `await run.cancel()`. See [Monitor and cancel a run](/capabilities/build/workflows/monitor-and-cancel-a-run?via=python).

## REST API

### List the runs

```bash
curl -s "http://localhost:9879/api/admin/system/jobs/runs?module=catalog&job=sync_items&status=FAILED" \
  -H "Authorization: Bearer $NEXUS_ACCESS_TOKEN"
```

Filters are `module` (the module id), `job`, `status` (comma-separated), `trigger`, `before`, `limit` (1 to 500, default 50) and `include_skipped`. `GET /api/admin/system/jobs` lists the jobs, and `GET /api/admin/system/jobs/failures?since=...` the failed runs.

### Read one run

```bash
curl -s "http://localhost:9879/api/admin/system/jobs/runs/catalog/$RUN_ID" \
  -H "Authorization: Bearer $NEXUS_ACCESS_TOKEN"
```

The run detail adds `payload`, `result`, `logs` and `trace_url`, and, for a `pipeline.<slug>` run, `workflow` with its steps. Scripts holding the instance's `ABI_API_KEY` read a `pipeline.<slug>` run with `GET /api/workflows/{module_id}/runs/{run_id}` instead: see [Monitor and cancel a run](/capabilities/build/workflows/monitor-and-cancel-a-run?via=api).

### Trigger or cancel

`POST /api/admin/system/jobs/catalog/sync_items/trigger` with `{"payload": {}}` starts a run and returns `202` with its `run_id`. `POST /api/admin/system/jobs/runs/catalog/$RUN_ID/cancel` cancels one. Every route under `/api/admin/system/jobs` needs the Nexus session token of a platform super admin (`POST /api/auth/login` returns it); anyone else gets 403.

## Config

Not applicable. A module keeps its run records for a fixed time, with no `config.yaml` key: finished runs 7 days, at most 1,000 per job, skipped ones an hour, pruned every 10 minutes. Running and queued runs are never pruned.
