ob-metaflow-stubs 4.5__py2.py3-none-any.whl → 4.7__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 (145) hide show
  1. metaflow-stubs/__init__.pyi +588 -588
  2. metaflow-stubs/cards.pyi +5 -5
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/client/__init__.pyi +4 -4
  5. metaflow-stubs/client/core.pyi +7 -7
  6. metaflow-stubs/client/filecache.pyi +3 -3
  7. metaflow-stubs/clone_util.pyi +2 -2
  8. metaflow-stubs/events.pyi +2 -2
  9. metaflow-stubs/exception.pyi +2 -2
  10. metaflow-stubs/flowspec.pyi +5 -5
  11. metaflow-stubs/generated_for.txt +1 -1
  12. metaflow-stubs/includefile.pyi +5 -5
  13. metaflow-stubs/metadata/metadata.pyi +2 -2
  14. metaflow-stubs/metadata/util.pyi +2 -2
  15. metaflow-stubs/metaflow_config.pyi +2 -2
  16. metaflow-stubs/metaflow_current.pyi +18 -18
  17. metaflow-stubs/mflog/mflog.pyi +2 -2
  18. metaflow-stubs/multicore_utils.pyi +2 -2
  19. metaflow-stubs/parameters.pyi +3 -3
  20. metaflow-stubs/plugins/__init__.pyi +2 -2
  21. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  22. metaflow-stubs/plugins/airflow/airflow.pyi +3 -3
  23. metaflow-stubs/plugins/airflow/airflow_cli.pyi +3 -3
  24. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +3 -3
  29. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +4 -4
  30. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +4 -4
  31. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  32. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
  35. metaflow-stubs/plugins/argo/argo_workflows_cli.pyi +3 -3
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  37. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  38. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  39. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  40. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  41. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/batch_cli.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  45. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  47. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/production_token.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_cli.pyi +3 -3
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  56. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  57. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  60. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  61. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  62. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  63. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  64. metaflow-stubs/plugins/cards/card_cli.pyi +4 -4
  65. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  66. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  71. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/chevron/__init__.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/chevron/main.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/chevron/metadata.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/chevron/renderer.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/chevron/tokenizer.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  78. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  79. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  80. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  81. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  82. metaflow-stubs/plugins/cards/component_serializer.pyi +3 -3
  83. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  84. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  85. metaflow-stubs/plugins/datatools/__init__.pyi +3 -3
  86. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  87. metaflow-stubs/plugins/datatools/s3/__init__.pyi +3 -3
  88. metaflow-stubs/plugins/datatools/s3/s3.pyi +5 -5
  89. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  90. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  91. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  92. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  93. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  94. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  95. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  96. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  99. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  100. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  101. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  102. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/kubernetes_cli.pyi +3 -3
  106. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  107. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  109. metaflow-stubs/plugins/logs_cli.pyi +4 -4
  110. metaflow-stubs/plugins/package_cli.pyi +2 -2
  111. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  112. metaflow-stubs/plugins/perimeters.pyi +4 -2
  113. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  116. metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
  117. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  119. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  120. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  122. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  123. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  124. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  125. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  126. metaflow-stubs/plugins/tag_cli.pyi +5 -5
  127. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  128. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  129. metaflow-stubs/procpoll.pyi +2 -2
  130. metaflow-stubs/profilers/__init__.pyi +2 -2
  131. metaflow-stubs/pylint_wrapper.pyi +2 -2
  132. metaflow-stubs/runner/__init__.pyi +2 -2
  133. metaflow-stubs/runner/metaflow_runner.pyi +6 -6
  134. metaflow-stubs/runner/nbrun.pyi +2 -2
  135. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  136. metaflow-stubs/system/__init__.pyi +3 -3
  137. metaflow-stubs/system/system_logger.pyi +2 -2
  138. metaflow-stubs/system/system_monitor.pyi +3 -3
  139. metaflow-stubs/tagging_util.pyi +2 -2
  140. metaflow-stubs/tuple_util.pyi +2 -2
  141. {ob_metaflow_stubs-4.5.dist-info → ob_metaflow_stubs-4.7.dist-info}/METADATA +1 -1
  142. ob_metaflow_stubs-4.7.dist-info/RECORD +145 -0
  143. ob_metaflow_stubs-4.5.dist-info/RECORD +0 -145
  144. {ob_metaflow_stubs-4.5.dist-info → ob_metaflow_stubs-4.7.dist-info}/WHEEL +0 -0
  145. {ob_metaflow_stubs-4.5.dist-info → ob_metaflow_stubs-4.7.dist-info}/top_level.txt +0 -0
@@ -1,25 +1,25 @@
1
1
  ##################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.12.7.1+ob(v1) #
4
- # Generated on 2024-07-12T00:19:39.735632 #
3
+ # MF version: 2.12.7.2+ob(v1) #
4
+ # Generated on 2024-07-16T17:10:32.274678 #
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.plugins.datatools.s3.s3
13
11
  import typing
14
- import metaflow.events
15
- import metaflow.metaflow_current
16
- import metaflow.client.core
17
- import metaflow.runner.metaflow_runner
18
- import metaflow._vendor.click.types
19
- import metaflow.datastore.inputs
20
12
  import datetime
21
- import io
13
+ import metaflow.plugins.datatools.s3.s3
22
14
  import metaflow.parameters
15
+ import metaflow.datastore.inputs
16
+ import metaflow.runner.metaflow_runner
17
+ import io
18
+ import metaflow.metaflow_current
19
+ import metaflow.flowspec
20
+ import metaflow._vendor.click.types
21
+ import metaflow.client.core
22
+ import metaflow.events
23
23
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
24
24
  StepFlag = typing.NewType("StepFlag", bool)
25
25
 
