mlrun 1.7.1rc2__py3-none-any.whl → 1.7.1rc4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of mlrun might be problematic. Click here for more details.

@@ -104,32 +104,32 @@ class OutputStream:
104
104
  self._mock = mock
105
105
  self._mock_queue = []
106
106
 
107
+ def create_stream(self):
108
+ # this import creates an import loop via the utils module, so putting it in execution path
109
+ from mlrun.utils.helpers import logger
110
+
111
+ logger.debug(
112
+ "Creating output stream",
113
+ endpoint=self._endpoint,
114
+ container=self._container,
115
+ stream_path=self._stream_path,
116
+ shards=self._shards,
117
+ retention_in_hours=self._retention_in_hours,
118
+ )
119
+ response = self._v3io_client.stream.create(
120
+ container=self._container,
121
+ stream_path=self._stream_path,
122
+ shard_count=self._shards or 1,
123
+ retention_period_hours=self._retention_in_hours or 24,
124
+ raise_for_status=v3io.dataplane.RaiseForStatus.never,
125
+ )
126
+ if not (response.status_code == 400 and "ResourceInUse" in str(response.body)):
127
+ response.raise_for_status([409, 204])
128
+
107
129
  def _lazy_init(self):
108
130
  if self._create and not self._mock:
109
- # this import creates an import loop via the utils module, so putting it in execution path
110
- from mlrun.utils.helpers import logger
111
-
112
131
  self._create = False
113
-
114
- logger.debug(
115
- "Creating output stream",
116
- endpoint=self._endpoint,
117
- container=self._container,
118
- stream_path=self._stream_path,
119
- shards=self._shards,
120
- retention_in_hours=self._retention_in_hours,
121
- )
122
- response = self._v3io_client.stream.create(
123
- container=self._container,
124
- stream_path=self._stream_path,
125
- shard_count=self._shards or 1,
126
- retention_period_hours=self._retention_in_hours or 24,
127
- raise_for_status=v3io.dataplane.RaiseForStatus.never,
128
- )
129
- if not (
130
- response.status_code == 400 and "ResourceInUse" in str(response.body)
131
- ):
132
- response.raise_for_status([409, 204])
132
+ self.create_stream()
133
133
 
134
134
  def push(self, data, partition_key=None):
135
135
  self._lazy_init()
@@ -607,7 +607,7 @@ class ServingRuntime(RemoteRuntime):
607
607
  ):
608
608
  # initialize or create required streams/queues
609
609
  self.spec.graph.check_and_process_graph()
610
- self.spec.graph.init_queues()
610
+ self.spec.graph.create_queue_streams()
611
611
  functions_in_steps = self.spec.graph.list_child_functions()
612
612
  child_functions = list(self._spec.function_refs.keys())
613
613
  for function in functions_in_steps:
mlrun/serving/routers.py CHANGED
@@ -491,6 +491,7 @@ class VotingEnsemble(ParallelRun):
491
491
  executor_type: Union[ParallelRunnerModes, str] = ParallelRunnerModes.thread,
492
492
  format_response_with_col_name_flag: bool = False,
493
493
  prediction_col_name: str = "prediction",
494
+ shard_by_endpoint: typing.Optional[bool] = None,
494
495
  **kwargs,
495
496
  ):
496
497
  """Voting Ensemble
@@ -580,6 +581,8 @@ class VotingEnsemble(ParallelRun):
580
581
  `{id: <id>, model_name: <name>, outputs: {..., prediction: [<predictions>], ...}}`
581
582
  the prediction_col_name should be `prediction`.
582
583
  by default, `prediction`
584
+ :param shard_by_endpoint: whether to use the endpoint as the partition/sharding key when writing to model
585
+ monitoring stream. Defaults to True.
583
586
  :param kwargs: extra arguments
584
587
  """
