metaflow-stubs 2.14.2__py2.py3-none-any.whl → 2.14.3__py2.py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (145) hide show
  1. metaflow-stubs/__init__.pyi +503 -503
  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 +5 -5
  8. metaflow-stubs/client/filecache.pyi +3 -3
  9. metaflow-stubs/events.pyi +3 -3
  10. metaflow-stubs/exception.pyi +2 -2
  11. metaflow-stubs/flowspec.pyi +6 -6
  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 +4 -2
  20. metaflow-stubs/metaflow_current.pyi +17 -17
  21. metaflow-stubs/multicore_utils.pyi +2 -2
  22. metaflow-stubs/parameters.pyi +3 -3
  23. metaflow-stubs/plugins/__init__.pyi +14 -14
  24. metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
  25. metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
  26. metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
  27. metaflow-stubs/plugins/airflow/exception.pyi +2 -2
  28. metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
  29. metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
  30. metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
  31. metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
  32. metaflow-stubs/plugins/argo/__init__.pyi +2 -2
  33. metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
  34. metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
  35. metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
  36. metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
  37. metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
  38. metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
  39. metaflow-stubs/plugins/aws/__init__.pyi +3 -3
  40. metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
  41. metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
  42. metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
  43. metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
  44. metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
  45. metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
  46. metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
  47. metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
  48. metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
  49. metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
  50. metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
  51. metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
  52. metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
  53. metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
  54. metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
  55. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
  56. metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
  57. metaflow-stubs/plugins/azure/__init__.pyi +2 -2
  58. metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
  59. metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
  60. metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
  61. metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
  62. metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
  63. metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
  64. metaflow-stubs/plugins/cards/__init__.pyi +2 -2
  65. metaflow-stubs/plugins/cards/card_client.pyi +2 -2
  66. metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
  67. metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
  68. metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
  69. metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
  70. metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
  71. metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
  72. metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
  73. metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
  74. metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
  75. metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
  76. metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
  77. metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
  78. metaflow-stubs/plugins/cards/exception.pyi +2 -2
  79. metaflow-stubs/plugins/catch_decorator.pyi +2 -2
  80. metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
  81. metaflow-stubs/plugins/datatools/local.pyi +2 -2
  82. metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
  83. metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
  84. metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
  85. metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
  86. metaflow-stubs/plugins/debug_logger.pyi +2 -2
  87. metaflow-stubs/plugins/debug_monitor.pyi +2 -2
  88. metaflow-stubs/plugins/environment_decorator.pyi +2 -2
  89. metaflow-stubs/plugins/events_decorator.pyi +2 -2
  90. metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
  91. metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
  92. metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
  93. metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
  94. metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
  95. metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
  96. metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
  97. metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
  98. metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
  99. metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
  100. metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
  101. metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
  102. metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
  103. metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
  104. metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
  105. metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
  106. metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
  107. metaflow-stubs/plugins/project_decorator.pyi +2 -2
  108. metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
  109. metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
  110. metaflow-stubs/plugins/pypi/conda_environment.pyi +6 -6
  111. metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
  112. metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
  113. metaflow-stubs/plugins/pypi/utils.pyi +2 -2
  114. metaflow-stubs/plugins/resources_decorator.pyi +2 -2
  115. metaflow-stubs/plugins/retry_decorator.pyi +2 -2
  116. metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
  117. metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
  118. metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
  119. metaflow-stubs/plugins/storage_executor.pyi +2 -2
  120. metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
  121. metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
  122. metaflow-stubs/pylint_wrapper.pyi +2 -2
  123. metaflow-stubs/runner/__init__.pyi +2 -2
  124. metaflow-stubs/runner/deployer.pyi +30 -30
  125. metaflow-stubs/runner/deployer_impl.pyi +2 -2
  126. metaflow-stubs/runner/metaflow_runner.pyi +3 -3
  127. metaflow-stubs/runner/nbdeploy.pyi +2 -2
  128. metaflow-stubs/runner/nbrun.pyi +2 -2
  129. metaflow-stubs/runner/subprocess_manager.pyi +2 -2
  130. metaflow-stubs/runner/utils.pyi +3 -3
  131. metaflow-stubs/system/__init__.pyi +2 -2
  132. metaflow-stubs/system/system_logger.pyi +2 -2
  133. metaflow-stubs/system/system_monitor.pyi +2 -2
  134. metaflow-stubs/tagging_util.pyi +2 -2
  135. metaflow-stubs/tuple_util.pyi +2 -2
  136. metaflow-stubs/user_configs/__init__.pyi +2 -2
  137. metaflow-stubs/user_configs/config_decorators.pyi +7 -7
  138. metaflow-stubs/user_configs/config_options.pyi +2 -2
  139. metaflow-stubs/user_configs/config_parameters.pyi +6 -6
  140. metaflow-stubs/version.pyi +2 -2
  141. {metaflow_stubs-2.14.2.dist-info → metaflow_stubs-2.14.3.dist-info}/METADATA +2 -2
  142. metaflow_stubs-2.14.3.dist-info/RECORD +145 -0
  143. metaflow_stubs-2.14.2.dist-info/RECORD +0 -145
  144. {metaflow_stubs-2.14.2.dist-info → metaflow_stubs-2.14.3.dist-info}/WHEEL +0 -0
  145. {metaflow_stubs-2.14.2.dist-info → metaflow_stubs-2.14.3.dist-info}/top_level.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  ######################################################################################################
2
2
  # Auto-generated Metaflow stub file #
3
- # MF version: 2.14.2 #
4
- # Generated on 2025-02-21T20:07:35.058121 #
3
+ # MF version: 2.14.3 #
4
+ # Generated on 2025-02-22T04:36:00.916575 #
5
5
  ######################################################################################################
6
6
 
7
7
  from __future__ import annotations
@@ -143,237 +143,231 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
143
143
  ...
144
144
 
145
145
  @typing.overload
146
- 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]]]:
146
+ 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]]]:
147
147
  """
148
- Specifies environment variables to be set prior to the execution of a step.
148
+ Specifies the PyPI packages for the step.
149
+
150
+ Information in this decorator will augment any
151
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
152
+ you can use `@pypi_base` to set packages required by all
153
+ steps and use `@pypi` to specify step-specific overrides.
149
154
 
150
155
 
151
156
  Parameters
152
157
  ----------
153
- vars : Dict[str, str], default {}
154
- Dictionary of environment variables to set.
158
+ packages : Dict[str, str], default: {}
159
+ Packages to use for this step. The key is the name of the package
160
+ and the value is the version to use.
161
+ python : str, optional, default: None
162
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
163
+ that the version used will correspond to the version of the Python interpreter used to start the run.
155
164
  """
156
165
  ...
157
166
 
158
167
  @typing.overload
159
- def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
168
+ def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
160
169
  ...
161
170
 
162
171
  @typing.overload
163
- def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
172
+ def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
164
173
  ...
165
174
 
166
- def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
175
+ 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):
167
176
  """
168
- Specifies environment variables to be set prior to the execution of a step.
177
+ Specifies the PyPI packages for the step.
178
+
179
+ Information in this decorator will augment any
180
+ attributes set in the `@pyi_base` flow-level decorator. Hence,
181
+ you can use `@pypi_base` to set packages required by all
182
+ steps and use `@pypi` to specify step-specific overrides.
169
183
 
170
184
 
171
185
  Parameters
172
186
  ----------
173
- vars : Dict[str, str], default {}
174
- Dictionary of environment variables to set.
187
+ packages : Dict[str, str], default: {}
188
+ Packages to use for this step. The key is the name of the package
189
+ and the value is the version to use.
190
+ python : str, optional, default: None
191
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
192
+ that the version used will correspond to the version of the Python interpreter used to start the run.
175
193
  """
176
194
  ...
177
195
 
178
196
  @typing.overload
179
- 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]]]:
197
+ 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]]]:
180
198
  """
181
- Specifies the number of times the task corresponding
182
- to a step needs to be retried.
199
+ Specifies a timeout for your step.
183
200
 
184
- This decorator is useful for handling transient errors, such as networking issues.
185
- If your task contains operations that can't be retried safely, e.g. database updates,
186
- it is advisable to annotate it with `@retry(times=0)`.
201
+ This decorator is useful if this step may hang indefinitely.
187
202
 
188
- This can be used in conjunction with the `@catch` decorator. The `@catch`
189
- decorator will execute a no-op task after all retries have been exhausted,
190
- ensuring that the flow execution can continue.
203
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
204
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
205
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
206
+
207
+ Note that all the values specified in parameters are added together so if you specify
208
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
191
209
 
192
210
 
193
211
  Parameters
194
212
  ----------
195
- times : int, default 3
196
- Number of times to retry this task.
197
- minutes_between_retries : int, default 2
198
- Number of minutes between retries.
213
+ seconds : int, default 0
214
+ Number of seconds to wait prior to timing out.
215
+ minutes : int, default 0
216
+ Number of minutes to wait prior to timing out.
217
+ hours : int, default 0
218
+ Number of hours to wait prior to timing out.
199
219
  """
200
220
  ...
201
221
 
202
222
  @typing.overload
203
- def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
223
+ def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
204
224
  ...
205
225
 
206
226
  @typing.overload
207
- def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
227
+ def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
208
228
  ...
209
229
 
210
- 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):
230
+ 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):
211
231
  """
212
- Specifies the number of times the task corresponding
213
- to a step needs to be retried.
232
+ Specifies a timeout for your step.
214
233
 
215
- This decorator is useful for handling transient errors, such as networking issues.
216
- If your task contains operations that can't be retried safely, e.g. database updates,
217
- it is advisable to annotate it with `@retry(times=0)`.
234
+ This decorator is useful if this step may hang indefinitely.
218
235
 
219
- This can be used in conjunction with the `@catch` decorator. The `@catch`
220
- decorator will execute a no-op task after all retries have been exhausted,
221
- ensuring that the flow execution can continue.
236
+ This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
237
+ A timeout is considered to be an exception thrown by the step. It will cause the step to be
238
+ retried if needed and the exception will be caught by the `@catch` decorator, if present.
239
+
240
+ Note that all the values specified in parameters are added together so if you specify
241
+ 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
222
242
 
223
243
 
224
244
  Parameters
225
245
  ----------
226
- times : int, default 3
227
- Number of times to retry this task.
228
- minutes_between_retries : int, default 2
229
- Number of minutes between retries.
246
+ seconds : int, default 0
247
+ Number of seconds to wait prior to timing out.
248
+ minutes : int, default 0
249
+ Number of minutes to wait prior to timing out.
250
+ hours : int, default 0
251
+ Number of hours to wait prior to timing out.
230
252
  """
231
253
  ...
232
254
 
233
- 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]]]:
255
+ @typing.overload
256
+ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
234
257
  """
235
- Specifies that this step should execute on Kubernetes.
236
-
237
-
238
258
  Parameters
239
259
  ----------
240
- cpu : int, default 1
241
- Number of CPUs required for this step. If `@resources` is
242
- also present, the maximum value from all decorators is used.
243
- memory : int, default 4096
244
- Memory size (in MB) required for this step. If
245
- `@resources` is also present, the maximum value from all decorators is
246
- used.
247
- disk : int, default 10240
248
- Disk size (in MB) required for this step. If
249
- `@resources` is also present, the maximum value from all decorators is
250
- used.
251
- image : str, optional, default None
252
- Docker image to use when launching on Kubernetes. If not specified, and
253
- METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
254
- not, a default Docker image mapping to the current version of Python is used.
255
- image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
256
- If given, the imagePullPolicy to be applied to the Docker image of the step.
257
- service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
258
- Kubernetes service account to use when launching pod in Kubernetes.
259
- secrets : List[str], optional, default None
260
- Kubernetes secrets to use when launching pod in Kubernetes. These
261
- secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
262
- in Metaflow configuration.
263
- node_selector: Union[Dict[str,str], str], optional, default None
264
- Kubernetes node selector(s) to apply to the pod running the task.
265
- Can be passed in as a comma separated string of values e.g.
266
- 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
267
- {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
268
- namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
269
- Kubernetes namespace to use when launching pod in Kubernetes.
270
- gpu : int, optional, default None
271
- Number of GPUs required for this step. A value of zero implies that
272
- the scheduled node should not have GPUs.
273
- gpu_vendor : str, default KUBERNETES_GPU_VENDOR
274
- The vendor of the GPUs to be used for this step.
275
- tolerations : List[str], default []
276
- The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
277
- Kubernetes tolerations to use when launching pod in Kubernetes.
278
- labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
279
- Kubernetes labels to use when launching pod in Kubernetes.
280
- annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
281
- Kubernetes annotations to use when launching pod in Kubernetes.
282
- use_tmpfs : bool, default False
283
- This enables an explicit tmpfs mount for this step.
284
- tmpfs_tempdir : bool, default True
285
- sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
286
- tmpfs_size : int, optional, default: None
287
- The value for the size (in MiB) of the tmpfs mount for this step.
288
- This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
289
- memory allocated for this step.
290
- tmpfs_path : str, optional, default /metaflow_temp
291
- Path to tmpfs mount for this step.
292
- persistent_volume_claims : Dict[str, str], optional, default None
293
- A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
294
- volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
295
- shared_memory: int, optional
296
- Shared memory size (in MiB) required for this step
297
- port: int, optional
298
- Port number to specify in the Kubernetes job object
299
- compute_pool : str, optional, default None
300
- Compute pool to be used for for this step.
301
- If not specified, any accessible compute pool within the perimeter is used.
302
- hostname_resolution_timeout: int, default 10 * 60
303
- Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
304
- Only applicable when @parallel is used.
305
- qos: str, default: Burstable
306
- Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
307
260
  """
308
261
  ...
309
262
 
310
263
  @typing.overload
311
- 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]]]:
264
+ def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
265
+ ...
266
+
267
+ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
312
268
  """
313
- Specifies the PyPI packages for the step.
269
+ Parameters
270
+ ----------
271
+ """
272
+ ...
273
+
274
+ @typing.overload
275
+ 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]]]:
276
+ """
277
+ Creates a human-readable report, a Metaflow Card, after this step completes.
314
278
 
315
- Information in this decorator will augment any
316
- attributes set in the `@pyi_base` flow-level decorator. Hence,
317
- you can use `@pypi_base` to set packages required by all
318
- steps and use `@pypi` to specify step-specific overrides.
279
+ Note that you may add multiple `@card` decorators in a step with different parameters.
319
280
 
320
281
 
321
282
  Parameters
322
283
  ----------
323
- packages : Dict[str, str], default: {}
324
- Packages to use for this step. The key is the name of the package
325
- and the value is the version to use.
326
- python : str, optional, default: None
327
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
328
- that the version used will correspond to the version of the Python interpreter used to start the run.
284
+ type : str, default 'default'
285
+ Card type.
286
+ id : str, optional, default None
287
+ If multiple cards are present, use this id to identify this card.
288
+ options : Dict[str, Any], default {}
289
+ Options passed to the card. The contents depend on the card type.
290
+ timeout : int, default 45
291
+ Interrupt reporting if it takes more than this many seconds.
329
292
  """
330
293
  ...
331
294
 
332
295
  @typing.overload
333
- def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
296
+ def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
334
297
  ...
335
298
 
336
299
  @typing.overload
337
- def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
300
+ def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
338
301
  ...
339
302
 
340
- 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):
303
+ 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):
341
304
  """
342
- Specifies the PyPI packages for the step.
305
+ Creates a human-readable report, a Metaflow Card, after this step completes.
343
306
 
344
- Information in this decorator will augment any
345
- attributes set in the `@pyi_base` flow-level decorator. Hence,
346
- you can use `@pypi_base` to set packages required by all
347
- steps and use `@pypi` to specify step-specific overrides.
307
+ Note that you may add multiple `@card` decorators in a step with different parameters.
348
308
 
349
309
 
350
310
  Parameters
351
311
  ----------
352
- packages : Dict[str, str], default: {}
353
- Packages to use for this step. The key is the name of the package
354
- and the value is the version to use.
355
- python : str, optional, default: None
356
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
357
- that the version used will correspond to the version of the Python interpreter used to start the run.
312
+ type : str, default 'default'
313
+ Card type.
314
+ id : str, optional, default None
315
+ If multiple cards are present, use this id to identify this card.
316
+ options : Dict[str, Any], default {}
317
+ Options passed to the card. The contents depend on the card type.
318
+ timeout : int, default 45
319
+ Interrupt reporting if it takes more than this many seconds.
358
320
  """
359
321
  ...
360
322
 
361
323
  @typing.overload
362
- def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
324
+ 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]]]:
363
325
  """
326
+ Specifies that the step will success under all circumstances.
327
+
328
+ The decorator will create an optional artifact, specified by `var`, which
329
+ contains the exception raised. You can use it to detect the presence
330
+ of errors, indicating that all happy-path artifacts produced by the step
331
+ are missing.
332
+
333
+
364
334
  Parameters
365
335
  ----------
336
+ var : str, optional, default None
337
+ Name of the artifact in which to store the caught exception.
338
+ If not specified, the exception is not stored.
339
+ print_exception : bool, default True
340
+ Determines whether or not the exception is printed to
341
+ stdout when caught.
366
342
  """
367
343
  ...
368
344
 
369
345
  @typing.overload
370
- def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
346
+ def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
371
347
  ...
372
348
 
373
- def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
349
+ @typing.overload
350
+ def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
351
+ ...
352
+
353
+ 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):
374
354
  """
355
+ Specifies that the step will success under all circumstances.
356
+
357
+ The decorator will create an optional artifact, specified by `var`, which
358
+ contains the exception raised. You can use it to detect the presence
359
+ of errors, indicating that all happy-path artifacts produced by the step
360
+ are missing.
361
+
362
+
375
363
  Parameters
376
364
  ----------
365
+ var : str, optional, default None
366
+ Name of the artifact in which to store the caught exception.
367
+ If not specified, the exception is not stored.
368
+ print_exception : bool, default True
369
+ Determines whether or not the exception is printed to
370
+ stdout when caught.
377
371
  """
378
372
  ...
379
373
 
@@ -456,57 +450,6 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
456
450
  """
457
451
  ...
458
452
 
459
- @typing.overload
460
- 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]]]:
461
- """
462
- Specifies that the step will success under all circumstances.
463
-
464
- The decorator will create an optional artifact, specified by `var`, which
465
- contains the exception raised. You can use it to detect the presence
466
- of errors, indicating that all happy-path artifacts produced by the step
467
- are missing.
468
-
469
-
470
- Parameters
471
- ----------
472
- var : str, optional, default None
473
- Name of the artifact in which to store the caught exception.
474
- If not specified, the exception is not stored.
475
- print_exception : bool, default True
476
- Determines whether or not the exception is printed to
477
- stdout when caught.
478
- """
479
- ...
480
-
481
- @typing.overload
482
- def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
483
- ...
484
-
485
- @typing.overload
486
- def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
487
- ...
488
-
489
- 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):
490
- """
491
- Specifies that the step will success under all circumstances.
492
-
493
- The decorator will create an optional artifact, specified by `var`, which
494
- contains the exception raised. You can use it to detect the presence
495
- of errors, indicating that all happy-path artifacts produced by the step
496
- are missing.
497
-
498
-
499
- Parameters
500
- ----------
501
- var : str, optional, default None
502
- Name of the artifact in which to store the caught exception.
503
- If not specified, the exception is not stored.
504
- print_exception : bool, default True
505
- Determines whether or not the exception is printed to
506
- stdout when caught.
507
- """
508
- ...
509
-
510
453
  @typing.overload
511
454
  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]]]:
512
455
  """
@@ -715,6 +658,83 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
715
658
  """
716
659
  ...
717
660
 
661
+ 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]]]:
662
+ """
663
+ Specifies that this step should execute on Kubernetes.
664
+
665
+
666
+ Parameters
667
+ ----------
668
+ cpu : int, default 1
669
+ Number of CPUs required for this step. If `@resources` is
670
+ also present, the maximum value from all decorators is used.
671
+ memory : int, default 4096
672
+ Memory size (in MB) required for this step. If
673
+ `@resources` is also present, the maximum value from all decorators is
674
+ used.
675
+ disk : int, default 10240
676
+ Disk size (in MB) required for this step. If
677
+ `@resources` is also present, the maximum value from all decorators is
678
+ used.
679
+ image : str, optional, default None
680
+ Docker image to use when launching on Kubernetes. If not specified, and
681
+ METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
682
+ not, a default Docker image mapping to the current version of Python is used.
683
+ image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
684
+ If given, the imagePullPolicy to be applied to the Docker image of the step.
685
+ service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
686
+ Kubernetes service account to use when launching pod in Kubernetes.
687
+ secrets : List[str], optional, default None
688
+ Kubernetes secrets to use when launching pod in Kubernetes. These
689
+ secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
690
+ in Metaflow configuration.
691
+ node_selector: Union[Dict[str,str], str], optional, default None
692
+ Kubernetes node selector(s) to apply to the pod running the task.
693
+ Can be passed in as a comma separated string of values e.g.
694
+ 'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
695
+ {'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
696
+ namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
697
+ Kubernetes namespace to use when launching pod in Kubernetes.
698
+ gpu : int, optional, default None
699
+ Number of GPUs required for this step. A value of zero implies that
700
+ the scheduled node should not have GPUs.
701
+ gpu_vendor : str, default KUBERNETES_GPU_VENDOR
702
+ The vendor of the GPUs to be used for this step.
703
+ tolerations : List[str], default []
704
+ The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
705
+ Kubernetes tolerations to use when launching pod in Kubernetes.
706
+ labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
707
+ Kubernetes labels to use when launching pod in Kubernetes.
708
+ annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
709
+ Kubernetes annotations to use when launching pod in Kubernetes.
710
+ use_tmpfs : bool, default False
711
+ This enables an explicit tmpfs mount for this step.
712
+ tmpfs_tempdir : bool, default True
713
+ sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
714
+ tmpfs_size : int, optional, default: None
715
+ The value for the size (in MiB) of the tmpfs mount for this step.
716
+ This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
717
+ memory allocated for this step.
718
+ tmpfs_path : str, optional, default /metaflow_temp
719
+ Path to tmpfs mount for this step.
720
+ persistent_volume_claims : Dict[str, str], optional, default None
721
+ A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
722
+ volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
723
+ shared_memory: int, optional
724
+ Shared memory size (in MiB) required for this step
725
+ port: int, optional
726
+ Port number to specify in the Kubernetes job object
727
+ compute_pool : str, optional, default None
728
+ Compute pool to be used for for this step.
729
+ If not specified, any accessible compute pool within the perimeter is used.
730
+ hostname_resolution_timeout: int, default 10 * 60
731
+ Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
732
+ Only applicable when @parallel is used.
733
+ qos: str, default: Burstable
734
+ Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
735
+ """
736
+ ...
737
+
718
738
  @typing.overload
719
739
  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]]]:
720
740
  """
@@ -751,288 +771,234 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
751
771
  ...
752
772
 
753
773
  @typing.overload
754
- 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]]]:
774
+ 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]]]:
755
775
  """
756
- Specifies a timeout for your step.
757
-
758
- This decorator is useful if this step may hang indefinitely.
776
+ Specifies the number of times the task corresponding
777
+ to a step needs to be retried.
759
778
 
760
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
761
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
762
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
779
+ This decorator is useful for handling transient errors, such as networking issues.
780
+ If your task contains operations that can't be retried safely, e.g. database updates,
781
+ it is advisable to annotate it with `@retry(times=0)`.
763
782
 
764
- Note that all the values specified in parameters are added together so if you specify
765
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
783
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
784
+ decorator will execute a no-op task after all retries have been exhausted,
785
+ ensuring that the flow execution can continue.
766
786
 
767
787
 
768
788
  Parameters
769
789
  ----------
770
- seconds : int, default 0
771
- Number of seconds to wait prior to timing out.
772
- minutes : int, default 0
773
- Number of minutes to wait prior to timing out.
774
- hours : int, default 0
775
- Number of hours to wait prior to timing out.
790
+ times : int, default 3
791
+ Number of times to retry this task.
792
+ minutes_between_retries : int, default 2
793
+ Number of minutes between retries.
776
794
  """
