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