CLI Examples
This article provides examples of popular use cases illustrating how to use the Command Line Interface (CLI)
Login¶
Login via run:ai sign in page (web)¶
You can login from the UI, if you are using SSO or credentials
Login via terminal (credentials)¶
runai login user -u [email protected] -p "password"
Configuration¶
Setting a default project¶
Submitting a workload¶
Naming a workload¶
Use the commands below to provide a name for a workload.
Setting a the workload name ( my_workload_name)¶
Setting a random name with prefix (prefix=workload type)¶
Setting a random name with specific prefix (prefix determined by flag)¶
Labels and annotations¶
Labels¶
Annotations¶
Container's environment variables¶
Requests and limits¶
runai workspace submit -p alon -i runai.jfrog.io/demo/quickstart-demo --cpu-core-request 0.3 --cpu-core-limit 1 --cpu-memory-request 50M --cpu-memory-limit 1G --gpu-devices-request 1 --gpu-memory-request 1G
Submit and attach to process¶
Submit a jupiter notebook¶
runai workspace submit --image jupyter/scipy-notebook -p alon --gpu-devices-request 1 --external-url container=8888 --name-prefix jupyter --command -- start-notebook.sh --NotebookApp.base_url='/${RUNAI_PROJECT}/${RUNAI_JOB_NAME}' --NotebookApp.token=''
Distributed with TensorFlow framework¶
runai distributed submit -f TF --workers=5 --no-master -g 1 -i kubeflow/tf-mnist-with-summaries:latest -p alon --command -- python /var/tf_mnist/mnist_with_summaries.py --max_steps 1000000
Multi pod submission¶
Submit and bash¶
Submit a workload with bash command¶
runai training pytorch submit -p alon -i nvidia/cuda:11.8.0-cudnn8-runtime-ubuntu20.04 -g 1 --workers 3 --command -- bash -c 'trap : TERM INT; sleep infinity & wait'
bash into the workload¶
Submit MPI¶
runai mpi submit dist1 --workers=2 -g 1 \
-i runai.jfrog.io/demo/quickstart-distributed:v0.3.0 -e RUNAI_SLEEP_SECS=60 -p alon
Submit with PVC¶
New PVC bounded to the workspace¶
New PVCs will be deleted when the workload is deleted
New ephemeral PVC¶
New ephemeral PVCs will deleted when the workload is deleted or paused
Existing PVC¶
Existing PVCs will not deleted when the workload is deleted
Master/Worker configuration¶
--command flag and -- are setting both leader(master) and workers command/arguments
--master-args flag sets the master arguments
--master-command flag set the master commands with arguments
--master-args and --master-command flags can set together
Override both the leader(master) and worker image's arguments¶
Override both the leader(master) and worker image's commands with arguments¶
Override arguments of the leader(master) and worker image's arguments with different values¶
runai pytorch submit -i ubuntu --master-args "-a master_arg_a -b master-arg_b'" -- '-a worker_arg_a'
Override command with arguments of the leader(master) and worker image's arguments¶
runai pytorch submit -i ubuntu --master-command "python_master -m pip install'" --command -- 'python_worker -m pip install'
List objects¶
Listing all workloads in the user's scope¶
Listing projects in a YAML format¶
Listing nodes in a JSON format¶
CLI reference¶
For the full guide of the CLI syntax, see the CLI reference