src.models.engine module#

Data models for inference engine services.

src.models.engine.ContainerURI#

alias of ConstrainedStrValue

class src.models.engine.CreateInferenceEngineService(*, modelId: str, imageUri: ConstrainedStrValue, containerPort: Optional[PositiveInt] = None, env: Optional[Dict[str, str]] = None, numGpus: ConstrainedFloatValue = 0)[source]#

Bases: BaseModel

Request model for creating an inference engine service.

class Config[source]#

Bases: object

Pydantic config to allow creation of data model from a JSON object with camelCase keys.

alias_generator() str#

Converts a string to camel case.

Parameters:

string (str) – Input string

Returns:

Camel case string

Return type:

str

_abc_impl = <_abc._abc_data object>#
container_port: Optional[PositiveInt]#
env: Optional[Dict[str, str]]#
image_uri: ConstrainedStrValue#
model_id: str#
num_gpus: float#
classmethod sanitize_model_name(v: str) str[source]#

Generates a URL safe model id if one is not provided.

Parameters:

v (str) – The model name.

Returns:

Generated model id.

Return type:

str

class src.models.engine.InferenceEngineService(*, modelId: str, imageUri: ConstrainedStrValue, containerPort: Optional[PositiveInt] = None, env: Optional[Dict[str, str]] = None, numGpus: ConstrainedFloatValue = 0, _id: PyObjectId = None, inferenceUrl: str, ownerId: str, serviceName: str, created: datetime, lastModified: datetime, host: str, path: str, protocol: str = 'http', backend: ServiceBackend)[source]#

Bases: CreateInferenceEngineService

Data model for inference engine service in database.

class Config[source]#

Bases: object

Pydantic config to allow creation of data model from a JSON object with camelCase keys and to convert ObjectId to str when returning JSON.

alias_generator() str#

Converts a string to camel case.

Parameters:

string (str) – Input string

Returns:

Camel case string

Return type:

str

allow_population_by_field_name = True#
arbitrary_types_allowed = True#
json_encoders = {<class 'bson.objectid.ObjectId'>: <class 'str'>}#
_abc_impl = <_abc._abc_data object>#
backend: ServiceBackend#
created: datetime#
host: str#
id: PyObjectId#
inference_url: str#
last_modified: datetime#
owner_id: str#
path: str#
protocol: str#
service_name: str#
class src.models.engine.InferenceServiceStatus(*, serviceName: str, status: K8SPhase = K8SPhase.UNKNOWN, message: str = '', ready: bool = True, schedulable: bool = True, expectedReplicas: ConstrainedIntValue = 1)[source]#

Bases: BaseModel

class Config[source]#

Bases: object

Pydantic config to allow creation of data model from a JSON object with camelCase keys.

alias_generator() str#

Converts a string to camel case.

Parameters:

string (str) – Input string

Returns:

Camel case string

Return type:

str

allow_population_by_field_name = True#
_abc_impl = <_abc._abc_data object>#
expected_replicas: int#
message: str#
ready: bool#
schedulable: bool#
service_name: str#
status: K8SPhase#
class src.models.engine.K8SPhase(value)[source]#

Bases: str, Enum

Enum for K8S phase.

FAILED = 'Failed'#
PENDING = 'Pending'#
RUNNING = 'Running'#
SUCCEEDED = 'Succeeded'#
UNKNOWN = 'Unknown'#
_generate_next_value_(start, count, last_values)#

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_value: the last value assigned or None

_member_map_ = {'FAILED': K8SPhase.FAILED, 'PENDING': K8SPhase.PENDING, 'RUNNING': K8SPhase.RUNNING, 'SUCCEEDED': K8SPhase.SUCCEEDED, 'UNKNOWN': K8SPhase.UNKNOWN}#
_member_names_ = ['PENDING', 'RUNNING', 'SUCCEEDED', 'FAILED', 'UNKNOWN']#
_member_type_#

alias of str

_value2member_map_ = {'Failed': K8SPhase.FAILED, 'Pending': K8SPhase.PENDING, 'Running': K8SPhase.RUNNING, 'Succeeded': K8SPhase.SUCCEEDED, 'Unknown': K8SPhase.UNKNOWN}#
class src.models.engine.ServiceBackend(value)[source]#

Bases: str, Enum

Enum for service backend.

EMISSARY = 'emissary'#
KNATIVE = 'knative'#
_generate_next_value_(start, count, last_values)#

Generate the next value when not given.

name: the name of the member start: the initial start value or None count: the number of existing members last_value: the last value assigned or None

_member_map_ = {'EMISSARY': ServiceBackend.EMISSARY, 'KNATIVE': ServiceBackend.KNATIVE}#
_member_names_ = ['KNATIVE', 'EMISSARY']#
_member_type_#

alias of str

_value2member_map_ = {'emissary': ServiceBackend.EMISSARY, 'knative': ServiceBackend.KNATIVE}#
class src.models.engine.UpdateInferenceEngineService(*, imageUri: ConstrainedStrValue, containerPort: Optional[PositiveInt] = None, env: Optional[dict] = None, numGpus: ConstrainedFloatValue = 0)[source]#

Bases: BaseModel

Request model for updating an inference engine service.

class Config[source]#

Bases: object

Pydantic config to allow creation of data model from a JSON object with camelCase keys.

alias_generator() str#

Converts a string to camel case.

Parameters:

string (str) – Input string

Returns:

Camel case string

Return type:

str

arbitrary_types_allowed = True#
json_encoders = {<class 'bson.objectid.ObjectId'>: <class 'str'>}#
_abc_impl = <_abc._abc_data object>#
container_port: Optional[PositiveInt]#
env: Optional[dict]#
image_uri: ConstrainedStrValue#
num_gpus: float#