Skip to content

Package kta_python_sdk.common

common package.

exception

SDK exceptions. In the following, "user" refers to the application using the SDK.

IllegalAccessException

Bases: KTABaseException

Raised if the user accesses an attribute, method, etc. that the user is not supposed to access. This might indicate that the implementation of a UDF is not stateless.

IllegalStateException

Bases: KTABaseException

Raised if the application reaches an illegal state and the illegal state was caused by the user.

InternalSDKException

Bases: KTABaseException

Raised if there is an error that was not caused by the user.

KTABaseException

Bases: Exception

Common base class for all SDK exceptions.

__init__(*args, **kwargs)

NotImplementedException

Bases: KTABaseException

Raised if the control flow reaches a method that is not implemented yet.

UDFException

Bases: KTABaseException

Raised if the provided autoscaling algorithm UDF behaves in an unexpected way.

UDFResponseException

Bases: UDFException

Raised if the return value of a UDF is erroneous (e.g., of an unexpected type).

model

Record classes (using Pydantic).

TopologyNodeFields = namedtuple('TopologyNodeFields', 'id kind name') module-attribute

UdfPlanResultBound = Union[PlanUdfResult, Dict[TopologyNode, PlanUdfResult]] module-attribute

UdfResultBound = Union[UdfResult, Dict[Any, Any]] module-attribute

Context

Bases: BaseModel

Context passed to autoscaling algorithm UDFs.

The context contains intermediate results of the current MAPE-K loop evaluation (e.g., in the analyze step, the result of the monitor step is available) and also the result history of successfully completed preceding MAPE-K loop evaluations (up to the specified limit in the KTAPolicy).

analyzeResult = None class-attribute instance-attribute

id instance-attribute

model_config = {'frozen': True} class-attribute instance-attribute

monitorResult = None class-attribute instance-attribute

resultHistory = field(default_factory=(lambda: [])) class-attribute instance-attribute

topology instance-attribute

udfStartTimestampMillis instance-attribute

Empty

Bases: UdfResult

The empty type.

model_config = {'extra': 'forbid'} class-attribute instance-attribute

PlanUdfResult

Bases: UdfResult

Result of the Plan step.

model_config = {'frozen': True} class-attribute instance-attribute

parallelism instance-attribute

RequestDto

Bases: BaseModel

Request DTO.

RequestDto instances decouple the internal interface between the Kubernetes Operator and SDK backends from the SDK user interface (UDFs). A Request is automatically converted to a Context object by the used backend.

analyzeResult = field(default_factory=Empty) class-attribute instance-attribute

id instance-attribute

model_config = {'frozen': True} class-attribute instance-attribute

monitorResult = field(default_factory=Empty) class-attribute instance-attribute

resultHistory = field(default_factory=(lambda: [])) class-attribute instance-attribute

topology instance-attribute

udfStartTimestampMillis instance-attribute

topology_validator(value) classmethod

Topology validator.

Result

Bases: BaseModel

Result.

analyzeResult = field(default_factory=Empty) class-attribute instance-attribute

id instance-attribute

model_config = {'frozen': True} class-attribute instance-attribute

monitorResult instance-attribute

parallelism instance-attribute

planResult instance-attribute

udfEndTimestampMillis instance-attribute

udfStartTimestampMillis instance-attribute

TopologyNode

Bases: BaseModel

Topology node.

fields instance-attribute

model_config = {'frozen': True} class-attribute instance-attribute

type instance-attribute

UdfResult

Bases: BaseModel

Result base class for user-defined results of autoscaling algorithm UDFs.

model_config = {'frozen': True, 'extra': 'allow'} class-attribute instance-attribute