ob-metaflow-stubs 5.8__py2.py3-none-any.whl → 5.8.2__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. metaflow-stubs/__init__.pyi +506 -506
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +2 -2
  5. metaflow-stubs/client/core.pyi +6 -6
  6. metaflow-stubs/client/filecache.pyi +1 -1
  7. metaflow-stubs/clone_util.pyi +1 -1
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +1 -1
  10. metaflow-stubs/flowspec.pyi +3 -3
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +3 -3
  13. metaflow-stubs/metadata/metadata.pyi +1 -1
  14. metaflow-stubs/metadata/util.pyi +1 -1
  15. metaflow-stubs/metaflow_config.pyi +1 -1
  16. metaflow-stubs/metaflow_current.pyi +27 -27
  17. metaflow-stubs/mflog/mflog.pyi +1 -1
  18. metaflow-stubs/multicore_utils.pyi +1 -1
  19. metaflow-stubs/parameters.pyi +3 -3
  20. metaflow-stubs/plugins/__init__.pyi +2 -2
  21. metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
  22. metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
  23. metaflow-stubs/plugins/airflow/exception.pyi +1 -1
  24. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
  25. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  28. metaflow-stubs/plugins/argo/__init__.pyi +1 -1
  29. metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
  30. metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
  31. metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +4 -4
  33. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +7 -7
  34. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
  35. metaflow-stubs/plugins/aws/__init__.pyi +1 -1
  36. metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
  37. metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
  38. metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
  39. metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
  40. metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
  41. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +3 -3
  42. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
  43. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +1 -1
  44. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
  45. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
  46. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +1 -1
  47. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
  48. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
  49. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
  50. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
  51. metaflow-stubs/plugins/azure/__init__.pyi +1 -1
  52. metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
  53. metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
  54. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +1 -1
  55. metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
  56. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
  57. metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
  58. metaflow-stubs/plugins/cards/__init__.pyi +1 -1
  59. metaflow-stubs/plugins/cards/card_cli.pyi +3 -3
  60. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  61. metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
  62. metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
  63. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  64. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
  65. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
  67. metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
  69. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
  70. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
  71. metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
  72. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  73. metaflow-stubs/plugins/cards/exception.pyi +1 -1
  74. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  75. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  76. metaflow-stubs/plugins/datatools/local.pyi +1 -1
  77. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  78. metaflow-stubs/plugins/datatools/s3/s3.pyi +6 -6
  79. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
  80. metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
  81. metaflow-stubs/plugins/debug_logger.pyi +1 -1
  82. metaflow-stubs/plugins/debug_monitor.pyi +1 -1
  83. metaflow-stubs/plugins/environment_decorator.pyi +1 -1
  84. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  85. metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
  86. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  87. metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
  88. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +1 -1
  89. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
  90. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
  91. metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
  92. metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
  93. metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
  94. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  95. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  96. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
  97. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +3 -3
  98. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
  99. metaflow-stubs/plugins/logs_cli.pyi +2 -2
  100. metaflow-stubs/plugins/package_cli.pyi +1 -1
  101. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  102. metaflow-stubs/plugins/perimeters.pyi +1 -1
  103. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  104. metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
  105. metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
  106. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  107. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
  108. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  109. metaflow-stubs/plugins/pypi/utils.pyi +1 -1
  110. metaflow-stubs/plugins/resources_decorator.pyi +1 -1
  111. metaflow-stubs/plugins/retry_decorator.pyi +1 -1
  112. metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
  113. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
  114. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
  115. metaflow-stubs/plugins/storage_executor.pyi +1 -1
  116. metaflow-stubs/plugins/tag_cli.pyi +4 -4
  117. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
  118. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  119. metaflow-stubs/procpoll.pyi +1 -1
  120. metaflow-stubs/profilers/__init__.pyi +1 -1
  121. metaflow-stubs/pylint_wrapper.pyi +1 -1
  122. metaflow-stubs/runner/__init__.pyi +1 -1
  123. metaflow-stubs/runner/deployer.pyi +2 -2
  124. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  125. metaflow-stubs/runner/nbdeploy.pyi +1 -1
  126. metaflow-stubs/runner/nbrun.pyi +1 -1
  127. metaflow-stubs/runner/subprocess_manager.pyi +1 -1
  128. metaflow-stubs/runner/utils.pyi +1 -1
  129. metaflow-stubs/system/__init__.pyi +2 -2
  130. metaflow-stubs/system/system_logger.pyi +2 -2
  131. metaflow-stubs/system/system_monitor.pyi +1 -1
  132. metaflow-stubs/tagging_util.pyi +1 -1
  133. metaflow-stubs/tuple_util.pyi +1 -1
  134. {ob_metaflow_stubs-5.8.dist-info → ob_metaflow_stubs-5.8.2.dist-info}/METADATA +1 -1
  135. ob_metaflow_stubs-5.8.2.dist-info/RECORD +138 -0
  136. ob_metaflow_stubs-5.8.dist-info/RECORD +0 -138
  137. {ob_metaflow_stubs-5.8.dist-info → ob_metaflow_stubs-5.8.2.dist-info}/WHEEL +0 -0
  138. {ob_metaflow_stubs-5.8.dist-info → ob_metaflow_stubs-5.8.2.dist-info}/top_level.txt +0 -0
@@ -1,23 +1,23 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
3
  # MF version: 2.12.19.1+ob(v1) #
4
- # Generated on 2024-09-04T22:56:44.982024 #
4
+ # Generated on 2024-09-09T18:18:13.623870 #
5
5
  ##################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import metaflow.client.core
12
11
  import metaflow.parameters
