Menu
AWS Batch
API Reference (API Version 2016-08-10)

DescribeJobs

Describes a list of AWS Batch jobs.

Request Syntax

POST /v1/describejobs HTTP/1.1
Content-type: application/json

{
   "jobs": [ "string" ]
}

URI Request Parameters

The request does not use any URI parameters.

Request Body

The request accepts the following data in JSON format.

jobs

A space-separated list of up to 100 job IDs.

Type: Array of strings

Required: Yes

Response Syntax

HTTP/1.1 200
Content-type: application/json

{
   "jobs": [ 
      { 
         "arrayProperties": { 
            "index": number,
            "size": number,
            "statusSummary": { 
               "string" : number 
            }
         },
         "attempts": [ 
            { 
               "container": { 
                  "containerInstanceArn": "string",
                  "exitCode": number,
                  "logStreamName": "string",
                  "reason": "string",
                  "taskArn": "string"
               },
               "startedAt": number,
               "statusReason": "string",
               "stoppedAt": number
            }
         ],
         "container": { 
            "command": [ "string" ],
            "containerInstanceArn": "string",
            "environment": [ 
               { 
                  "name": "string",
                  "value": "string"
               }
            ],
            "exitCode": number,
            "image": "string",
            "jobRoleArn": "string",
            "logStreamName": "string",
            "memory": number,
            "mountPoints": [ 
               { 
                  "containerPath": "string",
                  "readOnly": boolean,
                  "sourceVolume": "string"
               }
            ],
            "privileged": boolean,
            "readonlyRootFilesystem": boolean,
            "reason": "string",
            "taskArn": "string",
            "ulimits": [ 
               { 
                  "hardLimit": number,
                  "name": "string",
                  "softLimit": number
               }
            ],
            "user": "string",
            "vcpus": number,
            "volumes": [ 
               { 
                  "host": { 
                     "sourcePath": "string"
                  },
                  "name": "string"
               }
            ]
         },
         "createdAt": number,
         "dependsOn": [ 
            { 
               "jobId": "string",
               "type": "string"
            }
         ],
         "jobDefinition": "string",
         "jobId": "string",
         "jobName": "string",
         "jobQueue": "string",
         "parameters": { 
            "string" : "string" 
         },
         "retryStrategy": { 
            "attempts": number
         },
         "startedAt": number,
         "status": "string",
         "statusReason": "string",
         "stoppedAt": number
      }
   ]
}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

jobs

The list of jobs.

Type: Array of JobDetail objects

Errors

ClientException

These errors are usually caused by a client action, such as using an action or resource on behalf of a user that doesn't have permissions to use the action or resource, or specifying an identifier that is not valid.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server issue.

HTTP Status Code: 500

Example

In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an AWS Signature Version 4 signature. For more information about creating these signatures, see Signature Version 4 Signing Process in the AWS General Reference.

You only need to learn how to sign HTTP requests if you intend to manually create them. When you use the AWS Command Line Interface (AWS CLI) or one of the AWS SDKs to make requests to AWS, these tools automatically sign the requests for you with the access key that you specify when you configure the tools. When you use these tools, you don't need to learn how to sign requests yourself.

Example

This example describes a job with the specified job ID.

Sample Request

POST /v1/describejobs HTTP/1.1
Host: batch.us-east-1.amazonaws.com
Accept-Encoding: identity
Content-Length: 50
Authorization: AUTHPARAMS
X-Amz-Date: 20170327T151323Z
User-Agent: aws-cli/1.11.22 Python/2.7.12 Darwin/16.1.0 botocore/1.4.79

{
  "jobs": [
    "0668da57-1bcc-478b-bc14-5d4f1c1cef48"
  ]
}

Sample Response

HTTP/1.1 200 OK
Date: Mon, 27 Mar 2017 15:13:13 GMT
Content-Type: application/json
Content-Length: 1883
Connection: keep-alive
x-amzn-RequestId: e5628975-12ff-11e7-ab46-a583c88f0f07
X-Amzn-Trace-Id: Root=1-58d92c09-19ef6bec3f9f5a392d25738f
X-Cache: Miss from cloudfront
Via: 1.1 8a78b675adb2cce925860f2fe4383e71.cloudfront.net (CloudFront)
X-Amz-Cf-Id: TaW8k7yrDyXHgEU2udEEOAbliIY1iPmQr4LpN80ULdqyVGR6qP0q4Q==

{
  "jobs": [
    {
      "jobName": "EchoAttemptNumber",
      "jobId": "0668da57-1bcc-478b-bc14-5d4f1c1cef48",
      "jobQueue": "arn:aws:batch:us-east-1:012345678910:job-queue/HighPriority",
      "status": "FAILED",
      "attempts": [
        {
          "container": {
            "containerInstanceArn": "arn:aws:ecs:us-east-1:012345678910:container-instance/90bfe527-119c-494a-b8fe-f5999c66d214",
            "taskArn": "arn:aws:ecs:us-east-1:012345678910:task/af37d830-6978-4a2b-b796-e890e9b477b3",
            "exitCode": 1
          },
          "startedAt": 1490627002951,
          "stoppedAt": 1490627003065,
          "statusReason": "Essential container in task exited"
        },
        {
          "container": {
            "containerInstanceArn": "arn:aws:ecs:us-east-1:012345678910:container-instance/90bfe527-119c-494a-b8fe-f5999c66d214",
            "taskArn": "arn:aws:ecs:us-east-1:012345678910:task/3dfd4d0e-a177-4798-9c13-21b7148217bc",
            "exitCode": 2
          },
          "startedAt": 1490627019948,
          "stoppedAt": 1490627020059,
          "statusReason": "Essential container in task exited"
        },
        {
          "container": {
            "containerInstanceArn": "arn:aws:ecs:us-east-1:012345678910:container-instance/90bfe527-119c-494a-b8fe-f5999c66d214",
            "taskArn": "arn:aws:ecs:us-east-1:012345678910:task/22857040-182c-4af3-85f5-bb2c71edd282",
            "exitCode": 3
          },
          "startedAt": 1490627034798,
          "stoppedAt": 1490627034949,
          "statusReason": "Essential container in task exited"
        }
      ],
      "statusReason": "Essential container in task exited",
      "createdAt": 1490626709525,
      "retryStrategy": {
        "attempts": 3
      },
      "startedAt": 1490627034798,
      "stoppedAt": 1490627034949,
      "dependsOn": [],
      "jobDefinition": "arn:aws:batch:us-east-1:012345678910:job-definition/EchoAttemptNumber:1",
      "parameters": {},
      "container": {
        "image": "amazonlinux",
        "vcpus": 1,
        "memory": 2,
        "command": [
          "/bin/bash",
          "-c",
          "exit $AWS_BATCH_JOB_ATTEMPT"
        ],
        "volumes": [],
        "environment": [],
        "mountPoints": [],
        "ulimits": [],
        "exitCode": 3,
        "containerInstanceArn": "arn:aws:ecs:us-east-1:012345678910:container-instance/90bfe527-119c-494a-b8fe-f5999c66d214",
        "taskArn": "arn:aws:ecs:us-east-1:012345678910:task/22857040-182c-4af3-85f5-bb2c71edd282"
      }
    }
  ]
}

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: