codeflare_sdk.vendored.python_client package

Subpackages

Submodules

codeflare_sdk.vendored.python_client.constants module

codeflare_sdk.vendored.python_client.kuberay_cluster_api module

Set of APIs to manage rayclusters.

class codeflare_sdk.vendored.python_client.kuberay_cluster_api.RayClusterApi[source]

Bases: object

RayClusterApi provides APIs to list, get, create, build, update, delete rayclusters.

Methods: - list_ray_clusters(k8s_namespace: str = “default”, async_req: bool = False) -> Any: - get_ray_cluster(name: str, k8s_namespace: str = “default”) -> Any: - create_ray_cluster(body: Any, k8s_namespace: str = “default”) -> Any: - delete_ray_cluster(name: str, k8s_namespace: str = “default”) -> bool: - patch_ray_cluster(name: str, ray_patch: Any, k8s_namespace: str = “default”) -> Any:

create_ray_cluster(body: Any, k8s_namespace: str = 'default') Any[source]

Create a new Ray cluster custom resource.

Parameters: - body (Any): The data of the custom resource to create. - k8s_namespace (str, optional): The namespace in which to create the custom resource. Defaults to “default”.

Returns:

Any: The created custom resource, or None if it already exists or there was an error.

delete_ray_cluster(name: str, k8s_namespace: str = 'default') bool[source]

Delete a Ray cluster custom resource.

Parameters: - name (str): The name of the Ray cluster custom resource to delete. - k8s_namespace (str, optional): The namespace in which the Ray cluster exists. Defaults to “default”.

Returns:

Any: The deleted custom resource, or None if already deleted or there was an error.

get_ray_cluster(name: str, k8s_namespace: str = 'default') Any[source]

Get a specific Ray cluster in a given namespace.

Parameters: - name (str): The name of the Ray cluster custom resource. Defaults to “”. - k8s_namespace (str, optional): The namespace in which to retrieve the Ray cluster. Defaults to “default”.

Returns:

Any: The custom resource for the specified Ray cluster, or None if not found.

Raises:

ApiException: If there was an error fetching the custom resource.

get_ray_cluster_status(name: str, k8s_namespace: str = 'default', timeout: int = 60, delay_between_attempts: int = 5) Any[source]

Get a specific Ray cluster status in a given namespace.

This method waits until the cluster has a status field populated by the operator.

Parameters: - name (str): The name of the Ray cluster custom resource. - k8s_namespace (str, optional): The namespace in which to retrieve the Ray cluster. Defaults to “default”. - timeout (int, optional): The duration in seconds after which we stop trying to get status. Defaults to 60 seconds. - delay_between_attempts (int, optional): The duration in seconds to wait between attempts. Defaults to 5 seconds.

Returns:

Any: The custom resource status for the specified Ray cluster, or None if not found or timeout.

list_ray_clusters(k8s_namespace: str = 'default', label_selector: str = '', async_req: bool = False) Any[source]

List Ray clusters in a given namespace.

Parameters: - k8s_namespace (str, optional): The namespace in which to list the Ray clusters. Defaults to “default”. - async_req (bool, optional): Whether to make the request asynchronously. Defaults to False.

Returns:

Any: The custom resource for Ray clusters in the specified namespace, or None if not found.

Raises:

ApiException: If there was an error fetching the custom resource.

patch_ray_cluster(name: str, ray_patch: Any, k8s_namespace: str = 'default') Any[source]

Patch an existing Ray cluster custom resource.

Parameters: - name (str): The name of the Ray cluster custom resource to be patched. - ray_patch (Any): The patch data for the Ray cluster. - k8s_namespace (str, optional): The namespace in which the Ray cluster exists. Defaults to “default”.

Returns:

bool: True if the patch was successful, False otherwise.

wait_until_ray_cluster_running(name: str, k8s_namespace: str = 'default', timeout: int = 60, delay_between_attempts: int = 5) bool[source]

Wait until a Ray cluster is in ready state.

This method waits for the cluster to have a state field with value ‘ready’.

Parameters: - name (str): The name of the Ray cluster custom resource. - k8s_namespace (str, optional): The namespace in which to retrieve the Ray cluster. Defaults to “default”. - timeout (int, optional): The duration in seconds after which we stop trying. Defaults to 60 seconds. - delay_between_attempts (int, optional): The duration in seconds to wait between attempts. Defaults to 5 seconds.

Returns:

bool: True if the raycluster status is ‘ready’, False otherwise.

codeflare_sdk.vendored.python_client.kuberay_job_api module

Set of APIs to manage rayjobs.

class codeflare_sdk.vendored.python_client.kuberay_job_api.RayjobApi[source]

Bases: object

