Table of Contents
Batch.Client¶A low-level client representing AWS Batch:
client = session.create_client('batch')
These are the available methods:
can_paginate()cancel_job()create_compute_environment()create_job_queue()delete_compute_environment()delete_job_queue()deregister_job_definition()describe_compute_environments()describe_job_definitions()describe_job_queues()describe_jobs()generate_presigned_url()get_paginator()get_waiter()list_jobs()register_job_definition()submit_job()terminate_job()update_compute_environment()update_job_queue()can_paginate(operation_name)¶Check if an operation can be paginated.
| Parameters: | operation_name (string) – The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you’d normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo"). |
|---|---|
| Returns: | True if the operation can be paginated,
False otherwise. |
cancel_job(**kwargs)¶Cancels jobs in an AWS Batch job queue. Jobs that are in the SUBMITTED , PENDING , or RUNNABLE state are cancelled. Jobs that have progressed to STARTING or RUNNING are not cancelled (but the API operation still succeeds, even if no jobs are cancelled); these jobs must be terminated with the TerminateJob operation.
See also: AWS API Documentation
Request Syntax
response = client.cancel_job(
jobId='string',
reason='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {}
Response Structure
|
Examples
This example cancels a job with the specified job ID.
response = client.cancel_job(
jobId='1d828f65-7a4d-42e8-996d-3b900ed59dc4',
reason='Cancelling job.',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
create_compute_environment(**kwargs)¶Creates an AWS Batch compute environment. You can create MANAGED or UNMANAGED compute environments.
In a managed compute environment, AWS Batch manages the compute resources within the environment, based on the compute resources that you specify. Instances launched into a managed compute environment use the latest Amazon ECS-optimized AMI. You can choose to use Amazon EC2 On-Demand instances in your managed compute environment, or you can use Amazon EC2 Spot instances that only launch when the Spot bid price is below a specified percentage of the On-Demand price.
In an unmanaged compute environment, you can manage your own compute resources. This provides more compute resource configuration options, such as using a custom AMI, but you must ensure that your AMI meets the Amazon ECS container instance AMI specification. For more information, see Container Instance AMIs in the Amazon EC2 Container Service Developer Guide . After you have created your unmanaged compute environment, you can use the DescribeComputeEnvironments operation to find the Amazon ECS cluster that is associated with it and then manually launch your container instances into that Amazon ECS cluster. For more information, see Launching an Amazon ECS Container Instance in the Amazon EC2 Container Service Developer Guide .
See also: AWS API Documentation
Request Syntax
response = client.create_compute_environment(
computeEnvironmentName='string',
type='MANAGED'|'UNMANAGED',
state='ENABLED'|'DISABLED',
computeResources={
'type': 'EC2'|'SPOT',
'minvCpus': 123,
'maxvCpus': 123,
'desiredvCpus': 123,
'instanceTypes': [
'string',
],
'imageId': 'string',
'subnets': [
'string',
],
'securityGroupIds': [
'string',
],
'ec2KeyPair': 'string',
'instanceRole': 'string',
'tags': {
'string': 'string'
},
'bidPercentage': 123,
'spotIamFleetRole': 'string'
},
serviceRole='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'computeEnvironmentName': 'string',
'computeEnvironmentArn': 'string'
}
Response Structure
|
Examples
This example creates a managed compute environment with specific C4 instance types that are launched on demand. The compute environment is called C4OnDemand.
response = client.create_compute_environment(
type='MANAGED',
computeEnvironmentName='C4OnDemand',
computeResources={
'type': 'EC2',
'desiredvCpus': 48,
'ec2KeyPair': 'id_rsa',
'instanceRole': 'ecsInstanceRole',
'instanceTypes': [
'c4.large',
'c4.xlarge',
'c4.2xlarge',
'c4.4xlarge',
'c4.8xlarge',
],
'maxvCpus': 128,
'minvCpus': 0,
'securityGroupIds': [
'sg-cf5093b2',
],
'subnets': [
'subnet-220c0e0a',
'subnet-1a95556d',
'subnet-978f6dce',
],
'tags': {
'Name': 'Batch Instance - C4OnDemand',
},
},
serviceRole='arn:aws:iam::012345678910:role/AWSBatchServiceRole',
state='ENABLED',
)
print(response)
Expected Output:
{
'computeEnvironmentArn': 'arn:aws:batch:us-east-1:012345678910:compute-environment/C4OnDemand',
'computeEnvironmentName': 'C4OnDemand',
'ResponseMetadata': {
'...': '...',
},
}
This example creates a managed compute environment with the M4 instance type that is launched when the Spot bid price is at or below 20% of the On-Demand price for the instance type. The compute environment is called M4Spot.
response = client.create_compute_environment(
type='MANAGED',
computeEnvironmentName='M4Spot',
computeResources={
'type': 'SPOT',
'bidPercentage': 20,
'desiredvCpus': 4,
'ec2KeyPair': 'id_rsa',
'instanceRole': 'ecsInstanceRole',
'instanceTypes': [
'm4',
],
'maxvCpus': 128,
'minvCpus': 0,
'securityGroupIds': [
'sg-cf5093b2',
],
'spotIamFleetRole': 'arn:aws:iam::012345678910:role/aws-ec2-spot-fleet-role',
'subnets': [
'subnet-220c0e0a',
'subnet-1a95556d',
'subnet-978f6dce',
],
'tags': {
'Name': 'Batch Instance - M4Spot',
},
},
serviceRole='arn:aws:iam::012345678910:role/AWSBatchServiceRole',
state='ENABLED',
)
print(response)
Expected Output:
{
'computeEnvironmentArn': 'arn:aws:batch:us-east-1:012345678910:compute-environment/M4Spot',
'computeEnvironmentName': 'M4Spot',
'ResponseMetadata': {
'...': '...',
},
}
create_job_queue(**kwargs)¶Creates an AWS Batch job queue. When you create a job queue, you associate one or more compute environments to the queue and assign an order of preference for the compute environments.
You also set a priority to the job queue that determines the order in which the AWS Batch scheduler places jobs onto its associated compute environments. For example, if a compute environment is associated with more than one job queue, the job queue with a higher priority is given preference for scheduling jobs to that compute environment.
See also: AWS API Documentation
Request Syntax
response = client.create_job_queue(
jobQueueName='string',
state='ENABLED'|'DISABLED',
priority=123,
computeEnvironmentOrder=[
{
'order': 123,
'computeEnvironment': 'string'
},
]
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'jobQueueName': 'string',
'jobQueueArn': 'string'
}
Response Structure
|
Examples
This example creates a job queue called LowPriority that uses the M4Spot compute environment.
response = client.create_job_queue(
computeEnvironmentOrder=[
{
'computeEnvironment': 'M4Spot',
'order': 1,
},
],
jobQueueName='LowPriority',
priority=10,
state='ENABLED',
)
print(response)
Expected Output:
{
'jobQueueArn': 'arn:aws:batch:us-east-1:012345678910:job-queue/LowPriority',
'jobQueueName': 'LowPriority',
'ResponseMetadata': {
'...': '...',
},
}
This example creates a job queue called HighPriority that uses the C4OnDemand compute environment with an order of 1 and the M4Spot compute environment with an order of 2.
response = client.create_job_queue(
computeEnvironmentOrder=[
{
'computeEnvironment': 'C4OnDemand',
'order': 1,
},
{
'computeEnvironment': 'M4Spot',
'order': 2,
},
],
jobQueueName='HighPriority',
priority=1,
state='ENABLED',
)
print(response)
Expected Output:
{
'jobQueueArn': 'arn:aws:batch:us-east-1:012345678910:job-queue/HighPriority',
'jobQueueName': 'HighPriority',
'ResponseMetadata': {
'...': '...',
},
}
delete_compute_environment(**kwargs)¶Deletes an AWS Batch compute environment.
Before you can delete a compute environment, you must set its state to DISABLED with the UpdateComputeEnvironment API operation and disassociate it from any job queues with the UpdateJobQueue API operation.
See also: AWS API Documentation
Request Syntax
response = client.delete_compute_environment(
computeEnvironment='string'
)
| Parameters: | computeEnvironment (string) – [REQUIRED] The name or Amazon Resource Name (ARN) of the compute environment to delete. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{}
Response Structure
|
Examples
This example deletes the P2OnDemand compute environment.
response = client.delete_compute_environment(
computeEnvironment='P2OnDemand',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
delete_job_queue(**kwargs)¶Deletes the specified job queue. You must first disable submissions for a queue with the UpdateJobQueue operation and terminate any jobs that have not completed with the TerminateJob .
It is not necessary to disassociate compute environments from a queue before submitting a DeleteJobQueue request.
See also: AWS API Documentation
Request Syntax
response = client.delete_job_queue(
jobQueue='string'
)
| Parameters: | jobQueue (string) – [REQUIRED] The short name or full Amazon Resource Name (ARN) of the queue to delete. |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{}
Response Structure
|
Examples
This example deletes the GPGPU job queue.
response = client.delete_job_queue(
jobQueue='GPGPU',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
deregister_job_definition(**kwargs)¶Deregisters an AWS Batch job definition.
See also: AWS API Documentation
Request Syntax
response = client.deregister_job_definition(
jobDefinition='string'
)
| Parameters: | jobDefinition (string) – [REQUIRED] The name and revision ( |
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{}
Response Structure
|
Examples
This example deregisters a job definition called sleep10.
response = client.deregister_job_definition(
jobDefinition='sleep10',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
describe_compute_environments(**kwargs)¶Describes one or more of your compute environments.
If you are using an unmanaged compute environment, you can use the DescribeComputeEnvironment operation to determine the ecsClusterArn that you should launch your Amazon ECS container instances into.
See also: AWS API Documentation
Request Syntax
response = client.describe_compute_environments(
computeEnvironments=[
'string',
],
maxResults=123,
nextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'computeEnvironments': [
{
'computeEnvironmentName': 'string',
'computeEnvironmentArn': 'string',
'ecsClusterArn': 'string',
'type': 'MANAGED'|'UNMANAGED',
'state': 'ENABLED'|'DISABLED',
'status': 'CREATING'|'UPDATING'|'DELETING'|'DELETED'|'VALID'|'INVALID',
'statusReason': 'string',
'computeResources': {
'type': 'EC2'|'SPOT',
'minvCpus': 123,
'maxvCpus': 123,
'desiredvCpus': 123,
'instanceTypes': [
'string',
],
'imageId': 'string',
'subnets': [
'string',
],
'securityGroupIds': [
'string',
],
'ec2KeyPair': 'string',
'instanceRole': 'string',
'tags': {
'string': 'string'
},
'bidPercentage': 123,
'spotIamFleetRole': 'string'
},
'serviceRole': 'string'
},
],
'nextToken': 'string'
}
Response Structure
|
Examples
This example describes the P2OnDemand compute environment.
response = client.describe_compute_environments(
computeEnvironments=[
'P2OnDemand',
],
)
print(response)
Expected Output:
{
'computeEnvironments': [
{
'type': 'MANAGED',
'computeEnvironmentArn': 'arn:aws:batch:us-east-1:012345678910:compute-environment/P2OnDemand',
'computeEnvironmentName': 'P2OnDemand',
'computeResources': {
'type': 'EC2',
'desiredvCpus': 48,
'ec2KeyPair': 'id_rsa',
'instanceRole': 'ecsInstanceRole',
'instanceTypes': [
'p2',
],
'maxvCpus': 128,
'minvCpus': 0,
'securityGroupIds': [
'sg-cf5093b2',
],
'subnets': [
'subnet-220c0e0a',
'subnet-1a95556d',
'subnet-978f6dce',
],
'tags': {
'Name': 'Batch Instance - P2OnDemand',
},
},
'ecsClusterArn': 'arn:aws:ecs:us-east-1:012345678910:cluster/P2OnDemand_Batch_2c06f29d-d1fe-3a49-879d-42394c86effc',
'serviceRole': 'arn:aws:iam::012345678910:role/AWSBatchServiceRole',
'state': 'ENABLED',
'status': 'VALID',
'statusReason': 'ComputeEnvironment Healthy',
},
],
'ResponseMetadata': {
'...': '...',
},
}
describe_job_definitions(**kwargs)¶Describes a list of job definitions. You can specify a status (such as ACTIVE ) to only return job definitions that match that status.
See also: AWS API Documentation
Request Syntax
response = client.describe_job_definitions(
jobDefinitions=[
'string',
],
maxResults=123,
jobDefinitionName='string',
status='string',
nextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'jobDefinitions': [
{
'jobDefinitionName': 'string',
'jobDefinitionArn': 'string',
'revision': 123,
'status': 'string',
'type': 'string',
'parameters': {
'string': 'string'
},
'retryStrategy': {
'attempts': 123
},
'containerProperties': {
'image': 'string',
'vcpus': 123,
'memory': 123,
'command': [
'string',
],
'jobRoleArn': 'string',
'volumes': [
{
'host': {
'sourcePath': 'string'
},
'name': 'string'
},
],
'environment': [
{
'name': 'string',
'value': 'string'
},
],
'mountPoints': [
{
'containerPath': 'string',
'readOnly': True|False,
'sourceVolume': 'string'
},
],
'readonlyRootFilesystem': True|False,
'privileged': True|False,
'ulimits': [
{
'hardLimit': 123,
'name': 'string',
'softLimit': 123
},
],
'user': 'string'
}
},
],
'nextToken': 'string'
}
Response Structure
|
Examples
This example describes all of your active job definitions.
response = client.describe_job_definitions(
status='ACTIVE',
)
print(response)
Expected Output:
{
'jobDefinitions': [
{
'type': 'container',
'containerProperties': {
'command': [
'sleep',
'60',
],
'environment': [
],
'image': 'busybox',
'memory': 128,
'mountPoints': [
],
'ulimits': [
],
'vcpus': 1,
'volumes': [
],
},
'jobDefinitionArn': 'arn:aws:batch:us-east-1:012345678910:job-definition/sleep60:1',
'jobDefinitionName': 'sleep60',
'revision': 1,
'status': 'ACTIVE',
},
],
'ResponseMetadata': {
'...': '...',
},
}
describe_job_queues(**kwargs)¶Describes one or more of your job queues.
See also: AWS API Documentation
Request Syntax
response = client.describe_job_queues(
jobQueues=[
'string',
],
maxResults=123,
nextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'jobQueues': [
{
'jobQueueName': 'string',
'jobQueueArn': 'string',
'state': 'ENABLED'|'DISABLED',
'status': 'CREATING'|'UPDATING'|'DELETING'|'DELETED'|'VALID'|'INVALID',
'statusReason': 'string',
'priority': 123,
'computeEnvironmentOrder': [
{
'order': 123,
'computeEnvironment': 'string'
},
]
},
],
'nextToken': 'string'
}
Response Structure
|
Examples
This example describes the HighPriority job queue.
response = client.describe_job_queues(
jobQueues=[
'HighPriority',
],
)
print(response)
Expected Output:
{
'jobQueues': [
{
'computeEnvironmentOrder': [
{
'computeEnvironment': 'arn:aws:batch:us-east-1:012345678910:compute-environment/C4OnDemand',
'order': 1,
},
],
'jobQueueArn': 'arn:aws:batch:us-east-1:012345678910:job-queue/HighPriority',
'jobQueueName': 'HighPriority',
'priority': 1,
'state': 'ENABLED',
'status': 'VALID',
'statusReason': 'JobQueue Healthy',
},
],
'ResponseMetadata': {
'...': '...',
},
}
describe_jobs(**kwargs)¶Describes a list of AWS Batch jobs.
See also: AWS API Documentation
Request Syntax
response = client.describe_jobs(
jobs=[
'string',
]
)
| Parameters: | jobs (list) – [REQUIRED] A space-separated list of up to 100 job IDs.
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax{
'jobs': [
{
'jobName': 'string',
'jobId': 'string',
'jobQueue': 'string',
'status': 'SUBMITTED'|'PENDING'|'RUNNABLE'|'STARTING'|'RUNNING'|'SUCCEEDED'|'FAILED',
'attempts': [
{
'container': {
'containerInstanceArn': 'string',
'taskArn': 'string',
'exitCode': 123,
'reason': 'string'
},
'startedAt': 123,
'stoppedAt': 123,
'statusReason': 'string'
},
],
'statusReason': 'string',
'createdAt': 123,
'retryStrategy': {
'attempts': 123
},
'startedAt': 123,
'stoppedAt': 123,
'dependsOn': [
{
'jobId': 'string'
},
],
'jobDefinition': 'string',
'parameters': {
'string': 'string'
},
'container': {
'image': 'string',
'vcpus': 123,
'memory': 123,
'command': [
'string',
],
'jobRoleArn': 'string',
'volumes': [
{
'host': {
'sourcePath': 'string'
},
'name': 'string'
},
],
'environment': [
{
'name': 'string',
'value': 'string'
},
],
'mountPoints': [
{
'containerPath': 'string',
'readOnly': True|False,
'sourceVolume': 'string'
},
],
'readonlyRootFilesystem': True|False,
'ulimits': [
{
'hardLimit': 123,
'name': 'string',
'softLimit': 123
},
],
'privileged': True|False,
'user': 'string',
'exitCode': 123,
'reason': 'string',
'containerInstanceArn': 'string',
'taskArn': 'string'
}
},
]
}
Response Structure
|
Examples
This example describes a job with the specified job ID.
response = client.describe_jobs(
jobs=[
'24fa2d7a-64c4-49d2-8b47-f8da4fbde8e9',
],
)
print(response)
Expected Output:
{
'jobs': [
{
'container': {
'command': [
'sleep',
'60',
],
'containerInstanceArn': 'arn:aws:ecs:us-east-1:012345678910:container-instance/5406d7cd-58bd-4b8f-9936-48d7c6b1526c',
'environment': [
],
'exitCode': 0,
'image': 'busybox',
'memory': 128,
'mountPoints': [
],
'ulimits': [
],
'vcpus': 1,
'volumes': [
],
},
'createdAt': 1480460782010,
'dependsOn': [
],
'jobDefinition': 'sleep60',
'jobId': '24fa2d7a-64c4-49d2-8b47-f8da4fbde8e9',
'jobName': 'example',
'jobQueue': 'arn:aws:batch:us-east-1:012345678910:job-queue/HighPriority',
'parameters': {
},
'startedAt': 1480460816500,
'status': 'SUCCEEDED',
'stoppedAt': 1480460880699,
},
],
'ResponseMetadata': {
'...': '...',
},
}
generate_presigned_url(ClientMethod, Params=None, ExpiresIn=3600, HttpMethod=None)¶Generate a presigned url given a client, its method, and arguments
| Parameters: |
|
|---|---|
| Returns: | The presigned url |
get_paginator(operation_name)¶Create a paginator for an operation.
| Parameters: | operation_name (string) – The operation name. This is the same name
as the method name on the client. For example, if the
method name is create_foo, and you’d normally invoke the
operation as client.create_foo(**kwargs), if the
create_foo operation can be paginated, you can use the
call client.get_paginator("create_foo"). |
|---|---|
| Raises: | OperationNotPageableError – Raised if the operation is not
pageable. You can use the client.can_paginate method to
check if an operation is pageable. |
| Return type: | L{botocore.paginate.Paginator} |
| Returns: | A paginator object. |
get_waiter(waiter_name)¶list_jobs(**kwargs)¶Returns a list of task jobs for a specified job queue. You can filter the results by job status with the jobStatus parameter.
See also: AWS API Documentation
Request Syntax
response = client.list_jobs(
jobQueue='string',
jobStatus='SUBMITTED'|'PENDING'|'RUNNABLE'|'STARTING'|'RUNNING'|'SUCCEEDED'|'FAILED',
maxResults=123,
nextToken='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'jobSummaryList': [
{
'jobId': 'string',
'jobName': 'string'
},
],
'nextToken': 'string'
}
Response Structure
|
Examples
This example lists the running jobs in the HighPriority job queue.
response = client.list_jobs(
jobQueue='HighPriority',
)
print(response)
Expected Output:
{
'jobSummaryList': [
{
'jobId': 'e66ff5fd-a1ff-4640-b1a2-0b0a142f49bb',
'jobName': 'example',
},
],
'ResponseMetadata': {
'...': '...',
},
}
This example lists jobs in the HighPriority job queue that are in the SUBMITTED job status.
response = client.list_jobs(
jobQueue='HighPriority',
jobStatus='SUBMITTED',
)
print(response)
Expected Output:
{
'jobSummaryList': [
{
'jobId': '68f0c163-fbd4-44e6-9fd1-25b14a434786',
'jobName': 'example',
},
],
'ResponseMetadata': {
'...': '...',
},
}
register_job_definition(**kwargs)¶Registers an AWS Batch job definition.
See also: AWS API Documentation
Request Syntax
response = client.register_job_definition(
jobDefinitionName='string',
type='container',
parameters={
'string': 'string'
},
containerProperties={
'image': 'string',
'vcpus': 123,
'memory': 123,
'command': [
'string',
],
'jobRoleArn': 'string',
'volumes': [
{
'host': {
'sourcePath': 'string'
},
'name': 'string'
},
],
'environment': [
{
'name': 'string',
'value': 'string'
},
],
'mountPoints': [
{
'containerPath': 'string',
'readOnly': True|False,
'sourceVolume': 'string'
},
],
'readonlyRootFilesystem': True|False,
'privileged': True|False,
'ulimits': [
{
'hardLimit': 123,
'name': 'string',
'softLimit': 123
},
],
'user': 'string'
},
retryStrategy={
'attempts': 123
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'jobDefinitionName': 'string',
'jobDefinitionArn': 'string',
'revision': 123
}
Response Structure
|
Examples
This example registers a job definition for a simple container job.
response = client.register_job_definition(
type='container',
containerProperties={
'command': [
'sleep',
'10',
],
'image': 'busybox',
'memory': 128,
'vcpus': 1,
},
jobDefinitionName='sleep10',
)
print(response)
Expected Output:
{
'jobDefinitionArn': 'arn:aws:batch:us-east-1:012345678910:job-definition/sleep10:1',
'jobDefinitionName': 'sleep10',
'revision': 1,
'ResponseMetadata': {
'...': '...',
},
}
submit_job(**kwargs)¶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
Request Syntax
response = client.submit_job(
jobName='string',
jobQueue='string',
dependsOn=[
{
'jobId': 'string'
},
],
jobDefinition='string',
parameters={
'string': 'string'
},
containerOverrides={
'vcpus': 123,
'memory': 123,
'command': [
'string',
],
'environment': [
{
'name': 'string',
'value': 'string'
},
]
},
retryStrategy={
'attempts': 123
}
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'jobName': 'string',
'jobId': 'string'
}
Response Structure
|
Examples
This example submits a simple container job called example to the HighPriority job queue.
response = client.submit_job(
jobDefinition='sleep60',
jobName='example',
jobQueue='HighPriority',
)
print(response)
Expected Output:
{
'jobId': '876da822-4198-45f2-a252-6cea32512ea8',
'jobName': 'example',
'ResponseMetadata': {
'...': '...',
},
}
terminate_job(**kwargs)¶Terminates jobs in a job queue. Jobs that are in the STARTING or RUNNING state are terminated, which causes them to transition to FAILED . Jobs that have not progressed to the STARTING state are cancelled.
See also: AWS API Documentation
Request Syntax
response = client.terminate_job(
jobId='string',
reason='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {}
Response Structure
|
Examples
This example terminates a job with the specified job ID.
response = client.terminate_job(
jobId='61e743ed-35e4-48da-b2de-5c8333821c84',
reason='Terminating job.',
)
print(response)
Expected Output:
{
'ResponseMetadata': {
'...': '...',
},
}
update_compute_environment(**kwargs)¶Updates an AWS Batch compute environment.
See also: AWS API Documentation
Request Syntax
response = client.update_compute_environment(
computeEnvironment='string',
state='ENABLED'|'DISABLED',
computeResources={
'minvCpus': 123,
'maxvCpus': 123,
'desiredvCpus': 123
},
serviceRole='string'
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'computeEnvironmentName': 'string',
'computeEnvironmentArn': 'string'
}
Response Structure
|
Examples
This example disables the P2OnDemand compute environment so it can be deleted.
response = client.update_compute_environment(
computeEnvironment='P2OnDemand',
state='DISABLED',
)
print(response)
Expected Output:
{
'computeEnvironmentArn': 'arn:aws:batch:us-east-1:012345678910:compute-environment/P2OnDemand',
'computeEnvironmentName': 'P2OnDemand',
'ResponseMetadata': {
'...': '...',
},
}
update_job_queue(**kwargs)¶Updates a job queue.
See also: AWS API Documentation
Request Syntax
response = client.update_job_queue(
jobQueue='string',
state='ENABLED'|'DISABLED',
priority=123,
computeEnvironmentOrder=[
{
'order': 123,
'computeEnvironment': 'string'
},
]
)
| Parameters: |
|
|---|---|
| Return type: | dict |
| Returns: | Response Syntax {
'jobQueueName': 'string',
'jobQueueArn': 'string'
}
Response Structure
|
Examples
This example disables a job queue so that it can be deleted.
response = client.update_job_queue(
jobQueue='GPGPU',
state='DISABLED',
)
print(response)
Expected Output:
{
'jobQueueArn': 'arn:aws:batch:us-east-1:012345678910:job-queue/GPGPU',
'jobQueueName': 'GPGPU',
'ResponseMetadata': {
'...': '...',
},
}
The available paginators are: