ob-metaflow-stubs 6.0.3.150__py2.py3-none-any.whl → 6.0.3.151__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 (198) hide show
  1. metaflow-stubs/__init__.pyi +727 -727
  2. metaflow-stubs/cards.pyi +2 -2
  3. metaflow-stubs/cli.pyi +2 -2
  4. metaflow-stubs/cli_components/__init__.pyi +2 -2
  5. metaflow-stubs/cli_components/utils.pyi +2 -2
  6. metaflow-stubs/client/__init__.pyi +2 -2
  7. metaflow-stubs/client/core.pyi +6 -6
  8. metaflow-stubs/client/filecache.pyi +2 -2
  9. metaflow-stubs/events.pyi +2 -2
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +3 -3
  12. metaflow-stubs/generated_for.txt +1 -1
  13. metaflow-stubs/includefile.pyi +3 -3
  14. metaflow-stubs/info_file.pyi +2 -2
  15. metaflow-stubs/metadata_provider/__init__.pyi +2 -2
  16. metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
  17. metaflow-stubs/metadata_provider/metadata.pyi +2 -2
  18. metaflow-stubs/metadata_provider/util.pyi +2 -2
  19. metaflow-stubs/metaflow_config.pyi +2 -2
  20. metaflow-stubs/metaflow_current.pyi +91 -91
  21. metaflow-stubs/mf_extensions/__init__.pyi +2 -2
  22. metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
  23. metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
  24. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
  25. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
  26. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
  27. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
  28. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
  29. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
  30. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
  31. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
  32. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
  33. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
  34. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
  35. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
  36. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
  37. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
  38. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
  39. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
  40. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
  41. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
  42. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
  43. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
  44. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
  45. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
  46. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
  47. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
  48. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
  49. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
  50. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
  51. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
  52. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
  53. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
  54. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
  55. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
  56. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
  57. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
  58. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
  59. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
  60. metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
  61. metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
  62. metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
  63. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
  64. metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
  65. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
  66. metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
  67. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
  68. metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
  69. metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
  70. metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
  71. metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
  72. metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
  73. metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
  74. metaflow-stubs/multicore_utils.pyi +2 -2
  75. metaflow-stubs/parameters.pyi +3 -3
  76. metaflow-stubs/plugins/__init__.pyi +12 -12
  77. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  78. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  79. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  80. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  81. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  82. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  83. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  84. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  85. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  86. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  87. metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
  88. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
  89. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  90. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
  91. metaflow-stubs/plugins/aws/__init__.pyi +2 -2
  92. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  93. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  94. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  95. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  96. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  97. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  98. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  99. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  100. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  101. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  102. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  103. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  104. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  105. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
  106. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  107. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  108. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  109. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  110. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  111. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  112. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  113. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  114. metaflow-stubs/plugins/cards/__init__.pyi +6 -6
  115. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  116. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  117. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  118. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  120. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  121. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  122. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  123. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  124. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  125. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  126. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  127. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  128. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  129. metaflow-stubs/plugins/catch_decorator.pyi +3 -3
  130. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  131. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  132. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  133. metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
  134. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  135. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  136. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  137. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  138. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  139. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  140. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  141. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  142. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  143. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  144. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  145. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  146. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  147. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  148. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  149. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  150. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  151. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  152. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  153. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  154. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  155. metaflow-stubs/plugins/ollama/__init__.pyi +3 -3
  156. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  157. metaflow-stubs/plugins/perimeters.pyi +2 -2
  158. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  159. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  160. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  161. metaflow-stubs/plugins/pypi/conda_environment.pyi +2 -2
  162. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  163. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  164. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  165. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  166. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  167. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  168. metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
  169. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  170. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  171. metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
  172. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  173. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  174. metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
  175. metaflow-stubs/profilers/__init__.pyi +2 -2
  176. metaflow-stubs/pylint_wrapper.pyi +2 -2
  177. metaflow-stubs/runner/__init__.pyi +2 -2
  178. metaflow-stubs/runner/deployer.pyi +29 -29
  179. metaflow-stubs/runner/deployer_impl.pyi +3 -3
  180. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  181. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  182. metaflow-stubs/runner/nbrun.pyi +2 -2
  183. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  184. metaflow-stubs/runner/utils.pyi +2 -2
  185. metaflow-stubs/system/__init__.pyi +2 -2
  186. metaflow-stubs/system/system_logger.pyi +3 -3
  187. metaflow-stubs/system/system_monitor.pyi +2 -2
  188. metaflow-stubs/tagging_util.pyi +2 -2
  189. metaflow-stubs/tuple_util.pyi +2 -2
  190. metaflow-stubs/user_configs/__init__.pyi +2 -2
  191. metaflow-stubs/user_configs/config_decorators.pyi +6 -6
  192. metaflow-stubs/user_configs/config_options.pyi +2 -2
  193. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  194. {ob_metaflow_stubs-6.0.3.150.dist-info → ob_metaflow_stubs-6.0.3.151.dist-info}/METADATA +1 -1
  195. ob_metaflow_stubs-6.0.3.151.dist-info/RECORD +198 -0
  196. ob_metaflow_stubs-6.0.3.150.dist-info/RECORD +0 -198
  197. {ob_metaflow_stubs-6.0.3.150.dist-info → ob_metaflow_stubs-6.0.3.151.dist-info}/WHEEL +0 -0
  198. {ob_metaflow_stubs-6.0.3.150.dist-info → ob_metaflow_stubs-6.0.3.151.dist-info}/top_level.txt +0 -0
@@ -1,15 +1,15 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.5.1+obcheckpoint(0.1.9);ob(v1) #
4
- # Generated on 2025-03-13T17:31:16.313988 #
3
+ # MF version: 2.15.6.1+obcheckpoint(0.1.9);ob(v1) #
4
+ # Generated on 2025-03-17T20:51:51.819256 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
8
8
 
9
9
  import typing
10
10
  if typing.TYPE_CHECKING:
11
- import typing
12
11
  import datetime
12
+ import typing
13
13
  FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
14
14
  StepFlag = typing.NewType("StepFlag", bool)
15
15
 
@@ -43,9 +43,9 @@ from . import plugins as plugins
43
43
  from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
44
44
  from . import includefile as includefile
45
45
  from .includefile import IncludeFile as IncludeFile
46
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
46
47
  from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
47
48
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
48
- from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
49
49
  from . import client as client
50
50
  from .client.core import namespace as namespace
51
51
  from .client.core import get_namespace as get_namespace
@@ -149,111 +149,159 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
149
149
  """
150
150
  ...
151
151
 
152
- @typing.overload
153
- 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]]]:
152
+ def ollama(*, models: "list[Ollama]", backend: 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]]]:
154
153
  """
155
- Creates a human-readable report, a Metaflow Card, after this step completes.
154
+ This decorator is used to run Ollama APIs as Metaflow task sidecars.
156
155
 
157
- Note that you may add multiple `@card` decorators in a step with different parameters.
156
+ User code call
157
+ -----------
158
+ @ollama(
159
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
160
+ backend='local'
161
+ )
162
+
163
+ Valid backend options
164
+ ---------------------
165
+ - 'local': Run as a separate process on the local task machine.
166
+ - (TODO) 'managed': Outerbounds hosts and selects compute provider.
167
+ - (TODO) 'remote': Spin up separate instance to serve Ollama models.
168
+
169
+ Valid model options
170
+ ----------------
171
+ - 'llama3.2'
172
+ - 'llama3.3'
173
+ - any model here https://ollama.com/search
158
174
 
159
175
 
160
176
  Parameters
161
177
  ----------
162
- type : str, default 'default'
163
- Card type.
164
- id : str, optional, default None
165
- If multiple cards are present, use this id to identify this card.
166
- options : Dict[str, Any], default {}
167
- Options passed to the card. The contents depend on the card type.
168
- timeout : int, default 45
169
- Interrupt reporting if it takes more than this many seconds.
178
+ models: list[Ollama]
179
+ List of Ollama containers running models in sidecars.
180
+ backend: str
181
+ Determines where and how to run the Ollama process.
170
182
  """
171
183
  ...
172
184
 
173
185
  @typing.overload
174
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
186
+ 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]]]:
187
+ """
188
+ Specifies environment variables to be set prior to the execution of a step.
189
+
190
+
191
+ Parameters
192
+ ----------
193
+ vars : Dict[str, str], default {}
194
+ Dictionary of environment variables to set.
195
+ """
175
196
  ...
176
197
 
177
198
  @typing.overload
178
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
199
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
179
200
  ...
180
201
 
181
- 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):
202
+ @typing.overload
203
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
204
+ ...
205
+
206
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
182
207
  """
183
- Creates a human-readable report, a Metaflow Card, after this step completes.
184
-
185
- Note that you may add multiple `@card` decorators in a step with different parameters.
208
+ Specifies environment variables to be set prior to the execution of a step.
186
209
 
187
210
 
188
211
  Parameters
189
212
  ----------
190
- type : str, default 'default'
191
- Card type.
192
- id : str, optional, default None
193
- If multiple cards are present, use this id to identify this card.
194
- options : Dict[str, Any], default {}
195
- Options passed to the card. The contents depend on the card type.
196
- timeout : int, default 45
197
- Interrupt reporting if it takes more than this many seconds.
213
+ vars : Dict[str, str], default {}
214
+ Dictionary of environment variables to set.
198
215
  """
199
216
  ...
200
217
 
201
218
  @typing.overload
202
- 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]]]:
219
+ 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]]]:
203
220
  """
204
- Specifies the Conda environment for the step.
221
+ Specifies the number of times the task corresponding
222
+ to a step needs to be retried.
205
223
 
206
- Information in this decorator will augment any
207
- attributes set in the `@conda_base` flow-level decorator. Hence,
208
- you can use `@conda_base` to set packages required by all
209
- steps and use `@conda` to specify step-specific overrides.
224
+ This decorator is useful for handling transient errors, such as networking issues.
225
+ If your task contains operations that can't be retried safely, e.g. database updates,
226
+ it is advisable to annotate it with `@retry(times=0)`.
227
+
228
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
229
+ decorator will execute a no-op task after all retries have been exhausted,
230
+ ensuring that the flow execution can continue.
210
231
 
211
232
 
212
233
  Parameters
213
234
  ----------
214
- packages : Dict[str, str], default {}
215
- Packages to use for this step. The key is the name of the package
216
- and the value is the version to use.
217
- libraries : Dict[str, str], default {}
218
- Supported for backward compatibility. When used with packages, packages will take precedence.
219
- python : str, optional, default None
220
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
221
- that the version used will correspond to the version of the Python interpreter used to start the run.
222
- disabled : bool, default False
223
- If set to True, disables @conda.
235
+ times : int, default 3
236
+ Number of times to retry this task.
237
+ minutes_between_retries : int, default 2
238
+ Number of minutes between retries.
224
239
  """
225
240
  ...
226
241
 
227
242
  @typing.overload
228
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
243
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
229
244
  ...
230
245
 
231
246
  @typing.overload
232
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
247
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
233
248
  ...
234
249
 
235
- 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):
250
+ 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):
236
251
  """
237
- Specifies the Conda environment for the step.
252
+ Specifies the number of times the task corresponding
253
+ to a step needs to be retried.
238
254
 
239
- Information in this decorator will augment any
240
- attributes set in the `@conda_base` flow-level decorator. Hence,
241
- you can use `@conda_base` to set packages required by all
242
- steps and use `@conda` to specify step-specific overrides.
255
+ This decorator is useful for handling transient errors, such as networking issues.
256
+ If your task contains operations that can't be retried safely, e.g. database updates,
257
+ it is advisable to annotate it with `@retry(times=0)`.
258
+
259
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
260
+ decorator will execute a no-op task after all retries have been exhausted,
261
+ ensuring that the flow execution can continue.
243
262
 
244
263
 
245
264
  Parameters
246
265
  ----------
247
- packages : Dict[str, str], default {}
248
- Packages to use for this step. The key is the name of the package
249
- and the value is the version to use.
250
- libraries : Dict[str, str], default {}
251
- Supported for backward compatibility. When used with packages, packages will take precedence.
252
- python : str, optional, default None
253
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
254
- that the version used will correspond to the version of the Python interpreter used to start the run.
255
- disabled : bool, default False
256
- If set to True, disables @conda.
266
+ times : int, default 3
267
+ Number of times to retry this task.
268
+ minutes_between_retries : int, default 2
269
+ Number of minutes between retries.
270
+ """
271
+ ...
272
+
273
+ @typing.overload
274
+ 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]]]:
275
+ """
276
+ Specifies secrets to be retrieved and injected as environment variables prior to
277
+ the execution of a step.
278
+
279
+
280
+ Parameters
281
+ ----------
282
+ sources : List[Union[str, Dict[str, Any]]], default: []
283
+ List of secret specs, defining how the secrets are to be retrieved
284
+ """
285
+ ...
286
+
287
+ @typing.overload
288
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
289
+ ...
290
+
291
+ @typing.overload
292
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
293
+ ...
294
+
295
+ 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]]] = []):
296
+ """
297
+ Specifies secrets to be retrieved and injected as environment variables prior to
298
+ the execution of a step.
299
+
300
+
301
+ Parameters
302
+ ----------
303
+ sources : List[Union[str, Dict[str, Any]]], default: []
304
+ List of secret specs, defining how the secrets are to be retrieved
257
305
  """
258
306
  ...
259
307
 
@@ -315,398 +363,311 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
315
363
  ...
316
364
 
317
365
  @typing.overload
318
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
366
+ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
319
367
  """
320
- Decorator prototype for all step decorators. This function gets specialized
321
- and imported for all decorators types by _import_plugin_decorators().
368
+ Enables loading / saving of models within a step.
369
+
370
+
371
+
372
+ Parameters
373
+ ----------
374
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
375
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
376
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
377
+ - `current.checkpoint`
378
+ - `current.model`
379
+ - `current.huggingface_hub`
380
+
381
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
382
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
383
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
384
+
385
+ temp_dir_root : str, default: None
386
+ The root directory under which `current.model.loaded` will store loaded models
322
387
  """
323
388
  ...
324
389
 
325
390
  @typing.overload
326
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
391
+ def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
327
392
  ...
328
393
 
329
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
330
- """
331
- Decorator prototype for all step decorators. This function gets specialized
332
- and imported for all decorators types by _import_plugin_decorators().
333
- """
394
+ @typing.overload
395
+ def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
334
396
  ...
335
397
 
336
- def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> 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]]]:
398
+ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
337
399
  """
338
- This decorator is used to run NIM containers in Metaflow tasks as sidecars.
339
-
340
- User code call
341
- -----------
342
- @nim(
343
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
344
- backend='managed'
345
- )
346
-
347
- Valid backend options
348
- ---------------------
349
- - 'managed': Outerbounds selects a compute provider based on the model.
400
+ Enables loading / saving of models within a step.
350
401
 
351
- Valid model options
352
- ----------------
353
- - 'meta/llama3-8b-instruct': 8B parameter model
354
- - 'meta/llama3-70b-instruct': 70B parameter model
355
- - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
356
402
 
357
403
 
358
404
  Parameters
359
405
  ----------
360
- models: list[NIM]
361
- List of NIM containers running models in sidecars.
362
- backend: str
363
- Compute provider to run the NIM container.
364
- queue_timeout : int
365
- Time to keep the job in NVCF's queue.
406
+ load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
407
+ Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
408
+ These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
409
+ - `current.checkpoint`
410
+ - `current.model`
411
+ - `current.huggingface_hub`
412
+
413
+ If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
414
+ the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
415
+ If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
416
+
417
+ temp_dir_root : str, default: None
418
+ The root directory under which `current.model.loaded` will store loaded models
366
419
  """
367
420
  ...
368
421
 
369
- @typing.overload
370
- 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]]]:
422
+ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', 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, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> 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]]]:
371
423
  """
372
- Specifies the number of times the task corresponding
373
- to a step needs to be retried.
374
-
375
- This decorator is useful for handling transient errors, such as networking issues.
376
- If your task contains operations that can't be retried safely, e.g. database updates,
377
- it is advisable to annotate it with `@retry(times=0)`.
378
-
379
- This can be used in conjunction with the `@catch` decorator. The `@catch`
380
- decorator will execute a no-op task after all retries have been exhausted,
381
- ensuring that the flow execution can continue.
424
+ Specifies that this step should execute on Kubernetes.
382
425
 
