metaflow-stubs 2.18.9__py2.py3-none-any.whl → 2.18.11__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 +664 -664
- metaflow-stubs/cards.pyi +5 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +5 -5
- metaflow-stubs/meta_files.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +23 -23
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +8 -8
- metaflow-stubs/packaging_sys/backend.pyi +4 -4
- metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
- metaflow-stubs/packaging_sys/tar_backend.pyi +6 -6
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +3 -3
- metaflow-stubs/parameters.pyi +5 -5
- metaflow-stubs/plugins/__init__.pyi +14 -14
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +3 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +6 -4
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +168 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/json_viewer.pyi +119 -0
- 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 +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/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 +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/parsers.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +35 -35
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/runner/utils.pyi +4 -4
- 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 -2
- metaflow-stubs/user_configs/config_options.pyi +4 -4
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- metaflow-stubs/user_decorators/__init__.pyi +2 -2
- metaflow-stubs/user_decorators/common.pyi +2 -2
- metaflow-stubs/user_decorators/mutable_flow.pyi +4 -4
- metaflow-stubs/user_decorators/mutable_step.pyi +5 -5
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +4 -4
- metaflow-stubs/user_decorators/user_step_decorator.pyi +6 -6
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.18.9.dist-info → metaflow_stubs-2.18.11.dist-info}/METADATA +2 -2
- metaflow_stubs-2.18.11.dist-info/RECORD +168 -0
- metaflow_stubs-2.18.9.dist-info/RECORD +0 -167
- {metaflow_stubs-2.18.9.dist-info → metaflow_stubs-2.18.11.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.18.9.dist-info → metaflow_stubs-2.18.11.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
######################################################################################################
|
|
2
2
|
# Auto-generated Metaflow stub file #
|
|
3
|
-
# MF version: 2.18.
|
|
4
|
-
# Generated on 2025-
|
|
3
|
+
# MF version: 2.18.11 #
|
|
4
|
+
# Generated on 2025-10-07T00:51:30.224324 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import typing
|
|
10
10
|
if typing.TYPE_CHECKING:
|
|
11
|
-
import datetime
|
|
12
11
|
import typing
|
|
12
|
+
import datetime
|
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
|
15
15
|
|
|
@@ -39,18 +39,18 @@ from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDe
|
|
|
39
39
|
from .user_decorators.user_step_decorator import StepMutator as StepMutator
|
|
40
40
|
from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
|
|
41
41
|
from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
|
|
42
|
-
from . import tuple_util as tuple_util
|
|
43
42
|
from . import events as events
|
|
43
|
+
from . import tuple_util as tuple_util
|
|
44
44
|
from . import metaflow_git as metaflow_git
|
|
45
45
|
from . import runner as runner
|
|
46
46
|
from . import plugins as plugins
|
|
47
47
|
from .plugins.datatools.s3.s3 import S3 as S3
|
|
48
48
|
from . import includefile as includefile
|
|
49
49
|
from .includefile import IncludeFile as IncludeFile
|
|
50
|
-
from .plugins.parsers import yaml_parser as yaml_parser
|
|
51
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
52
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
53
50
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
51
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
52
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
53
|
+
from .plugins.parsers import yaml_parser as yaml_parser
|
|
54
54
|
from . import cards as cards
|
|
55
55
|
from . import client as client
|
|
56
56
|
from .client.core import namespace as namespace
|
|
@@ -154,335 +154,200 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
154
154
|
...
|
|
155
155
|
|
|
156
156
|
@typing.overload
|
|
157
|
-
def
|
|
157
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
158
158
|
"""
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
Parameters
|
|
163
|
-
----------
|
|
164
|
-
cpu : int, default 1
|
|
165
|
-
Number of CPUs required for this step. If `@resources` is
|
|
166
|
-
also present, the maximum value from all decorators is used.
|
|
167
|
-
gpu : int, default 0
|
|
168
|
-
Number of GPUs required for this step. If `@resources` is
|
|
169
|
-
also present, the maximum value from all decorators is used.
|
|
170
|
-
memory : int, default 4096
|
|
171
|
-
Memory size (in MB) required for this step. If
|
|
172
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
173
|
-
used.
|
|
174
|
-
image : str, optional, default None
|
|
175
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
|
176
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
177
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
178
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
179
|
-
AWS Batch Job Queue to submit the job to.
|
|
180
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
181
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
182
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
183
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
184
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
185
|
-
shared_memory : int, optional, default None
|
|
186
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
187
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
188
|
-
max_swap : int, optional, default None
|
|
189
|
-
The total amount of swap memory (in MiB) a container can use for this
|
|
190
|
-
step. This parameter is translated to the `--memory-swap` option in
|
|
191
|
-
Docker where the value is the sum of the container memory plus the
|
|
192
|
-
`max_swap` value.
|
|
193
|
-
swappiness : int, optional, default None
|
|
194
|
-
This allows you to tune memory swappiness behavior for this step.
|
|
195
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
196
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
197
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
198
|
-
aws_batch_tags: Dict[str, str], optional, default None
|
|
199
|
-
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
200
|
-
Set as string key-value pairs.
|
|
201
|
-
use_tmpfs : bool, default False
|
|
202
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
203
|
-
not available on Fargate compute environments
|
|
204
|
-
tmpfs_tempdir : bool, default True
|
|
205
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
206
|
-
tmpfs_size : int, optional, default None
|
|
207
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
208
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
209
|
-
memory allocated for this step.
|
|
210
|
-
tmpfs_path : str, optional, default None
|
|
211
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
212
|
-
inferentia : int, default 0
|
|
213
|
-
Number of Inferentia chips required for this step.
|
|
214
|
-
trainium : int, default None
|
|
215
|
-
Alias for inferentia. Use only one of the two.
|
|
216
|
-
efa : int, default 0
|
|
217
|
-
Number of elastic fabric adapter network devices to attach to container
|
|
218
|
-
ephemeral_storage : int, default None
|
|
219
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
220
|
-
This is only relevant for Fargate compute environments
|
|
221
|
-
log_driver: str, optional, default None
|
|
222
|
-
The log driver to use for the Amazon ECS container.
|
|
223
|
-
log_options: List[str], optional, default None
|
|
224
|
-
List of strings containing options for the chosen log driver. The configurable values
|
|
225
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
226
|
-
Example: [`awslogs-group:aws/batch/job`]
|
|
159
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
160
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
227
161
|
"""
|
|
228
162
|
...
|
|
229
163
|
|
|
230
164
|
@typing.overload
|
|
231
|
-
def
|
|
232
|
-
...
|
|
233
|
-
|
|
234
|
-
@typing.overload
|
|
235
|
-
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
165
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
236
166
|
...
|
|
237
167
|
|
|
238
|
-
def
|
|
168
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
239
169
|
"""
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
Parameters
|
|
244
|
-
----------
|
|
245
|
-
cpu : int, default 1
|
|
246
|
-
Number of CPUs required for this step. If `@resources` is
|
|
247
|
-
also present, the maximum value from all decorators is used.
|
|
248
|
-
gpu : int, default 0
|
|
249
|
-
Number of GPUs required for this step. If `@resources` is
|
|
250
|
-
also present, the maximum value from all decorators is used.
|
|
251
|
-
memory : int, default 4096
|
|
252
|
-
Memory size (in MB) required for this step. If
|
|
253
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
254
|
-
used.
|
|
255
|
-
image : str, optional, default None
|
|
256
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
|
257
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
258
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
259
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
260
|
-
AWS Batch Job Queue to submit the job to.
|
|
261
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
262
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
263
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
264
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
265
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
266
|
-
shared_memory : int, optional, default None
|
|
267
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
268
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
269
|
-
max_swap : int, optional, default None
|
|
270
|
-
The total amount of swap memory (in MiB) a container can use for this
|
|
271
|
-
step. This parameter is translated to the `--memory-swap` option in
|
|
272
|
-
Docker where the value is the sum of the container memory plus the
|
|
273
|
-
`max_swap` value.
|
|
274
|
-
swappiness : int, optional, default None
|
|
275
|
-
This allows you to tune memory swappiness behavior for this step.
|
|
276
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
277
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
278
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
279
|
-
aws_batch_tags: Dict[str, str], optional, default None
|
|
280
|
-
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
281
|
-
Set as string key-value pairs.
|
|
282
|
-
use_tmpfs : bool, default False
|
|
283
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
284
|
-
not available on Fargate compute environments
|
|
285
|
-
tmpfs_tempdir : bool, default True
|
|
286
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
287
|
-
tmpfs_size : int, optional, default None
|
|
288
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
289
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
290
|
-
memory allocated for this step.
|
|
291
|
-
tmpfs_path : str, optional, default None
|
|
292
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
293
|
-
inferentia : int, default 0
|
|
294
|
-
Number of Inferentia chips required for this step.
|
|
295
|
-
trainium : int, default None
|
|
296
|
-
Alias for inferentia. Use only one of the two.
|
|
297
|
-
efa : int, default 0
|
|
298
|
-
Number of elastic fabric adapter network devices to attach to container
|
|
299
|
-
ephemeral_storage : int, default None
|
|
300
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
301
|
-
This is only relevant for Fargate compute environments
|
|
302
|
-
log_driver: str, optional, default None
|
|
303
|
-
The log driver to use for the Amazon ECS container.
|
|
304
|
-
log_options: List[str], optional, default None
|
|
305
|
-
List of strings containing options for the chosen log driver. The configurable values
|
|
306
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
307
|
-
Example: [`awslogs-group:aws/batch/job`]
|
|
170
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
171
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
308
172
|
"""
|
|
309
173
|
...
|
|
310
174
|
|
|
311
175
|
@typing.overload
|
|
312
|
-
def
|
|
176
|
+
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
313
177
|
"""
|
|
314
|
-
Specifies
|
|
315
|
-
|
|
316
|
-
This decorator is useful if this step may hang indefinitely.
|
|
317
|
-
|
|
318
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
319
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
320
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
178
|
+
Specifies that the step will success under all circumstances.
|
|
321
179
|
|
|
322
|
-
|
|
323
|
-
|
|
180
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
181
|
+
contains the exception raised. You can use it to detect the presence
|
|
182
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
183
|
+
are missing.
|
|
324
184
|
|
|
325
185
|
|
|
326
186
|
Parameters
|
|
327
187
|
----------
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
188
|
+
var : str, optional, default None
|
|
189
|
+
Name of the artifact in which to store the caught exception.
|
|
190
|
+
If not specified, the exception is not stored.
|
|
191
|
+
print_exception : bool, default True
|
|
192
|
+
Determines whether or not the exception is printed to
|
|
193
|
+
stdout when caught.
|
|
334
194
|
"""
|
|
335
195
|
...
|
|
336
196
|
|
|
337
197
|
@typing.overload
|
|
338
|
-
def
|
|
198
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
339
199
|
...
|
|
340
200
|
|
|
341
201
|
@typing.overload
|
|
342
|
-
def
|
|
202
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
343
203
|
...
|
|
344
204
|
|
|
345
|
-
def
|
|
205
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
|
346
206
|
"""
|
|
347
|
-
Specifies
|
|
348
|
-
|
|
349
|
-
This decorator is useful if this step may hang indefinitely.
|
|
350
|
-
|
|
351
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
352
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
353
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
207
|
+
Specifies that the step will success under all circumstances.
|
|
354
208
|
|
|
355
|
-
|
|
356
|
-
|
|
209
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
210
|
+
contains the exception raised. You can use it to detect the presence
|
|
211
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
212
|
+
are missing.
|
|
357
213
|
|
|
358
214
|
|
|
359
215
|
Parameters
|
|
360
216
|
----------
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
217
|
+
var : str, optional, default None
|
|
218
|
+
Name of the artifact in which to store the caught exception.
|
|
219
|
+
If not specified, the exception is not stored.
|
|
220
|
+
print_exception : bool, default True
|
|
221
|
+
Determines whether or not the exception is printed to
|
|
222
|
+
stdout when caught.
|
|
367
223
|
"""
|
|
368
224
|
...
|
|
369
225
|
|
|
370
226
|
@typing.overload
|
|
371
|
-
def
|
|
227
|
+
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]]]:
|
|
372
228
|
"""
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
229
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
230
|
+
the execution of a step.
|
|
376
231
|
|
|
377
232
|
|
|
378
233
|
Parameters
|
|
379
234
|
----------
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
options : Dict[str, Any], default {}
|
|
385
|
-
Options passed to the card. The contents depend on the card type.
|
|
386
|
-
timeout : int, default 45
|
|
387
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
235
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
236
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
237
|
+
role : str, optional, default: None
|
|
238
|
+
Role to use for fetching secrets
|
|
388
239
|
"""
|
|
389
240
|
...
|
|
390
241
|
|
|
391
242
|
@typing.overload
|
|
392
|
-
def
|
|
243
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
393
244
|
...
|
|
394
245
|
|
|
395
246
|
@typing.overload
|
|
396
|
-
def
|
|
247
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
397
248
|
...
|
|
398
249
|
|
|
399
|
-
def
|
|
250
|
+
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):
|
|
400
251
|
"""
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
252
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
253
|
+
the execution of a step.
|
|
404
254
|
|
|
405
255
|
|
|
406
256
|
Parameters
|
|
407
257
|
----------
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
options : Dict[str, Any], default {}
|
|
413
|
-
Options passed to the card. The contents depend on the card type.
|
|
414
|
-
timeout : int, default 45
|
|
415
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
416
|
-
"""
|
|
417
|
-
...
|
|
418
|
-
|
|
419
|
-
@typing.overload
|
|
420
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
421
|
-
"""
|
|
422
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
423
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
424
|
-
"""
|
|
425
|
-
...
|
|
426
|
-
|
|
427
|
-
@typing.overload
|
|
428
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
429
|
-
...
|
|
430
|
-
|
|
431
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
432
|
-
"""
|
|
433
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
434
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
258
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
259
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
260
|
+
role : str, optional, default: None
|
|
261
|
+
Role to use for fetching secrets
|
|
435
262
|
"""
|
|
436
263
|
...
|
|
437
264
|
|
|
438
|
-
|
|
439
|
-
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
265
|
+
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[typing.Dict[str, 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]]]:
|
|
440
266
|
"""
|
|
441
|
-
Specifies that
|
|
442
|
-
|
|
443
|
-
The decorator will create an optional artifact, specified by `var`, which
|
|
444
|
-
contains the exception raised. You can use it to detect the presence
|
|
445
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
|
446
|
-
are missing.
|
|
267
|
+
Specifies that this step should execute on Kubernetes.
|
|
447
268
|
|
|
448
269
|
|
|
449
270
|
Parameters
|
|
450
271
|
----------
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
272
|
+
cpu : int, default 1
|
|
273
|
+
Number of CPUs required for this step. If `@resources` is
|
|
274
|
+
also present, the maximum value from all decorators is used.
|
|
275
|
+
memory : int, default 4096
|
|
276
|
+
Memory size (in MB) required for this step. If
|
|
277
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
278
|
+
used.
|
|
279
|
+
disk : int, default 10240
|
|
280
|
+
Disk size (in MB) required for this step. If
|
|
281
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
282
|
+
used.
|
|
283
|
+
image : str, optional, default None
|
|
284
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
|
285
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
286
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
287
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
288
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
289
|
+
image_pull_secrets: List[str], default []
|
|
290
|
+
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
291
|
+
Kubernetes image pull secrets to use when pulling container images
|
|
292
|
+
in Kubernetes.
|
|
293
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
294
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
|
295
|
+
secrets : List[str], optional, default None
|
|
296
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
297
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
298
|
+
in Metaflow configuration.
|
|
299
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
|
300
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
|
301
|
+
Can be passed in as a comma separated string of values e.g.
|
|
302
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
303
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
304
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
305
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
306
|
+
gpu : int, optional, default None
|
|
307
|
+
Number of GPUs required for this step. A value of zero implies that
|
|
308
|
+
the scheduled node should not have GPUs.
|
|
309
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
310
|
+
The vendor of the GPUs to be used for this step.
|
|
311
|
+
tolerations : List[Dict[str,str]], default []
|
|
312
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
313
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
314
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
315
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
|
316
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
317
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
318
|
+
use_tmpfs : bool, default False
|
|
319
|
+
This enables an explicit tmpfs mount for this step.
|
|
320
|
+
tmpfs_tempdir : bool, default True
|
|
321
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
322
|
+
tmpfs_size : int, optional, default: None
|
|
323
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
324
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
325
|
+
memory allocated for this step.
|
|
326
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
|
327
|
+
Path to tmpfs mount for this step.
|
|
328
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
|
329
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
330
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
331
|
+
shared_memory: int, optional
|
|
332
|
+
Shared memory size (in MiB) required for this step
|
|
333
|
+
port: int, optional
|
|
334
|
+
Port number to specify in the Kubernetes job object
|
|
335
|
+
compute_pool : str, optional, default None
|
|
336
|
+
Compute pool to be used for for this step.
|
|
337
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
|
338
|
+
hostname_resolution_timeout: int, default 10 * 60
|
|
339
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
340
|
+
Only applicable when @parallel is used.
|
|
341
|
+
qos: str, default: Burstable
|
|
342
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
477
343
|
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
stdout when caught.
|
|
344
|
+
security_context: Dict[str, Any], optional, default None
|
|
345
|
+
Container security context. Applies to the task container. Allows the following keys:
|
|
346
|
+
- privileged: bool, optional, default None
|
|
347
|
+
- allow_privilege_escalation: bool, optional, default None
|
|
348
|
+
- run_as_user: int, optional, default None
|
|
349
|
+
- run_as_group: int, optional, default None
|
|
350
|
+
- run_as_non_root: bool, optional, default None
|
|
486
351
|
"""
|
|
487
352
|
...
|
|
488
353
|
|
|
@@ -541,6 +406,161 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
541
406
|
"""
|
|
542
407
|
...
|
|
543
408
|
|
|
409
|
+
@typing.overload
|
|
410
|
+
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
411
|
+
"""
|
|
412
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
Parameters
|
|
416
|
+
----------
|
|
417
|
+
cpu : int, default 1
|
|
418
|
+
Number of CPUs required for this step. If `@resources` is
|
|
419
|
+
also present, the maximum value from all decorators is used.
|
|
420
|
+
gpu : int, default 0
|
|
421
|
+
Number of GPUs required for this step. If `@resources` is
|
|
422
|
+
also present, the maximum value from all decorators is used.
|
|
423
|
+
memory : int, default 4096
|
|
424
|
+
Memory size (in MB) required for this step. If
|
|
425
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
426
|
+
used.
|
|
427
|
+
image : str, optional, default None
|
|
428
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
429
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
430
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
431
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
432
|
+
AWS Batch Job Queue to submit the job to.
|
|
433
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
434
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
435
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
436
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
437
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
438
|
+
shared_memory : int, optional, default None
|
|
439
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
440
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
441
|
+
max_swap : int, optional, default None
|
|
442
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
443
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
444
|
+
Docker where the value is the sum of the container memory plus the
|
|
445
|
+
`max_swap` value.
|
|
446
|
+
swappiness : int, optional, default None
|
|
447
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
448
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
449
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
450
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
451
|
+
aws_batch_tags: Dict[str, str], optional, default None
|
|
452
|
+
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
453
|
+
Set as string key-value pairs.
|
|
454
|
+
use_tmpfs : bool, default False
|
|
455
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
456
|
+
not available on Fargate compute environments
|
|
457
|
+
tmpfs_tempdir : bool, default True
|
|
458
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
459
|
+
tmpfs_size : int, optional, default None
|
|
460
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
461
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
462
|
+
memory allocated for this step.
|
|
463
|
+
tmpfs_path : str, optional, default None
|
|
464
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
465
|
+
inferentia : int, default 0
|
|
466
|
+
Number of Inferentia chips required for this step.
|
|
467
|
+
trainium : int, default None
|
|
468
|
+
Alias for inferentia. Use only one of the two.
|
|
469
|
+
efa : int, default 0
|
|
470
|
+
Number of elastic fabric adapter network devices to attach to container
|
|
471
|
+
ephemeral_storage : int, default None
|
|
472
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
473
|
+
This is only relevant for Fargate compute environments
|
|
474
|
+
log_driver: str, optional, default None
|
|
475
|
+
The log driver to use for the Amazon ECS container.
|
|
476
|
+
log_options: List[str], optional, default None
|
|
477
|
+
List of strings containing options for the chosen log driver. The configurable values
|
|
478
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
479
|
+
Example: [`awslogs-group:aws/batch/job`]
|
|
480
|
+
"""
|
|
481
|
+
...
|
|
482
|
+
|
|
483
|
+
@typing.overload
|
|
484
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
485
|
+
...
|
|
486
|
+
|
|
487
|
+
@typing.overload
|
|
488
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
489
|
+
...
|
|
490
|
+
|
|
491
|
+
def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, aws_batch_tags: typing.Optional[typing.Dict[str, str]] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None):
|
|
492
|
+
"""
|
|
493
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
Parameters
|
|
497
|
+
----------
|
|
498
|
+
cpu : int, default 1
|
|
499
|
+
Number of CPUs required for this step. If `@resources` is
|
|
500
|
+
also present, the maximum value from all decorators is used.
|
|
501
|
+
gpu : int, default 0
|
|
502
|
+
Number of GPUs required for this step. If `@resources` is
|
|
503
|
+
also present, the maximum value from all decorators is used.
|
|
504
|
+
memory : int, default 4096
|
|
505
|
+
Memory size (in MB) required for this step. If
|
|
506
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
507
|
+
used.
|
|
508
|
+
image : str, optional, default None
|
|
509
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
510
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
511
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
512
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
513
|
+
AWS Batch Job Queue to submit the job to.
|
|
514
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
515
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
516
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
517
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
518
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
519
|
+
shared_memory : int, optional, default None
|
|
520
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
521
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
522
|
+
max_swap : int, optional, default None
|
|
523
|
+
The total amount of swap memory (in MiB) a container can use for this
|
|
524
|
+
step. This parameter is translated to the `--memory-swap` option in
|
|
525
|
+
Docker where the value is the sum of the container memory plus the
|
|
526
|
+
`max_swap` value.
|
|
527
|
+
swappiness : int, optional, default None
|
|
528
|
+
This allows you to tune memory swappiness behavior for this step.
|
|
529
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
|
530
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
|
531
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
|
532
|
+
aws_batch_tags: Dict[str, str], optional, default None
|
|
533
|
+
Sets arbitrary AWS tags on the AWS Batch compute environment.
|
|
534
|
+
Set as string key-value pairs.
|
|
535
|
+
use_tmpfs : bool, default False
|
|
536
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
|
537
|
+
not available on Fargate compute environments
|
|
538
|
+
tmpfs_tempdir : bool, default True
|
|
539
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
540
|
+
tmpfs_size : int, optional, default None
|
|
541
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
542
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
543
|
+
memory allocated for this step.
|
|
544
|
+
tmpfs_path : str, optional, default None
|
|
545
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
|
546
|
+
inferentia : int, default 0
|
|
547
|
+
Number of Inferentia chips required for this step.
|
|
548
|
+
trainium : int, default None
|
|
549
|
+
Alias for inferentia. Use only one of the two.
|
|
550
|
+
efa : int, default 0
|
|
551
|
+
Number of elastic fabric adapter network devices to attach to container
|
|
552
|
+
ephemeral_storage : int, default None
|
|
553
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
|
554
|
+
This is only relevant for Fargate compute environments
|
|
555
|
+
log_driver: str, optional, default None
|
|
556
|
+
The log driver to use for the Amazon ECS container.
|
|
557
|
+
log_options: List[str], optional, default None
|
|
558
|
+
List of strings containing options for the chosen log driver. The configurable values
|
|
559
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
|
560
|
+
Example: [`awslogs-group:aws/batch/job`]
|
|
561
|
+
"""
|
|
562
|
+
...
|
|
563
|
+
|
|
544
564
|
@typing.overload
|
|
545
565
|
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]]]:
|
|
546
566
|
"""
|
|
@@ -575,92 +595,140 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
|
|
|
575
595
|
...
|
|
576
596
|
|
|
577
597
|
@typing.overload
|
|
578
|
-
def
|
|
598
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
579
599
|
"""
|
|
580
|
-
Specifies the
|
|
600
|
+
Specifies the resources needed when executing this step.
|
|
581
601
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
602
|
+
Use `@resources` to specify the resource requirements
|
|
603
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
604
|
+
|
|
605
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
606
|
+
```
|
|
607
|
+
python myflow.py run --with batch
|
|
608
|
+
```
|
|
609
|
+
or
|
|
610
|
+
```
|
|
611
|
+
python myflow.py run --with kubernetes
|
|
612
|
+
```
|
|
613
|
+
which executes the flow on the desired system using the
|
|
614
|
+
requirements specified in `@resources`.
|
|
586
615
|
|
|
587
616
|
|
|
588
617
|
Parameters
|
|
589
618
|
----------
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
619
|
+
cpu : int, default 1
|
|
620
|
+
Number of CPUs required for this step.
|
|
621
|
+
gpu : int, optional, default None
|
|
622
|
+
Number of GPUs required for this step.
|
|
623
|
+
disk : int, optional, default None
|
|
624
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
625
|
+
memory : int, default 4096
|
|
626
|
+
Memory size (in MB) required for this step.
|
|
627
|
+
shared_memory : int, optional, default None
|
|
628
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
629
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
596
630
|
"""
|
|
597
631
|
...
|
|
598
632
|
|
|
599
633
|
@typing.overload
|
|
600
|
-
def
|
|
634
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
601
635
|
...
|
|
602
636
|
|
|
603
637
|
@typing.overload
|
|
604
|
-
def
|
|
638
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
605
639
|
...
|
|
606
640
|
|
|
607
|
-
def
|
|
641
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
|
608
642
|
"""
|
|
609
|
-
Specifies the
|
|
643
|
+
Specifies the resources needed when executing this step.
|
|
610
644
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
645
|
+
Use `@resources` to specify the resource requirements
|
|
646
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
647
|
+
|
|
648
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
649
|
+
```
|
|
650
|
+
python myflow.py run --with batch
|
|
651
|
+
```
|
|
652
|
+
or
|
|
653
|
+
```
|
|
654
|
+
python myflow.py run --with kubernetes
|
|
655
|
+
```
|
|
656
|
+
which executes the flow on the desired system using the
|
|
657
|
+
requirements specified in `@resources`.
|
|
615
658
|
|
|
616
659
|
|
|
617
660
|
Parameters
|
|
618
661
|
----------
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
662
|
+
cpu : int, default 1
|
|
663
|
+
Number of CPUs required for this step.
|
|
664
|
+
gpu : int, optional, default None
|
|
665
|
+
Number of GPUs required for this step.
|
|
666
|
+
disk : int, optional, default None
|
|
667
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
668
|
+
memory : int, default 4096
|
|
669
|
+
Memory size (in MB) required for this step.
|
|
670
|
+
shared_memory : int, optional, default None
|
|
671
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
672
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
625
673
|
"""
|
|
626
674
|
...
|
|
627
675
|
|
|
628
676
|
@typing.overload
|
|
629
|
-
def
|
|
677
|
+
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]]]:
|
|
630
678
|
"""
|
|
631
|
-
Specifies
|
|
632
|
-
|
|
679
|
+
Specifies a timeout for your step.
|
|
680
|
+
|
|
681
|
+
This decorator is useful if this step may hang indefinitely.
|
|
682
|
+
|
|
683
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
684
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
685
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
686
|
+
|
|
687
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
688
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
633
689
|
|
|
634
690
|
|
|
635
691
|
Parameters
|
|
636
692
|
----------
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
693
|
+
seconds : int, default 0
|
|
694
|
+
Number of seconds to wait prior to timing out.
|
|
695
|
+
minutes : int, default 0
|
|
696
|
+
Number of minutes to wait prior to timing out.
|
|
697
|
+
hours : int, default 0
|
|
698
|
+
Number of hours to wait prior to timing out.
|
|
641
699
|
"""
|
|
642
700
|
...
|
|
643
701
|
|
|
644
702
|
@typing.overload
|
|
645
|
-
def
|
|
703
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
646
704
|
...
|
|
647
705
|
|
|
648
706
|
@typing.overload
|
|
649
|
-
def
|
|
707
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
650
708
|
...
|
|
651
709
|
|
|
652
|
-
def
|
|
710
|
+
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):
|
|
653
711
|
"""
|
|
654
|
-
Specifies
|
|
655
|
-
|
|
712
|
+
Specifies a timeout for your step.
|
|
713
|
+
|
|
714
|
+
This decorator is useful if this step may hang indefinitely.
|
|
715
|
+
|
|
716
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
717
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
718
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
719
|
+
|
|
720
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
721
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
656
722
|
|
|
657
723
|
|
|
658
724
|
Parameters
|
|
659
725
|
----------
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
726
|
+
seconds : int, default 0
|
|
727
|
+
Number of seconds to wait prior to timing out.
|
|
728
|
+
minutes : int, default 0
|
|
729
|
+
Number of minutes to wait prior to timing out.
|
|
730
|
+
hours : int, default 0
|
|
731
|
+
Number of hours to wait prior to timing out.
|
|
664
732
|
"""
|
|
665
733
|
...
|
|
666
734
|
|
|
@@ -723,186 +791,70 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
723
791
|
"""
|
|
724
792
|
...
|
|
725
793
|
|
|
726
|
-
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[typing.Dict[str, 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]]]:
|
|
727
|
-
"""
|
|
728
|
-
Specifies that this step should execute on Kubernetes.
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
Parameters
|
|
732
|
-
----------
|
|
733
|
-
cpu : int, default 1
|
|
734
|
-
Number of CPUs required for this step. If `@resources` is
|
|
735
|
-
also present, the maximum value from all decorators is used.
|
|
736
|
-
memory : int, default 4096
|
|
737
|
-
Memory size (in MB) required for this step. If
|
|
738
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
739
|
-
used.
|
|
740
|
-
disk : int, default 10240
|
|
741
|
-
Disk size (in MB) required for this step. If
|
|
742
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
743
|
-
used.
|
|
744
|
-
image : str, optional, default None
|
|
745
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
|
746
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
747
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
748
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
749
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
750
|
-
image_pull_secrets: List[str], default []
|
|
751
|
-
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
752
|
-
Kubernetes image pull secrets to use when pulling container images
|
|
753
|
-
in Kubernetes.
|
|
754
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
755
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
|
756
|
-
secrets : List[str], optional, default None
|
|
757
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
758
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
759
|
-
in Metaflow configuration.
|
|
760
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
|
761
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
|
762
|
-
Can be passed in as a comma separated string of values e.g.
|
|
763
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
764
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
765
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
766
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
767
|
-
gpu : int, optional, default None
|
|
768
|
-
Number of GPUs required for this step. A value of zero implies that
|
|
769
|
-
the scheduled node should not have GPUs.
|
|
770
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
771
|
-
The vendor of the GPUs to be used for this step.
|
|
772
|
-
tolerations : List[Dict[str,str]], default []
|
|
773
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
774
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
775
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
776
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
|
777
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
778
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
779
|
-
use_tmpfs : bool, default False
|
|
780
|
-
This enables an explicit tmpfs mount for this step.
|
|
781
|
-
tmpfs_tempdir : bool, default True
|
|
782
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
783
|
-
tmpfs_size : int, optional, default: None
|
|
784
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
785
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
786
|
-
memory allocated for this step.
|
|
787
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
|
788
|
-
Path to tmpfs mount for this step.
|
|
789
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
|
790
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
791
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
792
|
-
shared_memory: int, optional
|
|
793
|
-
Shared memory size (in MiB) required for this step
|
|
794
|
-
port: int, optional
|
|
795
|
-
Port number to specify in the Kubernetes job object
|
|
796
|
-
compute_pool : str, optional, default None
|
|
797
|
-
Compute pool to be used for for this step.
|
|
798
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
|
799
|
-
hostname_resolution_timeout: int, default 10 * 60
|
|
800
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
801
|
-
Only applicable when @parallel is used.
|
|
802
|
-
qos: str, default: Burstable
|
|
803
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
804
|
-
|
|
805
|
-
security_context: Dict[str, Any], optional, default None
|
|
806
|
-
Container security context. Applies to the task container. Allows the following keys:
|
|
807
|
-
- privileged: bool, optional, default None
|
|
808
|
-
- allow_privilege_escalation: bool, optional, default None
|
|
809
|
-
- run_as_user: int, optional, default None
|
|
810
|
-
- run_as_group: int, optional, default None
|
|
811
|
-
- run_as_non_root: bool, optional, default None
|
|
812
|
-
"""
|
|
813
|
-
...
|
|
814
|
-
|
|
815
794
|
@typing.overload
|
|
816
|
-
def
|
|
795
|
+
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]]]:
|
|
817
796
|
"""
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
Use `@resources` to specify the resource requirements
|
|
821
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
797
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
822
798
|
|
|
823
|
-
|
|
824
|
-
```
|
|
825
|
-
python myflow.py run --with batch
|
|
826
|
-
```
|
|
827
|
-
or
|
|
828
|
-
```
|
|
829
|
-
python myflow.py run --with kubernetes
|
|
830
|
-
```
|
|
831
|
-
which executes the flow on the desired system using the
|
|
832
|
-
requirements specified in `@resources`.
|
|
799
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
833
800
|
|
|
834
801
|
|
|
835
802
|
Parameters
|
|
836
803
|
----------
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
shared_memory : int, optional, default None
|
|
846
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
847
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
804
|
+
type : str, default 'default'
|
|
805
|
+
Card type.
|
|
806
|
+
id : str, optional, default None
|
|
807
|
+
If multiple cards are present, use this id to identify this card.
|
|
808
|
+
options : Dict[str, Any], default {}
|
|
809
|
+
Options passed to the card. The contents depend on the card type.
|
|
810
|
+
timeout : int, default 45
|
|
811
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
848
812
|
"""
|
|
849
813
|
...
|
|
850
814
|
|
|
851
815
|
@typing.overload
|
|
852
|
-
def
|
|
816
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
853
817
|
...
|
|
854
818
|
|
|
855
819
|
@typing.overload
|
|
856
|
-
def
|
|
820
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
857
821
|
...
|
|
858
822
|
|
|
859
|
-
def
|
|
823
|
+
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):
|
|
860
824
|
"""
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
Use `@resources` to specify the resource requirements
|
|
864
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
825
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
865
826
|
|
|
866
|
-
|
|
867
|
-
```
|
|
868
|
-
python myflow.py run --with batch
|
|
869
|
-
```
|
|
870
|
-
or
|
|
871
|
-
```
|
|
872
|
-
python myflow.py run --with kubernetes
|
|
873
|
-
```
|
|
874
|
-
which executes the flow on the desired system using the
|
|
875
|
-
requirements specified in `@resources`.
|
|
827
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
876
828
|
|
|
877
829
|
|
|
878
830
|
Parameters
|
|
879
831
|
----------
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
shared_memory : int, optional, default None
|
|
889
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
890
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
832
|
+
type : str, default 'default'
|
|
833
|
+
Card type.
|
|
834
|
+
id : str, optional, default None
|
|
835
|
+
If multiple cards are present, use this id to identify this card.
|
|
836
|
+
options : Dict[str, Any], default {}
|
|
837
|
+
Options passed to the card. The contents depend on the card type.
|
|
838
|
+
timeout : int, default 45
|
|
839
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
891
840
|
"""
|
|
892
841
|
...
|
|
893
842
|
|
|
894
843
|
@typing.overload
|
|
895
|
-
def
|
|
844
|
+
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]]]:
|
|
896
845
|
"""
|
|
897
|
-
Specifies the PyPI packages for
|
|
846
|
+
Specifies the PyPI packages for the step.
|
|
898
847
|
|
|
899
|
-
|
|
848
|
+
Information in this decorator will augment any
|
|
849
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
850
|
+
you can use `@pypi_base` to set packages required by all
|
|
900
851
|
steps and use `@pypi` to specify step-specific overrides.
|
|
901
852
|
|
|
853
|
+
|
|
902
854
|
Parameters
|
|
903
855
|
----------
|
|
904
856
|
packages : Dict[str, str], default: {}
|
|
905
|
-
Packages to use for this
|
|
857
|
+
Packages to use for this step. The key is the name of the package
|
|
906
858
|
and the value is the version to use.
|
|
907
859
|
python : str, optional, default: None
|
|
908
860
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
@@ -911,20 +863,27 @@ def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[s
|
|
|
911
863
|
...
|
|
912
864
|
|
|
913
865
|
@typing.overload
|
|
914
|
-
def
|
|
866
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
915
867
|
...
|
|
916
868
|
|
|
917
|
-
|
|
869
|
+
@typing.overload
|
|
870
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
871
|
+
...
|
|
872
|
+
|
|
873
|
+
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):
|
|
918
874
|
"""
|
|
919
|
-
Specifies the PyPI packages for
|
|
875
|
+
Specifies the PyPI packages for the step.
|
|
920
876
|
|
|
921
|
-
|
|
877
|
+
Information in this decorator will augment any
|
|
878
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
879
|
+
you can use `@pypi_base` to set packages required by all
|
|
922
880
|
steps and use `@pypi` to specify step-specific overrides.
|
|
923
881
|
|
|
882
|
+
|
|
924
883
|
Parameters
|
|
925
884
|
----------
|
|
926
885
|
packages : Dict[str, str], default: {}
|
|
927
|
-
Packages to use for this
|
|
886
|
+
Packages to use for this step. The key is the name of the package
|
|
928
887
|
and the value is the version to use.
|
|
929
888
|
python : str, optional, default: None
|
|
930
889
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
@@ -932,6 +891,49 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
|
932
891
|
"""
|
|
933
892
|
...
|
|
934
893
|
|
|
894
|
+
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]]:
|
|
895
|
+
"""
|
|
896
|
+
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.
|
|
897
|
+
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.
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
Parameters
|
|
901
|
+
----------
|
|
902
|
+
timeout : int
|
|
903
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
904
|
+
poke_interval : int
|
|
905
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
906
|
+
mode : str
|
|
907
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
908
|
+
exponential_backoff : bool
|
|
909
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
910
|
+
pool : str
|
|
911
|
+
the slot pool this task should run in,
|
|
912
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
913
|
+
soft_fail : bool
|
|
914
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
915
|
+
name : str
|
|
916
|
+
Name of the sensor on Airflow
|
|
917
|
+
description : str
|
|
918
|
+
Description of sensor in the Airflow UI
|
|
919
|
+
external_dag_id : str
|
|
920
|
+
The dag_id that contains the task you want to wait for.
|
|
921
|
+
external_task_ids : List[str]
|
|
922
|
+
The list of task_ids that you want to wait for.
|
|
923
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
924
|
+
allowed_states : List[str]
|
|
925
|
+
Iterable of allowed states, (Default: ['success'])
|
|
926
|
+
failed_states : List[str]
|
|
927
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
928
|
+
execution_delta : datetime.timedelta
|
|
929
|
+
time difference with the previous execution to look at,
|
|
930
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
931
|
+
check_existence: bool
|
|
932
|
+
Set to True to check if the external task exists or check if
|
|
933
|
+
the DAG to wait for exists. (Default: True)
|
|
934
|
+
"""
|
|
935
|
+
...
|
|
936
|
+
|
|
935
937
|
@typing.overload
|
|
936
938
|
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
937
939
|
"""
|
|
@@ -994,40 +996,176 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
|
994
996
|
```
|
|
995
997
|
or
|
|
996
998
|
```
|
|
997
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
999
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1000
|
+
```
|
|
1001
|
+
This decorator respects the @project decorator and triggers the flow
|
|
1002
|
+
when upstream runs within the same namespace complete successfully
|
|
1003
|
+
|
|
1004
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
1005
|
+
by specifying the fully qualified project_flow_name.
|
|
1006
|
+
```
|
|
1007
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1008
|
+
```
|
|
1009
|
+
or
|
|
1010
|
+
```
|
|
1011
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1012
|
+
```
|
|
1013
|
+
|
|
1014
|
+
You can also specify just the project or project branch (other values will be
|
|
1015
|
+
inferred from the current project or project branch):
|
|
1016
|
+
```
|
|
1017
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1018
|
+
```
|
|
1019
|
+
|
|
1020
|
+
Note that `branch` is typically one of:
|
|
1021
|
+
- `prod`
|
|
1022
|
+
- `user.bob`
|
|
1023
|
+
- `test.my_experiment`
|
|
1024
|
+
- `prod.staging`
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
Parameters
|
|
1028
|
+
----------
|
|
1029
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1030
|
+
Upstream flow dependency for this flow.
|
|
1031
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1032
|
+
Upstream flow dependencies for this flow.
|
|
1033
|
+
options : Dict[str, Any], default {}
|
|
1034
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1035
|
+
"""
|
|
1036
|
+
...
|
|
1037
|
+
|
|
1038
|
+
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]]:
|
|
1039
|
+
"""
|
|
1040
|
+
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)
|
|
1041
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1042
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1043
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1044
|
+
starts only after all sensors finish.
|
|
1045
|
+
|
|
1046
|
+
|
|
1047
|
+
Parameters
|
|
1048
|
+
----------
|
|
1049
|
+
timeout : int
|
|
1050
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1051
|
+
poke_interval : int
|
|
1052
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1053
|
+
mode : str
|
|
1054
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1055
|
+
exponential_backoff : bool
|
|
1056
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1057
|
+
pool : str
|
|
1058
|
+
the slot pool this task should run in,
|
|
1059
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1060
|
+
soft_fail : bool
|
|
1061
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1062
|
+
name : str
|
|
1063
|
+
Name of the sensor on Airflow
|
|
1064
|
+
description : str
|
|
1065
|
+
Description of sensor in the Airflow UI
|
|
1066
|
+
bucket_key : Union[str, List[str]]
|
|
1067
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1068
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1069
|
+
bucket_name : str
|
|
1070
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1071
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1072
|
+
wildcard_match : bool
|
|
1073
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1074
|
+
aws_conn_id : str
|
|
1075
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1076
|
+
verify : bool
|
|
1077
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1078
|
+
"""
|
|
1079
|
+
...
|
|
1080
|
+
|
|
1081
|
+
@typing.overload
|
|
1082
|
+
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]]:
|
|
1083
|
+
"""
|
|
1084
|
+
Specifies the event(s) that this flow depends on.
|
|
1085
|
+
|
|
1086
|
+
```
|
|
1087
|
+
@trigger(event='foo')
|
|
1088
|
+
```
|
|
1089
|
+
or
|
|
1090
|
+
```
|
|
1091
|
+
@trigger(events=['foo', 'bar'])
|
|
1092
|
+
```
|
|
1093
|
+
|
|
1094
|
+
Additionally, you can specify the parameter mappings
|
|
1095
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1096
|
+
```
|
|
1097
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1098
|
+
```
|
|
1099
|
+
or
|
|
1100
|
+
```
|
|
1101
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1102
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1103
|
+
```
|
|
1104
|
+
|
|
1105
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1106
|
+
```
|
|
1107
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1108
|
+
```
|
|
1109
|
+
This is equivalent to:
|
|
1110
|
+
```
|
|
1111
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
|
|
1115
|
+
Parameters
|
|
1116
|
+
----------
|
|
1117
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1118
|
+
Event dependency for this flow.
|
|
1119
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1120
|
+
Events dependency for this flow.
|
|
1121
|
+
options : Dict[str, Any], default {}
|
|
1122
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1123
|
+
"""
|
|
1124
|
+
...
|
|
1125
|
+
|
|
1126
|
+
@typing.overload
|
|
1127
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1128
|
+
...
|
|
1129
|
+
|
|
1130
|
+
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] = {}):
|
|
1131
|
+
"""
|
|
1132
|
+
Specifies the event(s) that this flow depends on.
|
|
1133
|
+
|
|
1134
|
+
```
|
|
1135
|
+
@trigger(event='foo')
|
|
1136
|
+
```
|
|
1137
|
+
or
|
|
1138
|
+
```
|
|
1139
|
+
@trigger(events=['foo', 'bar'])
|
|
998
1140
|
```
|
|
999
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1000
|
-
when upstream runs within the same namespace complete successfully
|
|
1001
1141
|
|
|
1002
|
-
Additionally, you can specify
|
|
1003
|
-
|
|
1142
|
+
Additionally, you can specify the parameter mappings
|
|
1143
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1004
1144
|
```
|
|
1005
|
-
@
|
|
1145
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1006
1146
|
```
|
|
1007
1147
|
or
|
|
1008
1148
|
```
|
|
1009
|
-
@
|
|
1149
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1150
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1010
1151
|
```
|
|
1011
1152
|
|
|
1012
|
-
|
|
1013
|
-
inferred from the current project or project branch):
|
|
1153
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1014
1154
|
```
|
|
1015
|
-
@
|
|
1155
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1156
|
+
```
|
|
1157
|
+
This is equivalent to:
|
|
1158
|
+
```
|
|
1159
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1016
1160
|
```
|
|
1017
|
-
|
|
1018
|
-
Note that `branch` is typically one of:
|
|
1019
|
-
- `prod`
|
|
1020
|
-
- `user.bob`
|
|
1021
|
-
- `test.my_experiment`
|
|
1022
|
-
- `prod.staging`
|
|
1023
1161
|
|
|
1024
1162
|
|
|
1025
1163
|
Parameters
|
|
1026
1164
|
----------
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1165
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1166
|
+
Event dependency for this flow.
|
|
1167
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1168
|
+
Events dependency for this flow.
|
|
1031
1169
|
options : Dict[str, Any], default {}
|
|
1032
1170
|
Backend-specific configuration for tuning eventing behavior.
|
|
1033
1171
|
"""
|
|
@@ -1084,6 +1222,47 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
|
1084
1222
|
"""
|
|
1085
1223
|
...
|
|
1086
1224
|
|
|
1225
|
+
@typing.overload
|
|
1226
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1227
|
+
"""
|
|
1228
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1229
|
+
|
|
1230
|
+
Use `@pypi_base` to set common packages required by all
|
|
1231
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1232
|
+
|
|
1233
|
+
Parameters
|
|
1234
|
+
----------
|
|
1235
|
+
packages : Dict[str, str], default: {}
|
|
1236
|
+
Packages to use for this flow. The key is the name of the package
|
|
1237
|
+
and the value is the version to use.
|
|
1238
|
+
python : str, optional, default: None
|
|
1239
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1240
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1241
|
+
"""
|
|
1242
|
+
...
|
|
1243
|
+
|
|
1244
|
+
@typing.overload
|
|
1245
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1246
|
+
...
|
|
1247
|
+
|
|
1248
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1249
|
+
"""
|
|
1250
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1251
|
+
|
|
1252
|
+
Use `@pypi_base` to set common packages required by all
|
|
1253
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1254
|
+
|
|
1255
|
+
Parameters
|
|
1256
|
+
----------
|
|
1257
|
+
packages : Dict[str, str], default: {}
|
|
1258
|
+
Packages to use for this flow. The key is the name of the package
|
|
1259
|
+
and the value is the version to use.
|
|
1260
|
+
python : str, optional, default: None
|
|
1261
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1262
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1263
|
+
"""
|
|
1264
|
+
...
|
|
1265
|
+
|
|
1087
1266
|
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1088
1267
|
"""
|
|
1089
1268
|
Specifies what flows belong to the same project.
|
|
@@ -1119,49 +1298,6 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
|
|
|
1119
1298
|
"""
|
|
1120
1299
|
...
|
|
1121
1300
|
|
|
1122
|
-
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]]:
|
|
1123
|
-
"""
|
|
1124
|
-
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.
|
|
1125
|
-
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.
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
Parameters
|
|
1129
|
-
----------
|
|
1130
|
-
timeout : int
|
|
1131
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1132
|
-
poke_interval : int
|
|
1133
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1134
|
-
mode : str
|
|
1135
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1136
|
-
exponential_backoff : bool
|
|
1137
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1138
|
-
pool : str
|
|
1139
|
-
the slot pool this task should run in,
|
|
1140
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1141
|
-
soft_fail : bool
|
|
1142
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1143
|
-
name : str
|
|
1144
|
-
Name of the sensor on Airflow
|
|
1145
|
-
description : str
|
|
1146
|
-
Description of sensor in the Airflow UI
|
|
1147
|
-
external_dag_id : str
|
|
1148
|
-
The dag_id that contains the task you want to wait for.
|
|
1149
|
-
external_task_ids : List[str]
|
|
1150
|
-
The list of task_ids that you want to wait for.
|
|
1151
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1152
|
-
allowed_states : List[str]
|
|
1153
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1154
|
-
failed_states : List[str]
|
|
1155
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1156
|
-
execution_delta : datetime.timedelta
|
|
1157
|
-
time difference with the previous execution to look at,
|
|
1158
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1159
|
-
check_existence: bool
|
|
1160
|
-
Set to True to check if the external task exists or check if
|
|
1161
|
-
the DAG to wait for exists. (Default: True)
|
|
1162
|
-
"""
|
|
1163
|
-
...
|
|
1164
|
-
|
|
1165
1301
|
@typing.overload
|
|
1166
1302
|
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]]:
|
|
1167
1303
|
"""
|
|
@@ -1213,139 +1349,3 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
|
1213
1349
|
"""
|
|
1214
1350
|
...
|
|
1215
1351
|
|
|
1216
|
-
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]]:
|
|
1217
|
-
"""
|
|
1218
|
-
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)
|
|
1219
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1220
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1221
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1222
|
-
starts only after all sensors finish.
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
Parameters
|
|
1226
|
-
----------
|
|
1227
|
-
timeout : int
|
|
1228
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1229
|
-
poke_interval : int
|
|
1230
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1231
|
-
mode : str
|
|
1232
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1233
|
-
exponential_backoff : bool
|
|
1234
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1235
|
-
pool : str
|
|
1236
|
-
the slot pool this task should run in,
|
|
1237
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1238
|
-
soft_fail : bool
|
|
1239
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1240
|
-
name : str
|
|
1241
|
-
Name of the sensor on Airflow
|
|
1242
|
-
description : str
|
|
1243
|
-
Description of sensor in the Airflow UI
|
|
1244
|
-
bucket_key : Union[str, List[str]]
|
|
1245
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1246
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1247
|
-
bucket_name : str
|
|
1248
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1249
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1250
|
-
wildcard_match : bool
|
|
1251
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1252
|
-
aws_conn_id : str
|
|
1253
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1254
|
-
verify : bool
|
|
1255
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1256
|
-
"""
|
|
1257
|
-
...
|
|
1258
|
-
|
|
1259
|
-
@typing.overload
|
|
1260
|
-
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]]:
|
|
1261
|
-
"""
|
|
1262
|
-
Specifies the event(s) that this flow depends on.
|
|
1263
|
-
|
|
1264
|
-
```
|
|
1265
|
-
@trigger(event='foo')
|
|
1266
|
-
```
|
|
1267
|
-
or
|
|
1268
|
-
```
|
|
1269
|
-
@trigger(events=['foo', 'bar'])
|
|
1270
|
-
```
|
|
1271
|
-
|
|
1272
|
-
Additionally, you can specify the parameter mappings
|
|
1273
|
-
to map event payload to Metaflow parameters for the flow.
|
|
1274
|
-
```
|
|
1275
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1276
|
-
```
|
|
1277
|
-
or
|
|
1278
|
-
```
|
|
1279
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1280
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1281
|
-
```
|
|
1282
|
-
|
|
1283
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
1284
|
-
```
|
|
1285
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1286
|
-
```
|
|
1287
|
-
This is equivalent to:
|
|
1288
|
-
```
|
|
1289
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1290
|
-
```
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
Parameters
|
|
1294
|
-
----------
|
|
1295
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
|
1296
|
-
Event dependency for this flow.
|
|
1297
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
|
1298
|
-
Events dependency for this flow.
|
|
1299
|
-
options : Dict[str, Any], default {}
|
|
1300
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
1301
|
-
"""
|
|
1302
|
-
...
|
|
1303
|
-
|
|
1304
|
-
@typing.overload
|
|
1305
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1306
|
-
...
|
|
1307
|
-
|
|
1308
|
-
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] = {}):
|
|
1309
|
-
"""
|
|
1310
|
-
Specifies the event(s) that this flow depends on.
|
|
1311
|
-
|
|
1312
|
-
```
|
|
1313
|
-
@trigger(event='foo')
|
|
1314
|
-
```
|
|
1315
|
-
or
|
|
1316
|
-
```
|
|
1317
|
-
@trigger(events=['foo', 'bar'])
|
|
1318
|
-
```
|
|
1319
|
-
|
|
1320
|
-
Additionally, you can specify the parameter mappings
|
|
1321
|
-
to map event payload to Metaflow parameters for the flow.
|
|
1322
|
-
```
|
|
1323
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1324
|
-
```
|
|
1325
|
-
or
|
|
1326
|
-
```
|
|
1327
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1328
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1329
|
-
```
|
|
1330
|
-
|
|
1331
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
1332
|
-
```
|
|
1333
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1334
|
-
```
|
|
1335
|
-
This is equivalent to:
|
|
1336
|
-
```
|
|
1337
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1338
|
-
```
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
Parameters
|
|
1342
|
-
----------
|
|
1343
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
|
1344
|
-
Event dependency for this flow.
|
|
1345
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
|
1346
|
-
Events dependency for this flow.
|
|
1347
|
-
options : Dict[str, Any], default {}
|
|
1348
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
1349
|
-
"""
|
|
1350
|
-
...
|
|
1351
|
-
|