@@ -728,115 +728,55 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
728
728
  ...
729
729
 
730
730
  @typing.overload
731
- 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]]]:
732
- """
733
- Specifies that the step will success under all circumstances.
734
-
735
- The decorator will create an optional artifact, specified by `var`, which
736
- contains the exception raised. You can use it to detect the presence
737
- of errors, indicating that all happy-path artifacts produced by the step
738
- are missing.
739
-
740
- Parameters
741
- ----------
742
- var : str, optional, default None
743
- Name of the artifact in which to store the caught exception.
744
- If not specified, the exception is not stored.
745
- print_exception : bool, default True
746
- Determines whether or not the exception is printed to
747
- stdout when caught.
748
- """
749
- ...
750
-
751
- @typing.overload
752
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
753
- ...
754
-
755
- @typing.overload
756
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
757
- ...
758
-
759
- 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):
731
+ 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]]]:
760
732
  """
761
- Specifies that the step will success under all circumstances.
733
+ Specifies the number of times the task corresponding
734
+ to a step needs to be retried.
762
735
 
763
- The decorator will create an optional artifact, specified by `var`, which
764
- contains the exception raised. You can use it to detect the presence
765
- of errors, indicating that all happy-path artifacts produced by the step
766
- are missing.
736
+ This decorator is useful for handling transient errors, such as networking issues.
737
+ If your task contains operations that can't be retried safely, e.g. database updates,
738
+ it is advisable to annotate it with `@retry(times=0)`.
767
739
 
768
- Parameters
769
- ----------
770
- var : str, optional, default None
771
- Name of the artifact in which to store the caught exception.
772
- If not specified, the exception is not stored.
773
- print_exception : bool, default True
774
- Determines whether or not the exception is printed to
775
- stdout when caught.
776
- """
777
- ...
778
-
779
- @typing.overload
780
- 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]]]:
781
- """
782
- Specifies environment variables to be set prior to the execution of a step.
740
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
741
+ decorator will execute a no-op task after all retries have been exhausted,
742
+ ensuring that the flow execution can continue.
783
743
 
784
744
  Parameters
785
745
  ----------
786
- vars : Dict[str, str], default {}
787
- Dictionary of environment variables to set.
746
+ times : int, default 3
747
+ Number of times to retry this task.
748
+ minutes_between_retries : int, default 2
749
+ Number of minutes between retries.
788
750
  """
789
751
  ...
790
752
 
791
753
  @typing.overload
792
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
754
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
793
755
  ...
794
756
 
795
757
  @typing.overload
796
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
758
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
797
759
  ...
798
760
 
799
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
761
+ 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):
800
762
  """
801
- Specifies environment variables to be set prior to the execution of a step.
763
+ Specifies the number of times the task corresponding
764
+ to a step needs to be retried.
802
765
 
803
- Parameters
804
- ----------
805
- vars : Dict[str, str], default {}
806
- Dictionary of environment variables to set.
807
- """
808
- ...
809
-
810
- @typing.overload
811
- 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]]]:
812
- """
813
- Specifies secrets to be retrieved and injected as environment variables prior to
814
- the execution of a step.
766
+ This decorator is useful for handling transient errors, such as networking issues.
767
+ If your task contains operations that can't be retried safely, e.g. database updates,
768
+ it is advisable to annotate it with `@retry(times=0)`.
815
769
 
816
- Parameters
817
- ----------
818
- sources : List[Union[str, Dict[str, Any]]], default: []
819
- List of secret specs, defining how the secrets are to be retrieved
820
- """
821
- ...
822
-
823
- @typing.overload
824
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
825
- ...
826
-
827
- @typing.overload
828
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
829
- ...
830
-
831
- 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]]] = []):
832
- """
833
- Specifies secrets to be retrieved and injected as environment variables prior to
834
- the execution of a step.
770
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
771
+ decorator will execute a no-op task after all retries have been exhausted,
772
+ ensuring that the flow execution can continue.
835
773
 
836
774
  Parameters
837
775
  ----------
838
- sources : List[Union[str, Dict[str, Any]]], default: []
839
- List of secret specs, defining how the secrets are to be retrieved
776
+ times : int, default 3
777
+ Number of times to retry this task.
778
+ minutes_between_retries : int, default 2
779
+ Number of minutes between retries.
840
780
  """
841
781
  ...
842
782
 