383
426
 
384
427
  Parameters
385
428
  ----------
386
- times : int, default 3
387
- Number of times to retry this task.
388
- minutes_between_retries : int, default 2
389
- Number of minutes between retries.
429
+ cpu : int, default 1
430
+ Number of CPUs required for this step. If `@resources` is
431
+ also present, the maximum value from all decorators is used.
432
+ memory : int, default 4096
433
+ Memory size (in MB) required for this step. If
434
+ `@resources` is also present, the maximum value from all decorators is
435
+ used.
436
+ disk : int, default 10240
437
+ Disk size (in MB) required for this step. If
438
+ `@resources` is also present, the maximum value from all decorators is
439
+ used.
440
+ image : str, optional, default None
441
+ Docker image to use when launching on Kubernetes. If not specified, and
442
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
443
+ not, a default Docker image mapping to the current version of Python is used.
444
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
445
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
446
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
447
+ Kubernetes service account to use when launching pod in Kubernetes.
448
+ secrets : List[str], optional, default None
449
+ Kubernetes secrets to use when launching pod in Kubernetes. These
450
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
451
+ in Metaflow configuration.
452
+ node_selector: Union[Dict[str,str], str], optional, default None
453
+ Kubernetes node selector(s) to apply to the pod running the task.
454
+ Can be passed in as a comma separated string of values e.g.
455
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
456
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
457
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
458
+ Kubernetes namespace to use when launching pod in Kubernetes.
459
+ gpu : int, optional, default None
460
+ Number of GPUs required for this step. A value of zero implies that
461
+ the scheduled node should not have GPUs.
462
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
463
+ The vendor of the GPUs to be used for this step.
464
+ tolerations : List[str], default []
465
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
466
+ Kubernetes tolerations to use when launching pod in Kubernetes.
467
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
468
+ Kubernetes labels to use when launching pod in Kubernetes.
469
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
470
+ Kubernetes annotations to use when launching pod in Kubernetes.
471
+ use_tmpfs : bool, default False
472
+ This enables an explicit tmpfs mount for this step.
473
+ tmpfs_tempdir : bool, default True
474
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
475
+ tmpfs_size : int, optional, default: None
476
+ The value for the size (in MiB) of the tmpfs mount for this step.
477
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
478
+ memory allocated for this step.
479
+ tmpfs_path : str, optional, default /metaflow_temp
480
+ Path to tmpfs mount for this step.
481
+ persistent_volume_claims : Dict[str, str], optional, default None
482
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
483
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
484
+ shared_memory: int, optional
485
+ Shared memory size (in MiB) required for this step
486
+ port: int, optional
487
+ Port number to specify in the Kubernetes job object
488
+ compute_pool : str, optional, default None
489
+ Compute pool to be used for for this step.
490
+ If not specified, any accessible compute pool within the perimeter is used.
491
+ hostname_resolution_timeout: int, default 10 * 60
492
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
493
+ Only applicable when @parallel is used.
494
+ qos: str, default: Burstable
495
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
390
496
  """
391
497
  ...
392
498
 
393
499
  @typing.overload
394
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
500
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
501
+ """
502
+ Decorator prototype for all step decorators. This function gets specialized
503
+ and imported for all decorators types by _import_plugin_decorators().
504
+ """
395
505
  ...
396
506
 
397
507
  @typing.overload
398
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
508
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
399
509
  ...
400
510
 
401
- 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):
511
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
402
512
  """
403
- Specifies the number of times the task corresponding
404
- to a step needs to be retried.
405
-
406
- This decorator is useful for handling transient errors, such as networking issues.
407
- If your task contains operations that can't be retried safely, e.g. database updates,
408
- it is advisable to annotate it with `@retry(times=0)`.
409
-
410
- This can be used in conjunction with the `@catch` decorator. The `@catch`
411
- decorator will execute a no-op task after all retries have been exhausted,
412
- ensuring that the flow execution can continue.
413
-
414
-
415
- Parameters
416
- ----------
417
- times : int, default 3
418
- Number of times to retry this task.
419
- minutes_between_retries : int, default 2
420
- Number of minutes between retries.
513
+ Decorator prototype for all step decorators. This function gets specialized
514
+ and imported for all decorators types by _import_plugin_decorators().
421
515
  """
422
516
  ...
423
517
 
424
518
  @typing.overload
425
- 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]]]:
519
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
426
520
  """
427
- Specifies the PyPI packages for the step.
521
+ Internal decorator to support Fast bakery
522
+ """
523
+ ...
524
+
525
+ @typing.overload
526
+ def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
527
+ ...
528
+
529
+ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
530
+ """
531
+ Internal decorator to support Fast bakery
532
+ """
533
+ ...
534
+
535
+ @typing.overload
536
+ 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]]]:
537
+ """
538
+ Specifies the Conda environment for the step.
428
539
 
429
540
  Information in this decorator will augment any
430
- attributes set in the `@pyi_base` flow-level decorator. Hence,
431
- you can use `@pypi_base` to set packages required by all
432
- steps and use `@pypi` to specify step-specific overrides.
541
+ attributes set in the `@conda_base` flow-level decorator. Hence,
542
+ you can use `@conda_base` to set packages required by all
543
+ steps and use `@conda` to specify step-specific overrides.
433
544
 
434
545
 
435
546
  Parameters
436
547
  ----------
437
- packages : Dict[str, str], default: {}
548
+ packages : Dict[str, str], default {}
438
549
  Packages to use for this step. The key is the name of the package
439
550
  and the value is the version to use.
440
- python : str, optional, default: None
551
+ libraries : Dict[str, str], default {}
552
+ Supported for backward compatibility. When used with packages, packages will take precedence.
553
+ python : str, optional, default None
441
554
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
442
555
  that the version used will correspond to the version of the Python interpreter used to start the run.
556
+ disabled : bool, default False
557
+ If set to True, disables @conda.
443
558
  """
444
559
  ...
445
560
 
446
561
  @typing.overload
447
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
562
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
448
563
  ...
449
564
 
450
565
  @typing.overload
451
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
566
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
452
567
  ...
453
568
 
454
- 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):
569
+ 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):
455
570
  """
456
- Specifies the PyPI packages for the step.
571
+ Specifies the Conda environment for the step.
457
572
 
458
573
  Information in this decorator will augment any
459
- attributes set in the `@pyi_base` flow-level decorator. Hence,
460
- you can use `@pypi_base` to set packages required by all
461
- steps and use `@pypi` to specify step-specific overrides.
574
+ attributes set in the `@conda_base` flow-level decorator. Hence,
575
+ you can use `@conda_base` to set packages required by all
576
+ steps and use `@conda` to specify step-specific overrides.
462
577
 
463
578
 
464
579
  Parameters
465
580
  ----------
466
- packages : Dict[str, str], default: {}
581
+ packages : Dict[str, str], default {}
467
582
  Packages to use for this step. The key is the name of the package
468
583
  and the value is the version to use.
469
- python : str, optional, default: None
584
+ libraries : Dict[str, str], default {}
585
+ Supported for backward compatibility. When used with packages, packages will take precedence.
586
+ python : str, optional, default None
470
587
  Version of Python to use, e.g. '3.7.4'. A default value of None implies
471
588
  that the version used will correspond to the version of the Python interpreter used to start the run.
589
+ disabled : bool, default False
590
+ If set to True, disables @conda.
472
591
  """
473
592
  ...
474
593
 
475
594
  @typing.overload
476
- 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]]]:
595
+ 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]]]:
477
596
  """
478
- Specifies that the step will success under all circumstances.
597
+ Specifies a timeout for your step.
479
598
 
480
- The decorator will create an optional artifact, specified by `var`, which
481
- contains the exception raised. You can use it to detect the presence
482
- of errors, indicating that all happy-path artifacts produced by the step
483
- are missing.
599
+ This decorator is useful if this step may hang indefinitely.
600
+
601
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
602
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
603
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
604
+
605
+ Note that all the values specified in parameters are added together so if you specify
606
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
484
607
 
