ob-metaflow 2.16.6.5rc2__py2.py3-none-any.whl → 2.16.6.5rc3__py2.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 ob-metaflow might be problematic. Click here for more details.

@@ -310,6 +310,43 @@ class ArgoWorkflowsDeployedFlow(DeployedFlow):
310
310
 
311
311
  return cls(deployer=d)
312
312
 
313
+ @classmethod
314
+ def get_triggered_run(
315
+ cls, identifier: str, run_id: str, metadata: Optional[str] = None
316
+ ):
317
+ """
318
+ Retrieves a `ArgoWorkflowsTriggeredRun` object from an identifier, a run id and
319
+ optional metadata.
320
+
321
+ Parameters
322
+ ----------
323
+ identifier : str
324
+ Deployer specific identifier for the workflow to retrieve
325
+ run_id : str
326
+ Run ID for the which to fetch the triggered run object
327
+ metadata : str, optional, default None
328
+ Optional deployer specific metadata.
329
+
330
+ Returns
331
+ -------
332
+ ArgoWorkflowsTriggeredRun
333
+ A `ArgoWorkflowsTriggeredRun` object representing the
334
+ triggered run on argo workflows.
335
+ """
336
+ deployed_flow_obj = cls.from_deployment(identifier, metadata)
337
+ return ArgoWorkflowsTriggeredRun(
338
+ deployer=deployed_flow_obj.deployer,
339
+ content=json.dumps(
340
+ {
341
+ "metadata": deployed_flow_obj.deployer.metadata,
342
+ "pathspec": "/".join(
343
+ (deployed_flow_obj.deployer.flow_name, run_id)
344
+ ),
345
+ "name": run_id,
346
+ }
347
+ ),
348
+ )
349
+
313
350
  @property
314
351
  def production_token(self) -> Optional[str]:
315
352
  """
@@ -84,6 +84,22 @@ class StepFunctionsDeployedFlow(DeployedFlow):
84
84
  "from_deployment is not implemented for StepFunctions"
85
85
  )
86
86
 
87
+ @classmethod
88
+ def get_triggered_run(
89
+ cls, identifier: str, run_id: str, metadata: Optional[str] = None
90
+ ):
91
+ """
92
+ This method is not currently implemented for Step Functions.
93
+
94
+ Raises
95
+ ------
96
+ NotImplementedError
97
+ This method is not implemented for Step Functions.
98
+ """
99
+ raise NotImplementedError(
100
+ "get_triggered_run is not implemented for StepFunctions"
101
+ )
102
+
87
103
  @property
88
104
  def production_token(self: DeployedFlow) -> Optional[str]:
89
105
  """
@@ -1026,33 +1026,39 @@ class KubernetesArgoJobSet(object):
1026
1026
  def dump(self):
1027
1027
  client = self._kubernetes_sdk
1028
1028
 
