metaflow-stubs 2.15.11__py2.py3-none-any.whl → 2.15.13__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +657 -657
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +2 -2
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +24 -24
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +12 -12
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_decorator.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- 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 +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +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 +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +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 +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +6 -6
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +3 -3
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.15.11.dist-info → metaflow_stubs-2.15.13.dist-info}/METADATA +2 -2
- metaflow_stubs-2.15.13.dist-info/RECORD +149 -0
- {metaflow_stubs-2.15.11.dist-info → metaflow_stubs-2.15.13.dist-info}/WHEEL +1 -1
- metaflow_stubs-2.15.11.dist-info/RECORD +0 -149
- {metaflow_stubs-2.15.11.dist-info → metaflow_stubs-2.15.13.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.15.
|
4
|
-
# Generated on 2025-05-
|
3
|
+
# MF version: 2.15.13 #
|
4
|
+
# Generated on 2025-05-20T18:34:43.119385 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -35,16 +35,16 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import metaflow_git as metaflow_git
|
39
38
|
from . import tuple_util as tuple_util
|
39
|
+
from . import metaflow_git as metaflow_git
|
40
40
|
from . import events as events
|
41
41
|
from . import runner as runner
|
42
42
|
from . import plugins as plugins
|
43
43
|
from .plugins.datatools.s3.s3 import S3 as S3
|
44
44
|
from . import includefile as includefile
|
45
45
|
from .includefile import IncludeFile as IncludeFile
|
46
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
47
46
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
47
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
48
48
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
49
|
from . import cards as cards
|
50
50
|
from . import client as client
|
@@ -147,153 +147,465 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
147
147
|
...
|
148
148
|
|
149
149
|
@typing.overload
|
150
|
-
def
|
150
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
151
151
|
"""
|
152
|
-
Specifies
|
153
|
-
|
154
|
-
The decorator will create an optional artifact, specified by `var`, which
|
155
|
-
contains the exception raised. You can use it to detect the presence
|
156
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
157
|
-
are missing.
|
152
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
153
|
+
the execution of a step.
|
158
154
|
|
159
155
|
|
160
156
|
Parameters
|
161
157
|
----------
|
162
|
-
|
163
|
-
|
164
|
-
If not specified, the exception is not stored.
|
165
|
-
print_exception : bool, default True
|
166
|
-
Determines whether or not the exception is printed to
|
167
|
-
stdout when caught.
|
158
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
159
|
+
List of secret specs, defining how the secrets are to be retrieved
|
168
160
|
"""
|
169
161
|
...
|
170
162
|
|
171
163
|
@typing.overload
|
172
|
-
def
|
164
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
173
165
|
...
|
174
166
|
|
175
167
|
@typing.overload
|
176
|
-
def
|
168
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
177
169
|
...
|
178
170
|
|
179
|
-
def
|
171
|
+
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]]] = []):
|
180
172
|
"""
|
181
|
-
Specifies
|
182
|
-
|
183
|
-
The decorator will create an optional artifact, specified by `var`, which
|
184
|
-
contains the exception raised. You can use it to detect the presence
|
185
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
186
|
-
are missing.
|
173
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
174
|
+
the execution of a step.
|
187
175
|
|
188
176
|
|
189
177
|
Parameters
|
190
178
|
----------
|
191
|
-
|
192
|
-
|
193
|
-
If not specified, the exception is not stored.
|
194
|
-
print_exception : bool, default True
|
195
|
-
Determines whether or not the exception is printed to
|
196
|
-
stdout when caught.
|
179
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
180
|
+
List of secret specs, defining how the secrets are to be retrieved
|
197
181
|
"""
|
198
182
|
...
|
199
183
|
|
200
184
|
@typing.overload
|
201
|
-
def
|
185
|
+
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
202
186
|
"""
|
203
|
-
Specifies
|
187
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
204
188
|
|
205
189
|
|
206
190
|
Parameters
|
207
191
|
----------
|
208
|
-
|
209
|
-
|
192
|
+
cpu : int, default 1
|
193
|
+
Number of CPUs required for this step. If `@resources` is
|
194
|
+
also present, the maximum value from all decorators is used.
|
195
|
+
gpu : int, default 0
|
196
|
+
Number of GPUs required for this step. If `@resources` is
|
197
|
+
also present, the maximum value from all decorators is used.
|
198
|
+
memory : int, default 4096
|
199
|
+
Memory size (in MB) required for this step. If
|
200
|
+
`@resources` is also present, the maximum value from all decorators is
|
201
|
+
used.
|
202
|
+
image : str, optional, default None
|
203
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
204
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
205
|
+
not, a default Docker image mapping to the current version of Python is used.
|
206
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
207
|
+
AWS Batch Job Queue to submit the job to.
|
208
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
209
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
210
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
211
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
212
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
213
|
+
shared_memory : int, optional, default None
|
214
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
215
|
+
This parameter maps to the `--shm-size` option in Docker.
|
216
|
+
max_swap : int, optional, default None
|
217
|
+
The total amount of swap memory (in MiB) a container can use for this
|
218
|
+
step. This parameter is translated to the `--memory-swap` option in
|
219
|
+
Docker where the value is the sum of the container memory plus the
|
220
|
+
`max_swap` value.
|
221
|
+
swappiness : int, optional, default None
|
222
|
+
This allows you to tune memory swappiness behavior for this step.
|
223
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
224
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
225
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
226
|
+
use_tmpfs : bool, default False
|
227
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
228
|
+
not available on Fargate compute environments
|
229
|
+
tmpfs_tempdir : bool, default True
|
230
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
231
|
+
tmpfs_size : int, optional, default None
|
232
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
233
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
234
|
+
memory allocated for this step.
|
235
|
+
tmpfs_path : str, optional, default None
|
236
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
237
|
+
inferentia : int, default 0
|
238
|
+
Number of Inferentia chips required for this step.
|
239
|
+
trainium : int, default None
|
240
|
+
Alias for inferentia. Use only one of the two.
|
241
|
+
efa : int, default 0
|
242
|
+
Number of elastic fabric adapter network devices to attach to container
|
243
|
+
ephemeral_storage : int, default None
|
244
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
245
|
+
This is only relevant for Fargate compute environments
|
246
|
+
log_driver: str, optional, default None
|
247
|
+
The log driver to use for the Amazon ECS container.
|
248
|
+
log_options: List[str], optional, default None
|
249
|
+
List of strings containing options for the chosen log driver. The configurable values
|
250
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
251
|
+
Example: [`awslogs-group:aws/batch/job`]
|
210
252
|
"""
|
211
253
|
...
|
212
254
|
|
213
255
|
@typing.overload
|
214
|
-
def
|
256
|
+
def batch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
215
257
|
...
|
216
258
|
|
217
259
|
@typing.overload
|
218
|
-
def
|
260
|
+
def batch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
219
261
|
...
|
220
262
|
|
221
|
-
def
|
263
|
+
def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None):
|
222
264
|
"""
|
223
|
-
Specifies
|
265
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
224
266
|
|
225
267
|
|
226
268
|
Parameters
|
227
269
|
----------
|
228
|
-
|
229
|
-
|
270
|
+
cpu : int, default 1
|
271
|
+
Number of CPUs required for this step. If `@resources` is
|
272
|
+
also present, the maximum value from all decorators is used.
|
273
|
+
gpu : int, default 0
|
274
|
+
Number of GPUs required for this step. If `@resources` is
|
275
|
+
also present, the maximum value from all decorators is used.
|
276
|
+
memory : int, default 4096
|
277
|
+
Memory size (in MB) required for this step. If
|
278
|
+
`@resources` is also present, the maximum value from all decorators is
|
279
|
+
used.
|
280
|
+
image : str, optional, default None
|
281
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
282
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
283
|
+
not, a default Docker image mapping to the current version of Python is used.
|
284
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
285
|
+
AWS Batch Job Queue to submit the job to.
|
286
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
287
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
288
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
289
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
290
|
+
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
291
|
+
shared_memory : int, optional, default None
|
292
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
293
|
+
This parameter maps to the `--shm-size` option in Docker.
|
294
|
+
max_swap : int, optional, default None
|
295
|
+
The total amount of swap memory (in MiB) a container can use for this
|
296
|
+
step. This parameter is translated to the `--memory-swap` option in
|
297
|
+
Docker where the value is the sum of the container memory plus the
|
298
|
+
`max_swap` value.
|
299
|
+
swappiness : int, optional, default None
|
300
|
+
This allows you to tune memory swappiness behavior for this step.
|
301
|
+
A swappiness value of 0 causes swapping not to happen unless absolutely
|
302
|
+
necessary. A swappiness value of 100 causes pages to be swapped very
|
303
|
+
aggressively. Accepted values are whole numbers between 0 and 100.
|
304
|
+
use_tmpfs : bool, default False
|
305
|
+
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
306
|
+
not available on Fargate compute environments
|
307
|
+
tmpfs_tempdir : bool, default True
|
308
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
309
|
+
tmpfs_size : int, optional, default None
|
310
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
311
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
312
|
+
memory allocated for this step.
|
313
|
+
tmpfs_path : str, optional, default None
|
314
|
+
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
315
|
+
inferentia : int, default 0
|
316
|
+
Number of Inferentia chips required for this step.
|
317
|
+
trainium : int, default None
|
318
|
+
Alias for inferentia. Use only one of the two.
|
319
|
+
efa : int, default 0
|
320
|
+
Number of elastic fabric adapter network devices to attach to container
|
321
|
+
ephemeral_storage : int, default None
|
322
|
+
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
323
|
+
This is only relevant for Fargate compute environments
|
324
|
+
log_driver: str, optional, default None
|
325
|
+
The log driver to use for the Amazon ECS container.
|
326
|
+
log_options: List[str], optional, default None
|
327
|
+
List of strings containing options for the chosen log driver. The configurable values
|
328
|
+
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
329
|
+
Example: [`awslogs-group:aws/batch/job`]
|
230
330
|
"""
|
231
331
|
...
|
232
332
|
|
233
333
|
@typing.overload
|
234
|
-
def
|
334
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
235
335
|
"""
|
236
|
-
Specifies the
|
237
|
-
to a step needs to be retried.
|
238
|
-
|
239
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
240
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
241
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
336
|
+
Specifies the Conda environment for the step.
|
242
337
|
|
243
|
-
|
244
|
-
|
245
|
-
|
338
|
+
Information in this decorator will augment any
|
339
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
340
|
+
you can use `@conda_base` to set packages required by all
|
341
|
+
steps and use `@conda` to specify step-specific overrides.
|
246
342
|
|
247
343
|
|
248
344
|
Parameters
|
249
345
|
----------
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
346
|
+
packages : Dict[str, str], default {}
|
347
|
+
Packages to use for this step. The key is the name of the package
|
348
|
+
and the value is the version to use.
|
349
|
+
libraries : Dict[str, str], default {}
|
350
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
351
|
+
python : str, optional, default None
|
352
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
353
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
354
|
+
disabled : bool, default False
|
355
|
+
If set to True, disables @conda.
|
254
356
|
"""
|
255
357
|
...
|
256
358
|
|
257
359
|
@typing.overload
|
258
|
-
def
|
360
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
259
361
|
...
|
260
362
|
|
261
363
|
@typing.overload
|
262
|
-
def
|
364
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
263
365
|
...
|
264
366
|
|
265
|
-
def
|
367
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
266
368
|
"""
|
267
|
-
Specifies the
|
268
|
-
to a step needs to be retried.
|
269
|
-
|
270
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
271
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
272
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
369
|
+
Specifies the Conda environment for the step.
|
273
370
|
|
274
|
-
|
275
|
-
|
276
|
-
|
371
|
+
Information in this decorator will augment any
|
372
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
373
|
+
you can use `@conda_base` to set packages required by all
|
374
|
+
steps and use `@conda` to specify step-specific overrides.
|
277
375
|
|
278
376
|
|
279
377
|
Parameters
|
280
378
|
----------
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
|
379
|
+
packages : Dict[str, str], default {}
|
380
|
+
Packages to use for this step. The key is the name of the package
|
381
|
+
and the value is the version to use.
|
382
|
+
libraries : Dict[str, str], default {}
|
383
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
384
|
+
python : str, optional, default None
|
385
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
386
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
387
|
+
disabled : bool, default False
|
388
|
+
If set to True, disables @conda.
|
285
389
|
"""
|
286
390
|
...
|
287
391
|
|
288
|
-
|
392
|
+
@typing.overload
|
393
|
+
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]]]:
|
289
394
|
"""
|
290
|
-
Specifies that
|
395
|
+
Specifies that the step will success under all circumstances.
|
396
|
+
|
397
|
+
The decorator will create an optional artifact, specified by `var`, which
|
398
|
+
contains the exception raised. You can use it to detect the presence
|
399
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
400
|
+
are missing.
|
291
401
|
|
292
402
|
|
293
403
|
Parameters
|
294
404
|
----------
|
295
|
-
|
296
|
-
|
405
|
+
var : str, optional, default None
|
406
|
+
Name of the artifact in which to store the caught exception.
|
407
|
+
If not specified, the exception is not stored.
|
408
|
+
print_exception : bool, default True
|
409
|
+
Determines whether or not the exception is printed to
|
410
|
+
stdout when caught.
|
411
|
+
"""
|
412
|
+
...
|
413
|
+
|
414
|
+
@typing.overload
|
415
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
416
|
+
...
|
417
|
+
|
418
|
+
@typing.overload
|
419
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
420
|
+
...
|
421
|
+
|
422
|
+
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):
|
423
|
+
"""
|
424
|
+
Specifies that the step will success under all circumstances.
|
425
|
+
|
426
|
+
The decorator will create an optional artifact, specified by `var`, which
|
427
|
+
contains the exception raised. You can use it to detect the presence
|
428
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
429
|
+
are missing.
|
430
|
+
|
431
|
+
|
432
|
+
Parameters
|
433
|
+
----------
|
434
|
+
var : str, optional, default None
|
435
|
+
Name of the artifact in which to store the caught exception.
|
436
|
+
If not specified, the exception is not stored.
|
437
|
+
print_exception : bool, default True
|
438
|
+
Determines whether or not the exception is printed to
|
439
|
+
stdout when caught.
|
440
|
+
"""
|
441
|
+
...
|
442
|
+
|
443
|
+
@typing.overload
|
444
|
+
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]]]:
|
445
|
+
"""
|
446
|
+
Specifies the resources needed when executing this step.
|
447
|
+
|
448
|
+
Use `@resources` to specify the resource requirements
|
449
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
450
|
+
|
451
|
+
You can choose the compute layer on the command line by executing e.g.
|
452
|
+
```
|
453
|
+
python myflow.py run --with batch
|
454
|
+
```
|
455
|
+
or
|
456
|
+
```
|
457
|
+
python myflow.py run --with kubernetes
|
458
|
+
```
|
459
|
+
which executes the flow on the desired system using the
|
460
|
+
requirements specified in `@resources`.
|
461
|
+
|
462
|
+
|
463
|
+
Parameters
|
464
|
+
----------
|
465
|
+
cpu : int, default 1
|
466
|
+
Number of CPUs required for this step.
|
467
|
+
gpu : int, optional, default None
|
468
|
+
Number of GPUs required for this step.
|
469
|
+
disk : int, optional, default None
|
470
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
471
|
+
memory : int, default 4096
|
472
|
+
Memory size (in MB) required for this step.
|
473
|
+
shared_memory : int, optional, default None
|
474
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
475
|
+
This parameter maps to the `--shm-size` option in Docker.
|
476
|
+
"""
|
477
|
+
...
|
478
|
+
|
479
|
+
@typing.overload
|
480
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
481
|
+
...
|
482
|
+
|
483
|
+
@typing.overload
|
484
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
485
|
+
...
|
486
|
+
|
487
|
+
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):
|
488
|
+
"""
|
489
|
+
Specifies the resources needed when executing this step.
|
490
|
+
|
491
|
+
Use `@resources` to specify the resource requirements
|
492
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
493
|
+
|
494
|
+
You can choose the compute layer on the command line by executing e.g.
|
495
|
+
```
|
496
|
+
python myflow.py run --with batch
|
497
|
+
```
|
498
|
+
or
|
499
|
+
```
|
500
|
+
python myflow.py run --with kubernetes
|
501
|
+
```
|
502
|
+
which executes the flow on the desired system using the
|
503
|
+
requirements specified in `@resources`.
|
504
|
+
|
505
|
+
|
506
|
+
Parameters
|
507
|
+
----------
|
508
|
+
cpu : int, default 1
|
509
|
+
Number of CPUs required for this step.
|
510
|
+
gpu : int, optional, default None
|
511
|
+
Number of GPUs required for this step.
|
512
|
+
disk : int, optional, default None
|
513
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
514
|
+
memory : int, default 4096
|
515
|
+
Memory size (in MB) required for this step.
|
516
|
+
shared_memory : int, optional, default None
|
517
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
518
|
+
This parameter maps to the `--shm-size` option in Docker.
|
519
|
+
"""
|
520
|
+
...
|
521
|
+
|
522
|
+
@typing.overload
|
523
|
+
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]]]:
|
524
|
+
"""
|
525
|
+
Specifies a timeout for your step.
|
526
|
+
|
527
|
+
This decorator is useful if this step may hang indefinitely.
|
528
|
+
|
529
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
530
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
531
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
532
|
+
|
533
|
+
Note that all the values specified in parameters are added together so if you specify
|
534
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
535
|
+
|
536
|
+
|
537
|
+
Parameters
|
538
|
+
----------
|
539
|
+
seconds : int, default 0
|
540
|
+
Number of seconds to wait prior to timing out.
|
541
|
+
minutes : int, default 0
|
542
|
+
Number of minutes to wait prior to timing out.
|
543
|
+
hours : int, default 0
|
544
|
+
Number of hours to wait prior to timing out.
|
545
|
+
"""
|
546
|
+
...
|
547
|
+
|
548
|
+
@typing.overload
|
549
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
550
|
+
...
|
551
|
+
|
552
|
+
@typing.overload
|
553
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
554
|
+
...
|
555
|
+
|
556
|
+
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):
|
557
|
+
"""
|
558
|
+
Specifies a timeout for your step.
|
559
|
+
|
560
|
+
This decorator is useful if this step may hang indefinitely.
|
561
|
+
|
562
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
563
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
564
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
565
|
+
|
566
|
+
Note that all the values specified in parameters are added together so if you specify
|
567
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
568
|
+
|
569
|
+
|
570
|
+
Parameters
|
571
|
+
----------
|
572
|
+
seconds : int, default 0
|
573
|
+
Number of seconds to wait prior to timing out.
|
574
|
+
minutes : int, default 0
|
575
|
+
Number of minutes to wait prior to timing out.
|
576
|
+
hours : int, default 0
|
577
|
+
Number of hours to wait prior to timing out.
|
578
|
+
"""
|
579
|
+
...
|
580
|
+
|
581
|
+
@typing.overload
|
582
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
583
|
+
"""
|
584
|
+
Decorator prototype for all step decorators. This function gets specialized
|
585
|
+
and imported for all decorators types by _import_plugin_decorators().
|
586
|
+
"""
|
587
|
+
...
|
588
|
+
|
589
|
+
@typing.overload
|
590
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
591
|
+
...
|
592
|
+
|
593
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
594
|
+
"""
|
595
|
+
Decorator prototype for all step decorators. This function gets specialized
|
596
|
+
and imported for all decorators types by _import_plugin_decorators().
|
597
|
+
"""
|
598
|
+
...
|
599
|
+
|
600
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', 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]]]:
|
601
|
+
"""
|
602
|
+
Specifies that this step should execute on Kubernetes.
|
603
|
+
|
604
|
+
|
605
|
+
Parameters
|
606
|
+
----------
|
607
|
+
cpu : int, default 1
|
608
|
+
Number of CPUs required for this step. If `@resources` is
|
297
609
|
also present, the maximum value from all decorators is used.
|
298
610
|
memory : int, default 4096
|
299
611
|
Memory size (in MB) required for this step. If
|
@@ -371,202 +683,90 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
371
683
|
...
|
372
684
|
|
373
685
|
@typing.overload
|
374
|
-
def
|
686
|
+
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]]]:
|
375
687
|
"""
|
376
|
-
Specifies
|
377
|
-
|
378
|
-
Information in this decorator will augment any
|
379
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
380
|
-
you can use `@pypi_base` to set packages required by all
|
381
|
-
steps and use `@pypi` to specify step-specific overrides.
|
688
|
+
Specifies environment variables to be set prior to the execution of a step.
|
382
689
|
|
383
690
|
|
384
691
|
Parameters
|
385
692
|
----------
|
386
|
-
|
387
|
-
|
388
|
-
and the value is the version to use.
|
389
|
-
python : str, optional, default: None
|
390
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
391
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
693
|
+
vars : Dict[str, str], default {}
|
694
|
+
Dictionary of environment variables to set.
|
392
695
|
"""
|
393
696
|
...
|
394
697
|
|
395
698
|
@typing.overload
|
396
|
-
def
|
699
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
397
700
|
...
|
398
701
|
|
399
702
|
@typing.overload
|
400
|
-
def
|
703
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
401
704
|
...
|
402
705
|
|
403
|
-
def
|
706
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
404
707
|
"""
|
405
|
-
Specifies
|
406
|
-
|
407
|
-
Information in this decorator will augment any
|
408
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
409
|
-
you can use `@pypi_base` to set packages required by all
|
410
|
-
steps and use `@pypi` to specify step-specific overrides.
|
708
|
+
Specifies environment variables to be set prior to the execution of a step.
|
411
709
|
|
412
710
|
|
413
711
|
Parameters
|
414
712
|
----------
|
415
|
-
|
416
|
-
|
417
|
-
and the value is the version to use.
|
418
|
-
python : str, optional, default: None
|
419
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
420
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
713
|
+
vars : Dict[str, str], default {}
|
714
|
+
Dictionary of environment variables to set.
|
421
715
|
"""
|
422
716
|
...
|
423
717
|
|
424
718
|
@typing.overload
|
425
|
-
def
|
719
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
426
720
|
"""
|
427
|
-
Specifies
|
721
|
+
Specifies the number of times the task corresponding
|
722
|
+
to a step needs to be retried.
|
723
|
+
|
724
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
725
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
726
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
727
|
+
|
728
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
729
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
730
|
+
ensuring that the flow execution can continue.
|
428
731
|
|
429
732
|
|
430
733
|
Parameters
|
431
734
|
----------
|
432
|
-
|
433
|
-
Number of
|
434
|
-
|
435
|
-
|
436
|
-
Number of GPUs required for this step. If `@resources` is
|
437
|
-
also present, the maximum value from all decorators is used.
|
438
|
-
memory : int, default 4096
|
439
|
-
Memory size (in MB) required for this step. If
|
440
|
-
`@resources` is also present, the maximum value from all decorators is
|
441
|
-
used.
|
442
|
-
image : str, optional, default None
|
443
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
444
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
445
|
-
not, a default Docker image mapping to the current version of Python is used.
|
446
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
447
|
-
AWS Batch Job Queue to submit the job to.
|
448
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
449
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
450
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
451
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
452
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
453
|
-
shared_memory : int, optional, default None
|
454
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
455
|
-
This parameter maps to the `--shm-size` option in Docker.
|
456
|
-
max_swap : int, optional, default None
|
457
|
-
The total amount of swap memory (in MiB) a container can use for this
|
458
|
-
step. This parameter is translated to the `--memory-swap` option in
|
459
|
-
Docker where the value is the sum of the container memory plus the
|
460
|
-
`max_swap` value.
|
461
|
-
swappiness : int, optional, default None
|
462
|
-
This allows you to tune memory swappiness behavior for this step.
|
463
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
464
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
465
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
466
|
-
use_tmpfs : bool, default False
|
467
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
468
|
-
not available on Fargate compute environments
|
469
|
-
tmpfs_tempdir : bool, default True
|
470
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
471
|
-
tmpfs_size : int, optional, default None
|
472
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
473
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
474
|
-
memory allocated for this step.
|
475
|
-
tmpfs_path : str, optional, default None
|
476
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
477
|
-
inferentia : int, default 0
|
478
|
-
Number of Inferentia chips required for this step.
|
479
|
-
trainium : int, default None
|
480
|
-
Alias for inferentia. Use only one of the two.
|
481
|
-
efa : int, default 0
|
482
|
-
Number of elastic fabric adapter network devices to attach to container
|
483
|
-
ephemeral_storage : int, default None
|
484
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
485
|
-
This is only relevant for Fargate compute environments
|
486
|
-
log_driver: str, optional, default None
|
487
|
-
The log driver to use for the Amazon ECS container.
|
488
|
-
log_options: List[str], optional, default None
|
489
|
-
List of strings containing options for the chosen log driver. The configurable values
|
490
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
491
|
-
Example: [`awslogs-group:aws/batch/job`]
|
735
|
+
times : int, default 3
|
736
|
+
Number of times to retry this task.
|
737
|
+
minutes_between_retries : int, default 2
|
738
|
+
Number of minutes between retries.
|
492
739
|
"""
|
493
740
|
...
|
494
741
|
|
495
742
|
@typing.overload
|
496
|
-
def
|
743
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
497
744
|
...
|
498
745
|
|
499
746
|
@typing.overload
|
500
|
-
def
|
747
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
501
748
|
...
|
502
749
|
|
503
|
-
def
|
750
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
504
751
|
"""
|
505
|
-
Specifies
|
752
|
+
Specifies the number of times the task corresponding
|
753
|
+
to a step needs to be retried.
|
754
|
+
|
755
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
756
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
757
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
758
|
+
|
759
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
760
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
761
|
+
ensuring that the flow execution can continue.
|
506
762
|
|
507
763
|
|
508
764
|
Parameters
|
509
765
|
----------
|
510
|
-
|
511
|
-
Number of
|
512
|
-
|
513
|
-
|
514
|
-
Number of GPUs required for this step. If `@resources` is
|
515
|
-
also present, the maximum value from all decorators is used.
|
516
|
-
memory : int, default 4096
|
517
|
-
Memory size (in MB) required for this step. If
|
518
|
-
`@resources` is also present, the maximum value from all decorators is
|
519
|
-
used.
|
520
|
-
image : str, optional, default None
|
521
|
-
Docker image to use when launching on AWS Batch. If not specified, and
|
522
|
-
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
523
|
-
not, a default Docker image mapping to the current version of Python is used.
|
524
|
-
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
525
|
-
AWS Batch Job Queue to submit the job to.
|
526
|
-
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
527
|
-
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
528
|
-
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
529
|
-
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
530
|
-
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
531
|
-
shared_memory : int, optional, default None
|
532
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
533
|
-
This parameter maps to the `--shm-size` option in Docker.
|
534
|
-
max_swap : int, optional, default None
|
535
|
-
The total amount of swap memory (in MiB) a container can use for this
|
536
|
-
step. This parameter is translated to the `--memory-swap` option in
|
537
|
-
Docker where the value is the sum of the container memory plus the
|
538
|
-
`max_swap` value.
|
539
|
-
swappiness : int, optional, default None
|
540
|
-
This allows you to tune memory swappiness behavior for this step.
|
541
|
-
A swappiness value of 0 causes swapping not to happen unless absolutely
|
542
|
-
necessary. A swappiness value of 100 causes pages to be swapped very
|
543
|
-
aggressively. Accepted values are whole numbers between 0 and 100.
|
544
|
-
use_tmpfs : bool, default False
|
545
|
-
This enables an explicit tmpfs mount for this step. Note that tmpfs is
|
546
|
-
not available on Fargate compute environments
|
547
|
-
tmpfs_tempdir : bool, default True
|
548
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
549
|
-
tmpfs_size : int, optional, default None
|
550
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
551
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
552
|
-
memory allocated for this step.
|
553
|
-
tmpfs_path : str, optional, default None
|
554
|
-
Path to tmpfs mount for this step. Defaults to /metaflow_temp.
|
555
|
-
inferentia : int, default 0
|
556
|
-
Number of Inferentia chips required for this step.
|
557
|
-
trainium : int, default None
|
558
|
-
Alias for inferentia. Use only one of the two.
|
559
|
-
efa : int, default 0
|
560
|
-
Number of elastic fabric adapter network devices to attach to container
|
561
|
-
ephemeral_storage : int, default None
|
562
|
-
The total amount, in GiB, of ephemeral storage to set for the task, 21-200GiB.
|
563
|
-
This is only relevant for Fargate compute environments
|
564
|
-
log_driver: str, optional, default None
|
565
|
-
The log driver to use for the Amazon ECS container.
|
566
|
-
log_options: List[str], optional, default None
|
567
|
-
List of strings containing options for the chosen log driver. The configurable values
|
568
|
-
depend on the `log driver` chosen. Validation of these options is not supported yet.
|
569
|
-
Example: [`awslogs-group:aws/batch/job`]
|
766
|
+
times : int, default 3
|
767
|
+
Number of times to retry this task.
|
768
|
+
minutes_between_retries : int, default 2
|
769
|
+
Number of minutes between retries.
|
570
770
|
"""
|
571
771
|
...
|
572
772
|
|
@@ -620,304 +820,230 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
620
820
|
...
|
621
821
|
|
622
822
|
@typing.overload
|
623
|
-
def
|
823
|
+
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]]]:
|
624
824
|
"""
|
625
|
-
|
626
|
-
|
825
|
+
Specifies the PyPI packages for the step.
|
826
|
+
|
827
|
+
Information in this decorator will augment any
|
828
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
829
|
+
you can use `@pypi_base` to set packages required by all
|
830
|
+
steps and use `@pypi` to specify step-specific overrides.
|
831
|
+
|
832
|
+
|
833
|
+
Parameters
|
834
|
+
----------
|
835
|
+
packages : Dict[str, str], default: {}
|
836
|
+
Packages to use for this step. The key is the name of the package
|
837
|
+
and the value is the version to use.
|
838
|
+
python : str, optional, default: None
|
839
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
840
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
627
841
|
"""
|
628
842
|
...
|
629
843
|
|
630
844
|
@typing.overload
|
631
|
-
def
|
845
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
632
846
|
...
|
633
847
|
|
634
|
-
|
848
|
+
@typing.overload
|
849
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
850
|
+
...
|
851
|
+
|
852
|
+
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):
|
635
853
|
"""
|
636
|
-
|
637
|
-
|
854
|
+
Specifies the PyPI packages for the step.
|
855
|
+
|
856
|
+
Information in this decorator will augment any
|
857
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
858
|
+
you can use `@pypi_base` to set packages required by all
|
859
|
+
steps and use `@pypi` to specify step-specific overrides.
|
860
|
+
|
861
|
+
|
862
|
+
Parameters
|
863
|
+
----------
|
864
|
+
packages : Dict[str, str], default: {}
|
865
|
+
Packages to use for this step. The key is the name of the package
|
866
|
+
and the value is the version to use.
|
867
|
+
python : str, optional, default: None
|
868
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
869
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
638
870
|
"""
|
639
871
|
...
|
640
872
|
|
641
873
|
@typing.overload
|
642
|
-
def
|
874
|
+
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]]:
|
643
875
|
"""
|
644
|
-
Specifies the
|
876
|
+
Specifies the event(s) that this flow depends on.
|
645
877
|
|
646
|
-
|
647
|
-
|
878
|
+
```
|
879
|
+
@trigger(event='foo')
|
880
|
+
```
|
881
|
+
or
|
882
|
+
```
|
883
|
+
@trigger(events=['foo', 'bar'])
|
884
|
+
```
|
648
885
|
|
649
|
-
|
886
|
+
Additionally, you can specify the parameter mappings
|
887
|
+
to map event payload to Metaflow parameters for the flow.
|
650
888
|
```
|
651
|
-
|
889
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
652
890
|
```
|
653
891
|
or
|
654
892
|
```
|
655
|
-
|
893
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
894
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
895
|
+
```
|
896
|
+
|
897
|
+
'parameters' can also be a list of strings and tuples like so:
|
898
|
+
```
|
899
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
900
|
+
```
|
901
|
+
This is equivalent to:
|
902
|
+
```
|
903
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
656
904
|
```
|
657
|
-
which executes the flow on the desired system using the
|
658
|
-
requirements specified in `@resources`.
|
659
905
|
|
660
906
|
|
661
907
|
Parameters
|
662
908
|
----------
|
663
|
-
|
664
|
-
|
665
|
-
|
666
|
-
|
667
|
-
|
668
|
-
|
669
|
-
memory : int, default 4096
|
670
|
-
Memory size (in MB) required for this step.
|
671
|
-
shared_memory : int, optional, default None
|
672
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
673
|
-
This parameter maps to the `--shm-size` option in Docker.
|
909
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
910
|
+
Event dependency for this flow.
|
911
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
912
|
+
Events dependency for this flow.
|
913
|
+
options : Dict[str, Any], default {}
|
914
|
+
Backend-specific configuration for tuning eventing behavior.
|
674
915
|
"""
|
675
916
|
...
|
676
917
|
|
677
918
|
@typing.overload
|
678
|
-
def
|
679
|
-
...
|
680
|
-
|
681
|
-
@typing.overload
|
682
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
919
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
683
920
|
...
|
684
921
|
|
685
|
-
def
|
922
|
+
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] = {}):
|
686
923
|
"""
|
687
|
-
Specifies the
|
688
|
-
|
689
|
-
Use `@resources` to specify the resource requirements
|
690
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
924
|
+
Specifies the event(s) that this flow depends on.
|
691
925
|
|
692
|
-
You can choose the compute layer on the command line by executing e.g.
|
693
926
|
```
|
694
|
-
|
927
|
+
@trigger(event='foo')
|
695
928
|
```
|
696
929
|
or
|
697
930
|
```
|
698
|
-
|
931
|
+
@trigger(events=['foo', 'bar'])
|
932
|
+
```
|
933
|
+
|
934
|
+
Additionally, you can specify the parameter mappings
|
935
|
+
to map event payload to Metaflow parameters for the flow.
|
936
|
+
```
|
937
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
938
|
+
```
|
939
|
+
or
|
940
|
+
```
|
941
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
942
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
943
|
+
```
|
944
|
+
|
945
|
+
'parameters' can also be a list of strings and tuples like so:
|
946
|
+
```
|
947
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
948
|
+
```
|
949
|
+
This is equivalent to:
|
950
|
+
```
|
951
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
699
952
|
```
|
700
|
-
which executes the flow on the desired system using the
|
701
|
-
requirements specified in `@resources`.
|
702
953
|
|
703
954
|
|
704
955
|
Parameters
|
705
956
|
----------
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
memory : int, default 4096
|
713
|
-
Memory size (in MB) required for this step.
|
714
|
-
shared_memory : int, optional, default None
|
715
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
716
|
-
This parameter maps to the `--shm-size` option in Docker.
|
957
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
958
|
+
Event dependency for this flow.
|
959
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
960
|
+
Events dependency for this flow.
|
961
|
+
options : Dict[str, Any], default {}
|
962
|
+
Backend-specific configuration for tuning eventing behavior.
|
717
963
|
"""
|
718
964
|
...
|
719
965
|
|
720
966
|
@typing.overload
|
721
|
-
def
|
967
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
722
968
|
"""
|
723
|
-
Specifies the
|
724
|
-
|
725
|
-
Information in this decorator will augment any
|
726
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
727
|
-
you can use `@conda_base` to set packages required by all
|
728
|
-
steps and use `@conda` to specify step-specific overrides.
|
969
|
+
Specifies the PyPI packages for all steps of the flow.
|
729
970
|
|
971
|
+
Use `@pypi_base` to set common packages required by all
|
972
|
+
steps and use `@pypi` to specify step-specific overrides.
|
730
973
|
|
731
974
|
Parameters
|
732
975
|
----------
|
733
|
-
packages : Dict[str, str], default {}
|
734
|
-
Packages to use for this
|
976
|
+
packages : Dict[str, str], default: {}
|
977
|
+
Packages to use for this flow. The key is the name of the package
|
735
978
|
and the value is the version to use.
|
736
|
-
|
737
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
738
|
-
python : str, optional, default None
|
979
|
+
python : str, optional, default: None
|
739
980
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
740
981
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
741
|
-
disabled : bool, default False
|
742
|
-
If set to True, disables @conda.
|
743
982
|
"""
|
744
983
|
...
|
745
984
|
|
746
985
|
@typing.overload
|
747
|
-
def
|
748
|
-
...
|
749
|
-
|
750
|
-
@typing.overload
|
751
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
986
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
752
987
|
...
|
753
988
|
|
754
|
-
def
|
989
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
755
990
|
"""
|
756
|
-
Specifies the
|
757
|
-
|
758
|
-
Information in this decorator will augment any
|
759
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
760
|
-
you can use `@conda_base` to set packages required by all
|
761
|
-
steps and use `@conda` to specify step-specific overrides.
|
991
|
+
Specifies the PyPI packages for all steps of the flow.
|
762
992
|
|
993
|
+
Use `@pypi_base` to set common packages required by all
|
994
|
+
steps and use `@pypi` to specify step-specific overrides.
|
763
995
|
|
764
996
|
Parameters
|
765
997
|
----------
|
766
|
-
packages : Dict[str, str], default {}
|
767
|
-
Packages to use for this
|
998
|
+
packages : Dict[str, str], default: {}
|
999
|
+
Packages to use for this flow. The key is the name of the package
|
768
1000
|
and the value is the version to use.
|
769
|
-
|
770
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
771
|
-
python : str, optional, default None
|
1001
|
+
python : str, optional, default: None
|
772
1002
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
773
1003
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
774
|
-
disabled : bool, default False
|
775
|
-
If set to True, disables @conda.
|
776
|
-
"""
|
777
|
-
...
|
778
|
-
|
779
|
-
@typing.overload
|
780
|
-
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]]]:
|
781
|
-
"""
|
782
|
-
Specifies a timeout for your step.
|
783
|
-
|
784
|
-
This decorator is useful if this step may hang indefinitely.
|
785
|
-
|
786
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
787
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
788
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
789
|
-
|
790
|
-
Note that all the values specified in parameters are added together so if you specify
|
791
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
792
|
-
|
793
|
-
|
794
|
-
Parameters
|
795
|
-
----------
|
796
|
-
seconds : int, default 0
|
797
|
-
Number of seconds to wait prior to timing out.
|
798
|
-
minutes : int, default 0
|
799
|
-
Number of minutes to wait prior to timing out.
|
800
|
-
hours : int, default 0
|
801
|
-
Number of hours to wait prior to timing out.
|
802
|
-
"""
|
803
|
-
...
|
804
|
-
|
805
|
-
@typing.overload
|
806
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
807
|
-
...
|
808
|
-
|
809
|
-
@typing.overload
|
810
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
811
|
-
...
|
812
|
-
|
813
|
-
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):
|
814
|
-
"""
|
815
|
-
Specifies a timeout for your step.
|
816
|
-
|
817
|
-
This decorator is useful if this step may hang indefinitely.
|
818
|
-
|
819
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
820
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
821
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
822
|
-
|
823
|
-
Note that all the values specified in parameters are added together so if you specify
|
824
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
825
|
-
|
826
|
-
|
827
|
-
Parameters
|
828
|
-
----------
|
829
|
-
seconds : int, default 0
|
830
|
-
Number of seconds to wait prior to timing out.
|
831
|
-
minutes : int, default 0
|
832
|
-
Number of minutes to wait prior to timing out.
|
833
|
-
hours : int, default 0
|
834
|
-
Number of hours to wait prior to timing out.
|
835
|
-
"""
|
836
|
-
...
|
837
|
-
|
838
|
-
@typing.overload
|
839
|
-
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
840
|
-
"""
|
841
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
842
|
-
the execution of a step.
|
843
|
-
|
844
|
-
|
845
|
-
Parameters
|
846
|
-
----------
|
847
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
848
|
-
List of secret specs, defining how the secrets are to be retrieved
|
849
|
-
"""
|
850
|
-
...
|
851
|
-
|
852
|
-
@typing.overload
|
853
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
854
|
-
...
|
855
|
-
|
856
|
-
@typing.overload
|
857
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
858
|
-
...
|
859
|
-
|
860
|
-
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]]] = []):
|
861
|
-
"""
|
862
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
863
|
-
the execution of a step.
|
864
|
-
|
865
|
-
|
866
|
-
Parameters
|
867
|
-
----------
|
868
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
869
|
-
List of secret specs, defining how the secrets are to be retrieved
|
870
|
-
"""
|
871
|
-
...
|
872
|
-
|
873
|
-
@typing.overload
|
874
|
-
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
875
|
-
"""
|
876
|
-
Specifies the times when the flow should be run when running on a
|
877
|
-
production scheduler.
|
878
|
-
|
879
|
-
|
880
|
-
Parameters
|
881
|
-
----------
|
882
|
-
hourly : bool, default False
|
883
|
-
Run the workflow hourly.
|
884
|
-
daily : bool, default True
|
885
|
-
Run the workflow daily.
|
886
|
-
weekly : bool, default False
|
887
|
-
Run the workflow weekly.
|
888
|
-
cron : str, optional, default None
|
889
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
890
|
-
specified by this expression.
|
891
|
-
timezone : str, optional, default None
|
892
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
893
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
894
1004
|
"""
|
895
1005
|
...
|
896
1006
|
|
897
|
-
|
898
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
899
|
-
...
|
900
|
-
|
901
|
-
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1007
|
+
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]]:
|
902
1008
|
"""
|
903
|
-
|
904
|
-
|
1009
|
+
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.
|
1010
|
+
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.
|
905
1011
|
|
906
1012
|
|
907
1013
|
Parameters
|
908
1014
|
----------
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
1015
|
+
timeout : int
|
1016
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1017
|
+
poke_interval : int
|
1018
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1019
|
+
mode : str
|
1020
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1021
|
+
exponential_backoff : bool
|
1022
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1023
|
+
pool : str
|
1024
|
+
the slot pool this task should run in,
|
1025
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1026
|
+
soft_fail : bool
|
1027
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1028
|
+
name : str
|
1029
|
+
Name of the sensor on Airflow
|
1030
|
+
description : str
|
1031
|
+
Description of sensor in the Airflow UI
|
1032
|
+
external_dag_id : str
|
1033
|
+
The dag_id that contains the task you want to wait for.
|
1034
|
+
external_task_ids : List[str]
|
1035
|
+
The list of task_ids that you want to wait for.
|
1036
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1037
|
+
allowed_states : List[str]
|
1038
|
+
Iterable of allowed states, (Default: ['success'])
|
1039
|
+
failed_states : List[str]
|
1040
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1041
|
+
execution_delta : datetime.timedelta
|
1042
|
+
time difference with the previous execution to look at,
|
1043
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1044
|
+
check_existence: bool
|
1045
|
+
Set to True to check if the external task exists or check if
|
1046
|
+
the DAG to wait for exists. (Default: True)
|
921
1047
|
"""
|
922
1048
|
...
|
923
1049
|
|
@@ -1022,6 +1148,41 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1022
1148
|
"""
|
1023
1149
|
...
|
1024
1150
|
|
1151
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1152
|
+
"""
|
1153
|
+
Specifies what flows belong to the same project.
|
1154
|
+
|
1155
|
+
A project-specific namespace is created for all flows that
|
1156
|
+
use the same `@project(name)`.
|
1157
|
+
|
1158
|
+
|
1159
|
+
Parameters
|
1160
|
+
----------
|
1161
|
+
name : str
|
1162
|
+
Project name. Make sure that the name is unique amongst all
|
1163
|
+
projects that use the same production scheduler. The name may
|
1164
|
+
contain only lowercase alphanumeric characters and underscores.
|
1165
|
+
|
1166
|
+
branch : Optional[str], default None
|
1167
|
+
The branch to use. If not specified, the branch is set to
|
1168
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1169
|
+
also be set on the command line using `--branch` as a top-level option.
|
1170
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1171
|
+
|
1172
|
+
production : bool, default False
|
1173
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1174
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1175
|
+
`production` in the decorator and on the command line.
|
1176
|
+
The project branch name will be:
|
1177
|
+
- if `branch` is specified:
|
1178
|
+
- if `production` is True: `prod.<branch>`
|
1179
|
+
- if `production` is False: `test.<branch>`
|
1180
|
+
- if `branch` is not specified:
|
1181
|
+
- if `production` is True: `prod`
|
1182
|
+
- if `production` is False: `user.<username>`
|
1183
|
+
"""
|
1184
|
+
...
|
1185
|
+
|
1025
1186
|
@typing.overload
|
1026
1187
|
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]]:
|
1027
1188
|
"""
|
@@ -1073,46 +1234,54 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1073
1234
|
"""
|
1074
1235
|
...
|
1075
1236
|
|
1076
|
-
|
1237
|
+
@typing.overload
|
1238
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1077
1239
|
"""
|
1078
|
-
|
1079
|
-
|
1240
|
+
Specifies the times when the flow should be run when running on a
|
1241
|
+
production scheduler.
|
1080
1242
|
|
1081
1243
|
|
1082
1244
|
Parameters
|
1083
1245
|
----------
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1246
|
+
hourly : bool, default False
|
1247
|
+
Run the workflow hourly.
|
1248
|
+
daily : bool, default True
|
1249
|
+
Run the workflow daily.
|
1250
|
+
weekly : bool, default False
|
1251
|
+
Run the workflow weekly.
|
1252
|
+
cron : str, optional, default None
|
1253
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1254
|
+
specified by this expression.
|
1255
|
+
timezone : str, optional, default None
|
1256
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1257
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1258
|
+
"""
|
1259
|
+
...
|
1260
|
+
|
1261
|
+
@typing.overload
|
1262
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1263
|
+
...
|
1264
|
+
|
1265
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1266
|
+
"""
|
1267
|
+
Specifies the times when the flow should be run when running on a
|
1268
|
+
production scheduler.
|
1269
|
+
|
1270
|
+
|
1271
|
+
Parameters
|
1272
|
+
----------
|
1273
|
+
hourly : bool, default False
|
1274
|
+
Run the workflow hourly.
|
1275
|
+
daily : bool, default True
|
1276
|
+
Run the workflow daily.
|
1277
|
+
weekly : bool, default False
|
1278
|
+
Run the workflow weekly.
|
1279
|
+
cron : str, optional, default None
|
1280
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1281
|
+
specified by this expression.
|
1282
|
+
timezone : str, optional, default None
|
1283
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1284
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1116
1285
|
"""
|
1117
1286
|
...
|
1118
1287
|
|
@@ -1159,172 +1328,3 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1159
1328
|
"""
|
1160
1329
|
...
|
1161
1330
|
|
1162
|
-
@typing.overload
|
1163
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1164
|
-
"""
|
1165
|
-
Specifies the PyPI packages for all steps of the flow.
|
1166
|
-
|
1167
|
-
Use `@pypi_base` to set common packages required by all
|
1168
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1169
|
-
|
1170
|
-
Parameters
|
1171
|
-
----------
|
1172
|
-
packages : Dict[str, str], default: {}
|
1173
|
-
Packages to use for this flow. The key is the name of the package
|
1174
|
-
and the value is the version to use.
|
1175
|
-
python : str, optional, default: None
|
1176
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1177
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1178
|
-
"""
|
1179
|
-
...
|
1180
|
-
|
1181
|
-
@typing.overload
|
1182
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1183
|
-
...
|
1184
|
-
|
1185
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1186
|
-
"""
|
1187
|
-
Specifies the PyPI packages for all steps of the flow.
|
1188
|
-
|
1189
|
-
Use `@pypi_base` to set common packages required by all
|
1190
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1191
|
-
|
1192
|
-
Parameters
|
1193
|
-
----------
|
1194
|
-
packages : Dict[str, str], default: {}
|
1195
|
-
Packages to use for this flow. The key is the name of the package
|
1196
|
-
and the value is the version to use.
|
1197
|
-
python : str, optional, default: None
|
1198
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1199
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1200
|
-
"""
|
1201
|
-
...
|
1202
|
-
|
1203
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1204
|
-
"""
|
1205
|
-
Specifies what flows belong to the same project.
|
1206
|
-
|
1207
|
-
A project-specific namespace is created for all flows that
|
1208
|
-
use the same `@project(name)`.
|
1209
|
-
|
1210
|
-
|
1211
|
-
Parameters
|
1212
|
-
----------
|
1213
|
-
name : str
|
1214
|
-
Project name. Make sure that the name is unique amongst all
|
1215
|
-
projects that use the same production scheduler. The name may
|
1216
|
-
contain only lowercase alphanumeric characters and underscores.
|
1217
|
-
|
1218
|
-
branch : Optional[str], default None
|
1219
|
-
The branch to use. If not specified, the branch is set to
|
1220
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1221
|
-
also be set on the command line using `--branch` as a top-level option.
|
1222
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1223
|
-
|
1224
|
-
production : bool, default False
|
1225
|
-
Whether or not the branch is the production branch. This can also be set on the
|
1226
|
-
command line using `--production` as a top-level option. It is an error to specify
|
1227
|
-
`production` in the decorator and on the command line.
|
1228
|
-
The project branch name will be:
|
1229
|
-
- if `branch` is specified:
|
1230
|
-
- if `production` is True: `prod.<branch>`
|
1231
|
-
- if `production` is False: `test.<branch>`
|
1232
|
-
- if `branch` is not specified:
|
1233
|
-
- if `production` is True: `prod`
|
1234
|
-
- if `production` is False: `user.<username>`
|
1235
|
-
"""
|
1236
|
-
...
|
1237
|
-
|
1238
|
-
@typing.overload
|
1239
|
-
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]]:
|
1240
|
-
"""
|
1241
|
-
Specifies the event(s) that this flow depends on.
|
1242
|
-
|
1243
|
-
```
|
1244
|
-
@trigger(event='foo')
|
1245
|
-
```
|
1246
|
-
or
|
1247
|
-
```
|
1248
|
-
@trigger(events=['foo', 'bar'])
|
1249
|
-
```
|
1250
|
-
|
1251
|
-
Additionally, you can specify the parameter mappings
|
1252
|
-
to map event payload to Metaflow parameters for the flow.
|
1253
|
-
```
|
1254
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1255
|
-
```
|
1256
|
-
or
|
1257
|
-
```
|
1258
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1259
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1260
|
-
```
|
1261
|
-
|
1262
|
-
'parameters' can also be a list of strings and tuples like so:
|
1263
|
-
```
|
1264
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1265
|
-
```
|
1266
|
-
This is equivalent to:
|
1267
|
-
```
|
1268
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1269
|
-
```
|
1270
|
-
|
1271
|
-
|
1272
|
-
Parameters
|
1273
|
-
----------
|
1274
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1275
|
-
Event dependency for this flow.
|
1276
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1277
|
-
Events dependency for this flow.
|
1278
|
-
options : Dict[str, Any], default {}
|
1279
|
-
Backend-specific configuration for tuning eventing behavior.
|
1280
|
-
"""
|
1281
|
-
...
|
1282
|
-
|
1283
|
-
@typing.overload
|
1284
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1285
|
-
...
|
1286
|
-
|
1287
|
-
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] = {}):
|
1288
|
-
"""
|
1289
|
-
Specifies the event(s) that this flow depends on.
|
1290
|
-
|
1291
|
-
```
|
1292
|
-
@trigger(event='foo')
|
1293
|
-
```
|
1294
|
-
or
|
1295
|
-
```
|
1296
|
-
@trigger(events=['foo', 'bar'])
|
1297
|
-
```
|
1298
|
-
|
1299
|
-
Additionally, you can specify the parameter mappings
|
1300
|
-
to map event payload to Metaflow parameters for the flow.
|
1301
|
-
```
|
1302
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1303
|
-
```
|
1304
|
-
or
|
1305
|
-
```
|
1306
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1307
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1308
|
-
```
|
1309
|
-
|
1310
|
-
'parameters' can also be a list of strings and tuples like so:
|
1311
|
-
```
|
1312
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1313
|
-
```
|
1314
|
-
This is equivalent to:
|
1315
|
-
```
|
1316
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1317
|
-
```
|
1318
|
-
|
1319
|
-
|
1320
|
-
Parameters
|
1321
|
-
----------
|
1322
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1323
|
-
Event dependency for this flow.
|
1324
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1325
|
-
Events dependency for this flow.
|
1326
|
-
options : Dict[str, Any], default {}
|
1327
|
-
Backend-specific configuration for tuning eventing behavior.
|
1328
|
-
"""
|
1329
|
-
...
|
1330
|
-
|