signadot job
Note
The examples here work with v0.8.0+ of the Signadot CLI.
To submit a Job, first write a YAML or JSON file containing the spec
. The available fields within spec
are documented in the Job spec reference.
For example:
spec:
namePrefix: my-job
runnerGroup: my-jrg
script: |
#!/bin/bash
x=1
while [ $x -le 30 ]
do
echo "Welcome $x times (env TEST=$TEST)"
x=$(( $x + 1 ))
sleep 1
done
echo "This is an artifact" > /tmp/my-artifact.txt
echo "We are done!"
uploadArtifact:
- path: /tmp/my-artifact.txt
meta:
format: text
kind: demo
Note
Notice that runnerGroup
is set to the name of the JRG in the previous example. A Job runs in the context of its associated JRG.
Submit this job by passing the filename to the job submit
command:
signadot job submit -f my-job.yaml
You can use job list
to see all jobs, and job get
to see details about a single job:
# List all jobs with only running or queued state
signadot job list
# List all jobs including completed, cancelled states
signadot job list --all
# Get one job by name
signadot job get my-job-[generated_id]
To cancel a job:
signadot job delete my-job-[generated_id]
Working with Artifacts
To download an artifact linked to a job, first list the available artifacts with job get [NAME]
. Once you know which artifact you want to download:
# Download the stdout of job logs
signadot artifact download --job my-job-[generated_id] @stdout
# Download the stderr of job logs with a custom name
signadot artifact download --job my-job-[generated_id] @stderr --output job_errors
# Download user/custom artifacts. The output will be the basename only (my-artifact.txt)
signadot artifact download --job my-job-[generated_id] /tmp/my-artifact.txt
Viewing Logs
View job logs using the log
command:
# See stdout logs of job
signadot log --job my-job-[generated_id]
# View stderr logs
signadot log --job my-job-[generated_id] --stream stderr
For reusable job definitions, check out YAML Templates.