1029
- data = json.dumps(
1030
- client.ApiClient().sanitize_for_serialization(
1031
- dict(
1032
- apiVersion=self._group + "/" + self._version,
1033
- kind="JobSet",
1034
- metadata=client.api_client.ApiClient().sanitize_for_serialization(
1035
- client.V1ObjectMeta(
1036
- name=self.name,
1037
- labels=self._labels,
1038
- annotations=self._annotations,
1039
- )
1040
- ),
1041
- spec=dict(
1042
- replicatedJobs=[self.control.dump(), self.worker.dump()],
1043
- suspend=False,
1044
- startupPolicy=None,
1045
- successPolicy=None,
1046
- # The Failure Policy helps setting the number of retries for the jobset.
1047
- # but we don't rely on it and instead rely on either the local scheduler
1048
- # or the Argo Workflows to handle retries.
1049
- failurePolicy=None,
1050
- network=None,
1051
- ),
1052
- status=None,
1053
- )
1029
+ def _best_effort_yaml_dump(_data):
1030
+ try:
1031
+ import yaml
1032
+ except ImportError:
1033
+ return False, json.dumps(_data)
1034
+ return True, yaml.dump(_data, default_flow_style=False, indent=2)
1035
+
1036
+ js_dict = client.ApiClient().sanitize_for_serialization(
1037
+ dict(
1038
+ apiVersion=self._group + "/" + self._version,
1039
+ kind="JobSet",
1040
+ metadata=client.api_client.ApiClient().sanitize_for_serialization(
1041
+ client.V1ObjectMeta(
1042
+ name=self.name,
1043
+ labels=self._labels,
1044
+ annotations=self._annotations,
1045
+ )
1046
+ ),
1047
+ spec=dict(
1048
+ replicatedJobs=[self.control.dump(), self.worker.dump()],
1049
+ suspend=False,
1050
+ startupPolicy=None,
1051
+ successPolicy=None,
1052
+ # The Failure Policy helps setting the number of retries for the jobset.
1053
+ # but we don't rely on it and instead rely on either the local scheduler
1054
+ # or the Argo Workflows to handle retries.
1055
+ failurePolicy=None,
1056
+ network=None,
1057
+ ),
1058
+ status=None,
1054
1059
  )
1055
1060
  )
1061
+ yaml_coverted, data = _best_effort_yaml_dump(js_dict)
1056
1062
  # The values we populate in the Jobset manifest (for Argo Workflows) piggybacks on the Argo Workflow's templating engine.
1057
1063
  # Even though Argo Workflows's templating helps us constructing all the necessary IDs and populating the fields
1058
1064
  # required by Metaflow, we run into one glitch. When we construct JSON/YAML serializable objects,
@@ -1067,7 +1073,9 @@ class KubernetesArgoJobSet(object):
1067
1073
  # Since the value of `num_parallel` can be dynamic and can change from run to run, we need to ensure that the
1068
1074
  # value can be passed-down dynamically and is **explicitly set as a integer** in the Jobset Manifest submitted as a
1069
1075
  # part of the Argo Workflow
1070
-
1071
1076
  quoted_substring = '"{{=asInt(inputs.parameters.workerCount)}}"'
1077
+ if yaml_coverted:
1078
+ quoted_substring = "'{{=asInt(inputs.parameters.workerCount)}}'"
1079
+
1072
1080
  unquoted_substring = "{{=asInt(inputs.parameters.workerCount)}}"
1073
1081
  return data.replace(quoted_substring, unquoted_substring)
@@ -231,6 +231,67 @@ class DeployedFlowMeta(type):
231
231
  }
232
232
  )
233
233
 
234
+ def _get_triggered_run_injected_method():
235
+ def f(
236
+ cls,
237
+ identifier: str,
238
+ run_id: str,
239
+ metadata: Optional[str] = None,
240
+ impl: str = DEFAULT_FROM_DEPLOYMENT_IMPL.replace("-", "_"),
241
+ ) -> "TriggeredRun":
242
+ """
243
+ Retrieves a `TriggeredRun` object from an identifier, a run id and optional
244
+ metadata. The `impl` parameter specifies the deployer implementation
245
+ to use (like `argo-workflows`).
246
+
247
+ Parameters
248
+ ----------
249
+ identifier : str
250
+ Deployer specific identifier for the workflow to retrieve
251
+ run_id : str
252
+ Run ID for the which to fetch the triggered run object
253
+ metadata : str, optional, default None
254
+ Optional deployer specific metadata.
255
+ impl : str, optional, default given by METAFLOW_DEFAULT_FROM_DEPLOYMENT_IMPL
256
+ The default implementation to use if not specified
257
+
258
+ Returns
259
+ -------
260
+ TriggeredRun
261
+ A `TriggeredRun` object representing the triggered run corresponding
262
+ to the identifier and the run id.
263
+ """
264
+ if impl in allowed_providers:
265
+ return (
266
+ allowed_providers[impl]
267
+ .deployed_flow_type()
268
+ .get_triggered_run(identifier, run_id, metadata)
269
+ )
270
+ else:
271
+ raise ValueError(
272
+ f"No deployer '{impl}' exists; valid deployers are: "
273
+ f"{list(allowed_providers.keys())}"
274
+ )
275
+
276
+ f.__name__ = "get_triggered_run"
277
+ return f
278
+
279
+ def _per_type_get_triggered_run_injected_method(method_name, impl):
280
+ def f(
281
+ cls,
282
+ identifier: str,
283
+ run_id: str,
284
+ metadata: Optional[str] = None,
285
+ ):
286
+ return (
287
+ allowed_providers[impl]
288
+ .deployed_flow_type()
289
+ .get_triggered_run(identifier, run_id, metadata)
290
+ )
291
+
292
+ f.__name__ = method_name
293
+ return f
294
+
234
295
  def _from_deployment_injected_method():
