metaflow-stubs 2.15.8__py2.py3-none-any.whl → 2.15.9__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 (149) hide show
  1. metaflow-stubs/__init__.pyi +535 -527
  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 +3 -3
  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 +2 -2
  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 +5 -5
  21. metaflow-stubs/metaflow_git.pyi +2 -2
  22. metaflow-stubs/multicore_utils.pyi +2 -2
  23. metaflow-stubs/parameters.pyi +2 -2
  24. metaflow-stubs/plugins/__init__.pyi +11 -11
  25. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  30. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  31. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  32. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  33. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  35. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  36. metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
  37. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
  38. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  39. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
  40. metaflow-stubs/plugins/aws/__init__.pyi +4 -4
  41. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  42. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  45. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  46. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  48. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
  49. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  56. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  57. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  58. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  61. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
  62. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  63. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  64. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  65. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_client.pyi +3 -3
  67. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
  72. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  73. metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
  74. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  77. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  78. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  79. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  80. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  82. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  83. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  84. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  85. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  86. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  87. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  88. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  89. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  90. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  91. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  92. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  94. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
  95. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  96. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  98. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  101. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +4 -4
  102. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +10 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  106. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  107. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  109. metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
  110. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  111. metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
  112. metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
  113. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  114. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  115. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  116. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  117. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  118. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  119. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  120. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  121. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  122. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
  123. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  124. metaflow-stubs/plugins/uv/__init__.pyi +2 -2
  125. metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
  126. metaflow-stubs/pylint_wrapper.pyi +2 -2
  127. metaflow-stubs/runner/__init__.pyi +2 -2
  128. metaflow-stubs/runner/deployer.pyi +5 -5
  129. metaflow-stubs/runner/deployer_impl.pyi +3 -3
  130. metaflow-stubs/runner/metaflow_runner.pyi +4 -4
  131. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  132. metaflow-stubs/runner/nbrun.pyi +2 -2
  133. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  134. metaflow-stubs/runner/utils.pyi +4 -4
  135. metaflow-stubs/system/__init__.pyi +2 -2
  136. metaflow-stubs/system/system_logger.pyi +3 -3
  137. metaflow-stubs/system/system_monitor.pyi +2 -2
  138. metaflow-stubs/tagging_util.pyi +2 -2
  139. metaflow-stubs/tuple_util.pyi +2 -2
  140. metaflow-stubs/user_configs/__init__.pyi +2 -2
  141. metaflow-stubs/user_configs/config_decorators.pyi +5 -5
  142. metaflow-stubs/user_configs/config_options.pyi +2 -2
  143. metaflow-stubs/user_configs/config_parameters.pyi +5 -5
  144. metaflow-stubs/version.pyi +2 -2
  145. {metaflow_stubs-2.15.8.dist-info → metaflow_stubs-2.15.9.dist-info}/METADATA +2 -2
  146. metaflow_stubs-2.15.9.dist-info/RECORD +149 -0
  147. {metaflow_stubs-2.15.8.dist-info → metaflow_stubs-2.15.9.dist-info}/WHEEL +1 -1
  148. metaflow_stubs-2.15.8.dist-info/RECORD +0 -149
  149. {metaflow_stubs-2.15.8.dist-info → metaflow_stubs-2.15.9.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.15.8 #
4
- # Generated on 2025-04-17T19:00:19.966511 #
3
+ # MF version: 2.15.9 #
4
+ # Generated on 2025-04-22T01:36:50.325150 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -43,9 +43,9 @@ from . import plugins as plugins
43
43
  from .plugins.datatools.s3.s3 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 conda_environment_yml_parser as conda_environment_yml_parser
47
- from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
48
46
  from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
47
+ from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
48
+ from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
49
49
  from . import cards as cards
50
50
  from . import client as client
51
51
  from .client.core import namespace as namespace
@@ -146,54 +146,156 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
146
146
  """
147
147
  ...
148
148
 
149
+ 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', security_context: typing.Optional[typing.Dict[str, typing.Any]] = 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]]]:
150
+ """
151
+ Specifies that this step should execute on Kubernetes.
152
+
153
+
154
+ Parameters
155
+ ----------
156
+ cpu : int, default 1
157
+ Number of CPUs required for this step. If `@resources` is
158
+ also present, the maximum value from all decorators is used.
159
+ memory : int, default 4096
160
+ Memory size (in MB) required for this step. If
161
+ `@resources` is also present, the maximum value from all decorators is
162
+ used.
163
+ disk : int, default 10240
164
+ Disk size (in MB) required for this step. If
165
+ `@resources` is also present, the maximum value from all decorators is
166
+ used.
167
+ image : str, optional, default None
168
+ Docker image to use when launching on Kubernetes. If not specified, and
169
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
170
+ not, a default Docker image mapping to the current version of Python is used.
171
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
172
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
173
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
174
+ Kubernetes service account to use when launching pod in Kubernetes.
175
+ secrets : List[str], optional, default None
176
+ Kubernetes secrets to use when launching pod in Kubernetes. These
177
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
178
+ in Metaflow configuration.
179
+ node_selector: Union[Dict[str,str], str], optional, default None
180
+ Kubernetes node selector(s) to apply to the pod running the task.
181
+ Can be passed in as a comma separated string of values e.g.
182
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
183
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
184
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
185
+ Kubernetes namespace to use when launching pod in Kubernetes.
186
+ gpu : int, optional, default None
187
+ Number of GPUs required for this step. A value of zero implies that
188
+ the scheduled node should not have GPUs.
189
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
190
+ The vendor of the GPUs to be used for this step.
191
+ tolerations : List[str], default []
192
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
193
+ Kubernetes tolerations to use when launching pod in Kubernetes.
194
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
195
+ Kubernetes labels to use when launching pod in Kubernetes.
196
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
197
+ Kubernetes annotations to use when launching pod in Kubernetes.
198
+ use_tmpfs : bool, default False
199
+ This enables an explicit tmpfs mount for this step.
200
+ tmpfs_tempdir : bool, default True
201
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
202
+ tmpfs_size : int, optional, default: None
203
+ The value for the size (in MiB) of the tmpfs mount for this step.
204
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
205
+ memory allocated for this step.
206
+ tmpfs_path : str, optional, default /metaflow_temp
207
+ Path to tmpfs mount for this step.
208
+ persistent_volume_claims : Dict[str, str], optional, default None
209
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
210
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
211
+ shared_memory: int, optional
212
+ Shared memory size (in MiB) required for this step
213
+ port: int, optional
214
+ Port number to specify in the Kubernetes job object
215
+ compute_pool : str, optional, default None
216
+ Compute pool to be used for for this step.
217
+ If not specified, any accessible compute pool within the perimeter is used.
218
+ hostname_resolution_timeout: int, default 10 * 60
219
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
220
+ Only applicable when @parallel is used.
221
+ qos: str, default: Burstable
222
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
223
+
224
+ security_context: Dict[str, Any], optional, default None
225
+ Container security context. Applies to the task container. Allows the following keys:
226
+ - privileged: bool, optional, default None
227
+ - allow_privilege_escalation: bool, optional, default None
228
+ - run_as_user: int, optional, default None
229
+ - run_as_group: int, optional, default None
230
+ - run_as_non_root: bool, optional, default None
231
+ """
232
+ ...
233
+
149
234
  @typing.overload
150
- 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]]]:
235
+ 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]]]:
151
236
  """
152
- Specifies that the step will success under all circumstances.
237
+ Creates a human-readable report, a Metaflow Card, after this step completes.
153
238
 
154
- The decorator will create an optional artifact, specified by `var`, which
155
- contains the exception raised. You can use it to detect the presence
156
- of errors, indicating that all happy-path artifacts produced by the step
157
- are missing.
239
+ Note that you may add multiple `@card` decorators in a step with different parameters.
158
240
 
159
241
 
160
242
  Parameters
161
243
  ----------
162
- var : str, optional, default None
163
- Name of the artifact in which to store the caught exception.
164
- If not specified, the exception is not stored.
165
- print_exception : bool, default True
166
- Determines whether or not the exception is printed to
167
- stdout when caught.
244
+ type : str, default 'default'
245
+ Card type.
246
+ id : str, optional, default None
247
+ If multiple cards are present, use this id to identify this card.
248
+ options : Dict[str, Any], default {}
249
+ Options passed to the card. The contents depend on the card type.
250
+ timeout : int, default 45
251
+ Interrupt reporting if it takes more than this many seconds.
168
252
  """
169
253
  ...
170
254
 
171
255
  @typing.overload
172
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
256
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
173
257
  ...
174
258
 
175
259
  @typing.overload
176
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
260
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
177
261
  ...
178
262
 
179
- 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):
263
+ 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):
180
264
  """
181
- Specifies that the step will success under all circumstances.
265
+ Creates a human-readable report, a Metaflow Card, after this step completes.
182
266
 
183
- The decorator will create an optional artifact, specified by `var`, which
184
- contains the exception raised. You can use it to detect the presence
185
- of errors, indicating that all happy-path artifacts produced by the step
186
- are missing.
267
+ Note that you may add multiple `@card` decorators in a step with different parameters.
187
268
 
188
269
 
189
270
  Parameters
190
271
  ----------
191
- var : str, optional, default None
192
- Name of the artifact in which to store the caught exception.
193
- If not specified, the exception is not stored.
194
- print_exception : bool, default True
195
- Determines whether or not the exception is printed to
196
- stdout when caught.
272
+ type : str, default 'default'
273
+ Card type.
274
+ id : str, optional, default None
275
+ If multiple cards are present, use this id to identify this card.
276
+ options : Dict[str, Any], default {}
277
+ Options passed to the card. The contents depend on the card type.
278
+ timeout : int, default 45
279
+ Interrupt reporting if it takes more than this many seconds.
280
+ """
281
+ ...
282
+
283
+ @typing.overload
284
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
285
+ """
286
+ Decorator prototype for all step decorators. This function gets specialized
287
+ and imported for all decorators types by _import_plugin_decorators().
288
+ """
289
+ ...
290
+
291
+ @typing.overload
292
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
293
+ ...
294
+
295
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
296
+ """
297
+ Decorator prototype for all step decorators. This function gets specialized
298
+ and imported for all decorators types by _import_plugin_decorators().
197
299
  """
198
300
  ...
199
301
 
@@ -346,6 +448,65 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
346
448
  """
347
449
  ...
348
450
 
451
+ @typing.overload
452
+ 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]]]:
453
+ """
454
+ Specifies a timeout for your step.
455
+
456
+ This decorator is useful if this step may hang indefinitely.
457
+
458
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
459
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
460
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
461
+
462
+ Note that all the values specified in parameters are added together so if you specify
463
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
464
+
465
+
466
+ Parameters
467
+ ----------
468
+ seconds : int, default 0
469
+ Number of seconds to wait prior to timing out.
470
+ minutes : int, default 0
471
+ Number of minutes to wait prior to timing out.
472
+ hours : int, default 0
473
+ Number of hours to wait prior to timing out.
474
+ """
475
+ ...
476
+
477
+ @typing.overload
478
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
479
+ ...
480
+
481
+ @typing.overload
482
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
483
+ ...
484
+
485
+ 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):
486
+ """
487
+ Specifies a timeout for your step.
488
+
489
+ This decorator is useful if this step may hang indefinitely.
490
+
491
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
492
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
493
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
494
+
495
+ Note that all the values specified in parameters are added together so if you specify
496
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
497
+
498
+
499
+ Parameters
500
+ ----------
501
+ seconds : int, default 0
502
+ Number of seconds to wait prior to timing out.
503
+ minutes : int, default 0
504
+ Number of minutes to wait prior to timing out.
505
+ hours : int, default 0
506
+ Number of hours to wait prior to timing out.
507
+ """
508
+ ...
509
+
349
510
  @typing.overload
350
511
  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]]]:
351
512
  """
@@ -402,305 +563,148 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
402
563
  ...
403
564
 
404
565
  @typing.overload
405
- 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]]]:
566
+ 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]]]:
406
567
  """
407
- Specifies the Conda environment for the step.
408
-
409
- Information in this decorator will augment any
410
- attributes set in the `@conda_base` flow-level decorator. Hence,
411
- you can use `@conda_base` to set packages required by all
412
- steps and use `@conda` to specify step-specific overrides.
568
+ Specifies environment variables to be set prior to the execution of a step.
413
569
 
414
570
 
415
571
  Parameters
416
572
  ----------
417
- packages : Dict[str, str], default {}
418
- Packages to use for this step. The key is the name of the package
419
- and the value is the version to use.
420
- libraries : Dict[str, str], default {}
421
- Supported for backward compatibility. When used with packages, packages will take precedence.
422
- python : str, optional, default None
423
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
424
- that the version used will correspond to the version of the Python interpreter used to start the run.
425
- disabled : bool, default False
426
- If set to True, disables @conda.
573
+ vars : Dict[str, str], default {}
574
+ Dictionary of environment variables to set.
427
575
  """
428
576
  ...
429
577
 
430
578
  @typing.overload
431
- def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
579
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
432
580
  ...
433
581
 
434
582
  @typing.overload
435
- def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
583
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
436
584
  ...
437
585
 
438
- 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):
586
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
439
587
  """
