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