

# AWS Batch (`awsbatch`)
<a name="awsbatchcli"></a>

For information about AWS Batch, see [AWS Batch](https://aws.amazon.com/batch/). For documentation, see the [AWS Batch User Guide](https://docs.aws.amazon.com/batch/latest/userguide/).

**AWS ParallelCluster CLI commands for AWS Batch**

When you use the `awsbatch` scheduler, the AWS ParallelCluster CLI commands for AWS Batch are automatically installed in the AWS ParallelCluster head node. The CLI uses AWS Batch API operations and permits the following operations:
+ Submit and manage jobs.
+ Monitor jobs, queues, and hosts.
+ Mirror traditional scheduler commands.

**Important**  
AWS ParallelCluster doesn't support GPU jobs for AWS Batch. For more information, see [GPU jobs](https://docs.aws.amazon.com/batch/latest/userguide/gpu-jobs.html).

**Topics**
+ [

# `awsbsub`
](awsbatchcli.awsbsub.md)
+ [

# `awsbstat`
](awsbatchcli.awsbstat.md)
+ [

# `awsbout`
](awsbatchcli_awsbout.md)
+ [

# `awsbkill`
](awsbatchcli_awsbkill.md)
+ [

# `awsbqueues`
](awsbatchcli_awsbqueues.md)
+ [

# `awsbhosts`
](awsbatchcli_awsbhosts.md)

# `awsbsub`
<a name="awsbatchcli.awsbsub"></a>

Submits jobs to the job queue of the cluster.

```
awsbsub [-h] [-jn JOB_NAME] [-c CLUSTER] [-cf] [-w WORKING_DIR]
        [-pw PARENT_WORKING_DIR] [-if INPUT_FILE] [-p VCPUS] [-m MEMORY]
        [-e ENV] [-eb ENV_DENYLIST] [-r RETRY_ATTEMPTS] [-t TIMEOUT]
        [-n NODES] [-a ARRAY_SIZE] [-d DEPENDS_ON]
        [command] [arguments [arguments ...]]
```

**Important**  
AWS ParallelCluster doesn't support GPU jobs for AWS Batch. For more information, see [GPU jobs](https://docs.aws.amazon.com/batch/latest/userguide/gpu-jobs.html).

## Positional Arguments
<a name="awsbatchcli.awsbsub.args"></a>

***command***  
Submits the job (the command specified must be available on the compute instances) or the file name to be transferred. See also `--command-file`.

**arguments**  
(Optional) Specifies arguments for the command or the command-file.

## Named Arguments
<a name="awsbatchcli.awsbsub.namedargs"></a>

**-jn *JOB\$1NAME*, --job-name *JOB\$1NAME***  
Names the job. The first character must be either a letter or number. The job name can contain letters (both uppercase and lowercase), numbers, hyphens, and underscores, and be up to 128 characters in length. 

**-c *CLUSTER*, --cluster *CLUSTER***  
Specifies the cluster to use.

**-cf, --command-file**  
Indicates that the command is a file to be transferred to the compute instances.  
Default: False

**-w *WORKING\$1DIR*, --working-dir *WORKING\$1DIR***  
Specifies the folder to use as the job's working directory. If a working directory isn't specified, the job is run in the `job-<AWS_BATCH_JOB_ID>` subfolder of the user’s home directory. You can use either this parameter or the `--parent-working-dir` parameter.

**-pw *PARENT\$1WORKING\$1DIR*, --parent-working-dir *PARENT\$1WORKING\$1DIR***  
Specifies the parent folder of the job's working directory. If a parent working directory isn't specified, it defaults to the user’s home directory. A subfolder named `job-<AWS_BATCH_JOB_ID>` is created in the parent working directory. You can use either this parameter or the `--working-dir` parameter.

**-if *INPUT\$1FILE*, --input-file *INPUT\$1FILE***  
Specifies the file to be transferred to the compute instances, in the job's working directory. You can specify multiple input file parameters.

**-p *VCPUS*, --vcpus *VCPUS***  
Specifies the number of vCPUs to reserve for the container. When used together with `–nodes`, it identifies the number of vCPUs for each node.  
Default: 1

**-m *MEMORY*, --memory *MEMORY***  
Specifies the hard limit of memory (in MiB) to provide for the job. If your job attempts to exceed the memory limit specified here, the job is ended.  
Default: 128

**-e *ENV*, --env *ENV***  
Specifies a comma-separated list of environment variable names to export to the job environment. To export all environment variables, specify ‘all’. Note that a list of 'all' environment variables doesn't include those listed in the `–env-blacklist` parameter, or variables starting with the `PCLUSTER_*` or `AWS_*` prefix.

**-eb *ENV\$1DENYLIST*, --env-blacklist *ENV\$1DENYLIST***  
Specifies a comma-separated list of environment variable names to **not** export to the job environment. By default, `HOME`, `PWD`, `USER`, `PATH`, `LD_LIBRARY_PATH`, `TERM`, and `TERMCAP` are not exported.

**-r *RETRY\$1ATTEMPTS*, --retry-attempts *RETRY\$1ATTEMPTS***  
Specifies the number of times to move a job to the `RUNNABLE` status. You can specify between 1 and 10 attempts. If the value of attempts is greater than 1, the job is retried if it fails, until it has moved to a `RUNNABLE` status for the specified number of times.  
Default: 1

**-t *TIMEOUT*, --timeout *TIMEOUT***  
Specifies the time duration in seconds (measured from the job attempt’s `startedAt` timestamp) after which AWS Batch terminates your job if it hasn't finished. The timeout value must be at least 60 seconds.

**-n *NODES*, --nodes *NODES***  
Specifies the number of nodes to reserve for the job. Specify a value for this parameter to enable multi-node parallel submission.  
Multi-node parallel jobs aren't supported when the [`cluster_type`](cluster-definition.md#cluster-type) parameter is set to `spot`.

**-a *ARRAY\$1SIZE*, --array-size *ARRAY\$1SIZE***  
Indicates the size of the array. You can specify a value between 2 and 10,000. If you specify array properties for a job, it becomes an array job.

**-d *DEPENDS\$1ON*, --depends-on *DEPENDS\$1ON***  
Specifies a semicolon-separated list of dependencies for a job. A job can depend upon a maximum of 20 jobs. You can specify a `SEQUENTIAL` type dependency without specifying a job ID for array jobs. A sequential dependency allows each child array job to complete sequentially, starting at index 0. You can also specify an N\$1TO\$1N type dependency with a job ID for array jobs. An N\$1TO\$1N dependency means that each index child of this job must wait for the corresponding index child of each dependency to complete before it can begin. The syntax for this parameter is "jobId=*<string>*,type=*<string>*;...".

# `awsbstat`
<a name="awsbatchcli.awsbstat"></a>

Shows the jobs that are submitted in the cluster’s job queue.

```
awsbstat [-h] [-c CLUSTER] [-s STATUS] [-e] [-d] [job_ids [job_ids ...]]
```

## Positional Arguments
<a name="awsbatchcli.awsbstat.arguments"></a>

***job\$1ids***  
Specifies the space-separated list of job IDs to show in the output. If the job is a job array, all of the child jobs are displayed. If a single job is requested, it is shown in a detailed version.

## Named Arguments
<a name="awsbatchcli.awsbstat.namedarguments"></a>

**-c *CLUSTER*, --cluster *CLUSTER***  
Indicates the cluster to use.

**-s *STATUS*, --status *STATUS***  
Specifies a comma-separated list of job statuses to include. The default job status is “active.”. Accepted values are: `SUBMITTED`, `PENDING`, `RUNNABLE`, `STARTING`, `RUNNING`, `SUCCEEDED`, `FAILED`, and `ALL`.  
Default: “`SUBMITTED`,`PENDING`,`RUNNABLE`,`STARTING`,`RUNNING`”

**-e, --expand-children**  
Expands jobs with children (both array and multi-node parallel).  
Default: False

**-d, --details**  
Shows jobs details.  
Default: False

# `awsbout`
<a name="awsbatchcli_awsbout"></a>

Shows the output of a given job.

```
awsbout [ - h ] [ - c CLUSTER ] [ - hd HEAD ] [ - t TAIL ] [ - s ] [ - sp STREAM_PERIOD ] job_id
```

## Positional Arguments
<a name="awsbatchcli.awsbout.arguments"></a>

***job\$1id***  
Specifies the job ID.

## Named Arguments
<a name="awsbatchcli.awsbout.namedarguments"></a>

**-c *CLUSTER*, --cluster *CLUSTER***  
Indicates the cluster to use.

**-hd *HEAD*, --head *HEAD***  
Gets the first *HEAD* lines of the job output.

**-t *TAIL*, --tail *TAIL***  
Gets the last <tail> lines of the job output.

**-s, --stream**  
Gets the job output, and then waits for additional output to be produced. This argument can be used together with –tail to start from the latest <tail> lines of the job output.  
Default: False

**-sp *STREAM\$1PERIOD*, --stream-period *STREAM\$1PERIOD***  
Sets the streaming period.  
Default: 5

# `awsbkill`
<a name="awsbatchcli_awsbkill"></a>

Cancels or terminates jobs submitted in the cluster.

```
awsbkill [ - h ] [ - c CLUSTER ] [ - r REASON ] job_ids [ job_ids ... ]
```

## Positional Arguments
<a name="awsbatchcli.awsbkill.arguments"></a>

***job\$1ids***  
Specifies the space-separated list of job IDs to cancel or terminate.

## Named Arguments
<a name="awsbatchcli.awsbkill.namedarguments"></a>

**-c *CLUSTER*, --cluster *CLUSTER***  
Indicates the name of the cluster to use.

**-r *REASON*, --reason *REASON***  
Indicates the message to attach to a job, explaining the reason for canceling it.  
Default: “Terminated by the user”

# `awsbqueues`
<a name="awsbatchcli_awsbqueues"></a>

Shows the job queue that is associated with the cluster.

```
awsbqueues [ - h ] [ - c CLUSTER ] [ - d ] [ job_queues [ job_queues ... ]]
```

## Positional arguments
<a name="awsbatchcli.awsbqueues.arguments"></a>

***job\$1queues***  
Specifies the space-separated list of queue names to show. If a single queue is requested, it is shown in a detailed version.

## Named arguments
<a name="awsbatchcli.awsbqueues.namedarguments"></a>

**-c *CLUSTER*, --cluster *CLUSTER***  
Specifies the name of the cluster to use.

**-d, --details**  
Indicates whether to show the details of the queues.  
Default: False

# `awsbhosts`
<a name="awsbatchcli_awsbhosts"></a>

Shows the hosts that belong to the cluster’s compute environment.

```
awsbhosts [ - h ] [ - c CLUSTER ] [ - d ] [ instance_ids [ instance_ids ... ]]
```

## Positional Arguments
<a name="awsbatchcli.awsbhosts.arguments"></a>

***instance\$1ids***  
Specifies a space-separated list of instances IDs. If a single instance is requested, it is shown in a detailed version.

## Named Arguments
<a name="awsbatchcli.awsbhosts.namedarguments"></a>

**-c *CLUSTER*, --cluster *CLUSTER***  
Specifies the name of the cluster to use.

**-d, --details**  
Indicates whether to show the details of the hosts.  
Default: False