@@ -122,7 +122,7 @@ def get_origin_ml_task(self):
122122 if fmi is not None :
123123 return DSSMLTask .from_full_model_id (self .client , fmi , project_key = self .project_key )
124124
125- def import_mlflow_version_from_path (self , version_id , path , code_env_name = "INHERIT" ):
125+ def import_mlflow_version_from_path (self , version_id , path , code_env_name = "INHERIT" , container_exec_config_name = "INHERIT" ):
126126 """
127127 Create a new version for this saved model from a path containing a MLFlow model.
128128
@@ -133,6 +133,12 @@ def import_mlflow_version_from_path(self, version_id, path, code_env_name="INHER
133133 :param str code_env_name: Name of the code env to use for this model version. The code env must contain at least
134134 mlflow and the package(s) corresponding to the used MLFlow-compatible frameworks.
135135 If value is "INHERIT", the default active code env of the project will be used
136+ :param str container_exec_config_name: Name of the containerized execution configuration to use while creating
137+ this model version. Note that this information is not saved with the model version, so,
138+ for example, if you evaluate this model version later on, you will have to provide again
139+ that parameter.
140+ If value is "INHERIT", the container execution configuration of the project will be used.
141+ If value is "NONE", local execution will be used (no container)
136142 :return a :class:MLFlowVersionHandler in order to interact with the new MLFlow model version
137143 """
138144 # TODO: Add a check that it's indeed a MLFlow model folder
@@ -144,13 +150,13 @@ def import_mlflow_version_from_path(self, version_id, path, code_env_name="INHER
144150 archive_filename = _make_zipfile (os .path .join (archive_temp_dir , "tmpmodel.zip" ), path )
145151
146152 with open (archive_filename , "rb" ) as fp :
147- self .client ._perform_empty ("POST" , "/projects/%s/savedmodels/%s/versions/%s?codeEnvName=%s" % (self .project_key , self .sm_id , version_id , code_env_name ),
153+ self .client ._perform_empty ("POST" , "/projects/%s/savedmodels/%s/versions/%s?codeEnvName=%s&containerExecConfigName=%s " % (self .project_key , self .sm_id , version_id , code_env_name , container_exec_config_name ),
148154 files = {"file" : (archive_filename , fp )})
149155 return self .get_mlflow_version_handler (version_id )
150156 finally :
151157 shutil .rmtree (archive_temp_dir )
152158
153- def import_mlflow_version_from_managed_folder (self , version_id , managed_folder , path , code_env_name = "INHERIT" ):
159+ def import_mlflow_version_from_managed_folder (self , version_id , managed_folder , path , code_env_name = "INHERIT" , container_exec_config_name = "INHERIT" ):
154160 """
155161 Create a new version for this saved model from a path containing a MLFlow model in a managed folder.
156162
@@ -162,6 +168,12 @@ def import_mlflow_version_from_managed_folder(self, version_id, managed_folder,
162168 :param str code_env_name: Name of the code env to use for this model version. The code env must contain at least
163169 mlflow and the package(s) corresponding to the used MLFlow-compatible frameworks.
164170 If value is "INHERIT", the default active code env of the project will be used
171+ :param str container_exec_config_name: Name of the containerized execution configuration to use while creating
172+ this model version. Note that this information is not saved with the model version, so,
173+ for example, if you evaluate this model version later on, you will have to provide again
174+ that parameter.
175+ If value is "INHERIT", the container execution configuration of the project will be used.
176+ If value is "NONE", local execution will be used (no container)
165177 :return a :class:MLFlowVersionHandler in order to interact with the new MLFlow model version
166178 """
167179 # TODO: Add a check that it's indeed a MLFlow model folder
@@ -172,8 +184,8 @@ def import_mlflow_version_from_managed_folder(self, version_id, managed_folder,
172184 folder_ref = managed_folder
173185
174186 self .client ._perform_empty (
175- "POST" , "/projects/{project_id}/savedmodels/{saved_model_id}/versions/{version_id}?codeEnvName={codeEnvName}" .format (
176- project_id = self .project_key , saved_model_id = self .sm_id , version_id = version_id , codeEnvName = code_env_name
187+ "POST" , "/projects/{project_id}/savedmodels/{saved_model_id}/versions/{version_id}?codeEnvName={codeEnvName}&containerExecConfigName={containerExecConfigName} " .format (
188+ project_id = self .project_key , saved_model_id = self .sm_id , version_id = version_id , codeEnvName = code_env_name , containerExecConfigName = container_exec_config_name
177189 ),
178190 params = {"folderRef" : folder_ref , "path" : path },
179191 files = {"file" : (None , None )} # required for backend-mandated multipart request
@@ -343,7 +355,7 @@ def set_core_metadata(self,
343355 "/projects/%s/savedmodels/%s/versions/%s/external-ml/metadata" % (self .saved_model .project_key , self .saved_model .sm_id , self .version_id ),
344356 body = metadata )
345357
346- def evaluate (self , dataset_ref ):
358+ def evaluate (self , dataset_ref , container_exec_config_name = "INHERIT" ):
347359 """
348360 Evaluates the performance of this model version on a particular dataset.
349361 After calling this, the "result screens" of the MLFlow model version will be available
@@ -352,11 +364,15 @@ def evaluate(self, dataset_ref):
352364
353365 :meth:`set_core_metadata` must be called before you can evaluate a dataset
354366 :param str dataset_ref: Evaluation dataset to use (either a dataset name, "PROJECT.datasetName", :class:`DSSDataset` instance or :class:`dataiku.Dataset` instance)
367+ :param str container_exec_config_name: Name of the containerized execution configuration to use for running the evaluation process.
368+ If value is "INHERIT", the container execution configuration of the project will be used.
369+ If value is "NONE", local execution will be used (no container)
355370 """
356371 if hasattr (dataset_ref , 'name' ):
357372 dataset_ref = dataset_ref .name
358373 req = {
359- "datasetRef" : dataset_ref
374+ "datasetRef" : dataset_ref ,
375+ "containerExecConfigName" : container_exec_config_name
360376 }
361377 self .saved_model .client ._perform_empty ("POST" ,
362378 "/projects/%s/savedmodels/%s/versions/%s/external-ml/actions/evaluate" % (self .saved_model .project_key , self .saved_model .sm_id , self .version_id ),
0 commit comments