@@ -917,106 +857,6 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
917
857
  """
918
858
  ...
919
859
 
920
- @typing.overload
921
- 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]]]:
922
- """
923
- Creates a human-readable report, a Metaflow Card, after this step completes.
924
-
925
- Note that you may add multiple `@card` decorators in a step with different parameters.
926
-
927
- Parameters
928
- ----------
929
- type : str, default 'default'
930
- Card type.
931
- id : str, optional, default None
932
- If multiple cards are present, use this id to identify this card.
933
- options : Dict[str, Any], default {}
934
- Options passed to the card. The contents depend on the card type.
935
- timeout : int, default 45
936
- Interrupt reporting if it takes more than this many seconds.
937
-
938
-
939
- """
940
- ...
941
-
942
- @typing.overload
943
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
944
- ...
945
-
946
- @typing.overload
947
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
948
- ...
949
-
950
- 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):
951
- """
952
- Creates a human-readable report, a Metaflow Card, after this step completes.
953
-
954
- Note that you may add multiple `@card` decorators in a step with different parameters.
955
-
956
- Parameters
957
- ----------
958
- type : str, default 'default'
959
- Card type.
960
- id : str, optional, default None
961
- If multiple cards are present, use this id to identify this card.
962
- options : Dict[str, Any], default {}
963
- Options passed to the card. The contents depend on the card type.
964
- timeout : int, default 45
965
- Interrupt reporting if it takes more than this many seconds.
966
-
967
-
968
- """
969
- ...
970
-
971
- @typing.overload
972
- 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]]]:
973
- """
974
- Specifies the PyPI packages for the step.
975
-
976
- Information in this decorator will augment any
977
- attributes set in the `@pyi_base` flow-level decorator. Hence,
978
- you can use `@pypi_base` to set packages required by all
979
- steps and use `@pypi` to specify step-specific overrides.
980
-
981
- Parameters
982
- ----------
983
- packages : Dict[str, str], default: {}
984
- Packages to use for this step. The key is the name of the package
985
- and the value is the version to use.
986
- python : str, optional, default: None
987
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
988
- that the version used will correspond to the version of the Python interpreter used to start the run.
989
- """
990
- ...
991
-
992
- @typing.overload
993
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
994
- ...
995
-
996
- @typing.overload
997
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
998
- ...
999
-
1000
- 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):
1001
- """
1002
- Specifies the PyPI packages for the step.
1003
-
1004
- Information in this decorator will augment any
1005
- attributes set in the `@pyi_base` flow-level decorator. Hence,
1006
- you can use `@pypi_base` to set packages required by all
1007
- steps and use `@pypi` to specify step-specific overrides.
1008
-
1009
- Parameters
1010
- ----------
1011
- packages : Dict[str, str], default: {}
1012
- Packages to use for this step. The key is the name of the package
1013
- and the value is the version to use.
1014
- python : str, optional, default: None
1015
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1016
- that the version used will correspond to the version of the Python interpreter used to start the run.
1017
- """
1018
- ...
1019
-
1020
860
  @typing.overload
1021
861
  def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = "METAFLOW_BATCH_JOB_QUEUE", iam_role: str = "METAFLOW_ECS_S3_ACCESS_IAM_ROLE", execution_role: str = "METAFLOW_ECS_FARGATE_EXECUTION_ROLE", shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[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]]]:
1022
862
  """
@@ -1164,78 +1004,19 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1164
1004
  """
1165
1005
  ...
1166
1006
 
1167
- 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) -> 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]]]:
1007
+ @typing.overload
1008
+ 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]]]:
1168
1009
  """
1169
- Specifies that this step should execute on Kubernetes.
1170
-
1171
- Parameters
1172
- ----------
1173
- cpu : int, default 1
1174
- Number of CPUs required for this step. If `@resources` is
1175
- also present, the maximum value from all decorators is used.
1176
- memory : int, default 4096
1177
- Memory size (in MB) required for this step. If
1178
- `@resources` is also present, the maximum value from all decorators is
1179
- used.
1180
- disk : int, default 10240
1181
- Disk size (in MB) required for this step. If
1182
- `@resources` is also present, the maximum value from all decorators is
1183
- used.
1184
- image : str, optional, default None
1185
- Docker image to use when launching on Kubernetes. If not specified, and
1186
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1187
- not, a default Docker image mapping to the current version of Python is used.
1188
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1189
- If given, the imagePullPolicy to be applied to the Docker image of the step.
1190
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1191
- Kubernetes service account to use when launching pod in Kubernetes.
1192
- secrets : List[str], optional, default None
1193
- Kubernetes secrets to use when launching pod in Kubernetes. These
1194
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1195
- in Metaflow configuration.
1196
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1197
- Kubernetes namespace to use when launching pod in Kubernetes.
1198
- gpu : int, optional, default None
1199
- Number of GPUs required for this step. A value of zero implies that
1200
- the scheduled node should not have GPUs.
1201
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1202
- The vendor of the GPUs to be used for this step.
1203
- tolerations : List[str], default []
1204
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1205
- Kubernetes tolerations to use when launching pod in Kubernetes.
1206
- use_tmpfs : bool, default False
1207
- This enables an explicit tmpfs mount for this step.
1208
- tmpfs_tempdir : bool, default True
1209
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1210
- tmpfs_size : int, optional, default: None
1211
- The value for the size (in MiB) of the tmpfs mount for this step.
1212
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1213
- memory allocated for this step.
1214
- tmpfs_path : str, optional, default /metaflow_temp
1215
- Path to tmpfs mount for this step.
1216
- persistent_volume_claims : Dict[str, str], optional, default None
1217
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1218
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1219
- shared_memory: int, optional
1220
- Shared memory size (in MiB) required for this step
1221
- port: int, optional
1222
- Port number to specify in the Kubernetes job object
1223
- """
1224
- ...
1225
-
1226
- @typing.overload
1227
- 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]]]:
1228
- """
1229
- Specifies a timeout for your step.
1230
-
1231
- This decorator is useful if this step may hang indefinitely.
1232
-
1233
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1234
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
1235
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
1236
-
1237
- Note that all the values specified in parameters are added together so if you specify
1238
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1010
+ Specifies a timeout for your step.
1011
+
1012
+ This decorator is useful if this step may hang indefinitely.
1013
+
1014
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
1015
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
1016
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
1017
+
1018
+ Note that all the values specified in parameters are added together so if you specify
1019
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
1239
1020
 
1240
1021
  Parameters
1241
1022
  ----------
@@ -1281,55 +1062,94 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
1281
1062
  ...
1282
1063
 
1283
1064
  @typing.overload
1284
- 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]]]:
1065
+ 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]]]:
1285
1066
  """
1286
- Specifies the number of times the task corresponding
1287
- to a step needs to be retried.
1288
-
1289
- This decorator is useful for handling transient errors, such as networking issues.
1290
- If your task contains operations that can't be retried safely, e.g. database updates,
1291
- it is advisable to annotate it with `@retry(times=0)`.
1292
-
1293
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1294
- decorator will execute a no-op task after all retries have been exhausted,
1295
- ensuring that the flow execution can continue.
1067
+ Specifies secrets to be retrieved and injected as environment variables prior to
1068
+ the execution of a step.
1296
1069
 
1297
1070
  Parameters
1298
1071
  ----------
1299
- times : int, default 3
1300
- Number of times to retry this task.
1301
- minutes_between_retries : int, default 2
1302
- Number of minutes between retries.
1072
+ sources : List[Union[str, Dict[str, Any]]], default: []
1073
+ List of secret specs, defining how the secrets are to be retrieved
1303
1074
  """
