metaflow-stubs 2.12.39__py2.py3-none-any.whl → 2.13.1__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.
- metaflow-stubs/__init__.pyi +266 -265
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +3 -3
- metaflow-stubs/flowspec.pyi +7 -7
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +2 -2
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +6 -2
- metaflow-stubs/metaflow_current.pyi +27 -27
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +5 -5
- metaflow-stubs/plugins/__init__.pyi +14 -14
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -9
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -5
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +31 -3
- metaflow-stubs/plugins/aws/__init__.pyi +3 -3
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +9 -10
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +16 -14
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +4 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +25 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +4 -21
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +12 -3
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +3 -7
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +10 -4
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +6 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +28 -28
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +4 -4
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +9 -4
- metaflow-stubs/user_configs/config_parameters.pyi +7 -7
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.12.39.dist-info → metaflow_stubs-2.13.1.dist-info}/METADATA +2 -2
- metaflow_stubs-2.13.1.dist-info/RECORD +144 -0
- {metaflow_stubs-2.12.39.dist-info → metaflow_stubs-2.13.1.dist-info}/WHEEL +1 -1
- metaflow_stubs-2.12.39.dist-info/RECORD +0 -144
- {metaflow_stubs-2.12.39.dist-info → metaflow_stubs-2.13.1.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.
|
4
|
-
# Generated on
|
3
|
+
# MF version: 2.13.1 #
|
4
|
+
# Generated on 2025-01-06T13:29:15.375037 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import typing
|
12
11
|
import datetime
|
12
|
+
import typing
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -31,6 +31,7 @@ from .parameters import Parameter as Parameter
|
|
31
31
|
from .parameters import JSONTypeClass as JSONTypeClass
|
32
32
|
from .parameters import JSONType as JSONType
|
33
33
|
from .user_configs.config_parameters import Config as Config
|
34
|
+
from .user_configs.config_parameters import ConfigValue as ConfigValue
|
34
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
35
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
36
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
@@ -142,236 +143,236 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
142
143
|
...
|
143
144
|
|
144
145
|
@typing.overload
|
145
|
-
def
|
146
|
+
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]]]:
|
146
147
|
"""
|
147
|
-
Specifies
|
148
|
-
|
148
|
+
Specifies the number of times the task corresponding
|
149
|
+
to a step needs to be retried.
|
150
|
+
|
151
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
152
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
153
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
154
|
+
|
155
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
156
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
157
|
+
ensuring that the flow execution can continue.
|
149
158
|
"""
|
150
159
|
...
|
151
160
|
|
152
161
|
@typing.overload
|
153
|
-
def
|
162
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
154
163
|
...
|
155
164
|
|
156
165
|
@typing.overload
|
157
|
-
def
|
166
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
158
167
|
...
|
159
168
|
|
160
|
-
def
|
169
|
+
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):
|
161
170
|
"""
|
162
|
-
Specifies
|
163
|
-
|
171
|
+
Specifies the number of times the task corresponding
|
172
|
+
to a step needs to be retried.
|
173
|
+
|
174
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
175
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
176
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
177
|
+
|
178
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
179
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
180
|
+
ensuring that the flow execution can continue.
|
164
181
|
"""
|
165
182
|
...
|
166
183
|
|
167
184
|
@typing.overload
|
168
|
-
def
|
185
|
+
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]]]:
|
169
186
|
"""
|
170
|
-
Specifies the
|
187
|
+
Specifies the PyPI packages for the step.
|
171
188
|
|
172
189
|
Information in this decorator will augment any
|
173
|
-
attributes set in the `@
|
174
|
-
you can use `@
|
175
|
-
steps and use `@
|
190
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
191
|
+
you can use `@pypi_base` to set packages required by all
|
192
|
+
steps and use `@pypi` to specify step-specific overrides.
|
176
193
|
"""
|
177
194
|
...
|
178
195
|
|
179
196
|
@typing.overload
|
180
|
-
def
|
197
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
181
198
|
...
|
182
199
|
|
183
200
|
@typing.overload
|
184
|
-
def
|
201
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
185
202
|
...
|
186
203
|
|
187
|
-
def
|
204
|
+
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):
|
188
205
|
"""
|
189
|
-
Specifies the
|
206
|
+
Specifies the PyPI packages for the step.
|
190
207
|
|
191
208
|
Information in this decorator will augment any
|
192
|
-
attributes set in the `@
|
193
|
-
you can use `@
|
194
|
-
steps and use `@
|
209
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
210
|
+
you can use `@pypi_base` to set packages required by all
|
211
|
+
steps and use `@pypi` to specify step-specific overrides.
|
195
212
|
"""
|
196
213
|
...
|
197
214
|
|
198
215
|
@typing.overload
|
199
|
-
def
|
216
|
+
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]]]:
|
200
217
|
"""
|
201
|
-
Specifies
|
202
|
-
|
203
|
-
Use `@resources` to specify the resource requirements
|
204
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
205
|
-
|
206
|
-
You can choose the compute layer on the command line by executing e.g.
|
207
|
-
```
|
208
|
-
python myflow.py run --with batch
|
209
|
-
```
|
210
|
-
or
|
211
|
-
```
|
212
|
-
python myflow.py run --with kubernetes
|
213
|
-
```
|
214
|
-
which executes the flow on the desired system using the
|
215
|
-
requirements specified in `@resources`.
|
218
|
+
Specifies environment variables to be set prior to the execution of a step.
|
216
219
|
"""
|
217
220
|
...
|
218
221
|
|
219
222
|
@typing.overload
|
220
|
-
def
|
223
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
221
224
|
...
|
222
225
|
|
223
226
|
@typing.overload
|
224
|
-
def
|
227
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
225
228
|
...
|
226
229
|
|
227
|
-
def
|
230
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
228
231
|
"""
|
229
|
-
Specifies
|
230
|
-
|
231
|
-
Use `@resources` to specify the resource requirements
|
232
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
233
|
-
|
234
|
-
You can choose the compute layer on the command line by executing e.g.
|
235
|
-
```
|
236
|
-
python myflow.py run --with batch
|
237
|
-
```
|
238
|
-
or
|
239
|
-
```
|
240
|
-
python myflow.py run --with kubernetes
|
241
|
-
```
|
242
|
-
which executes the flow on the desired system using the
|
243
|
-
requirements specified in `@resources`.
|
232
|
+
Specifies environment variables to be set prior to the execution of a step.
|
244
233
|
"""
|
245
234
|
...
|
246
235
|
|
247
236
|
@typing.overload
|
248
|
-
def
|
237
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
249
238
|
"""
|
250
|
-
|
239
|
+
Decorator prototype for all step decorators. This function gets specialized
|
240
|
+
and imported for all decorators types by _import_plugin_decorators().
|
251
241
|
"""
|
252
242
|
...
|
253
243
|
|
254
244
|
@typing.overload
|
255
|
-
def
|
256
|
-
...
|
257
|
-
|
258
|
-
@typing.overload
|
259
|
-
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
245
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
260
246
|
...
|
261
247
|
|
262
|
-
def
|
248
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
263
249
|
"""
|
264
|
-
|
250
|
+
Decorator prototype for all step decorators. This function gets specialized
|
251
|
+
and imported for all decorators types by _import_plugin_decorators().
|
265
252
|
"""
|
266
253
|
...
|
267
254
|
|
268
255
|
@typing.overload
|
269
|
-
def
|
256
|
+
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]]]:
|
270
257
|
"""
|
271
|
-
|
258
|
+
Specifies a timeout for your step.
|
272
259
|
|
273
|
-
|
260
|
+
This decorator is useful if this step may hang indefinitely.
|
261
|
+
|
262
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
263
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
264
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
265
|
+
|
266
|
+
Note that all the values specified in parameters are added together so if you specify
|
267
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
274
268
|
"""
|
275
269
|
...
|
276
270
|
|
277
271
|
@typing.overload
|
278
|
-
def
|
272
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
279
273
|
...
|
280
274
|
|
281
275
|
@typing.overload
|
282
|
-
def
|
276
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
283
277
|
...
|
284
278
|
|
285
|
-
def
|
279
|
+
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):
|
286
280
|
"""
|
287
|
-
|
281
|
+
Specifies a timeout for your step.
|
288
282
|
|
289
|
-
|
283
|
+
This decorator is useful if this step may hang indefinitely.
|
284
|
+
|
285
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
286
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
287
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
288
|
+
|
289
|
+
Note that all the values specified in parameters are added together so if you specify
|
290
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
290
291
|
"""
|
291
292
|
...
|
292
293
|
|
293
294
|
@typing.overload
|
294
|
-
def
|
295
|
+
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]]]:
|
295
296
|
"""
|
296
|
-
Specifies
|
297
|
+
Specifies the Conda environment for the step.
|
298
|
+
|
299
|
+
Information in this decorator will augment any
|
300
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
301
|
+
you can use `@conda_base` to set packages required by all
|
302
|
+
steps and use `@conda` to specify step-specific overrides.
|
297
303
|
"""
|
298
304
|
...
|
299
305
|
|
300
306
|
@typing.overload
|
301
|
-
def
|
307
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
302
308
|
...
|
303
309
|
|
304
310
|
@typing.overload
|
305
|
-
def
|
306
|
-
...
|
307
|
-
|
308
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
309
|
-
"""
|
310
|
-
Specifies environment variables to be set prior to the execution of a step.
|
311
|
-
"""
|
311
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
312
312
|
...
|
313
313
|
|
314
|
-
def
|
314
|
+
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):
|
315
315
|
"""
|
316
|
-
Specifies
|
316
|
+
Specifies the Conda environment for the step.
|
317
|
+
|
318
|
+
Information in this decorator will augment any
|
319
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
320
|
+
you can use `@conda_base` to set packages required by all
|
321
|
+
steps and use `@conda` to specify step-specific overrides.
|
317
322
|
"""
|
318
323
|
...
|
319
324
|
|
320
325
|
@typing.overload
|
321
|
-
def
|
326
|
+
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]]]:
|
322
327
|
"""
|
323
|
-
|
324
|
-
to a step needs to be retried.
|
325
|
-
|
326
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
327
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
328
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
328
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
329
329
|
|
330
|
-
|
331
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
332
|
-
ensuring that the flow execution can continue.
|
330
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
333
331
|
"""
|
334
332
|
...
|
335
333
|
|
336
334
|
@typing.overload
|
337
|
-
def
|
335
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
338
336
|
...
|
339
337
|
|
340
338
|
@typing.overload
|
341
|
-
def
|
339
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
342
340
|
...
|
343
341
|
|
344
|
-
def
|
342
|
+
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):
|
345
343
|
"""
|
346
|
-
|
347
|
-
to a step needs to be retried.
|
348
|
-
|
349
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
350
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
351
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
344
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
352
345
|
|
353
|
-
|
354
|
-
|
355
|
-
|
346
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
347
|
+
"""
|
348
|
+
...
|
349
|
+
|
350
|
+
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]]]:
|
351
|
+
"""
|
352
|
+
Specifies that this step should execute on Kubernetes.
|
356
353
|
"""
|
357
354
|
...
|
358
355
|
|
359
356
|
@typing.overload
|
360
|
-
def
|
357
|
+
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]]]:
|
361
358
|
"""
|
362
|
-
|
363
|
-
|
359
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
360
|
+
the execution of a step.
|
364
361
|
"""
|
365
362
|
...
|
366
363
|
|
367
364
|
@typing.overload
|
368
|
-
def
|
365
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
369
366
|
...
|
370
367
|
|
371
|
-
|
368
|
+
@typing.overload
|
369
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
370
|
+
...
|
371
|
+
|
372
|
+
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]]] = []):
|
372
373
|
"""
|
373
|
-
|
374
|
-
|
374
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
375
|
+
the execution of a step.
|
375
376
|
"""
|
376
377
|
...
|
377
378
|
|
@@ -407,72 +408,184 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
407
408
|
...
|
408
409
|
|
409
410
|
@typing.overload
|
410
|
-
def
|
411
|
+
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]]]:
|
411
412
|
"""
|
412
|
-
Specifies the
|
413
|
+
Specifies the resources needed when executing this step.
|
413
414
|
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
415
|
+
Use `@resources` to specify the resource requirements
|
416
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
417
|
+
|
418
|
+
You can choose the compute layer on the command line by executing e.g.
|
419
|
+
```
|
420
|
+
python myflow.py run --with batch
|
421
|
+
```
|
422
|
+
or
|
423
|
+
```
|
424
|
+
python myflow.py run --with kubernetes
|
425
|
+
```
|
426
|
+
which executes the flow on the desired system using the
|
427
|
+
requirements specified in `@resources`.
|
418
428
|
"""
|
419
429
|
...
|
420
430
|
|
421
431
|
@typing.overload
|
422
|
-
def
|
432
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
423
433
|
...
|
424
434
|
|
425
435
|
@typing.overload
|
426
|
-
def
|
436
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
427
437
|
...
|
428
438
|
|
429
|
-
def
|
439
|
+
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):
|
430
440
|
"""
|
431
|
-
Specifies the
|
441
|
+
Specifies the resources needed when executing this step.
|
432
442
|
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
443
|
+
Use `@resources` to specify the resource requirements
|
444
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
445
|
+
|
446
|
+
You can choose the compute layer on the command line by executing e.g.
|
447
|
+
```
|
448
|
+
python myflow.py run --with batch
|
449
|
+
```
|
450
|
+
or
|
451
|
+
```
|
452
|
+
python myflow.py run --with kubernetes
|
453
|
+
```
|
454
|
+
which executes the flow on the desired system using the
|
455
|
+
requirements specified in `@resources`.
|
437
456
|
"""
|
438
457
|
...
|
439
458
|
|
440
459
|
@typing.overload
|
441
|
-
def
|
460
|
+
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
442
461
|
"""
|
443
|
-
Specifies
|
462
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
463
|
+
"""
|
464
|
+
...
|
465
|
+
|
466
|
+
@typing.overload
|
467
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
468
|
+
...
|
469
|
+
|
470
|
+
@typing.overload
|
471
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
472
|
+
...
|
473
|
+
|
474
|
+
def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None):
|
475
|
+
"""
|
476
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
477
|
+
"""
|
478
|
+
...
|
479
|
+
|
480
|
+
@typing.overload
|
481
|
+
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]]:
|
482
|
+
"""
|
483
|
+
Specifies the Conda environment for all steps of the flow.
|
444
484
|
|
445
|
-
|
485
|
+
Use `@conda_base` to set common libraries required by all
|
486
|
+
steps and use `@conda` to specify step-specific additions.
|
487
|
+
"""
|
488
|
+
...
|
489
|
+
|
490
|
+
@typing.overload
|
491
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
492
|
+
...
|
493
|
+
|
494
|
+
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):
|
495
|
+
"""
|
496
|
+
Specifies the Conda environment for all steps of the flow.
|
446
497
|
|
447
|
-
|
448
|
-
|
449
|
-
|
498
|
+
Use `@conda_base` to set common libraries required by all
|
499
|
+
steps and use `@conda` to specify step-specific additions.
|
500
|
+
"""
|
501
|
+
...
|
502
|
+
|
503
|
+
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]]:
|
504
|
+
"""
|
505
|
+
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.
|
506
|
+
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.
|
507
|
+
"""
|
508
|
+
...
|
509
|
+
|
510
|
+
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
511
|
+
"""
|
512
|
+
Specifies what flows belong to the same project.
|
450
513
|
|
451
|
-
|
452
|
-
|
514
|
+
A project-specific namespace is created for all flows that
|
515
|
+
use the same `@project(name)`.
|
453
516
|
"""
|
454
517
|
...
|
455
518
|
|
456
519
|
@typing.overload
|
457
|
-
def
|
520
|
+
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]]:
|
521
|
+
"""
|
522
|
+
Specifies the event(s) that this flow depends on.
|
523
|
+
|
524
|
+
```
|
525
|
+
@trigger(event='foo')
|
526
|
+
```
|
527
|
+
or
|
528
|
+
```
|
529
|
+
@trigger(events=['foo', 'bar'])
|
530
|
+
```
|
531
|
+
|
532
|
+
Additionally, you can specify the parameter mappings
|
533
|
+
to map event payload to Metaflow parameters for the flow.
|
534
|
+
```
|
535
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
536
|
+
```
|
537
|
+
or
|
538
|
+
```
|
539
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
540
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
541
|
+
```
|
542
|
+
|
543
|
+
'parameters' can also be a list of strings and tuples like so:
|
544
|
+
```
|
545
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
546
|
+
```
|
547
|
+
This is equivalent to:
|
548
|
+
```
|
549
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
550
|
+
```
|
551
|
+
"""
|
458
552
|
...
|
459
553
|
|
460
554
|
@typing.overload
|
461
|
-
def
|
555
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
462
556
|
...
|
463
557
|
|
464
|
-
def
|
558
|
+
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] = {}):
|
465
559
|
"""
|
466
|
-
Specifies
|
560
|
+
Specifies the event(s) that this flow depends on.
|
467
561
|
|
468
|
-
|
562
|
+
```
|
563
|
+
@trigger(event='foo')
|
564
|
+
```
|
565
|
+
or
|
566
|
+
```
|
567
|
+
@trigger(events=['foo', 'bar'])
|
568
|
+
```
|
469
569
|
|
470
|
-
|
471
|
-
|
472
|
-
|
570
|
+
Additionally, you can specify the parameter mappings
|
571
|
+
to map event payload to Metaflow parameters for the flow.
|
572
|
+
```
|
573
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
574
|
+
```
|
575
|
+
or
|
576
|
+
```
|
577
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
578
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
579
|
+
```
|
473
580
|
|
474
|
-
|
475
|
-
|
581
|
+
'parameters' can also be a list of strings and tuples like so:
|
582
|
+
```
|
583
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
584
|
+
```
|
585
|
+
This is equivalent to:
|
586
|
+
```
|
587
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
588
|
+
```
|
476
589
|
"""
|
477
590
|
...
|
478
591
|
|
@@ -557,32 +670,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
557
670
|
"""
|
558
671
|
...
|
559
672
|
|
560
|
-
def project(*, name: str) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
561
|
-
"""
|
562
|
-
Specifies what flows belong to the same project.
|
563
|
-
|
564
|
-
A project-specific namespace is created for all flows that
|
565
|
-
use the same `@project(name)`.
|
566
|
-
"""
|
567
|
-
...
|
568
|
-
|
569
|
-
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]]:
|
570
|
-
"""
|
571
|
-
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.
|
572
|
-
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.
|
573
|
-
"""
|
574
|
-
...
|
575
|
-
|
576
|
-
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
577
|
-
"""
|
578
|
-
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
579
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
580
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
581
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
582
|
-
starts only after all sensors finish.
|
583
|
-
"""
|
584
|
-
...
|
585
|
-
|
586
673
|
@typing.overload
|
587
674
|
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
588
675
|
"""
|
@@ -606,99 +693,13 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
606
693
|
"""
|
607
694
|
...
|
608
695
|
|
609
|
-
|
610
|
-
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]]:
|
611
|
-
"""
|
612
|
-
Specifies the Conda environment for all steps of the flow.
|
613
|
-
|
614
|
-
Use `@conda_base` to set common libraries required by all
|
615
|
-
steps and use `@conda` to specify step-specific additions.
|
616
|
-
"""
|
617
|
-
...
|
618
|
-
|
619
|
-
@typing.overload
|
620
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
621
|
-
...
|
622
|
-
|
623
|
-
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):
|
624
|
-
"""
|
625
|
-
Specifies the Conda environment for all steps of the flow.
|
626
|
-
|
627
|
-
Use `@conda_base` to set common libraries required by all
|
628
|
-
steps and use `@conda` to specify step-specific additions.
|
629
|
-
"""
|
630
|
-
...
|
631
|
-
|
632
|
-
@typing.overload
|
633
|
-
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]]:
|
634
|
-
"""
|
635
|
-
Specifies the event(s) that this flow depends on.
|
636
|
-
|
637
|
-
```
|
638
|
-
@trigger(event='foo')
|
639
|
-
```
|
640
|
-
or
|
641
|
-
```
|
642
|
-
@trigger(events=['foo', 'bar'])
|
643
|
-
```
|
644
|
-
|
645
|
-
Additionally, you can specify the parameter mappings
|
646
|
-
to map event payload to Metaflow parameters for the flow.
|
647
|
-
```
|
648
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
649
|
-
```
|
650
|
-
or
|
651
|
-
```
|
652
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
653
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
654
|
-
```
|
655
|
-
|
656
|
-
'parameters' can also be a list of strings and tuples like so:
|
657
|
-
```
|
658
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
659
|
-
```
|
660
|
-
This is equivalent to:
|
661
|
-
```
|
662
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
663
|
-
```
|
664
|
-
"""
|
665
|
-
...
|
666
|
-
|
667
|
-
@typing.overload
|
668
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
669
|
-
...
|
670
|
-
|
671
|
-
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] = {}):
|
696
|
+
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
672
697
|
"""
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
or
|
679
|
-
```
|
680
|
-
@trigger(events=['foo', 'bar'])
|
681
|
-
```
|
682
|
-
|
683
|
-
Additionally, you can specify the parameter mappings
|
684
|
-
to map event payload to Metaflow parameters for the flow.
|
685
|
-
```
|
686
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
687
|
-
```
|
688
|
-
or
|
689
|
-
```
|
690
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
691
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
692
|
-
```
|
693
|
-
|
694
|
-
'parameters' can also be a list of strings and tuples like so:
|
695
|
-
```
|
696
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
697
|
-
```
|
698
|
-
This is equivalent to:
|
699
|
-
```
|
700
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
701
|
-
```
|
698
|
+
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
699
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
700
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
701
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
702
|
+
starts only after all sensors finish.
|
702
703
|
"""
|
703
704
|
...
|
704
705
|
|