ob-metaflow-stubs 6.0.3.103rc3__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 +836 -498
  2. metaflow-stubs/cards.pyi +211 -5
  3. metaflow-stubs/cli.pyi +23 -3
  4. metaflow-stubs/client/__init__.pyi +129 -4
  5. metaflow-stubs/client/core.pyi +227 -7
  6. metaflow-stubs/client/filecache.pyi +2 -2
  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 +157 -4
  13. metaflow-stubs/info_file.pyi +2 -2
  14. metaflow-stubs/metadata/metadata.pyi +8 -2
  15. metaflow-stubs/metadata/util.pyi +2 -2
  16. metaflow-stubs/metaflow_config.pyi +2 -2
  17. metaflow-stubs/metaflow_current.pyi +39 -36
  18. metaflow-stubs/mflog/mflog.pyi +2 -2
  19. metaflow-stubs/multicore_utils.pyi +2 -2
  20. metaflow-stubs/parameters.pyi +70 -4
  21. metaflow-stubs/plugins/__init__.pyi +13 -2
  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 +5 -2
  27. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +45 -3
  28. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +45 -3
  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 +18 -5
  33. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +98 -7
  34. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +33 -5
  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 +33 -2
  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 +52 -2
  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 +55 -2
  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 +63 -3
  77. metaflow-stubs/plugins/datatools/local.pyi +16 -2
  78. metaflow-stubs/plugins/datatools/s3/__init__.pyi +72 -3
  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 +106 -2
  86. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  87. metaflow-stubs/plugins/frameworks/pytorch.pyi +23 -2
  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 +12 -3
  97. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +65 -2
  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 +4 -4
  102. metaflow-stubs/plugins/package_cli.pyi +2 -2
  103. metaflow-stubs/plugins/parallel_decorator.pyi +29 -2
  104. metaflow-stubs/plugins/perimeters.pyi +2 -2
  105. metaflow-stubs/plugins/project_decorator.pyi +59 -2
  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 +4 -4
  109. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +33 -2
  110. metaflow-stubs/plugins/pypi/pypi_environment.pyi +3 -3
  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 +36 -5
  119. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +9 -2
  120. metaflow-stubs/plugins/timeout_decorator.pyi +23 -2
  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 +71 -132
  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 +3 -3
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. {ob_metaflow_stubs-6.0.3.103rc3.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.103rc3.dist-info/RECORD +0 -140
  139. {ob_metaflow_stubs-6.0.3.103rc3.dist-info → ob_metaflow_stubs-6.0.3.105.dist-info}/WHEEL +0 -0
  140. {ob_metaflow_stubs-6.0.3.103rc3.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:42:44.532164 #
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.flowspec
12
- import metaflow.parameters
11
+ import metaflow.metaflow_current
13
12
  import typing
14
- import metaflow.datastore.inputs
15
- import metaflow._vendor.click.types
16
- import metaflow.runner.metaflow_runner
17
- import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
13
+ import metaflow.flowspec
18
14
  import datetime
19
15
  import metaflow.events
20
- import metaflow.metaflow_current
16
+ import metaflow_extensions.obcheckpoint.plugins.machine_learning_utilities.datastructures
17
+ import metaflow.datastore.inputs
18
+ import metaflow.parameters
19
+ import metaflow.runner.metaflow_runner
21
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,82 +513,159 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
435
513
  ...
436
514
 
437
515
  @typing.overload
438
- 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]]]:
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
- Specifies that the step will success under all circumstances.
518
+ Specifies the PyPI packages for the step.
441
519
 
442
- The decorator will create an optional artifact, specified by `var`, which
443
- contains the exception raised. You can use it to detect the presence
444
- of errors, indicating that all happy-path artifacts produced by the step
445
- are missing.
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.
446
524
 
447
525
  Parameters
448
526
  ----------
449
- var : str, optional, default None
450
- Name of the artifact in which to store the caught exception.
451
- If not specified, the exception is not stored.
452
- print_exception : bool, default True
453
- Determines whether or not the exception is printed to
454
- stdout when caught.
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.
455
533
  """
456
534
  ...
457
535
 
458
536
  @typing.overload
459
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
537
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
460
538
  ...
461
539
 
462
540
  @typing.overload
463
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
541
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
464
542
  ...
465
543
 
466
- 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):
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):
467
545
  """
468
- Specifies that the step will success under all circumstances.
546
+ Specifies the PyPI packages for the step.
469
547
 