485
608
 
486
609
  Parameters
487
610
  ----------
488
- var : str, optional, default None
489
- Name of the artifact in which to store the caught exception.
490
- If not specified, the exception is not stored.
491
- print_exception : bool, default True
492
- Determines whether or not the exception is printed to
493
- stdout when caught.
611
+ seconds : int, default 0
612
+ Number of seconds to wait prior to timing out.
613
+ minutes : int, default 0
614
+ Number of minutes to wait prior to timing out.
615
+ hours : int, default 0
616
+ Number of hours to wait prior to timing out.
494
617
  """
495
618
  ...
496
619
 
497
620
  @typing.overload
498
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
621
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
499
622
  ...
500
623
 
501
624
  @typing.overload
502
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
625
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
503
626
  ...
504
627
 
505
- 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):
628
+ 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):
506
629
  """
507
- Specifies that the step will success under all circumstances.
630
+ Specifies a timeout for your step.
508
631
 
509
- The decorator will create an optional artifact, specified by `var`, which
510
- contains the exception raised. You can use it to detect the presence
511
- of errors, indicating that all happy-path artifacts produced by the step
512
- are missing.
632
+ This decorator is useful if this step may hang indefinitely.
513
633
 
634
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
635
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
636
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
514
637
 
515
- Parameters
516
- ----------
517
- var : str, optional, default None
518
- Name of the artifact in which to store the caught exception.
519
- If not specified, the exception is not stored.
520
- print_exception : bool, default True
521
- Determines whether or not the exception is printed to
522
- stdout when caught.
523
- """
524
- ...
525
-
526
- def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], 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]]]:
527
- """
528
- Decorator that helps cache, version and store models/datasets from huggingface hub.
638
+ Note that all the values specified in parameters are added together so if you specify
639
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
529
640
 
530
641
 
531
642
  Parameters
532
643
  ----------
533
- temp_dir_root : str, optional
534
- The root directory that will hold the temporary directory where objects will be downloaded.
535
-
536
- load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
537
- The list of repos (models/datasets) to load.
538
-
539
- Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
540
-
541
- - If repo (model/dataset) is not found in the datastore:
542
- - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
543
- - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
544
- - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
545
-
546
- - If repo is found in the datastore:
547
- - Loads it directly from datastore to local path (can be temporary directory or specified path)
644
+ seconds : int, default 0
645
+ Number of seconds to wait prior to timing out.
646
+ minutes : int, default 0
647
+ Number of minutes to wait prior to timing out.
648
+ hours : int, default 0
649
+ Number of hours to wait prior to timing out.
548
650
  """
549
651
  ...
550
652
 
551
653
  @typing.overload
552
- def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
654
+ def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, 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]]]:
553
655
  """
554
- Enables loading / saving of models within a step.
656
+ Specifies the resources needed when executing this step.
555
657
 
658
+ Use `@resources` to specify the resource requirements
659
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
556
660
 
557
-
558
- Parameters
559
- ----------
560
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
561
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
562
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
563
- - `current.checkpoint`
564
- - `current.model`
565
- - `current.huggingface_hub`
566
-
567
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
568
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
569
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
570
-
571
- temp_dir_root : str, default: None
572
- The root directory under which `current.model.loaded` will store loaded models
573
- """
574
- ...
575
-
576
- @typing.overload
577
- def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
578
- ...
579
-
580
- @typing.overload
581
- def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
582
- ...
583
-
584
- def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
585
- """
586
- Enables loading / saving of models within a step.
587
-
588
-
589
-
590
- Parameters
591
- ----------
592
- load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
593
- Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
594
- These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
595
- - `current.checkpoint`
596
- - `current.model`
597
- - `current.huggingface_hub`
598
-
599
- If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
600
- the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
601
- If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
602
-
603
- temp_dir_root : str, default: None
604
- The root directory under which `current.model.loaded` will store loaded models
605
- """
606
- ...
607
-
608
- @typing.overload
609
- 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]]]:
610
- """
611
- Specifies secrets to be retrieved and injected as environment variables prior to
612
- the execution of a step.
613
-
614
-
615
- Parameters
616
- ----------
617
- sources : List[Union[str, Dict[str, Any]]], default: []
618
- List of secret specs, defining how the secrets are to be retrieved
619
- """
620
- ...
621
-
622
- @typing.overload
623
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
624
- ...
625
-
626
- @typing.overload
627
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
628
- ...
629
-
630
- 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]]] = []):
631
- """
632
- Specifies secrets to be retrieved and injected as environment variables prior to
633
- the execution of a step.
634
-
635
-
636
- Parameters
637
- ----------
638
- sources : List[Union[str, Dict[str, Any]]], default: []
639
- List of secret specs, defining how the secrets are to be retrieved
640
- """
641
- ...
642
-
643
- def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> 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]]]:
644
- """
645
- Specifies that this step should execute on DGX cloud.
646
-
647
-
648
- Parameters
649
- ----------
650
- gpu : int
651
- Number of GPUs to use.
652
- gpu_type : str
653
- Type of Nvidia GPU to use.
654
- queue_timeout : int
655
- Time to keep the job in NVCF's queue.
656
- """
657
- ...
658
-
659
- def ollama(*, models: "list[Ollama]", backend: 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]]]:
660
- """
661
- This decorator is used to run Ollama APIs as Metaflow task sidecars.
662
-
663
- User code call
664
- -----------
665
- @ollama(
666
- models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
667
- backend='local'
668
- )
669
-
670
- Valid backend options
671
- ---------------------
672
- - 'local': Run as a separate process on the local task machine.
673
- - (TODO) 'managed': Outerbounds hosts and selects compute provider.
674
- - (TODO) 'remote': Spin up separate instance to serve Ollama models.
675
-
676
- Valid model options
677
- ----------------
678
- - 'llama3.2'
679
- - 'llama3.3'
680
- - any model here https://ollama.com/search
681
-
682
-
683
- Parameters
684
- ----------
685
- models: list[Ollama]
686
- List of Ollama containers running models in sidecars.
687
- backend: str
688
- Determines where and how to run the Ollama process.
689
- """
690
- ...
691
-
692
- @typing.overload
693
- def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, 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]]]:
694
- """
695
- Specifies the resources needed when executing this step.
696
-
697
- Use `@resources` to specify the resource requirements
698
- independently of the specific compute layer (`@batch`, `@kubernetes`).
699
-
700
- You can choose the compute layer on the command line by executing e.g.
701
- ```
702
- python myflow.py run --with batch
703
- ```
704
- or
705
- ```
706
- python myflow.py run --with kubernetes
707
- ```
708
- which executes the flow on the desired system using the
709
- requirements specified in `@resources`.
661
+ You can choose the compute layer on the command line by executing e.g.
662
+ ```
663
+ python myflow.py run --with batch
664
+ ```
665
+ or
666
+ ```
667
+ python myflow.py run --with kubernetes
668
+ ```
669
+ which executes the flow on the desired system using the
670
+ requirements specified in `@resources`.
710
671
 
711
672
 
712
673
  Parameters
@@ -768,372 +729,448 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
768
729
  """
769
730
  ...
770
731
 
771
- @typing.overload
772
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
773
- """
774
- Internal decorator to support Fast bakery
775
- """
776
- ...
777
-
778
- @typing.overload
779
- def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
780
- ...
781
-
782
- def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
732
+ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], 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]]]:
783
733
  """
784
- Internal decorator to support Fast bakery
734
+ Decorator that helps cache, version and store models/datasets from huggingface hub.
735
+
736
+
737
+ Parameters
738
+ ----------
739
+ temp_dir_root : str, optional
740
+ The root directory that will hold the temporary directory where objects will be downloaded.
741
+
742
+ load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
743
+ The list of repos (models/datasets) to load.
744
+
745
+ Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
746
+
747
+ - If repo (model/dataset) is not found in the datastore:
748
+ - Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
749
+ - Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
750
+ - All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
751
+
752
+ - If repo is found in the datastore:
753
+ - Loads it directly from datastore to local path (can be temporary directory or specified path)
785
754
  """
786
755
  ...
787
756
 
788
757
  @typing.overload
789
- 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]]]:
758
+ 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]]]:
790
759
  """