440
- Specifies the Conda environment for the step.
441
-
442
- Information in this decorator will augment any
443
- attributes set in the `@conda_base` flow-level decorator. Hence,
444
- you can use `@conda_base` to set packages required by all
445
- steps and use `@conda` to specify step-specific overrides.
588
+ Specifies environment variables to be set prior to the execution of a step.
446
589
 
447
590
 
448
591
  Parameters
449
592
  ----------
450
- packages : Dict[str, str], default {}
451
- Packages to use for this step. The key is the name of the package
452
- and the value is the version to use.
453
- libraries : Dict[str, str], default {}
454
- Supported for backward compatibility. When used with packages, packages will take precedence.
455
- python : str, optional, default None
456
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
457
- that the version used will correspond to the version of the Python interpreter used to start the run.
458
- disabled : bool, default False
459
- If set to True, disables @conda.
460
- """
461
- ...
462
-
463
- 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]]]:
464
- """
465
- Specifies that this step should execute on Kubernetes.
466
-
467
-
468
- Parameters
469
- ----------
470
- cpu : int, default 1
471
- Number of CPUs required for this step. If `@resources` is
472
- also present, the maximum value from all decorators is used.
473
- memory : int, default 4096
474
- Memory size (in MB) required for this step. If
475
- `@resources` is also present, the maximum value from all decorators is
476
- used.
477
- disk : int, default 10240
478
- Disk size (in MB) required for this step. If
479
- `@resources` is also present, the maximum value from all decorators is
480
- used.
481
- image : str, optional, default None
482
- Docker image to use when launching on Kubernetes. If not specified, and
483
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
484
- not, a default Docker image mapping to the current version of Python is used.
485
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
486
- If given, the imagePullPolicy to be applied to the Docker image of the step.
487
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
488
- Kubernetes service account to use when launching pod in Kubernetes.
489
- secrets : List[str], optional, default None
490
- Kubernetes secrets to use when launching pod in Kubernetes. These
491
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
492
- in Metaflow configuration.
493
- node_selector: Union[Dict[str,str], str], optional, default None
494
- Kubernetes node selector(s) to apply to the pod running the task.
495
- Can be passed in as a comma separated string of values e.g.
496
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
497
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
498
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
499
- Kubernetes namespace to use when launching pod in Kubernetes.
500
- gpu : int, optional, default None
501
- Number of GPUs required for this step. A value of zero implies that
502
- the scheduled node should not have GPUs.
503
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
504
- The vendor of the GPUs to be used for this step.
505
- tolerations : List[str], default []
506
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
507
- Kubernetes tolerations to use when launching pod in Kubernetes.
508
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
509
- Kubernetes labels to use when launching pod in Kubernetes.
510
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
511
- Kubernetes annotations to use when launching pod in Kubernetes.
512
- use_tmpfs : bool, default False
513
- This enables an explicit tmpfs mount for this step.
514
- tmpfs_tempdir : bool, default True
515
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
516
- tmpfs_size : int, optional, default: None
517
- The value for the size (in MiB) of the tmpfs mount for this step.
518
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
519
- memory allocated for this step.
520
- tmpfs_path : str, optional, default /metaflow_temp
521
- Path to tmpfs mount for this step.
522
- persistent_volume_claims : Dict[str, str], optional, default None
523
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
524
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
525
- shared_memory: int, optional
526
- Shared memory size (in MiB) required for this step
527
- port: int, optional
528
- Port number to specify in the Kubernetes job object
529
- compute_pool : str, optional, default None
530
- Compute pool to be used for for this step.
531
- If not specified, any accessible compute pool within the perimeter is used.
532
- hostname_resolution_timeout: int, default 10 * 60
533
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
534
- Only applicable when @parallel is used.
535
- qos: str, default: Burstable
536
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
593
+ vars : Dict[str, str], default {}
594
+ Dictionary of environment variables to set.
537
595
  """
538
596
  ...
539
597
 
540
598
  @typing.overload
541
- 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]]]:
542
- """
543
- Specifies a timeout for your step.
544
-
545
- This decorator is useful if this step may hang indefinitely.
546
-
547
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
548
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
549
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
550
-
551
- Note that all the values specified in parameters are added together so if you specify
552
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
553
-
554
-
555
- Parameters
556
- ----------
557
- seconds : int, default 0
558
- Number of seconds to wait prior to timing out.
559
- minutes : int, default 0
560
- Number of minutes to wait prior to timing out.
561
- hours : int, default 0
562
- Number of hours to wait prior to timing out.
563
- """
564
- ...
565
-
566
- @typing.overload
567
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
568
- ...
569
-
570
- @typing.overload
571
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
572
- ...
573
-
574
- 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):
599
+ 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]]]:
575
600
  """
