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