791
- Specifies environment variables to be set prior to the execution of a step.
760
+ Creates a human-readable report, a Metaflow Card, after this step completes.
761
+
762
+ Note that you may add multiple `@card` decorators in a step with different parameters.
792
763
 
793
764
 
794
765
  Parameters
795
766
  ----------
796
- vars : Dict[str, str], default {}
797
- Dictionary of environment variables to set.
767
+ type : str, default 'default'
768
+ Card type.
769
+ id : str, optional, default None
770
+ If multiple cards are present, use this id to identify this card.
771
+ options : Dict[str, Any], default {}
772
+ Options passed to the card. The contents depend on the card type.
773
+ timeout : int, default 45
774
+ Interrupt reporting if it takes more than this many seconds.
798
775
  """
799
776
  ...
800
777
 
801
778
  @typing.overload
802
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
779
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
803
780
  ...
804
781
 
805
782
  @typing.overload
806
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
783
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
807
784
  ...
808
785
 
809
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
786
+ 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):
810
787
  """
811
- Specifies environment variables to be set prior to the execution of a step.
788
+ Creates a human-readable report, a Metaflow Card, after this step completes.
789
+
790
+ Note that you may add multiple `@card` decorators in a step with different parameters.
812
791
 
813
792
 
814
793
  Parameters
815
794
  ----------
816
- vars : Dict[str, str], default {}
817
- Dictionary of environment variables to set.
795
+ type : str, default 'default'
796
+ Card type.
797
+ id : str, optional, default None
798
+ If multiple cards are present, use this id to identify this card.
799
+ options : Dict[str, Any], default {}
800
+ Options passed to the card. The contents depend on the card type.
801
+ timeout : int, default 45
802
+ Interrupt reporting if it takes more than this many seconds.
818
803
  """
819
804
  ...
820
805
 
821
806
  @typing.overload
822
- 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]]]:
807
+ 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]]]:
823
808
  """
824
- Specifies a timeout for your step.
825
-
826
- This decorator is useful if this step may hang indefinitely.
827
-
828
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
829
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
830
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
809
+ Specifies the PyPI packages for the step.
831
810
 
832
- Note that all the values specified in parameters are added together so if you specify
833
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
811
+ Information in this decorator will augment any
812
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
813
+ you can use `@pypi_base` to set packages required by all
814
+ steps and use `@pypi` to specify step-specific overrides.
834
815
 
835
816
 
836
817
  Parameters
837
818
  ----------
838
- seconds : int, default 0
839
- Number of seconds to wait prior to timing out.
840
- minutes : int, default 0
841
- Number of minutes to wait prior to timing out.
842
- hours : int, default 0
843
- Number of hours to wait prior to timing out.
819
+ packages : Dict[str, str], default: {}
820
+ Packages to use for this step. The key is the name of the package
821
+ and the value is the version to use.
822
+ python : str, optional, default: None
823
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
824
+ that the version used will correspond to the version of the Python interpreter used to start the run.
844
825
  """
845
826
  ...
846
827
 
847
828
  @typing.overload
848
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
829
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
849
830
  ...
850
831
 
851
832
  @typing.overload
852
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
833
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
853
834
  ...
854
835
 
855
- 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):
836
+ 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):
856
837
  """
857
- Specifies a timeout for your step.
838
+ Specifies the PyPI packages for the step.
858
839
 
859
- This decorator is useful if this step may hang indefinitely.
840
+ Information in this decorator will augment any
841
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
842
+ you can use `@pypi_base` to set packages required by all
843
+ steps and use `@pypi` to specify step-specific overrides.
860
844
 
861
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
862
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
863
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
864
845
 
865
- Note that all the values specified in parameters are added together so if you specify
866
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
846
+ Parameters
847
+ ----------
848
+ packages : Dict[str, str], default: {}
849
+ Packages to use for this step. The key is the name of the package
850
+ and the value is the version to use.
851
+ python : str, optional, default: None
852
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
853
+ that the version used will correspond to the version of the Python interpreter used to start the run.
854
+ """
855
+ ...
856
+
857
+ def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> 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]]]:
858
+ """
859
+ This decorator is used to run NIM containers in Metaflow tasks as sidecars.
860
+
861
+ User code call
862
+ -----------
863
+ @nim(
864
+ models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
865
+ backend='managed'
866
+ )
867
+
868
+ Valid backend options
869
+ ---------------------
870
+ - 'managed': Outerbounds selects a compute provider based on the model.
871
+
872
+ Valid model options
873
+ ----------------
874
+ - 'meta/llama3-8b-instruct': 8B parameter model
875
+ - 'meta/llama3-70b-instruct': 70B parameter model
876
+ - any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
867
877
 
868
878
 
869
879
  Parameters
870
880
  ----------
871
- seconds : int, default 0
872
- Number of seconds to wait prior to timing out.
873
- minutes : int, default 0
874
- Number of minutes to wait prior to timing out.
875
- hours : int, default 0
876
- Number of hours to wait prior to timing out.
881
+ models: list[NIM]
882
+ List of NIM containers running models in sidecars.
883
+ backend: str
884
+ Compute provider to run the NIM container.
885
+ queue_timeout : int
886
+ Time to keep the job in NVCF's queue.
877
887
  """
878
888
  ...
879
889
 
880
- def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', 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, hostname_resolution_timeout: int = 600, qos: str = 'Burstable') -> 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]]]:
890
+ @typing.overload
891
+ 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]]]:
881
892
  """
882
- Specifies that this step should execute on Kubernetes.
893
+ Specifies that the step will success under all circumstances.
894
+
895
+ The decorator will create an optional artifact, specified by `var`, which
896
+ contains the exception raised. You can use it to detect the presence
897
+ of errors, indicating that all happy-path artifacts produced by the step
898
+ are missing.
883
899
 
884
900
 
885
901
  Parameters
886
902
  ----------
887
- cpu : int, default 1
888
- Number of CPUs required for this step. If `@resources` is
889
- also present, the maximum value from all decorators is used.
890
- memory : int, default 4096
891
- Memory size (in MB) required for this step. If
892
- `@resources` is also present, the maximum value from all decorators is
893
- used.
894
- disk : int, default 10240
895
- Disk size (in MB) required for this step. If
896
- `@resources` is also present, the maximum value from all decorators is
897
- used.
898
- image : str, optional, default None
899
- Docker image to use when launching on Kubernetes. If not specified, and
900
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
901
- not, a default Docker image mapping to the current version of Python is used.
902
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
903
- If given, the imagePullPolicy to be applied to the Docker image of the step.
904
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
905
- Kubernetes service account to use when launching pod in Kubernetes.
906
- secrets : List[str], optional, default None
907
- Kubernetes secrets to use when launching pod in Kubernetes. These
908
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
909
- in Metaflow configuration.
910
- node_selector: Union[Dict[str,str], str], optional, default None
911
- Kubernetes node selector(s) to apply to the pod running the task.
912
- Can be passed in as a comma separated string of values e.g.
913
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
914
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
915
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
916
- Kubernetes namespace to use when launching pod in Kubernetes.
917
- gpu : int, optional, default None
918
- Number of GPUs required for this step. A value of zero implies that
919
- the scheduled node should not have GPUs.
920
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
921
- The vendor of the GPUs to be used for this step.
922
- tolerations : List[str], default []
923
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
924
- Kubernetes tolerations to use when launching pod in Kubernetes.
925
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
926
- Kubernetes labels to use when launching pod in Kubernetes.
927
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
928
- Kubernetes annotations to use when launching pod in Kubernetes.
929
- use_tmpfs : bool, default False
930
- This enables an explicit tmpfs mount for this step.
931
- tmpfs_tempdir : bool, default True
932
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
933
- tmpfs_size : int, optional, default: None
934
- The value for the size (in MiB) of the tmpfs mount for this step.
935
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
936
- memory allocated for this step.
937
- tmpfs_path : str, optional, default /metaflow_temp
938
- Path to tmpfs mount for this step.
939
- persistent_volume_claims : Dict[str, str], optional, default None
940
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
941
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
942
- shared_memory: int, optional
943
- Shared memory size (in MiB) required for this step
944
- port: int, optional
945
- Port number to specify in the Kubernetes job object
946
- compute_pool : str, optional, default None
947
- Compute pool to be used for for this step.
948
- If not specified, any accessible compute pool within the perimeter is used.
949
- hostname_resolution_timeout: int, default 10 * 60
950
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
951
- Only applicable when @parallel is used.
952
- qos: str, default: Burstable
953
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
903
+ var : str, optional, default None
904
+ Name of the artifact in which to store the caught exception.
905
+ If not specified, the exception is not stored.
906
+ print_exception : bool, default True
907
+ Determines whether or not the exception is printed to
908
+ stdout when caught.
954
909
  """
955
910
  ...
956
911
 
957
- 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]]:
912
+ @typing.overload
913
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
914
+ ...
915
+
916
+ @typing.overload
917
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
918
+ ...
919
+
920
+ 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):
958
921
  """
