metaflow-stubs 2.19.0__py2.py3-none-any.whl → 2.19.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 +482 -482
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +4 -4
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +3 -3
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- 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 +2 -2
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +21 -21
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +5 -5
- metaflow-stubs/packaging_sys/backend.pyi +4 -4
- metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
- metaflow-stubs/packaging_sys/tar_backend.pyi +6 -6
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- 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 +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/dynamo_db_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/json_viewer.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +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/parsers.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +32 -32
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +7 -7
- 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 +2 -2
- metaflow-stubs/user_decorators/user_step_decorator.pyi +3 -3
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.19.0.dist-info → metaflow_stubs-2.19.2.dist-info}/METADATA +2 -2
- metaflow_stubs-2.19.2.dist-info/RECORD +168 -0
- metaflow_stubs-2.19.0.dist-info/RECORD +0 -168
- {metaflow_stubs-2.19.0.dist-info → metaflow_stubs-2.19.2.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.19.0.dist-info → metaflow_stubs-2.19.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.19.
|
|
4
|
-
# Generated on 2025-10-
|
|
3
|
+
# MF version: 2.19.2 #
|
|
4
|
+
# Generated on 2025-10-28T11:13:58.765115 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
@@ -47,10 +47,10 @@ from . import plugins as plugins
|
|
|
47
47
|
from .plugins.datatools.s3.s3 import S3 as S3
|
|
48
48
|
from . import includefile as includefile
|
|
49
49
|
from .includefile import IncludeFile as IncludeFile
|
|
50
|
-
from .plugins.parsers import yaml_parser as yaml_parser
|
|
51
50
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
52
51
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
53
52
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
53
|
+
from .plugins.parsers import yaml_parser as yaml_parser
|
|
54
54
|
from . import cards as cards
|
|
55
55
|
from . import client as client
|
|
56
56
|
from .client.core import namespace as namespace
|
|
@@ -155,21 +155,114 @@ def step(f: typing.Callable[[~FlowSpecDerived], NoneType] | typing.Callable[[~Fl
|
|
|
155
155
|
...
|
|
156
156
|
|
|
157
157
|
@typing.overload
|
|
158
|
-
def
|
|
158
|
+
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
159
159
|
"""
|
|
160
|
-
|
|
161
|
-
|
|
160
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
Parameters
|
|
164
|
+
----------
|
|
165
|
+
vars : Dict[str, str], default {}
|
|
166
|
+
Dictionary of environment variables to set.
|
|
162
167
|
"""
|
|
163
168
|
...
|
|
164
169
|
|
|
165
170
|
@typing.overload
|
|
166
|
-
def
|
|
171
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
167
172
|
...
|
|
168
173
|
|
|
169
|
-
|
|
174
|
+
@typing.overload
|
|
175
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
176
|
+
...
|
|
177
|
+
|
|
178
|
+
def environment(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, vars: typing.Dict[str, str] = {}):
|
|
170
179
|
"""
|
|
171
|
-
|
|
172
|
-
|
|
180
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
Parameters
|
|
184
|
+
----------
|
|
185
|
+
vars : Dict[str, str], default {}
|
|
186
|
+
Dictionary of environment variables to set.
|
|
187
|
+
"""
|
|
188
|
+
...
|
|
189
|
+
|
|
190
|
+
@typing.overload
|
|
191
|
+
def resources(*, cpu: int = 1, gpu: int | None = None, disk: int | None = None, memory: int = 4096, shared_memory: int | None = None) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
192
|
+
"""
|
|
193
|
+
Specifies the resources needed when executing this step.
|
|
194
|
+
|
|
195
|
+
Use `@resources` to specify the resource requirements
|
|
196
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
197
|
+
|
|
198
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
199
|
+
```
|
|
200
|
+
python myflow.py run --with batch
|
|
201
|
+
```
|
|
202
|
+
or
|
|
203
|
+
```
|
|
204
|
+
python myflow.py run --with kubernetes
|
|
205
|
+
```
|
|
206
|
+
which executes the flow on the desired system using the
|
|
207
|
+
requirements specified in `@resources`.
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
Parameters
|
|
211
|
+
----------
|
|
212
|
+
cpu : int, default 1
|
|
213
|
+
Number of CPUs required for this step.
|
|
214
|
+
gpu : int, optional, default None
|
|
215
|
+
Number of GPUs required for this step.
|
|
216
|
+
disk : int, optional, default None
|
|
217
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
218
|
+
memory : int, default 4096
|
|
219
|
+
Memory size (in MB) required for this step.
|
|
220
|
+
shared_memory : int, optional, default None
|
|
221
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
222
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
223
|
+
"""
|
|
224
|
+
...
|
|
225
|
+
|
|
226
|
+
@typing.overload
|
|
227
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
228
|
+
...
|
|
229
|
+
|
|
230
|
+
@typing.overload
|
|
231
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
232
|
+
...
|
|
233
|
+
|
|
234
|
+
def resources(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, cpu: int = 1, gpu: int | None = None, disk: int | None = None, memory: int = 4096, shared_memory: int | None = None):
|
|
235
|
+
"""
|
|
236
|
+
Specifies the resources needed when executing this step.
|
|
237
|
+
|
|
238
|
+
Use `@resources` to specify the resource requirements
|
|
239
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
240
|
+
|
|
241
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
242
|
+
```
|
|
243
|
+
python myflow.py run --with batch
|
|
244
|
+
```
|
|
245
|
+
or
|
|
246
|
+
```
|
|
247
|
+
python myflow.py run --with kubernetes
|
|
248
|
+
```
|
|
249
|
+
which executes the flow on the desired system using the
|
|
250
|
+
requirements specified in `@resources`.
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
Parameters
|
|
254
|
+
----------
|
|
255
|
+
cpu : int, default 1
|
|
256
|
+
Number of CPUs required for this step.
|
|
257
|
+
gpu : int, optional, default None
|
|
258
|
+
Number of GPUs required for this step.
|
|
259
|
+
disk : int, optional, default None
|
|
260
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
261
|
+
memory : int, default 4096
|
|
262
|
+
Memory size (in MB) required for this step.
|
|
263
|
+
shared_memory : int, optional, default None
|
|
264
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
265
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
173
266
|
"""
|
|
174
267
|
...
|
|
175
268
|
|
|
@@ -225,197 +318,122 @@ def catch(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_genera
|
|
|
225
318
|
...
|
|
226
319
|
|
|
227
320
|
@typing.overload
|
|
228
|
-
def
|
|
321
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
229
322
|
"""
|
|
230
|
-
Specifies the
|
|
323
|
+
Specifies the number of times the task corresponding
|
|
324
|
+
to a step needs to be retried.
|
|
231
325
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
326
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
327
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
328
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
329
|
+
|
|
330
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
331
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
332
|
+
ensuring that the flow execution can continue.
|
|
236
333
|
|
|
237
334
|
|
|
238
335
|
Parameters
|
|
239
336
|
----------
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
245
|
-
python : str, optional, default None
|
|
246
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
247
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
248
|
-
disabled : bool, default False
|
|
249
|
-
If set to True, disables @conda.
|
|
337
|
+
times : int, default 3
|
|
338
|
+
Number of times to retry this task.
|
|
339
|
+
minutes_between_retries : int, default 2
|
|
340
|
+
Number of minutes between retries.
|
|
250
341
|
"""
|
|
251
342
|
...
|
|
252
343
|
|
|
253
344
|
@typing.overload
|
|
254
|
-
def
|
|
345
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
255
346
|
...
|
|
256
347
|
|
|
257
348
|
@typing.overload
|
|
258
|
-
def
|
|
349
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
259
350
|
...
|
|
260
351
|
|
|
261
|
-
def
|
|
352
|
+
def retry(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, times: int = 3, minutes_between_retries: int = 2):
|
|
262
353
|
"""
|
|
263
|
-
Specifies the
|
|
354
|
+
Specifies the number of times the task corresponding
|
|
355
|
+
to a step needs to be retried.
|
|
264
356
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
357
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
358
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
359
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
360
|
+
|
|
361
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
362
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
363
|
+
ensuring that the flow execution can continue.
|
|
269
364
|
|
|
270
365
|
|
|
271
366
|
Parameters
|
|
272
367
|
----------
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
278
|
-
python : str, optional, default None
|
|
279
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
280
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
281
|
-
disabled : bool, default False
|
|
282
|
-
If set to True, disables @conda.
|
|
368
|
+
times : int, default 3
|
|
369
|
+
Number of times to retry this task.
|
|
370
|
+
minutes_between_retries : int, default 2
|
|
371
|
+
Number of minutes between retries.
|
|
283
372
|
"""
|
|
284
373
|
...
|
|
285
374
|
|
|
286
375
|
@typing.overload
|
|
287
|
-
def
|
|
376
|
+
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
288
377
|
"""
|
|
289
|
-
Specifies
|
|
378
|
+
Specifies a timeout for your step.
|
|
290
379
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
380
|
+
This decorator is useful if this step may hang indefinitely.
|
|
381
|
+
|
|
382
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
383
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
384
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
385
|
+
|
|
386
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
387
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
295
388
|
|
|
296
389
|
|
|
297
390
|
Parameters
|
|
298
391
|
----------
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
392
|
+
seconds : int, default 0
|
|
393
|
+
Number of seconds to wait prior to timing out.
|
|
394
|
+
minutes : int, default 0
|
|
395
|
+
Number of minutes to wait prior to timing out.
|
|
396
|
+
hours : int, default 0
|
|
397
|
+
Number of hours to wait prior to timing out.
|
|
305
398
|
"""
|
|
306
399
|
...
|
|
307
400
|
|
|
308
401
|
@typing.overload
|
|
309
|
-
def
|
|
402
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
310
403
|
...
|
|
311
404
|
|
|
312
405
|
@typing.overload
|
|
313
|
-
def
|
|
406
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
314
407
|
...
|
|
315
408
|
|
|
316
|
-
def
|
|
409
|
+
def timeout(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
|
317
410
|
"""
|
|
318
|
-
Specifies
|
|
411
|
+
Specifies a timeout for your step.
|
|
319
412
|
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
413
|
+
This decorator is useful if this step may hang indefinitely.
|
|
414
|
+
|
|
415
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
416
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
417
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
418
|
+
|
|
419
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
420
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
324
421
|
|
|
325
422
|
|
|
326
423
|
Parameters
|
|
327
424
|
----------
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
425
|
+
seconds : int, default 0
|
|
426
|
+
Number of seconds to wait prior to timing out.
|
|
427
|
+
minutes : int, default 0
|
|
428
|
+
Number of minutes to wait prior to timing out.
|
|
429
|
+
hours : int, default 0
|
|
430
|
+
Number of hours to wait prior to timing out.
|
|
334
431
|
"""
|
|
335
432
|
...
|
|
336
433
|
|
|
337
|
-
|
|
338
|
-
def resources(*, cpu: int = 1, gpu: int | None = None, disk: int | None = None, memory: int = 4096, shared_memory: int | None = None) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
434
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: str | None = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.List[str] | None = None, node_selector: typing.Dict[str, str] | str | None = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: int | None = 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: int | None = None, tmpfs_path: str | None = '/metaflow_temp', persistent_volume_claims: typing.Dict[str, str] | None = None, shared_memory: int | None = None, port: int | None = None, compute_pool: str | None = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Dict[str, typing.Any] | None = None) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
339
435
|
"""
|
|
340
|
-
Specifies
|
|
341
|
-
|
|
342
|
-
Use `@resources` to specify the resource requirements
|
|
343
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
344
|
-
|
|
345
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
346
|
-
```
|
|
347
|
-
python myflow.py run --with batch
|
|
348
|
-
```
|
|
349
|
-
or
|
|
350
|
-
```
|
|
351
|
-
python myflow.py run --with kubernetes
|
|
352
|
-
```
|
|
353
|
-
which executes the flow on the desired system using the
|
|
354
|
-
requirements specified in `@resources`.
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
Parameters
|
|
358
|
-
----------
|
|
359
|
-
cpu : int, default 1
|
|
360
|
-
Number of CPUs required for this step.
|
|
361
|
-
gpu : int, optional, default None
|
|
362
|
-
Number of GPUs required for this step.
|
|
363
|
-
disk : int, optional, default None
|
|
364
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
365
|
-
memory : int, default 4096
|
|
366
|
-
Memory size (in MB) required for this step.
|
|
367
|
-
shared_memory : int, optional, default None
|
|
368
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
369
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
370
|
-
"""
|
|
371
|
-
...
|
|
372
|
-
|
|
373
|
-
@typing.overload
|
|
374
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
375
|
-
...
|
|
376
|
-
|
|
377
|
-
@typing.overload
|
|
378
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
379
|
-
...
|
|
380
|
-
|
|
381
|
-
def resources(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, cpu: int = 1, gpu: int | None = None, disk: int | None = None, memory: int = 4096, shared_memory: int | None = None):
|
|
382
|
-
"""
|
|
383
|
-
Specifies the resources needed when executing this step.
|
|
384
|
-
|
|
385
|
-
Use `@resources` to specify the resource requirements
|
|
386
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
387
|
-
|
|
388
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
389
|
-
```
|
|
390
|
-
python myflow.py run --with batch
|
|
391
|
-
```
|
|
392
|
-
or
|
|
393
|
-
```
|
|
394
|
-
python myflow.py run --with kubernetes
|
|
395
|
-
```
|
|
396
|
-
which executes the flow on the desired system using the
|
|
397
|
-
requirements specified in `@resources`.
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
Parameters
|
|
401
|
-
----------
|
|
402
|
-
cpu : int, default 1
|
|
403
|
-
Number of CPUs required for this step.
|
|
404
|
-
gpu : int, optional, default None
|
|
405
|
-
Number of GPUs required for this step.
|
|
406
|
-
disk : int, optional, default None
|
|
407
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
408
|
-
memory : int, default 4096
|
|
409
|
-
Memory size (in MB) required for this step.
|
|
410
|
-
shared_memory : int, optional, default None
|
|
411
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
412
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
413
|
-
"""
|
|
414
|
-
...
|
|
415
|
-
|
|
416
|
-
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: str | None = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.List[str] | None = None, node_selector: typing.Dict[str, str] | str | None = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: int | None = 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: int | None = None, tmpfs_path: str | None = '/metaflow_temp', persistent_volume_claims: typing.Dict[str, str] | None = None, shared_memory: int | None = None, port: int | None = None, compute_pool: str | None = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Dict[str, typing.Any] | None = None) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
417
|
-
"""
|
|
418
|
-
Specifies that this step should execute on Kubernetes.
|
|
436
|
+
Specifies that this step should execute on Kubernetes.
|
|
419
437
|
|
|
420
438
|
|
|
421
439
|
Parameters
|
|
@@ -503,94 +521,53 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: st
|
|
|
503
521
|
...
|
|
504
522
|
|
|
505
523
|
@typing.overload
|
|
506
|
-
def
|
|
507
|
-
"""
|
|
508
|
-
Specifies environment variables to be set prior to the execution of a step.
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
Parameters
|
|
512
|
-
----------
|
|
513
|
-
vars : Dict[str, str], default {}
|
|
514
|
-
Dictionary of environment variables to set.
|
|
515
|
-
"""
|
|
516
|
-
...
|
|
517
|
-
|
|
518
|
-
@typing.overload
|
|
519
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
520
|
-
...
|
|
521
|
-
|
|
522
|
-
@typing.overload
|
|
523
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
524
|
-
...
|
|
525
|
-
|
|
526
|
-
def environment(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, vars: typing.Dict[str, str] = {}):
|
|
527
|
-
"""
|
|
528
|
-
Specifies environment variables to be set prior to the execution of a step.
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
Parameters
|
|
532
|
-
----------
|
|
533
|
-
vars : Dict[str, str], default {}
|
|
534
|
-
Dictionary of environment variables to set.
|
|
535
|
-
"""
|
|
536
|
-
...
|
|
537
|
-
|
|
538
|
-
@typing.overload
|
|
539
|
-
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
524
|
+
def pypi(*, packages: typing.Dict[str, str] = {}, python: str | None = None) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
540
525
|
"""
|
|
541
|
-
Specifies
|
|
542
|
-
|
|
543
|
-
This decorator is useful if this step may hang indefinitely.
|
|
544
|
-
|
|
545
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
546
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
547
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
526
|
+
Specifies the PyPI packages for the step.
|
|
548
527
|
|
|
549
|
-
|
|
550
|
-
|
|
528
|
+
Information in this decorator will augment any
|
|
529
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
530
|
+
you can use `@pypi_base` to set packages required by all
|
|
531
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
551
532
|
|
|
552
533
|
|
|
553
534
|
Parameters
|
|
554
535
|
----------
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
536
|
+
packages : Dict[str, str], default: {}
|
|
537
|
+
Packages to use for this step. The key is the name of the package
|
|
538
|
+
and the value is the version to use.
|
|
539
|
+
python : str, optional, default: None
|
|
540
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
541
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
561
542
|
"""
|
|
562
543
|
...
|
|
563
544
|
|
|
564
545
|
@typing.overload
|
|
565
|
-
def
|
|
546
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
566
547
|
...
|
|
567
548
|
|
|
568
549
|
@typing.overload
|
|
569
|
-
def
|
|
550
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
570
551
|
...
|
|
571
552
|
|
|
572
|
-
def
|
|
553
|
+
def pypi(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, packages: typing.Dict[str, str] = {}, python: str | None = None):
|
|
573
554
|
"""
|
|
574
|
-
Specifies
|
|
575
|
-
|
|
576
|
-
This decorator is useful if this step may hang indefinitely.
|
|
577
|
-
|
|
578
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
579
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
580
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
555
|
+
Specifies the PyPI packages for the step.
|
|
581
556
|
|
|
582
|
-
|
|
583
|
-
|
|
557
|
+
Information in this decorator will augment any
|
|
558
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
559
|
+
you can use `@pypi_base` to set packages required by all
|
|
560
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
584
561
|
|
|
585
562
|
|
|
586
563
|
Parameters
|
|
587
564
|
----------
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
565
|
+
packages : Dict[str, str], default: {}
|
|
566
|
+
Packages to use for this step. The key is the name of the package
|
|
567
|
+
and the value is the version to use.
|
|
568
|
+
python : str, optional, default: None
|
|
569
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
570
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
594
571
|
"""
|
|
595
572
|
...
|
|
596
573
|
|
|
@@ -750,57 +727,100 @@ def batch(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_genera
|
|
|
750
727
|
...
|
|
751
728
|
|
|
752
729
|
@typing.overload
|
|
753
|
-
def
|
|
730
|
+
def secrets(*, sources: typing.List[str | typing.Dict[str, typing.Any]] = [], role: str | None = None) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
754
731
|
"""
|
|
755
|
-
Specifies
|
|
756
|
-
|
|
732
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
733
|
+
the execution of a step.
|
|
757
734
|
|
|
758
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
759
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
760
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
761
735
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
736
|
+
Parameters
|
|
737
|
+
----------
|
|
738
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
739
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
740
|
+
role : str, optional, default: None
|
|
741
|
+
Role to use for fetching secrets
|
|
742
|
+
"""
|
|
743
|
+
...
|
|
744
|
+
|
|
745
|
+
@typing.overload
|
|
746
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
747
|
+
...
|
|
748
|
+
|
|
749
|
+
@typing.overload
|
|
750
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
751
|
+
...
|
|
752
|
+
|
|
753
|
+
def secrets(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, sources: typing.List[str | typing.Dict[str, typing.Any]] = [], role: str | None = None):
|
|
754
|
+
"""
|
|
755
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
756
|
+
the execution of a step.
|
|
765
757
|
|
|
766
758
|
|
|
767
759
|
Parameters
|
|
768
760
|
----------
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
761
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
762
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
763
|
+
role : str, optional, default: None
|
|
764
|
+
Role to use for fetching secrets
|
|
773
765
|
"""
|
|
774
766
|
...
|
|
775
767
|
|
|
776
768
|
@typing.overload
|
|
777
|
-
def
|
|
769
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: str | None = None, disabled: bool = False) -> typing.Callable[[typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]], typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType]]:
|
|
770
|
+
"""
|
|
771
|
+
Specifies the Conda environment for the step.
|
|
772
|
+
|
|
773
|
+
Information in this decorator will augment any
|
|
774
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
775
|
+
you can use `@conda_base` to set packages required by all
|
|
776
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
Parameters
|
|
780
|
+
----------
|
|
781
|
+
packages : Dict[str, str], default {}
|
|
782
|
+
Packages to use for this step. The key is the name of the package
|
|
783
|
+
and the value is the version to use.
|
|
784
|
+
libraries : Dict[str, str], default {}
|
|
785
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
786
|
+
python : str, optional, default None
|
|
787
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
788
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
789
|
+
disabled : bool, default False
|
|
790
|
+
If set to True, disables @conda.
|
|
791
|
+
"""
|
|
778
792
|
...
|
|
779
793
|
|
|
780
794
|
@typing.overload
|
|
781
|
-
def
|
|
795
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
782
796
|
...
|
|
783
797
|
|
|
784
|
-
|
|
798
|
+
@typing.overload
|
|
799
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
800
|
+
...
|
|
801
|
+
|
|
802
|
+
def conda(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: str | None = None, disabled: bool = False):
|
|
785
803
|
"""
|
|
786
|
-
Specifies the
|
|
787
|
-
to a step needs to be retried.
|
|
788
|
-
|
|
789
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
790
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
791
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
804
|
+
Specifies the Conda environment for the step.
|
|
792
805
|
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
806
|
+
Information in this decorator will augment any
|
|
807
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
808
|
+
you can use `@conda_base` to set packages required by all
|
|
809
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
796
810
|
|
|
797
811
|
|
|
798
812
|
Parameters
|
|
799
813
|
----------
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
814
|
+
packages : Dict[str, str], default {}
|
|
815
|
+
Packages to use for this step. The key is the name of the package
|
|
816
|
+
and the value is the version to use.
|
|
817
|
+
libraries : Dict[str, str], default {}
|
|
818
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
819
|
+
python : str, optional, default None
|
|
820
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
821
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
822
|
+
disabled : bool, default False
|
|
823
|
+
If set to True, disables @conda.
|
|
804
824
|
"""
|
|
805
825
|
...
|
|
806
826
|
|
|
@@ -854,178 +874,21 @@ def card(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generat
|
|
|
854
874
|
...
|
|
855
875
|
|
|
856
876
|
@typing.overload
|
|
857
|
-
def
|
|
877
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
858
878
|
"""
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
Parameters
|
|
864
|
-
----------
|
|
865
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
866
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
867
|
-
role : str, optional, default: None
|
|
868
|
-
Role to use for fetching secrets
|
|
869
|
-
"""
|
|
870
|
-
...
|
|
871
|
-
|
|
872
|
-
@typing.overload
|
|
873
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
874
|
-
...
|
|
875
|
-
|
|
876
|
-
@typing.overload
|
|
877
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
878
|
-
...
|
|
879
|
-
|
|
880
|
-
def secrets(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None, *, sources: typing.List[str | typing.Dict[str, typing.Any]] = [], role: str | None = None):
|
|
881
|
-
"""
|
|
882
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
883
|
-
the execution of a step.
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
Parameters
|
|
887
|
-
----------
|
|
888
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
889
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
890
|
-
role : str, optional, default: None
|
|
891
|
-
Role to use for fetching secrets
|
|
892
|
-
"""
|
|
893
|
-
...
|
|
894
|
-
|
|
895
|
-
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]]:
|
|
896
|
-
"""
|
|
897
|
-
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.
|
|
898
|
-
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.
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
Parameters
|
|
902
|
-
----------
|
|
903
|
-
timeout : int
|
|
904
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
905
|
-
poke_interval : int
|
|
906
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
907
|
-
mode : str
|
|
908
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
909
|
-
exponential_backoff : bool
|
|
910
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
911
|
-
pool : str
|
|
912
|
-
the slot pool this task should run in,
|
|
913
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
914
|
-
soft_fail : bool
|
|
915
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
916
|
-
name : str
|
|
917
|
-
Name of the sensor on Airflow
|
|
918
|
-
description : str
|
|
919
|
-
Description of sensor in the Airflow UI
|
|
920
|
-
external_dag_id : str
|
|
921
|
-
The dag_id that contains the task you want to wait for.
|
|
922
|
-
external_task_ids : List[str]
|
|
923
|
-
The list of task_ids that you want to wait for.
|
|
924
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
925
|
-
allowed_states : List[str]
|
|
926
|
-
Iterable of allowed states, (Default: ['success'])
|
|
927
|
-
failed_states : List[str]
|
|
928
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
929
|
-
execution_delta : datetime.timedelta
|
|
930
|
-
time difference with the previous execution to look at,
|
|
931
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
932
|
-
check_existence: bool
|
|
933
|
-
Set to True to check if the external task exists or check if
|
|
934
|
-
the DAG to wait for exists. (Default: True)
|
|
935
|
-
"""
|
|
936
|
-
...
|
|
937
|
-
|
|
938
|
-
@typing.overload
|
|
939
|
-
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: str | None = None, timezone: str | None = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
940
|
-
"""
|
|
941
|
-
Specifies the times when the flow should be run when running on a
|
|
942
|
-
production scheduler.
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
Parameters
|
|
946
|
-
----------
|
|
947
|
-
hourly : bool, default False
|
|
948
|
-
Run the workflow hourly.
|
|
949
|
-
daily : bool, default True
|
|
950
|
-
Run the workflow daily.
|
|
951
|
-
weekly : bool, default False
|
|
952
|
-
Run the workflow weekly.
|
|
953
|
-
cron : str, optional, default None
|
|
954
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
955
|
-
specified by this expression.
|
|
956
|
-
timezone : str, optional, default None
|
|
957
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
958
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
879
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
880
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
959
881
|
"""
|
|
960
882
|
...
|
|
961
883
|
|
|
962
884
|
@typing.overload
|
|
963
|
-
def
|
|
964
|
-
...
|
|
965
|
-
|
|
966
|
-
def schedule(f: typing.Type[~FlowSpecDerived] | None = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: str | None = None, timezone: str | None = None):
|
|
967
|
-
"""
|
|
968
|
-
Specifies the times when the flow should be run when running on a
|
|
969
|
-
production scheduler.
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
Parameters
|
|
973
|
-
----------
|
|
974
|
-
hourly : bool, default False
|
|
975
|
-
Run the workflow hourly.
|
|
976
|
-
daily : bool, default True
|
|
977
|
-
Run the workflow daily.
|
|
978
|
-
weekly : bool, default False
|
|
979
|
-
Run the workflow weekly.
|
|
980
|
-
cron : str, optional, default None
|
|
981
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
982
|
-
specified by this expression.
|
|
983
|
-
timezone : str, optional, default None
|
|
984
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
985
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
986
|
-
"""
|
|
885
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
987
886
|
...
|
|
988
887
|
|
|
989
|
-
def
|
|
888
|
+
def parallel(f: typing.Callable[[~FlowSpecDerived, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | typing.Callable[[~FlowSpecDerived, typing.Any, metaflow.cmd.develop.stub_generator.StepFlag], NoneType] | None = None):
|
|
990
889
|
"""
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
994
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
995
|
-
starts only after all sensors finish.
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
Parameters
|
|
999
|
-
----------
|
|
1000
|
-
timeout : int
|
|
1001
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1002
|
-
poke_interval : int
|
|
1003
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1004
|
-
mode : str
|
|
1005
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1006
|
-
exponential_backoff : bool
|
|
1007
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1008
|
-
pool : str
|
|
1009
|
-
the slot pool this task should run in,
|
|
1010
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1011
|
-
soft_fail : bool
|
|
1012
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1013
|
-
name : str
|
|
1014
|
-
Name of the sensor on Airflow
|
|
1015
|
-
description : str
|
|
1016
|
-
Description of sensor in the Airflow UI
|
|
1017
|
-
bucket_key : Union[str, List[str]]
|
|
1018
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1019
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1020
|
-
bucket_name : str
|
|
1021
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1022
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1023
|
-
wildcard_match : bool
|
|
1024
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1025
|
-
aws_conn_id : str
|
|
1026
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1027
|
-
verify : bool
|
|
1028
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
890
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
891
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
1029
892
|
"""
|
|
1030
893
|
...
|
|
1031
894
|
|
|
@@ -1130,89 +993,44 @@ def trigger_on_finish(f: typing.Type[~FlowSpecDerived] | None = None, *, flow: t
|
|
|
1130
993
|
"""
|
|
1131
994
|
...
|
|
1132
995
|
|
|
1133
|
-
def project(*, name: str, branch: str | None = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1134
|
-
"""
|
|
1135
|
-
Specifies what flows belong to the same project.
|
|
1136
|
-
|
|
1137
|
-
A project-specific namespace is created for all flows that
|
|
1138
|
-
use the same `@project(name)`.
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
Parameters
|
|
1142
|
-
----------
|
|
1143
|
-
name : str
|
|
1144
|
-
Project name. Make sure that the name is unique amongst all
|
|
1145
|
-
projects that use the same production scheduler. The name may
|
|
1146
|
-
contain only lowercase alphanumeric characters and underscores.
|
|
1147
|
-
|
|
1148
|
-
branch : Optional[str], default None
|
|
1149
|
-
The branch to use. If not specified, the branch is set to
|
|
1150
|
-
`user.<username>` unless `production` is set to `True`. This can
|
|
1151
|
-
also be set on the command line using `--branch` as a top-level option.
|
|
1152
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
|
1153
|
-
|
|
1154
|
-
production : bool, default False
|
|
1155
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
1156
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
1157
|
-
`production` in the decorator and on the command line.
|
|
1158
|
-
The project branch name will be:
|
|
1159
|
-
- if `branch` is specified:
|
|
1160
|
-
- if `production` is True: `prod.<branch>`
|
|
1161
|
-
- if `production` is False: `test.<branch>`
|
|
1162
|
-
- if `branch` is not specified:
|
|
1163
|
-
- if `production` is True: `prod`
|
|
1164
|
-
- if `production` is False: `user.<username>`
|
|
1165
|
-
"""
|
|
1166
|
-
...
|
|
1167
|
-
|
|
1168
996
|
@typing.overload
|
|
1169
|
-
def
|
|
997
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: str | None = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1170
998
|
"""
|
|
1171
|
-
Specifies the
|
|
1172
|
-
|
|
1173
|
-
Use `@conda_base` to set common libraries required by all
|
|
1174
|
-
steps and use `@conda` to specify step-specific additions.
|
|
999
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1175
1000
|
|
|
1001
|
+
Use `@pypi_base` to set common packages required by all
|
|
1002
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1176
1003
|
|
|
1177
1004
|
Parameters
|
|
1178
1005
|
----------
|
|
1179
|
-
packages : Dict[str, str], default {}
|
|
1006
|
+
packages : Dict[str, str], default: {}
|
|
1180
1007
|
Packages to use for this flow. The key is the name of the package
|
|
1181
1008
|
and the value is the version to use.
|
|
1182
|
-
|
|
1183
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1184
|
-
python : str, optional, default None
|
|
1009
|
+
python : str, optional, default: None
|
|
1185
1010
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1186
1011
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1187
|
-
disabled : bool, default False
|
|
1188
|
-
If set to True, disables Conda.
|
|
1189
1012
|
"""
|
|
1190
1013
|
...
|
|
1191
1014
|
|
|
1192
1015
|
@typing.overload
|
|
1193
|
-
def
|
|
1016
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1194
1017
|
...
|
|
1195
1018
|
|
|
1196
|
-
def
|
|
1019
|
+
def pypi_base(f: typing.Type[~FlowSpecDerived] | None = None, *, packages: typing.Dict[str, str] = {}, python: str | None = None):
|
|
1197
1020
|
"""
|
|
1198
|
-
Specifies the
|
|
1199
|
-
|
|
1200
|
-
Use `@conda_base` to set common libraries required by all
|
|
1201
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1021
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1202
1022
|
|
|
1023
|
+
Use `@pypi_base` to set common packages required by all
|
|
1024
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1203
1025
|
|
|
1204
1026
|
Parameters
|
|
1205
1027
|
----------
|
|
1206
|
-
packages : Dict[str, str], default {}
|
|
1028
|
+
packages : Dict[str, str], default: {}
|
|
1207
1029
|
Packages to use for this flow. The key is the name of the package
|
|
1208
1030
|
and the value is the version to use.
|
|
1209
|
-
|
|
1210
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1211
|
-
python : str, optional, default None
|
|
1031
|
+
python : str, optional, default: None
|
|
1212
1032
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1213
1033
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1214
|
-
disabled : bool, default False
|
|
1215
|
-
If set to True, disables Conda.
|
|
1216
1034
|
"""
|
|
1217
1035
|
...
|
|
1218
1036
|
|
|
@@ -1309,44 +1127,226 @@ def trigger(f: typing.Type[~FlowSpecDerived] | None = None, *, event: str | typi
|
|
|
1309
1127
|
"""
|
|
1310
1128
|
...
|
|
1311
1129
|
|
|
1130
|
+
def project(*, name: str, branch: str | None = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1131
|
+
"""
|
|
1132
|
+
Specifies what flows belong to the same project.
|
|
1133
|
+
|
|
1134
|
+
A project-specific namespace is created for all flows that
|
|
1135
|
+
use the same `@project(name)`.
|
|
1136
|
+
|
|
1137
|
+
|
|
1138
|
+
Parameters
|
|
1139
|
+
----------
|
|
1140
|
+
name : str
|
|
1141
|
+
Project name. Make sure that the name is unique amongst all
|
|
1142
|
+
projects that use the same production scheduler. The name may
|
|
1143
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1144
|
+
|
|
1145
|
+
branch : Optional[str], default None
|
|
1146
|
+
The branch to use. If not specified, the branch is set to
|
|
1147
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1148
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1149
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1150
|
+
|
|
1151
|
+
production : bool, default False
|
|
1152
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1153
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1154
|
+
`production` in the decorator and on the command line.
|
|
1155
|
+
The project branch name will be:
|
|
1156
|
+
- if `branch` is specified:
|
|
1157
|
+
- if `production` is True: `prod.<branch>`
|
|
1158
|
+
- if `production` is False: `test.<branch>`
|
|
1159
|
+
- if `branch` is not specified:
|
|
1160
|
+
- if `production` is True: `prod`
|
|
1161
|
+
- if `production` is False: `user.<username>`
|
|
1162
|
+
"""
|
|
1163
|
+
...
|
|
1164
|
+
|
|
1165
|
+
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]]:
|
|
1166
|
+
"""
|
|
1167
|
+
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.
|
|
1168
|
+
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.
|
|
1169
|
+
|
|
1170
|
+
|
|
1171
|
+
Parameters
|
|
1172
|
+
----------
|
|
1173
|
+
timeout : int
|
|
1174
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1175
|
+
poke_interval : int
|
|
1176
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1177
|
+
mode : str
|
|
1178
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1179
|
+
exponential_backoff : bool
|
|
1180
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1181
|
+
pool : str
|
|
1182
|
+
the slot pool this task should run in,
|
|
1183
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1184
|
+
soft_fail : bool
|
|
1185
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1186
|
+
name : str
|
|
1187
|
+
Name of the sensor on Airflow
|
|
1188
|
+
description : str
|
|
1189
|
+
Description of sensor in the Airflow UI
|
|
1190
|
+
external_dag_id : str
|
|
1191
|
+
The dag_id that contains the task you want to wait for.
|
|
1192
|
+
external_task_ids : List[str]
|
|
1193
|
+
The list of task_ids that you want to wait for.
|
|
1194
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1195
|
+
allowed_states : List[str]
|
|
1196
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1197
|
+
failed_states : List[str]
|
|
1198
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1199
|
+
execution_delta : datetime.timedelta
|
|
1200
|
+
time difference with the previous execution to look at,
|
|
1201
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1202
|
+
check_existence: bool
|
|
1203
|
+
Set to True to check if the external task exists or check if
|
|
1204
|
+
the DAG to wait for exists. (Default: True)
|
|
1205
|
+
"""
|
|
1206
|
+
...
|
|
1207
|
+
|
|
1312
1208
|
@typing.overload
|
|
1313
|
-
def
|
|
1209
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: str | None = None, timezone: str | None = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1314
1210
|
"""
|
|
1315
|
-
Specifies the
|
|
1211
|
+
Specifies the times when the flow should be run when running on a
|
|
1212
|
+
production scheduler.
|
|
1316
1213
|
|
|
1317
|
-
Use `@pypi_base` to set common packages required by all
|
|
1318
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1319
1214
|
|
|
1320
1215
|
Parameters
|
|
1321
1216
|
----------
|
|
1322
|
-
|
|
1217
|
+
hourly : bool, default False
|
|
1218
|
+
Run the workflow hourly.
|
|
1219
|
+
daily : bool, default True
|
|
1220
|
+
Run the workflow daily.
|
|
1221
|
+
weekly : bool, default False
|
|
1222
|
+
Run the workflow weekly.
|
|
1223
|
+
cron : str, optional, default None
|
|
1224
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1225
|
+
specified by this expression.
|
|
1226
|
+
timezone : str, optional, default None
|
|
1227
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1228
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1229
|
+
"""
|
|
1230
|
+
...
|
|
1231
|
+
|
|
1232
|
+
@typing.overload
|
|
1233
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1234
|
+
...
|
|
1235
|
+
|
|
1236
|
+
def schedule(f: typing.Type[~FlowSpecDerived] | None = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: str | None = None, timezone: str | None = None):
|
|
1237
|
+
"""
|
|
1238
|
+
Specifies the times when the flow should be run when running on a
|
|
1239
|
+
production scheduler.
|
|
1240
|
+
|
|
1241
|
+
|
|
1242
|
+
Parameters
|
|
1243
|
+
----------
|
|
1244
|
+
hourly : bool, default False
|
|
1245
|
+
Run the workflow hourly.
|
|
1246
|
+
daily : bool, default True
|
|
1247
|
+
Run the workflow daily.
|
|
1248
|
+
weekly : bool, default False
|
|
1249
|
+
Run the workflow weekly.
|
|
1250
|
+
cron : str, optional, default None
|
|
1251
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1252
|
+
specified by this expression.
|
|
1253
|
+
timezone : str, optional, default None
|
|
1254
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1255
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1256
|
+
"""
|
|
1257
|
+
...
|
|
1258
|
+
|
|
1259
|
+
@typing.overload
|
|
1260
|
+
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: str | None = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1261
|
+
"""
|
|
1262
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1263
|
+
|
|
1264
|
+
Use `@conda_base` to set common libraries required by all
|
|
1265
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1266
|
+
|
|
1267
|
+
|
|
1268
|
+
Parameters
|
|
1269
|
+
----------
|
|
1270
|
+
packages : Dict[str, str], default {}
|
|
1323
1271
|
Packages to use for this flow. The key is the name of the package
|
|
1324
1272
|
and the value is the version to use.
|
|
1325
|
-
|
|
1273
|
+
libraries : Dict[str, str], default {}
|
|
1274
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1275
|
+
python : str, optional, default None
|
|
1326
1276
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1327
1277
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1278
|
+
disabled : bool, default False
|
|
1279
|
+
If set to True, disables Conda.
|
|
1328
1280
|
"""
|
|
1329
1281
|
...
|
|
1330
1282
|
|
|
1331
1283
|
@typing.overload
|
|
1332
|
-
def
|
|
1284
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1333
1285
|
...
|
|
1334
1286
|
|
|
1335
|
-
def
|
|
1287
|
+
def conda_base(f: typing.Type[~FlowSpecDerived] | None = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: str | None = None, disabled: bool = False):
|
|
1336
1288
|
"""
|
|
1337
|
-
Specifies the
|
|
1289
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1290
|
+
|
|
1291
|
+
Use `@conda_base` to set common libraries required by all
|
|
1292
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1338
1293
|
|
|
1339
|
-
Use `@pypi_base` to set common packages required by all
|
|
1340
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1341
1294
|
|
|
1342
1295
|
Parameters
|
|
1343
1296
|
----------
|
|
1344
|
-
packages : Dict[str, str], default
|
|
1297
|
+
packages : Dict[str, str], default {}
|
|
1345
1298
|
Packages to use for this flow. The key is the name of the package
|
|
1346
1299
|
and the value is the version to use.
|
|
1347
|
-
|
|
1300
|
+
libraries : Dict[str, str], default {}
|
|
1301
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1302
|
+
python : str, optional, default None
|
|
1348
1303
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1349
1304
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1305
|
+
disabled : bool, default False
|
|
1306
|
+
If set to True, disables Conda.
|
|
1307
|
+
"""
|
|
1308
|
+
...
|
|
1309
|
+
|
|
1310
|
+
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: str | typing.List[str], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1311
|
+
"""
|
|
1312
|
+
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)
|
|
1313
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1314
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1315
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1316
|
+
starts only after all sensors finish.
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
Parameters
|
|
1320
|
+
----------
|
|
1321
|
+
timeout : int
|
|
1322
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1323
|
+
poke_interval : int
|
|
1324
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1325
|
+
mode : str
|
|
1326
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1327
|
+
exponential_backoff : bool
|
|
1328
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1329
|
+
pool : str
|
|
1330
|
+
the slot pool this task should run in,
|
|
1331
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1332
|
+
soft_fail : bool
|
|
1333
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1334
|
+
name : str
|
|
1335
|
+
Name of the sensor on Airflow
|
|
1336
|
+
description : str
|
|
1337
|
+
Description of sensor in the Airflow UI
|
|
1338
|
+
bucket_key : Union[str, List[str]]
|
|
1339
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1340
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1341
|
+
bucket_name : str
|
|
1342
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1343
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1344
|
+
wildcard_match : bool
|
|
1345
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1346
|
+
aws_conn_id : str
|
|
1347
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1348
|
+
verify : bool
|
|
1349
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1350
1350
|
"""
|
|
1351
1351
|
...
|
|
1352
1352
|
|