470
- The decorator will create an optional artifact, specified by `var`, which
471
- contains the exception raised. You can use it to detect the presence
472
- of errors, indicating that all happy-path artifacts produced by the step
473
- are missing.
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.
474
552
 
475
553
  Parameters
476
554
  ----------
477
- var : str, optional, default None
478
- Name of the artifact in which to store the caught exception.
479
- If not specified, the exception is not stored.
480
- print_exception : bool, default True
481
- Determines whether or not the exception is printed to
482
- stdout when caught.
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.
483
561
  """
484
562
  ...
485
563
 
486
564
  @typing.overload
487
- 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]]]:
565
+ def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> 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]]]:
488
566
  """
489
- Specifies environment variables to be set prior to the execution of a step.
567
+ Specifies the Conda environment for the step.
568
+
569
+ Information in this decorator will augment any
570
+ attributes set in the `@conda_base` flow-level decorator. Hence,
571
+ you can use `@conda_base` to set packages required by all
572
+ steps and use `@conda` to specify step-specific overrides.
490
573
 
491
574
  Parameters
492
575
  ----------
493
- vars : Dict[str, str], default {}
494
- Dictionary of environment variables to set.
576
+ packages : Dict[str, str], default {}
577
+ Packages to use for this step. The key is the name of the package
578
+ and the value is the version to use.
579
+ libraries : Dict[str, str], default {}
580
+ Supported for backward compatibility. When used with packages, packages will take precedence.
581
+ python : str, optional, default None
582
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
583
+ that the version used will correspond to the version of the Python interpreter used to start the run.
584
+ disabled : bool, default False
585
+ If set to True, disables @conda.
495
586
  """
496
587
  ...
497
588
 
498
589
  @typing.overload
499
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
590
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
500
591
  ...
501
592
 
502
593
  @typing.overload
503
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
594
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
504
595
  ...
505
596
 
506
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
597
+ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
507
598
  """
508
- Specifies environment variables to be set prior to the execution of a step.
599
+ Specifies the Conda environment for the step.
600
+
601
+ Information in this decorator will augment any
602
+ attributes set in the `@conda_base` flow-level decorator. Hence,
603
+ you can use `@conda_base` to set packages required by all
604
+ steps and use `@conda` to specify step-specific overrides.
509
605
 
510
606
  Parameters
511
607
  ----------
512
- vars : Dict[str, str], default {}
513
- Dictionary of environment variables to set.
608
+ packages : Dict[str, str], default {}
609
+ Packages to use for this step. The key is the name of the package
610
+ and the value is the version to use.
611
+ libraries : Dict[str, str], default {}
612
+ Supported for backward compatibility. When used with packages, packages will take precedence.
613
+ python : str, optional, default None
614
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
615
+ that the version used will correspond to the version of the Python interpreter used to start the run.
616
+ disabled : bool, default False
617
+ If set to True, disables @conda.
618
+ """
619
+ ...
620
+
621
+ @typing.overload
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]]]:
623
+ """
624
+ Creates a human-readable report, a Metaflow Card, after this step completes.
625
+
626
+ Note that you may add multiple `@card` decorators in a step with different parameters.
627
+
628
+ Parameters
629
+ ----------
630
+ type : str, default 'default'
631
+ Card type.
632
+ id : str, optional, default None
633
+ If multiple cards are present, use this id to identify this card.
634
+ options : Dict[str, Any], default {}
635
+ Options passed to the card. The contents depend on the card type.
636
+ timeout : int, default 45
637
+ Interrupt reporting if it takes more than this many seconds.
638
+
639
+
640
+ """
641
+ ...
642
+
643
+ @typing.overload
644
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
645
+ ...
646
+
647
+ @typing.overload
648
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
649
+ ...
650
+
651
+ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
652
+ """
653
+ Creates a human-readable report, a Metaflow Card, after this step completes.
654
+
655
+ Note that you may add multiple `@card` decorators in a step with different parameters.
656
+
657
+ Parameters
658
+ ----------
659
+ type : str, default 'default'
660
+ Card type.
661
+ id : str, optional, default None
662
+ If multiple cards are present, use this id to identify this card.
663
+ options : Dict[str, Any], default {}
664
+ Options passed to the card. The contents depend on the card type.
665
+ timeout : int, default 45
666
+ Interrupt reporting if it takes more than this many seconds.
667
+
668
+
514
669
  """
515
670
  ...
516
671
 
@@ -571,6 +726,72 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
571
726
  """