576
- Specifies a timeout for your step.
577
-
578
- This decorator is useful if this step may hang indefinitely.
579
-
580
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
581
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
582
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
583
-
584
- Note that all the values specified in parameters are added together so if you specify
585
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
601
+ Specifies the resources needed when executing this step.
586
602
 
603
+ Use `@resources` to specify the resource requirements
604
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
587
605
 
588
- Parameters
589
- ----------
590
- seconds : int, default 0
591
- Number of seconds to wait prior to timing out.
592
- minutes : int, default 0
593
- Number of minutes to wait prior to timing out.
594
- hours : int, default 0
595
- Number of hours to wait prior to timing out.
596
- """
597
- ...
598
-
599
- @typing.overload
600
- 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]]]:
601
- """
602
- Specifies secrets to be retrieved and injected as environment variables prior to
603
- the execution of a step.
606
+ You can choose the compute layer on the command line by executing e.g.
607
+ ```
608
+ python myflow.py run --with batch
609
+ ```
610
+ or
611
+ ```
612
+ python myflow.py run --with kubernetes
613
+ ```
614
+ which executes the flow on the desired system using the
615
+ requirements specified in `@resources`.
604
616
 
605
617
 
606
618
  Parameters
607
619
  ----------
608
- sources : List[Union[str, Dict[str, Any]]], default: []
609
- List of secret specs, defining how the secrets are to be retrieved
620
+ cpu : int, default 1
621
+ Number of CPUs required for this step.
622
+ gpu : int, optional, default None
623
+ Number of GPUs required for this step.
624
+ disk : int, optional, default None
625
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
626
+ memory : int, default 4096
627
+ Memory size (in MB) required for this step.
628
+ shared_memory : int, optional, default None
629
+ The value for the size (in MiB) of the /dev/shm volume for this step.
630
+ This parameter maps to the `--shm-size` option in Docker.
610
631
  """
611
632
  ...
612
633
 
613
634
  @typing.overload
614
- def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
635
+ def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
615
636
  ...
616
637
 
617
638
  @typing.overload
618
- def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
639
+ def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
619
640
  ...
620
641
 
621
- 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]]] = []):
642
+ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
622
643
  """
623
- Specifies secrets to be retrieved and injected as environment variables prior to
624
- the execution of a step.
625
-
644
+ Specifies the resources needed when executing this step.
626
645
 
627
- Parameters
628
- ----------
629
- sources : List[Union[str, Dict[str, Any]]], default: []
630
- List of secret specs, defining how the secrets are to be retrieved
631
- """
632
- ...
633
-
634
- @typing.overload
635
- 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]]]:
636
- """
637
- Creates a human-readable report, a Metaflow Card, after this step completes.
646
+ Use `@resources` to specify the resource requirements
647
+ independently of the specific compute layer (`@batch`, `@kubernetes`).
638
648
 
639
- Note that you may add multiple `@card` decorators in a step with different parameters.
649
+ You can choose the compute layer on the command line by executing e.g.
650
+ ```
651
+ python myflow.py run --with batch
652
+ ```
653
+ or
654
+ ```
655
+ python myflow.py run --with kubernetes
656
+ ```
657
+ which executes the flow on the desired system using the
658
+ requirements specified in `@resources`.
640
659
 
641
660
 
642
661
  Parameters
643
662
  ----------
644
- type : str, default 'default'
645
- Card type.
646
- id : str, optional, default None
647
- If multiple cards are present, use this id to identify this card.
648
- options : Dict[str, Any], default {}
649
- Options passed to the card. The contents depend on the card type.
650
- timeout : int, default 45
651
- Interrupt reporting if it takes more than this many seconds.
663
+ cpu : int, default 1
664
+ Number of CPUs required for this step.
665
+ gpu : int, optional, default None
666
+ Number of GPUs required for this step.
667
+ disk : int, optional, default None
668
+ Disk size (in MB) required for this step. Only applies on Kubernetes.
669
+ memory : int, default 4096
670
+ Memory size (in MB) required for this step.
671
+ shared_memory : int, optional, default None
672
+ The value for the size (in MiB) of the /dev/shm volume for this step.
673
+ This parameter maps to the `--shm-size` option in Docker.
652
674
  """
653
675
  ...
654
676
 
655
677
  @typing.overload
656
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
657
- ...
658
-
659
- @typing.overload
660
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
661
- ...
662
-
663
- 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):
678
+ 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]]]:
664
679
  """