777
795
  ...
778
796
 
779
797
  @typing.overload
780
- def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
798
+ def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
781
799
  ...
782
800
 
783
801
  @typing.overload
784
- def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
802
+ def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
785
803
  ...
786
804
 
787
- 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):
805
+ 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):
788
806
  """
789
- Specifies a timeout for your step.
790
-
791
- This decorator is useful if this step may hang indefinitely.
807
+ Specifies the number of times the task corresponding
808
+ to a step needs to be retried.
792
809
 
793
- This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
794
- A timeout is considered to be an exception thrown by the step. It will cause the step to be
795
- retried if needed and the exception will be caught by the `@catch` decorator, if present.
810
+ This decorator is useful for handling transient errors, such as networking issues.
811
+ If your task contains operations that can't be retried safely, e.g. database updates,
812
+ it is advisable to annotate it with `@retry(times=0)`.
796
813
 
797
- Note that all the values specified in parameters are added together so if you specify
798
- 60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
814
+ This can be used in conjunction with the `@catch` decorator. The `@catch`
815
+ decorator will execute a no-op task after all retries have been exhausted,
816
+ ensuring that the flow execution can continue.
799
817
 
800
818
 
801
819
  Parameters
802
820
  ----------
803
- seconds : int, default 0
804
- Number of seconds to wait prior to timing out.
805
- minutes : int, default 0
806
- Number of minutes to wait prior to timing out.
807
- hours : int, default 0
808
- Number of hours to wait prior to timing out.
821
+ times : int, default 3
822
+ Number of times to retry this task.
823
+ minutes_between_retries : int, default 2
824
+ Number of minutes between retries.
809
825
  """
810
826
  ...
811
827
 
812
828
  @typing.overload
813
- 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]]]:
829
+ 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]]]:
814
830
  """
815
- Creates a human-readable report, a Metaflow Card, after this step completes.
816
-
817
- Note that you may add multiple `@card` decorators in a step with different parameters.
831
+ Specifies environment variables to be set prior to the execution of a step.
818
832
 
819
833
 
820
834
  Parameters
821
835
  ----------
822
- type : str, default 'default'
823
- Card type.
824
- id : str, optional, default None
825
- If multiple cards are present, use this id to identify this card.
826
- options : Dict[str, Any], default {}
827
- Options passed to the card. The contents depend on the card type.
828
- timeout : int, default 45
829
- Interrupt reporting if it takes more than this many seconds.
836
+ vars : Dict[str, str], default {}
837
+ Dictionary of environment variables to set.
830
838
  """
831
839
  ...
832
840
 
833
841
  @typing.overload
834
- def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
842
+ def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
835
843
  ...
836
844
 
837
845
  @typing.overload
838
- def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
846
+ def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
839
847
  ...
840
848
 
841
- 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):
849
+ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
842
850
  """
843
- Creates a human-readable report, a Metaflow Card, after this step completes.
844
-
845
- Note that you may add multiple `@card` decorators in a step with different parameters.
851
+ Specifies environment variables to be set prior to the execution of a step.
846
852
 
847
853
 
848
854
  Parameters
849
855
  ----------
850
- type : str, default 'default'
851
- Card type.
852
- id : str, optional, default None
853
- If multiple cards are present, use this id to identify this card.
854
- options : Dict[str, Any], default {}
855
- Options passed to the card. The contents depend on the card type.
856
- timeout : int, default 45
857
- Interrupt reporting if it takes more than this many seconds.
856
+ vars : Dict[str, str], default {}
857
+ Dictionary of environment variables to set.
858
858
  """
859
859
  ...
860
860
 
861
- def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
861
+ @typing.overload
862
+ 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]]:
862
863
  """
863
- Specifies what flows belong to the same project.
864
-
865
- A project-specific namespace is created for all flows that
866
- use the same `@project(name)`.
867
-
864
+ Specifies the flow(s) that this flow depends on.
868
865
 
869
- Parameters
870
- ----------
871
- name : str
872
- Project name. Make sure that the name is unique amongst all
873
- projects that use the same production scheduler. The name may
874
- contain only lowercase alphanumeric characters and underscores.
866
+ ```
867
+ @trigger_on_finish(flow='FooFlow')
868
+ ```
869
+ or
870
+ ```
871
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
872
+ ```
873
+ This decorator respects the @project decorator and triggers the flow
874
+ when upstream runs within the same namespace complete successfully
875
875
 
876
- branch : Optional[str], default None
877
- The branch to use. If not specified, the branch is set to
878
- `user.<username>` unless `production` is set to `True`. This can
879
- also be set on the command line using `--branch` as a top-level option.
880
- It is an error to specify `branch` in the decorator and on the command line.
876
+ Additionally, you can specify project aware upstream flow dependencies
877
+ by specifying the fully qualified project_flow_name.
878
+ ```
879
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
880
+ ```
881
+ or
882
+ ```
883
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
884
+ ```
881
885
 
882
- production : bool, default False
883
- Whether or not the branch is the production branch. This can also be set on the
884
- command line using `--production` as a top-level option. It is an error to specify
885
- `production` in the decorator and on the command line.
886
- The project branch name will be:
887
- - if `branch` is specified:
888
- - if `production` is True: `prod.<branch>`
889
- - if `production` is False: `test.<branch>`
890
- - if `branch` is not specified:
891
- - if `production` is True: `prod`
892
- - if `production` is False: `user.<username>`
893
- """
894
- ...
895
-
896
- @typing.overload
897
- def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
898
- """
899
- Specifies the Conda environment for all steps of the flow.
886
+ You can also specify just the project or project branch (other values will be
887
+ inferred from the current project or project branch):
888
+ ```
889
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
890
+ ```
900
891
 
901
- Use `@conda_base` to set common libraries required by all
902
- steps and use `@conda` to specify step-specific additions.
892
+ Note that `branch` is typically one of:
893
+ - `prod`
894
+ - `user.bob`
895
+ - `test.my_experiment`
896
+ - `prod.staging`
903
897
 
904
898
 
905
899
  Parameters
906
900
  ----------
907
- packages : Dict[str, str], default {}
908
- Packages to use for this flow. The key is the name of the package
909
- and the value is the version to use.
910
- libraries : Dict[str, str], default {}
911
- Supported for backward compatibility. When used with packages, packages will take precedence.
912
- python : str, optional, default None
913
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
914
- that the version used will correspond to the version of the Python interpreter used to start the run.
915
- disabled : bool, default False
916
- If set to True, disables Conda.
901
+ flow : Union[str, Dict[str, str]], optional, default None
902
+ Upstream flow dependency for this flow.
903
+ flows : List[Union[str, Dict[str, str]]], default []
904
+ Upstream flow dependencies for this flow.
905
+ options : Dict[str, Any], default {}
906
+ Backend-specific configuration for tuning eventing behavior.
917
907
  """
