Skip to content

Job Operations Usage

Jobs are the execution records in DRP. Each job represents one task running on one machine at one point in time. Jobs are created automatically by the DRP runner when a machine advances through a workflow.

List Jobs

Bash
# List all jobs (most recent first)
drpcli jobs list sort=StartTime reverse=true

# Get the UUID of the most recent job across all machines
drpcli jobs list sort=StartTime reverse=true | jq -r '.[0].UUID'

# List jobs for a specific machine
drpcli jobs list Machine=<machine-uuid>

# List only failed jobs
drpcli jobs list State=failed

# List incomplete jobs
drpcli jobs list State=incomplete

Get Job Details

Bash
# Show a specific job by UUID
drpcli jobs show <job-uuid>

# Show just the state and task for a job
drpcli jobs show <job-uuid> | jq '{State:.State,Task:.Task,Machine:.Machine}'

Get Job Logs

Bash
# Print the complete log for a job
drpcli jobs log <job-uuid>

# Follow the log in real time (like tail -f) while the job is running
drpcli jobs log <job-uuid> --watch

# Get the log for the most recent job on a machine
JOB=$(drpcli jobs list Machine=<machine-uuid> sort=StartTime reverse=true | jq -r '.[0].UUID')
drpcli jobs log $JOB

Get Rendered Job Actions

Before a job runs, DRP renders the task's templates for that machine. Inspect the rendered scripts without running them:

Bash
# Retrieve the rendered action scripts for a job
drpcli jobs actions <job-uuid>

# Retrieve actions for a specific OS
drpcli jobs actions <job-uuid> --for-os linux

Retrying a Failed Task

Retrying a failed task is done by re-assigning the workflow to the machine:

Bash
drpcli machines workflow <machine-uuid> <workflow>

This resets the machine to run the workflow from the current point and creates a new job for it.

Purging Old Jobs

Purge jobs that exceed the configured retention limits:

Bash
# Purge using server default retention settings
drpcli jobs purge

# Preview what would be purged (dry run)
drpcli jobs purge --dry-run

# Purge jobs for a specific machine
drpcli jobs purge --machine <machine-uuid>

# Purge jobs for machines that have been deleted
drpcli jobs purge --machine missing

# Override retention: keep 5 jobs per machine, purge failed after 48 hours
drpcli jobs purge --jobs-to-keep 5 --failed-after 48h

# Purge completed jobs older than 7 days
drpcli jobs purge --complete-after 168h