585
588
  super().__init__(
@@ -606,6 +609,7 @@ class VotingEnsemble(ParallelRun):
606
609
  self.prediction_col_name = prediction_col_name or "prediction"
607
610
  self.format_response_with_col_name_flag = format_response_with_col_name_flag
608
611
  self.model_endpoint_uid = None
612
+ self.shard_by_endpoint = shard_by_endpoint
609
613
 
610
614
  def post_init(self, mode="sync"):
611
615
  server = getattr(self.context, "_server", None) or getattr(
@@ -907,7 +911,12 @@ class VotingEnsemble(ParallelRun):
907
911
  if self._model_logger and self.log_router:
908
912
  if "id" not in request:
909
913
  request["id"] = response.body["id"]
910
- self._model_logger.push(start, request, response.body)
914
+ partition_key = (
915
+ self.model_endpoint_uid if self.shard_by_endpoint is not False else None
916
+ )
917
+ self._model_logger.push(
918
+ start, request, response.body, partition_key=partition_key
919
+ )
911
920
  event.body = _update_result_body(
912
921
  self._result_path, original_body, response.body if response else None
913
922
  )
mlrun/serving/states.py CHANGED
@@ -839,6 +839,8 @@ class QueueStep(BaseStep):
839
839
  retention_in_hours=self.retention_in_hours,
840
840
  **self.options,
841
841
  )
842
+ if hasattr(self._stream, "create_stream"):
843
+ self._stream.create_stream()
842
844
  self._set_error_handler()
843
845
 
844
846
  @property
@@ -1247,8 +1249,8 @@ class FlowStep(BaseStep):
1247
1249
  links[next_step.function] = step
1248
1250
  return links
1249
1251
 
1250
- def init_queues(self):
1251
- """init/create the streams used in this flow"""
1252
+ def create_queue_streams(self):
1253
+ """create the streams used in this flow"""
1252
1254
  for step in self.get_children():
1253
1255
  if step.kind == StepKinds.queue:
1254
1256
  step.init_object(self.context, None)
@@ -1,4 +1,4 @@
1
1
  {
2
- "git_commit": "e31c876608ddb9f2760ea3bcd6b4feb901d923a0",
3
- "version": "1.7.1-rc2"
2
+ "git_commit": "cea87e17a9fb69a20668cbe421819d4fc73f08a3",
3
+ "version": "1.7.1-rc4"
4
4
  }
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: mlrun
3
- Version: 1.7.1rc2
3
+ Version: 1.7.1rc4
4
4
  Summary: Tracking and config of machine learning runs
5
5
  Home-page: https://github.com/mlrun/mlrun
6
6
  Author: Yaron Haviv
@@ -269,7 +269,7 @@ mlrun/package/utils/_supported_format.py,sha256=O3LPTvZ6A-nGi6mB2kTzJp2DQ-cCOgnl
269
269
  mlrun/package/utils/log_hint_utils.py,sha256=40X7oVzCiAIGsTTSON0iYNHj-_1Y4l4SDMThTA85If8,3696
270
270
  mlrun/package/utils/type_hint_utils.py,sha256=JYrek6vuN3z7e6MGUD3qBLDfQ03C4puZXNTpDSj-VrM,14695
271
271
  mlrun/platforms/__init__.py,sha256=ggSGF7inITs6S-vj9u4S9X_5psgbA0G3GVqf7zu8qYc,2406
272
- mlrun/platforms/iguazio.py,sha256=s_I9zf1IiMS7Rv6b7umQm5LBW-4rDdLqzhbWd5Ve0u0,13741
272
+ mlrun/platforms/iguazio.py,sha256=MNRzIzxcc_3wsePLjBXuKKKSaObVnnrC3ZyXgSRu8m0,13697
273
273
  mlrun/projects/__init__.py,sha256=0Krf0WIKfnZa71WthYOg0SoaTodGg3sV_hK3f_OlTPI,1220
274
274
  mlrun/projects/operations.py,sha256=gtqSU9OvYOV-b681uQtWgnW7YSnX6qfa1Mt1Xm4f1ZI,19752
275
275
  mlrun/projects/pipelines.py,sha256=IE8MpuXPnXi0_izOCEC1dtpEctcdWZUyCADnMvAZH0M,45331
@@ -296,7 +296,7 @@ mlrun/runtimes/nuclio/__init__.py,sha256=gx1kizzKv8pGT5TNloN1js1hdbxqDw3rM90sLVY
296
296
  mlrun/runtimes/nuclio/api_gateway.py,sha256=oQRSOvqtODKCzT2LqlqSXZbq2vcZ7epsFZwO9jvarhc,26899
297
297
  mlrun/runtimes/nuclio/function.py,sha256=TQt6RyxK_iyzNJr2r57BRtVXuy2GMrhdeFOlFjb2AZg,52106
298
298
  mlrun/runtimes/nuclio/nuclio.py,sha256=sLK8KdGO1LbftlL3HqPZlFOFTAAuxJACZCVl1c0Ha6E,2942
299
- mlrun/runtimes/nuclio/serving.py,sha256=Tsv-MssXJPe4di9stVOAyCj2MTMI7zQxvtFbAgdAtu0,29717
299
+ mlrun/runtimes/nuclio/serving.py,sha256=L1Tz5EZyo8JZmUBNmIRYL9AoWfqSm4zLQQ9DWbnlmp8,29726
300
300
  mlrun/runtimes/nuclio/application/__init__.py,sha256=rRs5vasy_G9IyoTpYIjYDafGoL6ifFBKgBtsXn31Atw,614
301
301
  mlrun/runtimes/nuclio/application/application.py,sha256=5XFIg7tgU9kKWwGdMFwB1OJpw79BWwlWUdGiHlDo4AY,29055
302
302
  mlrun/runtimes/nuclio/application/reverse_proxy.go,sha256=JIIYae6bXzCLf3jXuu49KWPQYoXr_FDQ2Rbo1OWKAd0,3150
@@ -305,10 +305,10 @@ mlrun/runtimes/sparkjob/spark3job.py,sha256=RuwO9Pk1IFaUCFz8zoYLaK3pYT7w07uAjouc
305
305
  mlrun/serving/__init__.py,sha256=-SMRV3q_5cGVPDxRslXPU0zGYZIygs0cSj7WKlOJJUc,1163
306
306
  mlrun/serving/merger.py,sha256=PXLn3A21FiLteJHaDSLm5xKNT-80eTTjfHUJnBX1gKY,6116
307
307
  mlrun/serving/remote.py,sha256=MrFByphQWmIsKXqw-MOwl2Q1hbtWReYVRKvlcKj9pfw,17980
308
- mlrun/serving/routers.py,sha256=el3-pfh7jXdnobt229jbMagD4WA-elp_ejX54VZQg6k,55347
308
+ mlrun/serving/routers.py,sha256=aJHO-063gaQ1N3vRDXQwKJ5zwy_X9q3RIq5CjsuCOG8,55832
309
309
  mlrun/serving/server.py,sha256=m1HzUDconjowDtheQ71HEKbV7e9A-TUtaCdoqxTH2Pw,22092
310
310
  mlrun/serving/serving_wrapper.py,sha256=R670-S6PX_d5ER6jiHtRvacuPyFzQH0mEf2K0sBIIOM,836
311
- mlrun/serving/states.py,sha256=e4QGSAnNq_eLPDoojxkMkw7fLgUST5ea_BQTO7jWsTA,60228
311
+ mlrun/serving/states.py,sha256=uajsgqmf1qBkkm6es4hb9c1hUARKHUBDqxVmDFEbPLo,60332
312
312
  mlrun/serving/utils.py,sha256=lej7XcUPX1MmHkEOi_0KZRGSpfbmpnE0GK_Sn4zLkHY,4025
313
313
  mlrun/serving/v1_serving.py,sha256=by4myxlnwyZ0ijQ5fURilGCK1sUpdQL2Il1VR3Xqpxg,11805
314
314
  mlrun/serving/v2_serving.py,sha256=y48sMhSmZwwHAeTaqdeaxeRag3hkZH1nDolx5CS8VbU,26379
@@ -341,11 +341,11 @@ mlrun/utils/notifications/notification/ipython.py,sha256=ZtVL30B_Ha0VGoo4LxO-voT
341
341
  mlrun/utils/notifications/notification/slack.py,sha256=wqpFGr5BTvFO5KuUSzFfxsgmyU1Ohq7fbrGeNe9TXOk,7006
342
342
  mlrun/utils/notifications/notification/webhook.py,sha256=cb9w1Mc8ENfJBdgan7iiVHK9eVls4-R3tUxmXM-P-8I,4746
343
343
  mlrun/utils/version/__init__.py,sha256=7kkrB7hEZ3cLXoWj1kPoDwo4MaswsI2JVOBpbKgPAgc,614
344
- mlrun/utils/version/version.json,sha256=D4idbmZRoOSf9434CduO0fir5zz0S4XOvHurnme_XUY,88
344
+ mlrun/utils/version/version.json,sha256=K3OspIDXXuhY1cyInBRY_fVXaoyI-2e-8DfXWB2SK3o,88
345
345
  mlrun/utils/version/version.py,sha256=eEW0tqIAkU9Xifxv8Z9_qsYnNhn3YH7NRAfM-pPLt1g,1878
346
- mlrun-1.7.1rc2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
347
- mlrun-1.7.1rc2.dist-info/METADATA,sha256=EbfTMAW4TIWdT5UGjJq1G1pwhFCIZ8nq5NI_kntKdM8,24486
348
- mlrun-1.7.1rc2.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
349
- mlrun-1.7.1rc2.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
350
- mlrun-1.7.1rc2.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
351
- mlrun-1.7.1rc2.dist-info/RECORD,,
346
+ mlrun-1.7.1rc4.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
347
+ mlrun-1.7.1rc4.dist-info/METADATA,sha256=MlsjuiTJPlbez2yLh9-QMd9bw_J70L1vgvT68yBj0AM,24486
348
+ mlrun-1.7.1rc4.dist-info/WHEEL,sha256=a7TGlA-5DaHMRrarXjVbQagU3Man_dCnGIWMJr5kRWo,91
349
+ mlrun-1.7.1rc4.dist-info/entry_points.txt,sha256=1Owd16eAclD5pfRCoJpYC2ZJSyGNTtUr0nCELMioMmU,46
350
+ mlrun-1.7.1rc4.dist-info/top_level.txt,sha256=NObLzw3maSF9wVrgSeYBv-fgnHkAJ1kEkh12DLdd5KM,6
351
+ mlrun-1.7.1rc4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (75.3.0)
2
+ Generator: setuptools (75.4.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5