ob-metaflow-stubs 6.0.3.104__py2.py3-none-any.whl → 6.0.3.105__py2.py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (140) hide show
  1. metaflow-stubs/__init__.pyi +888 -550
  2. metaflow-stubs/cards.pyi +210 -4
  3. metaflow-stubs/cli.pyi +22 -2
  4. metaflow-stubs/client/__init__.pyi +128 -3
  5. metaflow-stubs/client/core.pyi +226 -6
  6. metaflow-stubs/client/filecache.pyi +3 -3
  7. metaflow-stubs/clone_util.pyi +5 -2
  8. metaflow-stubs/events.pyi +21 -3
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +71 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +158 -5
  13. metaflow-stubs/info_file.pyi +2 -2
  14. metaflow-stubs/metadata/metadata.pyi +9 -3
  15. metaflow-stubs/metadata/util.pyi +2 -2
  16. metaflow-stubs/metaflow_config.pyi +2 -2
  17. metaflow-stubs/metaflow_current.pyi +69 -66
  18. metaflow-stubs/mflog/mflog.pyi +2 -2
  19. metaflow-stubs/multicore_utils.pyi +2 -2
  20. metaflow-stubs/parameters.pyi +69 -3
  21. metaflow-stubs/plugins/__init__.pyi +14 -3
  22. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  23. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  24. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +80 -2
  26. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +6 -3
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +46 -4
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +46 -4
  29. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  31. metaflow-stubs/plugins/argo/argo_events.pyi +16 -2
  32. metaflow-stubs/plugins/argo/argo_workflows.pyi +17 -4
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +97 -6
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +35 -7
  35. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +50 -5
  36. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  37. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  39. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +103 -3
  43. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +15 -3
  45. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  47. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +21 -2
  49. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +49 -4
  52. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  53. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  54. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  55. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +21 -3
  56. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  57. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  58. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  59. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  60. metaflow-stubs/plugins/cards/card_cli.pyi +62 -4
  61. metaflow-stubs/plugins/cards/card_client.pyi +34 -3
  62. metaflow-stubs/plugins/cards/card_creator.pyi +5 -2
  63. metaflow-stubs/plugins/cards/card_datastore.pyi +8 -2
  64. metaflow-stubs/plugins/cards/card_decorator.pyi +53 -3
  65. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +28 -2
  66. metaflow-stubs/plugins/cards/card_modules/basic.pyi +42 -3
  67. metaflow-stubs/plugins/cards/card_modules/card.pyi +28 -2
  68. metaflow-stubs/plugins/cards/card_modules/components.pyi +183 -3
  69. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +5 -2
  70. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +36 -3
  72. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  73. metaflow-stubs/plugins/cards/component_serializer.pyi +56 -3
  74. metaflow-stubs/plugins/cards/exception.pyi +8 -2
  75. metaflow-stubs/plugins/catch_decorator.pyi +20 -3
  76. metaflow-stubs/plugins/datatools/__init__.pyi +64 -4
  77. metaflow-stubs/plugins/datatools/local.pyi +16 -2
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +73 -4
  79. metaflow-stubs/plugins/datatools/s3/s3.pyi +82 -5
  80. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  82. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  83. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  84. metaflow-stubs/plugins/environment_decorator.pyi +10 -2
  85. metaflow-stubs/plugins/events_decorator.pyi +107 -3
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +25 -4
  88. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  89. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +15 -3
  90. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  91. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  92. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  94. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  96. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +11 -2
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +67 -4
  98. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +100 -3
  100. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +5 -2
  101. metaflow-stubs/plugins/logs_cli.pyi +3 -3
  102. metaflow-stubs/plugins/package_cli.pyi +2 -2
  103. metaflow-stubs/plugins/parallel_decorator.pyi +30 -3
  104. metaflow-stubs/plugins/perimeters.pyi +2 -2
  105. metaflow-stubs/plugins/project_decorator.pyi +60 -3
  106. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  107. metaflow-stubs/plugins/pypi/conda_decorator.pyi +45 -2
  108. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +33 -2
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  112. metaflow-stubs/plugins/resources_decorator.pyi +33 -2
  113. metaflow-stubs/plugins/retry_decorator.pyi +21 -2
  114. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  116. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +11 -2
  117. metaflow-stubs/plugins/storage_executor.pyi +6 -2
  118. metaflow-stubs/plugins/tag_cli.pyi +35 -4
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +10 -3
  120. metaflow-stubs/plugins/timeout_decorator.pyi +24 -3
  121. metaflow-stubs/procpoll.pyi +2 -2
  122. metaflow-stubs/profilers/__init__.pyi +2 -2
  123. metaflow-stubs/pylint_wrapper.pyi +2 -2
  124. metaflow-stubs/runner/__init__.pyi +2 -2
  125. metaflow-stubs/runner/deployer.pyi +70 -131
  126. metaflow-stubs/runner/metaflow_runner.pyi +117 -9
  127. metaflow-stubs/runner/nbdeploy.pyi +66 -2
  128. metaflow-stubs/runner/nbrun.pyi +79 -2
  129. metaflow-stubs/runner/subprocess_manager.pyi +16 -4
  130. metaflow-stubs/runner/utils.pyi +32 -2
  131. metaflow-stubs/system/__init__.pyi +3 -3
  132. metaflow-stubs/system/system_logger.pyi +2 -2
  133. metaflow-stubs/system/system_monitor.pyi +2 -2
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. {ob_metaflow_stubs-6.0.3.104.dist-info → ob_metaflow_stubs-6.0.3.105.dist-info}/METADATA +1 -1
  137. ob_metaflow_stubs-6.0.3.105.dist-info/RECORD +140 -0
  138. ob_metaflow_stubs-6.0.3.104.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.104.dist-info → ob_metaflow_stubs-6.0.3.105.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.104.dist-info → ob_metaflow_stubs-6.0.3.105.dist-info}/top_level.txt +0 -0
@@ -1,24 +1,24 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.22.1+obcheckpoint(0.0.11);ob(v1) #
4
- # Generated on 2024-09-20T21:46:07.326886 #
3
+ # MF version: 2.12.24.1+obcheckpoint(0.0.11);ob(v1) #
4
+ # Generated on 2024-10-04T10:13:10.624136 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow.client.core
12
- import metaflow._vendor.click.types
13
- import metaflow.runner.metaflow_runner
14
- import metaflow.parameters
15
- import metaflow.events
16
11
  import metaflow.metaflow_current
12
+ import typing
13
+ import metaflow.flowspec
17
14
  import datetime
18
- import metaflow.datastore.inputs
15
+ import metaflow.events
19
16
  import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
20
- import metaflow.flowspec
21
- import typing
17
+ import metaflow.datastore.inputs
18
+ import metaflow.parameters
19
+ import metaflow.runner.metaflow_runner
20
+ import metaflow.client.core
21
+ import metaflow._vendor.click.types
22
22
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
23
23
  StepFlag = typing.NewType("StepFlag", bool)
24
24
 
@@ -102,6 +102,14 @@ def metadata(ms: str) -> str:
102
102
  ...
103
103
 
104
104
  class FlowSpec(object, metaclass=metaflow.flowspec._FlowSpecMeta):
105
+ """
106
+ Main class from which all Flows should inherit.
107
+
108
+ Attributes
109
+ ----------
110
+ index
111
+ input
112
+ """
105
113
  def __init__(self, use_cli = True):