235
296
  def f(
236
297
  cls,
@@ -347,10 +408,16 @@ class DeployedFlowMeta(type):
347
408
  "list_deployed_flows",
348
409
  classmethod(_list_deployed_flows_injected_method()),
349
410
  )
411
+ setattr(
412
+ cls,
413
+ "get_triggered_run",
414
+ classmethod(_get_triggered_run_injected_method()),
415
+ )
350
416
 
351
417
  for impl in allowed_providers:
352
418
  from_deployment_method_name = f"from_{impl}"
353
419
  list_deployed_flows_method_name = f"list_{impl}"
420
+ get_triggered_run_method_name = f"get_triggered_{impl}_run"
354
421
 
355
422
  setattr(
356
423
  cls,
@@ -372,6 +439,16 @@ class DeployedFlowMeta(type):
372
439
  ),
373
440
  )
374
441
 
442
+ setattr(
443
+ cls,
444
+ get_triggered_run_method_name,
445
+ classmethod(
446
+ _per_type_get_triggered_run_injected_method(
447
+ get_triggered_run_method_name, impl
448
+ )
449
+ ),
450
+ )
451
+
375
452
  return cls
376
453
 
377
454
 
metaflow/version.py CHANGED
@@ -1 +1 @@
1
- metaflow_version = "2.16.6.5rc2"
1
+ metaflow_version = "2.16.6.5rc3"
@@ -582,6 +582,39 @@ if "jobset" in enabled_components:
582
582
 
583
583
  config_resources.append('jobset-controller-manager')
584
584
 
585
+ # ClusterRole for jobset operations
586
+ k8s_yaml(encode_yaml({
587
+ 'apiVersion': 'rbac.authorization.k8s.io/v1',
588
+ 'kind': 'ClusterRole',
589
+ 'metadata': {
590
+ 'name': 'jobset-full-access'
591
+ },
592
+ 'rules': [{
593
+ 'apiGroups': ['jobset.x-k8s.io'],
594
+ 'resources': ['jobsets'],
595
+ 'verbs': ['*']
596
+ }]
597
+ }))
598
+
599
+ # ClusterRoleBinding for default service account to access jobsets
600
+ k8s_yaml(encode_yaml({
601
+ 'apiVersion': 'rbac.authorization.k8s.io/v1',
602
+ 'kind': 'ClusterRoleBinding',
603
+ 'metadata': {
604
+ 'name': 'default-jobset-binding'
605
+ },
606
+ 'subjects': [{
607
+ 'kind': 'ServiceAccount',
608
+ 'name': 'default',
609
+ 'namespace': 'default'
610
+ }],
611
+ 'roleRef': {
612
+ 'kind': 'ClusterRole',
613
+ 'name': 'jobset-full-access',
614
+ 'apiGroup': 'rbac.authorization.k8s.io'
615
+ }
616
+ }))
617
+
585
618
  #################################################
586
619
  # METADATA SERVICE
587
620
  #################################################
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: ob-metaflow
3
- Version: 2.16.6.5rc2
3
+ Version: 2.16.6.5rc3
4
4
  Summary: Metaflow: More AI and ML, Less Engineering
5
5
  Author: Netflix, Outerbounds & the Metaflow Community
6
6
  Author-email: help@outerbounds.co
@@ -12,7 +12,7 @@ Requires-Dist: boto3
12
12
  Requires-Dist: pylint
13
13
  Requires-Dist: kubernetes
14
14
  Provides-Extra: stubs
15
- Requires-Dist: metaflow-stubs==2.16.6.5rc2; extra == "stubs"
15
+ Requires-Dist: metaflow-stubs==2.16.6.5rc3; extra == "stubs"
16
16
  Dynamic: author
17
17
  Dynamic: author-email
18
18
  Dynamic: description
