[ aws . batch ]

submit-job

Description

Submits an AWS Batch job from a job definition. Parameters specified during SubmitJob override parameters defined in the job definition.

See also: AWS API Documentation

See ‘aws help’ for descriptions of global parameters.

Synopsis

  submit-job
--job-name <value>
--job-queue <value>
[--array-properties <value>]
[--depends-on <value>]
--job-definition <value>
[--parameters <value>]
[--container-overrides <value>]
[--node-overrides <value>]
[--retry-strategy <value>]
[--timeout <value>]
[--cli-input-json | --cli-input-yaml]
[--generate-cli-skeleton <value>]
[--cli-auto-prompt <value>]

Options

--job-name (string)

The name of the job. The first character must be alphanumeric, and up to 128 letters (uppercase and lowercase), numbers, hyphens, and underscores are allowed.

--job-queue (string)

The job queue into which the job is submitted. You can specify either the name or the Amazon Resource Name (ARN) of the queue.

--array-properties (structure)

The array properties for the submitted job, such as the size of the array. The array size can be between 2 and 10,000. If you specify array properties for a job, it becomes an array job. For more information, see Array Jobs in the AWS Batch User Guide .

size -> (integer)

The size of the array job.

Shorthand Syntax:

size=integer

JSON Syntax:

{
  "size": integer
}

--depends-on (list)

A list of dependencies for the 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 so that each child array job completes sequentially, starting at index 0. You can also specify an N_TO_N type dependency with a job ID for array jobs. In that case, each index child of this job must wait for the corresponding index child of each dependency to complete before it can begin.

(structure)

An object representing an AWS Batch job dependency.

jobId -> (string)

The job ID of the AWS Batch job associated with this dependency.

type -> (string)

The type of the job dependency.

Shorthand Syntax:

jobId=string,type=string ...

JSON Syntax:

[
  {
    "jobId": "string",
    "type": "N_TO_N"|"SEQUENTIAL"
  }
  ...
]

--job-definition (string)

The job definition used by this job. This value can be one of name , name:revision , or the Amazon Resource Name (ARN) for the job definition. If name is specified without a revision then the latest active revision is used.

--parameters (map)

Additional parameters passed to the job that replace parameter substitution placeholders that are set in the job definition. Parameters are specified as a key and value pair mapping. Parameters in a SubmitJob request override any corresponding parameter defaults from the job definition.

key -> (string)

value -> (string)

Shorthand Syntax:

KeyName1=string,KeyName2=string

JSON Syntax:

{"string": "string"
  ...}

--container-overrides (structure)

A list of container overrides in JSON format that specify the name of a container in the specified job definition and the overrides it should receive. You can override the default command for a container (that is specified in the job definition or the Docker image) with a command override. You can also override existing environment variables (that are specified in the job definition or Docker image) on a container or add new environment variables to it with an environment override.

vcpus -> (integer)

The number of vCPUs to reserve for the container. This value overrides the value set in the job definition.

memory -> (integer)

The number of MiB of memory reserved for the job. This value overrides the value set in the job definition.

command -> (list)

The command to send to the container that overrides the default command from the Docker image or the job definition.

(string)

instanceType -> (string)

The instance type to use for a multi-node parallel job. This parameter is not valid for single-node container jobs.

environment -> (list)

The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the job definition.

Note

Environment variables must not start with AWS_BATCH ; this naming convention is reserved for variables that are set by the AWS Batch service.

(structure)

A key-value pair object.

name -> (string)

The name of the key-value pair. For environment variables, this is the name of the environment variable.

value -> (string)

The value of the key-value pair. For environment variables, this is the value of the environment variable.

resourceRequirements -> (list)

The type and amount of a resource to assign to a container. This value overrides the value set in the job definition. Currently, the only supported resource is GPU .

(structure)

The type and amount of a resource to assign to a container. Currently, the only supported resource type is GPU .

value -> (string)

The number of physical GPUs to reserve for the container. The number of GPUs reserved for all containers in a job should not exceed the number of available GPUs on the compute resource that the job is launched on.

type -> (string)

The type of resource to assign to a container. Currently, the only supported resource type is GPU .

Shorthand Syntax:

vcpus=integer,memory=integer,command=string,string,instanceType=string,environment=[{name=string,value=string},{name=string,value=string}],resourceRequirements=[{value=string,type=string},{value=string,type=string}]

JSON Syntax:

{
  "vcpus": integer,
  "memory": integer,
  "command": ["string", ...],
  "instanceType": "string",
  "environment": [
    {
      "name": "string",
      "value": "string"
    }
    ...
  ],
  "resourceRequirements": [
    {
      "value": "string",
      "type": "GPU"
    }
    ...
  ]
}

--node-overrides (structure)

A list of node overrides in JSON format that specify the node range to target and the container overrides for that node range.

numNodes -> (integer)

The number of nodes to use with a multi-node parallel job. This value overrides the number of nodes that are specified in the job definition. To use this override:

  • There must be at least one node range in your job definition that has an open upper boundary (such as : or n: ).

  • The lower boundary of the node range specified in the job definition must be fewer than the number of nodes specified in the override.

  • The main node index specified in the job definition must be fewer than the number of nodes specified in the override.

