# `jadpo batches`

Watch and stop batch runs.

Lists the app's batch runs (area 12): its file reads and writes and its `batches.each` runs, those running first, then those that ended, newest first, 20 a page, each with its state, how far it is against its estimated total, and its problems. --state lists one state's. `show` shows one run's progress, when it started and last moved, when it should finish at the rate so far, why it failed, and its problems by row, column and rule, never a value, 20 a page with --page. `cancel` stops a running one after the batch in hand, as `batches.cancel` does, logged in the database with who asked; one that has ended is left as it is. It runs none of the app's code. An id is the last 8 hex digits the list shows, or more. The databases are the ones the stores' connections' settings give, or a running jadpo dev's, or the one --url names (with --store when there are several). Times are in UTC.

Also: `jadpo batch`.

```text
jadpo batches [action] [id]
```

## Arguments

- `action` (optional): What to do: list, show or cancel
- `id` (optional): The batch run's id, as the list shows it

## Flags

- `--state <state>`: List those in this state only
- `--page <n>`: Which page of the list or problems, from 1
- `--url <url>`: The database the batch runs are in
- `--store <name>`: The store --url's database is

## On every command

- `--json`: Print data for tools instead of text
- `--full`: Show everything a report shortens
- `--help`: Show every flag, with examples
- `--color <when>`: Choose when to use colour

`jadpo batches --json` writes one JSON document to standard output instead of text, with the same exit code. The document has `schemaVersion`, `command` (`"batches"`), `ok`, `data` (what the command produced, `null` when it failed) and `diagnostics` (each error with its `rule`, `reason`, `next` and `help`). A command that needs a terminal refuses `--json` and names the flags that do the same job.

## Examples

```text
# See the batch runs and how far each is
jadpo batches
# See one run's progress and problems
jadpo batches show 4fa2c09e
# Stop a run after the batch in hand
jadpo batches cancel 4fa2c09e
```

## Errors

- [`cli.batches_arguments`](/docs/errors/cli.batches_arguments.md): A `jadpo batches` command names an action it doesn't have, no id or an id no batch run has, or a state or page it doesn't list
- [`batches.unavailable`](/docs/errors/batches.unavailable.md): The app's batch runs couldn't be read or cancelled in their database, because it can't be reached or has no table for them yet
- [`toolchain.project_not_found`](/docs/errors/toolchain.project_not_found.md): You ran a command that works on a project in a folder with no `app.jadpo`, in it or in any folder above it