665
- Creates a human-readable report, a Metaflow Card, after this step completes.
680
+ Specifies the PyPI packages for the step.
666
681
 
667
- Note that you may add multiple `@card` decorators in a step with different parameters.
682
+ Information in this decorator will augment any
683
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
684
+ you can use `@pypi_base` to set packages required by all
685
+ steps and use `@pypi` to specify step-specific overrides.
668
686
 
669
687
 
670
688
  Parameters
671
689
  ----------
672
- type : str, default 'default'
673
- Card type.
674
- id : str, optional, default None
675
- If multiple cards are present, use this id to identify this card.
676
- options : Dict[str, Any], default {}
677
- Options passed to the card. The contents depend on the card type.
678
- timeout : int, default 45
679
- Interrupt reporting if it takes more than this many seconds.
690
+ packages : Dict[str, str], default: {}
691
+ Packages to use for this step. The key is the name of the package
692
+ and the value is the version to use.
693
+ python : str, optional, default: None
694
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
695
+ that the version used will correspond to the version of the Python interpreter used to start the run.
680
696
  """
681
697
  ...
682
698
 
683
699
  @typing.overload
684
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
685
- """
686
- Decorator prototype for all step decorators. This function gets specialized
687
- and imported for all decorators types by _import_plugin_decorators().
688
- """
700
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
689
701
  ...
690
702
 
691
703
  @typing.overload
692
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
693
- ...
694
-
695
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
696
- """
697
- Decorator prototype for all step decorators. This function gets specialized
698
- and imported for all decorators types by _import_plugin_decorators().
699
- """
704
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
700
705
  ...
701
706
 
702
- @typing.overload
703
- 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]]]:
707
+ 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):
704
708
  """
705
709
  Specifies the PyPI packages for the step.
706
710
 
@@ -722,143 +726,147 @@ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] =
722
726
  ...
723
727
 
724
728
  @typing.overload
725
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
729
+ 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]]]:
730
+ """
731
+ Specifies secrets to be retrieved and injected as environment variables prior to
732
+ the execution of a step.
733
+
734
+
735
+ Parameters
736
+ ----------
737
+ sources : List[Union[str, Dict[str, Any]]], default: []
738
+ List of secret specs, defining how the secrets are to be retrieved
739
+ """
726
740
  ...
727
741
 
728
742
  @typing.overload
729
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
743
+ def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
744
+ ...
745
+
746
+ @typing.overload
747
+ def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
730
748
  ...
731
749
 
732
- 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):
750
+ 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]]] = []):
733
751
  """
734
- Specifies the PyPI packages for the step.
735
-
736
- Information in this decorator will augment any
737
- attributes set in the `@pyi_base` flow-level decorator. Hence,
738
- you can use `@pypi_base` to set packages required by all
739
- steps and use `@pypi` to specify step-specific overrides.
752
+ Specifies secrets to be retrieved and injected as environment variables prior to
753
+ the execution of a step.
740
754
 
741
755
 
742
756
  Parameters
743
757
  ----------
744
- packages : Dict[str, str], default: {}
745
- Packages to use for this step. The key is the name of the package
746
- and the value is the version to use.
747
- python : str, optional, default: None
748
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
749
- that the version used will correspond to the version of the Python interpreter used to start the run.
758
+ sources : List[Union[str, Dict[str, Any]]], default: []
759
+ List of secret specs, defining how the secrets are to be retrieved
750
760
  """
751
761
  ...
752
762
 
753
763
  @typing.overload
754
- 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]]]:
764
+ 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]]]:
755
765
  """
756
- Specifies environment variables to be set prior to the execution of a step.
766
+ Specifies the Conda environment for the step.
767
+
768
+ Information in this decorator will augment any
769
+ attributes set in the `@conda_base` flow-level decorator. Hence,
770
+ you can use `@conda_base` to set packages required by all
771
+ steps and use `@conda` to specify step-specific overrides.
757
772
 
758
773
 
759
774
  Parameters
760
775
  ----------
761
- vars : Dict[str, str], default {}
762
- Dictionary of environment variables to set.
776
+ packages : Dict[str, str], default {}
777
+ Packages to use for this step. The key is the name of the package
778
+ and the value is the version to use.
779
+ libraries : Dict[str, str], default {}
780
+ Supported for backward compatibility. When used with packages, packages will take precedence.
781
+ python : str, optional, default None
782
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
783
+ that the version used will correspond to the version of the Python interpreter used to start the run.
784
+ disabled : bool, default False
785
+ If set to True, disables @conda.
763
786
  """
764
787
  ...
765
788
 
766
789
  @typing.overload
767
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
790
+ def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
768
791
  ...
769
792
 
770
793
  @typing.overload
771
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
794
+ def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
772
795
  ...
773
796
 
