utils.rc.dtos.prediction_service

Module Contents

Classes

PredictionService

Attributes

logger

utils.rc.dtos.prediction_service.logger
class utils.rc.dtos.prediction_service.PredictionService(data={})
static create_service(name: str, description: str, model_name: str, service_obj_path: str, env_id: str, data_source_ids: List[str], model_version: str = None) PredictionService

Creates a prediction service

Parameters:
  • name (str) – name of the service

  • description (str) – description of the service

  • model_name (str) – name of the model

  • model_version (str) – version of the model

  • service_obj_path (str) – location of the py file for service

  • env_id (str) – id of the environment

  • data_source_ids (list[str]) – list of datasource ids

Returns:

created prediction service object

Return type:

PredictionService

static update_service(service_id: str, name: str, description: str, model_name: str, env_id: str, data_source_ids: list[str]) PredictionService

Updates prediction service

Parameters:
  • service_id (str) – id of the service

  • name (str) – name of the service

  • description (str) – description of the service

  • model_name (str) – model name

  • env_id (str) – id of the environment

  • data_source_ids (list[str]) – list of data source ids

Returns:

updated prediction service object

Return type:

PredictionService

static get_service_by_name(name: str) PredictionService

Get Prediction service by name

Parameters:

name (str) – name of the prediction service

Returns:

prediction service object

Return type:

PredictionService

static delete_service_by_id(service_id: str)

Deletes the prediction service by id

Parameters:

service_id (str) – id of the service

static get_signed_url_for_upload(service_id: str, file_name: str)
static refresh_service(service_name: str)

Refresh the prediction service. Use this method to reflect the updated changes in your service

Parameters:

service_name (str) – name of the service

static predict_by_service(service_name: str, payload)

Call the prediction service to do predictions :param service_name: name of the service :type service_name: str :param payload: payload :type payload: dict

Returns:

response

Return type:

dict

static get_all_models() List[str]

Get all the models associated with the tenant :returns: list of all the model names :rtype: List[str]

static delete_model(name: str)

Delete the model :param name: name of the model

Returns:

None

static get_model_details(name: str)
classmethod download_file(name: str, file_name: str, folder: str = None, folder_type: str = 'model', model_version: str = 'default') None

Download a file from model to your local file system :param folder_type: models or predictions :param name: name of the model :type name: str :param file_name: name of the file in model file system :type file_name: str :param folder: folder path to download, if None, takes current folder :type folder: str :param model_version: version of the model :type model_version: str

Returns:

None

classmethod download_model(name: str, folder: str = None) None

Download all the files in model to specified folder :param name: name of the model :param folder: folder path to download, if None, takes current folder

Returns:

None

classmethod download_for_local(model_name: str, tenant_id: str)

Download a model for local use. This class method allows the user to download a model specified by its name for local use. The model will be associated with the specified tenant ID. :param model_name: The name of the model to be downloaded. :type model_name: str :param tenant_id: The ID of the tenant associated with the downloaded model. :type tenant_id: str

Returns:

None

static prepare_local_docker(service_name)