RayjobApi provides APIs to list, get, create, build, update, delete rayjobs. Methods: - submit_job(k8s_namespace: str, job: Any) -> Any: Submit and execute a job asynchronously. - suspend_job(name: str, k8s_namespace: str) -> bool: Stop a job by suspending it. - resubmit_job(name: str, k8s_namespace: str) -> bool: Resubmit a job that has been suspended. - get_job(name: str, k8s_namespace: str) -> Any: Get a job. - list_jobs(k8s_namespace: str) -> Any: List all jobs. - get_job_status(name: str, k8s_namespace: str, timeout: int, delay_between_attempts: int) -> Any: Get the most recent status of a job. - wait_until_job_finished(name: str, k8s_namespace: str, timeout: int, delay_between_attempts: int) -> bool: Wait until a job is completed. - wait_until_job_running(name: str, k8s_namespace: str, timeout: int, delay_between_attempts: int) -> bool: Wait until a job reaches running state. - delete_job(name: str, k8s_namespace: str) -> bool: Delete a job and all of its associated data.

delete_job(name: str, k8s_namespace: str = 'default') bool[source]

Delete a Ray job and all of its associated data.

Parameters: - name (str): The name of the Ray job custom resource. - k8s_namespace (str, optional): The namespace in which to delete the Ray job. Defaults to “default”.

Returns:

bool: True if the job was successfully deleted, False otherwise.

get_job(name: str, k8s_namespace: str = 'default') Any[source]

Get a Ray job in a given namespace.

get_job_status(name: str, k8s_namespace: str = 'default', timeout: int = 60, delay_between_attempts: int = 5) Any[source]

Get a specific Ray job status in a given namespace.

This method waits until the job has a status field populated by the operator.

Parameters: - name (str): The name of the Ray job custom resource. - k8s_namespace (str, optional): The namespace in which to retrieve the Ray job. Defaults to “default”. - timeout (int, optional): The duration in seconds after which we stop trying to get status. Defaults to 60 seconds. - delay_between_attempts (int, optional): The duration in seconds to wait between attempts. Defaults to 5 seconds.

Returns:

Any: The custom resource status for the specified Ray job, or None if not found or timeout.

list_jobs(k8s_namespace: str = 'default') Any[source]

List all Ray jobs in a given namespace.

resubmit_job(name: str, k8s_namespace: str = 'default') bool[source]

Resubmit a suspended Ray job by setting the suspend field to False.

This will create a new RayCluster and resubmit the job. Only works on jobs in ‘Suspended’ status.

Parameters: - name (str): The name of the Ray job custom resource. - k8s_namespace (str, optional): The namespace in which to resubmit the Ray job. Defaults to “default”.

Returns:

bool: True if the job was successfully resubmitted, False otherwise.

submit_job(k8s_namespace: str = 'default', job: Any = None) Any[source]

Submit a Ray job to a given namespace.

suspend_job(name: str, k8s_namespace: str = 'default') bool[source]

Stop a Ray job by setting the suspend field to True.

This will delete the associated RayCluster and transition the job to ‘Suspended’ status. Only works on jobs in ‘Running’ or ‘Initializing’ status.

Parameters: - name (str): The name of the Ray job custom resource. - k8s_namespace (str, optional): The namespace in which to stop the Ray job. Defaults to “default”.

Returns:

bool: True if the job was successfully suspended, False otherwise.

wait_until_job_finished(name: str, k8s_namespace: str = 'default', timeout: int = 60, delay_between_attempts: int = 5) bool[source]

Wait until a Ray job reaches a terminal status.

This method waits for the job to reach a terminal state by checking both jobStatus (STOPPED, SUCCEEDED, FAILED) and jobDeploymentStatus (Complete, Failed).

Parameters: - name (str): The name of the Ray job custom resource. - k8s_namespace (str, optional): The namespace in which to retrieve the Ray job. Defaults to “default”. - timeout (int, optional): The duration in seconds after which we stop trying. Defaults to 60 seconds. - delay_between_attempts (int, optional): The duration in seconds to wait between attempts. Defaults to 5 seconds.

Returns:

bool: True if the rayjob reaches a terminal status, False otherwise.

wait_until_job_running(name: str, k8s_namespace: str = 'default', timeout: int = 60, delay_between_attempts: int = 5) bool[source]

Wait until a Ray job reaches Running state.

This method waits for the job’s jobDeploymentStatus to reach “Running”. Useful for confirming a job has started after submission or resubmission.

Parameters: - name (str): The name of the Ray job custom resource. - k8s_namespace (str, optional): The namespace in which to retrieve the Ray job. Defaults to “default”. - timeout (int, optional): The duration in seconds after which we stop trying. Defaults to 60 seconds. - delay_between_attempts (int, optional): The duration in seconds to wait between attempts. Defaults to 5 seconds.

Returns:

bool: True if the rayjob reaches Running status, False otherwise.

Module contents