106
114
  """
107
115
  Construct a FlowSpec
@@ -323,6 +331,49 @@ class FlowSpec(object, metaclass=metaflow.flowspec._FlowSpecMeta):
323
331
  ...
324
332
 
325
333
  class Parameter(object, metaclass=type):
334
+ """
335
+ Defines a parameter for a flow.
336
+
337
+ Parameters must be instantiated as class variables in flow classes, e.g.
338
+ ```
339
+ class MyFlow(FlowSpec):
340
+ param = Parameter('myparam')
341
+ ```
342
+ in this case, the parameter is specified on the command line as
343
+ ```
344
+ python myflow.py run --myparam=5
345
+ ```
346
+ and its value is accessible through a read-only artifact like this:
347
+ ```
348
+ print(self.param == 5)
349
+ ```
350
+ Note that the user-visible parameter name, `myparam` above, can be
351
+ different from the artifact name, `param` above.
352
+
353
+ The parameter value is converted to a Python type based on the `type`
354
+ argument or to match the type of `default`, if it is set.
355
+
356
+ Parameters
357
+ ----------
358
+ name : str
359
+ User-visible parameter name.
360
+ default : str or float or int or bool or `JSONType` or a function.
361
+ Default value for the parameter. Use a special `JSONType` class to
362
+ indicate that the value must be a valid JSON object. A function
363
+ implies that the parameter corresponds to a *deploy-time parameter*.
364
+ The type of the default value is used as the parameter `type`.
365
+ type : Type, default None
366
+ If `default` is not specified, define the parameter type. Specify
367
+ one of `str`, `float`, `int`, `bool`, or `JSONType`. If None, defaults
368
+ to the type of `default` or `str` if none specified.
369
+ help : str, optional
370
+ Help text to show in `run --help`.
371
+ required : bool, default False
372
+ Require that the user specified a value for the parameter.
373
+ `required=True` implies that the `default` is not used.
374
+ show_default : bool, default True
375
+ If True, show the default value in the help text.
376
+ """
326
377
  def __init__(self, name: str, default: typing.Union[str, float, int, bool, typing.Dict[str, typing.Any], typing.Callable[[], typing.Union[str, float, int, bool, typing.Dict[str, typing.Any]]], None] = None, type: typing.Union[typing.Type[str], typing.Type[float], typing.Type[int], typing.Type[bool], metaflow.parameters.JSONTypeClass, None] = None, help: typing.Optional[str] = None, required: bool = False, show_default: bool = True, **kwargs: typing.Dict[str, typing.Any]):
327
378
  ...
328
379
  def __repr__(self):
@@ -355,6 +406,33 @@ def S3(*args, **kwargs):
355
406
  ...
356
407
 
357
408
  class IncludeFile(metaflow.parameters.Parameter, metaclass=type):
409
+ """
410
+ Includes a local file as a parameter for the flow.
411
+
412
+ `IncludeFile` behaves like `Parameter` except that it reads its value from a file instead of
413
+ the command line. The user provides a path to a file on the command line. The file contents
414
+ are saved as a read-only artifact which is available in all steps of the flow.
415
+
416
+ Parameters
417
+ ----------
418
+ name : str
419
+ User-visible parameter name.
420
+ default : Union[str, Callable[ParameterContext, str]]
421
+ Default path to a local file. A function
422
+ implies that the parameter corresponds to a *deploy-time parameter*.
423
+ is_text : bool, default True
424
+ Convert the file contents to a string using the provided `encoding`.
425
+ If False, the artifact is stored in `bytes`.
426
+ encoding : str, optional, default 'utf-8'
427
+ Use this encoding to decode the file contexts if `is_text=True`.
428
+ required : bool, default False
429
+ Require that the user specified a value for the parameter.
430
+ `required=True` implies that the `default` is not used.
431
+ help : str, optional
432
+ Help text to show in `run --help`.
433
+ show_default : bool, default True
434
+ If True, show the default value in the help text.
435
+ """
358
436
  def __init__(self, name: str, required: bool = False, is_text: bool = True, encoding: str = "utf-8", help: typing.Optional[str] = None, **kwargs: typing.Dict[str, str]):
359
437
  ...
360
438
  def load_parameter(self, v):
@@ -435,19 +513,51 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
435
513
  ...
436
514
 
437
515
  @typing.overload
438
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
516
+ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
439
517
  """
440
- Internal decorator to support Fast bakery
518
+ Specifies the PyPI packages for the step.
519
+
520
+ Information in this decorator will augment any
521
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
522
+ you can use `@pypi_base` to set packages required by all
523
+ steps and use `@pypi` to specify step-specific overrides.
524
+
525
+ Parameters
526
+ ----------
527
+ packages : Dict[str, str], default: {}
528
+ Packages to use for this step. The key is the name of the package
529
+ and the value is the version to use.
530
+ python : str, optional, default: None
531
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
532
+ that the version used will correspond to the version of the Python interpreter used to start the run.
441
533
  """
442
534
  ...
443
535
 
444
536
  @typing.overload
445
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
537
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
446
538
  ...
447
539
 
448
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
540
+ @typing.overload
541
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
542
+ ...
543
+
544
+ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
449
545
  """
450
- Internal decorator to support Fast bakery
546
+ Specifies the PyPI packages for the step.
547
+
548
+ Information in this decorator will augment any
549
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
550
+ you can use `@pypi_base` to set packages required by all
551
+ steps and use `@pypi` to specify step-specific overrides.
552
+
553
+ Parameters
554
+ ----------
555
+ packages : Dict[str, str], default: {}
556
+ Packages to use for this step. The key is the name of the package
557
+ and the value is the version to use.
558
+ python : str, optional, default: None
559
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
560
+ that the version used will correspond to the version of the Python interpreter used to start the run.
451
561
  """
452
562
  ...
453
563
 
@@ -508,149 +618,6 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
508
618
  """
509
619
  ...
510
620
 
511
- @typing.overload
512
- def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
513
- """
514
- Specifies that the step will success under all circumstances.
515
-
516
- The decorator will create an optional artifact, specified by `var`, which
517
- contains the exception raised. You can use it to detect the presence
518
- of errors, indicating that all happy-path artifacts produced by the step
519
- are missing.
520
-
521
- Parameters
522
- ----------
523
- var : str, optional, default None
524
- Name of the artifact in which to store the caught exception.
525
- If not specified, the exception is not stored.
526
- print_exception : bool, default True
527
- Determines whether or not the exception is printed to
528
- stdout when caught.
529
- """
530
- ...
531
-
532
- @typing.overload
533
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
534
- ...
535
-
536
- @typing.overload
537
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
538
- ...
539
-
540
- def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
541
- """
542
- Specifies that the step will success under all circumstances.
543
-
544
- The decorator will create an optional artifact, specified by `var`, which
545
- contains the exception raised. You can use it to detect the presence
546
- of errors, indicating that all happy-path artifacts produced by the step
547
- are missing.
548
-
549
- Parameters
550
- ----------
551
- var : str, optional, default None
552
- Name of the artifact in which to store the caught exception.
553
- If not specified, the exception is not stored.
554
- print_exception : bool, default True
555
- Determines whether or not the exception is printed to
556
- stdout when caught.
557
- """
558
- ...
559
-
560
- @typing.overload
561
- def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
562
- """
563
- Specifies secrets to be retrieved and injected as environment variables prior to
564
- the execution of a step.
565
-
566
- Parameters
567
- ----------
568
- sources : List[Union[str, Dict[str, Any]]], default: []
569
- List of secret specs, defining how the secrets are to be retrieved
570
- """
571
- ...
572
-
573
- @typing.overload
574
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
575
- ...
576
-
577
- @typing.overload
578
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
579
- ...
580
-
581
- def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
582
- """
583
- Specifies secrets to be retrieved and injected as environment variables prior to
584
- the execution of a step.
585
-
586
- Parameters
587
- ----------
588
- sources : List[Union[str, Dict[str, Any]]], default: []
589
- List of secret specs, defining how the secrets are to be retrieved
590
- """
591
- ...
592
-
593
- @typing.overload
594
- def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
595
- """
596
- Enables loading / saving of models within a step.
597
-
598
-
599
- Parameters
600
- ----------
601
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
602
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
603
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
604
- - `current.checkpoint`
605
- - `current.model`
606
- - `current.huggingface_hub`
607
-
608
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
609
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
610
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
611
-
612
- temp_dir_root : str, default: None
613
- The root directory under which `current.model.loaded` will store loaded models
614
-
615
-
616
-
617
- """
618
- ...
619
-
620
- @typing.overload
621
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
622
- ...
623
-
624
- @typing.overload
625
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
626
- ...
627
-
628
- def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
629
- """
630
- Enables loading / saving of models within a step.
631
-
632
-
633
- Parameters
634
- ----------
635
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
636
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
637
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
638
- - `current.checkpoint`
639
- - `current.model`
640
- - `current.huggingface_hub`
641
-
642
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
643
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
644
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
645
-
646
- temp_dir_root : str, default: None
647
- The root directory under which `current.model.loaded` will store loaded models
648
-
649
-
650
-
651
- """
652
- ...
653
-
654
621
  @typing.overload