13
- import metaflow.events
14
- import metaflow._vendor.click.types
15
- import metaflow.runner.metaflow_runner
16
12
  import datetime
17
- import metaflow.flowspec
13
+ import metaflow._vendor.click.types
14
+ import metaflow.metaflow_current
18
15
  import metaflow.datastore.inputs
16
+ import metaflow.flowspec
19
17
  import typing
20
- import metaflow.metaflow_current
18
+ import metaflow.runner.metaflow_runner
19
+ import metaflow.events
20
+ import metaflow.client.core
21
21
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
22
22
  StepFlag = typing.NewType("StepFlag", bool)
23
23
 
@@ -438,133 +438,154 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
438
438
  ...
439
439
 
440
440
  @typing.overload
441
- def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
441
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
442
442
  """
443
- Specifies a timeout for your step.
444
-
445
- This decorator is useful if this step may hang indefinitely.
446
-
447
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
448
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
449
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
450
-
451
- Note that all the values specified in parameters are added together so if you specify
452
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
443
+ Decorator prototype for all step decorators. This function gets specialized
444
+ and imported for all decorators types by _import_plugin_decorators().
445
+ """
446
+ ...
447
+
448
+ @typing.overload
449
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
450
+ ...
451
+
452
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
453
+ """
454
+ Decorator prototype for all step decorators. This function gets specialized
455
+ and imported for all decorators types by _import_plugin_decorators().
456
+ """
457
+ ...
458
+
459
+ @typing.overload
460
+ 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]]]:
461
+ """
462
+ Specifies secrets to be retrieved and injected as environment variables prior to
463
+ the execution of a step.
453
464
 
454
465
  Parameters
455
466
  ----------
456
- seconds : int, default 0
457
- Number of seconds to wait prior to timing out.
458
- minutes : int, default 0
459
- Number of minutes to wait prior to timing out.
460
- hours : int, default 0
461
- Number of hours to wait prior to timing out.
467
+ sources : List[Union[str, Dict[str, Any]]], default: []
468
+ List of secret specs, defining how the secrets are to be retrieved
462
469
  """
463
470
  ...
464
471
 
465
472
  @typing.overload
466
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
473
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
467
474
  ...
468
475
 
469
476
  @typing.overload
470
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
477
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
471
478
  ...
472
479
 
473
- def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
480
+ 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]]] = []):
474
481
  """
475
- Specifies a timeout for your step.
476
-
477
- This decorator is useful if this step may hang indefinitely.
478
-
479
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
480
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
481
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
482
-
483
- Note that all the values specified in parameters are added together so if you specify
484
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
482
+ Specifies secrets to be retrieved and injected as environment variables prior to
483
+ the execution of a step.
485
484
 
486
485
  Parameters
487
486
  ----------
488
- seconds : int, default 0
489
- Number of seconds to wait prior to timing out.
490
- minutes : int, default 0
491
- Number of minutes to wait prior to timing out.
492
- hours : int, default 0
493
- Number of hours to wait prior to timing out.
487
+ sources : List[Union[str, Dict[str, Any]]], default: []
488
+ List of secret specs, defining how the secrets are to be retrieved
494
489
  """
495
490
  ...
496
491
 
497
492
  @typing.overload
498
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
493
+ 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]]]:
499
494
  """
500
- Internal decorator to support Fast bakery
495
+ Creates a human-readable report, a Metaflow Card, after this step completes.
496
+
497
+ Note that you may add multiple `@card` decorators in a step with different parameters.
498
+
499
+ Parameters
500
+ ----------
501
+ type : str, default 'default'
502
+ Card type.
503
+ id : str, optional, default None
504
+ If multiple cards are present, use this id to identify this card.
505
+ options : Dict[str, Any], default {}
506
+ Options passed to the card. The contents depend on the card type.
507
+ timeout : int, default 45
508
+ Interrupt reporting if it takes more than this many seconds.
509
+
510
+
501
511
  """
502
512
  ...
503
513
 
504
514
  @typing.overload
505
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
515
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
506
516
  ...
507
517
 
508
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
518
+ @typing.overload
519
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
520
+ ...
521
+
522
+ 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):
509
523
  """
510
- Internal decorator to support Fast bakery
524
+ Creates a human-readable report, a Metaflow Card, after this step completes.
525
+
526
+ Note that you may add multiple `@card` decorators in a step with different parameters.
527
+
528
+ Parameters
529
+ ----------
530
+ type : str, default 'default'
531
+ Card type.
532
+ id : str, optional, default None
533
+ If multiple cards are present, use this id to identify this card.
534
+ options : Dict[str, Any], default {}
535
+ Options passed to the card. The contents depend on the card type.
536
+ timeout : int, default 45
537
+ Interrupt reporting if it takes more than this many seconds.
538
+
539
+
511
540
  """
512
541
  ...
513
542
 
514
543
  @typing.overload
515
- 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]]]:
544
+ 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]]]:
516
545
  """
517
- Specifies the Conda environment for the step.
546
+ Specifies the PyPI packages for the step.
518
547
 
519
548
  Information in this decorator will augment any
520
- attributes set in the `@conda_base` flow-level decorator. Hence,
521
- you can use `@conda_base` to set packages required by all
522
- steps and use `@conda` to specify step-specific overrides.
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.
523
552
 
524
553
  Parameters
525
554
  ----------
526
- packages : Dict[str, str], default {}
555
+ packages : Dict[str, str], default: {}
527
556
  Packages to use for this step. The key is the name of the package
528
557
  and the value is the version to use.
529
- libraries : Dict[str, str], default {}
530
- Supported for backward compatibility. When used with packages, packages will take precedence.
531
- python : str, optional, default None
558
+ python : str, optional, default: None
532
559
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
533
560
  that the version used will correspond to the version of the Python interpreter used to start the run.
534
- disabled : bool, default False
535
- If set to True, disables @conda.
536
561
  """