918
908
  ...
919
909
 
920
910
  @typing.overload
921
- def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
922
- ...
923
-
924
- def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
925
- """
926
- Specifies the Conda environment for all steps of the flow.
927
-
928
- Use `@conda_base` to set common libraries required by all
929
- steps and use `@conda` to specify step-specific additions.
930
-
931
-
932
- Parameters
933
- ----------
934
- packages : Dict[str, str], default {}
935
- Packages to use for this flow. The key is the name of the package
936
- and the value is the version to use.
937
- libraries : Dict[str, str], default {}
938
- Supported for backward compatibility. When used with packages, packages will take precedence.
939
- python : str, optional, default None
940
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
941
- that the version used will correspond to the version of the Python interpreter used to start the run.
942
- disabled : bool, default False
943
- If set to True, disables Conda.
944
- """
911
+ def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
945
912
  ...
946
913
 
947
- @typing.overload
948
- 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]]:
914
+ 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] = {}):
949
915
  """
950
- Specifies the times when the flow should be run when running on a
951
- production scheduler.
916
+ Specifies the flow(s) that this flow depends on.
952
917
 
918
+ ```
919
+ @trigger_on_finish(flow='FooFlow')
920
+ ```
921
+ or
922
+ ```
923
+ @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
924
+ ```
925
+ This decorator respects the @project decorator and triggers the flow
926
+ when upstream runs within the same namespace complete successfully
953
927
 
954
- Parameters
955
- ----------
956
- hourly : bool, default False
957
- Run the workflow hourly.
958
- daily : bool, default True
959
- Run the workflow daily.
960
- weekly : bool, default False
961
- Run the workflow weekly.
962
- cron : str, optional, default None
963
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
964
- specified by this expression.
965
- timezone : str, optional, default None
966
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
967
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
968
- """
969
- ...
970
-
971
- @typing.overload
972
- def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
973
- ...
974
-
975
- 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):
976
- """
977
- Specifies the times when the flow should be run when running on a
978
- production scheduler.
928
+ Additionally, you can specify project aware upstream flow dependencies
929
+ by specifying the fully qualified project_flow_name.
930
+ ```
931
+ @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
932
+ ```
933
+ or
934
+ ```
935
+ @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
936
+ ```
979
937
 
938
+ You can also specify just the project or project branch (other values will be
939
+ inferred from the current project or project branch):
940
+ ```
941
+ @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
942
+ ```
980
943
 
981
- Parameters
982
- ----------
983
- hourly : bool, default False
984
- Run the workflow hourly.
985
- daily : bool, default True
986
- Run the workflow daily.
987
- weekly : bool, default False
988
- Run the workflow weekly.
989
- cron : str, optional, default None
990
- Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
991
- specified by this expression.
992
- timezone : str, optional, default None
993
- Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
994
- which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
995
- """
996
- ...
997
-
998
- @typing.overload
999
- def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1000
- """
1001
- Specifies the PyPI packages for all steps of the flow.
944
+ Note that `branch` is typically one of:
945
+ - `prod`
946
+ - `user.bob`
947
+ - `test.my_experiment`
948
+ - `prod.staging`
1002
949
 
1003
- Use `@pypi_base` to set common packages required by all
1004
- steps and use `@pypi` to specify step-specific overrides.
1005
950
 
1006
951
  Parameters
1007
952
  ----------
1008
- packages : Dict[str, str], default: {}
1009
- Packages to use for this flow. The key is the name of the package
1010
- and the value is the version to use.
1011
- python : str, optional, default: None
1012
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1013
- that the version used will correspond to the version of the Python interpreter used to start the run.
953
+ flow : Union[str, Dict[str, str]], optional, default None
954
+ Upstream flow dependency for this flow.
955
+ flows : List[Union[str, Dict[str, str]]], default []
956
+ Upstream flow dependencies for this flow.
957
+ options : Dict[str, Any], default {}
958
+ Backend-specific configuration for tuning eventing behavior.
1014
959
  """
1015
960
  ...
1016
961
 