774
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
797
+ 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):
775
798
  """
776
- Specifies environment variables to be set prior to the execution of a step.
799
+ Specifies the Conda environment for the step.
800
+
801
+ Information in this decorator will augment any
802
+ attributes set in the `@conda_base` flow-level decorator. Hence,
803
+ you can use `@conda_base` to set packages required by all
804
+ steps and use `@conda` to specify step-specific overrides.
777
805
 
778
806
 
779
807
  Parameters
780
808
  ----------
781
- vars : Dict[str, str], default {}
782
- Dictionary of environment variables to set.
809
+ packages : Dict[str, str], default {}
810
+ Packages to use for this step. The key is the name of the package
811
+ and the value is the version to use.
812
+ libraries : Dict[str, str], default {}
813
+ Supported for backward compatibility. When used with packages, packages will take precedence.
814
+ python : str, optional, default None
815
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
816
+ that the version used will correspond to the version of the Python interpreter used to start the run.
817
+ disabled : bool, default False
818
+ If set to True, disables @conda.
783
819
  """
784
820
  ...
785
821
 
786
822
  @typing.overload
787
- 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]]]:
823
+ 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]]]:
788
824
  """
789
- Specifies the resources needed when executing this step.
790
-
791
- Use `@resources` to specify the resource requirements
792
- independently of the specific compute layer (`@batch`, `@kubernetes`).
825
+ Specifies that the step will success under all circumstances.
793
826
 
794
- You can choose the compute layer on the command line by executing e.g.
795
- ```
796
- python myflow.py run --with batch
797
- ```
798
- or
799
- ```
800
- python myflow.py run --with kubernetes
801
- ```
802
- which executes the flow on the desired system using the
803
- requirements specified in `@resources`.
827
+ The decorator will create an optional artifact, specified by `var`, which
828
+ contains the exception raised. You can use it to detect the presence
829
+ of errors, indicating that all happy-path artifacts produced by the step
830
+ are missing.
804
831
 
805
832
 
806
833
  Parameters
807
834
  ----------
808
- cpu : int, default 1
809
- Number of CPUs required for this step.
810
- gpu : int, optional, default None
811
- Number of GPUs required for this step.
812
- disk : int, optional, default None
813
- Disk size (in MB) required for this step. Only applies on Kubernetes.
814
- memory : int, default 4096
815
- Memory size (in MB) required for this step.
816
- shared_memory : int, optional, default None
817
- The value for the size (in MiB) of the /dev/shm volume for this step.
818
- This parameter maps to the `--shm-size` option in Docker.
835
+ var : str, optional, default None
836
+ Name of the artifact in which to store the caught exception.
837
+ If not specified, the exception is not stored.
838
+ print_exception : bool, default True
839
+ Determines whether or not the exception is printed to
840
+ stdout when caught.
819
841
  """
820
842
  ...
821
843
 
822
844
  @typing.overload
823
- def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
845
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
824
846
  ...
825
847
 
826
848
  @typing.overload
827
- def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
849
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
828
850
  ...
829
851
 
830
- def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
852
+ 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):
831
853
  """
832
- Specifies the resources needed when executing this step.
833
-
834
- Use `@resources` to specify the resource requirements
835
- independently of the specific compute layer (`@batch`, `@kubernetes`).
854
+ Specifies that the step will success under all circumstances.
836
855
 
837
- You can choose the compute layer on the command line by executing e.g.
838
- ```
839
- python myflow.py run --with batch
840
- ```
841
- or
842
- ```
843
- python myflow.py run --with kubernetes
844
- ```
845
- which executes the flow on the desired system using the
846
- requirements specified in `@resources`.
856
+ The decorator will create an optional artifact, specified by `var`, which
857
+ contains the exception raised. You can use it to detect the presence
858
+ of errors, indicating that all happy-path artifacts produced by the step
859
+ are missing.
847
860
 
848
861
 
849
862
  Parameters
850
863
  ----------
851
- cpu : int, default 1
852
- Number of CPUs required for this step.
853
- gpu : int, optional, default None
854
- Number of GPUs required for this step.
855
- disk : int, optional, default None
856
- Disk size (in MB) required for this step. Only applies on Kubernetes.
857
- memory : int, default 4096
858
- Memory size (in MB) required for this step.
859
- shared_memory : int, optional, default None
860
- The value for the size (in MiB) of the /dev/shm volume for this step.
861
- This parameter maps to the `--shm-size` option in Docker.
864
+ var : str, optional, default None
865
+ Name of the artifact in which to store the caught exception.
866
+ If not specified, the exception is not stored.
867
+ print_exception : bool, default True
868
+ Determines whether or not the exception is printed to
869
+ stdout when caught.
862
870
  """
863
871
  ...
864
872
 
@@ -897,147 +905,87 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
897
905
  """
898
906
  ...
899
907
 
900
- @typing.overload
901
- 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]]:
902
- """
903
- Specifies the times when the flow should be run when running on a
904
- production scheduler.
905
-
906
-
907
- Parameters
908
- ----------
909
- hourly : bool, default False
910
- Run the workflow hourly.
911
- daily : bool, default True
912
- Run the workflow daily.
913
- weekly : bool, default False
914
- Run the workflow weekly.
915
- cron : str, optional, default None
916
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
917
- specified by this expression.
918
- timezone : str, optional, default None
919
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
920
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
921
- """
922
- ...
923
-
924
- @typing.overload
925
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
926
- ...
927
-
928
- 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):
908
+ 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]]:
929
909
  """
930
- Specifies the times when the flow should be run when running on a
931
- production scheduler.
910
+ 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.
911
+ 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.
932
912
 
933
913
 
934
914
  Parameters
935
915
  ----------
