Skip to main content

lium exec

Execute a command on one or more pods.

lium exec TARGETS [COMMAND] [OPTIONS]

Arguments​

  • TARGETS — Pod name, index, comma-separated list, or all.
  • COMMAND — The command to execute. Optional when you pass --script.

Options​

FlagEffect
--script, -s PATHExecute a local script file on the pod(s) instead of an inline command
--env, -e KEY=VALUESet an environment variable for the command (repeatable)
--jsonPrint machine-readable JSON instead of raw output

lium exec exits with the remote command's own exit code, so lium exec my-pod "cmd" && next-step behaves the way you expect.

The --json payload is always an envelope with an array, even for a single pod:

{
"ok": true,
"results": [
{"pod": "eager-wolf-aa", "stdout": "…", "stderr": "", "exit_code": 0, "error": null}
]
}

ok is true only when every pod succeeded. Read a single result with jq -r '.results[0].stdout' — there is no top-level stdout.

Examples​

lium exec my-pod "python train.py"
lium exec 1 "nvidia-smi"
lium exec 1,2,3 "apt update" # Multiple pods
lium exec all "pip install numpy" # Every running pod
lium exec my-pod --script ./setup.sh # Run a local script
lium exec my-pod -e WANDB_MODE=offline "python train.py"
lium exec my-pod --json "python train.py" # Parse the result programmatically

See also​

  • lium ssh — interactive shell
  • lium scp — push code first, then exec