655
622
  def card(*, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
656
623
  """
@@ -703,81 +670,32 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
703
670
  ...
704
671
 
705
672
  @typing.overload
706
- def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
673
+ def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
707
674
  """
708
- Specifies the PyPI packages for the step.
675
+ Specifies a timeout for your step.
709
676
 
710
- Information in this decorator will augment any
711
- attributes set in the `@pyi_base` flow-level decorator. Hence,
712
- you can use `@pypi_base` to set packages required by all
713
- steps and use `@pypi` to specify step-specific overrides.
677
+ This decorator is useful if this step may hang indefinitely.
678
+
679
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
680
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
681
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
682
+
683
+ Note that all the values specified in parameters are added together so if you specify
684
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
714
685
 
715
686
  Parameters
716
687
  ----------
717
- packages : Dict[str, str], default: {}
718
- Packages to use for this step. The key is the name of the package
719
- and the value is the version to use.
720
- python : str, optional, default: None
721
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
722
- that the version used will correspond to the version of the Python interpreter used to start the run.
688
+ seconds : int, default 0
689
+ Number of seconds to wait prior to timing out.
690
+ minutes : int, default 0
691
+ Number of minutes to wait prior to timing out.
692
+ hours : int, default 0
693
+ Number of hours to wait prior to timing out.
723
694
  """
724
695
  ...
725
696
 
726
697
  @typing.overload
727
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
728
- ...
729
-
730
- @typing.overload
731
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
732
- ...
733
-
734
- def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
735
- """
736
- Specifies the PyPI packages for the step.
737
-
738
- Information in this decorator will augment any
739
- attributes set in the `@pyi_base` flow-level decorator. Hence,
740
- you can use `@pypi_base` to set packages required by all
741
- steps and use `@pypi` to specify step-specific overrides.
742
-
743
- Parameters
744
- ----------
745
- packages : Dict[str, str], default: {}
746
- Packages to use for this step. The key is the name of the package
747
- and the value is the version to use.
748
- python : str, optional, default: None
749
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
750
- that the version used will correspond to the version of the Python interpreter used to start the run.
751
- """
752
- ...
753
-
754
- @typing.overload
755
- def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
756
- """
757
- Specifies a timeout for your step.
758
-
759
- This decorator is useful if this step may hang indefinitely.
760
-
761
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
762
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
763
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
764
-
765
- Note that all the values specified in parameters are added together so if you specify
766
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
767
-
768
- Parameters
769
- ----------
770
- seconds : int, default 0
771
- Number of seconds to wait prior to timing out.
772
- minutes : int, default 0
773
- Number of minutes to wait prior to timing out.
774
- hours : int, default 0
775
- Number of hours to wait prior to timing out.
776
- """
777
- ...
778
-
779
- @typing.overload
780
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
698
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
781
699
  ...
782
700
 
783
701
  @typing.overload
@@ -808,114 +726,69 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
808
726
  """
809
727
  ...
810
728
 
811
- @typing.overload
812
- def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
813
- """
814
- Specifies environment variables to be set prior to the execution of a step.
815
-
816
- Parameters
817
- ----------
818
- vars : Dict[str, str], default {}
819
- Dictionary of environment variables to set.
820
- """
821
- ...
822
-
823
- @typing.overload
824
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
825
- ...
826
-
827
- @typing.overload
828
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
829
- ...
830
-
831
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
832
- """
833
- Specifies environment variables to be set prior to the execution of a step.
834
-
835
- Parameters
836
- ----------
837
- vars : Dict[str, str], default {}
838
- Dictionary of environment variables to set.
839
- """
840
- ...
841
-
842
- @typing.overload
843
- def checkpoint(*, load_policy: str = "fresh", temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
844
- """
845
- Enables checkpointing for a step.
846
-
847
-
848
- Parameters
849
- ----------
850
- load_policy : str, default: "fresh"
851
- The policy for loading the checkpoint. The following policies are supported:
852
- - "eager": Loads the the latest available checkpoint within the namespace.
853
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
854
- will be loaded at the start of the task.
855
- - "none": Do not load any checkpoint
856
- - "fresh": Loads the lastest checkpoint created within the running Task.
857
- This mode helps loading checkpoints across various retry attempts of the same task.
858
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
859
- created within the task will be loaded when the task is retries execution on failure.
860
-
861
- temp_dir_root : str, default: None
862
- The root directory under which `current.checkpoint.directory` will be created.
863
-
864
-
865
-
866
- """
867
- ...
868
-
869
- @typing.overload
870
- def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
871
- ...
872
-
873
- @typing.overload
874
- def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
875
- ...
876
-
877
- def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
729
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
878
730
  """
879
- Enables checkpointing for a step.
880
-
731
+ Specifies that this step should execute on Kubernetes.
881
732
 
882
733
  Parameters
883
734
  ----------
884
- load_policy : str, default: "fresh"
885
- The policy for loading the checkpoint. The following policies are supported:
886
- - "eager": Loads the the latest available checkpoint within the namespace.
887
- With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
888
- will be loaded at the start of the task.
889
- - "none": Do not load any checkpoint
890
- - "fresh": Loads the lastest checkpoint created within the running Task.
891
- This mode helps loading checkpoints across various retry attempts of the same task.
892
- With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
893
- created within the task will be loaded when the task is retries execution on failure.
894
-
895
- temp_dir_root : str, default: None
896
- The root directory under which `current.checkpoint.directory` will be created.
897
-
898
-
899
-
900
- """
901
- ...
902
-
903
- @typing.overload
904
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
905
- """
906
- Decorator prototype for all step decorators. This function gets specialized
907
- and imported for all decorators types by _import_plugin_decorators().
908
- """
909
- ...
910
-
911
- @typing.overload
912
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
913
- ...
914
-
915
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
916
- """
917
- Decorator prototype for all step decorators. This function gets specialized
918
- and imported for all decorators types by _import_plugin_decorators().
735
+ cpu : int, default 1
736
+ Number of CPUs required for this step. If `@resources` is
737
+ also present, the maximum value from all decorators is used.
738
+ memory : int, default 4096
739
+ Memory size (in MB) required for this step. If
740
+ `@resources` is also present, the maximum value from all decorators is
741
+ used.
742
+ disk : int, default 10240
743
+ Disk size (in MB) required for this step. If
744
+ `@resources` is also present, the maximum value from all decorators is
745
+ used.
746
+ image : str, optional, default None
747
+ Docker image to use when launching on Kubernetes. If not specified, and
748
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
749
+ not, a default Docker image mapping to the current version of Python is used.
750
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
751
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
752
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
753
+ Kubernetes service account to use when launching pod in Kubernetes.
754
+ secrets : List[str], optional, default None
755
+ Kubernetes secrets to use when launching pod in Kubernetes. These
756
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
757
+ in Metaflow configuration.
758
+ node_selector: Union[Dict[str,str], str], optional, default None
759
+ Kubernetes node selector(s) to apply to the pod running the task.
760
+ Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
761
+ or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
762
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
763
+ Kubernetes namespace to use when launching pod in Kubernetes.
764
+ gpu : int, optional, default None
765
+ Number of GPUs required for this step. A value of zero implies that
766
+ the scheduled node should not have GPUs.
767
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
768
+ The vendor of the GPUs to be used for this step.
769
+ tolerations : List[str], default []
770
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
771
+ Kubernetes tolerations to use when launching pod in Kubernetes.
772
+ use_tmpfs : bool, default False
773
+ This enables an explicit tmpfs mount for this step.
774
+ tmpfs_tempdir : bool, default True
775
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
776
+ tmpfs_size : int, optional, default: None
777
+ The value for the size (in MiB) of the tmpfs mount for this step.
778
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
779
+ memory allocated for this step.
780
+ tmpfs_path : str, optional, default /metaflow_temp
781
+ Path to tmpfs mount for this step.
782
+ persistent_volume_claims : Dict[str, str], optional, default None
783
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
784
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
785
+ shared_memory: int, optional
786
+ Shared memory size (in MiB) required for this step
787
+ port: int, optional
788
+ Port number to specify in the Kubernetes job object
789
+ compute_pool : str, optional, default None
790
+ Compute pool to be used for for this step.
791
+ If not specified, any accessible compute pool within the perimeter is used.
919
792
  """
920
793
  ...
921
794
 
@@ -1049,230 +922,274 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
1049
922
  """
1050
923
  ...
1051
924
 
1052
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = "KUBERNETES_IMAGE_PULL_POLICY", service_account: str = "METAFLOW_KUBERNETES_SERVICE_ACCOUNT", secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = "METAFLOW_KUBERNETES_NAMESPACE", gpu: typing.Optional[int] = None, gpu_vendor: str = "KUBERNETES_GPU_VENDOR", tolerations: typing.List[str] = [], use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = "/metaflow_temp", persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
925
+ @typing.overload
926
+ def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1053
927
  """
1054
- Specifies that this step should execute on Kubernetes.
928
+ Specifies that the step will success under all circumstances.
929
+
930
+ The decorator will create an optional artifact, specified by `var`, which
931
+ contains the exception raised. You can use it to detect the presence
932
+ of errors, indicating that all happy-path artifacts produced by the step
933
+ are missing.
1055
934
 
1056
935
  Parameters
1057
936
  ----------
1058
- cpu : int, default 1
1059
- Number of CPUs required for this step. If `@resources` is
1060
- also present, the maximum value from all decorators is used.
1061
- memory : int, default 4096
1062
- Memory size (in MB) required for this step. If
1063
- `@resources` is also present, the maximum value from all decorators is
1064
- used.
1065
- disk : int, default 10240
1066
- Disk size (in MB) required for this step. If
1067
- `@resources` is also present, the maximum value from all decorators is
1068
- used.
1069
- image : str, optional, default None
1070
- Docker image to use when launching on Kubernetes. If not specified, and
1071
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1072
- not, a default Docker image mapping to the current version of Python is used.
1073
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1074
- If given, the imagePullPolicy to be applied to the Docker image of the step.
1075
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1076
- Kubernetes service account to use when launching pod in Kubernetes.
1077
- secrets : List[str], optional, default None
1078
- Kubernetes secrets to use when launching pod in Kubernetes. These
1079
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1080
- in Metaflow configuration.
1081
- node_selector: Union[Dict[str,str], str], optional, default None
1082
- Kubernetes node selector(s) to apply to the pod running the task.
1083
- Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
1084
- or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
1085
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1086
- Kubernetes namespace to use when launching pod in Kubernetes.
1087
- gpu : int, optional, default None
1088
- Number of GPUs required for this step. A value of zero implies that
1089
- the scheduled node should not have GPUs.
1090
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1091
- The vendor of the GPUs to be used for this step.
1092
- tolerations : List[str], default []
1093
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1094
- Kubernetes tolerations to use when launching pod in Kubernetes.
1095
- use_tmpfs : bool, default False
1096
- This enables an explicit tmpfs mount for this step.
1097
- tmpfs_tempdir : bool, default True
1098
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1099
- tmpfs_size : int, optional, default: None
1100
- The value for the size (in MiB) of the tmpfs mount for this step.
1101
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1102
- memory allocated for this step.
1103
- tmpfs_path : str, optional, default /metaflow_temp
1104
- Path to tmpfs mount for this step.
1105
- persistent_volume_claims : Dict[str, str], optional, default None
1106
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1107
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1108
- shared_memory: int, optional
1109
- Shared memory size (in MiB) required for this step
1110
- port: int, optional
1111
- Port number to specify in the Kubernetes job object
1112
- compute_pool : str, optional, default None
1113
- Compute pool to be used for for this step.
1114
- If not specified, any accessible compute pool within the perimeter is used.
937
+ var : str, optional, default None
938
+ Name of the artifact in which to store the caught exception.
939
+ If not specified, the exception is not stored.
940
+ print_exception : bool, default True
941
+ Determines whether or not the exception is printed to
942
+ stdout when caught.
1115
943
  """
1116
944
  ...
1117
945
 
1118
946
  @typing.overload
1119
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
947
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
948
+ ...
949
+
950
+ @typing.overload
951
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
952
+ ...
953
+
954
+ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
1120
955
  """
1121
- Specifies the PyPI packages for all steps of the flow.
956
+ Specifies that the step will success under all circumstances.
957
+
958
+ The decorator will create an optional artifact, specified by `var`, which
959
+ contains the exception raised. You can use it to detect the presence
960
+ of errors, indicating that all happy-path artifacts produced by the step
961
+ are missing.
1122
962
 
1123
- Use `@pypi_base` to set common packages required by all
1124
- steps and use `@pypi` to specify step-specific overrides.
1125
963
  Parameters
1126
964
  ----------
1127
- packages : Dict[str, str], default: {}
1128
- Packages to use for this flow. The key is the name of the package
1129
- and the value is the version to use.
1130
- python : str, optional, default: None
1131
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1132
- that the version used will correspond to the version of the Python interpreter used to start the run.
965
+ var : str, optional, default None
966
+ Name of the artifact in which to store the caught exception.
967
+ If not specified, the exception is not stored.
968
+ print_exception : bool, default True
969
+ Determines whether or not the exception is printed to
970
+ stdout when caught.
1133
971
  """
1134
972
  ...
1135
973
 
1136
974
  @typing.overload
1137
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
975
+ def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
976
+ """
977
+ Specifies environment variables to be set prior to the execution of a step.
978
+
979
+ Parameters
980
+ ----------
981
+ vars : Dict[str, str], default {}
982
+ Dictionary of environment variables to set.
983
+ """
1138
984
  ...
1139
985
 
1140
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
986
+ @typing.overload
987
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
988
+ ...
989
+
990
+ @typing.overload
991
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
992
+ ...
993
+
994
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1141
995
  """
1142
- Specifies the PyPI packages for all steps of the flow.
996
+ Specifies environment variables to be set prior to the execution of a step.
1143
997
 
1144
- Use `@pypi_base` to set common packages required by all
1145
- steps and use `@pypi` to specify step-specific overrides.
1146
998
  Parameters
1147
999
  ----------
1148
- packages : Dict[str, str], default: {}
1149
- Packages to use for this flow. The key is the name of the package
1150
- and the value is the version to use.
1151
- python : str, optional, default: None
1152
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1153
- that the version used will correspond to the version of the Python interpreter used to start the run.
1000
+ vars : Dict[str, str], default {}
1001
+ Dictionary of environment variables to set.
1154
1002
  """
1155
1003
  ...
1156
1004
 
1157
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1005
+ @typing.overload
1006
+ def checkpoint(*, load_policy: str = "fresh", temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1158
1007
  """
1159
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1008
+ Enables checkpointing for a step.
1160
1009
 
1161
- User code call
1162
- -----------
1163
- @nim(
1164
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1165
- backend='managed'
1166
- )
1167
1010
 
1168
- Valid backend options
1169
- ---------------------
1170
- - 'managed': Outerbounds selects a compute provider based on the model.
1171
- - 🚧 'dataplane': Run in your account.
1011
+ Parameters
1012
+ ----------
1013
+ load_policy : str, default: "fresh"
1014
+ The policy for loading the checkpoint. The following policies are supported:
1015
+ - "eager": Loads the the latest available checkpoint within the namespace.
1016
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1017
+ will be loaded at the start of the task.
1018
+ - "none": Do not load any checkpoint
1019
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1020
+ This mode helps loading checkpoints across various retry attempts of the same task.
1021
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1022
+ created within the task will be loaded when the task is retries execution on failure.
1023
+
1024
+ temp_dir_root : str, default: None
1025
+ The root directory under which `current.checkpoint.directory` will be created.
1026
+
1027
+
1028
+
1029
+ """
1030
+ ...
1031
+
1032
+ @typing.overload
1033
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1034
+ ...
1035
+
1036
+ @typing.overload
1037
+ def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1038
+ ...
1039
+
1040
+ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = "fresh", temp_dir_root: str = None):
1041
+ """
1042
+ Enables checkpointing for a step.
1172
1043
 
1173
- Valid model options
1174
- ----------------
1175
- - 'meta/llama3-8b-instruct': 8B parameter model
1176
- - 'meta/llama3-70b-instruct': 70B parameter model
1177
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1178
1044
 
1179
1045
  Parameters
1180
1046
  ----------
1181
- models: list[NIM]
1182
- List of NIM containers running models in sidecars.
1183
- backend: str
1184
- Compute provider to run the NIM container.
1047
+ load_policy : str, default: "fresh"
1048
+ The policy for loading the checkpoint. The following policies are supported:
1049
+ - "eager": Loads the the latest available checkpoint within the namespace.
1050
+ With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
1051
+ will be loaded at the start of the task.
1052
+ - "none": Do not load any checkpoint
1053
+ - "fresh": Loads the lastest checkpoint created within the running Task.
1054
+ This mode helps loading checkpoints across various retry attempts of the same task.
1055
+ With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
1056
+ created within the task will be loaded when the task is retries execution on failure.
1057
+
1058
+ temp_dir_root : str, default: None
1059
+ The root directory under which `current.checkpoint.directory` will be created.
1060
+
1061
+
1062
+
1185
1063
  """
1186
1064
  ...
1187
1065
 
1188
- def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1066
+ @typing.overload
1067
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1189
1068
  """
1190
- The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1191
- This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1069
+ Internal decorator to support Fast bakery
1070
+ """
1071
+ ...
1072
+
1073
+ @typing.overload
1074
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1075
+ ...
1076
+
1077
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1078
+ """
1079
+ Internal decorator to support Fast bakery
1080
+ """
1081
+ ...
1082
+
1083
+ @typing.overload
1084
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1085
+ """
1086
+ Enables loading / saving of models within a step.
1087
+
1192
1088
 
1193
1089
  Parameters
1194
1090
  ----------
1195
- timeout : int
1196
- Time, in seconds before the task times out and fails. (Default: 3600)
1197
- poke_interval : int
1198
- Time in seconds that the job should wait in between each try. (Default: 60)
1199
- mode : str
1200
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1201
- exponential_backoff : bool
1202
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1203
- pool : str
1204
- the slot pool this task should run in,
1205
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1206
- soft_fail : bool
1207
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1208
- name : str
1209
- Name of the sensor on Airflow
1210
- description : str
1211
- Description of sensor in the Airflow UI
1212
- external_dag_id : str
1213
- The dag_id that contains the task you want to wait for.
1214
- external_task_ids : List[str]
1215
- The list of task_ids that you want to wait for.
1216
- If None (default value) the sensor waits for the DAG. (Default: None)
1217
- allowed_states : List[str]
1218
- Iterable of allowed states, (Default: ['success'])
1219
- failed_states : List[str]
1220
- Iterable of failed or dis-allowed states. (Default: None)
1221
- execution_delta : datetime.timedelta
1222
- time difference with the previous execution to look at,
1223
- the default is the same logical date as the current task or DAG. (Default: None)
1224
- check_existence: bool
1225
- Set to True to check if the external task exists or check if
1226
- the DAG to wait for exists. (Default: True)
1091
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1092
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1093
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1094
+ - `current.checkpoint`
1095
+ - `current.model`
1096
+ - `current.huggingface_hub`
1097
+
1098
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
1099
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1100
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1101
+
1102
+ temp_dir_root : str, default: None
1103
+ The root directory under which `current.model.loaded` will store loaded models
1104
+
1105
+
1106
+
1227
1107
  """
1228
1108
  ...
1229
1109
 
1230
1110
  @typing.overload
1231
- def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1111
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1112
+ ...
1113
+
1114
+ @typing.overload
1115
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1116
+ ...
1117
+
1118
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
1232
1119
  """
1233
- Specifies the Conda environment for all steps of the flow.
1120
+ Enables loading / saving of models within a step.
1234
1121
 
1235
- Use `@conda_base` to set common libraries required by all
1236
- steps and use `@conda` to specify step-specific additions.
1237
1122
 
1238
1123
  Parameters
1239
1124
  ----------
1240
- packages : Dict[str, str], default {}
1241
- Packages to use for this flow. The key is the name of the package
1242
- and the value is the version to use.
1243
- libraries : Dict[str, str], default {}
1244
- Supported for backward compatibility. When used with packages, packages will take precedence.
1245
- python : str, optional, default None
1246
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1247
- that the version used will correspond to the version of the Python interpreter used to start the run.
1248
- disabled : bool, default False
1249
- If set to True, disables Conda.
1125
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
1126
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
1127
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
1128
+ - `current.checkpoint`
1129
+ - `current.model`
1130
+ - `current.huggingface_hub`
1131
+
1132
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
1133
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
1134
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
1135
+
1136
+ temp_dir_root : str, default: None
1137
+ The root directory under which `current.model.loaded` will store loaded models
1138
+
1139
+
1140
+
1250
1141
  """
1251
1142
  ...
1252
1143
 
1253
1144
  @typing.overload
1254
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1145
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1146
+ """
1147
+ Decorator prototype for all step decorators. This function gets specialized
1148
+ and imported for all decorators types by _import_plugin_decorators().
1149
+ """
1255
1150
  ...
1256
1151
 
1257
- def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1152
+ @typing.overload
1153
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1154
+ ...
1155
+
1156
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1258
1157
  """
1259
- Specifies the Conda environment for all steps of the flow.
1158
+ Decorator prototype for all step decorators. This function gets specialized
1159
+ and imported for all decorators types by _import_plugin_decorators().
1160
+ """
1161
+ ...
1162
+
1163
+ @typing.overload
1164
+ def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
1165
+ """
1166
+ Specifies secrets to be retrieved and injected as environment variables prior to
1167
+ the execution of a step.
1260
1168
 
1261
- Use `@conda_base` to set common libraries required by all
1262
- steps and use `@conda` to specify step-specific additions.
1169
+ Parameters
1170
+ ----------
1171
+ sources : List[Union[str, Dict[str, Any]]], default: []
1172
+ List of secret specs, defining how the secrets are to be retrieved
1173
+ """
1174
+ ...
1175
+
1176
+ @typing.overload
1177
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1178
+ ...
1179
+
1180
+ @typing.overload
1181
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1182
+ ...
1183
+
1184
+ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
1185
+ """
1186
+ Specifies secrets to be retrieved and injected as environment variables prior to
1187
+ the execution of a step.
1263
1188
 
1264
1189
  Parameters
1265
1190
  ----------
1266
- packages : Dict[str, str], default {}
1267
- Packages to use for this flow. The key is the name of the package
1268
- and the value is the version to use.
1269
- libraries : Dict[str, str], default {}
1270
- Supported for backward compatibility. When used with packages, packages will take precedence.
1271
- python : str, optional, default None
1272
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1273
- that the version used will correspond to the version of the Python interpreter used to start the run.
1274
- disabled : bool, default False
1275
- If set to True, disables Conda.
1191
+ sources : List[Union[str, Dict[str, Any]]], default: []
1192
+ List of secret specs, defining how the secrets are to be retrieved
1276
1193
  """
1277
1194
  ...
1278
1195
 
@@ -1360,14 +1277,87 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1360
1277
 
1361
1278
  Parameters
1362
1279
  ----------
1363
- event : Union[str, Dict[str, Any]], optional, default None
1364
- Event dependency for this flow.
1365
- events : List[Union[str, Dict[str, Any]]], default []
1366
- Events dependency for this flow.
1367
- options : Dict[str, Any], default {}
1368
- Backend-specific configuration for tuning eventing behavior.
1369
-
1370
-
1280
+ event : Union[str, Dict[str, Any]], optional, default None
1281
+ Event dependency for this flow.
1282
+ events : List[Union[str, Dict[str, Any]]], default []
1283
+ Events dependency for this flow.
1284
+ options : Dict[str, Any], default {}
1285
+ Backend-specific configuration for tuning eventing behavior.
1286
+
1287
+
1288
+ """
1289
+ ...
1290
+
1291
+ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1292
+ """
1293
+ The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1294
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1295
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1296
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1297
+ starts only after all sensors finish.
1298
+
1299
+ Parameters
1300
+ ----------
1301
+ timeout : int
1302
+ Time, in seconds before the task times out and fails. (Default: 3600)
1303
+ poke_interval : int
1304
+ Time in seconds that the job should wait in between each try. (Default: 60)
1305
+ mode : str
1306
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1307
+ exponential_backoff : bool
1308
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1309
+ pool : str
1310
+ the slot pool this task should run in,
1311
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1312
+ soft_fail : bool
1313
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1314
+ name : str
1315
+ Name of the sensor on Airflow
1316
+ description : str
1317
+ Description of sensor in the Airflow UI
1318
+ bucket_key : Union[str, List[str]]
1319
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1320
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1321
+ bucket_name : str
1322
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1323
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1324
+ wildcard_match : bool
1325
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1326
+ aws_conn_id : str
1327
+ a reference to the s3 connection on Airflow. (Default: None)
1328
+ verify : bool
1329
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1330
+ """
1331
+ ...
1332
+
1333
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1334
+ """
1335
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1336
+
1337
+ User code call
1338
+ -----------
1339
+ @nim(
1340
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1341
+ backend='managed'
1342
+ )
1343
+
1344
+ Valid backend options
1345
+ ---------------------
1346
+ - 'managed': Outerbounds selects a compute provider based on the model.
1347
+ - 🚧 'dataplane': Run in your account.
1348
+
1349
+ Valid model options
1350
+ ----------------
1351
+ - 'meta/llama3-8b-instruct': 8B parameter model
1352
+ - 'meta/llama3-70b-instruct': 70B parameter model
1353
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1354
+
1355
+ Parameters
1356
+ ----------
1357
+ models: list[NIM]
1358
+ List of NIM containers running models in sidecars.
1359
+ backend: str
1360
+ Compute provider to run the NIM container.
1371
1361
  """
1372
1362
  ...
1373
1363
 
@@ -1390,61 +1380,58 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
1390
1380
  ...
1391
1381
 
1392
1382
  @typing.overload
1393
- def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1383
+ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1394
1384
  """
1395
- Specifies the times when the flow should be run when running on a
1396
- production scheduler.
1385
+ Specifies the Conda environment for all steps of the flow.
1386
+
1387
+ Use `@conda_base` to set common libraries required by all
1388
+ steps and use `@conda` to specify step-specific additions.
1397
1389
 
1398
1390
  Parameters
1399
1391
  ----------
1400
- hourly : bool, default False
1401
- Run the workflow hourly.
1402
- daily : bool, default True
1403
- Run the workflow daily.
1404
- weekly : bool, default False
1405
- Run the workflow weekly.
1406
- cron : str, optional, default None
1407
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1408
- specified by this expression.
1409
- timezone : str, optional, default None
1410
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1411
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1392
+ packages : Dict[str, str], default {}
1393
+ Packages to use for this flow. The key is the name of the package
1394
+ and the value is the version to use.
1395
+ libraries : Dict[str, str], default {}
1396
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1397
+ python : str, optional, default None
1398
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1399
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1400
+ disabled : bool, default False
1401
+ If set to True, disables Conda.
1412
1402
  """
1413
1403
  ...
1414
1404
 
1415
1405
  @typing.overload
1416
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1406
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1417
1407
  ...
1418
1408
 
1419
- def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1409
+ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1420
1410
  """
1421
- Specifies the times when the flow should be run when running on a
1422
- production scheduler.
1411
+ Specifies the Conda environment for all steps of the flow.
1412
+
1413
+ Use `@conda_base` to set common libraries required by all
1414
+ steps and use `@conda` to specify step-specific additions.
1423
1415
 
1424
1416
  Parameters
1425
1417
  ----------
1426
- hourly : bool, default False
1427
- Run the workflow hourly.
1428
- daily : bool, default True
1429
- Run the workflow daily.
1430
- weekly : bool, default False
1431
- Run the workflow weekly.
1432
- cron : str, optional, default None
1433
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1434
- specified by this expression.
1435
- timezone : str, optional, default None
1436
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1437
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1418
+ packages : Dict[str, str], default {}
1419
+ Packages to use for this flow. The key is the name of the package
1420
+ and the value is the version to use.
1421
+ libraries : Dict[str, str], default {}
1422
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1423
+ python : str, optional, default None
1424
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1425
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1426
+ disabled : bool, default False
1427
+ If set to True, disables Conda.
1438
1428
  """
1439
1429
  ...
1440
1430
 
1441
- def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1431
+ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1442
1432
  """
1443
- The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
1444
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1445
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1446
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1447
- starts only after all sensors finish.
1433
+ The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
1434
+ This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
1448
1435
 
1449
1436
  Parameters
1450
1437
  ----------
@@ -1465,18 +1452,21 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1465
1452
  Name of the sensor on Airflow
1466
1453
  description : str
1467
1454
  Description of sensor in the Airflow UI
1468
- bucket_key : Union[str, List[str]]
1469
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1470
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1471
- bucket_name : str
1472
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1473
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1474
- wildcard_match : bool
1475
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1476
- aws_conn_id : str
1477
- a reference to the s3 connection on Airflow. (Default: None)
1478
- verify : bool
1479
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1455
+ external_dag_id : str
1456
+ The dag_id that contains the task you want to wait for.
1457
+ external_task_ids : List[str]
1458
+ The list of task_ids that you want to wait for.
1459
+ If None (default value) the sensor waits for the DAG. (Default: None)
1460
+ allowed_states : List[str]
1461
+ Iterable of allowed states, (Default: ['success'])
1462
+ failed_states : List[str]
1463
+ Iterable of failed or dis-allowed states. (Default: None)
1464
+ execution_delta : datetime.timedelta
1465
+ time difference with the previous execution to look at,
1466
+ the default is the same logical date as the current task or DAG. (Default: None)
1467
+ check_existence: bool
1468
+ Set to True to check if the external task exists or check if
1469
+ the DAG to wait for exists. (Default: True)
1480
1470
  """
1481
1471
  ...
1482
1472
 
@@ -1583,6 +1573,94 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1583
1573
  """
1584
1574
  ...
1585
1575
 
1576
+ @typing.overload
1577
+ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1578
+ """
1579
+ Specifies the times when the flow should be run when running on a
1580
+ production scheduler.
1581
+
1582
+ Parameters
1583
+ ----------
1584
+ hourly : bool, default False
1585
+ Run the workflow hourly.
1586
+ daily : bool, default True
1587
+ Run the workflow daily.
1588
+ weekly : bool, default False
1589
+ Run the workflow weekly.
1590
+ cron : str, optional, default None
1591
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1592
+ specified by this expression.
1593
+ timezone : str, optional, default None
1594
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1595
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1596
+ """
1597
+ ...
1598
+
1599
+ @typing.overload
1600
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1601
+ ...
1602
+
1603
+ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
1604
+ """
1605
+ Specifies the times when the flow should be run when running on a
1606
+ production scheduler.
1607
+
1608
+ Parameters
1609
+ ----------
1610
+ hourly : bool, default False
1611
+ Run the workflow hourly.
1612
+ daily : bool, default True
1613
+ Run the workflow daily.
1614
+ weekly : bool, default False
1615
+ Run the workflow weekly.
1616
+ cron : str, optional, default None
1617
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1618
+ specified by this expression.
1619
+ timezone : str, optional, default None
1620
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1621
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1622
+ """
1623
+ ...
1624
+
1625
+ @typing.overload
1626
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1627
+ """
1628
+ Specifies the PyPI packages for all steps of the flow.
1629
+
1630
+ Use `@pypi_base` to set common packages required by all
1631
+ steps and use `@pypi` to specify step-specific overrides.
1632
+ Parameters
1633
+ ----------
1634
+ packages : Dict[str, str], default: {}
1635
+ Packages to use for this flow. The key is the name of the package
1636
+ and the value is the version to use.
1637
+ python : str, optional, default: None
1638
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1639
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1640
+ """
1641
+ ...
1642
+
1643
+ @typing.overload
1644
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1645
+ ...
1646
+
1647
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1648
+ """
1649
+ Specifies the PyPI packages for all steps of the flow.
1650
+
1651
+ Use `@pypi_base` to set common packages required by all
1652
+ steps and use `@pypi` to specify step-specific overrides.
1653
+ Parameters
1654
+ ----------
1655
+ packages : Dict[str, str], default: {}
1656
+ Packages to use for this flow. The key is the name of the package
1657
+ and the value is the version to use.
1658
+ python : str, optional, default: None
1659
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1660
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1661
+ """
1662
+ ...
1663
+
1586
1664
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1587
1665
  """
1588
1666
  Switch namespace to the one provided.
@@ -1661,6 +1739,19 @@ def default_metadata() -> str:
1661
1739
  ...
1662
1740
 
1663
1741
  class Metaflow(object, metaclass=type):
1742
+ """
1743
+ Entry point to all objects in the Metaflow universe.
1744
+
1745
+ This object can be used to list all the flows present either through the explicit property
1746
+ or by iterating over this object.
1747
+
1748
+ Attributes
1749
+ ----------
1750
+ flows : List[Flow]
1751
+ Returns the list of all `Flow` objects known to this metadata provider. Note that only
1752
+ flows present in the current namespace will be returned. A `Flow` is present in a namespace
1753
+ if it has at least one run in the namespace.
1754
+ """
1664
1755
  def __init__(self):
1665
1756
  ...
1666
1757
  @property
@@ -1712,6 +1803,17 @@ class Metaflow(object, metaclass=type):
1712
1803
  ...
1713
1804
 
1714
1805
  class Flow(metaflow.client.core.MetaflowObject, metaclass=type):
1806
+ """
1807
+ A Flow represents all existing flows with a certain name, in other words,
1808
+ classes derived from `FlowSpec`. A container of `Run` objects.
1809
+
1810
+ Attributes
1811
+ ----------
1812
+ latest_run : Run
1813
+ Latest `Run` (in progress or completed, successfully or not) of this flow.
1814
+ latest_successful_run : Run
1815
+ Latest successfully completed `Run` of this flow.
1816
+ """
1715
1817
  def __init__(self, *args, **kwargs):
1716
1818
  ...
1717
1819
  @property
@@ -1798,6 +1900,26 @@ class Flow(metaflow.client.core.MetaflowObject, metaclass=type):
1798
1900
  ...
1799
1901
 
1800
1902
  class Run(metaflow.client.core.MetaflowObject, metaclass=type):
1903
+ """
1904
+ A `Run` represents an execution of a `Flow`. It is a container of `Step`s.
1905
+
1906
+ Attributes
1907
+ ----------
1908
+ data : MetaflowData
1909
+ a shortcut to run['end'].task.data, i.e. data produced by this run.
1910
+ successful : bool
1911
+ True if the run completed successfully.
1912
+ finished : bool
1913
+ True if the run completed.
1914
+ finished_at : datetime
1915
+ Time this run finished.
1916
+ code : MetaflowCode
1917
+ Code package for this run (if present). See `MetaflowCode`.
1918
+ trigger : MetaflowTrigger
1919
+ Information about event(s) that triggered this run (if present). See `MetaflowTrigger`.
1920
+ end_task : Task
1921
+ `Task` for the end step (if it is present already).
1922
+ """
1801
1923
  def steps(self, *tags: str) -> typing.Iterator[metaflow.client.core.Step]:
1802
1924
  """
1803
1925
  [Legacy function - do not use]
@@ -2030,6 +2152,23 @@ class Run(metaflow.client.core.MetaflowObject, metaclass=type):
2030
2152
  ...
2031
2153
 
2032
2154
  class Step(metaflow.client.core.MetaflowObject, metaclass=type):
2155
+ """
2156
+ A `Step` represents a user-defined step, that is, a method annotated with the `@step` decorator.
2157
+
2158
+ It contains `Task` objects associated with the step, that is, all executions of the
2159
+ `Step`. The step may contain multiple `Task`s in the case of a foreach step.
2160
+
2161
+ Attributes
2162
+ ----------
2163
+ task : Task
2164
+ The first `Task` object in this step. This is a shortcut for retrieving the only
2165
+ task contained in a non-foreach step.
2166
+ finished_at : datetime
2167
+ Time when the latest `Task` of this step finished. Note that in the case of foreaches,
2168
+ this time may change during execution of the step.
2169
+ environment_info : Dict[str, Any]
2170
+ Information about the execution environment.
2171
+ """
2033
2172
  @property
2034
2173
  def task(self) -> typing.Optional[metaflow.client.core.Task]:
2035
2174
  """
@@ -2164,6 +2303,55 @@ class Step(metaflow.client.core.MetaflowObject, metaclass=type):
2164
2303
  ...
2165
2304
 
2166
2305
  class Task(metaflow.client.core.MetaflowObject, metaclass=type):
2306
+ """
2307
+ A `Task` represents an execution of a `Step`.
2308
+
2309
+ It contains all `DataArtifact` objects produced by the task as
2310
+ well as metadata related to execution.
2311
+
2312
+ Note that the `@retry` decorator may cause multiple attempts of
2313
+ the task to be present. Usually you want the latest attempt, which
2314
+ is what instantiating a `Task` object returns by default. If
2315
+ you need to e.g. retrieve logs from a failed attempt, you can
2316
+ explicitly get information about a specific attempt by using the
2317
+ following syntax when creating a task:
2318
+
2319
+ `Task('flow/run/step/task', attempt=<attempt>)`
2320
+
2321
+ where `attempt=0` corresponds to the first attempt etc.
2322
+
2323
+ Attributes
2324
+ ----------
2325
+ metadata : List[Metadata]
2326
+ List of all metadata events associated with the task.
2327
+ metadata_dict : Dict[str, str]
2328
+ A condensed version of `metadata`: A dictionary where keys
2329
+ are names of metadata events and values the latest corresponding event.
2330
+ data : MetaflowData
2331
+ Container of all data artifacts produced by this task. Note that this
2332
+ call downloads all data locally, so it can be slower than accessing
2333
+ artifacts individually. See `MetaflowData` for more information.
2334
+ artifacts : MetaflowArtifacts
2335
+ Container of `DataArtifact` objects produced by this task.
2336
+ successful : bool
2337
+ True if the task completed successfully.
2338
+ finished : bool
2339
+ True if the task completed.
2340
+ exception : object
2341
+ Exception raised by this task if there was one.
2342
+ finished_at : datetime
2343
+ Time this task finished.
2344
+ runtime_name : str
2345
+ Runtime this task was executed on.
2346
+ stdout : str
2347
+ Standard output for the task execution.
2348
+ stderr : str
2349
+ Standard error output for the task execution.
2350
+ code : MetaflowCode
2351
+ Code package for this task (if present). See `MetaflowCode`.
2352
+ environment_info : Dict[str, str]
2353
+ Information about the execution environment.
2354
+ """
2167
2355
  def __init__(self, *args, **kwargs):
2168
2356
  ...
2169
2357
  @property
@@ -2478,6 +2666,21 @@ class Task(metaflow.client.core.MetaflowObject, metaclass=type):
2478
2666
  ...
2479
2667
 
2480
2668
  class DataArtifact(metaflow.client.core.MetaflowObject, metaclass=type):
2669
+ """
2670
+ A single data artifact and associated metadata. Note that this object does
2671
+ not contain other objects as it is the leaf object in the hierarchy.
2672
+
2673
+ Attributes
2674
+ ----------
2675
+ data : object
2676
+ The data contained in this artifact, that is, the object produced during
2677
+ execution of this run.
2678
+ sha : string
2679
+ A unique ID of this artifact.
2680
+ finished_at : datetime
2681
+ Corresponds roughly to the `Task.finished_at` time of the parent `Task`.
2682
+ An alias for `DataArtifact.created_at`.
2683
+ """
2481
2684
  @property
2482
2685
  def data(self) -> typing.Any:
2483
2686
  """
@@ -2534,6 +2737,44 @@ class DataArtifact(metaflow.client.core.MetaflowObject, metaclass=type):
2534
2737
  ...
2535
2738
 
2536
2739
  class Runner(object, metaclass=type):
2740
+ """
2741
+ Metaflow's Runner API that presents a programmatic interface
2742
+ to run flows and perform other operations either synchronously or asynchronously.
2743
+ The class expects a path to the flow file along with optional arguments
2744
+ that match top-level options on the command-line.
2745
+
2746
+ This class works as a context manager, calling `cleanup()` to remove
2747
+ temporary files at exit.
2748
+
2749
+ Example:
2750
+ ```python
2751
+ with Runner('slowflow.py', pylint=False) as runner:
2752
+ result = runner.run(alpha=5, tags=["abc", "def"], max_workers=5)
2753
+ print(result.run.finished)
2754
+ ```
2755
+
2756
+ Parameters
2757
+ ----------
2758
+ flow_file : str
2759
+ Path to the flow file to run
2760
+ show_output : bool, default True
2761
+ Show the 'stdout' and 'stderr' to the console by default,
2762
+ Only applicable for synchronous 'run' and 'resume' functions.
2763
+ profile : Optional[str], default None
2764
+ Metaflow profile to use to run this run. If not specified, the default
2765
+ profile is used (or the one already set using `METAFLOW_PROFILE`)
2766
+ env : Optional[Dict], default None
2767
+ Additional environment variables to set for the Run. This overrides the
2768
+ environment set for this process.
2769
+ cwd : Optional[str], default None
2770
+ The directory to run the subprocess in; if not specified, the current
2771
+ directory is used.
2772
+ file_read_timeout : int, default 3600
2773
+ The timeout until which we try to read the runner attribute file.
2774
+ **kwargs : Any
2775
+ Additional arguments that you would pass to `python myflow.py` before
2776
+ the `run` command.
2777
+ """
2537
2778
  def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
2538
2779
  ...
2539
2780
  def __enter__(self) -> metaflow.runner.metaflow_runner.Runner:
@@ -2626,6 +2867,42 @@ class Runner(object, metaclass=type):
2626
2867
  ...
2627
2868
 
2628
2869
  class NBRunner(object, metaclass=type):
2870
+ """
2871
+ A wrapper over `Runner` for executing flows defined in a Jupyter
2872
+ notebook cell.
2873
+
2874
+ Instantiate this class on the last line of a notebook cell where
2875
+ a `flow` is defined. In contrast to `Runner`, this class is not
2876
+ meant to be used in a context manager. Instead, use a blocking helper
2877
+ function like `nbrun` (which calls `cleanup()` internally) or call
2878
+ `cleanup()` explictly when using non-blocking APIs.
2879
+
2880
+ ```python
2881
+ run = NBRunner(FlowName).nbrun()
2882
+ ```
2883
+
2884
+ Parameters
2885
+ ----------
2886
+ flow : FlowSpec
2887
+ Flow defined in the same cell
2888
+ show_output : bool, default True
2889
+ Show the 'stdout' and 'stderr' to the console by default,
2890
+ Only applicable for synchronous 'run' and 'resume' functions.
2891
+ profile : Optional[str], default None
2892
+ Metaflow profile to use to run this run. If not specified, the default
2893
+ profile is used (or the one already set using `METAFLOW_PROFILE`)
2894
+ env : Optional[Dict], default None
2895
+ Additional environment variables to set for the Run. This overrides the
2896
+ environment set for this process.
2897
+ base_dir : Optional[str], default None
2898
+ The directory to run the subprocess in; if not specified, a temporary
2899
+ directory is used.
2900
+ file_read_timeout : int, default 3600
2901
+ The timeout until which we try to read the runner attribute file.
2902
+ **kwargs : Any
2903
+ Additional arguments that you would pass to `python myflow.py` before
2904
+ the `run` command.
2905
+ """
2629
2906
  def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", file_read_timeout: int = 3600, **kwargs):
2630
2907
  ...
2631
2908
  def nbrun(self, **kwargs):
@@ -2732,6 +3009,30 @@ class NBRunner(object, metaclass=type):
2732
3009
  ...
2733
3010
 
2734
3011
  class Deployer(object, metaclass=type):
3012
+ """
3013
+ Use the `Deployer` class to configure and access one of the production
3014
+ orchestrators supported by Metaflow.
3015
+
3016
+ Parameters
3017
+ ----------
3018
+ flow_file : str
3019
+ Path to the flow file to deploy.
3020
+ show_output : bool, default True
3021
+ Show the 'stdout' and 'stderr' to the console by default.
3022
+ profile : Optional[str], default None
3023
+ Metaflow profile to use for the deployment. If not specified, the default
3024
+ profile is used.
3025
+ env : Optional[Dict[str, str]], default None
3026
+ Additional environment variables to set for the deployment.
3027
+ cwd : Optional[str], default None
3028
+ The directory to run the subprocess in; if not specified, the current
3029
+ directory is used.
3030
+ file_read_timeout : int, default 3600
3031
+ The timeout until which we try to read the deployer attribute file.
3032
+ **kwargs : Any
3033
+ Additional arguments that you would pass to `python myflow.py` before
3034
+ the deployment command.
3035
+ """
2735
3036
  def __init__(self, flow_file: str, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, cwd: typing.Optional[str] = None, file_read_timeout: int = 3600, **kwargs):
2736
3037
  ...
2737
3038
  def _Deployer__make_function(self, deployer_class):
@@ -2752,6 +3053,43 @@ class Deployer(object, metaclass=type):
2752
3053
  ...
2753
3054
 
2754
3055
  class NBDeployer(object, metaclass=type):
3056
+ """
3057
+ A wrapper over `Deployer` for deploying flows defined in a Jupyter
3058
+ notebook cell.
3059
+
3060
+ Instantiate this class on the last line of a notebook cell where
3061
+ a `flow` is defined. In contrast to `Deployer`, this class is not
3062
+ meant to be used in a context manager.
3063
+
3064
+ ```python
3065
+ deployer = NBDeployer(FlowName)
3066
+ ar = deployer.argo_workflows(name="madhur")
3067
+ ar_obj = ar.create()
3068
+ result = ar_obj.trigger(alpha=300)
3069
+ print(result.status)
3070
+ print(result.run)
3071
+ result.terminate()
3072
+ ```
3073
+
3074
+ Parameters
3075
+ ----------
3076
+ flow : FlowSpec
3077
+ Flow defined in the same cell
3078
+ show_output : bool, default True
3079
+ Show the 'stdout' and 'stderr' to the console by default,
3080
+ profile : Optional[str], default None
3081
+ Metaflow profile to use to deploy this run. If not specified, the default
3082
+ profile is used (or the one already set using `METAFLOW_PROFILE`)
3083
+ env : Optional[Dict[str, str]], default None
3084
+ Additional environment variables to set. This overrides the
3085
+ environment set for this process.
3086
+ base_dir : Optional[str], default None
3087
+ The directory to run the subprocess in; if not specified, a temporary
3088
+ directory is used.
3089
+ **kwargs : Any
3090
+ Additional arguments that you would pass to `python myflow.py` i.e. options
3091
+ listed in `python myflow.py --help`
3092
+ """
2755
3093
  def __init__(self, flow, show_output: bool = True, profile: typing.Optional[str] = None, env: typing.Optional[typing.Dict] = None, base_dir: str = "/tmp", file_read_timeout: int = 3600, **kwargs):
2756
3094
  ...
2757
3095
  def cleanup(self):