> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anonalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# jobs

> Check or cancel the background jobs that queued writes and document uploads return.

`record --async`, `record --batch` and `documents upload` return job ids
instead of waiting. These two commands follow them up. Both address one space:
`--space`, or `ANONA_SPACE_ID`.

| Command | pip | npm |
| - | - | - |
| `jobs get`, `jobs cancel` | yes | 0.19.0 |

## jobs get

```bash theme={null}
anona jobs get JOB_ID --space notes
anona jobs get JOB_ID --space notes --json | jq -r .status
```

The job's status, how many memories it made from how many items, and their
ids. `GET /v1/spaces/{id}/jobs/{job_id}`. A poll is a read: it costs nothing
and is safe to repeat.

A job is still running while its status is `pending`, `processing`, `running`
or `queued`; anything else is final (`completed`, `failed`, `cancelled`).
`memory_count` far below `items_submitted` is not a failure: near-identical
items legitimately extract to fewer memories. `zero_yield_items` is how many
items extraction produced no memory from. It can be non-zero even when
`memory_count` is at or above `items_submitted`, because one item can produce
several memories and another none.

An id the space does not hold (a typo, or a job from another space) exits `5`
with `job_not_found` and prints nothing on stdout, `--json` or not. The API
itself answers that case with `200` and `"status": "not_found"`.

To wait for a job instead of polling it yourself, pass `--wait` to the command
that queued it ([`record`](https://docs.anonalabs.com/cli/memory#background-writes),
[`documents upload`](https://docs.anonalabs.com/cli/documents#documents-upload)).

**`--json`:** `{"job_id", "status", "created_at", "completed_at", "error", "memory_count", "memory_ids", "items_submitted", "zero_yield_items", "progress"}`.

## jobs cancel

```bash theme={null}
anona jobs cancel JOB_ID --yes --space notes
```

Cancels the parts of a job still queued. The parts already running finish, and
the output says how many. Without `--yes` it exits `2` and sends nothing. A job
that has already finished cannot be cancelled (`job_not_cancellable`).

**`--json`:** `{"job_id", "status", "cancelled_parts", "running_parts"}`.

## Related

* API: [Job status](https://docs.anonalabs.com/api-reference/memories.md#job-status), [Cancel a job](https://docs.anonalabs.com/api-reference/memories.md#cancel-a-job).
* [Stop a runaway import](https://docs.anonalabs.com/use-cases/stop-a-runaway-import.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.