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