1304
1075
  ...
1305
1076
 
1306
1077
  @typing.overload
1307
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1078
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1308
1079
  ...
1309
1080
 
1310
1081
  @typing.overload
1311
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1082
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1312
1083
  ...
1313
1084
 
1314
- 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):
1085
+ 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]]] = []):
1315
1086
  """
1316
- Specifies the number of times the task corresponding
1317
- to a step needs to be retried.
1318
-
1319
- This decorator is useful for handling transient errors, such as networking issues.
1320
- If your task contains operations that can't be retried safely, e.g. database updates,
1321
- it is advisable to annotate it with `@retry(times=0)`.
1087
+ Specifies secrets to be retrieved and injected as environment variables prior to
1088
+ the execution of a step.
1322
1089
 
1323
- This can be used in conjunction with the `@catch` decorator. The `@catch`
1324
- decorator will execute a no-op task after all retries have been exhausted,
1325
- ensuring that the flow execution can continue.
1090
+ Parameters
1091
+ ----------
1092
+ sources : List[Union[str, Dict[str, Any]]], default: []
1093
+ List of secret specs, defining how the secrets are to be retrieved
1094
+ """
1095
+ ...
1096
+
1097
+ 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) -> 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]]]:
1098
+ """
1099
+ Specifies that this step should execute on Kubernetes.
1326
1100
 
1327
1101
  Parameters
1328
1102
  ----------
1329
- times : int, default 3
1330
- Number of times to retry this task.
1331
- minutes_between_retries : int, default 2
1332
- Number of minutes between retries.
1103
+ cpu : int, default 1
1104
+ Number of CPUs required for this step. If `@resources` is
1105
+ also present, the maximum value from all decorators is used.
1106
+ memory : int, default 4096
1107
+ Memory size (in MB) required for this step. If
1108
+ `@resources` is also present, the maximum value from all decorators is
1109
+ used.
1110
+ disk : int, default 10240
1111
+ Disk size (in MB) required for this step. If
1112
+ `@resources` is also present, the maximum value from all decorators is
1113
+ used.
1114
+ image : str, optional, default None
1115
+ Docker image to use when launching on Kubernetes. If not specified, and
1116
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
1117
+ not, a default Docker image mapping to the current version of Python is used.
1118
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
1119
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
1120
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
1121
+ Kubernetes service account to use when launching pod in Kubernetes.
1122
+ secrets : List[str], optional, default None
1123
+ Kubernetes secrets to use when launching pod in Kubernetes. These
1124
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
1125
+ in Metaflow configuration.
1126
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
1127
+ Kubernetes namespace to use when launching pod in Kubernetes.
1128
+ gpu : int, optional, default None
1129
+ Number of GPUs required for this step. A value of zero implies that
1130
+ the scheduled node should not have GPUs.
1131
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
1132
+ The vendor of the GPUs to be used for this step.
1133
+ tolerations : List[str], default []
1134
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
1135
+ Kubernetes tolerations to use when launching pod in Kubernetes.
1136
+ use_tmpfs : bool, default False
1137
+ This enables an explicit tmpfs mount for this step.
1138
+ tmpfs_tempdir : bool, default True
1139
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
1140
+ tmpfs_size : int, optional, default: None
1141
+ The value for the size (in MiB) of the tmpfs mount for this step.
1142
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
1143
+ memory allocated for this step.
1144
+ tmpfs_path : str, optional, default /metaflow_temp
1145
+ Path to tmpfs mount for this step.
1146
+ persistent_volume_claims : Dict[str, str], optional, default None
1147
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
1148
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
1149
+ shared_memory: int, optional
1150
+ Shared memory size (in MiB) required for this step
1151
+ port: int, optional
1152
+ Port number to specify in the Kubernetes job object
1333
1153
  """
1334
1154
  ...
1335
1155
 
@@ -1390,82 +1210,323 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
1390
1210
  """
1391
1211
  ...
1392
1212
 
1393
- 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]]:
1213
+ @typing.overload
1214
+ 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]]]:
1394
1215
  """
1395
- 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.
1396
- 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.
1216
+ Specifies that the step will success under all circumstances.
1217
+
1218
+ The decorator will create an optional artifact, specified by `var`, which
1219
+ contains the exception raised. You can use it to detect the presence
1220
+ of errors, indicating that all happy-path artifacts produced by the step
1221
+ are missing.
1397
1222
 
1398
1223
  Parameters
1399
1224
  ----------
