Jobs CLI examples
Use the CLI when you want to launch, inspect, and clean up jobs from a terminal, shell script, or CI system.
Prerequisites
$ pip install lightning-sdk -U
$ lightning login
$ lightning config set teamspace owner/teamspace
$ lightning studio start --name sdk-tutorial-studio --teamspace owner/teamspace --machine CPU --createRun a Studio-backed job
$ lightning job run \
--name sdk-tutorial-job \
--teamspace owner/teamspace \
--studio sdk-tutorial-studio \
--machine CPU \
--env RUN_MODE=tutorial \
--command "python train.py --epochs 1"Inspect and list jobs
$ lightning job inspect sdk-tutorial-job --teamspace owner/teamspace
$ lightning job list --teamspace owner/teamspace --sort-by statusRun an image-backed job
$ lightning job run \
--name sdk-image-job \
--teamspace owner/teamspace \
--image python:3.11-slim \
--machine CPU \
--command "python -c 'print(\"hello from a Lightning job\")'"Clean up
$ lightning job stop sdk-tutorial-job --teamspace owner/teamspace
$ lightning job delete sdk-tutorial-job --teamspace owner/teamspaceWas this page helpful?
Thanks for the feedback.