537
562
  ...
538
563
 
539
564
  @typing.overload
540
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
565
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
541
566
  ...
542
567
 
543
568
  @typing.overload
544
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
569
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
545
570
  ...
546
571
 
547
- 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):
572
+ 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):
548
573
  """
549
- Specifies the Conda environment for the step.
574
+ Specifies the PyPI packages for the step.
550
575
 
551
576
  Information in this decorator will augment any
552
- attributes set in the `@conda_base` flow-level decorator. Hence,
553
- you can use `@conda_base` to set packages required by all
554
- steps and use `@conda` to specify step-specific overrides.
577
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
578
+ you can use `@pypi_base` to set packages required by all
579
+ steps and use `@pypi` to specify step-specific overrides.
555
580
 
556
581
  Parameters
557
582
  ----------
558
- packages : Dict[str, str], default {}
583
+ packages : Dict[str, str], default: {}
559
584
  Packages to use for this step. The key is the name of the package
560
585
  and the value is the version to use.
561
- libraries : Dict[str, str], default {}
562
- Supported for backward compatibility. When used with packages, packages will take precedence.
563
- python : str, optional, default None
586
+ python : str, optional, default: None
564
587
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
565
588
  that the version used will correspond to the version of the Python interpreter used to start the run.
566
- disabled : bool, default False
567
- If set to True, disables @conda.
568
589
  """
569
590
  ...
570
591
 
@@ -599,6 +620,68 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
599
620
  """
600
621
  ...
601
622
 
623
+ 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, 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]]]:
624
+ """
625
+ Specifies that this step should execute on Kubernetes.
626
+
627
+ Parameters
628
+ ----------
629
+ cpu : int, default 1
630
+ Number of CPUs required for this step. If `@resources` is
631
+ also present, the maximum value from all decorators is used.
632
+ memory : int, default 4096
633
+ Memory size (in MB) required for this step. If
634
+ `@resources` is also present, the maximum value from all decorators is
635
+ used.
636
+ disk : int, default 10240
637
+ Disk size (in MB) required for this step. If
638
+ `@resources` is also present, the maximum value from all decorators is
639
+ used.
640
+ image : str, optional, default None
641
+ Docker image to use when launching on Kubernetes. If not specified, and
642
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
643
+ not, a default Docker image mapping to the current version of Python is used.
644
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
645
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
646
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
647
+ Kubernetes service account to use when launching pod in Kubernetes.
648
+ secrets : List[str], optional, default None
649
+ Kubernetes secrets to use when launching pod in Kubernetes. These
650
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
651
+ in Metaflow configuration.
652
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
653
+ Kubernetes namespace to use when launching pod in Kubernetes.
654
+ gpu : int, optional, default None
655
+ Number of GPUs required for this step. A value of zero implies that
656
+ the scheduled node should not have GPUs.
657
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
658
+ The vendor of the GPUs to be used for this step.
659
+ tolerations : List[str], default []
660
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
661
+ Kubernetes tolerations to use when launching pod in Kubernetes.
662
+ use_tmpfs : bool, default False
663
+ This enables an explicit tmpfs mount for this step.
664
+ tmpfs_tempdir : bool, default True
665
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
666
+ tmpfs_size : int, optional, default: None
667
+ The value for the size (in MiB) of the tmpfs mount for this step.
668
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
669
+ memory allocated for this step.
670
+ tmpfs_path : str, optional, default /metaflow_temp
671
+ Path to tmpfs mount for this step.
672
+ persistent_volume_claims : Dict[str, str], optional, default None
673
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
674
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
675
+ shared_memory: int, optional
676
+ Shared memory size (in MiB) required for this step
677
+ port: int, optional
678
+ Port number to specify in the Kubernetes job object
679
+ compute_pool : str, optional, default None
680
+ Compute pool to be used for for this step.
681
+ If not specified, any accessible compute pool within the perimeter is used.
682
+ """
683
+ ...
684
+
602
685
  @typing.overload
603
686
  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]]]:
604
687
  """
@@ -649,266 +732,309 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
649
732
  ...
650
733
 
651
734
  @typing.overload
652
- 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]]]:
735
+ 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]]]:
653
736
  """
654
- Specifies the number of times the task corresponding
655
- to a step needs to be retried.
737
+ Specifies the resources needed when executing this step.
656
738
 
657
- This decorator is useful for handling transient errors, such as networking issues.
658
- If your task contains operations that can't be retried safely, e.g. database updates,
659
- it is advisable to annotate it with `@retry(times=0)`.
739
+ Use `@resources` to specify the resource requirements
740
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
660
741
 
661
- This can be used in conjunction with the `@catch` decorator. The `@catch`
662
- decorator will execute a no-op task after all retries have been exhausted,
663
- ensuring that the flow execution can continue.
742
+ You can choose the compute layer on the command line by executing e.g.
743
+ ```
744
+ python myflow.py run --with batch
745
+ ```
746
+ or
747
+ ```
748
+ python myflow.py run --with kubernetes
749
+ ```
750
+ which executes the flow on the desired system using the
751
+ requirements specified in `@resources`.
664
752
 
665
753
  Parameters
666
754
  ----------
667
- times : int, default 3
668
- Number of times to retry this task.
669
- minutes_between_retries : int, default 2
670
- Number of minutes between retries.
671
- """
672
- ...
673
-
674
- @typing.overload
675
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
755
+ cpu : int, default 1
756
+ Number of CPUs required for this step.
757
+ gpu : int, default 0
758
+ Number of GPUs required for this step.
759
+ disk : int, optional, default None
760
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
761
+ memory : int, default 4096
762
+ Memory size (in MB) required for this step.
763
+ shared_memory : int, optional, default None
764
+ The value for the size (in MiB) of the /dev/shm volume for this step.
765
+ This parameter maps to the `--shm-size` option in Docker.
766
+ """
676
767
  ...
677
768
 
678
769
  @typing.overload
679
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
770
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
680
771
  ...
681
772
 
682
- def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
683
- """
684
- Specifies the number of times the task corresponding
685
- to a step needs to be retried.
686
-
687
- This decorator is useful for handling transient errors, such as networking issues.
688
- If your task contains operations that can't be retried safely, e.g. database updates,
689
- it is advisable to annotate it with `@retry(times=0)`.
690
-
691
- This can be used in conjunction with the `@catch` decorator. The `@catch`
692
- decorator will execute a no-op task after all retries have been exhausted,
693
- ensuring that the flow execution can continue.
694
-
695
- Parameters
696
- ----------
697
- times : int, default 3
698
- Number of times to retry this task.
699
- minutes_between_retries : int, default 2
700
- Number of minutes between retries.
701
- """
773
+ @typing.overload
774
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
702
775
  ...
703
776
 
704
- 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, 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]]]:
777
+ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
705
778
  """