1400
- timeout : int
1401
- Time, in seconds before the task times out and fails. (Default: 3600)
1402
- poke_interval : int
1403
- Time in seconds that the job should wait in between each try. (Default: 60)
1404
- mode : str
1405
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1406
- exponential_backoff : bool
1407
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1408
- pool : str
1409
- the slot pool this task should run in,
1410
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1411
- soft_fail : bool
1412
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1413
- name : str
1414
- Name of the sensor on Airflow
1415
- description : str
1416
- Description of sensor in the Airflow UI
1417
- external_dag_id : str
1418
- The dag_id that contains the task you want to wait for.
1419
- external_task_ids : List[str]
1420
- The list of task_ids that you want to wait for.
1421
- If None (default value) the sensor waits for the DAG. (Default: None)
1422
- allowed_states : List[str]
1423
- Iterable of allowed states, (Default: ['success'])
1424
- failed_states : List[str]
1425
- Iterable of failed or dis-allowed states. (Default: None)
1426
- execution_delta : datetime.timedelta
1427
- time difference with the previous execution to look at,
1428
- the default is the same logical date as the current task or DAG. (Default: None)
1429
- check_existence: bool
1430
- Set to True to check if the external task exists or check if
1431
- the DAG to wait for exists. (Default: True)
1225
+ var : str, optional, default None
1226
+ Name of the artifact in which to store the caught exception.
1227
+ If not specified, the exception is not stored.
1228
+ print_exception : bool, default True
1229
+ Determines whether or not the exception is printed to
1230
+ stdout when caught.
1432
1231
  """
1433
1232
  ...
1434
1233
 
1435
- 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]]:
1234
+ @typing.overload
1235
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1236
+ ...
1237
+
1238
+ @typing.overload
1239
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1240
+ ...
1241
+
1242
+ 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):
1436
1243
  """
1437
- 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)
1438
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1439
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1440
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
1441
- starts only after all sensors finish.
1244
+ Specifies that the step will success under all circumstances.
1245
+
1246
+ The decorator will create an optional artifact, specified by `var`, which
1247
+ contains the exception raised. You can use it to detect the presence
1248
+ of errors, indicating that all happy-path artifacts produced by the step
1249
+ are missing.
1442
1250
 
1443
1251
  Parameters
1444
1252
  ----------