@@ -36,7 +36,7 @@ metaflow/tuple_util.py,sha256=_G5YIEhuugwJ_f6rrZoelMFak3DqAR2tt_5CapS1XTY,830
36
36
  metaflow/unbounded_foreach.py,sha256=p184WMbrMJ3xKYHwewj27ZhRUsSj_kw1jlye5gA9xJk,387
37
37
  metaflow/util.py,sha256=g2SOU_CRzJLgDM_UGF9QDMANMAIHAsDRXE6S76_YzsY,14594
38
38
  metaflow/vendor.py,sha256=EDZokNMrx1PU07jNMiWFMFtC7TL03pMXZ1kKn13k-2g,5139
39
- metaflow/version.py,sha256=myLPpIY7ah-4ZTESJn77HIAOJwWJZ6HiMk7ZESRU6Rw,33
39
+ metaflow/version.py,sha256=uSLoIqYtZomyU4CiNeXNRryvNmDj9FDE2SbSzgme6wE,33
40
40
  metaflow/_vendor/__init__.py,sha256=y_CiwUD3l4eAKvTVDZeqgVujMy31cAM1qjAB-HfI-9s,353
41
41
  metaflow/_vendor/typing_extensions.py,sha256=q9zxWa6p6CzF1zZvSkygSlklduHf_b3K7MCxGz7MJRc,134519
42
42
  metaflow/_vendor/zipp.py,sha256=ajztOH-9I7KA_4wqDYygtHa6xUBVZgFpmZ8FE74HHHI,8425
@@ -217,7 +217,7 @@ metaflow/plugins/argo/argo_workflows.py,sha256=9Bc8h2w_yN39puQDXVskrT5L2sRo-kO8J
217
217
  metaflow/plugins/argo/argo_workflows_cli.py,sha256=Le_GgvLVE1MhxQeOv-k5xp4L51tzQ6ZIq3_P-YEphIk,38784
218
218
  metaflow/plugins/argo/argo_workflows_decorator.py,sha256=ogCSBmwsC2C3eusydrgjuAJd4qK18f1sI4jJwA4Fd-o,7800
219
219
  metaflow/plugins/argo/argo_workflows_deployer.py,sha256=6kHxEnYXJwzNCM9swI8-0AckxtPWqwhZLerYkX8fxUM,4444
220
- metaflow/plugins/argo/argo_workflows_deployer_objects.py,sha256=1qiY69jB2yq0ryIH2SKzFHgUXRYvr0VTXd9TDQWG-s0,13693
220
+ metaflow/plugins/argo/argo_workflows_deployer_objects.py,sha256=ydBE-lP42eNKvep36nQdUBPS3rQQErvoA7rCgyp5M6I,14949
221
221
  metaflow/plugins/argo/capture_error.py,sha256=Ys9dscGrTpW-ZCirLBU0gD9qBM0BjxyxGlUMKcwewQc,1852
222
222
  metaflow/plugins/argo/exit_hooks.py,sha256=nh8IEkzAtQnbKVnh3N9CVnVKZB39Bjm3e0LFrACsLz8,6109
223
223
  metaflow/plugins/argo/generate_input_paths.py,sha256=loYsI6RFX9LlFsHb7Fe-mzlTTtRdySoOu7sYDy-uXK0,881
@@ -243,7 +243,7 @@ metaflow/plugins/aws/step_functions/step_functions_cli.py,sha256=tLIfDwgdcfBjkjm
243
243
  metaflow/plugins/aws/step_functions/step_functions_client.py,sha256=DKpNwAIWElvWjFANs5Ku3rgzjxFoqAD6k-EF8Xhkg3Q,4754
244
244
  metaflow/plugins/aws/step_functions/step_functions_decorator.py,sha256=jzDHYmgU_XvLffZDazR_1viow_1qQFblx9UKyjtoM_0,3788
245
245
  metaflow/plugins/aws/step_functions/step_functions_deployer.py,sha256=JKYtDhKivtXUWPklprZFzkqezh14loGDmk8mNk6QtpI,3714
