Skip to content

Job

Bases: DuploTenantResourceV3

apply

Apply a Job

Create or Update a Job resource with Duplocloud cli.

CLI Usage

duploctl job apply -f 'job.yaml'
Contents of the job.yaml file
metadata:
  name: duploctl
spec:
  ttlSecondsAfterFinished: 86400
  parallelism: 2
  completions: 4
  template:
    spec:
      restartPolicy: Never
      containers:
      - name: app
        image: ubuntu:latest
        command:
        - /bin/bash
        - -c
        args:
        - |
          echo "Hello, World!"
          sleep 10
          echo "Goodbye, World!"
          num="$(echo $((1 + $RANDOM % 10)))"
          sleep $num
          echo "I slept for $num seconds"
          sleep 10
      initContainers: []

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 job.

delete

Delete a Job resource by name.

cli usage
duploctl job delete <name>

Parameters:

Name Type Description Default
name NAME

The name of the Job resource to delete.

required

Returns:

Name Type Description
message dict

A success message.

Raises:

Type Description
DuploError

If the {{kind}} resource could not be found or deleted.

find

Find Job resources by name.

cli usage
duploctl job find <name>

Parameters:

Name Type Description Default
name NAME

The name of the Job resource to find.

required

Returns:

Name Type Description
resource dict

The Job object.

Raises:

Type Description
DuploError

If the {{kind}} could not be found.

list

Retrieve a List of Job resources

cli usage
duploctl job list

Returns:

Name Type Description
list list

A list of Job.

pods

Get the pods for a service.

Parameters:

Name Type Description Default
name str

The name of the service to get pods for.

required

Returns: A list of pods for the service. Raises: DuploError: If the service could not be found.

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.