# CLI reference

## apolo-flow

**Usage:**

```bash
apolo-flow [OPTIONS] COMMAND [ARGS]...
```

**Options:**

| Name               | Description                                                                                       |
| ------------------ | ------------------------------------------------------------------------------------------------- |
| *--config PATH*    | Path to a directory with .apolo folder inside, automatic lookup is performed if not set (default) |
| *-v, --verbose*    | Give more output. Option is additive, and can be used up to 2 times.                              |
| *-q, --quiet*      | Give less output. Option is additive, and can be used up to 2 times.                              |
| *--show-traceback* | Show python traceback on error, useful for debugging the tool.                                    |
| *--version*        | Show the version and exit.                                                                        |
| *--help*           | Show this message and exit.                                                                       |

**Command Groups:**

| Usage                                             | Description                   |
| ------------------------------------------------- | ----------------------------- |
| [*apolo-flow completion*](#apolo-flow-completion) | Output shell completion code. |

**Commands:**

| Usage                                               | Description                                      |
| --------------------------------------------------- | ------------------------------------------------ |
| [*apolo-flow bake*](#apolo-flow-bake)               | Start a batch.                                   |
| [*apolo-flow bakes*](#apolo-flow-bakes)             | List existing bakes.                             |
| [*apolo-flow build*](#apolo-flow-build)             | Build an image.                                  |
| [*apolo-flow cancel*](#apolo-flow-cancel)           | Cancel a bake.                                   |
| [*apolo-flow clean*](#apolo-flow-clean)             | Clean volume.                                    |
| [*apolo-flow clear-cache*](#apolo-flow-clear-cache) | Clear cache.                                     |
| [*apolo-flow delete-flow*](#apolo-flow-delete-flow) | Completely remove flow with all related entities |
| [*apolo-flow download*](#apolo-flow-download)       | Download volume.                                 |
| [*apolo-flow init*](#apolo-flow-init)               | Initialize a flow from a selected template.      |
| [*apolo-flow inspect*](#apolo-flow-inspect)         | Inspect a bake.                                  |
| [*apolo-flow kill*](#apolo-flow-kill)               | Kill a job.                                      |
| [*apolo-flow logs*](#apolo-flow-logs)               | Print logs.                                      |
| [*apolo-flow mkvolumes*](#apolo-flow-mkvolumes)     | Create all remote folders for volumes.           |
| [*apolo-flow ps*](#apolo-flow-ps)                   | List all jobs                                    |
| [*apolo-flow restart*](#apolo-flow-restart)         | Start a batch.                                   |
| [*apolo-flow run*](#apolo-flow-run)                 | Run a job.                                       |
| [*apolo-flow show*](#apolo-flow-show)               | Show output of baked task.                       |
| [*apolo-flow status*](#apolo-flow-status)           | Show job status.                                 |
| [*apolo-flow upload*](#apolo-flow-upload)           | Upload volume.                                   |

### apolo-flow completion

Output shell completion code.

**Usage:**

```bash
apolo-flow completion [OPTIONS] COMMAND [ARGS]...
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

**Commands:**

| Usage                                                               | Description                                                          |
| ------------------------------------------------------------------- | -------------------------------------------------------------------- |
| [*apolo-flow completion generate*](#apolo-flow-completion-generate) | Provide instruction for shell completion generation.                 |
| [*apolo-flow completion patch*](#apolo-flow-completion-patch)       | Automatically patch shell configuration profile to enable completion |

#### apolo-flow completion generate

Provide instruction for shell completion generation.

**Usage:**

```bash
apolo-flow completion generate [OPTIONS] {bash|zsh}
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

#### apolo-flow completion patch

Automatically patch shell configuration profile to enable completion

**Usage:**

```bash
apolo-flow completion patch [OPTIONS] {bash|zsh}
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow bake

Start a batch.

Run BATCH pipeline remotely on the cluster.

**Usage:**

```bash
apolo-flow bake [OPTIONS] BATCH
```

**Options:**

| Name                          | Description                                |
| ----------------------------- | ------------------------------------------ |
| *--local-executor*            | Run primary job locally                    |
| *-p, --param \<TEXT TEXT>...* | Set params of the batch config             |
| *-n, --name NAME*             | Optional bake name                         |
| *--meta-from-file FILE*       | File with params for batch.                |
| *-t, --tag TAG*               | Optional bake tag, multiple values allowed |
| *--help*                      | Show this message and exit.                |

### apolo-flow bakes

List existing bakes.

**Usage:**

```bash
apolo-flow bakes [OPTIONS]
```

**Options:**

| Name                             | Description                                                                                                                                 |
| -------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------- |
| *-t, --tag TAG*                  | Filter out bakes by tag (multiple option)                                                                                                   |
| *--since DATE\_OR\_TIMEDELTA*    | Show bakes created after a specific date (including). Use value of format '1d2h3m4s' to specify moment in past relatively to current time.  |
| *--until DATE\_OR\_TIMEDELTA*    | Show bakes created before a specific date (including). Use value of format '1d2h3m4s' to specify moment in past relatively to current time. |
| *--recent-first / --recent-last* | Show newer bakes first or last                                                                                                              |
| *--help*                         | Show this message and exit.                                                                                                                 |

### apolo-flow build

Build an image.

Assemble the IMAGE remotely and publish it.

**Usage:**

```bash
apolo-flow build [OPTIONS] IMAGE
```

**Options:**

| Name                    | Description                                         |
| ----------------------- | --------------------------------------------------- |
| *-F, --force-overwrite* | Build even if the destination image already exists. |
| *--help*                | Show this message and exit.                         |

### apolo-flow cancel

Cancel a bake.

Cancel a bake execution by stopping all started tasks.

**Usage:**

```bash
apolo-flow cancel [OPTIONS] BAKE
```

**Options:**

| Name                    | Description                                 |
| ----------------------- | ------------------------------------------- |
| *-a, --attempt INTEGER* | Attempt number, the last attempt by default |
| *--help*                | Show this message and exit.                 |

### apolo-flow clean

Clean volume.

Clean remote files on VOLUME, use `clean ALL` for cleaning up all volumes.

**Usage:**

```bash
apolo-flow clean [OPTIONS] VOLUME
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow clear-cache

Clear cache.

Use `apolo-flow clear-cache <BATCH>` for cleaning up the cache for BATCH; Use `apolo-flow clear-cache <BATCH> <TASK_ID>` for cleaning up the cache for TASK\_ID in BATCH;

`apolo-flow clear-cache ALL` clears all caches.

**Usage:**

```bash
apolo-flow clear-cache [OPTIONS] BATCH [TASK_ID]
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow delete-flow

Completely remove flow with all related entities

**Usage:**

```bash
apolo-flow delete-flow [OPTIONS] FLOW_IDS...
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow download

Download volume.

Download remote files to local for VOLUME, use `download ALL` for downloading all volumes.

**Usage:**

```bash
apolo-flow download [OPTIONS] VOLUME
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow init

Initialize a flow from a selected template.

The structure of each flow template could be found at: default: <https://github.com/neuro-inc/flow-template> barebone: <https://github.com/neuro-inc/flow-template-barebone>

**Usage:**

```bash
apolo-flow init [OPTIONS] [[barebone|default]]
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow inspect

Inspect a bake.

Display a list of started/finished tasks of BAKE\_ID.

**Usage:**

```bash
apolo-flow inspect [OPTIONS] BAKE
```

**Options:**

| Name                      | Description                                                                              |
| ------------------------- | ---------------------------------------------------------------------------------------- |
| *-a, --attempt INTEGER*   | Attempt number, the last attempt by default                                              |
| *-o, --output-graph FILE* | A path to Graphviz (DOT) file. Autogenerated from BAKE\_ID and attempt number by default |
| *--dot*                   | Save DOT file with tasks statuses.                                                       |
| *--pdf*                   | Save PDF file with tasks statuses.                                                       |
| *--view*                  | Open generated PDF file with tasks statuses.                                             |
| *--help*                  | Show this message and exit.                                                              |

### apolo-flow kill

Kill a job.

Kill JOB-ID, use `kill ALL` for killing all jobs.

**Usage:**

```bash
apolo-flow kill [OPTIONS] JOB_ID [SUFFIX]
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow logs

Print logs.

Display logs for JOB-ID

**Usage:**

```bash
apolo-flow logs [OPTIONS] JOB_ID [SUFFIX]
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow mkvolumes

Create all remote folders for volumes.

**Usage:**

```bash
apolo-flow mkvolumes [OPTIONS]
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow ps

List all jobs

**Usage:**

```bash
apolo-flow ps [OPTIONS]
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow restart

Start a batch.

Run BATCH pipeline remotely on the cluster.

**Usage:**

```bash
apolo-flow restart [OPTIONS] BAKE
```

**Options:**

| Name                               | Description                                 |
| ---------------------------------- | ------------------------------------------- |
| *-a, --attempt INTEGER*            | Attempt number, the last attempt by default |
| *--local-executor*                 | Run primary job locally                     |
| *--from-failed / --no-from-failed* | Restart from the point of failure           |
| *--help*                           | Show this message and exit.                 |

### apolo-flow run

Run a job.

RUN job JOB-ID or ATTACH to it if the job is already running

For multi-jobs an explicit job suffix can be used with explicit job arguments.

**Usage:**

```bash
apolo-flow run [OPTIONS] JOB_ID [ARGS]...
```

**Options:**

| Name                          | Description                                |
| ----------------------------- | ------------------------------------------ |
| *-s, --suffix TEXT*           | Optional suffix for multi-jobs             |
| *-p, --param \<TEXT TEXT>...* | Set params of the batch config             |
| *--dry-run*                   | Print run command instead of starting job. |
| *--help*                      | Show this message and exit.                |

### apolo-flow show

Show output of baked task.

Display a logged output of TASK\_ID from BAKE\_ID.

**Usage:**

```bash
apolo-flow show [OPTIONS] BAKE TASK_ID
```

**Options:**

| Name                       | Description                                                                      |
| -------------------------- | -------------------------------------------------------------------------------- |
| *-a, --attempt INTEGER*    | Attempt number, the last attempt by default                                      |
| *-r, --raw / -R, --no-raw* | Raw mode disables the output postprocessing (the output is processed by default) |
| *--help*                   | Show this message and exit.                                                      |

### apolo-flow status

Show job status.

Print status for JOB-ID

**Usage:**

```bash
apolo-flow status [OPTIONS] JOB_ID [SUFFIX]
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |

### apolo-flow upload

Upload volume.

Upload local files to remote for VOLUME, use `upload ALL` for uploading all volumes.

**Usage:**

```bash
apolo-flow upload [OPTIONS] VOLUME
```

**Options:**

| Name     | Description                 |
| -------- | --------------------------- |
| *--help* | Show this message and exit. |
