q8sctl user guideRun programs

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:

Dockerfile
FROM vstirbu/q8s-cuda12
 
COPY requirements.txt /requirements.txt
RUN pip install -r requirements.txt

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.