metaflow-stubs 2.17.3__py2.py3-none-any.whl → 2.17.4__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of metaflow-stubs might be problematic. Click here for more details.
- metaflow-stubs/__init__.pyi +526 -526
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +6 -6
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/meta_files.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +5 -5
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +5 -5
- metaflow-stubs/packaging_sys/backend.pyi +4 -4
- metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
- metaflow-stubs/packaging_sys/tar_backend.pyi +4 -4
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +4 -4
- 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 +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +4 -4
- metaflow-stubs/plugins/argo/exit_hooks.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +4 -4
- 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 +4 -4
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +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/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_job.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- 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/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +33 -33
- 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 +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_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- metaflow-stubs/user_decorators/__init__.pyi +2 -2
- metaflow-stubs/user_decorators/common.pyi +2 -2
- metaflow-stubs/user_decorators/mutable_flow.pyi +5 -5
- metaflow-stubs/user_decorators/mutable_step.pyi +6 -6
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +4 -4
- metaflow-stubs/user_decorators/user_step_decorator.pyi +7 -7
- metaflow-stubs/version.pyi +2 -2
- {metaflow_stubs-2.17.3.dist-info → metaflow_stubs-2.17.4.dist-info}/METADATA +2 -2
- metaflow_stubs-2.17.4.dist-info/RECORD +166 -0
- metaflow_stubs-2.17.3.dist-info/RECORD +0 -166
- {metaflow_stubs-2.17.3.dist-info → metaflow_stubs-2.17.4.dist-info}/WHEEL +0 -0
- {metaflow_stubs-2.17.3.dist-info → metaflow_stubs-2.17.4.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.17.
|
|
4
|
-
# Generated on 2025-08-
|
|
3
|
+
# MF version: 2.17.4 #
|
|
4
|
+
# Generated on 2025-08-25T17:38:02.332471 #
|
|
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
|
|
|
@@ -204,139 +204,92 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
204
204
|
...
|
|
205
205
|
|
|
206
206
|
@typing.overload
|
|
207
|
-
def
|
|
207
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
208
208
|
"""
|
|
209
|
-
Specifies
|
|
210
|
-
|
|
211
|
-
This decorator is useful if this step may hang indefinitely.
|
|
212
|
-
|
|
213
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
214
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
215
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
216
|
-
|
|
217
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
218
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
209
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
210
|
+
the execution of a step.
|
|
219
211
|
|
|
220
212
|
|
|
221
213
|
Parameters
|
|
222
214
|
----------
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
hours : int, default 0
|
|
228
|
-
Number of hours to wait prior to timing out.
|
|
215
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
216
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
217
|
+
role : str, optional, default: None
|
|
218
|
+
Role to use for fetching secrets
|
|
229
219
|
"""
|
|
230
220
|
...
|
|
231
221
|
|
|
232
222
|
@typing.overload
|
|
233
|
-
def
|
|
223
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
234
224
|
...
|
|
235
225
|
|
|
236
226
|
@typing.overload
|
|
237
|
-
def
|
|
227
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
238
228
|
...
|
|
239
229
|
|
|
240
|
-
def
|
|
230
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: typing.Optional[str] = None):
|
|
241
231
|
"""
|
|
242
|
-
Specifies
|
|
243
|
-
|
|
244
|
-
This decorator is useful if this step may hang indefinitely.
|
|
245
|
-
|
|
246
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
247
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
248
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
249
|
-
|
|
250
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
251
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
232
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
233
|
+
the execution of a step.
|
|
252
234
|
|
|
253
235
|
|
|
254
236
|
Parameters
|
|
255
237
|
----------
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
hours : int, default 0
|
|
261
|
-
Number of hours to wait prior to timing out.
|
|
262
|
-
"""
|
|
263
|
-
...
|
|
264
|
-
|
|
265
|
-
@typing.overload
|
|
266
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
267
|
-
"""
|
|
268
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
269
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
270
|
-
"""
|
|
271
|
-
...
|
|
272
|
-
|
|
273
|
-
@typing.overload
|
|
274
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
275
|
-
...
|
|
276
|
-
|
|
277
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
278
|
-
"""
|
|
279
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
280
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
238
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
239
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
240
|
+
role : str, optional, default: None
|
|
241
|
+
Role to use for fetching secrets
|
|
281
242
|
"""
|
|
282
243
|
...
|
|
283
244
|
|
|
284
245
|
@typing.overload
|
|
285
|
-
def
|
|
246
|
+
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]]]:
|
|
286
247
|
"""
|
|
287
|
-
Specifies the
|
|
248
|
+
Specifies the PyPI packages for the step.
|
|
288
249
|
|
|
289
250
|
Information in this decorator will augment any
|
|
290
|
-
attributes set in the `@
|
|
291
|
-
you can use `@
|
|
292
|
-
steps and use `@
|
|
251
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
252
|
+
you can use `@pypi_base` to set packages required by all
|
|
253
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
293
254
|
|
|
294
255
|
|
|
295
256
|
Parameters
|
|
296
257
|
----------
|
|
297
|
-
packages : Dict[str, str], default {}
|
|
258
|
+
packages : Dict[str, str], default: {}
|
|
298
259
|
Packages to use for this step. The key is the name of the package
|
|
299
260
|
and the value is the version to use.
|
|
300
|
-
|
|
301
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
302
|
-
python : str, optional, default None
|
|
261
|
+
python : str, optional, default: None
|
|
303
262
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
304
263
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
305
|
-
disabled : bool, default False
|
|
306
|
-
If set to True, disables @conda.
|
|
307
264
|
"""
|
|
308
265
|
...
|
|
309
266
|
|
|
310
267
|
@typing.overload
|
|
311
|
-
def
|
|
268
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
312
269
|
...
|
|
313
270
|
|
|
314
271
|
@typing.overload
|
|
315
|
-
def
|
|
272
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
316
273
|
...
|
|
317
274
|
|
|
318
|
-
def
|
|
275
|
+
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):
|
|
319
276
|
"""
|
|
320
|
-
Specifies the
|
|
277
|
+
Specifies the PyPI packages for the step.
|
|
321
278
|
|
|
322
279
|
Information in this decorator will augment any
|
|
323
|
-
attributes set in the `@
|
|
324
|
-
you can use `@
|
|
325
|
-
steps and use `@
|
|
280
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
281
|
+
you can use `@pypi_base` to set packages required by all
|
|
282
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
326
283
|
|
|
327
284
|
|
|
328
285
|
Parameters
|
|
329
286
|
----------
|
|
330
|
-
packages : Dict[str, str], default {}
|
|
287
|
+
packages : Dict[str, str], default: {}
|
|
331
288
|
Packages to use for this step. The key is the name of the package
|
|
332
289
|
and the value is the version to use.
|
|
333
|
-
|
|
334
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
335
|
-
python : str, optional, default None
|
|
290
|
+
python : str, optional, default: None
|
|
336
291
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
337
292
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
338
|
-
disabled : bool, default False
|
|
339
|
-
If set to True, disables @conda.
|
|
340
293
|
"""
|
|
341
294
|
...
|
|
342
295
|
|
|
@@ -420,179 +373,168 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
|
420
373
|
...
|
|
421
374
|
|
|
422
375
|
@typing.overload
|
|
423
|
-
def
|
|
376
|
+
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]]]:
|
|
424
377
|
"""
|
|
425
|
-
|
|
378
|
+
Specifies a timeout for your step.
|
|
426
379
|
|
|
427
|
-
|
|
380
|
+
This decorator is useful if this step may hang indefinitely.
|
|
381
|
+
|
|
382
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
383
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
384
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
385
|
+
|
|
386
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
387
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
428
388
|
|
|
429
389
|
|
|
430
390
|
Parameters
|
|
431
391
|
----------
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
timeout : int, default 45
|
|
439
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
392
|
+
seconds : int, default 0
|
|
393
|
+
Number of seconds to wait prior to timing out.
|
|
394
|
+
minutes : int, default 0
|
|
395
|
+
Number of minutes to wait prior to timing out.
|
|
396
|
+
hours : int, default 0
|
|
397
|
+
Number of hours to wait prior to timing out.
|
|
440
398
|
"""
|
|
441
399
|
...
|
|
442
400
|
|
|
443
401
|
@typing.overload
|
|
444
|
-
def
|
|
402
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
445
403
|
...
|
|
446
404
|
|
|
447
405
|
@typing.overload
|
|
448
|
-
def
|
|
406
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
449
407
|
...
|
|
450
408
|
|
|
451
|
-
def
|
|
409
|
+
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):
|
|
452
410
|
"""
|
|
453
|
-
|
|
411
|
+
Specifies a timeout for your step.
|
|
454
412
|
|
|
455
|
-
|
|
413
|
+
This decorator is useful if this step may hang indefinitely.
|
|
414
|
+
|
|
415
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
416
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
417
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
418
|
+
|
|
419
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
420
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
456
421
|
|
|
457
422
|
|
|
458
423
|
Parameters
|
|
459
424
|
----------
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
timeout : int, default 45
|
|
467
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
425
|
+
seconds : int, default 0
|
|
426
|
+
Number of seconds to wait prior to timing out.
|
|
427
|
+
minutes : int, default 0
|
|
428
|
+
Number of minutes to wait prior to timing out.
|
|
429
|
+
hours : int, default 0
|
|
430
|
+
Number of hours to wait prior to timing out.
|
|
468
431
|
"""
|
|
469
432
|
...
|
|
470
433
|
|
|
471
434
|
@typing.overload
|
|
472
|
-
def
|
|
435
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
473
436
|
"""
|
|
474
|
-
|
|
475
|
-
|
|
437
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
438
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
439
|
+
"""
|
|
440
|
+
...
|
|
441
|
+
|
|
442
|
+
@typing.overload
|
|
443
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
444
|
+
...
|
|
445
|
+
|
|
446
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
447
|
+
"""
|
|
448
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
449
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
450
|
+
"""
|
|
451
|
+
...
|
|
452
|
+
|
|
453
|
+
@typing.overload
|
|
454
|
+
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]]]:
|
|
455
|
+
"""
|
|
456
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
476
457
|
|
|
477
458
|
|
|
478
459
|
Parameters
|
|
479
460
|
----------
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
role : str, optional, default: None
|
|
483
|
-
Role to use for fetching secrets
|
|
461
|
+
vars : Dict[str, str], default {}
|
|
462
|
+
Dictionary of environment variables to set.
|
|
484
463
|
"""
|
|
485
464
|
...
|
|
486
465
|
|
|
487
466
|
@typing.overload
|
|
488
|
-
def
|
|
467
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
489
468
|
...
|
|
490
469
|
|
|
491
470
|
@typing.overload
|
|
492
|
-
def
|
|
471
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
493
472
|
...
|
|
494
473
|
|
|
495
|
-
def
|
|
474
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
496
475
|
"""
|
|
497
|
-
Specifies
|
|
498
|
-
the execution of a step.
|
|
476
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
499
477
|
|
|
500
478
|
|
|
501
479
|
Parameters
|
|
502
480
|
----------
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
role : str, optional, default: None
|
|
506
|
-
Role to use for fetching secrets
|
|
481
|
+
vars : Dict[str, str], default {}
|
|
482
|
+
Dictionary of environment variables to set.
|
|
507
483
|
"""
|
|
508
484
|
...
|
|
509
485
|
|
|
510
|
-
|
|
486
|
+
@typing.overload
|
|
487
|
+
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]]]:
|
|
511
488
|
"""
|
|
512
|
-
Specifies
|
|
489
|
+
Specifies the number of times the task corresponding
|
|
490
|
+
to a step needs to be retried.
|
|
491
|
+
|
|
492
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
493
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
494
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
495
|
+
|
|
496
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
497
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
498
|
+
ensuring that the flow execution can continue.
|
|
513
499
|
|
|
514
500
|
|
|
515
501
|
Parameters
|
|
516
502
|
----------
|
|
517
|
-
|
|
518
|
-
Number of
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
Kubernetes image pull secrets to use when pulling container images
|
|
537
|
-
in Kubernetes.
|
|
538
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
539
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
|
540
|
-
secrets : List[str], optional, default None
|
|
541
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
542
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
543
|
-
in Metaflow configuration.
|
|
544
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
|
545
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
|
546
|
-
Can be passed in as a comma separated string of values e.g.
|
|
547
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
548
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
549
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
550
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
551
|
-
gpu : int, optional, default None
|
|
552
|
-
Number of GPUs required for this step. A value of zero implies that
|
|
553
|
-
the scheduled node should not have GPUs.
|
|
554
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
555
|
-
The vendor of the GPUs to be used for this step.
|
|
556
|
-
tolerations : List[Dict[str,str]], default []
|
|
557
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
558
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
559
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
560
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
|
561
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
562
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
563
|
-
use_tmpfs : bool, default False
|
|
564
|
-
This enables an explicit tmpfs mount for this step.
|
|
565
|
-
tmpfs_tempdir : bool, default True
|
|
566
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
567
|
-
tmpfs_size : int, optional, default: None
|
|
568
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
569
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
570
|
-
memory allocated for this step.
|
|
571
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
|
572
|
-
Path to tmpfs mount for this step.
|
|
573
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
|
574
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
575
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
576
|
-
shared_memory: int, optional
|
|
577
|
-
Shared memory size (in MiB) required for this step
|
|
578
|
-
port: int, optional
|
|
579
|
-
Port number to specify in the Kubernetes job object
|
|
580
|
-
compute_pool : str, optional, default None
|
|
581
|
-
Compute pool to be used for for this step.
|
|
582
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
|
583
|
-
hostname_resolution_timeout: int, default 10 * 60
|
|
584
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
585
|
-
Only applicable when @parallel is used.
|
|
586
|
-
qos: str, default: Burstable
|
|
587
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
503
|
+
times : int, default 3
|
|
504
|
+
Number of times to retry this task.
|
|
505
|
+
minutes_between_retries : int, default 2
|
|
506
|
+
Number of minutes between retries.
|
|
507
|
+
"""
|
|
508
|
+
...
|
|
509
|
+
|
|
510
|
+
@typing.overload
|
|
511
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
512
|
+
...
|
|
513
|
+
|
|
514
|
+
@typing.overload
|
|
515
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
516
|
+
...
|
|
517
|
+
|
|
518
|
+
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):
|
|
519
|
+
"""
|
|
520
|
+
Specifies the number of times the task corresponding
|
|
521
|
+
to a step needs to be retried.
|
|
588
522
|
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
523
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
524
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
525
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
526
|
+
|
|
527
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
528
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
529
|
+
ensuring that the flow execution can continue.
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
Parameters
|
|
533
|
+
----------
|
|
534
|
+
times : int, default 3
|
|
535
|
+
Number of times to retry this task.
|
|
536
|
+
minutes_between_retries : int, default 2
|
|
537
|
+
Number of minutes between retries.
|
|
596
538
|
"""
|
|
597
539
|
...
|
|
598
540
|
|
|
@@ -746,237 +688,438 @@ def batch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
746
688
|
...
|
|
747
689
|
|
|
748
690
|
@typing.overload
|
|
749
|
-
def
|
|
691
|
+
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]]]:
|
|
750
692
|
"""
|
|
751
|
-
|
|
693
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
752
694
|
|
|
753
|
-
|
|
754
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
755
|
-
you can use `@pypi_base` to set packages required by all
|
|
756
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
695
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
757
696
|
|
|
758
697
|
|
|
759
698
|
Parameters
|
|
760
699
|
----------
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
700
|
+
type : str, default 'default'
|
|
701
|
+
Card type.
|
|
702
|
+
id : str, optional, default None
|
|
703
|
+
If multiple cards are present, use this id to identify this card.
|
|
704
|
+
options : Dict[str, Any], default {}
|
|
705
|
+
Options passed to the card. The contents depend on the card type.
|
|
706
|
+
timeout : int, default 45
|
|
707
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
767
708
|
"""
|
|
768
709
|
...
|
|
769
710
|
|
|
770
711
|
@typing.overload
|
|
771
|
-
def
|
|
712
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
772
713
|
...
|
|
773
714
|
|
|
774
715
|
@typing.overload
|
|
775
|
-
def
|
|
716
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
776
717
|
...
|
|
777
718
|
|
|
778
|
-
def
|
|
719
|
+
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):
|
|
779
720
|
"""
|
|
780
|
-
|
|
721
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
781
722
|
|
|
782
|
-
|
|
783
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
784
|
-
you can use `@pypi_base` to set packages required by all
|
|
785
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
723
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
786
724
|
|
|
787
725
|
|
|
788
726
|
Parameters
|
|
789
727
|
----------
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
728
|
+
type : str, default 'default'
|
|
729
|
+
Card type.
|
|
730
|
+
id : str, optional, default None
|
|
731
|
+
If multiple cards are present, use this id to identify this card.
|
|
732
|
+
options : Dict[str, Any], default {}
|
|
733
|
+
Options passed to the card. The contents depend on the card type.
|
|
734
|
+
timeout : int, default 45
|
|
735
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
796
736
|
"""
|
|
797
737
|
...
|
|
798
738
|
|
|
799
|
-
|
|
800
|
-
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]]]:
|
|
739
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[typing.Dict[str, str]] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
801
740
|
"""
|
|
802
|
-
Specifies
|
|
803
|
-
to a step needs to be retried.
|
|
804
|
-
|
|
805
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
806
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
807
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
808
|
-
|
|
809
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
810
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
811
|
-
ensuring that the flow execution can continue.
|
|
741
|
+
Specifies that this step should execute on Kubernetes.
|
|
812
742
|
|
|
813
743
|
|
|
814
744
|
Parameters
|
|
815
745
|
----------
|
|
816
|
-
|
|
817
|
-
Number of
|
|
818
|
-
|
|
819
|
-
|
|
746
|
+
cpu : int, default 1
|
|
747
|
+
Number of CPUs required for this step. If `@resources` is
|
|
748
|
+
also present, the maximum value from all decorators is used.
|
|
749
|
+
memory : int, default 4096
|
|
750
|
+
Memory size (in MB) required for this step. If
|
|
751
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
752
|
+
used.
|
|
753
|
+
disk : int, default 10240
|
|
754
|
+
Disk size (in MB) required for this step. If
|
|
755
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
756
|
+
used.
|
|
757
|
+
image : str, optional, default None
|
|
758
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
|
759
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
760
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
761
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
762
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
763
|
+
image_pull_secrets: List[str], default []
|
|
764
|
+
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
765
|
+
Kubernetes image pull secrets to use when pulling container images
|
|
766
|
+
in Kubernetes.
|
|
767
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
768
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
|
769
|
+
secrets : List[str], optional, default None
|
|
770
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
771
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
772
|
+
in Metaflow configuration.
|
|
773
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
|
774
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
|
775
|
+
Can be passed in as a comma separated string of values e.g.
|
|
776
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
777
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
778
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
779
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
780
|
+
gpu : int, optional, default None
|
|
781
|
+
Number of GPUs required for this step. A value of zero implies that
|
|
782
|
+
the scheduled node should not have GPUs.
|
|
783
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
784
|
+
The vendor of the GPUs to be used for this step.
|
|
785
|
+
tolerations : List[Dict[str,str]], default []
|
|
786
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
787
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
788
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
789
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
|
790
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
791
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
792
|
+
use_tmpfs : bool, default False
|
|
793
|
+
This enables an explicit tmpfs mount for this step.
|
|
794
|
+
tmpfs_tempdir : bool, default True
|
|
795
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
796
|
+
tmpfs_size : int, optional, default: None
|
|
797
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
798
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
799
|
+
memory allocated for this step.
|
|
800
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
|
801
|
+
Path to tmpfs mount for this step.
|
|
802
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
|
803
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
804
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
805
|
+
shared_memory: int, optional
|
|
806
|
+
Shared memory size (in MiB) required for this step
|
|
807
|
+
port: int, optional
|
|
808
|
+
Port number to specify in the Kubernetes job object
|
|
809
|
+
compute_pool : str, optional, default None
|
|
810
|
+
Compute pool to be used for for this step.
|
|
811
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
|
812
|
+
hostname_resolution_timeout: int, default 10 * 60
|
|
813
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
814
|
+
Only applicable when @parallel is used.
|
|
815
|
+
qos: str, default: Burstable
|
|
816
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
817
|
+
|
|
818
|
+
security_context: Dict[str, Any], optional, default None
|
|
819
|
+
Container security context. Applies to the task container. Allows the following keys:
|
|
820
|
+
- privileged: bool, optional, default None
|
|
821
|
+
- allow_privilege_escalation: bool, optional, default None
|
|
822
|
+
- run_as_user: int, optional, default None
|
|
823
|
+
- run_as_group: int, optional, default None
|
|
824
|
+
- run_as_non_root: bool, optional, default None
|
|
820
825
|
"""
|
|
821
826
|
...
|
|
822
827
|
|
|
823
828
|
@typing.overload
|
|
824
|
-
def
|
|
825
|
-
...
|
|
826
|
-
|
|
827
|
-
@typing.overload
|
|
828
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
829
|
-
...
|
|
830
|
-
|
|
831
|
-
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):
|
|
829
|
+
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]]]:
|
|
832
830
|
"""
|
|
833
|
-
Specifies the
|
|
834
|
-
to a step needs to be retried.
|
|
835
|
-
|
|
836
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
837
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
838
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
831
|
+
Specifies the Conda environment for the step.
|
|
839
832
|
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
833
|
+
Information in this decorator will augment any
|
|
834
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
835
|
+
you can use `@conda_base` to set packages required by all
|
|
836
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
843
837
|
|
|
844
838
|
|
|
845
839
|
Parameters
|
|
846
840
|
----------
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
841
|
+
packages : Dict[str, str], default {}
|
|
842
|
+
Packages to use for this step. The key is the name of the package
|
|
843
|
+
and the value is the version to use.
|
|
844
|
+
libraries : Dict[str, str], default {}
|
|
845
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
846
|
+
python : str, optional, default None
|
|
847
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
848
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
849
|
+
disabled : bool, default False
|
|
850
|
+
If set to True, disables @conda.
|
|
851
851
|
"""
|
|
852
852
|
...
|
|
853
853
|
|
|
854
854
|
@typing.overload
|
|
855
|
-
def
|
|
855
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
856
|
+
...
|
|
857
|
+
|
|
858
|
+
@typing.overload
|
|
859
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
860
|
+
...
|
|
861
|
+
|
|
862
|
+
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):
|
|
856
863
|
"""
|
|
857
|
-
Specifies
|
|
864
|
+
Specifies the Conda environment for the step.
|
|
865
|
+
|
|
866
|
+
Information in this decorator will augment any
|
|
867
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
868
|
+
you can use `@conda_base` to set packages required by all
|
|
869
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
858
870
|
|
|
859
871
|
|
|
860
872
|
Parameters
|
|
861
873
|
----------
|
|
862
|
-
|
|
863
|
-
|
|
874
|
+
packages : Dict[str, str], default {}
|
|
875
|
+
Packages to use for this step. The key is the name of the package
|
|
876
|
+
and the value is the version to use.
|
|
877
|
+
libraries : Dict[str, str], default {}
|
|
878
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
879
|
+
python : str, optional, default None
|
|
880
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
881
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
882
|
+
disabled : bool, default False
|
|
883
|
+
If set to True, disables @conda.
|
|
884
|
+
"""
|
|
885
|
+
...
|
|
886
|
+
|
|
887
|
+
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]]:
|
|
888
|
+
"""
|
|
889
|
+
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.
|
|
890
|
+
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.
|
|
891
|
+
|
|
892
|
+
|
|
893
|
+
Parameters
|
|
894
|
+
----------
|
|
895
|
+
timeout : int
|
|
896
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
897
|
+
poke_interval : int
|
|
898
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
899
|
+
mode : str
|
|
900
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
901
|
+
exponential_backoff : bool
|
|
902
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
903
|
+
pool : str
|
|
904
|
+
the slot pool this task should run in,
|
|
905
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
906
|
+
soft_fail : bool
|
|
907
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
908
|
+
name : str
|
|
909
|
+
Name of the sensor on Airflow
|
|
910
|
+
description : str
|
|
911
|
+
Description of sensor in the Airflow UI
|
|
912
|
+
external_dag_id : str
|
|
913
|
+
The dag_id that contains the task you want to wait for.
|
|
914
|
+
external_task_ids : List[str]
|
|
915
|
+
The list of task_ids that you want to wait for.
|
|
916
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
917
|
+
allowed_states : List[str]
|
|
918
|
+
Iterable of allowed states, (Default: ['success'])
|
|
919
|
+
failed_states : List[str]
|
|
920
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
921
|
+
execution_delta : datetime.timedelta
|
|
922
|
+
time difference with the previous execution to look at,
|
|
923
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
924
|
+
check_existence: bool
|
|
925
|
+
Set to True to check if the external task exists or check if
|
|
926
|
+
the DAG to wait for exists. (Default: True)
|
|
864
927
|
"""
|
|
865
928
|
...
|
|
866
929
|
|
|
867
930
|
@typing.overload
|
|
868
|
-
def
|
|
931
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
932
|
+
"""
|
|
933
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
934
|
+
|
|
935
|
+
Use `@pypi_base` to set common packages required by all
|
|
936
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
937
|
+
|
|
938
|
+
Parameters
|
|
939
|
+
----------
|
|
940
|
+
packages : Dict[str, str], default: {}
|
|
941
|
+
Packages to use for this flow. The key is the name of the package
|
|
942
|
+
and the value is the version to use.
|
|
943
|
+
python : str, optional, default: None
|
|
944
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
945
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
946
|
+
"""
|
|
869
947
|
...
|
|
870
948
|
|
|
871
949
|
@typing.overload
|
|
872
|
-
def
|
|
950
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
873
951
|
...
|
|
874
952
|
|
|
875
|
-
def
|
|
953
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
876
954
|
"""
|
|
877
|
-
Specifies
|
|
955
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
878
956
|
|
|
957
|
+
Use `@pypi_base` to set common packages required by all
|
|
958
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
879
959
|
|
|
880
960
|
Parameters
|
|
881
961
|
----------
|
|
882
|
-
|
|
883
|
-
|
|
962
|
+
packages : Dict[str, str], default: {}
|
|
963
|
+
Packages to use for this flow. The key is the name of the package
|
|
964
|
+
and the value is the version to use.
|
|
965
|
+
python : str, optional, default: None
|
|
966
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
967
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
884
968
|
"""
|
|
885
969
|
...
|
|
886
970
|
|
|
887
971
|
@typing.overload
|
|
888
|
-
def
|
|
972
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
889
973
|
"""
|
|
890
|
-
Specifies the
|
|
974
|
+
Specifies the flow(s) that this flow depends on.
|
|
891
975
|
|
|
892
976
|
```
|
|
893
|
-
@
|
|
977
|
+
@trigger_on_finish(flow='FooFlow')
|
|
894
978
|
```
|
|
895
979
|
or
|
|
896
980
|
```
|
|
897
|
-
@
|
|
981
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
898
982
|
```
|
|
983
|
+
This decorator respects the @project decorator and triggers the flow
|
|
984
|
+
when upstream runs within the same namespace complete successfully
|
|
899
985
|
|
|
900
|
-
Additionally, you can specify
|
|
901
|
-
|
|
986
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
987
|
+
by specifying the fully qualified project_flow_name.
|
|
902
988
|
```
|
|
903
|
-
@
|
|
989
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
904
990
|
```
|
|
905
991
|
or
|
|
906
992
|
```
|
|
907
|
-
@
|
|
908
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
993
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
909
994
|
```
|
|
910
995
|
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
914
|
-
```
|
|
915
|
-
This is equivalent to:
|
|
996
|
+
You can also specify just the project or project branch (other values will be
|
|
997
|
+
inferred from the current project or project branch):
|
|
916
998
|
```
|
|
917
|
-
@
|
|
999
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
918
1000
|
```
|
|
919
1001
|
|
|
1002
|
+
Note that `branch` is typically one of:
|
|
1003
|
+
- `prod`
|
|
1004
|
+
- `user.bob`
|
|
1005
|
+
- `test.my_experiment`
|
|
1006
|
+
- `prod.staging`
|
|
1007
|
+
|
|
920
1008
|
|
|
921
1009
|
Parameters
|
|
922
1010
|
----------
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
1011
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1012
|
+
Upstream flow dependency for this flow.
|
|
1013
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1014
|
+
Upstream flow dependencies for this flow.
|
|
927
1015
|
options : Dict[str, Any], default {}
|
|
928
1016
|
Backend-specific configuration for tuning eventing behavior.
|
|
929
1017
|
"""
|
|
930
1018
|
...
|
|
931
1019
|
|
|
932
1020
|
@typing.overload
|
|
933
|
-
def
|
|
1021
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
934
1022
|
...
|
|
935
1023
|
|
|
936
|
-
def
|
|
1024
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
937
1025
|
"""
|
|
938
|
-
Specifies the
|
|
1026
|
+
Specifies the flow(s) that this flow depends on.
|
|
939
1027
|
|
|
940
1028
|
```
|
|
941
|
-
@
|
|
1029
|
+
@trigger_on_finish(flow='FooFlow')
|
|
942
1030
|
```
|
|
943
1031
|
or
|
|
944
1032
|
```
|
|
945
|
-
@
|
|
1033
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
946
1034
|
```
|
|
1035
|
+
This decorator respects the @project decorator and triggers the flow
|
|
1036
|
+
when upstream runs within the same namespace complete successfully
|
|
947
1037
|
|
|
948
|
-
Additionally, you can specify
|
|
949
|
-
|
|
1038
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
1039
|
+
by specifying the fully qualified project_flow_name.
|
|
950
1040
|
```
|
|
951
|
-
@
|
|
1041
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
952
1042
|
```
|
|
953
1043
|
or
|
|
954
1044
|
```
|
|
955
|
-
@
|
|
956
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1045
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
957
1046
|
```
|
|
958
1047
|
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
962
|
-
```
|
|
963
|
-
This is equivalent to:
|
|
1048
|
+
You can also specify just the project or project branch (other values will be
|
|
1049
|
+
inferred from the current project or project branch):
|
|
964
1050
|
```
|
|
965
|
-
@
|
|
1051
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
966
1052
|
```
|
|
967
1053
|
|
|
1054
|
+
Note that `branch` is typically one of:
|
|
1055
|
+
- `prod`
|
|
1056
|
+
- `user.bob`
|
|
1057
|
+
- `test.my_experiment`
|
|
1058
|
+
- `prod.staging`
|
|
1059
|
+
|
|
968
1060
|
|
|
969
1061
|
Parameters
|
|
970
1062
|
----------
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1063
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1064
|
+
Upstream flow dependency for this flow.
|
|
1065
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1066
|
+
Upstream flow dependencies for this flow.
|
|
975
1067
|
options : Dict[str, Any], default {}
|
|
976
1068
|
Backend-specific configuration for tuning eventing behavior.
|
|
977
1069
|
"""
|
|
978
1070
|
...
|
|
979
1071
|
|
|
1072
|
+
@typing.overload
|
|
1073
|
+
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]]:
|
|
1074
|
+
"""
|
|
1075
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1076
|
+
|
|
1077
|
+
Use `@conda_base` to set common libraries required by all
|
|
1078
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1079
|
+
|
|
1080
|
+
|
|
1081
|
+
Parameters
|
|
1082
|
+
----------
|
|
1083
|
+
packages : Dict[str, str], default {}
|
|
1084
|
+
Packages to use for this flow. The key is the name of the package
|
|
1085
|
+
and the value is the version to use.
|
|
1086
|
+
libraries : Dict[str, str], default {}
|
|
1087
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1088
|
+
python : str, optional, default None
|
|
1089
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1090
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1091
|
+
disabled : bool, default False
|
|
1092
|
+
If set to True, disables Conda.
|
|
1093
|
+
"""
|
|
1094
|
+
...
|
|
1095
|
+
|
|
1096
|
+
@typing.overload
|
|
1097
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1098
|
+
...
|
|
1099
|
+
|
|
1100
|
+
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):
|
|
1101
|
+
"""
|
|
1102
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1103
|
+
|
|
1104
|
+
Use `@conda_base` to set common libraries required by all
|
|
1105
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
Parameters
|
|
1109
|
+
----------
|
|
1110
|
+
packages : Dict[str, str], default {}
|
|
1111
|
+
Packages to use for this flow. The key is the name of the package
|
|
1112
|
+
and the value is the version to use.
|
|
1113
|
+
libraries : Dict[str, str], default {}
|
|
1114
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1115
|
+
python : str, optional, default None
|
|
1116
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1117
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1118
|
+
disabled : bool, default False
|
|
1119
|
+
If set to True, disables Conda.
|
|
1120
|
+
"""
|
|
1121
|
+
...
|
|
1122
|
+
|
|
980
1123
|
@typing.overload
|
|
981
1124
|
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]]:
|
|
982
1125
|
"""
|
|
@@ -1063,148 +1206,6 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
|
|
|
1063
1206
|
"""
|
|
1064
1207
|
...
|
|
1065
1208
|
|
|
1066
|
-
@typing.overload
|
|
1067
|
-
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1068
|
-
"""
|
|
1069
|
-
Specifies the flow(s) that this flow depends on.
|
|
1070
|
-
|
|
1071
|
-
```
|
|
1072
|
-
@trigger_on_finish(flow='FooFlow')
|
|
1073
|
-
```
|
|
1074
|
-
or
|
|
1075
|
-
```
|
|
1076
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1077
|
-
```
|
|
1078
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1079
|
-
when upstream runs within the same namespace complete successfully
|
|
1080
|
-
|
|
1081
|
-
Additionally, you can specify project aware upstream flow dependencies
|
|
1082
|
-
by specifying the fully qualified project_flow_name.
|
|
1083
|
-
```
|
|
1084
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1085
|
-
```
|
|
1086
|
-
or
|
|
1087
|
-
```
|
|
1088
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1089
|
-
```
|
|
1090
|
-
|
|
1091
|
-
You can also specify just the project or project branch (other values will be
|
|
1092
|
-
inferred from the current project or project branch):
|
|
1093
|
-
```
|
|
1094
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1095
|
-
```
|
|
1096
|
-
|
|
1097
|
-
Note that `branch` is typically one of:
|
|
1098
|
-
- `prod`
|
|
1099
|
-
- `user.bob`
|
|
1100
|
-
- `test.my_experiment`
|
|
1101
|
-
- `prod.staging`
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
Parameters
|
|
1105
|
-
----------
|
|
1106
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
|
1107
|
-
Upstream flow dependency for this flow.
|
|
1108
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
|
1109
|
-
Upstream flow dependencies for this flow.
|
|
1110
|
-
options : Dict[str, Any], default {}
|
|
1111
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
1112
|
-
"""
|
|
1113
|
-
...
|
|
1114
|
-
|
|
1115
|
-
@typing.overload
|
|
1116
|
-
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1117
|
-
...
|
|
1118
|
-
|
|
1119
|
-
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
1120
|
-
"""
|
|
1121
|
-
Specifies the flow(s) that this flow depends on.
|
|
1122
|
-
|
|
1123
|
-
```
|
|
1124
|
-
@trigger_on_finish(flow='FooFlow')
|
|
1125
|
-
```
|
|
1126
|
-
or
|
|
1127
|
-
```
|
|
1128
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1129
|
-
```
|
|
1130
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1131
|
-
when upstream runs within the same namespace complete successfully
|
|
1132
|
-
|
|
1133
|
-
Additionally, you can specify project aware upstream flow dependencies
|
|
1134
|
-
by specifying the fully qualified project_flow_name.
|
|
1135
|
-
```
|
|
1136
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1137
|
-
```
|
|
1138
|
-
or
|
|
1139
|
-
```
|
|
1140
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1141
|
-
```
|
|
1142
|
-
|
|
1143
|
-
You can also specify just the project or project branch (other values will be
|
|
1144
|
-
inferred from the current project or project branch):
|
|
1145
|
-
```
|
|
1146
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1147
|
-
```
|
|
1148
|
-
|
|
1149
|
-
Note that `branch` is typically one of:
|
|
1150
|
-
- `prod`
|
|
1151
|
-
- `user.bob`
|
|
1152
|
-
- `test.my_experiment`
|
|
1153
|
-
- `prod.staging`
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
Parameters
|
|
1157
|
-
----------
|
|
1158
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
|
1159
|
-
Upstream flow dependency for this flow.
|
|
1160
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
|
1161
|
-
Upstream flow dependencies for this flow.
|
|
1162
|
-
options : Dict[str, Any], default {}
|
|
1163
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
1164
|
-
"""
|
|
1165
|
-
...
|
|
1166
|
-
|
|
1167
|
-
@typing.overload
|
|
1168
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1169
|
-
"""
|
|
1170
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
1171
|
-
|
|
1172
|
-
Use `@pypi_base` to set common packages required by all
|
|
1173
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1174
|
-
|
|
1175
|
-
Parameters
|
|
1176
|
-
----------
|
|
1177
|
-
packages : Dict[str, str], default: {}
|
|
1178
|
-
Packages to use for this flow. The key is the name of the package
|
|
1179
|
-
and the value is the version to use.
|
|
1180
|
-
python : str, optional, default: None
|
|
1181
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1182
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1183
|
-
"""
|
|
1184
|
-
...
|
|
1185
|
-
|
|
1186
|
-
@typing.overload
|
|
1187
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1188
|
-
...
|
|
1189
|
-
|
|
1190
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1191
|
-
"""
|
|
1192
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
1193
|
-
|
|
1194
|
-
Use `@pypi_base` to set common packages required by all
|
|
1195
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1196
|
-
|
|
1197
|
-
Parameters
|
|
1198
|
-
----------
|
|
1199
|
-
packages : Dict[str, str], default: {}
|
|
1200
|
-
Packages to use for this flow. The key is the name of the package
|
|
1201
|
-
and the value is the version to use.
|
|
1202
|
-
python : str, optional, default: None
|
|
1203
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1204
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1205
|
-
"""
|
|
1206
|
-
...
|
|
1207
|
-
|
|
1208
1209
|
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]]:
|
|
1209
1210
|
"""
|
|
1210
1211
|
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)
|
|
@@ -1249,96 +1250,95 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
|
1249
1250
|
...
|
|
1250
1251
|
|
|
1251
1252
|
@typing.overload
|
|
1252
|
-
def
|
|
1253
|
+
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]]:
|
|
1253
1254
|
"""
|
|
1254
|
-
Specifies the
|
|
1255
|
+
Specifies the event(s) that this flow depends on.
|
|
1255
1256
|
|
|
1256
|
-
|
|
1257
|
-
|
|
1257
|
+
```
|
|
1258
|
+
@trigger(event='foo')
|
|
1259
|
+
```
|
|
1260
|
+
or
|
|
1261
|
+
```
|
|
1262
|
+
@trigger(events=['foo', 'bar'])
|
|
1263
|
+
```
|
|
1264
|
+
|
|
1265
|
+
Additionally, you can specify the parameter mappings
|
|
1266
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1267
|
+
```
|
|
1268
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1269
|
+
```
|
|
1270
|
+
or
|
|
1271
|
+
```
|
|
1272
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1273
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1274
|
+
```
|
|
1275
|
+
|
|
1276
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1277
|
+
```
|
|
1278
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1279
|
+
```
|
|
1280
|
+
This is equivalent to:
|
|
1281
|
+
```
|
|
1282
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1283
|
+
```
|
|
1258
1284
|
|
|
1259
1285
|
|
|
1260
1286
|
Parameters
|
|
1261
1287
|
----------
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1269
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1270
|
-
disabled : bool, default False
|
|
1271
|
-
If set to True, disables Conda.
|
|
1288
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1289
|
+
Event dependency for this flow.
|
|
1290
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1291
|
+
Events dependency for this flow.
|
|
1292
|
+
options : Dict[str, Any], default {}
|
|
1293
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1272
1294
|
"""
|
|
1273
1295
|
...
|
|
1274
1296
|
|
|
1275
1297
|
@typing.overload
|
|
1276
|
-
def
|
|
1298
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1277
1299
|
...
|
|
1278
1300
|
|
|
1279
|
-
def
|
|
1301
|
+
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] = {}):
|
|
1280
1302
|
"""
|
|
1281
|
-
Specifies the
|
|
1303
|
+
Specifies the event(s) that this flow depends on.
|
|
1282
1304
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1305
|
+
```
|
|
1306
|
+
@trigger(event='foo')
|
|
1307
|
+
```
|
|
1308
|
+
or
|
|
1309
|
+
```
|
|
1310
|
+
@trigger(events=['foo', 'bar'])
|
|
1311
|
+
```
|
|
1285
1312
|
|
|
1313
|
+
Additionally, you can specify the parameter mappings
|
|
1314
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1315
|
+
```
|
|
1316
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1317
|
+
```
|
|
1318
|
+
or
|
|
1319
|
+
```
|
|
1320
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1321
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1322
|
+
```
|
|
1286
1323
|
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1296
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1297
|
-
disabled : bool, default False
|
|
1298
|
-
If set to True, disables Conda.
|
|
1299
|
-
"""
|
|
1300
|
-
...
|
|
1301
|
-
|
|
1302
|
-
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]]:
|
|
1303
|
-
"""
|
|
1304
|
-
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.
|
|
1305
|
-
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.
|
|
1324
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1325
|
+
```
|
|
1326
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1327
|
+
```
|
|
1328
|
+
This is equivalent to:
|
|
1329
|
+
```
|
|
1330
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1331
|
+
```
|
|
1306
1332
|
|
|
1307
1333
|
|
|
1308
1334
|
Parameters
|
|
1309
1335
|
----------
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1316
|
-
exponential_backoff : bool
|
|
1317
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1318
|
-
pool : str
|
|
1319
|
-
the slot pool this task should run in,
|
|
1320
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1321
|
-
soft_fail : bool
|
|
1322
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1323
|
-
name : str
|
|
1324
|
-
Name of the sensor on Airflow
|
|
1325
|
-
description : str
|
|
1326
|
-
Description of sensor in the Airflow UI
|
|
1327
|
-
external_dag_id : str
|
|
1328
|
-
The dag_id that contains the task you want to wait for.
|
|
1329
|
-
external_task_ids : List[str]
|
|
1330
|
-
The list of task_ids that you want to wait for.
|
|
1331
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1332
|
-
allowed_states : List[str]
|
|
1333
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1334
|
-
failed_states : List[str]
|
|
1335
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1336
|
-
execution_delta : datetime.timedelta
|
|
1337
|
-
time difference with the previous execution to look at,
|
|
1338
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1339
|
-
check_existence: bool
|
|
1340
|
-
Set to True to check if the external task exists or check if
|
|
1341
|
-
the DAG to wait for exists. (Default: True)
|
|
1336
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1337
|
+
Event dependency for this flow.
|
|
1338
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1339
|
+
Events dependency for this flow.
|
|
1340
|
+
options : Dict[str, Any], default {}
|
|
1341
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1342
1342
|
"""
|
|
1343
1343
|
...
|
|
1344
1344
|
|