1445
- timeout : int
1446
- Time, in seconds before the task times out and fails. (Default: 3600)
1447
- poke_interval : int
1448
- Time in seconds that the job should wait in between each try. (Default: 60)
1449
- mode : str
1450
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1451
- exponential_backoff : bool
1452
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1453
- pool : str
1454
- the slot pool this task should run in,
1455
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1456
- soft_fail : bool
1457
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1458
- name : str
1459
- Name of the sensor on Airflow
1460
- description : str
1461
- Description of sensor in the Airflow UI
1462
- bucket_key : Union[str, List[str]]
1463
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1464
- When it's specified as a full s3:// url, please leave `bucket_name` as None
1465
- bucket_name : str
1466
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1467
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1468
- wildcard_match : bool
1253
+ var : str, optional, default None
1254
+ Name of the artifact in which to store the caught exception.
1255
+ If not specified, the exception is not stored.
1256
+ print_exception : bool, default True
1257
+ Determines whether or not the exception is printed to
1258
+ stdout when caught.
1259
+ """
1260
+ ...
1261
+
1262
+ @typing.overload
1263
+ 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]]]:
1264
+ """
1265
+ Specifies the PyPI packages for the step.
1266
+
1267
+ Information in this decorator will augment any
1268
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1269
+ you can use `@pypi_base` to set packages required by all
1270
+ steps and use `@pypi` to specify step-specific overrides.
1271
+
1272
+ Parameters
1273
+ ----------
1274
+ packages : Dict[str, str], default: {}
1275
+ Packages to use for this step. The key is the name of the package
1276
+ and the value is the version to use.
1277
+ python : str, optional, default: None
1278
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1279
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1280
+ """
1281
+ ...
1282
+
1283
+ @typing.overload
1284
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1285
+ ...
1286
+
1287
+ @typing.overload
1288
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1289
+ ...
1290
+
1291
+ 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):
1292
+ """
1293
+ Specifies the PyPI packages for the step.
1294
+
1295
+ Information in this decorator will augment any
1296
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
1297
+ you can use `@pypi_base` to set packages required by all
1298
+ steps and use `@pypi` to specify step-specific overrides.
1299
+
1300
+ Parameters
1301
+ ----------
1302
+ packages : Dict[str, str], default: {}
1303
+ Packages to use for this step. The key is the name of the package
1304
+ and the value is the version to use.
1305
+ python : str, optional, default: None
1306
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1307
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1308
+ """
1309
+ ...
1310
+
1311
+ @typing.overload
1312
+ 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]]]:
1313
+ """
1314
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1315
+
1316
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1317
+
1318
+ Parameters
1319
+ ----------
1320
+ type : str, default 'default'
1321
+ Card type.
1322
+ id : str, optional, default None
1323
+ If multiple cards are present, use this id to identify this card.
1324
+ options : Dict[str, Any], default {}
1325
+ Options passed to the card. The contents depend on the card type.
1326
+ timeout : int, default 45
1327
+ Interrupt reporting if it takes more than this many seconds.
1328
+
1329
+
1330
+ """
1331
+ ...
1332
+
1333
+ @typing.overload
1334
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1335
+ ...
1336
+
1337
+ @typing.overload
1338
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1339
+ ...
1340
+
1341
+ 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):
1342
+ """
1343
+ Creates a human-readable report, a Metaflow Card, after this step completes.
1344
+
1345
+ Note that you may add multiple `@card` decorators in a step with different parameters.
1346
+
1347
+ Parameters
1348
+ ----------
1349
+ type : str, default 'default'
1350
+ Card type.
1351
+ id : str, optional, default None
1352
+ If multiple cards are present, use this id to identify this card.
1353
+ options : Dict[str, Any], default {}
1354
+ Options passed to the card. The contents depend on the card type.
1355
+ timeout : int, default 45
1356
+ Interrupt reporting if it takes more than this many seconds.
1357
+
1358
+
1359
+ """
1360
+ ...
1361
+
1362
+ @typing.overload
1363
+ 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]]]:
1364
+ """
1365
+ Specifies environment variables to be set prior to the execution of a step.
1366
+
1367
+ Parameters
1368
+ ----------
1369
+ vars : Dict[str, str], default {}
1370
+ Dictionary of environment variables to set.
1371
+ """
1372
+ ...
1373
+
1374
+ @typing.overload
1375
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
1376
+ ...
1377
+
1378
+ @typing.overload
1379
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
1380
+ ...
1381
+
1382
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
1383
+ """
1384
+ Specifies environment variables to be set prior to the execution of a step.
1385
+
1386
+ Parameters
1387
+ ----------
1388
+ vars : Dict[str, str], default {}
1389
+ Dictionary of environment variables to set.
1390
+ """
1391
+ ...
1392
+
1393
+ @typing.overload
1394
+ 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]]:
1395
+ """
1396
+ Specifies the flow(s) that this flow depends on.
1397
+
1398
+ ```
1399
+ @trigger_on_finish(flow='FooFlow')
1400
+ ```
1401
+ or
1402
+ ```
1403
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1404
+ ```
1405
+ This decorator respects the @project decorator and triggers the flow
1406
+ when upstream runs within the same namespace complete successfully
1407
+
1408
+ Additionally, you can specify project aware upstream flow dependencies
1409
+ by specifying the fully qualified project_flow_name.
1410
+ ```
1411
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1412
+ ```
1413
+ or
1414
+ ```
1415
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1416
+ ```
1417
+
1418
+ You can also specify just the project or project branch (other values will be
1419
+ inferred from the current project or project branch):
1420
+ ```
1421
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1422
+ ```
1423
+
1424
+ Note that `branch` is typically one of:
1425
+ - `prod`
1426
+ - `user.bob`
1427
+ - `test.my_experiment`
1428
+ - `prod.staging`
1429
+
1430
+ Parameters
1431
+ ----------
1432
+ flow : Union[str, Dict[str, str]], optional, default None
1433
+ Upstream flow dependency for this flow.
1434
+ flows : List[Union[str, Dict[str, str]]], default []
1435
+ Upstream flow dependencies for this flow.
1436
+ options : Dict[str, Any], default {}
1437
+ Backend-specific configuration for tuning eventing behavior.
1438
+
1439
+
1440
+ """
1441
+ ...
1442
+
1443
+ @typing.overload
1444
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1445
+ ...
1446
+
1447
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1448
+ """
1449
+ Specifies the flow(s) that this flow depends on.
1450
+
1451
+ ```
1452
+ @trigger_on_finish(flow='FooFlow')
1453
+ ```
1454
+ or
1455
+ ```
1456
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1457
+ ```
1458
+ This decorator respects the @project decorator and triggers the flow
1459
+ when upstream runs within the same namespace complete successfully
1460
+
1461
+ Additionally, you can specify project aware upstream flow dependencies
1462
+ by specifying the fully qualified project_flow_name.
1463
+ ```
1464
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1465
+ ```
1466
+ or
1467
+ ```
1468
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1469
+ ```
1470
+
1471
+ You can also specify just the project or project branch (other values will be
1472
+ inferred from the current project or project branch):
1473
+ ```
1474
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1475
+ ```
1476
+
1477
+ Note that `branch` is typically one of:
1478
+ - `prod`
1479
+ - `user.bob`
1480
+ - `test.my_experiment`
1481
+ - `prod.staging`
1482
+
1483
+ Parameters
1484
+ ----------
1485
+ flow : Union[str, Dict[str, str]], optional, default None
1486
+ Upstream flow dependency for this flow.
1487
+ flows : List[Union[str, Dict[str, str]]], default []
1488
+ Upstream flow dependencies for this flow.
1489
+ options : Dict[str, Any], default {}
1490
+ Backend-specific configuration for tuning eventing behavior.
1491
+
1492
+
1493
+ """
1494
+ ...
1495
+
1496
+ 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]]:
1497
+ """
1498
+ 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)
1499
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1500
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1501
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1502
+ starts only after all sensors finish.
1503
+
1504
+ Parameters
1505
+ ----------
1506
+ timeout : int
1507
+ Time, in seconds before the task times out and fails. (Default: 3600)
1508
+ poke_interval : int
1509
+ Time in seconds that the job should wait in between each try. (Default: 60)
1510
+ mode : str
1511
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1512
+ exponential_backoff : bool
1513
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1514
+ pool : str
1515
+ the slot pool this task should run in,
1516
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1517
+ soft_fail : bool
1518
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1519
+ name : str
1520
+ Name of the sensor on Airflow
1521
+ description : str
1522
+ Description of sensor in the Airflow UI
1523
+ bucket_key : Union[str, List[str]]
1524
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1525
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1526
+ bucket_name : str
1527
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1528
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1529
+ wildcard_match : bool
1469
1530
  whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1470
1531
  aws_conn_id : str
1471
1532
  a reference to the s3 connection on Airflow. (Default: None)