1017
- @typing.overload
1018
- def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1019
- ...
1020
-
1021
- def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
962
+ 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]]:
1022
963
  """
1023
- Specifies the PyPI packages for all steps of the flow.
964
+ 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.
965
+ 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.
1024
966
 
1025
- Use `@pypi_base` to set common packages required by all
1026
- steps and use `@pypi` to specify step-specific overrides.
1027
967
 
1028
968
  Parameters
1029
969
  ----------
1030
- packages : Dict[str, str], default: {}
1031
- Packages to use for this flow. The key is the name of the package
1032
- and the value is the version to use.
1033
- python : str, optional, default: None
1034
- Version of Python to use, e.g. '3.7.4'. A default value of None implies
1035
- that the version used will correspond to the version of the Python interpreter used to start the run.
970
+ timeout : int
971
+ Time, in seconds before the task times out and fails. (Default: 3600)
972
+ poke_interval : int
973
+ Time in seconds that the job should wait in between each try. (Default: 60)
974
+ mode : str
975
+ How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
976
+ exponential_backoff : bool
977
+ allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
978
+ pool : str
979
+ the slot pool this task should run in,
980
+ slot pools are a way to limit concurrency for certain tasks. (Default:None)
981
+ soft_fail : bool
982
+ Set to true to mark the task as SKIPPED on failure. (Default: False)
983
+ name : str
984
+ Name of the sensor on Airflow
985
+ description : str
986
+ Description of sensor in the Airflow UI
987
+ external_dag_id : str
988
+ The dag_id that contains the task you want to wait for.
989
+ external_task_ids : List[str]
990
+ The list of task_ids that you want to wait for.
991
+ If None (default value) the sensor waits for the DAG. (Default: None)
992
+ allowed_states : List[str]
993
+ Iterable of allowed states, (Default: ['success'])
994
+ failed_states : List[str]
995
+ Iterable of failed or dis-allowed states. (Default: None)
996
+ execution_delta : datetime.timedelta
997
+ time difference with the previous execution to look at,
998
+ the default is the same logical date as the current task or DAG. (Default: None)
999
+ check_existence: bool
1000
+ Set to True to check if the external task exists or check if
1001
+ the DAG to wait for exists. (Default: True)
1036
1002
  """
1037
1003
  ...
1038
1004
 
@@ -1079,6 +1045,47 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
1079
1045
  """
1080
1046
  ...
1081
1047
 
1048
+ @typing.overload
1049
+ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1050
+ """
1051
+ Specifies the PyPI packages for all steps of the flow.
1052
+
1053
+ Use `@pypi_base` to set common packages required by all
1054
+ steps and use `@pypi` to specify step-specific overrides.
1055
+
1056
+ Parameters
1057
+ ----------
1058
+ packages : Dict[str, str], default: {}
1059
+ Packages to use for this flow. The key is the name of the package
1060
+ and the value is the version to use.
1061
+ python : str, optional, default: None
1062
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1063
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1064
+ """
1065
+ ...
1066
+
1067
+ @typing.overload
1068
+ def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1069
+ ...
1070
+
1071
+ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
1072
+ """
1073
+ Specifies the PyPI packages for all steps of the flow.
1074
+
1075
+ Use `@pypi_base` to set common packages required by all
1076
+ steps and use `@pypi` to specify step-specific overrides.
1077
+
1078
+ Parameters
1079
+ ----------
1080
+ packages : Dict[str, str], default: {}
1081
+ Packages to use for this flow. The key is the name of the package
1082
+ and the value is the version to use.
1083
+ python : str, optional, default: None
1084
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1085
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1086
+ """
1087
+ ...
1088
+
1082
1089
  @typing.overload
1083
1090
  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]]:
1084
1091
  """
@@ -1172,147 +1179,140 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
1172
1179
  """
1173
1180
  ...
1174
1181
 
1175
- 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]]:
1182
+ @typing.overload
1183
+ 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]]:
1176
1184
  """
1177
- 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.
1178
- 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.
1185
+ Specifies the times when the flow should be run when running on a
1186
+ production scheduler.
1179
1187
 
1180
1188
 
1181
1189
  Parameters
1182
1190
  ----------
1183
- timeout : int
1184
- Time, in seconds before the task times out and fails. (Default: 3600)
1185
- poke_interval : int
1186
- Time in seconds that the job should wait in between each try. (Default: 60)
1187
- mode : str
1188
- How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
1189
- exponential_backoff : bool
1190
- allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
1191
- pool : str
1192
- the slot pool this task should run in,
1193
- slot pools are a way to limit concurrency for certain tasks. (Default:None)
1194
- soft_fail : bool
1195
- Set to true to mark the task as SKIPPED on failure. (Default: False)
1196
- name : str
1197
- Name of the sensor on Airflow
1198
- description : str
1199
- Description of sensor in the Airflow UI
1200
- external_dag_id : str
1201
- The dag_id that contains the task you want to wait for.
1202
- external_task_ids : List[str]
1203
- The list of task_ids that you want to wait for.
1204
- If None (default value) the sensor waits for the DAG. (Default: None)
1205
- allowed_states : List[str]
1206
- Iterable of allowed states, (Default: ['success'])
1207
- failed_states : List[str]
1208
- Iterable of failed or dis-allowed states. (Default: None)
1209
- execution_delta : datetime.timedelta
1210
- time difference with the previous execution to look at,
1211
- the default is the same logical date as the current task or DAG. (Default: None)
1212
- check_existence: bool
1213
- Set to True to check if the external task exists or check if
1214
- the DAG to wait for exists. (Default: True)
1191
+ hourly : bool, default False
1192
+ Run the workflow hourly.
1193
+ daily : bool, default True
1194
+ Run the workflow daily.
1195
+ weekly : bool, default False
1196
+ Run the workflow weekly.
1197
+ cron : str, optional, default None
1198
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1199
+ specified by this expression.
1200
+ timezone : str, optional, default None
1201
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1202
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1215
1203
  """
1216
1204
  ...
1217
1205
 
1218
1206
  @typing.overload
1219
- 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]]:
1207
+ def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1208
+ ...
1209
+
1210
+ 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):
1220
1211
  """
1221
- Specifies the flow(s) that this flow depends on.
1222
-
1223
- ```
1224
- @trigger_on_finish(flow='FooFlow')
1225
- ```
1226
- or
1227
- ```
1228
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1229
- ```
1230
- This decorator respects the @project decorator and triggers the flow
1231
- when upstream runs within the same namespace complete successfully
1212
+ Specifies the times when the flow should be run when running on a
1213
+ production scheduler.
1232
1214
 
