hydrosdk.servable module¶
This module contains all the code associated with Servables and their management at Hydrosphere platform. You can learn more about Servables here https://hydrosphere.io/serving-docs/latest/overview/concepts.html#servable.
- show-inheritance
- class hydrosdk.servable.Servable(cluster, model_version_id, servable_name, status, status_message, deployment_configuration_name, metadata=None)¶
Servable is an instance of a model version which is used within applications. Intendend for internal usage only.
- Parameters
cluster (hydrosdk.cluster.Cluster) –
model_version_id (int) –
servable_name (str) –
status (hydrosdk.servable.ServableStatus) –
status_message (Optional[str]) –
deployment_configuration_name (Optional[str]) –
metadata (Optional[dict]) –
- Return type
- static create(cluster, model_name, version, metadata=None, deployment_configuration=None)¶
Deploy an instance of uploaded model version at your cluster.
- Parameters
deployment_configuration (Optional[hydrosdk.deployment_configuration.DeploymentConfiguration]) – k8s configurations used to run this servable
cluster (hydrosdk.cluster.Cluster) – Cluster connected to Hydrosphere
model_name (str) – Name of uploaded model
version (int) – Version of uploaded model
metadata (Optional[Dict[str, str]]) – Information which you can attach to your servable in a form of Dict[str, str]
- Raises
- Returns
servable
- Return type
- static delete(cluster, servable_name)¶
Shut down and delete servable instance.
- Parameters
cluster (hydrosdk.cluster.Cluster) – active cluster
servable_name (str) – name of the servable
- Returns
json response from serve
- Return type
- static find_by_name(cluster, servable_name)¶
Finds a serving servable in a cluster
- Parameters
cluster (hydrosdk.cluster.Cluster) – active cluster
servable_name (str) – a name of the servable
- Raises
- Returns
Servable
- Return type
- static list(cluster)¶
Retrieve a list of all servables available at your cluster
- Parameters
cluster (hydrosdk.cluster.Cluster) – Hydrosphere cluster
- Returns
List of all Servables available at your cluster
- Return type
- lock_while_starting(timeout=120)¶
Wait for a servable to become ready.
- Parameters
timeout (int) –
- Return type
- predictor(monitorable=True, return_type=PredictorDT.DICT_NP_ARRAY)¶
Returns a predictor object which is used to pass data into the deployed Servable
- Parameters
monitorable – If True, the data will be shadowed to the monitoring service
return_type – Specifies into which data format should predictor return Servable outputs
- Returns
- Return type
- class hydrosdk.servable.ServableStatus(value)¶
Servable can be in one of four states
- static from_camel_case(camel_case_servable_status)¶
Get value of ServableStatus enum from CamelCase style string returned from the manager. :param camel_case_servable_status: :return: ServableStatus
- Example
- Parameters
camel_case_servable_status (str) –
- Return type
>>> ServableStatus.from_camel_case("NotServing") ServableStatus.NOT_SERVING