#!/usr/bin/env python# -*- coding: utf-8 -*--# Copyright (c) 2022, 2023 Oracle and/or its affiliates.# Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/fromdataclassesimportdataclassfromosimportenvironfromtypingimportUnionfromads.model.base_propertiesimportBaseProperties
[docs]@dataclass(repr=False)classModelProperties(BaseProperties):"""Represents properties required to save and deploy model."""inference_conda_env:str=Noneinference_python_version:str=Nonetraining_conda_env:str=Nonetraining_python_version:str=Nonetraining_resource_id:str=Nonetraining_script_path:str=Nonetraining_id:str=Nonecompartment_id:str=Noneproject_id:str=Nonebucket_uri:str=Noneremove_existing_artifact:bool=Noneoverwrite_existing_artifact:bool=Nonedeployment_instance_shape:str=Nonedeployment_instance_subnet_id:str=Nonedeployment_instance_count:int=Nonedeployment_bandwidth_mbps:int=Nonedeployment_log_group_id:str=Nonedeployment_access_log_id:str=Nonedeployment_predict_log_id:str=Nonedeployment_memory_in_gbs:Union[float,int]=Nonedeployment_ocpus:Union[float,int]=Nonedeployment_image:str=Nonedef_adjust_with_env(self)->None:"""Adjusts env variables. This method is used within `with_env` method."""super()._adjust_with_env()props_env_map={"project_id":["PROJECT_OCID"],"training_resource_id":["JOB_RUN_OCID","NB_SESSION_OCID"],"compartment_id":["JOB_RUN_COMPARTMENT_OCID","NB_SESSION_COMPARTMENT_OCID",],}forkey,env_keysinprops_env_map.items():try:value=next(environ.get(env_key)forenv_keyinenv_keysifenviron.get(env_key,None)isnotNone)self.with_prop(key,value)except:pass