706
- Specifies that this step should execute on Kubernetes.
779
+ Specifies the resources needed when executing this step.
780
+
781
+ Use `@resources` to specify the resource requirements
782
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
783
+
784
+ You can choose the compute layer on the command line by executing e.g.
785
+ ```
786
+ python myflow.py run --with batch
787
+ ```
788
+ or
789
+ ```
790
+ python myflow.py run --with kubernetes
791
+ ```
792
+ which executes the flow on the desired system using the
793
+ requirements specified in `@resources`.
707
794
 
708
795
  Parameters
709
796
  ----------
710
797
  cpu : int, default 1
711
- Number of CPUs required for this step. If `@resources` is
712
- also present, the maximum value from all decorators is used.
798
+ Number of CPUs required for this step.
799
+ gpu : int, default 0
800
+ Number of GPUs required for this step.
801
+ disk : int, optional, default None
802
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
713
803
  memory : int, default 4096
714
- Memory size (in MB) required for this step. If
715
- `@resources` is also present, the maximum value from all decorators is
716
- used.
717
- disk : int, default 10240
718
- Disk size (in MB) required for this step. If
719
- `@resources` is also present, the maximum value from all decorators is
720
- used.
721
- image : str, optional, default None
722
- Docker image to use when launching on Kubernetes. If not specified, and
723
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
724
- not, a default Docker image mapping to the current version of Python is used.
725
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
726
- If given, the imagePullPolicy to be applied to the Docker image of the step.
727
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
728
- Kubernetes service account to use when launching pod in Kubernetes.
729
- secrets : List[str], optional, default None
730
- Kubernetes secrets to use when launching pod in Kubernetes. These
731
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
732
- in Metaflow configuration.
733
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
734
- Kubernetes namespace to use when launching pod in Kubernetes.
735
- gpu : int, optional, default None
736
- Number of GPUs required for this step. A value of zero implies that
737
- the scheduled node should not have GPUs.
738
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
739
- The vendor of the GPUs to be used for this step.
740
- tolerations : List[str], default []
741
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
742
- Kubernetes tolerations to use when launching pod in Kubernetes.
743
- use_tmpfs : bool, default False
744
- This enables an explicit tmpfs mount for this step.
745
- tmpfs_tempdir : bool, default True
746
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
747
- tmpfs_size : int, optional, default: None
748
- The value for the size (in MiB) of the tmpfs mount for this step.
749
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
750
- memory allocated for this step.
751
- tmpfs_path : str, optional, default /metaflow_temp
752
- Path to tmpfs mount for this step.
753
- persistent_volume_claims : Dict[str, str], optional, default None
754
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
755
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
756
- shared_memory: int, optional
757
- Shared memory size (in MiB) required for this step
758
- port: int, optional
759
- Port number to specify in the Kubernetes job object
760
- compute_pool : str, optional, default None
761
- Compute pool to be used for for this step.
762
- If not specified, any accessible compute pool within the perimeter is used.
804
+ Memory size (in MB) required for this step.
805
+ shared_memory : int, optional, default None
806
+ The value for the size (in MiB) of the /dev/shm volume for this step.
807
+ This parameter maps to the `--shm-size` option in Docker.
763
808
  """
764
809
  ...
765
810
 
766
811
  @typing.overload
767
- 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]]]:
812
+ def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
768
813
  """
769
- Creates a human-readable report, a Metaflow Card, after this step completes.
814
+ Specifies a timeout for your step.
770
815
 
771
- Note that you may add multiple `@card` decorators in a step with different parameters.
816
+ This decorator is useful if this step may hang indefinitely.
772
817
 
773
- Parameters
774
- ----------
775
- type : str, default 'default'
776
- Card type.
777
- id : str, optional, default None
778
- If multiple cards are present, use this id to identify this card.
779
- options : Dict[str, Any], default {}
780
- Options passed to the card. The contents depend on the card type.
781
- timeout : int, default 45
782
- Interrupt reporting if it takes more than this many seconds.
818
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
819
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
820
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
783
821
 
822
+ Note that all the values specified in parameters are added together so if you specify
823
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
784
824
 