572
727
  ...
573
728
 
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]]]:
730
+ """
731
+ Specifies that this step should execute on Kubernetes.
732
+
733
+ Parameters
734
+ ----------
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.
792
+ """
793
+ ...
794
+
574
795
  @typing.overload
575
796
  def retry(*, times: int = 3, minutes_between_retries: int = 2) -> 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]]]:
576
797
  """
@@ -625,43 +846,7 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
625
846
  ...
626
847
 
627
848
  @typing.overload
628
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
629
- """
630
- Internal decorator to support Fast bakery
631
- """
632
- ...
633
-
634
- @typing.overload
635
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
636
- ...
637
-
638
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
639
- """
640
- Internal decorator to support Fast bakery
641
- """
642
- ...
643
-
644
- @typing.overload
645
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
646
- """
647
- Decorator prototype for all step decorators. This function gets specialized
648
- and imported for all decorators types by _import_plugin_decorators().
649
- """
650
- ...
651
-
652
- @typing.overload
653
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
654
- ...
655
-
656
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
657
- """
658
- Decorator prototype for all step decorators. This function gets specialized
659
- and imported for all decorators types by _import_plugin_decorators().
660
- """
661
- ...
662
-
663
- @typing.overload
664
- def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = 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]]]:
849
+ def resources(*, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = 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]]]:
665
850
  """
666
851
  Specifies the resources needed when executing this step.
667
852
 
@@ -738,158 +923,82 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
738
923
  ...
739
924
 
740
925
  @typing.overload
741
- 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]]]:
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]]]:
742
927
  """
743
- Specifies secrets to be retrieved and injected as environment variables prior to
744
- the execution of a step.
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.
745
934
 
746
935
  Parameters
747
936
  ----------
748
- sources : List[Union[str, Dict[str, Any]]], default: []
749
- List of secret specs, defining how the secrets are to be retrieved
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.
750
943
  """
751
944
  ...
752
945
 
753
946
  @typing.overload
754
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
947
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
755
948
  ...
756
949
 
757
950
  @typing.overload
758
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
951
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
759
952
  ...
760
953
 
761
- 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]]] = []):
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):
762
955
  """
763
- Specifies secrets to be retrieved and injected as environment variables prior to
764
- the execution of a step.
956
+ Specifies that the step will success under all circumstances.
765
957
 
766
- Parameters
767
- ----------
768
- sources : List[Union[str, Dict[str, Any]]], default: []
769
- List of secret specs, defining how the secrets are to be retrieved
770
- """
771
- ...
772
-
773
- 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]]]:
774
- """
775
- Specifies that this step should execute on Kubernetes.
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.
776
962
 
777
963
  Parameters
778
964
  ----------
779
- cpu : int, default 1
780
- Number of CPUs required for this step. If `@resources` is
781
- also present, the maximum value from all decorators is used.
782
- memory : int, default 4096
783
- Memory size (in MB) required for this step. If
784
- `@resources` is also present, the maximum value from all decorators is
785
- used.
786
- disk : int, default 10240
787
- Disk size (in MB) required for this step. If
788
- `@resources` is also present, the maximum value from all decorators is
789
- used.
790
- image : str, optional, default None
791
- Docker image to use when launching on Kubernetes. If not specified, and
792
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
793
- not, a default Docker image mapping to the current version of Python is used.
794
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
795
- If given, the imagePullPolicy to be applied to the Docker image of the step.
796
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
797
- Kubernetes service account to use when launching pod in Kubernetes.
798
- secrets : List[str], optional, default None
799
- Kubernetes secrets to use when launching pod in Kubernetes. These
800
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
801
- in Metaflow configuration.
802
- node_selector: Union[Dict[str,str], str], optional, default None
803
- Kubernetes node selector(s) to apply to the pod running the task.
804
- Can be passed in as a comma separated string of values e.g. "kubernetes.io/os=linux,kubernetes.io/arch=amd64"
805
- or as a dictionary {"kubernetes.io/os": "linux", "kubernetes.io/arch": "amd64"}
806
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
807
- Kubernetes namespace to use when launching pod in Kubernetes.
808
- gpu : int, optional, default None
809
- Number of GPUs required for this step. A value of zero implies that
810
- the scheduled node should not have GPUs.
811
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
812
- The vendor of the GPUs to be used for this step.
813
- tolerations : List[str], default []
814
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
815
- Kubernetes tolerations to use when launching pod in Kubernetes.
816
- use_tmpfs : bool, default False
817
- This enables an explicit tmpfs mount for this step.
818
- tmpfs_tempdir : bool, default True
819
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
820
- tmpfs_size : int, optional, default: None
821
- The value for the size (in MiB) of the tmpfs mount for this step.
822
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
823
- memory allocated for this step.
824
- tmpfs_path : str, optional, default /metaflow_temp
825
- Path to tmpfs mount for this step.
826
- persistent_volume_claims : Dict[str, str], optional, default None
827
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
828
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
829
- shared_memory: int, optional
830
- Shared memory size (in MiB) required for this step
831
- port: int, optional
832
- Port number to specify in the Kubernetes job object
833
- compute_pool : str, optional, default None
834
- Compute pool to be used for for this step.
835
- If not specified, any accessible compute pool within the perimeter is used.
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.
836
971
  """