936
- hourly : bool, default False
937
- Run the workflow hourly.
938
- daily : bool, default True
939
- Run the workflow daily.
940
- weekly : bool, default False
941
- Run the workflow weekly.
942
- cron : str, optional, default None
943
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
944
- specified by this expression.
945
- timezone : str, optional, default None
946
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
947
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
948
- """
949
- ...
950
-
951
- @typing.overload
952
- 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]]:
916
+ timeout : int
917
+ Time, in seconds before the task times out and fails. (Default: 3600)
918
+ poke_interval : int
919
+ Time in seconds that the job should wait in between each try. (Default: 60)
920
+ mode : str
921
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
922
+ exponential_backoff : bool
923
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
924
+ pool : str
925
+ the slot pool this task should run in,
926
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
927
+ soft_fail : bool
928
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
929
+ name : str
930
+ Name of the sensor on Airflow
931
+ description : str
932
+ Description of sensor in the Airflow UI
933
+ external_dag_id : str
934
+ The dag_id that contains the task you want to wait for.
935
+ external_task_ids : List[str]
936
+ The list of task_ids that you want to wait for.
937
+ If None (default value) the sensor waits for the DAG. (Default: None)
938
+ allowed_states : List[str]
939
+ Iterable of allowed states, (Default: ['success'])
940
+ failed_states : List[str]
941
+ Iterable of failed or dis-allowed states. (Default: None)
942
+ execution_delta : datetime.timedelta
943
+ time difference with the previous execution to look at,
944
+ the default is the same logical date as the current task or DAG. (Default: None)
945
+ check_existence: bool
946
+ Set to True to check if the external task exists or check if
947
+ the DAG to wait for exists. (Default: True)
953
948
  """
954
- Specifies the event(s) that this flow depends on.
955
-
956
- ```
957
- @trigger(event='foo')
958
- ```
959
- or
960
- ```
961
- @trigger(events=['foo', 'bar'])
962
- ```
963
-
964
- Additionally, you can specify the parameter mappings
965
- to map event payload to Metaflow parameters for the flow.
966
- ```
967
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
968
- ```
969
- or
970
- ```
971
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
972
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
973
- ```
974
-
975
- 'parameters' can also be a list of strings and tuples like so:
976
- ```
977
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
978
- ```
979
- This is equivalent to:
980
- ```
981
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
982
- ```
949
+ ...
950
+
951
+ @typing.overload
952
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
953
+ """
954
+ Specifies the PyPI packages for all steps of the flow.
983
955
 
956
+ Use `@pypi_base` to set common packages required by all
957
+ steps and use `@pypi` to specify step-specific overrides.
984
958
 
985
959
  Parameters
986
960
  ----------
987
- event : Union[str, Dict[str, Any]], optional, default None
988
- Event dependency for this flow.
989
- events : List[Union[str, Dict[str, Any]]], default []
990
- Events dependency for this flow.
991
- options : Dict[str, Any], default {}
992
- Backend-specific configuration for tuning eventing behavior.
961
+ packages : Dict[str, str], default: {}
962
+ Packages to use for this flow. The key is the name of the package
963
+ and the value is the version to use.
964
+ python : str, optional, default: None
965
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
966
+ that the version used will correspond to the version of the Python interpreter used to start the run.
993
967
  """
994
968
  ...
995
969
 
996
970
  @typing.overload
997
- def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
971
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
998
972
  ...
999
973
 
1000
- 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] = {}):
974
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1001
975
  """
1002
- Specifies the event(s) that this flow depends on.
1003
-
1004
- ```
1005
- @trigger(event='foo')
1006
- ```
1007
- or
1008
- ```
1009
- @trigger(events=['foo', 'bar'])
1010
- ```
1011
-
1012
- Additionally, you can specify the parameter mappings
1013
- to map event payload to Metaflow parameters for the flow.
1014
- ```
1015
- @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1016
- ```
1017
- or
1018
- ```
1019
- @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1020
- {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1021
- ```
1022
-
1023
- 'parameters' can also be a list of strings and tuples like so:
1024
- ```
1025
- @trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
1026
- ```
1027
- This is equivalent to:
1028
- ```
1029
- @trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
1030
- ```
976
+ Specifies the PyPI packages for all steps of the flow.
1031
977
 
978
+ Use `@pypi_base` to set common packages required by all
979
+ steps and use `@pypi` to specify step-specific overrides.
1032
980
 
1033
981
  Parameters
1034
982
  ----------
1035
- event : Union[str, Dict[str, Any]], optional, default None
1036
- Event dependency for this flow.
1037
- events : List[Union[str, Dict[str, Any]]], default []
1038
- Events dependency for this flow.
1039
- options : Dict[str, Any], default {}
1040
- Backend-specific configuration for tuning eventing behavior.
983
+ packages : Dict[str, str], default: {}
984
+ Packages to use for this flow. The key is the name of the package
985
+ and the value is the version to use.
986
+ python : str, optional, default: None
987
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
988
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1041
989
  """
1042
990
  ...
1043
991
 
