Run Python programs
The q8sctl
’s command execute
runs a Python program on Qubernetes. The command takes a Python application (e.g. app.py
), as an argument and executes it on the Qubernetes cluster. The script can be any Python program that you want to run on the cluster. The command will create a new job on the cluster and execute the script in a container.
q8sctl execute app.py --kubeconfig /path/to/config --image docker-image
The command requires the path to the kubeconfig file and the Docker image to use. The Docker image must contain the Python interpreter and any dependencies required by the script:
FROM vstirbu/q8s-cuda12
COPY requirements.txt /requirements.txt
RUN pip install -r requirements.txt
Environment variables
Environment variables are supported in the Python script. You can set them in the .env.q8s
file that should be placed in the root of the workspace.
Execution targets
You can specify the target device using the --target
flag when submitting a job. The following targets are supported:
cpu
: Execute the job on a CPU nodes.gpu
: Execute the job on a GPU nodes with CUDA support.qpu
: Execute the job on a remote QPU. Curently only IQM QPU is supported.