837
972
  ...
838
973
 
839
974
  @typing.overload
840
- def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> 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]]]:
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]]]:
841
976
  """
842
- Specifies the Conda environment for the step.
843
-
844
- Information in this decorator will augment any
845
- attributes set in the `@conda_base` flow-level decorator. Hence,
846
- you can use `@conda_base` to set packages required by all
847
- steps and use `@conda` to specify step-specific overrides.
977
+ Specifies environment variables to be set prior to the execution of a step.
848
978
 
849
979
  Parameters
850
980
  ----------
851
- packages : Dict[str, str], default {}
852
- Packages to use for this step. The key is the name of the package
853
- and the value is the version to use.
854
- libraries : Dict[str, str], default {}
855
- Supported for backward compatibility. When used with packages, packages will take precedence.
856
- python : str, optional, default None
857
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
858
- that the version used will correspond to the version of the Python interpreter used to start the run.
859
- disabled : bool, default False
860
- If set to True, disables @conda.
981
+ vars : Dict[str, str], default {}
982
+ Dictionary of environment variables to set.
861
983
  """
862
984
  ...
863
985
 
864
986
  @typing.overload
865
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
987
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
866
988
  ...
867
989
 
868
990
  @typing.overload
869
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
991
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
870
992
  ...
871
993
 
872
- def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
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] = {}):
873
995
  """
874
- Specifies the Conda environment for the step.
875
-
876
- Information in this decorator will augment any
877
- attributes set in the `@conda_base` flow-level decorator. Hence,
878
- you can use `@conda_base` to set packages required by all
879
- steps and use `@conda` to specify step-specific overrides.
996
+ Specifies environment variables to be set prior to the execution of a step.
880
997
 
881
998
  Parameters
882
999
  ----------
883
- packages : Dict[str, str], default {}
884
- Packages to use for this step. The key is the name of the package
885
- and the value is the version to use.
886
- libraries : Dict[str, str], default {}
887
- Supported for backward compatibility. When used with packages, packages will take precedence.
888
- python : str, optional, default None
889
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
890
- that the version used will correspond to the version of the Python interpreter used to start the run.
891
- disabled : bool, default False
892
- If set to True, disables @conda.
1000
+ vars : Dict[str, str], default {}
1001
+ Dictionary of environment variables to set.
893
1002
  """
894
1003
  ...
895
1004
 
@@ -954,6 +1063,23 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
954
1063
  """
955
1064
  ...
956
1065
 
1066
+ @typing.overload
1067
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1068
+ """
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
+
957
1083
  @typing.overload
958
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]]]:
959
1085
  """
@@ -1016,232 +1142,54 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1016
1142
  ...
1017
1143
 
1018
1144
  @typing.overload
1019
- 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]]]:
1145
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1020
1146
  """
