codeflare_sdk.common.kueue package

Submodules

codeflare_sdk.common.kueue.kueue module

codeflare_sdk.common.kueue.kueue.add_queue_label(item: dict, namespace: str, local_queue: str | None)[source]

Adds a local queue name label to the provided item.

If the local queue is not provided, the default local queue for the namespace is used. The function validates if the local queue exists, and if it does, the local queue name label is added to the resource metadata.

Args:
item (dict):

The resource where the label will be added.

namespace (str):

The namespace of the local queue.

local_queue (str, optional):

The name of the local queue to use. Defaults to None.

Raises:
ValueError:

If the provided or default local queue does not exist in the namespace.

codeflare_sdk.common.kueue.kueue.get_default_kueue_name(namespace: str) str | None[source]

Retrieves the default Kueue name from the provided namespace.

This function attempts to fetch the local queues in the given namespace and checks if any of them is annotated as the default queue. If found, the name of the default queue is returned.

The default queue is marked with the annotation “kueue.x-k8s.io/default-queue” set to “true.”

Args:
namespace (str):

The Kubernetes namespace where the local queues are located.

Returns:
Optional[str]:

The name of the default queue if it exists, otherwise None.

codeflare_sdk.common.kueue.kueue.list_local_queues(namespace: str | None = None, flavors: List[str] | None = None) List[dict][source]

This function lists all local queues in the namespace provided.

If no namespace is provided, it will use the current namespace. If flavors is provided, it will only return local queues that support all the flavors provided.

Note:

Depending on the version of the local queue API, the available flavors may not be present in the response.

Args:
namespace (str, optional):

The namespace to list local queues from. Defaults to None.

flavors (List[str], optional):

The flavors to filter local queues by. Defaults to None.

Returns:
List[dict]:

A list of dictionaries containing the name of the local queue and the available flavors

codeflare_sdk.common.kueue.kueue.local_queue_exists(namespace: str, local_queue_name: str) bool[source]

Checks if a local queue with the provided name exists in the given namespace.

This function queries the local queues in the specified namespace and verifies if any queue matches the given name.

Args:
namespace (str):

The namespace where the local queues are located.

local_queue_name (str):

The name of the local queue to check for existence.

Returns:
bool:

True if the local queue exists, False otherwise.

Module contents