nodePropertyOverrides -> (list)

The node property overrides for the job.

(structure)

Object representing any node overrides to a job definition that is used in a SubmitJob API operation.

targetNodes -> (string)

The range of nodes, using node index values, with which to override. A range of 0:3 indicates nodes with index values of 0 through 3 . If the starting range value is omitted (:n ), then 0 is used to start the range. If the ending range value is omitted (n: ), then the highest possible node index is used to end the range.

containerOverrides -> (structure)

The overrides that should be sent to a node range.

vcpus -> (integer)

The number of vCPUs to reserve for the container. This value overrides the value set in the job definition.

memory -> (integer)

The number of MiB of memory reserved for the job. This value overrides the value set in the job definition.

command -> (list)

The command to send to the container that overrides the default command from the Docker image or the job definition.

(string)

instanceType -> (string)

The instance type to use for a multi-node parallel job. This parameter is not valid for single-node container jobs.

environment -> (list)

The environment variables to send to the container. You can add new environment variables, which are added to the container at launch, or you can override the existing environment variables from the Docker image or the job definition.

Note

Environment variables must not start with AWS_BATCH ; this naming convention is reserved for variables that are set by the AWS Batch service.

(structure)

A key-value pair object.

name -> (string)

The name of the key-value pair. For environment variables, this is the name of the environment variable.

value -> (string)

The value of the key-value pair. For environment variables, this is the value of the environment variable.

resourceRequirements -> (list)

The type and amount of a resource to assign to a container. This value overrides the value set in the job definition. Currently, the only supported resource is GPU .

(structure)

The type and amount of a resource to assign to a container. Currently, the only supported resource type is GPU .

value -> (string)

The number of physical GPUs to reserve for the container. The number of GPUs reserved for all containers in a job should not exceed the number of available GPUs on the compute resource that the job is launched on.

type -> (string)

The type of resource to assign to a container. Currently, the only supported resource type is GPU .

JSON Syntax:

{
  "numNodes": integer,
  "nodePropertyOverrides": [
    {
      "targetNodes": "string",
      "containerOverrides": {
        "vcpus": integer,
        "memory": integer,
        "command": ["string", ...],
        "instanceType": "string",
        "environment": [
          {
            "name": "string",
            "value": "string"
          }
          ...
        ],
        "resourceRequirements": [
          {
            "value": "string",
            "type": "GPU"
          }
          ...
        ]
      }
    }
    ...
  ]
}

--retry-strategy (structure)

The retry strategy to use for failed jobs from this SubmitJob operation. When a retry strategy is specified here, it overrides the retry strategy defined in the job definition.

attempts -> (integer)

The number of times to move a job to the RUNNABLE status. You may specify between 1 and 10 attempts. If the value of attempts is greater than one, the job is retried on failure the same number of attempts as the value.

Shorthand Syntax:

attempts=integer

JSON Syntax:

{
  "attempts": integer
}

--timeout (structure)

The timeout configuration for this SubmitJob operation. You can specify a timeout duration after which AWS Batch terminates your jobs if they have not finished. If a job is terminated due to a timeout, it is not retried. The minimum value for the timeout is 60 seconds. This configuration overrides any timeout configuration specified in the job definition. For array jobs, child jobs have the same timeout configuration as the parent job. For more information, see Job Timeouts in the Amazon Elastic Container Service Developer Guide .

attemptDurationSeconds -> (integer)

The time duration in seconds (measured from the job attempt’s startedAt timestamp) after which AWS Batch terminates your jobs if they have not finished.

Shorthand Syntax:

attemptDurationSeconds=integer

JSON Syntax:

{
  "attemptDurationSeconds": integer
}

--cli-input-json | --cli-input-yaml (string) Reads arguments from the JSON string provided. The JSON string follows the format provided by --generate-cli-skeleton. If other arguments are provided on the command line, those values will override the JSON-provided values. It is not possible to pass arbitrary binary values using a JSON-provided value as the string will be taken literally. This may not be specified along with --cli-input-yaml.

--generate-cli-skeleton (string) Prints a JSON skeleton to standard output without sending an API request. If provided with no value or the value input, prints a sample input JSON that can be used as an argument for --cli-input-json. Similarly, if provided yaml-input it will print a sample input YAML that can be used with --cli-input-yaml. If provided with the value output, it validates the command inputs and returns a sample output JSON for that command.

--cli-auto-prompt (boolean) Automatically prompt for CLI input parameters.

See ‘aws help’ for descriptions of global parameters.

Examples

To submit a job

This example submits a simple container job called example to the HighPriority job queue.

Command:

aws batch submit-job --job-name example --job-queue HighPriority  --job-definition sleep60

Output:

{
    "jobName": "example",
    "jobId": "876da822-4198-45f2-a252-6cea32512ea8"
}

Output

jobName -> (string)

The name of the job.

jobId -> (string)

The unique identifier for the job.