1021
- Creates a human-readable report, a Metaflow Card, after this step completes.
1022
-
1023
- Note that you may add multiple `@card` decorators in a step with different parameters.
1024
-
1025
- Parameters
1026
- ----------
1027
- type : str, default 'default'
1028
- Card type.
1029
- id : str, optional, default None
1030
- If multiple cards are present, use this id to identify this card.
1031
- options : Dict[str, Any], default {}
1032
- Options passed to the card. The contents depend on the card type.
1033
- timeout : int, default 45
1034
- Interrupt reporting if it takes more than this many seconds.
1035
-
1036
-
1147
+ Decorator prototype for all step decorators. This function gets specialized
1148
+ and imported for all decorators types by _import_plugin_decorators().
1037
1149
  """
1038
1150
  ...
1039
1151
 
1040
1152
  @typing.overload
1041
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1153
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1042
1154
  ...
1043
1155
 
1044
- @typing.overload
1045
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1156
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
1157
+ """
1158
+ Decorator prototype for all step decorators. This function gets specialized
1159
+ and imported for all decorators types by _import_plugin_decorators().
1160
+ """
1046
1161
  ...
1047
1162
 
1048
- def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = "default", id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
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]]]:
1049
1165
  """
1050
- Creates a human-readable report, a Metaflow Card, after this step completes.
1051
-
1052
- Note that you may add multiple `@card` decorators in a step with different parameters.
1166
+ Specifies secrets to be retrieved and injected as environment variables prior to
1167
+ the execution of a step.
1053
1168
 
1054
1169
  Parameters
1055
1170
  ----------
1056
- type : str, default 'default'
1057
- Card type.
1058
- id : str, optional, default None
1059
- If multiple cards are present, use this id to identify this card.
1060
- options : Dict[str, Any], default {}
1061
- Options passed to the card. The contents depend on the card type.
1062
- timeout : int, default 45
1063
- Interrupt reporting if it takes more than this many seconds.
1064
-
1065
-
1171
+ sources : List[Union[str, Dict[str, Any]]], default: []
1172
+ List of secret specs, defining how the secrets are to be retrieved
1066
1173
  """
1067
1174
  ...
1068
1175
 
1069
1176
  @typing.overload
1070
- 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]]]:
1071
- """
1072
- Specifies the PyPI packages for the step.
1073
-
1074
- Information in this decorator will augment any
1075
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1076
- you can use `@pypi_base` to set packages required by all
1077
- steps and use `@pypi` to specify step-specific overrides.
1078
-
1079
- Parameters
1080
- ----------
1081
- packages : Dict[str, str], default: {}
1082
- Packages to use for this step. The key is the name of the package
1083
- and the value is the version to use.
1084
- python : str, optional, default: None
1085
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1086
- that the version used will correspond to the version of the Python interpreter used to start the run.
1087
- """
1088
- ...
1089
-
1090
- @typing.overload
1091
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1092
- ...
1093
-
1094
- @typing.overload
1095
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1096
- ...
1097
-
1098
- 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):
1099
- """
1100
- Specifies the PyPI packages for the step.
1101
-
1102
- Information in this decorator will augment any
1103
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1104
- you can use `@pypi_base` to set packages required by all
1105
- steps and use `@pypi` to specify step-specific overrides.
1106
-
1107
- Parameters
1108
- ----------
1109
- packages : Dict[str, str], default: {}
1110
- Packages to use for this step. The key is the name of the package
1111
- and the value is the version to use.
1112
- python : str, optional, default: None
1113
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1114
- that the version used will correspond to the version of the Python interpreter used to start the run.
1115
- """
1116
- ...
1117
-
1118
- @typing.overload
1119
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1120
- """
1121
- Specifies the PyPI packages for all steps of the flow.
1122
-
1123
- Use `@pypi_base` to set common packages required by all
1124
- steps and use `@pypi` to specify step-specific overrides.
1125
- Parameters
1126
- ----------
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.
1133
- """
1134
- ...
1135
-
1136
- @typing.overload
1137
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1138
- ...
1139
-
1140
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1141
- """
1142
- Specifies the PyPI packages for all steps of the flow.
1143
-
1144
- Use `@pypi_base` to set common packages required by all
1145
- steps and use `@pypi` to specify step-specific overrides.
1146
- Parameters
1147
- ----------
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.
1154
- """
1155
- ...
1156
-
1157
- 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]]:
1158
- """
1159
- 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)
1160
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1161
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1162
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1163
- starts only after all sensors finish.
1164
-
1165
- Parameters
1166
- ----------
1167
- timeout : int
1168
- Time, in seconds before the task times out and fails. (Default: 3600)
1169
- poke_interval : int
1170
- Time in seconds that the job should wait in between each try. (Default: 60)
1171
- mode : str
1172
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1173
- exponential_backoff : bool
1174
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1175
- pool : str
1176
- the slot pool this task should run in,
1177
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1178
- soft_fail : bool
1179
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1180
- name : str
1181
- Name of the sensor on Airflow
1182
- description : str
1183
- Description of sensor in the Airflow UI
1184
- bucket_key : Union[str, List[str]]
1185
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1186
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1187
- bucket_name : str
1188
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1189
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1190
- wildcard_match : bool
1191
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1192
- aws_conn_id : str
1193
- a reference to the s3 connection on Airflow. (Default: None)
1194
- verify : bool
1195
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1196
- """
1197
- ...
1198
-
1199
- @typing.overload
1200
- 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]]:
1201
- """
1202
- Specifies the Conda environment for all steps of the flow.
1203
-
1204
- Use `@conda_base` to set common libraries required by all
1205
- steps and use `@conda` to specify step-specific additions.
1206
-
1207
- Parameters
1208
- ----------
1209
- packages : Dict[str, str], default {}
1210
- Packages to use for this flow. The key is the name of the package
1211
- and the value is the version to use.
1212
- libraries : Dict[str, str], default {}
1213
- Supported for backward compatibility. When used with packages, packages will take precedence.
1214
- python : str, optional, default None
1215
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1216
- that the version used will correspond to the version of the Python interpreter used to start the run.
1217
- disabled : bool, default False
1218
- If set to True, disables Conda.
1219
- """
1177
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1220
1178
  ...
1221
1179
 
1222
1180
  @typing.overload
1223
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1181
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1224
1182
  ...
1225
1183
 
1226
- 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):
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]]] = []):
1227
1185
  """