@@ -1135,6 +1083,99 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1135
1083
  """
1136
1084
  ...
1137
1085
 
1086
+ @typing.overload
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]]:
1088
+ """
1089
+ Specifies the event(s) that this flow depends on.
1090
+
1091
+ ```
1092
+ @trigger(event='foo')
1093
+ ```
1094
+ or
1095
+ ```
1096
+ @trigger(events=['foo', 'bar'])
1097
+ ```
1098
+
1099
+ Additionally, you can specify the parameter mappings
1100
+ to map event payload to Metaflow parameters for the flow.
1101
+ ```
1102
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1103
+ ```
1104
+ or
1105
+ ```
1106
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1107
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1108
+ ```
1109
+
1110
+ 'parameters' can also be a list of strings and tuples like so:
1111
+ ```
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'}})
1117
+ ```
1118
+
1119
+
1120
+ Parameters
1121
+ ----------
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.
1126
+ options : Dict[str, Any], default {}
1127
+ Backend-specific configuration for tuning eventing behavior.
1128
+ """
1129
+ ...
1130
+
1131
+ @typing.overload
1132
+ def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1133
+ ...
1134
+
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] = {}):
1136
+ """
1137
+ Specifies the event(s) that this flow depends on.
1138
+
1139
+ ```
1140
+ @trigger(event='foo')
1141
+ ```
1142
+ or
1143
+ ```
1144
+ @trigger(events=['foo', 'bar'])
1145
+ ```
1146
+
1147
+ Additionally, you can specify the parameter mappings
1148
+ to map event payload to Metaflow parameters for the flow.
1149
+ ```
1150
+ @trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
1151
+ ```
1152
+ or
1153
+ ```
1154
+ @trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
1155
+ {'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
1156
+ ```
1157
+
1158
+ 'parameters' can also be a list of strings and tuples like so:
1159
+ ```
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'}})
1165
+ ```
1166
+
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.
1174
+ options : Dict[str, Any], default {}
1175
+ Backend-specific configuration for tuning eventing behavior.
1176
+ """
1177
+ ...
1178
+
1138
1179
  @typing.overload
1139
1180
  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]]:
1140
1181
  """
@@ -1236,87 +1277,54 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
1236
1277
  """
1237
1278
  ...
1238
1279
 
1239
- 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]]:
1240
- """
1241
- 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.
1242
- 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.
1243
-
1244
-
1245
- Parameters
1246
- ----------
1247
- timeout : int
1248
- Time, in seconds before the task times out and fails. (Default: 3600)
1249
- poke_interval : int
1250
- Time in seconds that the job should wait in between each try. (Default: 60)
1251
- mode : str
1252
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1253
- exponential_backoff : bool
1254
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1255
- pool : str
1256
- the slot pool this task should run in,
1257
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1258
- soft_fail : bool
1259
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1260
- name : str
1261
- Name of the sensor on Airflow
1262
- description : str
1263
- Description of sensor in the Airflow UI
1264
- external_dag_id : str
1265
- The dag_id that contains the task you want to wait for.
1266
- external_task_ids : List[str]
1267
- The list of task_ids that you want to wait for.
1268
- If None (default value) the sensor waits for the DAG. (Default: None)
1269
- allowed_states : List[str]
1270
- Iterable of allowed states, (Default: ['success'])
1271
- failed_states : List[str]
1272
- Iterable of failed or dis-allowed states. (Default: None)
1273
- execution_delta : datetime.timedelta
1274
- time difference with the previous execution to look at,
1275
- the default is the same logical date as the current task or DAG. (Default: None)
1276
- check_existence: bool
1277
- Set to True to check if the external task exists or check if
1278
- the DAG to wait for exists. (Default: True)
1279
- """
1280
- ...
1281
-
1282
1280
  @typing.overload
1283
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1281
+ 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]]:
1284
1282
  """
1285
- Specifies the PyPI packages for all steps of the flow.
1283
+ Specifies the times when the flow should be run when running on a
1284
+ production scheduler.
1286
1285
 
1287
- Use `@pypi_base` to set common packages required by all
1288
- steps and use `@pypi` to specify step-specific overrides.
1289
1286
 
1290
1287
  Parameters
1291
1288
  ----------
1292
- packages : Dict[str, str], default: {}
1293
- Packages to use for this flow. The key is the name of the package
1294
- and the value is the version to use.
1295
- python : str, optional, default: None
1296
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1297
- that the version used will correspond to the version of the Python interpreter used to start the run.
1289
+ hourly : bool, default False
1290
+ Run the workflow hourly.
1291
+ daily : bool, default True
1292
+ Run the workflow daily.
1293
+ weekly : bool, default False
1294
+ Run the workflow weekly.
1295
+ cron : str, optional, default None
1296
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1297
+ specified by this expression.
1298
+ timezone : str, optional, default None
1299
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1300
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1298
1301
  """
1299
1302
  ...
1300
1303
 
1301
1304
  @typing.overload
1302
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1305
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1303
1306
  ...
1304
1307
 
1305
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1308
+ 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):
1306
1309
  """
1307
- Specifies the PyPI packages for all steps of the flow.
1310
+ Specifies the times when the flow should be run when running on a
1311
+ production scheduler.
1308
1312
 
1309
- Use `@pypi_base` to set common packages required by all
1310
- steps and use `@pypi` to specify step-specific overrides.
1311
1313
 
1312
1314
  Parameters
1313
1315
  ----------
1314
- packages : Dict[str, str], default: {}
1315
- Packages to use for this flow. The key is the name of the package
1316
- and the value is the version to use.
1317
- python : str, optional, default: None
1318
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1319
- that the version used will correspond to the version of the Python interpreter used to start the run.
1316
+ hourly : bool, default False
1317
+ Run the workflow hourly.
1318
+ daily : bool, default True
1319
+ Run the workflow daily.
1320
+ weekly : bool, default False
1321
+ Run the workflow weekly.
1322
+ cron : str, optional, default None
1323
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1324
+ specified by this expression.
1325
+ timezone : str, optional, default None
1326
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1327
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1320
1328
  """
1321
1329
  ...
1322
1330