959
- 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)
960
- before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
961
- and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
962
- added as a flow decorators. Adding more than one decorator will ensure that `start` step
963
- starts only after all sensors finish.
922
+ Specifies that the step will success under all circumstances.
923
+
924
+ The decorator will create an optional artifact, specified by `var`, which
925
+ contains the exception raised. You can use it to detect the presence
926
+ of errors, indicating that all happy-path artifacts produced by the step
927
+ are missing.
964
928
 
965
929
 
966
930
  Parameters
967
931
  ----------
968
- timeout : int
969
- Time, in seconds before the task times out and fails. (Default: 3600)
970
- poke_interval : int
971
- Time in seconds that the job should wait in between each try. (Default: 60)
972
- mode : str
973
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
974
- exponential_backoff : bool
975
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
976
- pool : str
977
- the slot pool this task should run in,
978
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
979
- soft_fail : bool
980
- Set to true to mark the task as SKIPPED on failure. (Default: False)
981
- name : str
982
- Name of the sensor on Airflow
983
- description : str
984
- Description of sensor in the Airflow UI
985
- bucket_key : Union[str, List[str]]
986
- The key(s) being waited on. Supports full s3:// style url or relative path from root level.
987
- When it's specified as a full s3:// url, please leave `bucket_name` as None
988
- bucket_name : str
989
- Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
990
- When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
991
- wildcard_match : bool
992
- whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
993
- aws_conn_id : str
994
- a reference to the s3 connection on Airflow. (Default: None)
995
- verify : bool
996
- Whether or not to verify SSL certificates for S3 connection. (Default: None)
932
+ var : str, optional, default None
933
+ Name of the artifact in which to store the caught exception.
934
+ If not specified, the exception is not stored.
935
+ print_exception : bool, default True
936
+ Determines whether or not the exception is printed to
937
+ stdout when caught.
938
+ """
939
+ ...
940
+
941
+ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> 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]]]:
942
+ """
943
+ Specifies that this step should execute on DGX cloud.
944
+
945
+
946
+ Parameters
947
+ ----------
948
+ gpu : int
949
+ Number of GPUs to use.
950
+ gpu_type : str
951
+ Type of Nvidia GPU to use.
952
+ queue_timeout : int
953
+ Time to keep the job in NVCF's queue.
997
954
  """
998
955
  ...
999
956
 
1000
957
  @typing.overload
1001
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
958
+ 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]]:
1002
959
  """
1003
- Specifies the PyPI packages for all steps of the flow.
960
+ Specifies the times when the flow should be run when running on a
961
+ production scheduler.
1004
962
 
1005
- Use `@pypi_base` to set common packages required by all
1006
- steps and use `@pypi` to specify step-specific overrides.
1007
963
 
1008
964
  Parameters
1009
965
  ----------
1010
- packages : Dict[str, str], default: {}
1011
- Packages to use for this flow. The key is the name of the package
1012
- and the value is the version to use.
1013
- python : str, optional, default: None
1014
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1015
- that the version used will correspond to the version of the Python interpreter used to start the run.
966
+ hourly : bool, default False
967
+ Run the workflow hourly.
968
+ daily : bool, default True
969
+ Run the workflow daily.
970
+ weekly : bool, default False
971
+ Run the workflow weekly.
972
+ cron : str, optional, default None
973
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
974
+ specified by this expression.
975
+ timezone : str, optional, default None
976
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
977
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1016
978
  """
1017
979
  ...
1018
980
 
1019
981
  @typing.overload
1020
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
982
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1021
983
  ...
1022
984
 
1023
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
985
+ 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):
1024
986
  """
1025
- Specifies the PyPI packages for all steps of the flow.
987
+ Specifies the times when the flow should be run when running on a
988
+ production scheduler.
1026
989
 
1027
- Use `@pypi_base` to set common packages required by all
1028
- steps and use `@pypi` to specify step-specific overrides.
1029
990
 
1030
991
  Parameters
1031
992
  ----------
1032
- packages : Dict[str, str], default: {}
1033
- Packages to use for this flow. The key is the name of the package
1034
- and the value is the version to use.
1035
- python : str, optional, default: None
1036
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1037
- that the version used will correspond to the version of the Python interpreter used to start the run.
993
+ hourly : bool, default False
994
+ Run the workflow hourly.
995
+ daily : bool, default True
996
+ Run the workflow daily.
997
+ weekly : bool, default False
998
+ Run the workflow weekly.
999
+ cron : str, optional, default None
1000
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1001
+ specified by this expression.
1002
+ timezone : str, optional, default None
1003
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1004
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1005
+ """
1006
+ ...
1007
+
1008
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1009
+ """
1010
+ Specifies what flows belong to the same project.
1011
+
1012
+ A project-specific namespace is created for all flows that
1013
+ use the same `@project(name)`.
1014
+
1015
+
1016
+ Parameters
1017
+ ----------
1018
+ name : str
1019
+ Project name. Make sure that the name is unique amongst all
1020
+ projects that use the same production scheduler. The name may
1021
+ contain only lowercase alphanumeric characters and underscores.
1022
+
1023
+ branch : Optional[str], default None
1024
+ The branch to use. If not specified, the branch is set to
1025
+ `user.<username>` unless `production` is set to `True`. This can
1026
+ also be set on the command line using `--branch` as a top-level option.
1027
+ It is an error to specify `branch` in the decorator and on the command line.
1028
+
1029
+ production : bool, default False
1030
+ Whether or not the branch is the production branch. This can also be set on the
1031
+ command line using `--production` as a top-level option. It is an error to specify
1032
+ `production` in the decorator and on the command line.
1033
+ The project branch name will be:
1034
+ - if `branch` is specified:
1035
+ - if `production` is True: `prod.<branch>`
1036
+ - if `production` is False: `test.<branch>`
1037
+ - if `branch` is not specified:
1038
+ - if `production` is True: `prod`
1039
+ - if `production` is False: `user.<username>`
1040
+ """
1041
+ ...
1042
+
1043
+ 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]]:
1044
+ """
1045
+ 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.
1046
+ 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.
1047
+
1048
+
1049
+ Parameters
1050
+ ----------
1051
+ timeout : int
1052
+ Time, in seconds before the task times out and fails. (Default: 3600)
1053
+ poke_interval : int
1054
+ Time in seconds that the job should wait in between each try. (Default: 60)
1055
+ mode : str
1056
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1057
+ exponential_backoff : bool
1058
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1059
+ pool : str
1060
+ the slot pool this task should run in,
1061
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1062
+ soft_fail : bool
1063
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1064
+ name : str
1065
+ Name of the sensor on Airflow
1066
+ description : str
1067
+ Description of sensor in the Airflow UI
1068
+ external_dag_id : str
1069
+ The dag_id that contains the task you want to wait for.
1070
+ external_task_ids : List[str]
1071
+ The list of task_ids that you want to wait for.
1072
+ If None (default value) the sensor waits for the DAG. (Default: None)
1073
+ allowed_states : List[str]
1074
+ Iterable of allowed states, (Default: ['success'])
1075
+ failed_states : List[str]
1076
+ Iterable of failed or dis-allowed states. (Default: None)
1077
+ execution_delta : datetime.timedelta
1078
+ time difference with the previous execution to look at,
1079
+ the default is the same logical date as the current task or DAG. (Default: None)
1080
+ check_existence: bool
1081
+ Set to True to check if the external task exists or check if
1082
+ the DAG to wait for exists. (Default: True)
1038
1083
  """
1039
1084
  ...
1040
1085
 
1041
1086
  @typing.overload
1042
- def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, 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]]:
1087
+ 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]]:
1043
1088
  """