1233
- Additionally, you can specify project aware upstream flow dependencies
1234
- by specifying the fully qualified project_flow_name.
1235
- ```
1236
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1237
- ```
1238
- or
1239
- ```
1240
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1241
- ```
1242
1215
 
1243
- You can also specify just the project or project branch (other values will be
1244
- inferred from the current project or project branch):
1245
- ```
1246
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1247
- ```
1216
+ Parameters
1217
+ ----------
1218
+ hourly : bool, default False
1219
+ Run the workflow hourly.
1220
+ daily : bool, default True
1221
+ Run the workflow daily.
1222
+ weekly : bool, default False
1223
+ Run the workflow weekly.
1224
+ cron : str, optional, default None
1225
+ Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
1226
+ specified by this expression.
1227
+ timezone : str, optional, default None
1228
+ Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
1229
+ which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
1230
+ """
1231
+ ...
1232
+
1233
+ def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1234
+ """
1235
+ Specifies what flows belong to the same project.
1248
1236
 
1249
- Note that `branch` is typically one of:
1250
- - `prod`
1251
- - `user.bob`
1252
- - `test.my_experiment`
1253
- - `prod.staging`
1237
+ A project-specific namespace is created for all flows that
1238
+ use the same `@project(name)`.
1254
1239
 
1255
1240
 
1256
1241
  Parameters
1257
1242
  ----------
1258
- flow : Union[str, Dict[str, str]], optional, default None
1259
- Upstream flow dependency for this flow.
1260
- flows : List[Union[str, Dict[str, str]]], default []
1261
- Upstream flow dependencies for this flow.
1262
- options : Dict[str, Any], default {}
1263
- Backend-specific configuration for tuning eventing behavior.
1243
+ name : str
1244
+ Project name. Make sure that the name is unique amongst all
1245
+ projects that use the same production scheduler. The name may
1246
+ contain only lowercase alphanumeric characters and underscores.
1247
+
1248
+ branch : Optional[str], default None
1249
+ The branch to use. If not specified, the branch is set to
1250
+ `user.<username>` unless `production` is set to `True`. This can
1251
+ also be set on the command line using `--branch` as a top-level option.
1252
+ It is an error to specify `branch` in the decorator and on the command line.
1253
+
1254
+ production : bool, default False
1255
+ Whether or not the branch is the production branch. This can also be set on the
1256
+ command line using `--production` as a top-level option. It is an error to specify
1257
+ `production` in the decorator and on the command line.
1258
+ The project branch name will be:
1259
+ - if `branch` is specified:
1260
+ - if `production` is True: `prod.<branch>`
1261
+ - if `production` is False: `test.<branch>`
1262
+ - if `branch` is not specified:
1263
+ - if `production` is True: `prod`
1264
+ - if `production` is False: `user.<username>`
1264
1265
  """
1265
1266
  ...
1266
1267
 
1267
1268
  @typing.overload
1268
- def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1269
- ...
1270
-
1271
- 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] = {}):
1269
+ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
1272
1270
  """
1273
- Specifies the flow(s) that this flow depends on.
1271
+ Specifies the Conda environment for all steps of the flow.
1274
1272
 
1275
- ```
1276
- @trigger_on_finish(flow='FooFlow')
1277
- ```
1278
- or
1279
- ```
1280
- @trigger_on_finish(flows=['FooFlow', 'BarFlow'])
1281
- ```
1282
- This decorator respects the @project decorator and triggers the flow
1283
- when upstream runs within the same namespace complete successfully
1273
+ Use `@conda_base` to set common libraries required by all
1274
+ steps and use `@conda` to specify step-specific additions.
1284
1275
 
1285
- Additionally, you can specify project aware upstream flow dependencies
1286
- by specifying the fully qualified project_flow_name.
1287
- ```
1288
- @trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
1289
- ```
1290
- or
1291
- ```
1292
- @trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
1293
- ```
1294
1276
 
1295
- You can also specify just the project or project branch (other values will be
1296
- inferred from the current project or project branch):
1297
- ```
1298
- @trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
1299
- ```
1277
+ Parameters
1278
+ ----------
1279
+ packages : Dict[str, str], default {}
1280
+ Packages to use for this flow. The key is the name of the package
1281
+ and the value is the version to use.
1282
+ libraries : Dict[str, str], default {}
1283
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1284
+ python : str, optional, default None
1285
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1286
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1287
+ disabled : bool, default False
1288
+ If set to True, disables Conda.
1289
+ """
1290
+ ...
1291
+
1292
+ @typing.overload
1293
+ def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
1294
+ ...
1295
+
1296
+ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
1297
+ """
1298
+ Specifies the Conda environment for all steps of the flow.
1300
1299
 
1301
- Note that `branch` is typically one of:
1302
- - `prod`
1303
- - `user.bob`
1304
- - `test.my_experiment`
1305
- - `prod.staging`
1300
+ Use `@conda_base` to set common libraries required by all
1301
+ steps and use `@conda` to specify step-specific additions.
1306
1302
 
1307
1303
 
1308
1304
  Parameters
1309
1305
  ----------
1310
- flow : Union[str, Dict[str, str]], optional, default None
1311
- Upstream flow dependency for this flow.
1312
- flows : List[Union[str, Dict[str, str]]], default []
1313
- Upstream flow dependencies for this flow.
1314
- options : Dict[str, Any], default {}
1315
- Backend-specific configuration for tuning eventing behavior.
1306
+ packages : Dict[str, str], default {}
1307
+ Packages to use for this flow. The key is the name of the package
1308
+ and the value is the version to use.
1309
+ libraries : Dict[str, str], default {}
1310
+ Supported for backward compatibility. When used with packages, packages will take precedence.
1311
+ python : str, optional, default None
1312
+ Version of Python to use, e.g. '3.7.4'. A default value of None implies
1313
+ that the version used will correspond to the version of the Python interpreter used to start the run.
1314
+ disabled : bool, default False
1315
+ If set to True, disables Conda.
1316
1316
  """
1317
1317
  ...
1318
1318