Use UpdateJobQueue with an AWS SDK or CLI - AWS SDK Code Examples

There are more AWS SDK examples available in the AWS Doc SDK Examples GitHub repo.

Use UpdateJobQueue with an AWS SDK or CLI

The following code examples show how to use UpdateJobQueue.

Action examples are code excerpts from larger programs and must be run in context. You can see this action in context in the following code example:

CLI
AWS CLI

To update a job queue

This example disables a job queue so that it can be deleted.

Command:

aws batch update-job-queue --job-queue GPGPU --state DISABLED

Output:

{ "jobQueueArn": "arn:aws:batch:us-east-1:012345678910:job-queue/GPGPU", "jobQueueName": "GPGPU" }
Java
SDK for Java 2.x
Note

There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository.

/** * Disables the specified job queue asynchronously. * * @param jobQueueArn the Amazon Resource Name (ARN) of the job queue to be disabled * @return a {@link CompletableFuture} that completes when the job queue update operation is complete, * or completes exceptionally if an error occurs during the operation */ public CompletableFuture<Void> disableJobQueueAsync(String jobQueueArn) { UpdateJobQueueRequest updateRequest = UpdateJobQueueRequest.builder() .jobQueue(jobQueueArn) .state(JQState.DISABLED) .build(); CompletableFuture<UpdateJobQueueResponse> responseFuture = getAsyncClient().updateJobQueue(updateRequest); return responseFuture.whenComplete((updateResponse, ex) -> { if (ex != null) { throw new RuntimeException("Failed to update job queue: " + ex.getMessage(), ex); } }).thenApply(updateResponse -> null); }
  • For API details, see UpdateJobQueue in AWS SDK for Java 2.x API Reference.