metaflow-stubs 2.18.3__py2.py3-none-any.whl → 2.18.5__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.
Potentially problematic release.
This version of metaflow-stubs might be problematic. Click here for more details.
- metaflow-stubs/__init__.pyi +624 -624
- 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 +6 -6
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/meta_files.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 +2 -2
- metaflow-stubs/metaflow_current.pyi +16 -16
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +6 -6
- metaflow-stubs/packaging_sys/backend.pyi +4 -4
- metaflow-stubs/packaging_sys/distribution_support.pyi +5 -5
- metaflow-stubs/packaging_sys/tar_backend.pyi +5 -5
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +3 -3
- metaflow-stubs/parameters.pyi +4 -4
- 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 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/argo/exit_hooks.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- 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 +3 -3
- 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 +4 -4
- 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/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_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 +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -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/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +6 -6
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +5 -5
- 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_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +7 -7
- metaflow-stubs/user_decorators/__init__.pyi +2 -2
- metaflow-stubs/user_decorators/common.pyi +2 -2
- metaflow-stubs/user_decorators/mutable_flow.pyi +4 -4
- metaflow-stubs/user_decorators/mutable_step.pyi +5 -5
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +4 -4
- metaflow-stubs/user_decorators/user_step_decorator.pyi +6 -6
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.18.3.dist-info → metaflow_stubs-2.18.5.dist-info}/METADATA +2 -2
- metaflow_stubs-2.18.5.dist-info/RECORD +166 -0
- metaflow_stubs-2.18.3.dist-info/RECORD +0 -166
- {metaflow_stubs-2.18.3.dist-info → metaflow_stubs-2.18.5.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.18.3.dist-info → metaflow_stubs-2.18.5.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.18.
|
|
4
|
-
# Generated on 2025-09-
|
|
3
|
+
# MF version: 2.18.5 #
|
|
4
|
+
# Generated on 2025-09-16T00:24:37.068070 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import typing
|
|
10
10
|
if typing.TYPE_CHECKING:
|
|
11
|
-
import datetime
|
|
12
11
|
import typing
|
|
12
|
+
import datetime
|
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
|
15
15
|
|
|
@@ -47,9 +47,9 @@ from . import plugins as plugins
|
|
|
47
47
|
from .plugins.datatools.s3.s3 import S3 as S3
|
|
48
48
|
from . import includefile as includefile
|
|
49
49
|
from .includefile import IncludeFile as IncludeFile
|
|
50
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
51
50
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
52
51
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
52
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
53
53
|
from . import cards as cards
|
|
54
54
|
from . import client as client
|
|
55
55
|
from .client.core import namespace as namespace
|
|
@@ -204,70 +204,61 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
204
204
|
...
|
|
205
205
|
|
|
206
206
|
@typing.overload
|
|
207
|
-
def
|
|
208
|
-
"""
|
|
209
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
210
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
211
|
-
"""
|
|
212
|
-
...
|
|
213
|
-
|
|
214
|
-
@typing.overload
|
|
215
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
216
|
-
...
|
|
217
|
-
|
|
218
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
219
|
-
"""
|
|
220
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
221
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
222
|
-
"""
|
|
223
|
-
...
|
|
224
|
-
|
|
225
|
-
@typing.overload
|
|
226
|
-
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]]]:
|
|
207
|
+
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]]]:
|
|
227
208
|
"""
|
|
228
|
-
|
|
209
|
+
Specifies the Conda environment for the step.
|
|
229
210
|
|
|
230
|
-
|
|
211
|
+
Information in this decorator will augment any
|
|
212
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
213
|
+
you can use `@conda_base` to set packages required by all
|
|
214
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
231
215
|
|
|
232
216
|
|
|
233
217
|
Parameters
|
|
234
218
|
----------
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
219
|
+
packages : Dict[str, str], default {}
|
|
220
|
+
Packages to use for this step. The key is the name of the package
|
|
221
|
+
and the value is the version to use.
|
|
222
|
+
libraries : Dict[str, str], default {}
|
|
223
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
224
|
+
python : str, optional, default None
|
|
225
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
226
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
227
|
+
disabled : bool, default False
|
|
228
|
+
If set to True, disables @conda.
|
|
243
229
|
"""
|
|
244
230
|
...
|
|
245
231
|
|
|
246
232
|
@typing.overload
|
|
247
|
-
def
|
|
233
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
248
234
|
...
|
|
249
235
|
|
|
250
236
|
@typing.overload
|
|
251
|
-
def
|
|
237
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
252
238
|
...
|
|
253
239
|
|
|
254
|
-
def
|
|
240
|
+
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):
|
|
255
241
|
"""
|
|
256
|
-
|
|
242
|
+
Specifies the Conda environment for the step.
|
|
257
243
|
|
|
258
|
-
|
|
244
|
+
Information in this decorator will augment any
|
|
245
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
246
|
+
you can use `@conda_base` to set packages required by all
|
|
247
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
259
248
|
|
|
260
249
|
|
|
261
250
|
Parameters
|
|
262
251
|
----------
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
252
|
+
packages : Dict[str, str], default {}
|
|
253
|
+
Packages to use for this step. The key is the name of the package
|
|
254
|
+
and the value is the version to use.
|
|
255
|
+
libraries : Dict[str, str], default {}
|
|
256
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
257
|
+
python : str, optional, default None
|
|
258
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
259
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
260
|
+
disabled : bool, default False
|
|
261
|
+
If set to True, disables @conda.
|
|
271
262
|
"""
|
|
272
263
|
...
|
|
273
264
|
|
|
@@ -311,237 +302,162 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
|
311
302
|
...
|
|
312
303
|
|
|
313
304
|
@typing.overload
|
|
314
|
-
def
|
|
305
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
315
306
|
"""
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
Parameters
|
|
320
|
-
----------
|
|
321
|
-
vars : Dict[str, str], default {}
|
|
322
|
-
Dictionary of environment variables to set.
|
|
307
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
308
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
323
309
|
"""
|
|
324
310
|
...
|
|
325
311
|
|
|
326
312
|
@typing.overload
|
|
327
|
-
def
|
|
328
|
-
...
|
|
329
|
-
|
|
330
|
-
@typing.overload
|
|
331
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
313
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
332
314
|
...
|
|
333
315
|
|
|
334
|
-
def
|
|
316
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
335
317
|
"""
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
Parameters
|
|
340
|
-
----------
|
|
341
|
-
vars : Dict[str, str], default {}
|
|
342
|
-
Dictionary of environment variables to set.
|
|
318
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
319
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
343
320
|
"""
|
|
344
321
|
...
|
|
345
322
|
|
|
346
323
|
@typing.overload
|
|
347
|
-
def
|
|
324
|
+
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]]]:
|
|
348
325
|
"""
|
|
349
|
-
Specifies
|
|
350
|
-
|
|
351
|
-
This decorator is useful if this step may hang indefinitely.
|
|
326
|
+
Specifies the number of times the task corresponding
|
|
327
|
+
to a step needs to be retried.
|
|
352
328
|
|
|
353
|
-
This
|
|
354
|
-
|
|
355
|
-
|
|
329
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
330
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
331
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
356
332
|
|
|
357
|
-
|
|
358
|
-
|
|
333
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
334
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
335
|
+
ensuring that the flow execution can continue.
|
|
359
336
|
|
|
360
337
|
|
|
361
338
|
Parameters
|
|
362
339
|
----------
|
|
363
|
-
|
|
364
|
-
Number of
|
|
365
|
-
|
|
366
|
-
Number of minutes
|
|
367
|
-
hours : int, default 0
|
|
368
|
-
Number of hours to wait prior to timing out.
|
|
340
|
+
times : int, default 3
|
|
341
|
+
Number of times to retry this task.
|
|
342
|
+
minutes_between_retries : int, default 2
|
|
343
|
+
Number of minutes between retries.
|
|
369
344
|
"""
|
|
370
345
|
...
|
|
371
346
|
|
|
372
347
|
@typing.overload
|
|
373
|
-
def
|
|
348
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
374
349
|
...
|
|
375
350
|
|
|
376
351
|
@typing.overload
|
|
377
|
-
def
|
|
352
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
378
353
|
...
|
|
379
354
|
|
|
380
|
-
def
|
|
355
|
+
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):
|
|
381
356
|
"""
|
|
382
|
-
Specifies
|
|
383
|
-
|
|
384
|
-
This decorator is useful if this step may hang indefinitely.
|
|
357
|
+
Specifies the number of times the task corresponding
|
|
358
|
+
to a step needs to be retried.
|
|
385
359
|
|
|
386
|
-
This
|
|
387
|
-
|
|
388
|
-
|
|
360
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
361
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
362
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
389
363
|
|
|
390
|
-
|
|
391
|
-
|
|
364
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
365
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
366
|
+
ensuring that the flow execution can continue.
|
|
392
367
|
|
|
393
368
|
|
|
394
369
|
Parameters
|
|
395
370
|
----------
|
|
396
|
-
|
|
397
|
-
Number of
|
|
398
|
-
|
|
399
|
-
Number of minutes
|
|
400
|
-
hours : int, default 0
|
|
401
|
-
Number of hours to wait prior to timing out.
|
|
371
|
+
times : int, default 3
|
|
372
|
+
Number of times to retry this task.
|
|
373
|
+
minutes_between_retries : int, default 2
|
|
374
|
+
Number of minutes between retries.
|
|
402
375
|
"""
|
|
403
376
|
...
|
|
404
377
|
|
|
405
378
|
@typing.overload
|
|
406
|
-
def
|
|
379
|
+
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, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = 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]]]:
|
|
407
380
|
"""
|
|
408
|
-
Specifies
|
|
409
|
-
|
|
410
|
-
Information in this decorator will augment any
|
|
411
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
412
|
-
you can use `@conda_base` to set packages required by all
|
|
413
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
381
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
414
382
|
|
|
415
383
|
|
|
416
384
|
Parameters
|
|
417
385
|
----------
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
386
|
+
cpu : int, default 1
|
|
387
|
+
Number of CPUs required for this step. If `@resources` is
|
|
388
|
+
also present, the maximum value from all decorators is used.
|
|
389
|
+
gpu : int, default 0
|
|
390
|
+
Number of GPUs required for this step. If `@resources` is
|
|
391
|
+
also present, the maximum value from all decorators is used.
|
|
392
|
+
memory : int, default 4096
|
|
393
|
+
Memory size (in MB) required for this step. If
|
|
394
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
395
|
+
used.
|
|
396
|
+
image : str, optional, default None
|
|
397
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
398
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
399
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
400
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
401
|
+
AWS Batch Job Queue to submit the job to.
|
|
402
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
403
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
404
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
405
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
406
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
407
|
+
shared_memory : int, optional, default None
|
|
408
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
409
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
410
|
+
max_swap : int, optional, default None
|
|
411
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
412
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
413
|
+
Docker where the value is the sum of the container memory plus the
|
|
414
|
+
`max_swap` value.
|
|
415
|
+
swappiness : int, optional, default None
|
|
416
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
417
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
418
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
419
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
420
|
+
aws_batch_tags: Dict[str, str], optional, default None
|
|
421
|
+
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
422
|
+
Set as string key-value pairs.
|
|
423
|
+
use_tmpfs : bool, default False
|
|
424
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
425
|
+
not available on Fargate compute environments
|
|
426
|
+
tmpfs_tempdir : bool, default True
|
|
427
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
428
|
+
tmpfs_size : int, optional, default None
|
|
429
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
430
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
431
|
+
memory allocated for this step.
|
|
432
|
+
tmpfs_path : str, optional, default None
|
|
433
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
434
|
+
inferentia : int, default 0
|
|
435
|
+
Number of Inferentia chips required for this step.
|
|
436
|
+
trainium : int, default None
|
|
437
|
+
Alias for inferentia. Use only one of the two.
|
|
438
|
+
efa : int, default 0
|
|
439
|
+
Number of elastic fabric adapter network devices to attach to container
|
|
440
|
+
ephemeral_storage : int, default None
|
|
441
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
442
|
+
This is only relevant for Fargate compute environments
|
|
443
|
+
log_driver: str, optional, default None
|
|
444
|
+
The log driver to use for the Amazon ECS container.
|
|
445
|
+
log_options: List[str], optional, default None
|
|
446
|
+
List of strings containing options for the chosen log driver. The configurable values
|
|
447
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
448
|
+
Example: [`awslogs-group:aws/batch/job`]
|
|
428
449
|
"""
|
|
429
450
|
...
|
|
430
451
|
|
|
431
452
|
@typing.overload
|
|
432
|
-
def
|
|
453
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
433
454
|
...
|
|
434
455
|
|
|
435
456
|
@typing.overload
|
|
436
|
-
def
|
|
457
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
437
458
|
...
|
|
438
459
|
|
|
439
|
-
def
|
|
440
|
-
"""
|
|
441
|
-
Specifies the Conda environment for the step.
|
|
442
|
-
|
|
443
|
-
Information in this decorator will augment any
|
|
444
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
445
|
-
you can use `@conda_base` to set packages required by all
|
|
446
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
Parameters
|
|
450
|
-
----------
|
|
451
|
-
packages : Dict[str, str], default {}
|
|
452
|
-
Packages to use for this step. The key is the name of the package
|
|
453
|
-
and the value is the version to use.
|
|
454
|
-
libraries : Dict[str, str], default {}
|
|
455
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
456
|
-
python : str, optional, default None
|
|
457
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
458
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
459
|
-
disabled : bool, default False
|
|
460
|
-
If set to True, disables @conda.
|
|
461
|
-
"""
|
|
462
|
-
...
|
|
463
|
-
|
|
464
|
-
@typing.overload
|
|
465
|
-
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]]]:
|
|
466
|
-
"""
|
|
467
|
-
Specifies the resources needed when executing this step.
|
|
468
|
-
|
|
469
|
-
Use `@resources` to specify the resource requirements
|
|
470
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
471
|
-
|
|
472
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
473
|
-
```
|
|
474
|
-
python myflow.py run --with batch
|
|
475
|
-
```
|
|
476
|
-
or
|
|
477
|
-
```
|
|
478
|
-
python myflow.py run --with kubernetes
|
|
479
|
-
```
|
|
480
|
-
which executes the flow on the desired system using the
|
|
481
|
-
requirements specified in `@resources`.
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
Parameters
|
|
485
|
-
----------
|
|
486
|
-
cpu : int, default 1
|
|
487
|
-
Number of CPUs required for this step.
|
|
488
|
-
gpu : int, optional, default None
|
|
489
|
-
Number of GPUs required for this step.
|
|
490
|
-
disk : int, optional, default None
|
|
491
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
492
|
-
memory : int, default 4096
|
|
493
|
-
Memory size (in MB) required for this step.
|
|
494
|
-
shared_memory : int, optional, default None
|
|
495
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
496
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
497
|
-
"""
|
|
498
|
-
...
|
|
499
|
-
|
|
500
|
-
@typing.overload
|
|
501
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
502
|
-
...
|
|
503
|
-
|
|
504
|
-
@typing.overload
|
|
505
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
506
|
-
...
|
|
507
|
-
|
|
508
|
-
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):
|
|
509
|
-
"""
|
|
510
|
-
Specifies the resources needed when executing this step.
|
|
511
|
-
|
|
512
|
-
Use `@resources` to specify the resource requirements
|
|
513
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
514
|
-
|
|
515
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
516
|
-
```
|
|
517
|
-
python myflow.py run --with batch
|
|
518
|
-
```
|
|
519
|
-
or
|
|
520
|
-
```
|
|
521
|
-
python myflow.py run --with kubernetes
|
|
522
|
-
```
|
|
523
|
-
which executes the flow on the desired system using the
|
|
524
|
-
requirements specified in `@resources`.
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
Parameters
|
|
528
|
-
----------
|
|
529
|
-
cpu : int, default 1
|
|
530
|
-
Number of CPUs required for this step.
|
|
531
|
-
gpu : int, optional, default None
|
|
532
|
-
Number of GPUs required for this step.
|
|
533
|
-
disk : int, optional, default None
|
|
534
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
535
|
-
memory : int, default 4096
|
|
536
|
-
Memory size (in MB) required for this step.
|
|
537
|
-
shared_memory : int, optional, default None
|
|
538
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
539
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
540
|
-
"""
|
|
541
|
-
...
|
|
542
|
-
|
|
543
|
-
@typing.overload
|
|
544
|
-
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, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = 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]]]:
|
|
460
|
+
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, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = 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):
|
|
545
461
|
"""
|
|
546
462
|
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
547
463
|
|
|
@@ -615,83 +531,194 @@ def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optio
|
|
|
615
531
|
...
|
|
616
532
|
|
|
617
533
|
@typing.overload
|
|
618
|
-
def
|
|
534
|
+
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]]]:
|
|
535
|
+
"""
|
|
536
|
+
Specifies a timeout for your step.
|
|
537
|
+
|
|
538
|
+
This decorator is useful if this step may hang indefinitely.
|
|
539
|
+
|
|
540
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
541
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
542
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
543
|
+
|
|
544
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
545
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
Parameters
|
|
549
|
+
----------
|
|
550
|
+
seconds : int, default 0
|
|
551
|
+
Number of seconds to wait prior to timing out.
|
|
552
|
+
minutes : int, default 0
|
|
553
|
+
Number of minutes to wait prior to timing out.
|
|
554
|
+
hours : int, default 0
|
|
555
|
+
Number of hours to wait prior to timing out.
|
|
556
|
+
"""
|
|
619
557
|
...
|
|
620
558
|
|
|
621
559
|
@typing.overload
|
|
622
|
-
def
|
|
560
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
623
561
|
...
|
|
624
562
|
|
|
625
|
-
|
|
563
|
+
@typing.overload
|
|
564
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
565
|
+
...
|
|
566
|
+
|
|
567
|
+
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):
|
|
626
568
|
"""
|
|
627
|
-
Specifies
|
|
569
|
+
Specifies a timeout for your step.
|
|
570
|
+
|
|
571
|
+
This decorator is useful if this step may hang indefinitely.
|
|
572
|
+
|
|
573
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
574
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
575
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
576
|
+
|
|
577
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
578
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
628
579
|
|
|
629
580
|
|
|
630
581
|
Parameters
|
|
631
582
|
----------
|
|
632
|
-
|
|
633
|
-
Number of
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
583
|
+
seconds : int, default 0
|
|
584
|
+
Number of seconds to wait prior to timing out.
|
|
585
|
+
minutes : int, default 0
|
|
586
|
+
Number of minutes to wait prior to timing out.
|
|
587
|
+
hours : int, default 0
|
|
588
|
+
Number of hours to wait prior to timing out.
|
|
589
|
+
"""
|
|
590
|
+
...
|
|
591
|
+
|
|
592
|
+
@typing.overload
|
|
593
|
+
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]]]:
|
|
594
|
+
"""
|
|
595
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
596
|
+
|
|
597
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
Parameters
|
|
601
|
+
----------
|
|
602
|
+
type : str, default 'default'
|
|
603
|
+
Card type.
|
|
604
|
+
id : str, optional, default None
|
|
605
|
+
If multiple cards are present, use this id to identify this card.
|
|
606
|
+
options : Dict[str, Any], default {}
|
|
607
|
+
Options passed to the card. The contents depend on the card type.
|
|
608
|
+
timeout : int, default 45
|
|
609
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
610
|
+
"""
|
|
611
|
+
...
|
|
612
|
+
|
|
613
|
+
@typing.overload
|
|
614
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
615
|
+
...
|
|
616
|
+
|
|
617
|
+
@typing.overload
|
|
618
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
619
|
+
...
|
|
620
|
+
|
|
621
|
+
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):
|
|
622
|
+
"""
|
|
623
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
624
|
+
|
|
625
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
Parameters
|
|
629
|
+
----------
|
|
630
|
+
type : str, default 'default'
|
|
631
|
+
Card type.
|
|
632
|
+
id : str, optional, default None
|
|
633
|
+
If multiple cards are present, use this id to identify this card.
|
|
634
|
+
options : Dict[str, Any], default {}
|
|
635
|
+
Options passed to the card. The contents depend on the card type.
|
|
636
|
+
timeout : int, default 45
|
|
637
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
638
|
+
"""
|
|
639
|
+
...
|
|
640
|
+
|
|
641
|
+
@typing.overload
|
|
642
|
+
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]]]:
|
|
643
|
+
"""
|
|
644
|
+
Specifies the PyPI packages for the step.
|
|
645
|
+
|
|
646
|
+
Information in this decorator will augment any
|
|
647
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
648
|
+
you can use `@pypi_base` to set packages required by all
|
|
649
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
Parameters
|
|
653
|
+
----------
|
|
654
|
+
packages : Dict[str, str], default: {}
|
|
655
|
+
Packages to use for this step. The key is the name of the package
|
|
656
|
+
and the value is the version to use.
|
|
657
|
+
python : str, optional, default: None
|
|
658
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
659
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
660
|
+
"""
|
|
661
|
+
...
|
|
662
|
+
|
|
663
|
+
@typing.overload
|
|
664
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
665
|
+
...
|
|
666
|
+
|
|
667
|
+
@typing.overload
|
|
668
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
669
|
+
...
|
|
670
|
+
|
|
671
|
+
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):
|
|
672
|
+
"""
|
|
673
|
+
Specifies the PyPI packages for the step.
|
|
674
|
+
|
|
675
|
+
Information in this decorator will augment any
|
|
676
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
677
|
+
you can use `@pypi_base` to set packages required by all
|
|
678
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
Parameters
|
|
682
|
+
----------
|
|
683
|
+
packages : Dict[str, str], default: {}
|
|
684
|
+
Packages to use for this step. The key is the name of the package
|
|
685
|
+
and the value is the version to use.
|
|
686
|
+
python : str, optional, default: None
|
|
687
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
688
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
689
|
+
"""
|
|
690
|
+
...
|
|
691
|
+
|
|
692
|
+
@typing.overload
|
|
693
|
+
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]]]:
|
|
694
|
+
"""
|
|
695
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
Parameters
|
|
699
|
+
----------
|
|
700
|
+
vars : Dict[str, str], default {}
|
|
701
|
+
Dictionary of environment variables to set.
|
|
702
|
+
"""
|
|
703
|
+
...
|
|
704
|
+
|
|
705
|
+
@typing.overload
|
|
706
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
707
|
+
...
|
|
708
|
+
|
|
709
|
+
@typing.overload
|
|
710
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
711
|
+
...
|
|
712
|
+
|
|
713
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
714
|
+
"""
|
|
715
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
Parameters
|
|
719
|
+
----------
|
|
720
|
+
vars : Dict[str, str], default {}
|
|
721
|
+
Dictionary of environment variables to set.
|
|
695
722
|
"""
|
|
696
723
|
...
|
|
697
724
|
|
|
@@ -785,533 +812,452 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
|
785
812
|
...
|
|
786
813
|
|
|
787
814
|
@typing.overload
|
|
788
|
-
def
|
|
789
|
-
"""
|
|
790
|
-
Specifies the PyPI packages for the step.
|
|
791
|
-
|
|
792
|
-
Information in this decorator will augment any
|
|
793
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
794
|
-
you can use `@pypi_base` to set packages required by all
|
|
795
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
Parameters
|
|
799
|
-
----------
|
|
800
|
-
packages : Dict[str, str], default: {}
|
|
801
|
-
Packages to use for this step. The key is the name of the package
|
|
802
|
-
and the value is the version to use.
|
|
803
|
-
python : str, optional, default: None
|
|
804
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
805
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
806
|
-
"""
|
|
807
|
-
...
|
|
808
|
-
|
|
809
|
-
@typing.overload
|
|
810
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
811
|
-
...
|
|
812
|
-
|
|
813
|
-
@typing.overload
|
|
814
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
815
|
-
...
|
|
816
|
-
|
|
817
|
-
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):
|
|
818
|
-
"""
|
|
819
|
-
Specifies the PyPI packages for the step.
|
|
820
|
-
|
|
821
|
-
Information in this decorator will augment any
|
|
822
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
823
|
-
you can use `@pypi_base` to set packages required by all
|
|
824
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
Parameters
|
|
828
|
-
----------
|
|
829
|
-
packages : Dict[str, str], default: {}
|
|
830
|
-
Packages to use for this step. The key is the name of the package
|
|
831
|
-
and the value is the version to use.
|
|
832
|
-
python : str, optional, default: None
|
|
833
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
834
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
835
|
-
"""
|
|
836
|
-
...
|
|
837
|
-
|
|
838
|
-
@typing.overload
|
|
839
|
-
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]]]:
|
|
815
|
+
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]]]:
|
|
840
816
|
"""
|
|
841
|
-
Specifies the
|
|
842
|
-
to a step needs to be retried.
|
|
817
|
+
Specifies the resources needed when executing this step.
|
|
843
818
|
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
819
|
+
Use `@resources` to specify the resource requirements
|
|
820
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
847
821
|
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
822
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
823
|
+
```
|
|
824
|
+
python myflow.py run --with batch
|
|
825
|
+
```
|
|
826
|
+
or
|
|
827
|
+
```
|
|
828
|
+
python myflow.py run --with kubernetes
|
|
829
|
+
```
|
|
830
|
+
which executes the flow on the desired system using the
|
|
831
|
+
requirements specified in `@resources`.
|
|
851
832
|
|
|
852
833
|
|
|
853
834
|
Parameters
|
|
854
835
|
----------
|
|
855
|
-
|
|
856
|
-
Number of
|
|
857
|
-
|
|
858
|
-
Number of
|
|
836
|
+
cpu : int, default 1
|
|
837
|
+
Number of CPUs required for this step.
|
|
838
|
+
gpu : int, optional, default None
|
|
839
|
+
Number of GPUs required for this step.
|
|
840
|
+
disk : int, optional, default None
|
|
841
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
842
|
+
memory : int, default 4096
|
|
843
|
+
Memory size (in MB) required for this step.
|
|
844
|
+
shared_memory : int, optional, default None
|
|
845
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
846
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
859
847
|
"""
|
|
860
848
|
...
|
|
861
849
|
|
|
862
850
|
@typing.overload
|
|
863
|
-
def
|
|
851
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
864
852
|
...
|
|
865
853
|
|
|
866
854
|
@typing.overload
|
|
867
|
-
def
|
|
855
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
868
856
|
...
|
|
869
857
|
|
|
870
|
-
def
|
|
858
|
+
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):
|
|
871
859
|
"""
|
|
872
|
-
Specifies the
|
|
873
|
-
to a step needs to be retried.
|
|
874
|
-
|
|
875
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
876
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
877
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
878
|
-
|
|
879
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
880
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
881
|
-
ensuring that the flow execution can continue.
|
|
882
|
-
|
|
860
|
+
Specifies the resources needed when executing this step.
|
|
883
861
|
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
times : int, default 3
|
|
887
|
-
Number of times to retry this task.
|
|
888
|
-
minutes_between_retries : int, default 2
|
|
889
|
-
Number of minutes between retries.
|
|
890
|
-
"""
|
|
891
|
-
...
|
|
892
|
-
|
|
893
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
894
|
-
"""
|
|
895
|
-
Specifies what flows belong to the same project.
|
|
862
|
+
Use `@resources` to specify the resource requirements
|
|
863
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
896
864
|
|
|
897
|
-
|
|
898
|
-
|
|
865
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
866
|
+
```
|
|
867
|
+
python myflow.py run --with batch
|
|
868
|
+
```
|
|
869
|
+
or
|
|
870
|
+
```
|
|
871
|
+
python myflow.py run --with kubernetes
|
|
872
|
+
```
|
|
873
|
+
which executes the flow on the desired system using the
|
|
874
|
+
requirements specified in `@resources`.
|
|
899
875
|
|
|
900
876
|
|
|
901
877
|
Parameters
|
|
902
878
|
----------
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
production : bool, default False
|
|
915
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
916
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
917
|
-
`production` in the decorator and on the command line.
|
|
918
|
-
The project branch name will be:
|
|
919
|
-
- if `branch` is specified:
|
|
920
|
-
- if `production` is True: `prod.<branch>`
|
|
921
|
-
- if `production` is False: `test.<branch>`
|
|
922
|
-
- if `branch` is not specified:
|
|
923
|
-
- if `production` is True: `prod`
|
|
924
|
-
- if `production` is False: `user.<username>`
|
|
879
|
+
cpu : int, default 1
|
|
880
|
+
Number of CPUs required for this step.
|
|
881
|
+
gpu : int, optional, default None
|
|
882
|
+
Number of GPUs required for this step.
|
|
883
|
+
disk : int, optional, default None
|
|
884
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
885
|
+
memory : int, default 4096
|
|
886
|
+
Memory size (in MB) required for this step.
|
|
887
|
+
shared_memory : int, optional, default None
|
|
888
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
889
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
925
890
|
"""
|
|
926
891
|
...
|
|
927
892
|
|
|
928
893
|
@typing.overload
|
|
929
|
-
def
|
|
894
|
+
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]]:
|
|
930
895
|
"""
|
|
931
|
-
Specifies the
|
|
896
|
+
Specifies the flow(s) that this flow depends on.
|
|
932
897
|
|
|
933
898
|
```
|
|
934
|
-
@
|
|
899
|
+
@trigger_on_finish(flow='FooFlow')
|
|
935
900
|
```
|
|
936
901
|
or
|
|
937
902
|
```
|
|
938
|
-
@
|
|
903
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
939
904
|
```
|
|
905
|
+
This decorator respects the @project decorator and triggers the flow
|
|
906
|
+
when upstream runs within the same namespace complete successfully
|
|
940
907
|
|
|
941
|
-
Additionally, you can specify
|
|
942
|
-
|
|
908
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
909
|
+
by specifying the fully qualified project_flow_name.
|
|
943
910
|
```
|
|
944
|
-
@
|
|
911
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
945
912
|
```
|
|
946
913
|
or
|
|
947
914
|
```
|
|
948
|
-
@
|
|
949
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
915
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
950
916
|
```
|
|
951
917
|
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
955
|
-
```
|
|
956
|
-
This is equivalent to:
|
|
918
|
+
You can also specify just the project or project branch (other values will be
|
|
919
|
+
inferred from the current project or project branch):
|
|
957
920
|
```
|
|
958
|
-
@
|
|
921
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
959
922
|
```
|
|
960
923
|
|
|
924
|
+
Note that `branch` is typically one of:
|
|
925
|
+
- `prod`
|
|
926
|
+
- `user.bob`
|
|
927
|
+
- `test.my_experiment`
|
|
928
|
+
- `prod.staging`
|
|
929
|
+
|
|
961
930
|
|
|
962
931
|
Parameters
|
|
963
932
|
----------
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
933
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
934
|
+
Upstream flow dependency for this flow.
|
|
935
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
936
|
+
Upstream flow dependencies for this flow.
|
|
968
937
|
options : Dict[str, Any], default {}
|
|
969
938
|
Backend-specific configuration for tuning eventing behavior.
|
|
970
939
|
"""
|
|
971
940
|
...
|
|
972
941
|
|
|
973
942
|
@typing.overload
|
|
974
|
-
def
|
|
943
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
975
944
|
...
|
|
976
945
|
|
|
977
|
-
def
|
|
946
|
+
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] = {}):
|
|
978
947
|
"""
|
|
979
|
-
Specifies the
|
|
948
|
+
Specifies the flow(s) that this flow depends on.
|
|
980
949
|
|
|
981
950
|
```
|
|
982
|
-
@
|
|
951
|
+
@trigger_on_finish(flow='FooFlow')
|
|
983
952
|
```
|
|
984
953
|
or
|
|
985
954
|
```
|
|
986
|
-
@
|
|
955
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
987
956
|
```
|
|
957
|
+
This decorator respects the @project decorator and triggers the flow
|
|
958
|
+
when upstream runs within the same namespace complete successfully
|
|
988
959
|
|
|
989
|
-
Additionally, you can specify
|
|
990
|
-
|
|
960
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
961
|
+
by specifying the fully qualified project_flow_name.
|
|
991
962
|
```
|
|
992
|
-
@
|
|
963
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
993
964
|
```
|
|
994
965
|
or
|
|
995
966
|
```
|
|
996
|
-
@
|
|
997
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
967
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
998
968
|
```
|
|
999
969
|
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1003
|
-
```
|
|
1004
|
-
This is equivalent to:
|
|
970
|
+
You can also specify just the project or project branch (other values will be
|
|
971
|
+
inferred from the current project or project branch):
|
|
1005
972
|
```
|
|
1006
|
-
@
|
|
973
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1007
974
|
```
|
|
1008
975
|
|
|
976
|
+
Note that `branch` is typically one of:
|
|
977
|
+
- `prod`
|
|
978
|
+
- `user.bob`
|
|
979
|
+
- `test.my_experiment`
|
|
980
|
+
- `prod.staging`
|
|
981
|
+
|
|
1009
982
|
|
|
1010
983
|
Parameters
|
|
1011
984
|
----------
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
985
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
986
|
+
Upstream flow dependency for this flow.
|
|
987
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
988
|
+
Upstream flow dependencies for this flow.
|
|
1016
989
|
options : Dict[str, Any], default {}
|
|
1017
990
|
Backend-specific configuration for tuning eventing behavior.
|
|
1018
991
|
"""
|
|
1019
992
|
...
|
|
1020
993
|
|
|
1021
|
-
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
|
-
"""
|
|
1023
|
-
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.
|
|
1024
|
-
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.
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
Parameters
|
|
1028
|
-
----------
|
|
1029
|
-
timeout : int
|
|
1030
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1031
|
-
poke_interval : int
|
|
1032
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1033
|
-
mode : str
|
|
1034
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1035
|
-
exponential_backoff : bool
|
|
1036
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1037
|
-
pool : str
|
|
1038
|
-
the slot pool this task should run in,
|
|
1039
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1040
|
-
soft_fail : bool
|
|
1041
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1042
|
-
name : str
|
|
1043
|
-
Name of the sensor on Airflow
|
|
1044
|
-
description : str
|
|
1045
|
-
Description of sensor in the Airflow UI
|
|
1046
|
-
external_dag_id : str
|
|
1047
|
-
The dag_id that contains the task you want to wait for.
|
|
1048
|
-
external_task_ids : List[str]
|
|
1049
|
-
The list of task_ids that you want to wait for.
|
|
1050
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1051
|
-
allowed_states : List[str]
|
|
1052
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1053
|
-
failed_states : List[str]
|
|
1054
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1055
|
-
execution_delta : datetime.timedelta
|
|
1056
|
-
time difference with the previous execution to look at,
|
|
1057
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1058
|
-
check_existence: bool
|
|
1059
|
-
Set to True to check if the external task exists or check if
|
|
1060
|
-
the DAG to wait for exists. (Default: True)
|
|
1061
|
-
"""
|
|
1062
|
-
...
|
|
1063
|
-
|
|
1064
994
|
@typing.overload
|
|
1065
|
-
def
|
|
995
|
+
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]]:
|
|
1066
996
|
"""
|
|
1067
|
-
Specifies the
|
|
997
|
+
Specifies the Conda environment for all steps of the flow.
|
|
998
|
+
|
|
999
|
+
Use `@conda_base` to set common libraries required by all
|
|
1000
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1068
1001
|
|
|
1069
|
-
Use `@pypi_base` to set common packages required by all
|
|
1070
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1071
1002
|
|
|
1072
1003
|
Parameters
|
|
1073
1004
|
----------
|
|
1074
|
-
packages : Dict[str, str], default
|
|
1005
|
+
packages : Dict[str, str], default {}
|
|
1075
1006
|
Packages to use for this flow. The key is the name of the package
|
|
1076
1007
|
and the value is the version to use.
|
|
1077
|
-
|
|
1008
|
+
libraries : Dict[str, str], default {}
|
|
1009
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1010
|
+
python : str, optional, default None
|
|
1078
1011
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1079
1012
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1013
|
+
disabled : bool, default False
|
|
1014
|
+
If set to True, disables Conda.
|
|
1080
1015
|
"""
|
|
1081
1016
|
...
|
|
1082
1017
|
|
|
1083
1018
|
@typing.overload
|
|
1084
|
-
def
|
|
1019
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1085
1020
|
...
|
|
1086
1021
|
|
|
1087
|
-
def
|
|
1022
|
+
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):
|
|
1088
1023
|
"""
|
|
1089
|
-
Specifies the
|
|
1024
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1025
|
+
|
|
1026
|
+
Use `@conda_base` to set common libraries required by all
|
|
1027
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1090
1028
|
|
|
1091
|
-
Use `@pypi_base` to set common packages required by all
|
|
1092
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1093
1029
|
|
|
1094
1030
|
Parameters
|
|
1095
1031
|
----------
|
|
1096
|
-
packages : Dict[str, str], default
|
|
1032
|
+
packages : Dict[str, str], default {}
|
|
1097
1033
|
Packages to use for this flow. The key is the name of the package
|
|
1098
1034
|
and the value is the version to use.
|
|
1099
|
-
|
|
1035
|
+
libraries : Dict[str, str], default {}
|
|
1036
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1037
|
+
python : str, optional, default None
|
|
1100
1038
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1101
1039
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1040
|
+
disabled : bool, default False
|
|
1041
|
+
If set to True, disables Conda.
|
|
1102
1042
|
"""
|
|
1103
1043
|
...
|
|
1104
1044
|
|
|
1105
|
-
|
|
1106
|
-
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]]:
|
|
1045
|
+
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]]:
|
|
1107
1046
|
"""
|
|
1108
|
-
|
|
1109
|
-
|
|
1047
|
+
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)
|
|
1048
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1049
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1050
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1051
|
+
starts only after all sensors finish.
|
|
1110
1052
|
|
|
1111
1053
|
|
|
1112
1054
|
Parameters
|
|
1113
1055
|
----------
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1056
|
+
timeout : int
|
|
1057
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1058
|
+
poke_interval : int
|
|
1059
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1060
|
+
mode : str
|
|
1061
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1062
|
+
exponential_backoff : bool
|
|
1063
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1064
|
+
pool : str
|
|
1065
|
+
the slot pool this task should run in,
|
|
1066
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1067
|
+
soft_fail : bool
|
|
1068
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1069
|
+
name : str
|
|
1070
|
+
Name of the sensor on Airflow
|
|
1071
|
+
description : str
|
|
1072
|
+
Description of sensor in the Airflow UI
|
|
1073
|
+
bucket_key : Union[str, List[str]]
|
|
1074
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1075
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1076
|
+
bucket_name : str
|
|
1077
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1078
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1079
|
+
wildcard_match : bool
|
|
1080
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1081
|
+
aws_conn_id : str
|
|
1082
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1083
|
+
verify : bool
|
|
1084
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1126
1085
|
"""
|
|
1127
1086
|
...
|
|
1128
1087
|
|
|
1129
|
-
|
|
1130
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1131
|
-
...
|
|
1132
|
-
|
|
1133
|
-
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):
|
|
1088
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1134
1089
|
"""
|
|
1135
|
-
Specifies
|
|
1136
|
-
|
|
1090
|
+
Specifies what flows belong to the same project.
|
|
1091
|
+
|
|
1092
|
+
A project-specific namespace is created for all flows that
|
|
1093
|
+
use the same `@project(name)`.
|
|
1137
1094
|
|
|
1138
1095
|
|
|
1139
1096
|
Parameters
|
|
1140
1097
|
----------
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1098
|
+
name : str
|
|
1099
|
+
Project name. Make sure that the name is unique amongst all
|
|
1100
|
+
projects that use the same production scheduler. The name may
|
|
1101
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1102
|
+
|
|
1103
|
+
branch : Optional[str], default None
|
|
1104
|
+
The branch to use. If not specified, the branch is set to
|
|
1105
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1106
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1107
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1108
|
+
|
|
1109
|
+
production : bool, default False
|
|
1110
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1111
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1112
|
+
`production` in the decorator and on the command line.
|
|
1113
|
+
The project branch name will be:
|
|
1114
|
+
- if `branch` is specified:
|
|
1115
|
+
- if `production` is True: `prod.<branch>`
|
|
1116
|
+
- if `production` is False: `test.<branch>`
|
|
1117
|
+
- if `branch` is not specified:
|
|
1118
|
+
- if `production` is True: `prod`
|
|
1119
|
+
- if `production` is False: `user.<username>`
|
|
1153
1120
|
"""
|
|
1154
1121
|
...
|
|
1155
1122
|
|
|
1156
1123
|
@typing.overload
|
|
1157
|
-
def
|
|
1124
|
+
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]]:
|
|
1158
1125
|
"""
|
|
1159
|
-
Specifies the
|
|
1126
|
+
Specifies the event(s) that this flow depends on.
|
|
1160
1127
|
|
|
1161
1128
|
```
|
|
1162
|
-
@
|
|
1129
|
+
@trigger(event='foo')
|
|
1163
1130
|
```
|
|
1164
1131
|
or
|
|
1165
1132
|
```
|
|
1166
|
-
@
|
|
1133
|
+
@trigger(events=['foo', 'bar'])
|
|
1167
1134
|
```
|
|
1168
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1169
|
-
when upstream runs within the same namespace complete successfully
|
|
1170
1135
|
|
|
1171
|
-
Additionally, you can specify
|
|
1172
|
-
|
|
1136
|
+
Additionally, you can specify the parameter mappings
|
|
1137
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1173
1138
|
```
|
|
1174
|
-
@
|
|
1139
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1175
1140
|
```
|
|
1176
1141
|
or
|
|
1177
1142
|
```
|
|
1178
|
-
@
|
|
1143
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1144
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1179
1145
|
```
|
|
1180
1146
|
|
|
1181
|
-
|
|
1182
|
-
inferred from the current project or project branch):
|
|
1147
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1183
1148
|
```
|
|
1184
|
-
@
|
|
1149
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1150
|
+
```
|
|
1151
|
+
This is equivalent to:
|
|
1152
|
+
```
|
|
1153
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1185
1154
|
```
|
|
1186
|
-
|
|
1187
|
-
Note that `branch` is typically one of:
|
|
1188
|
-
- `prod`
|
|
1189
|
-
- `user.bob`
|
|
1190
|
-
- `test.my_experiment`
|
|
1191
|
-
- `prod.staging`
|
|
1192
1155
|
|
|
1193
1156
|
|
|
1194
1157
|
Parameters
|
|
1195
1158
|
----------
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1159
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1160
|
+
Event dependency for this flow.
|
|
1161
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1162
|
+
Events dependency for this flow.
|
|
1200
1163
|
options : Dict[str, Any], default {}
|
|
1201
1164
|
Backend-specific configuration for tuning eventing behavior.
|
|
1202
1165
|
"""
|
|
1203
1166
|
...
|
|
1204
1167
|
|
|
1205
1168
|
@typing.overload
|
|
1206
|
-
def
|
|
1169
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1207
1170
|
...
|
|
1208
1171
|
|
|
1209
|
-
def
|
|
1172
|
+
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] = {}):
|
|
1210
1173
|
"""
|
|
1211
|
-
Specifies the
|
|
1174
|
+
Specifies the event(s) that this flow depends on.
|
|
1212
1175
|
|
|
1213
1176
|
```
|
|
1214
|
-
@
|
|
1177
|
+
@trigger(event='foo')
|
|
1215
1178
|
```
|
|
1216
1179
|
or
|
|
1217
1180
|
```
|
|
1218
|
-
@
|
|
1181
|
+
@trigger(events=['foo', 'bar'])
|
|
1219
1182
|
```
|
|
1220
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1221
|
-
when upstream runs within the same namespace complete successfully
|
|
1222
1183
|
|
|
1223
|
-
Additionally, you can specify
|
|
1224
|
-
|
|
1184
|
+
Additionally, you can specify the parameter mappings
|
|
1185
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1225
1186
|
```
|
|
1226
|
-
@
|
|
1187
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1227
1188
|
```
|
|
1228
1189
|
or
|
|
1229
1190
|
```
|
|
1230
|
-
@
|
|
1191
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1192
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1231
1193
|
```
|
|
1232
1194
|
|
|
1233
|
-
|
|
1234
|
-
inferred from the current project or project branch):
|
|
1195
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1235
1196
|
```
|
|
1236
|
-
@
|
|
1197
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1198
|
+
```
|
|
1199
|
+
This is equivalent to:
|
|
1200
|
+
```
|
|
1201
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1237
1202
|
```
|
|
1238
|
-
|
|
1239
|
-
Note that `branch` is typically one of:
|
|
1240
|
-
- `prod`
|
|
1241
|
-
- `user.bob`
|
|
1242
|
-
- `test.my_experiment`
|
|
1243
|
-
- `prod.staging`
|
|
1244
1203
|
|
|
1245
1204
|
|
|
1246
1205
|
Parameters
|
|
1247
1206
|
----------
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1207
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1208
|
+
Event dependency for this flow.
|
|
1209
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1210
|
+
Events dependency for this flow.
|
|
1252
1211
|
options : Dict[str, Any], default {}
|
|
1253
1212
|
Backend-specific configuration for tuning eventing behavior.
|
|
1254
1213
|
"""
|
|
1255
1214
|
...
|
|
1256
1215
|
|
|
1257
1216
|
@typing.overload
|
|
1258
|
-
def
|
|
1217
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1259
1218
|
"""
|
|
1260
|
-
Specifies the
|
|
1261
|
-
|
|
1262
|
-
Use `@conda_base` to set common libraries required by all
|
|
1263
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1219
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1264
1220
|
|
|
1221
|
+
Use `@pypi_base` to set common packages required by all
|
|
1222
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1265
1223
|
|
|
1266
1224
|
Parameters
|
|
1267
1225
|
----------
|
|
1268
|
-
packages : Dict[str, str], default {}
|
|
1226
|
+
packages : Dict[str, str], default: {}
|
|
1269
1227
|
Packages to use for this flow. The key is the name of the package
|
|
1270
1228
|
and the value is the version to use.
|
|
1271
|
-
|
|
1272
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1273
|
-
python : str, optional, default None
|
|
1229
|
+
python : str, optional, default: None
|
|
1274
1230
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1275
1231
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1276
|
-
disabled : bool, default False
|
|
1277
|
-
If set to True, disables Conda.
|
|
1278
1232
|
"""
|
|
1279
1233
|
...
|
|
1280
1234
|
|
|
1281
1235
|
@typing.overload
|
|
1282
|
-
def
|
|
1236
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1283
1237
|
...
|
|
1284
1238
|
|
|
1285
|
-
def
|
|
1239
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1286
1240
|
"""
|
|
1287
|
-
Specifies the
|
|
1288
|
-
|
|
1289
|
-
Use `@conda_base` to set common libraries required by all
|
|
1290
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1241
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1291
1242
|
|
|
1243
|
+
Use `@pypi_base` to set common packages required by all
|
|
1244
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1292
1245
|
|
|
1293
1246
|
Parameters
|
|
1294
1247
|
----------
|
|
1295
|
-
packages : Dict[str, str], default {}
|
|
1248
|
+
packages : Dict[str, str], default: {}
|
|
1296
1249
|
Packages to use for this flow. The key is the name of the package
|
|
1297
1250
|
and the value is the version to use.
|
|
1298
|
-
|
|
1299
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1300
|
-
python : str, optional, default None
|
|
1251
|
+
python : str, optional, default: None
|
|
1301
1252
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1302
1253
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1303
|
-
disabled : bool, default False
|
|
1304
|
-
If set to True, disables Conda.
|
|
1305
1254
|
"""
|
|
1306
1255
|
...
|
|
1307
1256
|
|
|
1308
|
-
def
|
|
1257
|
+
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]]:
|
|
1309
1258
|
"""
|
|
1310
|
-
The `@
|
|
1311
|
-
|
|
1312
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1313
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1314
|
-
starts only after all sensors finish.
|
|
1259
|
+
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.
|
|
1260
|
+
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.
|
|
1315
1261
|
|
|
1316
1262
|
|
|
1317
1263
|
Parameters
|
|
@@ -1333,18 +1279,72 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
|
1333
1279
|
Name of the sensor on Airflow
|
|
1334
1280
|
description : str
|
|
1335
1281
|
Description of sensor in the Airflow UI
|
|
1336
|
-
|
|
1337
|
-
The
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1282
|
+
external_dag_id : str
|
|
1283
|
+
The dag_id that contains the task you want to wait for.
|
|
1284
|
+
external_task_ids : List[str]
|
|
1285
|
+
The list of task_ids that you want to wait for.
|
|
1286
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1287
|
+
allowed_states : List[str]
|
|
1288
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1289
|
+
failed_states : List[str]
|
|
1290
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1291
|
+
execution_delta : datetime.timedelta
|
|
1292
|
+
time difference with the previous execution to look at,
|
|
1293
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1294
|
+
check_existence: bool
|
|
1295
|
+
Set to True to check if the external task exists or check if
|
|
1296
|
+
the DAG to wait for exists. (Default: True)
|
|
1297
|
+
"""
|
|
1298
|
+
...
|
|
1299
|
+
|
|
1300
|
+
@typing.overload
|
|
1301
|
+
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]]:
|
|
1302
|
+
"""
|
|
1303
|
+
Specifies the times when the flow should be run when running on a
|
|
1304
|
+
production scheduler.
|
|
1305
|
+
|
|
1306
|
+
|
|
1307
|
+
Parameters
|
|
1308
|
+
----------
|
|
1309
|
+
hourly : bool, default False
|
|
1310
|
+
Run the workflow hourly.
|
|
1311
|
+
daily : bool, default True
|
|
1312
|
+
Run the workflow daily.
|
|
1313
|
+
weekly : bool, default False
|
|
1314
|
+
Run the workflow weekly.
|
|
1315
|
+
cron : str, optional, default None
|
|
1316
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1317
|
+
specified by this expression.
|
|
1318
|
+
timezone : str, optional, default None
|
|
1319
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1320
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1321
|
+
"""
|
|
1322
|
+
...
|
|
1323
|
+
|
|
1324
|
+
@typing.overload
|
|
1325
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1326
|
+
...
|
|
1327
|
+
|
|
1328
|
+
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):
|
|
1329
|
+
"""
|
|
1330
|
+
Specifies the times when the flow should be run when running on a
|
|
1331
|
+
production scheduler.
|
|
1332
|
+
|
|
1333
|
+
|
|
1334
|
+
Parameters
|
|
1335
|
+
----------
|
|
1336
|
+
hourly : bool, default False
|
|
1337
|
+
Run the workflow hourly.
|
|
1338
|
+
daily : bool, default True
|
|
1339
|
+
Run the workflow daily.
|
|
1340
|
+
weekly : bool, default False
|
|
1341
|
+
Run the workflow weekly.
|
|
1342
|
+
cron : str, optional, default None
|
|
1343
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1344
|
+
specified by this expression.
|
|
1345
|
+
timezone : str, optional, default None
|
|
1346
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1347
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1348
1348
|
"""
|
|
1349
1349
|
...
|
|
1350
1350
|
|