sedai.workloads

class KubernetesContainerSpec:

This class represents a specification for a container in a Kubernetes workload.

name: str

Name of the container.

image: str

Image used for the container.

cpu_limit: Optional[str] = None

CPU limit for the container.

cpu_request: Optional[str] = None

CPU request for the container.

memory_limit_bytes: Optional[int] = None

Memory limit for the container in bytes.

memory_request_bytes: Optional[int] = None

Memory request for the container in bytes.

class SedaiKubeWorkload:

Represents the base class for all Kubernetes workloads in Sedai.

This class defines the common attributes and behavior shared across different types of Kubernetes workloads, such as name, namespace, cluster details, and container specifications.

It serves as the foundation for more specialized workload classes, such as SedaiScalableKubeWorkload, which extends this class to include scalability-related fields like replica counts, labels, and annotations.

name: str

Name of the Kubernetes workload.

inference_type: str

Type of kubernetes workload.

namespace: str

Namespace in which the workload is deployed.

cluster_name: str

Name of the Kubernetes cluster.

instance_ids: Optional[list[str]] = None

List of instance IDs associated with the workload.

load_balancer_ids: Optional[list[str]] = None

List of load balancer IDs associated with the workload.

node_id_vs_replica_count: Optional[dict[str, int]] = None

Mapping node IDs to the number of replicas running on each node.

container_specs: Optional[List[KubernetesContainerSpec]] = None

List of container specifications for the workload.

desired_replicas: Optional[int] = None

The number of desired replicas for the workload.

class SedaiScalableKubeWorkload(SedaiKubeWorkload):

This class represents various scalable Kubernetes workload types, including ReplicationController, Deployment, ReplicaSet, Rollout, and StatefulSet.

Extends the SedaiKubeWorkload base class by adding fields related to scalability, such as the number of ready, updated, and available pod replicas. Also includes additional metadata like labels and annotations.

ready_replicas: Optional[int] = None

Number of pod replicas currently Ready to serve requests.

updated_replicas: Optional[int] = None

The number of pod replicas that have been updated to match the latest workload revision.

available_replicas: Optional[int] = None

Number of updated pod replicas available to users, not terminating and past minimum ready time.

labels: Optional[dict[str, int]] = None

Labels associated with the workload.

annotations: Optional[dict[str, int]] = None

Annotations associated with the workload.

def get_all_kube_workloads( account_id: str, namespace: str = None, pagination_config: Optional[sedai.pagination.PaginationConfig] = None) -> sedai.pagination.PageIterator[typing.List[SedaiKubeWorkload]]:

Returns all Kubernetes workloads for a given account ID.

Parameters
  • account_id: The ID of the account for which to fetch workloads.
  • namespace: Optional namespace to filter workloads. If None, all namespaces are considered.
  • pagination_config: The pagination configuration for fetching kubernetes workload. Refer to sedai.pagination.PaginationConfig for more details about the available options. If no pagination_config is given it will use the default pagination configuration, sedai.pagination.DEFAULT_PAGINATION_CONFIG.
Returns

List of SedaiKubeWorkload instances, or None if no workloads exist.