825
+ Parameters
826
+ ----------
827
+ seconds : int, default 0
828
+ Number of seconds to wait prior to timing out.
829
+ minutes : int, default 0
830
+ Number of minutes to wait prior to timing out.
831
+ hours : int, default 0
832
+ Number of hours to wait prior to timing out.
785
833
  """
786
834
  ...
787
835
 
788
836
  @typing.overload
789
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
837
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
790
838
  ...
791
839
 
792
840
  @typing.overload
793
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
841
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
794
842
  ...
795
843
 
796
- 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):
844
+ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
797
845
  """
798
- Creates a human-readable report, a Metaflow Card, after this step completes.
846
+ Specifies a timeout for your step.
799
847
 
800
- Note that you may add multiple `@card` decorators in a step with different parameters.
848
+ This decorator is useful if this step may hang indefinitely.
801
849
 
802
- Parameters
803
- ----------
804
- type : str, default 'default'
805
- Card type.
806
- id : str, optional, default None
807
- If multiple cards are present, use this id to identify this card.
808
- options : Dict[str, Any], default {}
809
- Options passed to the card. The contents depend on the card type.
810
- timeout : int, default 45
811
- Interrupt reporting if it takes more than this many seconds.
850
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
851
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
852
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
812
853
 
854
+ Note that all the values specified in parameters are added together so if you specify
855
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
813
856
 
857
+ Parameters
858
+ ----------
859
+ seconds : int, default 0
860
+ Number of seconds to wait prior to timing out.
861
+ minutes : int, default 0
862
+ Number of minutes to wait prior to timing out.
863
+ hours : int, default 0
864
+ Number of hours to wait prior to timing out.
814
865
  """
815
866
  ...
816
867
 
817
868
  @typing.overload
818
- 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]]]:
869
+ 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]]]:
819
870
  """
820
- Specifies secrets to be retrieved and injected as environment variables prior to
821
- the execution of a step.
871
+ Specifies the number of times the task corresponding
872
+ to a step needs to be retried.
873
+
874
+ This decorator is useful for handling transient errors, such as networking issues.
875
+ If your task contains operations that can't be retried safely, e.g. database updates,
876
+ it is advisable to annotate it with `@retry(times=0)`.
877
+
878
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
879
+ decorator will execute a no-op task after all retries have been exhausted,
880
+ ensuring that the flow execution can continue.
822
881
 
823
882
  Parameters
824
883
  ----------
825
- sources : List[Union[str, Dict[str, Any]]], default: []
826
- List of secret specs, defining how the secrets are to be retrieved
884
+ times : int, default 3
885
+ Number of times to retry this task.
886
+ minutes_between_retries : int, default 2
887
+ Number of minutes between retries.
827
888
  """
828
889
  ...
829
890
 
830
891
  @typing.overload
831
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
892
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
832
893
  ...
833
894
 
834
895
  @typing.overload
835
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
896
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
836
897
  ...
837
898
 
838
- 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]]] = []):
899
+ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
839
900
  """
840
- Specifies secrets to be retrieved and injected as environment variables prior to
841
- the execution of a step.
901
+ Specifies the number of times the task corresponding
902
+ to a step needs to be retried.
903
+
904
+ This decorator is useful for handling transient errors, such as networking issues.
905
+ If your task contains operations that can't be retried safely, e.g. database updates,
906
+ it is advisable to annotate it with `@retry(times=0)`.
907
+
908
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
909
+ decorator will execute a no-op task after all retries have been exhausted,
910
+ ensuring that the flow execution can continue.
842
911
 
843
912
  Parameters
844
913
  ----------
845
- sources : List[Union[str, Dict[str, Any]]], default: []
846
- List of secret specs, defining how the secrets are to be retrieved
914
+ times : int, default 3
915
+ Number of times to retry this task.
916
+ minutes_between_retries : int, default 2
917
+ Number of minutes between retries.
847
918
  """
848
919
  ...
849
920
 
850
921
  @typing.overload
851
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
922
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
852
923
  """
853
- Decorator prototype for all step decorators. This function gets specialized
854
- and imported for all decorators types by _import_plugin_decorators().
924
+ Internal decorator to support Fast bakery
855
925
  """
856
926
  ...
857
927
 
858
928
  @typing.overload
859
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
929
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
860
930
  ...
861
931
 
862
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
932
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
863
933
  """
864
- Decorator prototype for all step decorators. This function gets specialized
865
- and imported for all decorators types by _import_plugin_decorators().
934
+ Internal decorator to support Fast bakery
866
935
  """
867
936
  ...
868
937
 
869
938
  @typing.overload
870
- 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]]]:
939
+ 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]]]:
871
940
  """
872
- Specifies the PyPI packages for the step.
941
+ Specifies the Conda environment for the step.
873
942
 
874
943
  Information in this decorator will augment any
875
- attributes set in the `@pyi_base` flow-level decorator. Hence,
876
- you can use `@pypi_base` to set packages required by all
877
- steps and use `@pypi` to specify step-specific overrides.
944
+ attributes set in the `@conda_base` flow-level decorator. Hence,
945
+ you can use `@conda_base` to set packages required by all
946
+ steps and use `@conda` to specify step-specific overrides.
878
947
 
879
948
  Parameters
880
949
  ----------
881
- packages : Dict[str, str], default: {}
950
+ packages : Dict[str, str], default {}
882
951
  Packages to use for this step. The key is the name of the package
883
952
  and the value is the version to use.
884
- python : str, optional, default: None
953
+ libraries : Dict[str, str], default {}
954
+ Supported for backward compatibility. When used with packages, packages will take precedence.
955
+ python : str, optional, default None
885
956
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
886
957
  that the version used will correspond to the version of the Python interpreter used to start the run.
958
+ disabled : bool, default False
959
+ If set to True, disables @conda.
887
960
  """
888
961
  ...
889
962
 
890
963
  @typing.overload
891
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
964
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
892
965
  ...
893
966
 
894
967
  @typing.overload
895
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
968
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
896
969
  ...
897
970
 
898
- 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):
971
+ 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):
899
972
  """