246
- metaflow/plugins/aws/step_functions/step_functions_deployer_objects.py,sha256=KWIPpE4ebOYyyXlRVtJF6XMnYcyjMFTxdzJWbP0m5PA,7719
246
+ metaflow/plugins/aws/step_functions/step_functions_deployer_objects.py,sha256=n7AEPs3uULXEuG3TVf2ZlTNq1LFd2n7x1IPVO2T5Ekk,8174
247
247
  metaflow/plugins/azure/__init__.py,sha256=GuuhTVC-zSdyAf79a1wiERMq0Zts7fwVT7t9fAf234A,100
248
248
  metaflow/plugins/azure/azure_credential.py,sha256=JmdGEbVzgxy8ucqnQDdTTI_atyMX9WSZUw3qYOo7RhE,2174
249
249
  metaflow/plugins/azure/azure_exceptions.py,sha256=NnbwpUC23bc61HZjJmeXztY0tBNn_Y_VpIpDDuYWIZ0,433
@@ -330,7 +330,7 @@ metaflow/plugins/kubernetes/kubernetes_cli.py,sha256=qtWTQqp8i-hTKAA0RcJ_qeOuD8T
330
330
  metaflow/plugins/kubernetes/kubernetes_client.py,sha256=tuvXP-QKpdeSmzVolB2R_TaacOr5DIb0j642eKcjsiM,6491
331
331
  metaflow/plugins/kubernetes/kubernetes_decorator.py,sha256=htawUXm3SDfxzAcjluKrdfMez0o9Lf6ni5_rqK38YJY,33278
332
332
  metaflow/plugins/kubernetes/kubernetes_job.py,sha256=xhucNJR7EpM-XMsfY0nt-BASbjo_T4vL_-tmQ_xHL1U,33284
333
- metaflow/plugins/kubernetes/kubernetes_jobsets.py,sha256=ZZU5vsBe67NmGuxgXw6clf7kKRST7867AW6_t3fCD5g,43065
333
+ metaflow/plugins/kubernetes/kubernetes_jobsets.py,sha256=zxINtrBvviw1CUt9xB2Uiu3LVi8Lj5Ov6hgjK03e2I0,43350
334
334
  metaflow/plugins/kubernetes/spot_metadata_cli.py,sha256=an0nWCxgflmqIPBCBrlb4m3DereDFFJBLt-KKhqcHc8,1670
335
335
  metaflow/plugins/kubernetes/spot_monitor_sidecar.py,sha256=zrWU-smQwPnL6MBHmzTxWyEA00R6iKKQbhhy50xFwQ8,3832
336
336
  metaflow/plugins/metadata_providers/__init__.py,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
@@ -357,7 +357,7 @@ metaflow/plugins/uv/bootstrap.py,sha256=1UmNnnR7I1YcOtjdAmhuiU23-vj7NimUk3C9Qill
357
357
  metaflow/plugins/uv/uv_environment.py,sha256=AYZICrBEq3Bv-taXktJwu9DhKFxNooPFwlcH379EYMs,2719
358
358
  metaflow/runner/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
359
359
  metaflow/runner/click_api.py,sha256=DSxa5A0C_IHNug7fZlLpD_N99F_skDcAjTRx5YRMylY,23756
360
- metaflow/runner/deployer.py,sha256=JwclsNiqnr0RsrA7-8a1-3Z23A4BDz4SNJubqDPxUuU,13955
360
+ metaflow/runner/deployer.py,sha256=OAAMG_l3Q1ClcY_603VZnhclVkfFe3Rf8bFRodC3poc,17138
361
361
  metaflow/runner/deployer_impl.py,sha256=zTING0_fwP44JcGo69DuNrVut5KqdBVzYOM7MYTZgIY,7049
362
362
  metaflow/runner/metaflow_runner.py,sha256=uo3BzcAfZ67VT_f-TPe5ZHiWHn6uuojWusOMGksvX14,18178
363
363
  metaflow/runner/nbdeploy.py,sha256=Sp5w-6nCZwjHaRBHWxi8udya-RYnJOB76KNLjB4L7Gs,4166
