Jupyter kernel
Run programs

Run Python programs

If you don't use Jupyter notebooks for development, the q8sctl's command execute runs a Python program on Qubernetes. The command takes a Python script (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 directory of the workspace.