900
- Specifies the PyPI packages for the step.
973
+ Specifies the Conda environment for the step.
901
974
 
902
975
  Information in this decorator will augment any
903
- attributes set in the `@pyi_base` flow-level decorator. Hence,
904
- you can use `@pypi_base` to set packages required by all
905
- steps and use `@pypi` to specify step-specific overrides.
976
+ attributes set in the `@conda_base` flow-level decorator. Hence,
977
+ you can use `@conda_base` to set packages required by all
978
+ steps and use `@conda` to specify step-specific overrides.
906
979
 
907
980
  Parameters
908
981
  ----------
909
- packages : Dict[str, str], default: {}
982
+ packages : Dict[str, str], default {}
910
983
  Packages to use for this step. The key is the name of the package
911
984
  and the value is the version to use.
985
+ libraries : Dict[str, str], default {}
986
+ Supported for backward compatibility. When used with packages, packages will take precedence.
987
+ python : str, optional, default None
988
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
989
+ that the version used will correspond to the version of the Python interpreter used to start the run.
990
+ disabled : bool, default False
991
+ If set to True, disables @conda.
992
+ """
993
+ ...
994
+
995
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
996
+ """
997
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
998
+
999
+ User code call
1000
+ -----------
1001
+ @nim(
1002
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1003
+ backend='managed'
1004
+ )
1005
+
1006
+ Valid backend options
1007
+ ---------------------
1008
+ - 'managed': Outerbounds selects a compute provider based on the model.
1009
+ - 🚧 'dataplane': Run in your account.
1010
+
1011
+ Valid model options
1012
+ ----------------
1013
+ - 'meta/llama3-8b-instruct': 8B parameter model
1014
+ - 'meta/llama3-70b-instruct': 70B parameter model
1015
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1016
+
1017
+ Parameters
1018
+ ----------
1019
+ models: list[NIM]
1020
+ List of NIM containers running models in sidecars.
1021
+ backend: str
1022
+ Compute provider to run the NIM container.
1023
+ """
1024
+ ...
1025
+
1026
+ @typing.overload
1027
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1028
+ """
1029
+ Specifies the PyPI packages for all steps of the flow.
1030
+
1031
+ Use `@pypi_base` to set common packages required by all
1032
+ steps and use `@pypi` to specify step-specific overrides.
1033
+ Parameters
1034
+ ----------
1035
+ packages : Dict[str, str], default: {}
1036
+ Packages to use for this flow. The key is the name of the package
1037
+ and the value is the version to use.
912
1038
  python : str, optional, default: None
913
1039
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
914
1040
  that the version used will correspond to the version of the Python interpreter used to start the run.
@@ -916,79 +1042,181 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
916
1042
  ...
917
1043
 
918
1044
  @typing.overload
919
- 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]]]:
1045
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1046
+ ...
1047
+
1048
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
920
1049
  """
921
- Specifies the resources needed when executing this step.
1050
+ Specifies the PyPI packages for all steps of the flow.
922
1051
 
923
- Use `@resources` to specify the resource requirements
924
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1052
+ Use `@pypi_base` to set common packages required by all
1053
+ steps and use `@pypi` to specify step-specific overrides.
1054
+ Parameters
1055
+ ----------
1056
+ packages : Dict[str, str], default: {}
1057
+ Packages to use for this flow. The key is the name of the package
1058
+ and the value is the version to use.
1059
+ python : str, optional, default: None
1060
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1061
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1062
+ """
1063
+ ...
1064
+
1065
+ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1066
+ """
1067
+ Specifies what flows belong to the same project.
925
1068
 
926
- You can choose the compute layer on the command line by executing e.g.
927
- ```
928
- python myflow.py run --with batch
929
- ```
930
- or
931
- ```
932
- python myflow.py run --with kubernetes
933
- ```
934
- which executes the flow on the desired system using the
935
- requirements specified in `@resources`.
1069
+ A project-specific namespace is created for all flows that
1070
+ use the same `@project(name)`.
936
1071
 
937
1072
  Parameters
938
1073
  ----------
939
- cpu : int, default 1
940
- Number of CPUs required for this step.
941
- gpu : int, default 0
942
- Number of GPUs required for this step.
943
- disk : int, optional, default None
944
- Disk size (in MB) required for this step. Only applies on Kubernetes.
945
- memory : int, default 4096
946
- Memory size (in MB) required for this step.
947
- shared_memory : int, optional, default None
948
- The value for the size (in MiB) of the /dev/shm volume for this step.
949
- This parameter maps to the `--shm-size` option in Docker.
1074
+ name : str
1075
+ Project name. Make sure that the name is unique amongst all
1076
+ projects that use the same production scheduler. The name may
1077
+ contain only lowercase alphanumeric characters and underscores.
1078
+
1079
+
950
1080
  """
951
1081
  ...
952
1082
 
953
1083
  @typing.overload
954
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1084
+ 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]]:
1085
+ """
1086
+ Specifies the times when the flow should be run when running on a
1087
+ production scheduler.
1088
+
1089
+ Parameters
1090
+ ----------
1091
+ hourly : bool, default False
1092
+ Run the workflow hourly.
1093
+ daily : bool, default True
1094
+ Run the workflow daily.
1095
+ weekly : bool, default False
1096
+ Run the workflow weekly.
1097
+ cron : str, optional, default None
1098
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1099
+ specified by this expression.
1100
+ timezone : str, optional, default None
1101
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1102
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1103
+ """
955
1104
  ...
956
1105
 
957
1106
  @typing.overload
