Skip to content

Commit c9d97fb

Browse files
authored
bring back deprecated params and add warn (#834) (#835)
1 parent 668d545 commit c9d97fb

File tree

2 files changed

+90
-40
lines changed

2 files changed

+90
-40
lines changed

batch_inference_v2/batch_inference_v2.py

+34-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,17 @@ def infer(
120120
model_endpoint_sample_set: Union[
121121
mlrun.DataItem, list, dict, pd.DataFrame, pd.Series, np.ndarray
122122
] = None,
123+
124+
# the following parameters are deprecated and will be removed once the versioning mechanism is implemented
125+
# TODO: Remove the following parameters once FHUB-13 is resolved
126+
trigger_monitoring_job: Optional[bool] = None,
127+
batch_image_job: Optional[str] = None,
128+
model_endpoint_drift_threshold: Optional[float] = None,
129+
model_endpoint_possible_drift_threshold: Optional[float] = None,
130+
131+
# prediction kwargs to pass to the model predict function
123132
**predict_kwargs: Dict[str, Any],
133+
124134
):
125135
"""
126136
Perform a prediction on the provided dataset using the specified model.
@@ -173,10 +183,33 @@ def infer(
173183
:param model_endpoint_sample_set: A sample dataset to give to compare the inputs in the drift analysis.
174184
Can be provided as an input (DataItem) or as a parameter (e.g. string, list, DataFrame).
175185
The default chosen sample set will always be the one who is set in the model artifact itself.
186+
:param trigger_monitoring_job: Whether to trigger the batch drift analysis after the infer job.
187+
:param batch_image_job: The image that will be used to register the monitoring batch job if not exist.
188+
By default, the image is mlrun/mlrun.
189+
:param model_endpoint_drift_threshold: The threshold of which to mark drifts. Defaulted to 0.7.
190+
:param model_endpoint_possible_drift_threshold: The threshold of which to mark possible drifts. Defaulted to 0.5.
176191
177192
raises MLRunInvalidArgumentError: if both `model_path` and `endpoint_id` are not provided
178193
"""
179194

195+
196+
if trigger_monitoring_job:
197+
context.logger.warning("The `trigger_monitoring_job` parameter is deprecated and will be removed once the versioning mechanism is implemented. "
198+
"if you are using mlrun<1.7.0, please import the previous version of this function, for example "
199+
"'hub://batch_inference_v2:2.5.0'.")
200+
if batch_image_job:
201+
context.logger.warning("The `batch_image_job` parameter is deprecated and will be removed once the versioning mechanism is implemented. "
202+
"if you are using mlrun<1.7.0, please import the previous version of this function, for example "
203+
"'hub://batch_inference_v2:2.5.0'.")
204+
if model_endpoint_drift_threshold:
205+
context.logger.warning("The `model_endpoint_drift_threshold` parameter is deprecated and will be removed once the versioning mechanism is implemented. "
206+
"if you are using mlrun<1.7.0, please import the previous version of this function, for example "
207+
"'hub://batch_inference_v2:2.5.0'.")
208+
if model_endpoint_possible_drift_threshold:
209+
context.logger.warning("The `model_endpoint_possible_drift_threshold` parameter is deprecated and will be removed once the versioning mechanism is implemented. "
210+
"if you are using mlrun<1.7.0, please import the previous version of this function, for example "
211+
"'hub://batch_inference_v2:2.5.0'.")
212+
180213
# Loading the model:
181214
context.logger.info(f"Loading model...")
182215
if isinstance(model_path, mlrun.DataItem):
@@ -250,4 +283,4 @@ def infer(
250283
model_endpoint_name=model_endpoint_name,
251284
infer_results_df=result_set.copy(),
252285
sample_set_statistics=sample_set_statistics,
253-
)
286+
)

0 commit comments

Comments
 (0)