1228
- Specifies the Conda environment for all steps of the flow.
1229
-
1230
- Use `@conda_base` to set common libraries required by all
1231
- steps and use `@conda` to specify step-specific additions.
1186
+ Specifies secrets to be retrieved and injected as environment variables prior to
1187
+ the execution of a step.
1232
1188
 
1233
1189
  Parameters
1234
1190
  ----------
1235
- packages : Dict[str, str], default {}
1236
- Packages to use for this flow. The key is the name of the package
1237
- and the value is the version to use.
1238
- libraries : Dict[str, str], default {}
1239
- Supported for backward compatibility. When used with packages, packages will take precedence.
1240
- python : str, optional, default None
1241
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1242
- that the version used will correspond to the version of the Python interpreter used to start the run.
1243
- disabled : bool, default False
1244
- 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
1245
1193
  """
1246
1194
  ...
1247
1195
 
@@ -1340,52 +1288,185 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1340
1288
  """
1341
1289
  ...
1342
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.
1361
+ """
1362
+ ...
1363
+
1364
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1365
+ """
1366
+ Specifies what flows belong to the same project.
1367
+
1368
+ A project-specific namespace is created for all flows that
1369
+ use the same `@project(name)`.
1370
+
1371
+ Parameters
1372
+ ----------
1373
+ name : str
1374
+ Project name. Make sure that the name is unique amongst all
1375
+ projects that use the same production scheduler. The name may
1376
+ contain only lowercase alphanumeric characters and underscores.
1377
+
1378
+
1379
+ """
1380
+ ...
1381
+
1343
1382
  @typing.overload
1344
- 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]]:
1345
1384
  """
1346
- Specifies the times when the flow should be run when running on a
1347
- 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.
1348
1389
 
1349
1390
  Parameters
1350
1391
  ----------
1351
- hourly : bool, default False
1352
- Run the workflow hourly.
1353
- daily : bool, default True
1354
- Run the workflow daily.
1355
- weekly : bool, default False
1356
- Run the workflow weekly.
1357
- cron : str, optional, default None
1358
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1359
- specified by this expression.
1360
- timezone : str, optional, default None
1361
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1362
- 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.
1402
+ """
1403
+ ...
1404
+
1405
+ @typing.overload
1406
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1407
+ ...
1408
+
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):
1410
+ """
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.
1415
+
1416
+ Parameters
1417
+ ----------
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.
1363
1428
  """
1364
1429
  ...
1365
1430
 
1366
- @typing.overload
1367
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1368
- ...
1369
-
1370
- 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):
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]]:
1371
1432
  """
1372
- Specifies the times when the flow should be run when running on a
1373
- production scheduler.
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.
1374
1435
 
1375
1436
  Parameters
1376
1437
  ----------
