metaflow-stubs 2.15.20__py2.py3-none-any.whl → 2.16.0__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 +649 -643
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +3 -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 +8 -9
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +10 -10
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +5 -5
- metaflow-stubs/{info_file.pyi → meta_files.pyi} +2 -6
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +6 -2
- metaflow-stubs/metaflow_current.pyi +26 -26
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +430 -0
- metaflow-stubs/packaging_sys/backend.pyi +73 -0
- metaflow-stubs/packaging_sys/distribution_support.pyi +72 -0
- metaflow-stubs/packaging_sys/tar_backend.pyi +53 -0
- metaflow-stubs/packaging_sys/utils.pyi +26 -0
- metaflow-stubs/packaging_sys/v1.pyi +145 -0
- metaflow-stubs/parameters.pyi +5 -5
- metaflow-stubs/plugins/__init__.pyi +12 -12
- 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 +5 -5
- 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 +4 -4
- metaflow-stubs/plugins/argo/exit_hooks.pyi +3 -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 +4 -4
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +4 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- 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 +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +4 -4
- 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 +3 -5
- 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 +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 +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 +5 -5
- 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 +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 +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +4 -4
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -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 +3 -3
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +5 -8
- metaflow-stubs/plugins/pypi/conda_environment.pyi +7 -6
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +4 -4
- 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 +2 -2
- 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 +4 -4
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +4 -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 +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +3 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- 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 -3
- metaflow-stubs/user_configs/config_options.pyi +5 -6
- metaflow-stubs/user_configs/config_parameters.pyi +6 -8
- metaflow-stubs/user_decorators/__init__.pyi +15 -0
- metaflow-stubs/user_decorators/common.pyi +38 -0
- metaflow-stubs/user_decorators/mutable_flow.pyi +223 -0
- metaflow-stubs/user_decorators/mutable_step.pyi +152 -0
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +137 -0
- metaflow-stubs/user_decorators/user_step_decorator.pyi +323 -0
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.15.20.dist-info → metaflow_stubs-2.16.0.dist-info}/METADATA +2 -2
- metaflow_stubs-2.16.0.dist-info/RECORD +166 -0
- metaflow-stubs/user_configs/config_decorators.pyi +0 -251
- metaflow_stubs-2.15.20.dist-info/RECORD +0 -155
- {metaflow_stubs-2.15.20.dist-info → metaflow_stubs-2.16.0.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.15.20.dist-info → metaflow_stubs-2.16.0.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
######################################################################################################
|
|
2
2
|
# Auto-generated Metaflow stub file #
|
|
3
|
-
# MF version: 2.
|
|
4
|
-
# Generated on 2025-07-
|
|
3
|
+
# MF version: 2.16.0 #
|
|
4
|
+
# Generated on 2025-07-12T15:28:57.479372 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
@@ -13,7 +13,8 @@ if typing.TYPE_CHECKING:
|
|
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
|
15
15
|
|
|
16
|
-
from . import
|
|
16
|
+
from . import meta_files as meta_files
|
|
17
|
+
from . import packaging_sys as packaging_sys
|
|
17
18
|
from . import exception as exception
|
|
18
19
|
from . import metaflow_config as metaflow_config
|
|
19
20
|
from . import multicore_utils as multicore_utils
|
|
@@ -23,6 +24,7 @@ from . import metaflow_current as metaflow_current
|
|
|
23
24
|
from .metaflow_current import current as current
|
|
24
25
|
from . import parameters as parameters
|
|
25
26
|
from . import user_configs as user_configs
|
|
27
|
+
from . import user_decorators as user_decorators
|
|
26
28
|
from . import tagging_util as tagging_util
|
|
27
29
|
from . import metadata_provider as metadata_provider
|
|
28
30
|
from . import flowspec as flowspec
|
|
@@ -33,19 +35,21 @@ from .parameters import JSONType as JSONType
|
|
|
33
35
|
from .user_configs.config_parameters import Config as Config
|
|
34
36
|
from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
37
|
from .user_configs.config_parameters import config_expr as config_expr
|
|
36
|
-
from .
|
|
37
|
-
from .
|
|
38
|
-
from . import
|
|
39
|
-
from . import
|
|
38
|
+
from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDecorator
|
|
39
|
+
from .user_decorators.user_step_decorator import StepMutator as StepMutator
|
|
40
|
+
from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
|
|
41
|
+
from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
|
|
40
42
|
from . import metaflow_git as metaflow_git
|
|
43
|
+
from . import events as events
|
|
44
|
+
from . import tuple_util as tuple_util
|
|
41
45
|
from . import runner as runner
|
|
42
46
|
from . import plugins as plugins
|
|
43
47
|
from .plugins.datatools.s3.s3 import S3 as S3
|
|
44
48
|
from . import includefile as includefile
|
|
45
49
|
from .includefile import IncludeFile as IncludeFile
|
|
46
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
47
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
48
50
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
51
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
52
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
49
53
|
from . import cards as cards
|
|
50
54
|
from . import client as client
|
|
51
55
|
from .client.core import namespace as namespace
|
|
@@ -73,6 +77,8 @@ from . import cli as cli
|
|
|
73
77
|
|
|
74
78
|
EXT_PKG: str
|
|
75
79
|
|
|
80
|
+
USER_SKIP_STEP: dict
|
|
81
|
+
|
|
76
82
|
@typing.overload
|
|
77
83
|
def step(f: typing.Callable[[FlowSpecDerived], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
78
84
|
"""
|
|
@@ -147,200 +153,61 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
147
153
|
...
|
|
148
154
|
|
|
149
155
|
@typing.overload
|
|
150
|
-
def
|
|
151
|
-
"""
|
|
152
|
-
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
Parameters
|
|
156
|
-
----------
|
|
157
|
-
cpu : int, default 1
|
|
158
|
-
Number of CPUs required for this step. If `@resources` is
|
|
159
|
-
also present, the maximum value from all decorators is used.
|
|
160
|
-
gpu : int, default 0
|
|
161
|
-
Number of GPUs required for this step. If `@resources` is
|
|
162
|
-
also present, the maximum value from all decorators is used.
|
|
163
|
-
memory : int, default 4096
|
|
164
|
-
Memory size (in MB) required for this step. If
|
|
165
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
166
|
-
used.
|
|
167
|
-
image : str, optional, default None
|
|
168
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
|
169
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
170
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
171
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
172
|
-
AWS Batch Job Queue to submit the job to.
|
|
173
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
174
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
175
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
176
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
177
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
178
|
-
shared_memory : int, optional, default None
|
|
179
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
180
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
181
|
-
max_swap : int, optional, default None
|
|
182
|
-
The total amount of swap memory (in MiB) a container can use for this
|
|
183
|
-
step. This parameter is translated to the `--memory-swap` option in
|
|
184
|
-
Docker where the value is the sum of the container memory plus the
|
|
185
|
-
`max_swap` value.
|
|
186
|
-
swappiness : int, optional, default None
|
|
187
|
-
This allows you to tune memory swappiness behavior for this step.
|
|
188
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
189
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
190
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
191
|
-
use_tmpfs : bool, default False
|
|
192
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
193
|
-
not available on Fargate compute environments
|
|
194
|
-
tmpfs_tempdir : bool, default True
|
|
195
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
196
|
-
tmpfs_size : int, optional, default None
|
|
197
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
198
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
199
|
-
memory allocated for this step.
|
|
200
|
-
tmpfs_path : str, optional, default None
|
|
201
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
202
|
-
inferentia : int, default 0
|
|
203
|
-
Number of Inferentia chips required for this step.
|
|
204
|
-
trainium : int, default None
|
|
205
|
-
Alias for inferentia. Use only one of the two.
|
|
206
|
-
efa : int, default 0
|
|
207
|
-
Number of elastic fabric adapter network devices to attach to container
|
|
208
|
-
ephemeral_storage : int, default None
|
|
209
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
210
|
-
This is only relevant for Fargate compute environments
|
|
211
|
-
log_driver: str, optional, default None
|
|
212
|
-
The log driver to use for the Amazon ECS container.
|
|
213
|
-
log_options: List[str], optional, default None
|
|
214
|
-
List of strings containing options for the chosen log driver. The configurable values
|
|
215
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
216
|
-
Example: [`awslogs-group:aws/batch/job`]
|
|
217
|
-
"""
|
|
218
|
-
...
|
|
219
|
-
|
|
220
|
-
@typing.overload
|
|
221
|
-
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
222
|
-
...
|
|
223
|
-
|
|
224
|
-
@typing.overload
|
|
225
|
-
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
226
|
-
...
|
|
227
|
-
|
|
228
|
-
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):
|
|
229
|
-
"""
|
|
230
|
-
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
Parameters
|
|
234
|
-
----------
|
|
235
|
-
cpu : int, default 1
|
|
236
|
-
Number of CPUs required for this step. If `@resources` is
|
|
237
|
-
also present, the maximum value from all decorators is used.
|
|
238
|
-
gpu : int, default 0
|
|
239
|
-
Number of GPUs required for this step. If `@resources` is
|
|
240
|
-
also present, the maximum value from all decorators is used.
|
|
241
|
-
memory : int, default 4096
|
|
242
|
-
Memory size (in MB) required for this step. If
|
|
243
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
244
|
-
used.
|
|
245
|
-
image : str, optional, default None
|
|
246
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
|
247
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
248
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
249
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
250
|
-
AWS Batch Job Queue to submit the job to.
|
|
251
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
252
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
253
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
254
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
255
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
256
|
-
shared_memory : int, optional, default None
|
|
257
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
258
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
259
|
-
max_swap : int, optional, default None
|
|
260
|
-
The total amount of swap memory (in MiB) a container can use for this
|
|
261
|
-
step. This parameter is translated to the `--memory-swap` option in
|
|
262
|
-
Docker where the value is the sum of the container memory plus the
|
|
263
|
-
`max_swap` value.
|
|
264
|
-
swappiness : int, optional, default None
|
|
265
|
-
This allows you to tune memory swappiness behavior for this step.
|
|
266
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
267
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
268
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
269
|
-
use_tmpfs : bool, default False
|
|
270
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
271
|
-
not available on Fargate compute environments
|
|
272
|
-
tmpfs_tempdir : bool, default True
|
|
273
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
274
|
-
tmpfs_size : int, optional, default None
|
|
275
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
276
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
277
|
-
memory allocated for this step.
|
|
278
|
-
tmpfs_path : str, optional, default None
|
|
279
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
280
|
-
inferentia : int, default 0
|
|
281
|
-
Number of Inferentia chips required for this step.
|
|
282
|
-
trainium : int, default None
|
|
283
|
-
Alias for inferentia. Use only one of the two.
|
|
284
|
-
efa : int, default 0
|
|
285
|
-
Number of elastic fabric adapter network devices to attach to container
|
|
286
|
-
ephemeral_storage : int, default None
|
|
287
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
288
|
-
This is only relevant for Fargate compute environments
|
|
289
|
-
log_driver: str, optional, default None
|
|
290
|
-
The log driver to use for the Amazon ECS container.
|
|
291
|
-
log_options: List[str], optional, default None
|
|
292
|
-
List of strings containing options for the chosen log driver. The configurable values
|
|
293
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
294
|
-
Example: [`awslogs-group:aws/batch/job`]
|
|
295
|
-
"""
|
|
296
|
-
...
|
|
297
|
-
|
|
298
|
-
@typing.overload
|
|
299
|
-
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]]]:
|
|
156
|
+
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]]]:
|
|
300
157
|
"""
|
|
301
|
-
|
|
158
|
+
Specifies the Conda environment for the step.
|
|
302
159
|
|
|
303
|
-
|
|
160
|
+
Information in this decorator will augment any
|
|
161
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
162
|
+
you can use `@conda_base` to set packages required by all
|
|
163
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
304
164
|
|
|
305
165
|
|
|
306
166
|
Parameters
|
|
307
167
|
----------
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
168
|
+
packages : Dict[str, str], default {}
|
|
169
|
+
Packages to use for this step. The key is the name of the package
|
|
170
|
+
and the value is the version to use.
|
|
171
|
+
libraries : Dict[str, str], default {}
|
|
172
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
173
|
+
python : str, optional, default None
|
|
174
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
175
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
176
|
+
disabled : bool, default False
|
|
177
|
+
If set to True, disables @conda.
|
|
316
178
|
"""
|
|
317
179
|
...
|
|
318
180
|
|
|
319
181
|
@typing.overload
|
|
320
|
-
def
|
|
182
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
321
183
|
...
|
|
322
184
|
|
|
323
185
|
@typing.overload
|
|
324
|
-
def
|
|
186
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
325
187
|
...
|
|
326
188
|
|
|
327
|
-
def
|
|
189
|
+
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):
|
|
328
190
|
"""
|
|
329
|
-
|
|
191
|
+
Specifies the Conda environment for the step.
|
|
330
192
|
|
|
331
|
-
|
|
193
|
+
Information in this decorator will augment any
|
|
194
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
195
|
+
you can use `@conda_base` to set packages required by all
|
|
196
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
332
197
|
|
|
333
198
|
|
|
334
199
|
Parameters
|
|
335
200
|
----------
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
201
|
+
packages : Dict[str, str], default {}
|
|
202
|
+
Packages to use for this step. The key is the name of the package
|
|
203
|
+
and the value is the version to use.
|
|
204
|
+
libraries : Dict[str, str], default {}
|
|
205
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
206
|
+
python : str, optional, default None
|
|
207
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
208
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
209
|
+
disabled : bool, default False
|
|
210
|
+
If set to True, disables @conda.
|
|
344
211
|
"""
|
|
345
212
|
...
|
|
346
213
|
|
|
@@ -396,116 +263,203 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
396
263
|
...
|
|
397
264
|
|
|
398
265
|
@typing.overload
|
|
399
|
-
def
|
|
266
|
+
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]]]:
|
|
400
267
|
"""
|
|
401
|
-
Specifies
|
|
402
|
-
to a step needs to be retried.
|
|
268
|
+
Specifies a timeout for your step.
|
|
403
269
|
|
|
404
|
-
This decorator is useful
|
|
405
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
406
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
270
|
+
This decorator is useful if this step may hang indefinitely.
|
|
407
271
|
|
|
408
|
-
This can be used in conjunction with the `@
|
|
409
|
-
|
|
410
|
-
|
|
272
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
273
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
274
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
275
|
+
|
|
276
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
277
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
411
278
|
|
|
412
279
|
|
|
413
280
|
Parameters
|
|
414
281
|
----------
|
|
415
|
-
|
|
416
|
-
Number of
|
|
417
|
-
|
|
418
|
-
Number of minutes
|
|
282
|
+
seconds : int, default 0
|
|
283
|
+
Number of seconds to wait prior to timing out.
|
|
284
|
+
minutes : int, default 0
|
|
285
|
+
Number of minutes to wait prior to timing out.
|
|
286
|
+
hours : int, default 0
|
|
287
|
+
Number of hours to wait prior to timing out.
|
|
419
288
|
"""
|
|
420
289
|
...
|
|
421
290
|
|
|
422
291
|
@typing.overload
|
|
423
|
-
def
|
|
292
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
424
293
|
...
|
|
425
294
|
|
|
426
295
|
@typing.overload
|
|
427
|
-
def
|
|
296
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
428
297
|
...
|
|
429
298
|
|
|
430
|
-
def
|
|
299
|
+
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):
|
|
431
300
|
"""
|
|
432
|
-
Specifies
|
|
433
|
-
to a step needs to be retried.
|
|
301
|
+
Specifies a timeout for your step.
|
|
434
302
|
|
|
435
|
-
This decorator is useful
|
|
436
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
437
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
303
|
+
This decorator is useful if this step may hang indefinitely.
|
|
438
304
|
|
|
439
|
-
This can be used in conjunction with the `@
|
|
440
|
-
|
|
441
|
-
|
|
305
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
306
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
307
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
308
|
+
|
|
309
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
310
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
442
311
|
|
|
443
312
|
|
|
444
313
|
Parameters
|
|
445
314
|
----------
|
|
446
|
-
|
|
447
|
-
Number of
|
|
448
|
-
|
|
449
|
-
Number of minutes
|
|
315
|
+
seconds : int, default 0
|
|
316
|
+
Number of seconds to wait prior to timing out.
|
|
317
|
+
minutes : int, default 0
|
|
318
|
+
Number of minutes to wait prior to timing out.
|
|
319
|
+
hours : int, default 0
|
|
320
|
+
Number of hours to wait prior to timing out.
|
|
450
321
|
"""
|
|
451
322
|
...
|
|
452
323
|
|
|
453
324
|
@typing.overload
|
|
454
|
-
def
|
|
325
|
+
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]]]:
|
|
455
326
|
"""
|
|
456
|
-
Specifies the
|
|
327
|
+
Specifies the PyPI packages for the step.
|
|
457
328
|
|
|
458
329
|
Information in this decorator will augment any
|
|
459
|
-
attributes set in the `@
|
|
460
|
-
you can use `@
|
|
461
|
-
steps and use `@
|
|
330
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
331
|
+
you can use `@pypi_base` to set packages required by all
|
|
332
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
462
333
|
|
|
463
334
|
|
|
464
335
|
Parameters
|
|
465
336
|
----------
|
|
466
|
-
packages : Dict[str, str], default {}
|
|
337
|
+
packages : Dict[str, str], default: {}
|
|
467
338
|
Packages to use for this step. The key is the name of the package
|
|
468
339
|
and the value is the version to use.
|
|
469
|
-
|
|
470
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
471
|
-
python : str, optional, default None
|
|
340
|
+
python : str, optional, default: None
|
|
472
341
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
473
342
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
474
|
-
disabled : bool, default False
|
|
475
|
-
If set to True, disables @conda.
|
|
476
343
|
"""
|
|
477
344
|
...
|
|
478
345
|
|
|
479
346
|
@typing.overload
|
|
480
|
-
def
|
|
347
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
481
348
|
...
|
|
482
349
|
|
|
483
350
|
@typing.overload
|
|
484
|
-
def
|
|
351
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
485
352
|
...
|
|
486
353
|
|
|
487
|
-
def
|
|
354
|
+
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):
|
|
488
355
|
"""
|
|
489
|
-
Specifies the
|
|
356
|
+
Specifies the PyPI packages for the step.
|
|
490
357
|
|
|
491
358
|
Information in this decorator will augment any
|
|
492
|
-
attributes set in the `@
|
|
493
|
-
you can use `@
|
|
494
|
-
steps and use `@
|
|
359
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
360
|
+
you can use `@pypi_base` to set packages required by all
|
|
361
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
495
362
|
|
|
496
363
|
|
|
497
364
|
Parameters
|
|
498
365
|
----------
|
|
499
|
-
packages : Dict[str, str], default {}
|
|
366
|
+
packages : Dict[str, str], default: {}
|
|
500
367
|
Packages to use for this step. The key is the name of the package
|
|
501
368
|
and the value is the version to use.
|
|
502
|
-
|
|
503
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
504
|
-
python : str, optional, default None
|
|
369
|
+
python : str, optional, default: None
|
|
505
370
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
506
371
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
507
|
-
|
|
508
|
-
|
|
372
|
+
"""
|
|
373
|
+
...
|
|
374
|
+
|
|
375
|
+
@typing.overload
|
|
376
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
377
|
+
"""
|
|
378
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
379
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
380
|
+
"""
|
|
381
|
+
...
|
|
382
|
+
|
|
383
|
+
@typing.overload
|
|
384
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
385
|
+
...
|
|
386
|
+
|
|
387
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
388
|
+
"""
|
|
389
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
390
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
391
|
+
"""
|
|
392
|
+
...
|
|
393
|
+
|
|
394
|
+
@typing.overload
|
|
395
|
+
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]]]:
|
|
396
|
+
"""
|
|
397
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
Parameters
|
|
401
|
+
----------
|
|
402
|
+
vars : Dict[str, str], default {}
|
|
403
|
+
Dictionary of environment variables to set.
|
|
404
|
+
"""
|
|
405
|
+
...
|
|
406
|
+
|
|
407
|
+
@typing.overload
|
|
408
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
409
|
+
...
|
|
410
|
+
|
|
411
|
+
@typing.overload
|
|
412
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
413
|
+
...
|
|
414
|
+
|
|
415
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
416
|
+
"""
|
|
417
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
418
|
+
|
|
419
|
+
|
|
420
|
+
Parameters
|
|
421
|
+
----------
|
|
422
|
+
vars : Dict[str, str], default {}
|
|
423
|
+
Dictionary of environment variables to set.
|
|
424
|
+
"""
|
|
425
|
+
...
|
|
426
|
+
|
|
427
|
+
@typing.overload
|
|
428
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: 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]]]:
|
|
429
|
+
"""
|
|
430
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
431
|
+
the execution of a step.
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
Parameters
|
|
435
|
+
----------
|
|
436
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
437
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
438
|
+
role : str, optional, default: None
|
|
439
|
+
Role to use for fetching secrets
|
|
440
|
+
"""
|
|
441
|
+
...
|
|
442
|
+
|
|
443
|
+
@typing.overload
|
|
444
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
445
|
+
...
|
|
446
|
+
|
|
447
|
+
@typing.overload
|
|
448
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
449
|
+
...
|
|
450
|
+
|
|
451
|
+
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]]] = [], role: typing.Optional[str] = None):
|
|
452
|
+
"""
|
|
453
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
454
|
+
the execution of a step.
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
Parameters
|
|
458
|
+
----------
|
|
459
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
460
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
461
|
+
role : str, optional, default: None
|
|
462
|
+
Role to use for fetching secrets
|
|
509
463
|
"""
|
|
510
464
|
...
|
|
511
465
|
|
|
@@ -588,260 +542,395 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
|
588
542
|
"""
|
|
589
543
|
...
|
|
590
544
|
|
|
591
|
-
|
|
545
|
+
@typing.overload
|
|
546
|
+
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]]]:
|
|
592
547
|
"""
|
|
593
|
-
|
|
548
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
549
|
+
|
|
550
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
594
551
|
|
|
595
552
|
|
|
596
553
|
Parameters
|
|
597
554
|
----------
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
Disk size (in MB) required for this step. If
|
|
607
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
608
|
-
used.
|
|
609
|
-
image : str, optional, default None
|
|
610
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
|
611
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
612
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
613
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
614
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
615
|
-
image_pull_secrets: List[str], default []
|
|
616
|
-
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
617
|
-
Kubernetes image pull secrets to use when pulling container images
|
|
618
|
-
in Kubernetes.
|
|
619
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
620
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
|
621
|
-
secrets : List[str], optional, default None
|
|
622
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
623
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
624
|
-
in Metaflow configuration.
|
|
625
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
|
626
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
|
627
|
-
Can be passed in as a comma separated string of values e.g.
|
|
628
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
629
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
630
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
631
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
632
|
-
gpu : int, optional, default None
|
|
633
|
-
Number of GPUs required for this step. A value of zero implies that
|
|
634
|
-
the scheduled node should not have GPUs.
|
|
635
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
636
|
-
The vendor of the GPUs to be used for this step.
|
|
637
|
-
tolerations : List[str], default []
|
|
638
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
639
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
640
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
641
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
|
642
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
643
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
644
|
-
use_tmpfs : bool, default False
|
|
645
|
-
This enables an explicit tmpfs mount for this step.
|
|
646
|
-
tmpfs_tempdir : bool, default True
|
|
647
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
648
|
-
tmpfs_size : int, optional, default: None
|
|
649
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
650
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
651
|
-
memory allocated for this step.
|
|
652
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
|
653
|
-
Path to tmpfs mount for this step.
|
|
654
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
|
655
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
656
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
657
|
-
shared_memory: int, optional
|
|
658
|
-
Shared memory size (in MiB) required for this step
|
|
659
|
-
port: int, optional
|
|
660
|
-
Port number to specify in the Kubernetes job object
|
|
661
|
-
compute_pool : str, optional, default None
|
|
662
|
-
Compute pool to be used for for this step.
|
|
663
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
|
664
|
-
hostname_resolution_timeout: int, default 10 * 60
|
|
665
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
666
|
-
Only applicable when @parallel is used.
|
|
667
|
-
qos: str, default: Burstable
|
|
668
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
669
|
-
|
|
670
|
-
security_context: Dict[str, Any], optional, default None
|
|
671
|
-
Container security context. Applies to the task container. Allows the following keys:
|
|
672
|
-
- privileged: bool, optional, default None
|
|
673
|
-
- allow_privilege_escalation: bool, optional, default None
|
|
674
|
-
- run_as_user: int, optional, default None
|
|
675
|
-
- run_as_group: int, optional, default None
|
|
676
|
-
- run_as_non_root: bool, optional, default None
|
|
555
|
+
type : str, default 'default'
|
|
556
|
+
Card type.
|
|
557
|
+
id : str, optional, default None
|
|
558
|
+
If multiple cards are present, use this id to identify this card.
|
|
559
|
+
options : Dict[str, Any], default {}
|
|
560
|
+
Options passed to the card. The contents depend on the card type.
|
|
561
|
+
timeout : int, default 45
|
|
562
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
677
563
|
"""
|
|
678
564
|
...
|
|
679
565
|
|
|
680
566
|
@typing.overload
|
|
681
|
-
def
|
|
567
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
568
|
+
...
|
|
569
|
+
|
|
570
|
+
@typing.overload
|
|
571
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
572
|
+
...
|
|
573
|
+
|
|
574
|
+
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):
|
|
682
575
|
"""
|
|
683
|
-
|
|
684
|
-
|
|
576
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
577
|
+
|
|
578
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
685
579
|
|
|
686
580
|
|
|
687
581
|
Parameters
|
|
688
582
|
----------
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
583
|
+
type : str, default 'default'
|
|
584
|
+
Card type.
|
|
585
|
+
id : str, optional, default None
|
|
586
|
+
If multiple cards are present, use this id to identify this card.
|
|
587
|
+
options : Dict[str, Any], default {}
|
|
588
|
+
Options passed to the card. The contents depend on the card type.
|
|
589
|
+
timeout : int, default 45
|
|
590
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
693
591
|
"""
|
|
694
592
|
...
|
|
695
593
|
|
|
696
594
|
@typing.overload
|
|
697
|
-
def
|
|
698
|
-
...
|
|
699
|
-
|
|
700
|
-
@typing.overload
|
|
701
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
702
|
-
...
|
|
703
|
-
|
|
704
|
-
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]]] = [], role: typing.Optional[str] = None):
|
|
595
|
+
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]]]:
|
|
705
596
|
"""
|
|
706
|
-
Specifies
|
|
707
|
-
|
|
597
|
+
Specifies the number of times the task corresponding
|
|
598
|
+
to a step needs to be retried.
|
|
708
599
|
|
|
600
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
601
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
602
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
709
603
|
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
714
|
-
role : str, optional, default: None
|
|
715
|
-
Role to use for fetching secrets
|
|
716
|
-
"""
|
|
717
|
-
...
|
|
718
|
-
|
|
719
|
-
@typing.overload
|
|
720
|
-
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]]]:
|
|
721
|
-
"""
|
|
722
|
-
Specifies environment variables to be set prior to the execution of a step.
|
|
604
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
605
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
606
|
+
ensuring that the flow execution can continue.
|
|
723
607
|
|
|
724
608
|
|
|
725
609
|
Parameters
|
|
726
610
|
----------
|
|
727
|
-
|
|
728
|
-
|
|
611
|
+
times : int, default 3
|
|
612
|
+
Number of times to retry this task.
|
|
613
|
+
minutes_between_retries : int, default 2
|
|
614
|
+
Number of minutes between retries.
|
|
729
615
|
"""
|
|
730
616
|
...
|
|
731
617
|
|
|
732
618
|
@typing.overload
|
|
733
|
-
def
|
|
619
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
734
620
|
...
|
|
735
621
|
|
|
736
622
|
@typing.overload
|
|
737
|
-
def
|
|
623
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
738
624
|
...
|
|
739
625
|
|
|
740
|
-
def
|
|
626
|
+
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):
|
|
741
627
|
"""
|
|
742
|
-
Specifies
|
|
628
|
+
Specifies the number of times the task corresponding
|
|
629
|
+
to a step needs to be retried.
|
|
630
|
+
|
|
631
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
632
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
633
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
634
|
+
|
|
635
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
636
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
637
|
+
ensuring that the flow execution can continue.
|
|
743
638
|
|
|
744
639
|
|
|
745
640
|
Parameters
|
|
746
641
|
----------
|
|
747
|
-
|
|
748
|
-
|
|
642
|
+
times : int, default 3
|
|
643
|
+
Number of times to retry this task.
|
|
644
|
+
minutes_between_retries : int, default 2
|
|
645
|
+
Number of minutes between retries.
|
|
749
646
|
"""
|
|
750
647
|
...
|
|
751
648
|
|
|
752
649
|
@typing.overload
|
|
753
|
-
def
|
|
650
|
+
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]]]:
|
|
754
651
|
"""
|
|
755
|
-
|
|
756
|
-
|
|
652
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
Parameters
|
|
656
|
+
----------
|
|
657
|
+
cpu : int, default 1
|
|
658
|
+
Number of CPUs required for this step. If `@resources` is
|
|
659
|
+
also present, the maximum value from all decorators is used.
|
|
660
|
+
gpu : int, default 0
|
|
661
|
+
Number of GPUs required for this step. If `@resources` is
|
|
662
|
+
also present, the maximum value from all decorators is used.
|
|
663
|
+
memory : int, default 4096
|
|
664
|
+
Memory size (in MB) required for this step. If
|
|
665
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
666
|
+
used.
|
|
667
|
+
image : str, optional, default None
|
|
668
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
669
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
670
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
671
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
672
|
+
AWS Batch Job Queue to submit the job to.
|
|
673
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
674
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
675
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
676
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
677
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
678
|
+
shared_memory : int, optional, default None
|
|
679
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
680
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
681
|
+
max_swap : int, optional, default None
|
|
682
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
683
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
684
|
+
Docker where the value is the sum of the container memory plus the
|
|
685
|
+
`max_swap` value.
|
|
686
|
+
swappiness : int, optional, default None
|
|
687
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
688
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
689
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
690
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
691
|
+
use_tmpfs : bool, default False
|
|
692
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
693
|
+
not available on Fargate compute environments
|
|
694
|
+
tmpfs_tempdir : bool, default True
|
|
695
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
696
|
+
tmpfs_size : int, optional, default None
|
|
697
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
698
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
699
|
+
memory allocated for this step.
|
|
700
|
+
tmpfs_path : str, optional, default None
|
|
701
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
702
|
+
inferentia : int, default 0
|
|
703
|
+
Number of Inferentia chips required for this step.
|
|
704
|
+
trainium : int, default None
|
|
705
|
+
Alias for inferentia. Use only one of the two.
|
|
706
|
+
efa : int, default 0
|
|
707
|
+
Number of elastic fabric adapter network devices to attach to container
|
|
708
|
+
ephemeral_storage : int, default None
|
|
709
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
710
|
+
This is only relevant for Fargate compute environments
|
|
711
|
+
log_driver: str, optional, default None
|
|
712
|
+
The log driver to use for the Amazon ECS container.
|
|
713
|
+
log_options: List[str], optional, default None
|
|
714
|
+
List of strings containing options for the chosen log driver. The configurable values
|
|
715
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
716
|
+
Example: [`awslogs-group:aws/batch/job`]
|
|
757
717
|
"""
|
|
758
718
|
...
|
|
759
719
|
|
|
760
720
|
@typing.overload
|
|
761
|
-
def
|
|
721
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
762
722
|
...
|
|
763
723
|
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
767
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
768
|
-
"""
|
|
724
|
+
@typing.overload
|
|
725
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
769
726
|
...
|
|
770
727
|
|
|
771
|
-
|
|
772
|
-
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]]]:
|
|
728
|
+
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):
|
|
773
729
|
"""
|
|
774
|
-
Specifies
|
|
775
|
-
|
|
776
|
-
This decorator is useful if this step may hang indefinitely.
|
|
777
|
-
|
|
778
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
779
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
780
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
781
|
-
|
|
782
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
783
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
730
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
784
731
|
|
|
785
732
|
|
|
786
733
|
Parameters
|
|
787
734
|
----------
|
|
788
|
-
|
|
789
|
-
Number of
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
735
|
+
cpu : int, default 1
|
|
736
|
+
Number of CPUs required for this step. If `@resources` is
|
|
737
|
+
also present, the maximum value from all decorators is used.
|
|
738
|
+
gpu : int, default 0
|
|
739
|
+
Number of GPUs required for this step. If `@resources` is
|
|
740
|
+
also present, the maximum value from all decorators is used.
|
|
741
|
+
memory : int, default 4096
|
|
742
|
+
Memory size (in MB) required for this step. If
|
|
743
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
744
|
+
used.
|
|
745
|
+
image : str, optional, default None
|
|
746
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
747
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
748
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
749
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
750
|
+
AWS Batch Job Queue to submit the job to.
|
|
751
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
752
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
753
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
754
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
755
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
756
|
+
shared_memory : int, optional, default None
|
|
757
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
758
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
759
|
+
max_swap : int, optional, default None
|
|
760
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
761
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
762
|
+
Docker where the value is the sum of the container memory plus the
|
|
763
|
+
`max_swap` value.
|
|
764
|
+
swappiness : int, optional, default None
|
|
765
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
766
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
767
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
768
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
769
|
+
use_tmpfs : bool, default False
|
|
770
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
771
|
+
not available on Fargate compute environments
|
|
772
|
+
tmpfs_tempdir : bool, default True
|
|
773
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
774
|
+
tmpfs_size : int, optional, default None
|
|
775
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
776
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
777
|
+
memory allocated for this step.
|
|
778
|
+
tmpfs_path : str, optional, default None
|
|
779
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
780
|
+
inferentia : int, default 0
|
|
781
|
+
Number of Inferentia chips required for this step.
|
|
782
|
+
trainium : int, default None
|
|
783
|
+
Alias for inferentia. Use only one of the two.
|
|
784
|
+
efa : int, default 0
|
|
785
|
+
Number of elastic fabric adapter network devices to attach to container
|
|
786
|
+
ephemeral_storage : int, default None
|
|
787
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
788
|
+
This is only relevant for Fargate compute environments
|
|
789
|
+
log_driver: str, optional, default None
|
|
790
|
+
The log driver to use for the Amazon ECS container.
|
|
791
|
+
log_options: List[str], optional, default None
|
|
792
|
+
List of strings containing options for the chosen log driver. The configurable values
|
|
793
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
794
|
+
Example: [`awslogs-group:aws/batch/job`]
|
|
794
795
|
"""
|
|
795
796
|
...
|
|
796
797
|
|
|
797
|
-
|
|
798
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
799
|
-
...
|
|
800
|
-
|
|
801
|
-
@typing.overload
|
|
802
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
803
|
-
...
|
|
804
|
-
|
|
805
|
-
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):
|
|
798
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
806
799
|
"""
|
|
807
|
-
Specifies
|
|
800
|
+
Specifies that this step should execute on Kubernetes.
|
|
808
801
|
|
|
809
|
-
This decorator is useful if this step may hang indefinitely.
|
|
810
802
|
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
803
|
+
Parameters
|
|
804
|
+
----------
|
|
805
|
+
cpu : int, default 1
|
|
806
|
+
Number of CPUs required for this step. If `@resources` is
|
|
807
|
+
also present, the maximum value from all decorators is used.
|
|
808
|
+
memory : int, default 4096
|
|
809
|
+
Memory size (in MB) required for this step. If
|
|
810
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
811
|
+
used.
|
|
812
|
+
disk : int, default 10240
|
|
813
|
+
Disk size (in MB) required for this step. If
|
|
814
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
815
|
+
used.
|
|
816
|
+
image : str, optional, default None
|
|
817
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
|
818
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
819
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
820
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
821
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
822
|
+
image_pull_secrets: List[str], default []
|
|
823
|
+
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
824
|
+
Kubernetes image pull secrets to use when pulling container images
|
|
825
|
+
in Kubernetes.
|
|
826
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
827
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
|
828
|
+
secrets : List[str], optional, default None
|
|
829
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
830
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
831
|
+
in Metaflow configuration.
|
|
832
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
|
833
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
|
834
|
+
Can be passed in as a comma separated string of values e.g.
|
|
835
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
836
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
837
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
838
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
839
|
+
gpu : int, optional, default None
|
|
840
|
+
Number of GPUs required for this step. A value of zero implies that
|
|
841
|
+
the scheduled node should not have GPUs.
|
|
842
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
843
|
+
The vendor of the GPUs to be used for this step.
|
|
844
|
+
tolerations : List[str], default []
|
|
845
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
846
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
847
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
848
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
|
849
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
850
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
851
|
+
use_tmpfs : bool, default False
|
|
852
|
+
This enables an explicit tmpfs mount for this step.
|
|
853
|
+
tmpfs_tempdir : bool, default True
|
|
854
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
855
|
+
tmpfs_size : int, optional, default: None
|
|
856
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
857
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
858
|
+
memory allocated for this step.
|
|
859
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
|
860
|
+
Path to tmpfs mount for this step.
|
|
861
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
|
862
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
863
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
864
|
+
shared_memory: int, optional
|
|
865
|
+
Shared memory size (in MiB) required for this step
|
|
866
|
+
port: int, optional
|
|
867
|
+
Port number to specify in the Kubernetes job object
|
|
868
|
+
compute_pool : str, optional, default None
|
|
869
|
+
Compute pool to be used for for this step.
|
|
870
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
|
871
|
+
hostname_resolution_timeout: int, default 10 * 60
|
|
872
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
873
|
+
Only applicable when @parallel is used.
|
|
874
|
+
qos: str, default: Burstable
|
|
875
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
814
876
|
|
|
815
|
-
|
|
816
|
-
|
|
877
|
+
security_context: Dict[str, Any], optional, default None
|
|
878
|
+
Container security context. Applies to the task container. Allows the following keys:
|
|
879
|
+
- privileged: bool, optional, default None
|
|
880
|
+
- allow_privilege_escalation: bool, optional, default None
|
|
881
|
+
- run_as_user: int, optional, default None
|
|
882
|
+
- run_as_group: int, optional, default None
|
|
883
|
+
- run_as_non_root: bool, optional, default None
|
|
884
|
+
"""
|
|
885
|
+
...
|
|
886
|
+
|
|
887
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
888
|
+
"""
|
|
889
|
+
Specifies what flows belong to the same project.
|
|
890
|
+
|
|
891
|
+
A project-specific namespace is created for all flows that
|
|
892
|
+
use the same `@project(name)`.
|
|
817
893
|
|
|
818
894
|
|
|
819
895
|
Parameters
|
|
820
896
|
----------
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
897
|
+
name : str
|
|
898
|
+
Project name. Make sure that the name is unique amongst all
|
|
899
|
+
projects that use the same production scheduler. The name may
|
|
900
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
901
|
+
|
|
902
|
+
branch : Optional[str], default None
|
|
903
|
+
The branch to use. If not specified, the branch is set to
|
|
904
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
905
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
906
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
907
|
+
|
|
908
|
+
production : bool, default False
|
|
909
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
910
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
911
|
+
`production` in the decorator and on the command line.
|
|
912
|
+
The project branch name will be:
|
|
913
|
+
- if `branch` is specified:
|
|
914
|
+
- if `production` is True: `prod.<branch>`
|
|
915
|
+
- if `production` is False: `test.<branch>`
|
|
916
|
+
- if `branch` is not specified:
|
|
917
|
+
- if `production` is True: `prod`
|
|
918
|
+
- if `production` is False: `user.<username>`
|
|
827
919
|
"""
|
|
828
920
|
...
|
|
829
921
|
|
|
830
922
|
@typing.overload
|
|
831
|
-
def
|
|
923
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
832
924
|
"""
|
|
833
|
-
Specifies the PyPI packages for the
|
|
925
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
834
926
|
|
|
835
|
-
|
|
836
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
837
|
-
you can use `@pypi_base` to set packages required by all
|
|
927
|
+
Use `@pypi_base` to set common packages required by all
|
|
838
928
|
steps and use `@pypi` to specify step-specific overrides.
|
|
839
929
|
|
|
840
|
-
|
|
841
930
|
Parameters
|
|
842
931
|
----------
|
|
843
932
|
packages : Dict[str, str], default: {}
|
|
844
|
-
Packages to use for this
|
|
933
|
+
Packages to use for this flow. The key is the name of the package
|
|
845
934
|
and the value is the version to use.
|
|
846
935
|
python : str, optional, default: None
|
|
847
936
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
@@ -850,27 +939,20 @@ def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] =
|
|
|
850
939
|
...
|
|
851
940
|
|
|
852
941
|
@typing.overload
|
|
853
|
-
def
|
|
854
|
-
...
|
|
855
|
-
|
|
856
|
-
@typing.overload
|
|
857
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
942
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
858
943
|
...
|
|
859
944
|
|
|
860
|
-
def
|
|
945
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
861
946
|
"""
|
|
862
|
-
Specifies the PyPI packages for the
|
|
947
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
863
948
|
|
|
864
|
-
|
|
865
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
866
|
-
you can use `@pypi_base` to set packages required by all
|
|
949
|
+
Use `@pypi_base` to set common packages required by all
|
|
867
950
|
steps and use `@pypi` to specify step-specific overrides.
|
|
868
951
|
|
|
869
|
-
|
|
870
952
|
Parameters
|
|
871
953
|
----------
|
|
872
954
|
packages : Dict[str, str], default: {}
|
|
873
|
-
Packages to use for this
|
|
955
|
+
Packages to use for this flow. The key is the name of the package
|
|
874
956
|
and the value is the version to use.
|
|
875
957
|
python : str, optional, default: None
|
|
876
958
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
@@ -878,96 +960,46 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
|
878
960
|
"""
|
|
879
961
|
...
|
|
880
962
|
|
|
881
|
-
|
|
882
|
-
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]]:
|
|
883
|
-
"""
|
|
884
|
-
Specifies the event(s) that this flow depends on.
|
|
885
|
-
|
|
886
|
-
```
|
|
887
|
-
@trigger(event='foo')
|
|
888
|
-
```
|
|
889
|
-
or
|
|
890
|
-
```
|
|
891
|
-
@trigger(events=['foo', 'bar'])
|
|
892
|
-
```
|
|
893
|
-
|
|
894
|
-
Additionally, you can specify the parameter mappings
|
|
895
|
-
to map event payload to Metaflow parameters for the flow.
|
|
896
|
-
```
|
|
897
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
898
|
-
```
|
|
899
|
-
or
|
|
900
|
-
```
|
|
901
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
902
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
903
|
-
```
|
|
904
|
-
|
|
905
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
906
|
-
```
|
|
907
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
908
|
-
```
|
|
909
|
-
This is equivalent to:
|
|
910
|
-
```
|
|
911
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
912
|
-
```
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
Parameters
|
|
916
|
-
----------
|
|
917
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
|
918
|
-
Event dependency for this flow.
|
|
919
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
|
920
|
-
Events dependency for this flow.
|
|
921
|
-
options : Dict[str, Any], default {}
|
|
922
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
923
|
-
"""
|
|
924
|
-
...
|
|
925
|
-
|
|
926
|
-
@typing.overload
|
|
927
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
928
|
-
...
|
|
929
|
-
|
|
930
|
-
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] = {}):
|
|
963
|
+
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]]:
|
|
931
964
|
"""
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
```
|
|
935
|
-
@trigger(event='foo')
|
|
936
|
-
```
|
|
937
|
-
or
|
|
938
|
-
```
|
|
939
|
-
@trigger(events=['foo', 'bar'])
|
|
940
|
-
```
|
|
941
|
-
|
|
942
|
-
Additionally, you can specify the parameter mappings
|
|
943
|
-
to map event payload to Metaflow parameters for the flow.
|
|
944
|
-
```
|
|
945
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
946
|
-
```
|
|
947
|
-
or
|
|
948
|
-
```
|
|
949
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
950
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
951
|
-
```
|
|
952
|
-
|
|
953
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
954
|
-
```
|
|
955
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
956
|
-
```
|
|
957
|
-
This is equivalent to:
|
|
958
|
-
```
|
|
959
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
960
|
-
```
|
|
965
|
+
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.
|
|
966
|
+
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.
|
|
961
967
|
|
|
962
968
|
|
|
963
969
|
Parameters
|
|
964
970
|
----------
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
+
timeout : int
|
|
972
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
973
|
+
poke_interval : int
|
|
974
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
975
|
+
mode : str
|
|
976
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
977
|
+
exponential_backoff : bool
|
|
978
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
979
|
+
pool : str
|
|
980
|
+
the slot pool this task should run in,
|
|
981
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
982
|
+
soft_fail : bool
|
|
983
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
984
|
+
name : str
|
|
985
|
+
Name of the sensor on Airflow
|
|
986
|
+
description : str
|
|
987
|
+
Description of sensor in the Airflow UI
|
|
988
|
+
external_dag_id : str
|
|
989
|
+
The dag_id that contains the task you want to wait for.
|
|
990
|
+
external_task_ids : List[str]
|
|
991
|
+
The list of task_ids that you want to wait for.
|
|
992
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
993
|
+
allowed_states : List[str]
|
|
994
|
+
Iterable of allowed states, (Default: ['success'])
|
|
995
|
+
failed_states : List[str]
|
|
996
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
997
|
+
execution_delta : datetime.timedelta
|
|
998
|
+
time difference with the previous execution to look at,
|
|
999
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1000
|
+
check_existence: bool
|
|
1001
|
+
Set to True to check if the external task exists or check if
|
|
1002
|
+
the DAG to wait for exists. (Default: True)
|
|
971
1003
|
"""
|
|
972
1004
|
...
|
|
973
1005
|
|
|
@@ -1072,90 +1104,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
|
1072
1104
|
"""
|
|
1073
1105
|
...
|
|
1074
1106
|
|
|
1075
|
-
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]]:
|
|
1076
|
-
"""
|
|
1077
|
-
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)
|
|
1078
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1079
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1080
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1081
|
-
starts only after all sensors finish.
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
Parameters
|
|
1085
|
-
----------
|
|
1086
|
-
timeout : int
|
|
1087
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1088
|
-
poke_interval : int
|
|
1089
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1090
|
-
mode : str
|
|
1091
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1092
|
-
exponential_backoff : bool
|
|
1093
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1094
|
-
pool : str
|
|
1095
|
-
the slot pool this task should run in,
|
|
1096
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1097
|
-
soft_fail : bool
|
|
1098
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1099
|
-
name : str
|
|
1100
|
-
Name of the sensor on Airflow
|
|
1101
|
-
description : str
|
|
1102
|
-
Description of sensor in the Airflow UI
|
|
1103
|
-
bucket_key : Union[str, List[str]]
|
|
1104
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1105
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1106
|
-
bucket_name : str
|
|
1107
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1108
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1109
|
-
wildcard_match : bool
|
|
1110
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1111
|
-
aws_conn_id : str
|
|
1112
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1113
|
-
verify : bool
|
|
1114
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1115
|
-
"""
|
|
1116
|
-
...
|
|
1117
|
-
|
|
1118
|
-
@typing.overload
|
|
1119
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1120
|
-
"""
|
|
1121
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
1122
|
-
|
|
1123
|
-
Use `@pypi_base` to set common packages required by all
|
|
1124
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1125
|
-
|
|
1126
|
-
Parameters
|
|
1127
|
-
----------
|
|
1128
|
-
packages : Dict[str, str], default: {}
|
|
1129
|
-
Packages to use for this flow. The key is the name of the package
|
|
1130
|
-
and the value is the version to use.
|
|
1131
|
-
python : str, optional, default: None
|
|
1132
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1133
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1134
|
-
"""
|
|
1135
|
-
...
|
|
1136
|
-
|
|
1137
|
-
@typing.overload
|
|
1138
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1139
|
-
...
|
|
1140
|
-
|
|
1141
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1142
|
-
"""
|
|
1143
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
1144
|
-
|
|
1145
|
-
Use `@pypi_base` to set common packages required by all
|
|
1146
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1147
|
-
|
|
1148
|
-
Parameters
|
|
1149
|
-
----------
|
|
1150
|
-
packages : Dict[str, str], default: {}
|
|
1151
|
-
Packages to use for this flow. The key is the name of the package
|
|
1152
|
-
and the value is the version to use.
|
|
1153
|
-
python : str, optional, default: None
|
|
1154
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1155
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1156
|
-
"""
|
|
1157
|
-
...
|
|
1158
|
-
|
|
1159
1107
|
@typing.overload
|
|
1160
1108
|
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]]:
|
|
1161
1109
|
"""
|
|
@@ -1207,6 +1155,99 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
|
1207
1155
|
"""
|
|
1208
1156
|
...
|
|
1209
1157
|
|
|
1158
|
+
@typing.overload
|
|
1159
|
+
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]]:
|
|
1160
|
+
"""
|
|
1161
|
+
Specifies the event(s) that this flow depends on.
|
|
1162
|
+
|
|
1163
|
+
```
|
|
1164
|
+
@trigger(event='foo')
|
|
1165
|
+
```
|
|
1166
|
+
or
|
|
1167
|
+
```
|
|
1168
|
+
@trigger(events=['foo', 'bar'])
|
|
1169
|
+
```
|
|
1170
|
+
|
|
1171
|
+
Additionally, you can specify the parameter mappings
|
|
1172
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1173
|
+
```
|
|
1174
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1175
|
+
```
|
|
1176
|
+
or
|
|
1177
|
+
```
|
|
1178
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1179
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1180
|
+
```
|
|
1181
|
+
|
|
1182
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1183
|
+
```
|
|
1184
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1185
|
+
```
|
|
1186
|
+
This is equivalent to:
|
|
1187
|
+
```
|
|
1188
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1189
|
+
```
|
|
1190
|
+
|
|
1191
|
+
|
|
1192
|
+
Parameters
|
|
1193
|
+
----------
|
|
1194
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1195
|
+
Event dependency for this flow.
|
|
1196
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1197
|
+
Events dependency for this flow.
|
|
1198
|
+
options : Dict[str, Any], default {}
|
|
1199
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1200
|
+
"""
|
|
1201
|
+
...
|
|
1202
|
+
|
|
1203
|
+
@typing.overload
|
|
1204
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1205
|
+
...
|
|
1206
|
+
|
|
1207
|
+
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] = {}):
|
|
1208
|
+
"""
|
|
1209
|
+
Specifies the event(s) that this flow depends on.
|
|
1210
|
+
|
|
1211
|
+
```
|
|
1212
|
+
@trigger(event='foo')
|
|
1213
|
+
```
|
|
1214
|
+
or
|
|
1215
|
+
```
|
|
1216
|
+
@trigger(events=['foo', 'bar'])
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
Additionally, you can specify the parameter mappings
|
|
1220
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1221
|
+
```
|
|
1222
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1223
|
+
```
|
|
1224
|
+
or
|
|
1225
|
+
```
|
|
1226
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1227
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1228
|
+
```
|
|
1229
|
+
|
|
1230
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1231
|
+
```
|
|
1232
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1233
|
+
```
|
|
1234
|
+
This is equivalent to:
|
|
1235
|
+
```
|
|
1236
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1237
|
+
```
|
|
1238
|
+
|
|
1239
|
+
|
|
1240
|
+
Parameters
|
|
1241
|
+
----------
|
|
1242
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1243
|
+
Event dependency for this flow.
|
|
1244
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1245
|
+
Events dependency for this flow.
|
|
1246
|
+
options : Dict[str, Any], default {}
|
|
1247
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1248
|
+
"""
|
|
1249
|
+
...
|
|
1250
|
+
|
|
1210
1251
|
@typing.overload
|
|
1211
1252
|
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]]:
|
|
1212
1253
|
"""
|
|
@@ -1258,45 +1299,13 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
|
1258
1299
|
"""
|
|
1259
1300
|
...
|
|
1260
1301
|
|
|
1261
|
-
def
|
|
1262
|
-
"""
|
|
1263
|
-
Specifies what flows belong to the same project.
|
|
1264
|
-
|
|
1265
|
-
A project-specific namespace is created for all flows that
|
|
1266
|
-
use the same `@project(name)`.
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
Parameters
|
|
1270
|
-
----------
|
|
1271
|
-
name : str
|
|
1272
|
-
Project name. Make sure that the name is unique amongst all
|
|
1273
|
-
projects that use the same production scheduler. The name may
|
|
1274
|
-
contain only lowercase alphanumeric characters and underscores.
|
|
1275
|
-
|
|
1276
|
-
branch : Optional[str], default None
|
|
1277
|
-
The branch to use. If not specified, the branch is set to
|
|
1278
|
-
`user.<username>` unless `production` is set to `True`. This can
|
|
1279
|
-
also be set on the command line using `--branch` as a top-level option.
|
|
1280
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
|
1281
|
-
|
|
1282
|
-
production : bool, default False
|
|
1283
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
1284
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
1285
|
-
`production` in the decorator and on the command line.
|
|
1286
|
-
The project branch name will be:
|
|
1287
|
-
- if `branch` is specified:
|
|
1288
|
-
- if `production` is True: `prod.<branch>`
|
|
1289
|
-
- if `production` is False: `test.<branch>`
|
|
1290
|
-
- if `branch` is not specified:
|
|
1291
|
-
- if `production` is True: `prod`
|
|
1292
|
-
- if `production` is False: `user.<username>`
|
|
1293
|
-
"""
|
|
1294
|
-
...
|
|
1295
|
-
|
|
1296
|
-
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]]:
|
|
1302
|
+
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]]:
|
|
1297
1303
|
"""
|
|
1298
|
-
The `@
|
|
1299
|
-
This decorator only works when a flow is scheduled on Airflow
|
|
1304
|
+
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)
|
|
1305
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1306
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1307
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1308
|
+
starts only after all sensors finish.
|
|
1300
1309
|
|
|
1301
1310
|
|
|
1302
1311
|
Parameters
|
|
@@ -1318,21 +1327,18 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
|
1318
1327
|
Name of the sensor on Airflow
|
|
1319
1328
|
description : str
|
|
1320
1329
|
Description of sensor in the Airflow UI
|
|
1321
|
-
|
|
1322
|
-
The
|
|
1323
|
-
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
|
|
1328
|
-
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
check_existence: bool
|
|
1334
|
-
Set to True to check if the external task exists or check if
|
|
1335
|
-
the DAG to wait for exists. (Default: True)
|
|
1330
|
+
bucket_key : Union[str, List[str]]
|
|
1331
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1332
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1333
|
+
bucket_name : str
|
|
1334
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1335
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1336
|
+
wildcard_match : bool
|
|
1337
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1338
|
+
aws_conn_id : str
|
|
1339
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1340
|
+
verify : bool
|
|
1341
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1336
1342
|
"""
|
|
1337
1343
|
...
|
|
1338
1344
|
|