958
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1107
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
959
1108
  ...
960
1109
 
961
- def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
1110
+ 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):
962
1111
  """
963
- Specifies the resources needed when executing this step.
1112
+ Specifies the times when the flow should be run when running on a
1113
+ production scheduler.
964
1114
 
965
- Use `@resources` to specify the resource requirements
966
- independently of the specific compute layer (`@batch`, `@kubernetes`).
1115
+ Parameters
1116
+ ----------
1117
+ hourly : bool, default False
1118
+ Run the workflow hourly.
1119
+ daily : bool, default True
1120
+ Run the workflow daily.
1121
+ weekly : bool, default False
1122
+ Run the workflow weekly.
1123
+ cron : str, optional, default None
1124
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1125
+ specified by this expression.
1126
+ timezone : str, optional, default None
1127
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1128
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1129
+ """
1130
+ ...
1131
+
1132
+ @typing.overload
1133
+ 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]]:
1134
+ """
1135
+ Specifies the Conda environment for all steps of the flow.
967
1136
 
968
- You can choose the compute layer on the command line by executing e.g.
969
- ```
970
- python myflow.py run --with batch
971
- ```
972
- or
973
- ```
974
- python myflow.py run --with kubernetes
975
- ```
976
- which executes the flow on the desired system using the
977
- requirements specified in `@resources`.
1137
+ Use `@conda_base` to set common libraries required by all
1138
+ steps and use `@conda` to specify step-specific additions.
978
1139
 
979
1140
  Parameters
980
1141
  ----------
981
- cpu : int, default 1
982
- Number of CPUs required for this step.
983
- gpu : int, default 0
984
- Number of GPUs required for this step.
985
- disk : int, optional, default None
986
- Disk size (in MB) required for this step. Only applies on Kubernetes.
987
- memory : int, default 4096
988
- Memory size (in MB) required for this step.
989
- shared_memory : int, optional, default None
990
- The value for the size (in MiB) of the /dev/shm volume for this step.
991
- This parameter maps to the `--shm-size` option in Docker.
1142
+ packages : Dict[str, str], default {}
1143
+ Packages to use for this flow. The key is the name of the package
1144
+ and the value is the version to use.
1145
+ libraries : Dict[str, str], default {}
1146
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1147
+ python : str, optional, default None
1148
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1149
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1150
+ disabled : bool, default False
1151
+ If set to True, disables Conda.
1152
+ """
1153
+ ...
1154
+
1155
+ @typing.overload
1156
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1157
+ ...
1158
+
1159
+ 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):
1160
+ """
1161
+ Specifies the Conda environment for all steps of the flow.
1162
+
1163
+ Use `@conda_base` to set common libraries required by all
1164
+ steps and use `@conda` to specify step-specific additions.
1165
+
1166
+ Parameters
1167
+ ----------
1168
+ packages : Dict[str, str], default {}
1169
+ Packages to use for this flow. The key is the name of the package
1170
+ and the value is the version to use.
1171
+ libraries : Dict[str, str], default {}
1172
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1173
+ python : str, optional, default None
1174
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1175
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1176
+ disabled : bool, default False
1177
+ If set to True, disables Conda.
1178
+ """
1179
+ ...
1180
+
1181
+ 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]]:
1182
+ """
1183
+ 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)
1184
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1185
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1186
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1187
+ starts only after all sensors finish.
1188
+
1189
+ Parameters
1190
+ ----------
1191
+ timeout : int
1192
+ Time, in seconds before the task times out and fails. (Default: 3600)
1193
+ poke_interval : int
1194
+ Time in seconds that the job should wait in between each try. (Default: 60)
1195
+ mode : str
1196
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1197
+ exponential_backoff : bool
1198
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1199
+ pool : str
1200
+ the slot pool this task should run in,
1201
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1202
+ soft_fail : bool
1203
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1204
+ name : str
1205
+ Name of the sensor on Airflow
1206
+ description : str
1207
+ Description of sensor in the Airflow UI
1208
+ bucket_key : Union[str, List[str]]
1209
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1210
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1211
+ bucket_name : str
1212
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1213
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1214
+ wildcard_match : bool
1215
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1216
+ aws_conn_id : str
1217
+ a reference to the s3 connection on Airflow. (Default: None)
1218
+ verify : bool
1219
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
992
1220
  """
993
1221
  ...
994
1222
 
@@ -1129,55 +1357,6 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
1129
1357
  """
1130
1358
  ...
1131
1359
 
1132
- @typing.overload
1133
- 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]]:
1134
- """
1135
- Specifies the times when the flow should be run when running on a
1136
- production scheduler.
1137
-
1138
- Parameters
1139
- ----------
1140
- hourly : bool, default False
1141
- Run the workflow hourly.
1142
- daily : bool, default True
1143
- Run the workflow daily.
1144
- weekly : bool, default False
1145
- Run the workflow weekly.
1146
- cron : str, optional, default None
1147
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1148
- specified by this expression.
1149
- timezone : str, optional, default None
1150
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1151
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1152
- """
1153
- ...
1154
-
1155
- @typing.overload
1156
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1157
- ...
1158
-
1159
- 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):
1160
- """
1161
- Specifies the times when the flow should be run when running on a
1162
- production scheduler.
1163
-
1164
- Parameters
1165
- ----------
1166
- hourly : bool, default False
1167
- Run the workflow hourly.
1168
- daily : bool, default True
1169
- Run the workflow daily.
1170
- weekly : bool, default False
1171
- Run the workflow weekly.
1172
- cron : str, optional, default None
1173
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1174
- specified by this expression.
1175
- timezone : str, optional, default None
1176
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1177
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1178
- """
1179
- ...
1180
-
1181
1360
  @typing.overload
1182
1361
  def trigger_on_finish(*, flow: typing.Union[str, typing.Dict[str, str], None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1183
1362
  """
