Skip to content

Python client for KubeRay API server

This Python client is currently only supporting Ray cluster management through usage of the API server Ray API. It implements all of the current functionality of the API server (and the operator) and provide pythonic APIs to the capabilities.

The package supports Python objects (documented in the code) that can be used to build and receive payloads for creation, listing and deleting of template and Ray clusters.

The main class of the package is KubeRayAPIs that implements all of the functionality. It leverages templates and cluster definitions, allowing to specify all required parameters as straight Python classes. Additional (intermediate) definitions are provided (see cluster, environment variables, volumes, head group, worker group and job submission)

Prerequisites

It is also expected that the kuberay operator (Installation instructions are here.) and api server (Installation instructions are here.) are installed

Development

Start by installing setup-tools

pip3 install -U setuptools

Now install our library locally. From the directory path/to/kuberay/clients/python_apiserver_client execute

pip3 install -e .

Testing

To do testing first create the current images for operator and API server, create kind cluster and install operator and API server. From apiserver directory, execute:

make operator-image cluster load-operator-image deploy-operator docker-image load-image install

Now you can use the following test files:

  • parameters_test exercise parameter creation
  • api_test exercise overall package functionality and can also be used as a guide for API usage.

Clean up

From apiserver directory, execute:

make clean-cluster