@@ -1474,6 +1535,76 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1474
1535
  """
1475
1536
  ...
1476
1537
 
1538
+ @typing.overload
1539
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1540
+ """
1541
+ Specifies the PyPI packages for all steps of the flow.
1542
+
1543
+ Use `@pypi_base` to set common packages required by all
1544
+ steps and use `@pypi` to specify step-specific overrides.
1545
+ Parameters
1546
+ ----------
1547
+ packages : Dict[str, str], default: {}
1548
+ Packages to use for this flow. The key is the name of the package
1549
+ and the value is the version to use.
1550
+ python : str, optional, default: None
1551
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1552
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1553
+ """
1554
+ ...
1555
+
1556
+ @typing.overload
1557
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1558
+ ...
1559
+
1560
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1561
+ """
1562
+ Specifies the PyPI packages for all steps of the flow.
1563
+
1564
+ Use `@pypi_base` to set common packages required by all
1565
+ steps and use `@pypi` to specify step-specific overrides.
1566
+ Parameters
1567
+ ----------
1568
+ packages : Dict[str, str], default: {}
1569
+ Packages to use for this flow. The key is the name of the package
1570
+ and the value is the version to use.
1571
+ python : str, optional, default: None
1572
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1573
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1574
+ """
1575
+ ...
1576
+
1577
+ def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1578
+ """
1579
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1580
+
1581
+ User code call
1582
+ -----------
1583
+ @nim(
1584
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1585
+ backend='managed'
1586
+ )
1587
+
1588
+ Valid backend options
1589
+ ---------------------
1590
+ - 'managed': Outerbounds selects a compute provider based on the model.
1591
+ - 🚧 'dataplane': Run in your account.
1592
+
1593
+ Valid model options
1594
+ ----------------
1595
+ - 'meta/llama3-8b-instruct': 8B parameter model
1596
+ - 'meta/llama3-70b-instruct': 70B parameter model
1597
+ - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1598
+
1599
+ Parameters
1600
+ ----------
1601
+ models: list[NIM]
1602
+ List of NIM containers running models in sidecars.
1603
+ backend: str
1604
+ Compute provider to run the NIM container.
1605
+ """
1606
+ ...
1607
+
1477
1608
  def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1478
1609
  """
1479
1610
  Specifies what flows belong to the same project.
@@ -1492,6 +1623,97 @@ def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typ
1492
1623
  """
1493
1624
  ...
1494
1625
 
1626
+ @typing.overload
1627
+ 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]]:
1628
+ """
1629
+ Specifies the Conda environment for all steps of the flow.
1630
+
1631
+ Use `@conda_base` to set common libraries required by all
1632
+ steps and use `@conda` to specify step-specific additions.
1633
+
1634
+ Parameters
1635
+ ----------
1636
+ packages : Dict[str, str], default {}
1637
+ Packages to use for this flow. The key is the name of the package
1638
+ and the value is the version to use.
1639
+ libraries : Dict[str, str], default {}
1640
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1641
+ python : str, optional, default None
1642
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1643
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1644
+ disabled : bool, default False
1645
+ If set to True, disables Conda.
1646
+ """
1647
+ ...
1648
+
1649
+ @typing.overload
1650
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1651
+ ...
1652
+
1653
+ 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):
1654
+ """
1655
+ Specifies the Conda environment for all steps of the flow.
1656
+
1657
+ Use `@conda_base` to set common libraries required by all
1658
+ steps and use `@conda` to specify step-specific additions.
1659
+
1660
+ Parameters
1661
+ ----------
1662
+ packages : Dict[str, str], default {}
1663
+ Packages to use for this flow. The key is the name of the package
1664
+ and the value is the version to use.
1665
+ libraries : Dict[str, str], default {}
1666
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1667
+ python : str, optional, default None
1668
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1669
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1670
+ disabled : bool, default False
1671
+ If set to True, disables Conda.
1672
+ """
1673
+ ...
1674
+
1675
+ 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]]:
1676
+ """
1677
+ 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.
1678
+ 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.
1679
+
1680
+ Parameters
1681
+ ----------
1682
+ timeout : int
1683
+ Time, in seconds before the task times out and fails. (Default: 3600)
1684
+ poke_interval : int
1685
+ Time in seconds that the job should wait in between each try. (Default: 60)
1686
+ mode : str
1687
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1688
+ exponential_backoff : bool
1689
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1690
+ pool : str
1691
+ the slot pool this task should run in,
1692
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1693
+ soft_fail : bool
1694
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1695
+ name : str
1696
+ Name of the sensor on Airflow
1697
+ description : str
1698
+ Description of sensor in the Airflow UI
1699
+ external_dag_id : str
1700
+ The dag_id that contains the task you want to wait for.
1701
+ external_task_ids : List[str]
1702
+ The list of task_ids that you want to wait for.
1703
+ If None (default value) the sensor waits for the DAG. (Default: None)
1704
+ allowed_states : List[str]
1705
+ Iterable of allowed states, (Default: ['success'])
1706
+ failed_states : List[str]
1707
+ Iterable of failed or dis-allowed states. (Default: None)
1708
+ execution_delta : datetime.timedelta
1709
+ time difference with the previous execution to look at,
1710
+ the default is the same logical date as the current task or DAG. (Default: None)
1711
+ check_existence: bool
1712
+ Set to True to check if the external task exists or check if
1713
+ the DAG to wait for exists. (Default: True)
1714
+ """
1715
+ ...
1716
+
1495
1717
  @typing.overload
1496
1718
  def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1497
1719
  """