1044
- Specifies the flow(s) that this flow depends on.
1089
+ Specifies the event(s) that this flow depends on.
1045
1090
 
1046
1091
  ```
1047
- @trigger_on_finish(flow='FooFlow')
1092
+ @trigger(event='foo')
1048
1093
  ```
1049
1094
  or
1050
1095
  ```
1051
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1096
+ @trigger(events=['foo', 'bar'])
1052
1097
  ```
1053
- This decorator respects the @project decorator and triggers the flow
1054
- when upstream runs within the same namespace complete successfully
1055
1098
 
1056
- Additionally, you can specify project aware upstream flow dependencies
1057
- by specifying the fully qualified project_flow_name.
1099
+ Additionally, you can specify the parameter mappings
1100
+ to map event payload to Metaflow parameters for the flow.
1058
1101
  ```
1059
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1102
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1060
1103
  ```
1061
1104
  or
1062
1105
  ```
1063
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1106
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1107
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1064
1108
  ```
1065
1109
 
1066
- You can also specify just the project or project branch (other values will be
1067
- inferred from the current project or project branch):
1110
+ 'parameters' can also be a list of strings and tuples like so:
1068
1111
  ```
1069
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1112
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1113
+ ```
1114
+ This is equivalent to:
1115
+ ```
1116
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1070
1117
  ```
1071
-
1072
- Note that `branch` is typically one of:
1073
- - `prod`
1074
- - `user.bob`
1075
- - `test.my_experiment`
1076
- - `prod.staging`
1077
1118
 
1078
1119
 
1079
1120
  Parameters
1080
1121
  ----------
1081
- flow : Union[str, Dict[str, str]], optional, default None
1082
- Upstream flow dependency for this flow.
1083
- flows : List[Union[str, Dict[str, str]]], default []
1084
- Upstream flow dependencies for this flow.
1122
+ event : Union[str, Dict[str, Any]], optional, default None
1123
+ Event dependency for this flow.
1124
+ events : List[Union[str, Dict[str, Any]]], default []
1125
+ Events dependency for this flow.
1085
1126
  options : Dict[str, Any], default {}
1086
1127
  Backend-specific configuration for tuning eventing behavior.
1087
1128
  """
1088
1129
  ...
1089
1130
 
1090
1131
  @typing.overload
1091
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1132
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1092
1133
  ...
1093
1134
 
1094
- def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1135
+ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1095
1136
  """
1096
- Specifies the flow(s) that this flow depends on.
1137
+ Specifies the event(s) that this flow depends on.
1097
1138
 
1098
1139
  ```
1099
- @trigger_on_finish(flow='FooFlow')
1140
+ @trigger(event='foo')
1100
1141
  ```
1101
1142
  or
1102
1143
  ```
1103
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1144
+ @trigger(events=['foo', 'bar'])
1104
1145
  ```
1105
- This decorator respects the @project decorator and triggers the flow
1106
- when upstream runs within the same namespace complete successfully
1107
1146
 
1108
- Additionally, you can specify project aware upstream flow dependencies
1109
- by specifying the fully qualified project_flow_name.
1147
+ Additionally, you can specify the parameter mappings
1148
+ to map event payload to Metaflow parameters for the flow.
1110
1149
  ```
1111
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1150
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1112
1151
  ```
1113
1152
  or
1114
1153
  ```
1115
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1154
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1155
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1116
1156
  ```
1117
1157
 
1118
- You can also specify just the project or project branch (other values will be
1119
- inferred from the current project or project branch):
1158
+ 'parameters' can also be a list of strings and tuples like so:
1120
1159
  ```
1121
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1160
+ @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1161
+ ```
1162
+ This is equivalent to:
1163
+ ```
1164
+ @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1122
1165
  ```
1123
1166
 
1124
- Note that `branch` is typically one of:
1125
- - `prod`
1126
- - `user.bob`
1127
- - `test.my_experiment`
1128
- - `prod.staging`
1129
-
1130
-
1131
- Parameters
1132
- ----------
1133
- flow : Union[str, Dict[str, str]], optional, default None
1134
- Upstream flow dependency for this flow.
1135
- flows : List[Union[str, Dict[str, str]]], default []
1136
- Upstream flow dependencies for this flow.
1167
+
1168
+ Parameters
1169
+ ----------
1170
+ event : Union[str, Dict[str, Any]], optional, default None
1171
+ Event dependency for this flow.
1172
+ events : List[Union[str, Dict[str, Any]]], default []
1173
+ Events dependency for this flow.
1137
1174
  options : Dict[str, Any], default {}
1138
1175
  Backend-specific configuration for tuning eventing behavior.
1139
1176
  """
@@ -1190,225 +1227,188 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
1190
1227
  """
1191
1228
  ...
1192
1229
 
1193
- 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]]:
1194
- """
1195
- 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.
1196
- 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.
1197
-
1198
-
1199
- Parameters
1200
- ----------
1201
- timeout : int
1202
- Time, in seconds before the task times out and fails. (Default: 3600)
1203
- poke_interval : int
1204
- Time in seconds that the job should wait in between each try. (Default: 60)
1205
- mode : str
1206
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1207
- exponential_backoff : bool
1208
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1209
- pool : str
1210
- the slot pool this task should run in,
1211
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1212
- soft_fail : bool
1213
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1214
- name : str
1215
- Name of the sensor on Airflow
1216
- description : str
1217
- Description of sensor in the Airflow UI
1218
- external_dag_id : str
1219
- The dag_id that contains the task you want to wait for.
1220
- external_task_ids : List[str]
1221
- The list of task_ids that you want to wait for.
1222
- If None (default value) the sensor waits for the DAG. (Default: None)
1223
- allowed_states : List[str]
1224
- Iterable of allowed states, (Default: ['success'])
1225
- failed_states : List[str]
1226
- Iterable of failed or dis-allowed states. (Default: None)
1227
- execution_delta : datetime.timedelta
1228
- time difference with the previous execution to look at,
1229
- the default is the same logical date as the current task or DAG. (Default: None)
1230
- check_existence: bool
1231
- Set to True to check if the external task exists or check if
1232
- the DAG to wait for exists. (Default: True)
1233
- """
1234
- ...
1235
-
1236
1230
  @typing.overload
1237
- 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]]:
1231
+ def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, 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]]:
1238
1232
  """
1239
- Specifies the event(s) that this flow depends on.
1233
+ Specifies the flow(s) that this flow depends on.
1240
1234
 
1241
1235
  ```
1242
- @trigger(event='foo')
1236
+ @trigger_on_finish(flow='FooFlow')
1243
1237
  ```
1244
1238
  or
1245
1239
  ```
1246
- @trigger(events=['foo', 'bar'])
1240
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1247
1241
  ```
1242
+ This decorator respects the @project decorator and triggers the flow
1243
+ when upstream runs within the same namespace complete successfully
1248
1244
 
1249
- Additionally, you can specify the parameter mappings
1250
- to map event payload to Metaflow parameters for the flow.
1245
+ Additionally, you can specify project aware upstream flow dependencies
1246
+ by specifying the fully qualified project_flow_name.
1251
1247
  ```
1252
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1248
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1253
1249
  ```
1254
1250
  or
1255
1251
  ```
1256
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1257
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1252
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1258
1253
  ```
1259
1254
 
1260
- 'parameters' can also be a list of strings and tuples like so:
1261
- ```
1262
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1263
- ```
1264
- This is equivalent to:
1255
+ You can also specify just the project or project branch (other values will be
1256
+ inferred from the current project or project branch):
1265
1257
  ```
1266
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1258
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1267
1259
  ```
1268
1260
 
1261
+ Note that `branch` is typically one of:
1262
+ - `prod`
1263
+ - `user.bob`
1264
+ - `test.my_experiment`
1265
+ - `prod.staging`
1266
+
1269
1267
 
1270
1268
  Parameters
1271
1269
  ----------
1272
- event : Union[str, Dict[str, Any]], optional, default None
1273
- Event dependency for this flow.
1274
- events : List[Union[str, Dict[str, Any]]], default []
1275
- Events dependency for this flow.
1270
+ flow : Union[str, Dict[str, str]], optional, default None
1271
+ Upstream flow dependency for this flow.
1272
+ flows : List[Union[str, Dict[str, str]]], default []
1273
+ Upstream flow dependencies for this flow.
1276
1274
  options : Dict[str, Any], default {}
1277
1275
  Backend-specific configuration for tuning eventing behavior.
1278
1276
  """
