Skip to content

BatchDefinition

Bases: DuploTenantResourceV3

Manage AWS Batch Job Definition Resources

Manage batch Job Definitions as a resource in Duplo.

Read more docs here: https://docs.duplocloud.com/docs/overview/aws-services/batch

apply

Apply a BatchDefinition

Create or Update a BatchDefinition resource with Duplocloud cli.

CLI Usage

duploctl batchdefinition apply -f 'batchdefinition.yaml'
Contents of the batchdefinition.yaml file
JobDefinitionName: duploctl
ContainerProperties:
  Command:
  - sleep
  - '10'
  Image: alpine:latest
  ResourceRequirements:
  - Type: MEMORY
    Value: '2048'
  - Type: VCPU
    Value: '2'
PlatformCapabilities:
- EC2

Parameters:

Name Type Description Default
body BODY

The resource to apply.

required
wait WAIT

Wait for the resource to be created.

False
patches PATCHES

The patches to apply to the resource.

None

Returns:

Name Type Description
message dict

Success message.

create

Create a Batch Job Definition resource.

CLI Usage

duploctl batch_definition create -f 'batchdefinition.yaml'
Contents of the batchdefinition.yaml file
JobDefinitionName: duploctl
ContainerProperties:
  Command:
  - sleep
  - '10'
  Image: alpine:latest
  ResourceRequirements:
  - Type: MEMORY
    Value: '2048'
  - Type: VCPU
    Value: '2'
PlatformCapabilities:
- EC2

One liner example
echo """
JobDefinitionName: duploctl
ContainerProperties:
  Command:
  - sleep
  - '10'
  Image: alpine:latest
  ResourceRequirements:
  - Type: MEMORY
    Value: '2048'
  - Type: VCPU
    Value: '2'
PlatformCapabilities:
- EC2
""" | duploctl batch_definition create -f -

Parameters:

Name Type Description Default
body BODY

The resource to create.

required

Returns:

Name Type Description
message dict

Success message.

Raises:

Type Description
DuploError

If the resource could not be created.

delete

Delete a Batch Job Definition by name.

CLI Usage
duploctl batch_definition delete <name>

Parameters:

Name Type Description Default
name NAME

The name of the Batch Job Definition to delete.

required
to_revision TO_REVISION

The specific revision of the Batch Job Definition to delete. If negative it will walk back that number of revisions from whatever number is the highest revision.

None

Returns:

Name Type Description
message dict

Success message.

find

Find a Single Batch Job Definition by name.

cli usage
duploctl batch_definition find <name>
Example

Find the previous revision to the latest. This is what you would use to do a rollback.

duploctl batch_definition find myjobdef --revision -2

Example

Find the earliest revision of a job definition.

duploctl batch_definition find myjobdef --revision 0

Parameters:

Name Type Description Default
name NAME

The name of the Batch Job Definition to find.

required
to_revision TO_REVISION

The specific revision of the Batch Job Definition to find. If negative it will walk back that number of revisions from whatever number is the highest revision. The default is -1 which will return the latest.

None

Returns:

Name Type Description
resource dict

The Batch Job Definition object.

list

List all Batch Job Definitions.

Usage
duploctl batch_definition list
Example

Retrieve all of the revision IDs for one job definition using JMESPATH query and output as yaml

duploctl batch_definition list --query "[?JobDefinitionName=='duploservices-dev01-myjobdef'].Revision" -o yaml

Returns:

Name Type Description
list list

A list of Batch Job Definitions.

update

Update a V3 resource by name.

Parameters:

Name Type Description Default
name NAME

The name of the resource to update.

None
body BODY

The resource to update.

None
patches PATCHES

The patches to apply to the resource.

None

Returns:

Name Type Description
message

Success message.

Raises:

Type Description
DuploError

If the resource could not be created.

update_image

Update the image of a Batch Job Definition by name.

CLI Usage
duploctl batch_definition update_image <name> --image <image>

Parameters:

Name Type Description Default
name NAME

The name of the Batch Job Definition to update.

required
image IMAGE

The new image to set for the Batch Job Definition.

required

Returns:

Name Type Description
message dict

Success message.