1377
- hourly : bool, default False
1378
- Run the workflow hourly.
1379
- daily : bool, default True
1380
- Run the workflow daily.
1381
- weekly : bool, default False
1382
- Run the workflow weekly.
1383
- cron : str, optional, default None
1384
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1385
- specified by this expression.
1386
- timezone : str, optional, default None
1387
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1388
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1438
+ timeout : int
1439
+ Time, in seconds before the task times out and fails. (Default: 3600)
1440
+ poke_interval : int
1441
+ Time in seconds that the job should wait in between each try. (Default: 60)
1442
+ mode : str
1443
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1444
+ exponential_backoff : bool
1445
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1446
+ pool : str
1447
+ the slot pool this task should run in,
1448
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1449
+ soft_fail : bool
1450
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1451
+ name : str
1452
+ Name of the sensor on Airflow
1453
+ description : str
1454
+ Description of sensor in the Airflow UI
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)
1389
1470
  """
1390
1471
  ...
1391
1472
 
@@ -1492,94 +1573,91 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1492
1573
  """
1493
1574
  ...
1494
1575
 
1495
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
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]]:
1496
1578
  """
1497
- Specifies what flows belong to the same project.
1498
-
1499
- A project-specific namespace is created for all flows that
1500
- use the same `@project(name)`.
1579
+ Specifies the times when the flow should be run when running on a
1580
+ production scheduler.
1501
1581
 
1502
1582
  Parameters
1503
1583
  ----------
1504
- name : str
1505
- Project name. Make sure that the name is unique amongst all
1506
- projects that use the same production scheduler. The name may
1507
- contain only lowercase alphanumeric characters and underscores.
1508
-
1509
-
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).
1510
1596
  """
1511
1597
  ...
1512
1598
 
1513
- 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]]:
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):
1514
1604
  """
1515
- 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.
1516
- 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.
1605
+ Specifies the times when the flow should be run when running on a
1606
+ production scheduler.
1517
1607
 
1518
1608
  Parameters
1519
1609
  ----------
1520
- timeout : int
1521
- Time, in seconds before the task times out and fails. (Default: 3600)
1522
- poke_interval : int
1523
- Time in seconds that the job should wait in between each try. (Default: 60)
1524
- mode : str
1525
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1526
- exponential_backoff : bool
1527
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1528
- pool : str
1529
- the slot pool this task should run in,
1530
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1531
- soft_fail : bool
1532
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1533
- name : str
1534
- Name of the sensor on Airflow
1535
- description : str
1536
- Description of sensor in the Airflow UI
1537
- external_dag_id : str
1538
- The dag_id that contains the task you want to wait for.
1539
- external_task_ids : List[str]
1540
- The list of task_ids that you want to wait for.
1541
- If None (default value) the sensor waits for the DAG. (Default: None)
1542
- allowed_states : List[str]
1543
- Iterable of allowed states, (Default: ['success'])
1544
- failed_states : List[str]
1545
- Iterable of failed or dis-allowed states. (Default: None)
1546
- execution_delta : datetime.timedelta
1547
- time difference with the previous execution to look at,
1548
- the default is the same logical date as the current task or DAG. (Default: None)
1549
- check_existence: bool
1550
- Set to True to check if the external task exists or check if
1551
- the DAG to wait for exists. (Default: True)
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).
1552
1622
  """
1553
1623
  ...
1554
1624
 
1555
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
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]]:
1556
1627
  """
1557
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1558
-
1559
- User code call
1560
- -----------
1561
- @nim(
1562
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1563
- backend='managed'
1564
- )
1565
-
1566
- Valid backend options
1567
- ---------------------
1568
- - 'managed': Outerbounds selects a compute provider based on the model.
1569
- - 🚧 'dataplane': Run in your account.
1628
+ Specifies the PyPI packages for all steps of the flow.
1570
1629
 
1571
- Valid model options
1572
- ----------------
1573
- - 'meta/llama3-8b-instruct': 8B parameter model
1574
- - 'meta/llama3-70b-instruct': 70B parameter model
1575
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
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.
1576
1650
 
1651
+ Use `@pypi_base` to set common packages required by all
1652
+ steps and use `@pypi` to specify step-specific overrides.
1577
1653
  Parameters
1578
1654
  ----------
1579
- models: list[NIM]
1580
- List of NIM containers running models in sidecars.
1581
- backend: str
1582
- Compute provider to run the NIM container.
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.
1583
1661
  """
1584
1662
  ...
1585
1663
 
@@ -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):