@@ -1281,185 +1460,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1281
1460
  """
1282
1461
  ...
1283
1462
 
1284
- def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1285
- """
1286
- Specifies what flows belong to the same project.
1287
-
1288
- A project-specific namespace is created for all flows that
1289
- use the same `@project(name)`.
1290
-
1291
- Parameters
1292
- ----------
1293
- name : str
1294
- Project name. Make sure that the name is unique amongst all
1295
- projects that use the same production scheduler. The name may
1296
- contain only lowercase alphanumeric characters and underscores.
1297
-
1298
-
1299
- """
1300
- ...
1301
-
1302
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1303
- """
1304
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1305
-
1306
- User code call
1307
- -----------
1308
- @nim(
1309
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1310
- backend='managed'
1311
- )
1312
-
1313
- Valid backend options
1314
- ---------------------
1315
- - 'managed': Outerbounds selects a compute provider based on the model.
1316
- - 🚧 'dataplane': Run in your account.
1317
-
1318
- Valid model options
1319
- ----------------
1320
- - 'meta/llama3-8b-instruct': 8B parameter model
1321
- - 'meta/llama3-70b-instruct': 70B parameter model
1322
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1323
-
1324
- Parameters
1325
- ----------
1326
- models: list[NIM]
1327
- List of NIM containers running models in sidecars.
1328
- backend: str
1329
- Compute provider to run the NIM container.
1330
- """
1331
- ...
1332
-
1333
- @typing.overload
1334
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1335
- """
1336
- Specifies the PyPI packages for all steps of the flow.
1337
-
1338
- Use `@pypi_base` to set common packages required by all
1339
- steps and use `@pypi` to specify step-specific overrides.
1340
- Parameters
1341
- ----------
1342
- packages : Dict[str, str], default: {}
1343
- Packages to use for this flow. The key is the name of the package
1344
- and the value is the version to use.
1345
- python : str, optional, default: None
1346
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1347
- that the version used will correspond to the version of the Python interpreter used to start the run.
1348
- """
1349
- ...
1350
-
1351
- @typing.overload
1352
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1353
- ...
1354
-
1355
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1356
- """
1357
- Specifies the PyPI packages for all steps of the flow.
1358
-
1359
- Use `@pypi_base` to set common packages required by all
1360
- steps and use `@pypi` to specify step-specific overrides.
1361
- Parameters
1362
- ----------
1363
- packages : Dict[str, str], default: {}
1364
- Packages to use for this flow. The key is the name of the package
1365
- and the value is the version to use.
1366
- python : str, optional, default: None
1367
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1368
- that the version used will correspond to the version of the Python interpreter used to start the run.
1369
- """
1370
- ...
1371
-
1372
- @typing.overload
1373
- 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]]:
1374
- """
1375
- Specifies the Conda environment for all steps of the flow.
1376
-
1377
- Use `@conda_base` to set common libraries required by all
1378
- steps and use `@conda` to specify step-specific additions.
1379
-
1380
- Parameters
1381
- ----------
1382
- packages : Dict[str, str], default {}
1383
- Packages to use for this flow. The key is the name of the package
1384
- and the value is the version to use.
1385
- libraries : Dict[str, str], default {}
1386
- Supported for backward compatibility. When used with packages, packages will take precedence.
1387
- python : str, optional, default None
1388
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1389
- that the version used will correspond to the version of the Python interpreter used to start the run.
1390
- disabled : bool, default False
1391
- If set to True, disables Conda.
1392
- """
1393
- ...
1394
-
1395
- @typing.overload
1396
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1397
- ...
1398
-
1399
- 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):
1400
- """
1401
- Specifies the Conda environment for all steps of the flow.
1402
-
1403
- Use `@conda_base` to set common libraries required by all
1404
- steps and use `@conda` to specify step-specific additions.
1405
-
1406
- Parameters
1407
- ----------
1408
- packages : Dict[str, str], default {}
1409
- Packages to use for this flow. The key is the name of the package
1410
- and the value is the version to use.
1411
- libraries : Dict[str, str], default {}
1412
- Supported for backward compatibility. When used with packages, packages will take precedence.
1413
- python : str, optional, default None
1414
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1415
- that the version used will correspond to the version of the Python interpreter used to start the run.
1416
- disabled : bool, default False
1417
- If set to True, disables Conda.
1418
- """
1419
- ...
1420
-
1421
- 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]]:
1422
- """
1423
- 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)
1424
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1425
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1426
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1427
- starts only after all sensors finish.
1428
-
1429
- Parameters
1430
- ----------
1431
- timeout : int
1432
- Time, in seconds before the task times out and fails. (Default: 3600)
1433
- poke_interval : int
1434
- Time in seconds that the job should wait in between each try. (Default: 60)
1435
- mode : str
1436
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1437
- exponential_backoff : bool
1438
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1439
- pool : str
1440
- the slot pool this task should run in,
1441
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1442
- soft_fail : bool
1443
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1444
- name : str
1445
- Name of the sensor on Airflow
1446
- description : str
1447
- Description of sensor in the Airflow UI
1448
- bucket_key : Union[str, List[str]]
1449
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1450
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1451
- bucket_name : str
1452
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1453
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1454
- wildcard_match : bool
1455
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1456
- aws_conn_id : str
1457
- a reference to the s3 connection on Airflow. (Default: None)
1458
- verify : bool
1459
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
1460
- """
1461
- ...
1462
-
1463
1463
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1464
1464
  """
1465
1465
  Switch namespace to the one provided.