@@ -1636,228 +1858,6 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
1636
1858
  """
1637
1859
  ...
1638
1860
 
1639
- @typing.overload
1640
- 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]]:
1641
- """
1642
- Specifies the Conda environment for all steps of the flow.
1643
-
1644
- Use `@conda_base` to set common libraries required by all
1645
- steps and use `@conda` to specify step-specific additions.
1646
-
1647
- Parameters
1648
- ----------
1649
- packages : Dict[str, str], default {}
1650
- Packages to use for this flow. The key is the name of the package
1651
- and the value is the version to use.
1652
- libraries : Dict[str, str], default {}
1653
- Supported for backward compatibility. When used with packages, packages will take precedence.
1654
- python : str, optional, default None
1655
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1656
- that the version used will correspond to the version of the Python interpreter used to start the run.
1657
- disabled : bool, default False
1658
- If set to True, disables Conda.
1659
- """
1660
- ...
1661
-
1662
- @typing.overload
1663
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1664
- ...
1665
-
1666
- 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):
1667
- """
1668
- Specifies the Conda environment for all steps of the flow.
1669
-
1670
- Use `@conda_base` to set common libraries required by all
1671
- steps and use `@conda` to specify step-specific additions.
1672
-
1673
- Parameters
1674
- ----------
1675
- packages : Dict[str, str], default {}
1676
- Packages to use for this flow. The key is the name of the package
1677
- and the value is the version to use.
1678
- libraries : Dict[str, str], default {}
1679
- Supported for backward compatibility. When used with packages, packages will take precedence.
1680
- python : str, optional, default None
1681
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1682
- that the version used will correspond to the version of the Python interpreter used to start the run.
1683
- disabled : bool, default False
1684
- If set to True, disables Conda.
1685
- """
1686
- ...
1687
-
1688
- def nim(*, models: "list[NIM]", backend: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1689
- """
1690
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
1691
-
1692
- User code call
1693
- -----------
1694
- @nim(
1695
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
1696
- backend='managed'
1697
- )
1698
-
1699
- Valid backend options
1700
- ---------------------
1701
- - 'managed': Outerbounds selects a compute provider based on the model.
1702
- - 🚧 'dataplane': Run in your account.
1703
-
1704
- Valid model options
1705
- ----------------
1706
- - 'meta/llama3-8b-instruct': 8B parameter model
1707
- - 'meta/llama3-70b-instruct': 70B parameter model
1708
- - Upon request, any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
1709
-
1710
- Parameters
1711
- ----------
1712
- models: list[NIM]
1713
- List of NIM containers running models in sidecars.
1714
- backend: str
1715
- Compute provider to run the NIM container.
1716
- """
1717
- ...
1718
-
1719
- @typing.overload
1720
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1721
- """
1722
- Specifies the PyPI packages for all steps of the flow.
1723
-
1724
- Use `@pypi_base` to set common packages required by all
1725
- steps and use `@pypi` to specify step-specific overrides.
1726
- Parameters
1727
- ----------
1728
- packages : Dict[str, str], default: {}
1729
- Packages to use for this flow. The key is the name of the package
1730
- and the value is the version to use.
1731
- python : str, optional, default: None
1732
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1733
- that the version used will correspond to the version of the Python interpreter used to start the run.
1734
- """
1735
- ...
1736
-
1737
- @typing.overload
1738
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1739
- ...
1740
-
1741
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1742
- """
1743
- Specifies the PyPI packages for all steps of the flow.
1744
-
1745
- Use `@pypi_base` to set common packages required by all
1746
- steps and use `@pypi` to specify step-specific overrides.
1747
- Parameters
1748
- ----------
1749
- packages : Dict[str, str], default: {}
1750
- Packages to use for this flow. The key is the name of the package
1751
- and the value is the version to use.
1752
- python : str, optional, default: None
1753
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1754
- that the version used will correspond to the version of the Python interpreter used to start the run.
1755
- """
1756
- ...
1757
-
1758
- @typing.overload
1759
- 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]]:
1760
- """
1761
- Specifies the flow(s) that this flow depends on.
1762
-
1763
- ```
1764
- @trigger_on_finish(flow='FooFlow')
1765
- ```
1766
- or
1767
- ```
1768
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1769
- ```
1770
- This decorator respects the @project decorator and triggers the flow
1771
- when upstream runs within the same namespace complete successfully
1772
-
1773
- Additionally, you can specify project aware upstream flow dependencies
1774
- by specifying the fully qualified project_flow_name.
1775
- ```
1776
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1777
- ```
1778
- or
1779
- ```
1780
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1781
- ```
1782
-
1783
- You can also specify just the project or project branch (other values will be
1784
- inferred from the current project or project branch):
1785
- ```
1786
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1787
- ```
1788
-
1789
- Note that `branch` is typically one of:
1790
- - `prod`
1791
- - `user.bob`
1792
- - `test.my_experiment`
1793
- - `prod.staging`
1794
-
1795
- Parameters
1796
- ----------
1797
- flow : Union[str, Dict[str, str]], optional, default None
1798
- Upstream flow dependency for this flow.
1799
- flows : List[Union[str, Dict[str, str]]], default []
1800
- Upstream flow dependencies for this flow.
1801
- options : Dict[str, Any], default {}
1802
- Backend-specific configuration for tuning eventing behavior.
1803
-
1804
-
1805
- """
1806
- ...
1807
-
1808
- @typing.overload
1809
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1810
- ...
1811
-
1812
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1813
- """
1814
- Specifies the flow(s) that this flow depends on.
1815
-
1816
- ```
1817
- @trigger_on_finish(flow='FooFlow')
1818
- ```
1819
- or
1820
- ```
1821
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1822
- ```
1823
- This decorator respects the @project decorator and triggers the flow
1824
- when upstream runs within the same namespace complete successfully
1825
-
1826
- Additionally, you can specify project aware upstream flow dependencies
1827
- by specifying the fully qualified project_flow_name.
1828
- ```
1829
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1830
- ```
1831
- or
1832
- ```
1833
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1834
- ```
1835
-
1836
- You can also specify just the project or project branch (other values will be
1837
- inferred from the current project or project branch):
1838
- ```
1839
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1840
- ```
1841
-
1842
- Note that `branch` is typically one of:
1843
- - `prod`
1844
- - `user.bob`
1845
- - `test.my_experiment`
1846
- - `prod.staging`
1847
-
1848
- Parameters
1849
- ----------
1850
- flow : Union[str, Dict[str, str]], optional, default None
1851
- Upstream flow dependency for this flow.
1852
- flows : List[Union[str, Dict[str, str]]], default []
1853
- Upstream flow dependencies for this flow.
1854
- options : Dict[str, Any], default {}
1855
- Backend-specific configuration for tuning eventing behavior.
1856
-
1857
-
1858
- """
1859
- ...
1860
-
1861
1861
  def namespace(ns: typing.Optional[str]) -> typing.Optional[str]:
1862
1862
  """
1863
1863
  Switch namespace to the one provided.