metaflow-stubs 2.15.19__py2.py3-none-any.whl → 2.15.21__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of metaflow-stubs might be problematic. Click here for more details.
- metaflow-stubs/__init__.pyi +543 -543
- 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 +3 -3
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +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 +17 -17
- 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 +11 -11
- 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/argo/exit_hooks.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 +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 +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 +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 +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +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 +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +6 -7
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +5 -5
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.15.19.dist-info → metaflow_stubs-2.15.21.dist-info}/METADATA +2 -2
- metaflow_stubs-2.15.21.dist-info/RECORD +155 -0
- metaflow_stubs-2.15.19.dist-info/RECORD +0 -155
- {metaflow_stubs-2.15.19.dist-info → metaflow_stubs-2.15.21.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.15.19.dist-info → metaflow_stubs-2.15.21.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-07-
|
|
3
|
+
# MF version: 2.15.21 #
|
|
4
|
+
# Generated on 2025-07-11T15:58:13.105014 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
@@ -44,8 +44,8 @@ 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
46
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
47
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
48
47
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
48
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_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,155 +146,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
146
146
|
"""
|
|
147
147
|
...
|
|
148
148
|
|
|
149
|
-
@typing.overload
|
|
150
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
151
|
-
"""
|
|
152
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
153
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
154
|
-
"""
|
|
155
|
-
...
|
|
156
|
-
|
|
157
|
-
@typing.overload
|
|
158
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
159
|
-
...
|
|
160
|
-
|
|
161
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
162
|
-
"""
|
|
163
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
164
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
165
|
-
"""
|
|
166
|
-
...
|
|
167
|
-
|
|
168
|
-
@typing.overload
|
|
169
|
-
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]]]:
|
|
170
|
-
"""
|
|
171
|
-
Specifies the PyPI packages for the step.
|
|
172
|
-
|
|
173
|
-
Information in this decorator will augment any
|
|
174
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
175
|
-
you can use `@pypi_base` to set packages required by all
|
|
176
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
Parameters
|
|
180
|
-
----------
|
|
181
|
-
packages : Dict[str, str], default: {}
|
|
182
|
-
Packages to use for this step. The key is the name of the package
|
|
183
|
-
and the value is the version to use.
|
|
184
|
-
python : str, optional, default: None
|
|
185
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
186
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
187
|
-
"""
|
|
188
|
-
...
|
|
189
|
-
|
|
190
|
-
@typing.overload
|
|
191
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
192
|
-
...
|
|
193
|
-
|
|
194
|
-
@typing.overload
|
|
195
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
196
|
-
...
|
|
197
|
-
|
|
198
|
-
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):
|
|
199
|
-
"""
|
|
200
|
-
Specifies the PyPI packages for the step.
|
|
201
|
-
|
|
202
|
-
Information in this decorator will augment any
|
|
203
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
204
|
-
you can use `@pypi_base` to set packages required by all
|
|
205
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
Parameters
|
|
209
|
-
----------
|
|
210
|
-
packages : Dict[str, str], default: {}
|
|
211
|
-
Packages to use for this step. The key is the name of the package
|
|
212
|
-
and the value is the version to use.
|
|
213
|
-
python : str, optional, default: None
|
|
214
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
215
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
216
|
-
"""
|
|
217
|
-
...
|
|
218
|
-
|
|
219
|
-
@typing.overload
|
|
220
|
-
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]]]:
|
|
221
|
-
"""
|
|
222
|
-
Specifies the resources needed when executing this step.
|
|
223
|
-
|
|
224
|
-
Use `@resources` to specify the resource requirements
|
|
225
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
226
|
-
|
|
227
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
228
|
-
```
|
|
229
|
-
python myflow.py run --with batch
|
|
230
|
-
```
|
|
231
|
-
or
|
|
232
|
-
```
|
|
233
|
-
python myflow.py run --with kubernetes
|
|
234
|
-
```
|
|
235
|
-
which executes the flow on the desired system using the
|
|
236
|
-
requirements specified in `@resources`.
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
Parameters
|
|
240
|
-
----------
|
|
241
|
-
cpu : int, default 1
|
|
242
|
-
Number of CPUs required for this step.
|
|
243
|
-
gpu : int, optional, default None
|
|
244
|
-
Number of GPUs required for this step.
|
|
245
|
-
disk : int, optional, default None
|
|
246
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
247
|
-
memory : int, default 4096
|
|
248
|
-
Memory size (in MB) required for this step.
|
|
249
|
-
shared_memory : int, optional, default None
|
|
250
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
251
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
252
|
-
"""
|
|
253
|
-
...
|
|
254
|
-
|
|
255
|
-
@typing.overload
|
|
256
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
257
|
-
...
|
|
258
|
-
|
|
259
|
-
@typing.overload
|
|
260
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
261
|
-
...
|
|
262
|
-
|
|
263
|
-
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):
|
|
264
|
-
"""
|
|
265
|
-
Specifies the resources needed when executing this step.
|
|
266
|
-
|
|
267
|
-
Use `@resources` to specify the resource requirements
|
|
268
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
269
|
-
|
|
270
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
271
|
-
```
|
|
272
|
-
python myflow.py run --with batch
|
|
273
|
-
```
|
|
274
|
-
or
|
|
275
|
-
```
|
|
276
|
-
python myflow.py run --with kubernetes
|
|
277
|
-
```
|
|
278
|
-
which executes the flow on the desired system using the
|
|
279
|
-
requirements specified in `@resources`.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
Parameters
|
|
283
|
-
----------
|
|
284
|
-
cpu : int, default 1
|
|
285
|
-
Number of CPUs required for this step.
|
|
286
|
-
gpu : int, optional, default None
|
|
287
|
-
Number of GPUs required for this step.
|
|
288
|
-
disk : int, optional, default None
|
|
289
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
290
|
-
memory : int, default 4096
|
|
291
|
-
Memory size (in MB) required for this step.
|
|
292
|
-
shared_memory : int, optional, default None
|
|
293
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
294
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
295
|
-
"""
|
|
296
|
-
...
|
|
297
|
-
|
|
298
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]]]:
|
|
299
150
|
"""
|
|
300
151
|
Specifies that this step should execute on Kubernetes.
|
|
@@ -385,57 +236,61 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
|
385
236
|
...
|
|
386
237
|
|
|
387
238
|
@typing.overload
|
|
388
|
-
def
|
|
239
|
+
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]]]:
|
|
389
240
|
"""
|
|
390
|
-
Specifies the
|
|
391
|
-
to a step needs to be retried.
|
|
392
|
-
|
|
393
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
394
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
395
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
241
|
+
Specifies the Conda environment for the step.
|
|
396
242
|
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
243
|
+
Information in this decorator will augment any
|
|
244
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
245
|
+
you can use `@conda_base` to set packages required by all
|
|
246
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
400
247
|
|
|
401
248
|
|
|
402
249
|
Parameters
|
|
403
250
|
----------
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
251
|
+
packages : Dict[str, str], default {}
|
|
252
|
+
Packages to use for this step. The key is the name of the package
|
|
253
|
+
and the value is the version to use.
|
|
254
|
+
libraries : Dict[str, str], default {}
|
|
255
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
256
|
+
python : str, optional, default None
|
|
257
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
258
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
259
|
+
disabled : bool, default False
|
|
260
|
+
If set to True, disables @conda.
|
|
408
261
|
"""
|
|
409
262
|
...
|
|
410
263
|
|
|
411
264
|
@typing.overload
|
|
412
|
-
def
|
|
265
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
413
266
|
...
|
|
414
267
|
|
|
415
268
|
@typing.overload
|
|
416
|
-
def
|
|
269
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
417
270
|
...
|
|
418
271
|
|
|
419
|
-
def
|
|
272
|
+
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):
|
|
420
273
|
"""
|
|
421
|
-
Specifies the
|
|
422
|
-
to a step needs to be retried.
|
|
423
|
-
|
|
424
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
425
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
426
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
274
|
+
Specifies the Conda environment for the step.
|
|
427
275
|
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
276
|
+
Information in this decorator will augment any
|
|
277
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
278
|
+
you can use `@conda_base` to set packages required by all
|
|
279
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
431
280
|
|
|
432
281
|
|
|
433
282
|
Parameters
|
|
434
283
|
----------
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
284
|
+
packages : Dict[str, str], default {}
|
|
285
|
+
Packages to use for this step. The key is the name of the package
|
|
286
|
+
and the value is the version to use.
|
|
287
|
+
libraries : Dict[str, str], default {}
|
|
288
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
289
|
+
python : str, optional, default None
|
|
290
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
291
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
292
|
+
disabled : bool, default False
|
|
293
|
+
If set to True, disables @conda.
|
|
439
294
|
"""
|
|
440
295
|
...
|
|
441
296
|
|
|
@@ -473,33 +328,112 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
|
|
|
473
328
|
...
|
|
474
329
|
|
|
475
330
|
@typing.overload
|
|
476
|
-
def
|
|
331
|
+
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]]]:
|
|
477
332
|
"""
|
|
478
|
-
Specifies
|
|
333
|
+
Specifies the resources needed when executing this step.
|
|
334
|
+
|
|
335
|
+
Use `@resources` to specify the resource requirements
|
|
336
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
337
|
+
|
|
338
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
339
|
+
```
|
|
340
|
+
python myflow.py run --with batch
|
|
341
|
+
```
|
|
342
|
+
or
|
|
343
|
+
```
|
|
344
|
+
python myflow.py run --with kubernetes
|
|
345
|
+
```
|
|
346
|
+
which executes the flow on the desired system using the
|
|
347
|
+
requirements specified in `@resources`.
|
|
479
348
|
|
|
480
349
|
|
|
481
350
|
Parameters
|
|
482
351
|
----------
|
|
483
352
|
cpu : int, default 1
|
|
484
|
-
Number of CPUs required for this step.
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
353
|
+
Number of CPUs required for this step.
|
|
354
|
+
gpu : int, optional, default None
|
|
355
|
+
Number of GPUs required for this step.
|
|
356
|
+
disk : int, optional, default None
|
|
357
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
489
358
|
memory : int, default 4096
|
|
490
|
-
Memory size (in MB) required for this step.
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
359
|
+
Memory size (in MB) required for this step.
|
|
360
|
+
shared_memory : int, optional, default None
|
|
361
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
362
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
363
|
+
"""
|
|
364
|
+
...
|
|
365
|
+
|
|
366
|
+
@typing.overload
|
|
367
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
368
|
+
...
|
|
369
|
+
|
|
370
|
+
@typing.overload
|
|
371
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
372
|
+
...
|
|
373
|
+
|
|
374
|
+
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):
|
|
375
|
+
"""
|
|
376
|
+
Specifies the resources needed when executing this step.
|
|
377
|
+
|
|
378
|
+
Use `@resources` to specify the resource requirements
|
|
379
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
380
|
+
|
|
381
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
382
|
+
```
|
|
383
|
+
python myflow.py run --with batch
|
|
384
|
+
```
|
|
385
|
+
or
|
|
386
|
+
```
|
|
387
|
+
python myflow.py run --with kubernetes
|
|
388
|
+
```
|
|
389
|
+
which executes the flow on the desired system using the
|
|
390
|
+
requirements specified in `@resources`.
|
|
391
|
+
|
|
392
|
+
|
|
393
|
+
Parameters
|
|
394
|
+
----------
|
|
395
|
+
cpu : int, default 1
|
|
396
|
+
Number of CPUs required for this step.
|
|
397
|
+
gpu : int, optional, default None
|
|
398
|
+
Number of GPUs required for this step.
|
|
399
|
+
disk : int, optional, default None
|
|
400
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
401
|
+
memory : int, default 4096
|
|
402
|
+
Memory size (in MB) required for this step.
|
|
403
|
+
shared_memory : int, optional, default None
|
|
404
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
405
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
406
|
+
"""
|
|
407
|
+
...
|
|
408
|
+
|
|
409
|
+
@typing.overload
|
|
410
|
+
def batch(*, cpu: int = 1, gpu: int = 0, memory: int = 4096, image: typing.Optional[str] = None, queue: str = 'METAFLOW_BATCH_JOB_QUEUE', iam_role: str = 'METAFLOW_ECS_S3_ACCESS_IAM_ROLE', execution_role: str = 'METAFLOW_ECS_FARGATE_EXECUTION_ROLE', shared_memory: typing.Optional[int] = None, max_swap: typing.Optional[int] = None, swappiness: typing.Optional[int] = None, use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = None, inferentia: int = 0, trainium: int = None, efa: int = 0, ephemeral_storage: int = None, log_driver: typing.Optional[str] = None, log_options: typing.Optional[typing.List[str]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
411
|
+
"""
|
|
412
|
+
Specifies that this step should execute on [AWS Batch](https://aws.amazon.com/batch/).
|
|
413
|
+
|
|
414
|
+
|
|
415
|
+
Parameters
|
|
416
|
+
----------
|
|
417
|
+
cpu : int, default 1
|
|
418
|
+
Number of CPUs required for this step. If `@resources` is
|
|
419
|
+
also present, the maximum value from all decorators is used.
|
|
420
|
+
gpu : int, default 0
|
|
421
|
+
Number of GPUs required for this step. If `@resources` is
|
|
422
|
+
also present, the maximum value from all decorators is used.
|
|
423
|
+
memory : int, default 4096
|
|
424
|
+
Memory size (in MB) required for this step. If
|
|
425
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
426
|
+
used.
|
|
427
|
+
image : str, optional, default None
|
|
428
|
+
Docker image to use when launching on AWS Batch. If not specified, and
|
|
429
|
+
METAFLOW_BATCH_CONTAINER_IMAGE is specified, that image is used. If
|
|
430
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
431
|
+
queue : str, default METAFLOW_BATCH_JOB_QUEUE
|
|
432
|
+
AWS Batch Job Queue to submit the job to.
|
|
433
|
+
iam_role : str, default METAFLOW_ECS_S3_ACCESS_IAM_ROLE
|
|
434
|
+
AWS IAM role that AWS Batch container uses to access AWS cloud resources.
|
|
435
|
+
execution_role : str, default METAFLOW_ECS_FARGATE_EXECUTION_ROLE
|
|
436
|
+
AWS IAM role that AWS Batch can use [to trigger AWS Fargate tasks]
|
|
503
437
|
(https://docs.aws.amazon.com/batch/latest/userguide/execution-IAM-role.html).
|
|
504
438
|
shared_memory : int, optional, default None
|
|
505
439
|
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
@@ -622,112 +556,131 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
622
556
|
...
|
|
623
557
|
|
|
624
558
|
@typing.overload
|
|
625
|
-
def
|
|
559
|
+
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]]]:
|
|
626
560
|
"""
|
|
627
|
-
Specifies
|
|
561
|
+
Specifies a timeout for your step.
|
|
628
562
|
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
563
|
+
This decorator is useful if this step may hang indefinitely.
|
|
564
|
+
|
|
565
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
566
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
567
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
568
|
+
|
|
569
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
570
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
633
571
|
|
|
634
572
|
|
|
635
573
|
Parameters
|
|
636
574
|
----------
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
644
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
645
|
-
disabled : bool, default False
|
|
646
|
-
If set to True, disables @conda.
|
|
575
|
+
seconds : int, default 0
|
|
576
|
+
Number of seconds to wait prior to timing out.
|
|
577
|
+
minutes : int, default 0
|
|
578
|
+
Number of minutes to wait prior to timing out.
|
|
579
|
+
hours : int, default 0
|
|
580
|
+
Number of hours to wait prior to timing out.
|
|
647
581
|
"""
|
|
648
582
|
...
|
|
649
583
|
|
|
650
584
|
@typing.overload
|
|
651
|
-
def
|
|
585
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
652
586
|
...
|
|
653
587
|
|
|
654
588
|
@typing.overload
|
|
655
|
-
def
|
|
589
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
656
590
|
...
|
|
657
591
|
|
|
658
|
-
def
|
|
592
|
+
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):
|
|
659
593
|
"""
|
|
660
|
-
Specifies
|
|
594
|
+
Specifies a timeout for your step.
|
|
661
595
|
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
596
|
+
This decorator is useful if this step may hang indefinitely.
|
|
597
|
+
|
|
598
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
599
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
600
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
601
|
+
|
|
602
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
603
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
666
604
|
|
|
667
605
|
|
|
668
606
|
Parameters
|
|
669
607
|
----------
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
677
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
678
|
-
disabled : bool, default False
|
|
679
|
-
If set to True, disables @conda.
|
|
608
|
+
seconds : int, default 0
|
|
609
|
+
Number of seconds to wait prior to timing out.
|
|
610
|
+
minutes : int, default 0
|
|
611
|
+
Number of minutes to wait prior to timing out.
|
|
612
|
+
hours : int, default 0
|
|
613
|
+
Number of hours to wait prior to timing out.
|
|
680
614
|
"""
|
|
681
615
|
...
|
|
682
616
|
|
|
683
617
|
@typing.overload
|
|
684
|
-
def
|
|
618
|
+
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]]]:
|
|
685
619
|
"""
|
|
686
|
-
Specifies
|
|
620
|
+
Specifies the PyPI packages for the step.
|
|
687
621
|
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
622
|
+
Information in this decorator will augment any
|
|
623
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
624
|
+
you can use `@pypi_base` to set packages required by all
|
|
625
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
692
626
|
|
|
693
627
|
|
|
694
628
|
Parameters
|
|
695
629
|
----------
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
630
|
+
packages : Dict[str, str], default: {}
|
|
631
|
+
Packages to use for this step. The key is the name of the package
|
|
632
|
+
and the value is the version to use.
|
|
633
|
+
python : str, optional, default: None
|
|
634
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
635
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
702
636
|
"""
|
|
703
637
|
...
|
|
704
638
|
|
|
705
639
|
@typing.overload
|
|
706
|
-
def
|
|
640
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
707
641
|
...
|
|
708
642
|
|
|
709
643
|
@typing.overload
|
|
710
|
-
def
|
|
644
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
711
645
|
...
|
|
712
646
|
|
|
713
|
-
def
|
|
647
|
+
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):
|
|
714
648
|
"""
|
|
715
|
-
Specifies
|
|
649
|
+
Specifies the PyPI packages for the step.
|
|
716
650
|
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
651
|
+
Information in this decorator will augment any
|
|
652
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
653
|
+
you can use `@pypi_base` to set packages required by all
|
|
654
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
721
655
|
|
|
722
656
|
|
|
723
657
|
Parameters
|
|
724
658
|
----------
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
659
|
+
packages : Dict[str, str], default: {}
|
|
660
|
+
Packages to use for this step. The key is the name of the package
|
|
661
|
+
and the value is the version to use.
|
|
662
|
+
python : str, optional, default: None
|
|
663
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
664
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
665
|
+
"""
|
|
666
|
+
...
|
|
667
|
+
|
|
668
|
+
@typing.overload
|
|
669
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
670
|
+
"""
|
|
671
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
672
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
673
|
+
"""
|
|
674
|
+
...
|
|
675
|
+
|
|
676
|
+
@typing.overload
|
|
677
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
678
|
+
...
|
|
679
|
+
|
|
680
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
681
|
+
"""
|
|
682
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
683
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
731
684
|
"""
|
|
732
685
|
...
|
|
733
686
|
|
|
@@ -781,227 +734,147 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
|
781
734
|
...
|
|
782
735
|
|
|
783
736
|
@typing.overload
|
|
784
|
-
def
|
|
737
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
785
738
|
"""
|
|
786
|
-
Specifies
|
|
787
|
-
|
|
788
|
-
This decorator is useful if this step may hang indefinitely.
|
|
789
|
-
|
|
790
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
791
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
792
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
793
|
-
|
|
794
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
795
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
739
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
740
|
+
the execution of a step.
|
|
796
741
|
|
|
797
742
|
|
|
798
743
|
Parameters
|
|
799
744
|
----------
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
hours : int, default 0
|
|
805
|
-
Number of hours to wait prior to timing out.
|
|
745
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
746
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
747
|
+
role : str, optional, default: None
|
|
748
|
+
Role to use for fetching secrets
|
|
806
749
|
"""
|
|
807
750
|
...
|
|
808
751
|
|
|
809
752
|
@typing.overload
|
|
810
|
-
def
|
|
753
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
811
754
|
...
|
|
812
755
|
|
|
813
756
|
@typing.overload
|
|
814
|
-
def
|
|
757
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
815
758
|
...
|
|
816
759
|
|
|
817
|
-
def
|
|
760
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None):
|
|
818
761
|
"""
|
|
819
|
-
Specifies
|
|
820
|
-
|
|
821
|
-
This decorator is useful if this step may hang indefinitely.
|
|
822
|
-
|
|
823
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
824
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
825
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
826
|
-
|
|
827
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
828
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
762
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
763
|
+
the execution of a step.
|
|
829
764
|
|
|
830
765
|
|
|
831
766
|
Parameters
|
|
832
767
|
----------
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
hours : int, default 0
|
|
838
|
-
Number of hours to wait prior to timing out.
|
|
768
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
769
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
770
|
+
role : str, optional, default: None
|
|
771
|
+
Role to use for fetching secrets
|
|
839
772
|
"""
|
|
840
773
|
...
|
|
841
774
|
|
|
842
775
|
@typing.overload
|
|
843
|
-
def
|
|
776
|
+
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]]]:
|
|
844
777
|
"""
|
|
845
|
-
Specifies
|
|
846
|
-
|
|
778
|
+
Specifies that the step will success under all circumstances.
|
|
779
|
+
|
|
780
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
781
|
+
contains the exception raised. You can use it to detect the presence
|
|
782
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
783
|
+
are missing.
|
|
847
784
|
|
|
848
785
|
|
|
849
786
|
Parameters
|
|
850
787
|
----------
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
788
|
+
var : str, optional, default None
|
|
789
|
+
Name of the artifact in which to store the caught exception.
|
|
790
|
+
If not specified, the exception is not stored.
|
|
791
|
+
print_exception : bool, default True
|
|
792
|
+
Determines whether or not the exception is printed to
|
|
793
|
+
stdout when caught.
|
|
855
794
|
"""
|
|
856
795
|
...
|
|
857
796
|
|
|
858
797
|
@typing.overload
|
|
859
|
-
def
|
|
798
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
860
799
|
...
|
|
861
800
|
|
|
862
801
|
@typing.overload
|
|
863
|
-
def
|
|
864
|
-
...
|
|
865
|
-
|
|
866
|
-
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None):
|
|
867
|
-
"""
|
|
868
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
869
|
-
the execution of a step.
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
Parameters
|
|
873
|
-
----------
|
|
874
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
875
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
876
|
-
role : str, optional, default: None
|
|
877
|
-
Role to use for fetching secrets
|
|
878
|
-
"""
|
|
802
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
879
803
|
...
|
|
880
804
|
|
|
881
|
-
def
|
|
805
|
+
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):
|
|
882
806
|
"""
|
|
883
|
-
Specifies
|
|
807
|
+
Specifies that the step will success under all circumstances.
|
|
884
808
|
|
|
885
|
-
|
|
886
|
-
use the
|
|
809
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
810
|
+
contains the exception raised. You can use it to detect the presence
|
|
811
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
812
|
+
are missing.
|
|
887
813
|
|
|
888
814
|
|
|
889
815
|
Parameters
|
|
890
816
|
----------
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
The branch to use. If not specified, the branch is set to
|
|
898
|
-
`user.<username>` unless `production` is set to `True`. This can
|
|
899
|
-
also be set on the command line using `--branch` as a top-level option.
|
|
900
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
|
901
|
-
|
|
902
|
-
production : bool, default False
|
|
903
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
904
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
905
|
-
`production` in the decorator and on the command line.
|
|
906
|
-
The project branch name will be:
|
|
907
|
-
- if `branch` is specified:
|
|
908
|
-
- if `production` is True: `prod.<branch>`
|
|
909
|
-
- if `production` is False: `test.<branch>`
|
|
910
|
-
- if `branch` is not specified:
|
|
911
|
-
- if `production` is True: `prod`
|
|
912
|
-
- if `production` is False: `user.<username>`
|
|
817
|
+
var : str, optional, default None
|
|
818
|
+
Name of the artifact in which to store the caught exception.
|
|
819
|
+
If not specified, the exception is not stored.
|
|
820
|
+
print_exception : bool, default True
|
|
821
|
+
Determines whether or not the exception is printed to
|
|
822
|
+
stdout when caught.
|
|
913
823
|
"""
|
|
914
824
|
...
|
|
915
825
|
|
|
916
826
|
@typing.overload
|
|
917
|
-
def
|
|
827
|
+
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]]]:
|
|
918
828
|
"""
|
|
919
|
-
Specifies the times
|
|
920
|
-
|
|
829
|
+
Specifies the number of times the task corresponding
|
|
830
|
+
to a step needs to be retried.
|
|
921
831
|
|
|
832
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
833
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
834
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
922
835
|
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
Run the workflow hourly.
|
|
927
|
-
daily : bool, default True
|
|
928
|
-
Run the workflow daily.
|
|
929
|
-
weekly : bool, default False
|
|
930
|
-
Run the workflow weekly.
|
|
931
|
-
cron : str, optional, default None
|
|
932
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
933
|
-
specified by this expression.
|
|
934
|
-
timezone : str, optional, default None
|
|
935
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
936
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
937
|
-
"""
|
|
938
|
-
...
|
|
939
|
-
|
|
940
|
-
@typing.overload
|
|
941
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
942
|
-
...
|
|
943
|
-
|
|
944
|
-
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):
|
|
945
|
-
"""
|
|
946
|
-
Specifies the times when the flow should be run when running on a
|
|
947
|
-
production scheduler.
|
|
836
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
837
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
838
|
+
ensuring that the flow execution can continue.
|
|
948
839
|
|
|
949
840
|
|
|
950
841
|
Parameters
|
|
951
842
|
----------
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
weekly : bool, default False
|
|
957
|
-
Run the workflow weekly.
|
|
958
|
-
cron : str, optional, default None
|
|
959
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
960
|
-
specified by this expression.
|
|
961
|
-
timezone : str, optional, default None
|
|
962
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
963
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
843
|
+
times : int, default 3
|
|
844
|
+
Number of times to retry this task.
|
|
845
|
+
minutes_between_retries : int, default 2
|
|
846
|
+
Number of minutes between retries.
|
|
964
847
|
"""
|
|
965
848
|
...
|
|
966
849
|
|
|
967
850
|
@typing.overload
|
|
968
|
-
def
|
|
969
|
-
"""
|
|
970
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
971
|
-
|
|
972
|
-
Use `@pypi_base` to set common packages required by all
|
|
973
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
974
|
-
|
|
975
|
-
Parameters
|
|
976
|
-
----------
|
|
977
|
-
packages : Dict[str, str], default: {}
|
|
978
|
-
Packages to use for this flow. The key is the name of the package
|
|
979
|
-
and the value is the version to use.
|
|
980
|
-
python : str, optional, default: None
|
|
981
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
982
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
983
|
-
"""
|
|
851
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
984
852
|
...
|
|
985
853
|
|
|
986
854
|
@typing.overload
|
|
987
|
-
def
|
|
855
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
988
856
|
...
|
|
989
857
|
|
|
990
|
-
def
|
|
858
|
+
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):
|
|
991
859
|
"""
|
|
992
|
-
Specifies the
|
|
860
|
+
Specifies the number of times the task corresponding
|
|
861
|
+
to a step needs to be retried.
|
|
862
|
+
|
|
863
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
864
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
865
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
866
|
+
|
|
867
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
868
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
869
|
+
ensuring that the flow execution can continue.
|
|
993
870
|
|
|
994
|
-
Use `@pypi_base` to set common packages required by all
|
|
995
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
996
871
|
|
|
997
872
|
Parameters
|
|
998
873
|
----------
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1004
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
874
|
+
times : int, default 3
|
|
875
|
+
Number of times to retry this task.
|
|
876
|
+
minutes_between_retries : int, default 2
|
|
877
|
+
Number of minutes between retries.
|
|
1005
878
|
"""
|
|
1006
879
|
...
|
|
1007
880
|
|
|
@@ -1106,96 +979,46 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
|
1106
979
|
"""
|
|
1107
980
|
...
|
|
1108
981
|
|
|
1109
|
-
|
|
1110
|
-
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]]:
|
|
982
|
+
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]]:
|
|
1111
983
|
"""
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
or
|
|
1118
|
-
```
|
|
1119
|
-
@trigger(events=['foo', 'bar'])
|
|
1120
|
-
```
|
|
1121
|
-
|
|
1122
|
-
Additionally, you can specify the parameter mappings
|
|
1123
|
-
to map event payload to Metaflow parameters for the flow.
|
|
1124
|
-
```
|
|
1125
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1126
|
-
```
|
|
1127
|
-
or
|
|
1128
|
-
```
|
|
1129
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1130
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1131
|
-
```
|
|
1132
|
-
|
|
1133
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
1134
|
-
```
|
|
1135
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1136
|
-
```
|
|
1137
|
-
This is equivalent to:
|
|
1138
|
-
```
|
|
1139
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1140
|
-
```
|
|
984
|
+
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)
|
|
985
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
986
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
987
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
988
|
+
starts only after all sensors finish.
|
|
1141
989
|
|
|
1142
990
|
|
|
1143
991
|
Parameters
|
|
1144
992
|
----------
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
```
|
|
1175
|
-
or
|
|
1176
|
-
```
|
|
1177
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1178
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1179
|
-
```
|
|
1180
|
-
|
|
1181
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
1182
|
-
```
|
|
1183
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1184
|
-
```
|
|
1185
|
-
This is equivalent to:
|
|
1186
|
-
```
|
|
1187
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1188
|
-
```
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
Parameters
|
|
1192
|
-
----------
|
|
1193
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
|
1194
|
-
Event dependency for this flow.
|
|
1195
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
|
1196
|
-
Events dependency for this flow.
|
|
1197
|
-
options : Dict[str, Any], default {}
|
|
1198
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
993
|
+
timeout : int
|
|
994
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
995
|
+
poke_interval : int
|
|
996
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
997
|
+
mode : str
|
|
998
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
999
|
+
exponential_backoff : bool
|
|
1000
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1001
|
+
pool : str
|
|
1002
|
+
the slot pool this task should run in,
|
|
1003
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1004
|
+
soft_fail : bool
|
|
1005
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1006
|
+
name : str
|
|
1007
|
+
Name of the sensor on Airflow
|
|
1008
|
+
description : str
|
|
1009
|
+
Description of sensor in the Airflow UI
|
|
1010
|
+
bucket_key : Union[str, List[str]]
|
|
1011
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1012
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1013
|
+
bucket_name : str
|
|
1014
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1015
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1016
|
+
wildcard_match : bool
|
|
1017
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1018
|
+
aws_conn_id : str
|
|
1019
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1020
|
+
verify : bool
|
|
1021
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1199
1022
|
"""
|
|
1200
1023
|
...
|
|
1201
1024
|
|
|
@@ -1250,49 +1073,6 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
|
1250
1073
|
"""
|
|
1251
1074
|
...
|
|
1252
1075
|
|
|
1253
|
-
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]]:
|
|
1254
|
-
"""
|
|
1255
|
-
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)
|
|
1256
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1257
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1258
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1259
|
-
starts only after all sensors finish.
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
Parameters
|
|
1263
|
-
----------
|
|
1264
|
-
timeout : int
|
|
1265
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1266
|
-
poke_interval : int
|
|
1267
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1268
|
-
mode : str
|
|
1269
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1270
|
-
exponential_backoff : bool
|
|
1271
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1272
|
-
pool : str
|
|
1273
|
-
the slot pool this task should run in,
|
|
1274
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1275
|
-
soft_fail : bool
|
|
1276
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1277
|
-
name : str
|
|
1278
|
-
Name of the sensor on Airflow
|
|
1279
|
-
description : str
|
|
1280
|
-
Description of sensor in the Airflow UI
|
|
1281
|
-
bucket_key : Union[str, List[str]]
|
|
1282
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1283
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1284
|
-
bucket_name : str
|
|
1285
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1286
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1287
|
-
wildcard_match : bool
|
|
1288
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1289
|
-
aws_conn_id : str
|
|
1290
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1291
|
-
verify : bool
|
|
1292
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1293
|
-
"""
|
|
1294
|
-
...
|
|
1295
|
-
|
|
1296
1076
|
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]]:
|
|
1297
1077
|
"""
|
|
1298
1078
|
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.
|
|
@@ -1336,3 +1116,223 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
|
1336
1116
|
"""
|
|
1337
1117
|
...
|
|
1338
1118
|
|
|
1119
|
+
@typing.overload
|
|
1120
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1121
|
+
"""
|
|
1122
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1123
|
+
|
|
1124
|
+
Use `@pypi_base` to set common packages required by all
|
|
1125
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1126
|
+
|
|
1127
|
+
Parameters
|
|
1128
|
+
----------
|
|
1129
|
+
packages : Dict[str, str], default: {}
|
|
1130
|
+
Packages to use for this flow. The key is the name of the package
|
|
1131
|
+
and the value is the version to use.
|
|
1132
|
+
python : str, optional, default: None
|
|
1133
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1134
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1135
|
+
"""
|
|
1136
|
+
...
|
|
1137
|
+
|
|
1138
|
+
@typing.overload
|
|
1139
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1140
|
+
...
|
|
1141
|
+
|
|
1142
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1143
|
+
"""
|
|
1144
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1145
|
+
|
|
1146
|
+
Use `@pypi_base` to set common packages required by all
|
|
1147
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1148
|
+
|
|
1149
|
+
Parameters
|
|
1150
|
+
----------
|
|
1151
|
+
packages : Dict[str, str], default: {}
|
|
1152
|
+
Packages to use for this flow. The key is the name of the package
|
|
1153
|
+
and the value is the version to use.
|
|
1154
|
+
python : str, optional, default: None
|
|
1155
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1156
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1157
|
+
"""
|
|
1158
|
+
...
|
|
1159
|
+
|
|
1160
|
+
@typing.overload
|
|
1161
|
+
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]]:
|
|
1162
|
+
"""
|
|
1163
|
+
Specifies the event(s) that this flow depends on.
|
|
1164
|
+
|
|
1165
|
+
```
|
|
1166
|
+
@trigger(event='foo')
|
|
1167
|
+
```
|
|
1168
|
+
or
|
|
1169
|
+
```
|
|
1170
|
+
@trigger(events=['foo', 'bar'])
|
|
1171
|
+
```
|
|
1172
|
+
|
|
1173
|
+
Additionally, you can specify the parameter mappings
|
|
1174
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1175
|
+
```
|
|
1176
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1177
|
+
```
|
|
1178
|
+
or
|
|
1179
|
+
```
|
|
1180
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1181
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1182
|
+
```
|
|
1183
|
+
|
|
1184
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1185
|
+
```
|
|
1186
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1187
|
+
```
|
|
1188
|
+
This is equivalent to:
|
|
1189
|
+
```
|
|
1190
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1191
|
+
```
|
|
1192
|
+
|
|
1193
|
+
|
|
1194
|
+
Parameters
|
|
1195
|
+
----------
|
|
1196
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1197
|
+
Event dependency for this flow.
|
|
1198
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1199
|
+
Events dependency for this flow.
|
|
1200
|
+
options : Dict[str, Any], default {}
|
|
1201
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1202
|
+
"""
|
|
1203
|
+
...
|
|
1204
|
+
|
|
1205
|
+
@typing.overload
|
|
1206
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1207
|
+
...
|
|
1208
|
+
|
|
1209
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
1210
|
+
"""
|
|
1211
|
+
Specifies the event(s) that this flow depends on.
|
|
1212
|
+
|
|
1213
|
+
```
|
|
1214
|
+
@trigger(event='foo')
|
|
1215
|
+
```
|
|
1216
|
+
or
|
|
1217
|
+
```
|
|
1218
|
+
@trigger(events=['foo', 'bar'])
|
|
1219
|
+
```
|
|
1220
|
+
|
|
1221
|
+
Additionally, you can specify the parameter mappings
|
|
1222
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1223
|
+
```
|
|
1224
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1225
|
+
```
|
|
1226
|
+
or
|
|
1227
|
+
```
|
|
1228
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1229
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1230
|
+
```
|
|
1231
|
+
|
|
1232
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1233
|
+
```
|
|
1234
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1235
|
+
```
|
|
1236
|
+
This is equivalent to:
|
|
1237
|
+
```
|
|
1238
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1239
|
+
```
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
Parameters
|
|
1243
|
+
----------
|
|
1244
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1245
|
+
Event dependency for this flow.
|
|
1246
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1247
|
+
Events dependency for this flow.
|
|
1248
|
+
options : Dict[str, Any], default {}
|
|
1249
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1250
|
+
"""
|
|
1251
|
+
...
|
|
1252
|
+
|
|
1253
|
+
@typing.overload
|
|
1254
|
+
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]]:
|
|
1255
|
+
"""
|
|
1256
|
+
Specifies the times when the flow should be run when running on a
|
|
1257
|
+
production scheduler.
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
Parameters
|
|
1261
|
+
----------
|
|
1262
|
+
hourly : bool, default False
|
|
1263
|
+
Run the workflow hourly.
|
|
1264
|
+
daily : bool, default True
|
|
1265
|
+
Run the workflow daily.
|
|
1266
|
+
weekly : bool, default False
|
|
1267
|
+
Run the workflow weekly.
|
|
1268
|
+
cron : str, optional, default None
|
|
1269
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1270
|
+
specified by this expression.
|
|
1271
|
+
timezone : str, optional, default None
|
|
1272
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1273
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1274
|
+
"""
|
|
1275
|
+
...
|
|
1276
|
+
|
|
1277
|
+
@typing.overload
|
|
1278
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1279
|
+
...
|
|
1280
|
+
|
|
1281
|
+
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):
|
|
1282
|
+
"""
|
|
1283
|
+
Specifies the times when the flow should be run when running on a
|
|
1284
|
+
production scheduler.
|
|
1285
|
+
|
|
1286
|
+
|
|
1287
|
+
Parameters
|
|
1288
|
+
----------
|
|
1289
|
+
hourly : bool, default False
|
|
1290
|
+
Run the workflow hourly.
|
|
1291
|
+
daily : bool, default True
|
|
1292
|
+
Run the workflow daily.
|
|
1293
|
+
weekly : bool, default False
|
|
1294
|
+
Run the workflow weekly.
|
|
1295
|
+
cron : str, optional, default None
|
|
1296
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1297
|
+
specified by this expression.
|
|
1298
|
+
timezone : str, optional, default None
|
|
1299
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1300
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1301
|
+
"""
|
|
1302
|
+
...
|
|
1303
|
+
|
|
1304
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1305
|
+
"""
|
|
1306
|
+
Specifies what flows belong to the same project.
|
|
1307
|
+
|
|
1308
|
+
A project-specific namespace is created for all flows that
|
|
1309
|
+
use the same `@project(name)`.
|
|
1310
|
+
|
|
1311
|
+
|
|
1312
|
+
Parameters
|
|
1313
|
+
----------
|
|
1314
|
+
name : str
|
|
1315
|
+
Project name. Make sure that the name is unique amongst all
|
|
1316
|
+
projects that use the same production scheduler. The name may
|
|
1317
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1318
|
+
|
|
1319
|
+
branch : Optional[str], default None
|
|
1320
|
+
The branch to use. If not specified, the branch is set to
|
|
1321
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1322
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1323
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1324
|
+
|
|
1325
|
+
production : bool, default False
|
|
1326
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1327
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1328
|
+
`production` in the decorator and on the command line.
|
|
1329
|
+
The project branch name will be:
|
|
1330
|
+
- if `branch` is specified:
|
|
1331
|
+
- if `production` is True: `prod.<branch>`
|
|
1332
|
+
- if `production` is False: `test.<branch>`
|
|
1333
|
+
- if `branch` is not specified:
|
|
1334
|
+
- if `production` is True: `prod`
|
|
1335
|
+
- if `production` is False: `user.<username>`
|
|
1336
|
+
"""
|
|
1337
|
+
...
|
|
1338
|
+
|