1279
1277
  ...
1280
1278
 
1281
1279
  @typing.overload
1282
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1280
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1283
1281
  ...
1284
1282
 
1285
- def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, 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] = {}):
1283
+ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
1286
1284
  """
1287
- Specifies the event(s) that this flow depends on.
1285
+ Specifies the flow(s) that this flow depends on.
1288
1286
 
1289
1287
  ```
1290
- @trigger(event='foo')
1288
+ @trigger_on_finish(flow='FooFlow')
1291
1289
  ```
1292
1290
  or
1293
1291
  ```
1294
- @trigger(events=['foo', 'bar'])
1292
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1295
1293
  ```
1294
+ This decorator respects the @project decorator and triggers the flow
1295
+ when upstream runs within the same namespace complete successfully
1296
1296
 
1297
- Additionally, you can specify the parameter mappings
1298
- to map event payload to Metaflow parameters for the flow.
1297
+ Additionally, you can specify project aware upstream flow dependencies
1298
+ by specifying the fully qualified project_flow_name.
1299
1299
  ```
1300
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1300
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1301
1301
  ```
1302
1302
  or
1303
1303
  ```
1304
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1305
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1304
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1306
1305
  ```
1307
1306
 
1308
- 'parameters' can also be a list of strings and tuples like so:
1309
- ```
1310
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1311
- ```
1312
- This is equivalent to:
1307
+ You can also specify just the project or project branch (other values will be
1308
+ inferred from the current project or project branch):
1313
1309
  ```
1314
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1310
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1315
1311
  ```
1316
1312
 
1313
+ Note that `branch` is typically one of:
1314
+ - `prod`
1315
+ - `user.bob`
1316
+ - `test.my_experiment`
1317
+ - `prod.staging`
1318
+
1317
1319
 
1318
1320
  Parameters
1319
1321
  ----------
1320
- event : Union[str, Dict[str, Any]], optional, default None
1321
- Event dependency for this flow.
1322
- events : List[Union[str, Dict[str, Any]]], default []
1323
- Events dependency for this flow.
1322
+ flow : Union[str, Dict[str, str]], optional, default None
1323
+ Upstream flow dependency for this flow.
1324
+ flows : List[Union[str, Dict[str, str]]], default []
1325
+ Upstream flow dependencies for this flow.
1324
1326
  options : Dict[str, Any], default {}
1325
1327
  Backend-specific configuration for tuning eventing behavior.
1326
1328
  """
1327
1329
  ...
1328
1330
 
1329
- @typing.overload
1330
- 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]]:
1331
+ 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]]:
1331
1332
  """
1332
- Specifies the times when the flow should be run when running on a
1333
- production scheduler.
1333
+ 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)
1334
+ before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
1335
+ and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
1336
+ added as a flow decorators. Adding more than one decorator will ensure that `start` step
1337
+ starts only after all sensors finish.
1334
1338
 
1335
1339
 
1336
1340
  Parameters
1337
1341
  ----------
1338
- hourly : bool, default False
1339
- Run the workflow hourly.
1340
- daily : bool, default True
1341
- Run the workflow daily.
1342
- weekly : bool, default False
1343
- Run the workflow weekly.
1344
- cron : str, optional, default None
1345
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1346
- specified by this expression.
1347
- timezone : str, optional, default None
1348
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1349
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1342
+ timeout : int
1343
+ Time, in seconds before the task times out and fails. (Default: 3600)
1344
+ poke_interval : int
1345
+ Time in seconds that the job should wait in between each try. (Default: 60)
1346
+ mode : str
1347
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1348
+ exponential_backoff : bool
1349
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1350
+ pool : str
1351
+ the slot pool this task should run in,
1352
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
1353
+ soft_fail : bool
1354
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
1355
+ name : str
1356
+ Name of the sensor on Airflow
1357
+ description : str
1358
+ Description of sensor in the Airflow UI
1359
+ bucket_key : Union[str, List[str]]
1360
+ The key(s) being waited on. Supports full s3:// style url or relative path from root level.
1361
+ When it's specified as a full s3:// url, please leave `bucket_name` as None
1362
+ bucket_name : str
1363
+ Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
1364
+ When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
1365
+ wildcard_match : bool
1366
+ whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
1367
+ aws_conn_id : str
1368
+ a reference to the s3 connection on Airflow. (Default: None)
1369
+ verify : bool
1370
+ Whether or not to verify SSL certificates for S3 connection. (Default: None)
1350
1371
  """
1351
1372
  ...
1352
1373
 
1353
1374
  @typing.overload
1354
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1355
- ...
1356
-
1357
- 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):
1375
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1358
1376
  """
1359
- Specifies the times when the flow should be run when running on a
1360
- production scheduler.
1377
+ Specifies the PyPI packages for all steps of the flow.
1361
1378
 
1379
+ Use `@pypi_base` to set common packages required by all
1380
+ steps and use `@pypi` to specify step-specific overrides.
1362
1381
 
1363
1382
  Parameters
1364
1383
  ----------
1365
- hourly : bool, default False
1366
- Run the workflow hourly.
1367
- daily : bool, default True
1368
- Run the workflow daily.
1369
- weekly : bool, default False
1370
- Run the workflow weekly.
1371
- cron : str, optional, default None
1372
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1373
- specified by this expression.
1374
- timezone : str, optional, default None
1375
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1376
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1384
+ packages : Dict[str, str], default: {}
1385
+ Packages to use for this flow. The key is the name of the package
1386
+ and the value is the version to use.
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.
1377
1390
  """
1378
1391
  ...
1379
1392
 
1380
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1393
+ @typing.overload
1394
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1395
+ ...
1396
+
1397
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1381
1398
  """
1382
- Specifies what flows belong to the same project.
1383
-
1384
- A project-specific namespace is created for all flows that
1385
- use the same `@project(name)`.
1399
+ Specifies the PyPI packages for all steps of the flow.
1386
1400
 
1401
+ Use `@pypi_base` to set common packages required by all
1402
+ steps and use `@pypi` to specify step-specific overrides.
1387
1403
 
1388
1404
  Parameters
1389
1405
  ----------
1390
- name : str
1391
- Project name. Make sure that the name is unique amongst all
1392
- projects that use the same production scheduler. The name may
1393
- contain only lowercase alphanumeric characters and underscores.
1394
-
1395
- branch : Optional[str], default None
1396
- The branch to use. If not specified, the branch is set to
1397
- `user.<username>` unless `production` is set to `True`. This can
1398
- also be set on the command line using `--branch` as a top-level option.
1399
- It is an error to specify `branch` in the decorator and on the command line.
1400
-
1401
- production : bool, default False
1402
- Whether or not the branch is the production branch. This can also be set on the
1403
- command line using `--production` as a top-level option. It is an error to specify
1404
- `production` in the decorator and on the command line.
1405
- The project branch name will be:
1406
- - if `branch` is specified:
1407
- - if `production` is True: `prod.<branch>`
1408
- - if `production` is False: `test.<branch>`
1409
- - if `branch` is not specified:
1410
- - if `production` is True: `prod`
1411
- - if `production` is False: `user.<username>`
1406
+ packages : Dict[str, str], default: {}
1407
+ Packages to use for this flow. The key is the name of the package
1408
+ and the value is the version to use.
1409
+ python : str, optional, default: None
1410
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1411
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1412
1412
  """
1413
1413
  ...
1414
1414