@@ -409,12 +409,12 @@ metaflow/user_decorators/mutable_flow.py,sha256=icF7XFCS5FdlW3OEL68ZbQOtTPhLsUyc
409
409
  metaflow/user_decorators/mutable_step.py,sha256=-BY0UDXf_RCAEnC5JlLzEXGdiw1KD9oSrSxS_SWaB9Y,16791
410
410
  metaflow/user_decorators/user_flow_decorator.py,sha256=2yDwZq9QGv9W-7kEuKwa8o4ZkTvuHJ5ESz7VVrGViAI,9890
411
411
  metaflow/user_decorators/user_step_decorator.py,sha256=JYNGXONWCpzwn-_bF5WiAkof4Ii9tRS4xdK8ojSxG6M,26007
412
- ob_metaflow-2.16.6.5rc2.data/data/share/metaflow/devtools/Makefile,sha256=5n89OGIC_kE4wxtEI66VCucN-b-1w5bqvGeZYmeRGz8,13737
413
- ob_metaflow-2.16.6.5rc2.data/data/share/metaflow/devtools/Tiltfile,sha256=3a5aujin8nrvh9yfRt-ZF8NK_jJCWff4XcNmWkuNDpU,22962
414
- ob_metaflow-2.16.6.5rc2.data/data/share/metaflow/devtools/pick_services.sh,sha256=PGjQeDIigFHeoQ0asmYNdYDPIOdeYy1UYvkw2wdN4zg,2209
415
- ob_metaflow-2.16.6.5rc2.dist-info/licenses/LICENSE,sha256=nl_Lt5v9VvJ-5lWJDT4ddKAG-VZ-2IaLmbzpgYDz2hU,11343
416
- ob_metaflow-2.16.6.5rc2.dist-info/METADATA,sha256=j3uiTsmp_UpbgSgYL-V9Fon9rnCwl_p9fQbAxa7YYFw,5941
417
- ob_metaflow-2.16.6.5rc2.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
418
- ob_metaflow-2.16.6.5rc2.dist-info/entry_points.txt,sha256=RvEq8VFlgGe_FfqGOZi0D7ze1hLD0pAtXeNyGfzc_Yc,103
419
- ob_metaflow-2.16.6.5rc2.dist-info/top_level.txt,sha256=v1pDHoWaSaKeuc5fKTRSfsXCKSdW1zvNVmvA-i0if3o,9
420
- ob_metaflow-2.16.6.5rc2.dist-info/RECORD,,
412
+ ob_metaflow-2.16.6.5rc3.data/data/share/metaflow/devtools/Makefile,sha256=5n89OGIC_kE4wxtEI66VCucN-b-1w5bqvGeZYmeRGz8,13737
413
+ ob_metaflow-2.16.6.5rc3.data/data/share/metaflow/devtools/Tiltfile,sha256=mGQGEDxj0wwk1cU2FbGxSBSvfEPvbpEWWabsFEilsR0,23915
414
+ ob_metaflow-2.16.6.5rc3.data/data/share/metaflow/devtools/pick_services.sh,sha256=PGjQeDIigFHeoQ0asmYNdYDPIOdeYy1UYvkw2wdN4zg,2209
415
+ ob_metaflow-2.16.6.5rc3.dist-info/licenses/LICENSE,sha256=nl_Lt5v9VvJ-5lWJDT4ddKAG-VZ-2IaLmbzpgYDz2hU,11343
416
+ ob_metaflow-2.16.6.5rc3.dist-info/METADATA,sha256=9AbjuWqa2JkCE1lauZmRogIPhchmPUfa01npsMcFjD0,5941
417
+ ob_metaflow-2.16.6.5rc3.dist-info/WHEEL,sha256=JNWh1Fm1UdwIQV075glCn4MVuCRs0sotJIq-J6rbxCU,109
418
+ ob_metaflow-2.16.6.5rc3.dist-info/entry_points.txt,sha256=RvEq8VFlgGe_FfqGOZi0D7ze1hLD0pAtXeNyGfzc_Yc,103
419
+ ob_metaflow-2.16.6.5rc3.dist-info/top_level.txt,sha256=v1pDHoWaSaKeuc5fKTRSfsXCKSdW1zvNVmvA-i0if3o,9
420
+ ob_metaflow-2.16.6.5rc3.dist-info/RECORD,,