For the complete documentation index, see llms.txt. A markdown version of this page is at /workstations/lifecycle/jobs-results/index.md.

Jobs and their results

A job on a workstation, such as a CI build, can report when it ends and what it exited with.

A job on a workstation, such as a CI build, can report when it ends and what it exited with. You can then wait for the result from anywhere. The job writes its exit status to a file, and the workstation’s Finished condition then reports the result.

Job results

A job reports its result by writing its exit status, a number from 0 to 255, to ~/.ringleader/job-exit in the login user’s home. The in-VM agent reads the file and reports the number to Ringleader, which records it in the workstation’s status.jobResult and sets the Finished condition. Status 0 means the job succeeded, and any other status means it failed. Finished reasons lists the reasons.

Finished is True for a failed job too, because it reports that the job is over. A failed job says nothing about the workstation’s health, so Finished counts toward neither Configured nor Available. A workstation whose job has never reported a result has no Finished condition.

Job results across a stop or start

A result belongs to the boot that produced it. A stop or a start clears status.jobResult, and Finished turns False with reason NoJobResult. When the workstation boots, the in-VM agent deletes any job-exit file left from the previous boot. A job on the new boot then reports its own result.

Job results over a shell connection

When you run a job with rl shell, the command passes the job’s exit code through, and only that client sees it. A job that runs detached, so that it outlives the connection, can write job-exit instead. Ringleader then keeps the result, and any client can read it later. Shell exit codes shows how to tell a failed job from a failed connection with rl shell.

Report a job’s result

To report a job’s result, have the job write its exit status to ~/.ringleader/job-exit after it runs:

mkdir -p "$HOME/.ringleader"
make test; echo $? > "$HOME/.ringleader/job-exit"

Run the job as the login user, so that $HOME is that user’s home. A value outside 0 to 255 isn’t reported.

Wait for a job to finish

To wait until the job ends, whatever it exited with, wait for the Finished condition:

rl workstation wait my-box --for condition=Finished --timeout 1h -n local

Then read the exit status:

rl workstation get my-box -n local -o jsonpath='{.status.jobResult.code}'

rl workstation describe shows the Finished condition and its message too.

Next steps