There are more AWS SDK examples available in the AWS Doc SDK Examples
Use DeregisterJobDefinition with an AWS SDK or CLI
The following code examples show how to use DeregisterJobDefinition.
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 deregister a job definition
This example deregisters a job definition called sleep10.
Command:
aws batch deregister-job-definition --job-definitionsleep10-
For API details, see DeregisterJobDefinition
in AWS CLI Command Reference.
-
- 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
. /** * Deregisters a job definition asynchronously. * * @param jobDefinition the name of the job definition to be deregistered * @return a CompletableFuture that completes when the job definition has been deregistered * or an exception has occurred */ public CompletableFuture<DeregisterJobDefinitionResponse> deregisterJobDefinitionAsync(String jobDefinition) { DeregisterJobDefinitionRequest jobDefinitionRequest = DeregisterJobDefinitionRequest.builder() .jobDefinition(jobDefinition) .build(); CompletableFuture<DeregisterJobDefinitionResponse> responseFuture = getAsyncClient().deregisterJobDefinition(jobDefinitionRequest); responseFuture.whenComplete((response, ex) -> { if (ex != null) { throw new RuntimeException("Unexpected error occurred: " + ex.getMessage(), ex); } }); return responseFuture; }-
For API details, see DeregisterJobDefinition in AWS SDK for Java 2.x API Reference.
-
- Python
-
- SDK for Python (Boto3)
-
Note
There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository
. def deregister_job_definition(self, job_definition: str) -> None: """ Deregisters a job definition. :param job_definition: The job definition name:revision or ARN. """ try: self.batch_client.deregister_job_definition(jobDefinition=job_definition) logger.info("Deregistered job definition %s.", job_definition) except ClientError as err: logger.error( "Error deregistering job definition %s: %s", job_definition, err.response["Error"]["Message"], ) raise-
For API details, see DeregisterJobDefinition in AWS SDK for Python (Boto3) API Reference.
-