ob-metaflow-stubs 6.0.3.174__py2.py3-none-any.whl → 6.0.3.175rc1__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 +670 -669
- metaflow-stubs/cards.pyi +1 -1
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/cli_components/__init__.pyi +1 -1
- metaflow-stubs/cli_components/utils.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +1 -1
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +1 -1
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +96 -96
- metaflow-stubs/metaflow_git.pyi +1 -1
- metaflow-stubs/mf_extensions/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +51 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +65 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +74 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/ob_internal.pyi +11 -0
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +9 -9
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/torchtune/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +29 -29
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +1 -1
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.174.dist-info → ob_metaflow_stubs-6.0.3.175rc1.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.175rc1.dist-info/RECORD +216 -0
- ob_metaflow_stubs-6.0.3.174.dist-info/RECORD +0 -211
- {ob_metaflow_stubs-6.0.3.174.dist-info → ob_metaflow_stubs-6.0.3.175rc1.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.174.dist-info → ob_metaflow_stubs-6.0.3.175rc1.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.15.14.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-05-
|
4
|
+
# Generated on 2025-05-31T01:09:57.775269 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -37,16 +37,16 @@ from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDec
|
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
38
|
from . import tuple_util as tuple_util
|
39
39
|
from . import cards as cards
|
40
|
-
from . import metaflow_git as metaflow_git
|
41
40
|
from . import events as events
|
41
|
+
from . import metaflow_git as metaflow_git
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
48
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
47
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
48
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -77,6 +77,7 @@ from . import system as system
|
|
77
77
|
from . import pylint_wrapper as pylint_wrapper
|
78
78
|
from . import cli as cli
|
79
79
|
from . import profilers as profilers
|
80
|
+
from . import ob_internal as ob_internal
|
80
81
|
|
81
82
|
EXT_PKG: str
|
82
83
|
|
@@ -233,61 +234,110 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
233
234
|
...
|
234
235
|
|
235
236
|
@typing.overload
|
236
|
-
def
|
237
|
+
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]]]:
|
237
238
|
"""
|
238
|
-
Specifies
|
239
|
-
|
240
|
-
This decorator is useful if this step may hang indefinitely.
|
241
|
-
|
242
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
243
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
244
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
239
|
+
Specifies that the step will success under all circumstances.
|
245
240
|
|
246
|
-
|
247
|
-
|
241
|
+
The decorator will create an optional artifact, specified by `var`, which
|
242
|
+
contains the exception raised. You can use it to detect the presence
|
243
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
244
|
+
are missing.
|
248
245
|
|
249
246
|
|
250
247
|
Parameters
|
251
248
|
----------
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
249
|
+
var : str, optional, default None
|
250
|
+
Name of the artifact in which to store the caught exception.
|
251
|
+
If not specified, the exception is not stored.
|
252
|
+
print_exception : bool, default True
|
253
|
+
Determines whether or not the exception is printed to
|
254
|
+
stdout when caught.
|
258
255
|
"""
|
259
256
|
...
|
260
257
|
|
261
258
|
@typing.overload
|
262
|
-
def
|
259
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
263
260
|
...
|
264
261
|
|
265
262
|
@typing.overload
|
266
|
-
def
|
263
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
267
264
|
...
|
268
265
|
|
269
|
-
def
|
266
|
+
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):
|
270
267
|
"""
|
271
|
-
Specifies
|
268
|
+
Specifies that the step will success under all circumstances.
|
272
269
|
|
273
|
-
|
270
|
+
The decorator will create an optional artifact, specified by `var`, which
|
271
|
+
contains the exception raised. You can use it to detect the presence
|
272
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
273
|
+
are missing.
|
274
274
|
|
275
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
276
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
277
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
278
275
|
|
279
|
-
|
280
|
-
|
276
|
+
Parameters
|
277
|
+
----------
|
278
|
+
var : str, optional, default None
|
279
|
+
Name of the artifact in which to store the caught exception.
|
280
|
+
If not specified, the exception is not stored.
|
281
|
+
print_exception : bool, default True
|
282
|
+
Determines whether or not the exception is printed to
|
283
|
+
stdout when caught.
|
284
|
+
"""
|
285
|
+
...
|
286
|
+
|
287
|
+
@typing.overload
|
288
|
+
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: 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]]]:
|
289
|
+
"""
|
290
|
+
Enables loading / saving of models within a step.
|
291
|
+
|
281
292
|
|
282
293
|
|
283
294
|
Parameters
|
284
295
|
----------
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
296
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
297
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
298
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
299
|
+
- `current.checkpoint`
|
300
|
+
- `current.model`
|
301
|
+
- `current.huggingface_hub`
|
302
|
+
|
303
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
304
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
305
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
306
|
+
|
307
|
+
temp_dir_root : str, default: None
|
308
|
+
The root directory under which `current.model.loaded` will store loaded models
|
309
|
+
"""
|
310
|
+
...
|
311
|
+
|
312
|
+
@typing.overload
|
313
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
314
|
+
...
|
315
|
+
|
316
|
+
@typing.overload
|
317
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
318
|
+
...
|
319
|
+
|
320
|
+
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
321
|
+
"""
|
322
|
+
Enables loading / saving of models within a step.
|
323
|
+
|
324
|
+
|
325
|
+
|
326
|
+
Parameters
|
327
|
+
----------
|
328
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
329
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
330
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
331
|
+
- `current.checkpoint`
|
332
|
+
- `current.model`
|
333
|
+
- `current.huggingface_hub`
|
334
|
+
|
335
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
336
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
337
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
338
|
+
|
339
|
+
temp_dir_root : str, default: None
|
340
|
+
The root directory under which `current.model.loaded` will store loaded models
|
291
341
|
"""
|
292
342
|
...
|
293
343
|
|
@@ -328,131 +378,54 @@ def ollama(*, models: list, backend: str, force_pull: bool, skip_push_check: boo
|
|
328
378
|
"""
|
329
379
|
...
|
330
380
|
|
331
|
-
def
|
381
|
+
def app_deploy(*, app_port: int, app_name: 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]]]:
|
332
382
|
"""
|
333
|
-
|
383
|
+
Specifies that this step is used to deploy an instance of the app.
|
384
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
334
385
|
|
335
386
|
|
336
387
|
Parameters
|
337
388
|
----------
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
The list of repos (models/datasets) to load.
|
343
|
-
|
344
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
345
|
-
|
346
|
-
- If repo (model/dataset) is not found in the datastore:
|
347
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
348
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
349
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
350
|
-
|
351
|
-
- If repo is found in the datastore:
|
352
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
389
|
+
app_port : int
|
390
|
+
Number of GPUs to use.
|
391
|
+
app_name : str
|
392
|
+
Name of the app to deploy.
|
353
393
|
"""
|
354
394
|
...
|
355
395
|
|
356
396
|
@typing.overload
|
357
|
-
def
|
397
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
358
398
|
"""
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
363
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
364
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
365
|
-
|
366
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
367
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
368
|
-
ensuring that the flow execution can continue.
|
369
|
-
|
370
|
-
|
371
|
-
Parameters
|
372
|
-
----------
|
373
|
-
times : int, default 3
|
374
|
-
Number of times to retry this task.
|
375
|
-
minutes_between_retries : int, default 2
|
376
|
-
Number of minutes between retries.
|
399
|
+
Decorator prototype for all step decorators. This function gets specialized
|
400
|
+
and imported for all decorators types by _import_plugin_decorators().
|
377
401
|
"""
|
378
402
|
...
|
379
403
|
|
380
404
|
@typing.overload
|
381
|
-
def
|
382
|
-
...
|
383
|
-
|
384
|
-
@typing.overload
|
385
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
405
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
386
406
|
...
|
387
407
|
|
388
|
-
def
|
408
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
389
409
|
"""
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
394
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
395
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
396
|
-
|
397
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
398
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
399
|
-
ensuring that the flow execution can continue.
|
400
|
-
|
401
|
-
|
402
|
-
Parameters
|
403
|
-
----------
|
404
|
-
times : int, default 3
|
405
|
-
Number of times to retry this task.
|
406
|
-
minutes_between_retries : int, default 2
|
407
|
-
Number of minutes between retries.
|
410
|
+
Decorator prototype for all step decorators. This function gets specialized
|
411
|
+
and imported for all decorators types by _import_plugin_decorators().
|
408
412
|
"""
|
409
413
|
...
|
410
414
|
|
411
415
|
@typing.overload
|
412
|
-
def
|
416
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
413
417
|
"""
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
Parameters
|
418
|
-
----------
|
419
|
-
vars : Dict[str, str], default {}
|
420
|
-
Dictionary of environment variables to set.
|
418
|
+
Internal decorator to support Fast bakery
|
421
419
|
"""
|
422
420
|
...
|
423
421
|
|
424
422
|
@typing.overload
|
425
|
-
def
|
426
|
-
...
|
427
|
-
|
428
|
-
@typing.overload
|
429
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
430
|
-
...
|
431
|
-
|
432
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
433
|
-
"""
|
434
|
-
Specifies environment variables to be set prior to the execution of a step.
|
435
|
-
|
436
|
-
|
437
|
-
Parameters
|
438
|
-
----------
|
439
|
-
vars : Dict[str, str], default {}
|
440
|
-
Dictionary of environment variables to set.
|
441
|
-
"""
|
423
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
442
424
|
...
|
443
425
|
|
444
|
-
def
|
426
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
445
427
|
"""
|
446
|
-
|
447
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
448
|
-
|
449
|
-
|
450
|
-
Parameters
|
451
|
-
----------
|
452
|
-
app_port : int
|
453
|
-
Number of GPUs to use.
|
454
|
-
app_name : str
|
455
|
-
Name of the app to deploy.
|
428
|
+
Internal decorator to support Fast bakery
|
456
429
|
"""
|
457
430
|
...
|
458
431
|
|
@@ -470,499 +443,620 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
|
|
470
443
|
"""
|
471
444
|
...
|
472
445
|
|
473
|
-
|
474
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
475
|
-
"""
|
476
|
-
Decorator prototype for all step decorators. This function gets specialized
|
477
|
-
and imported for all decorators types by _import_plugin_decorators().
|
478
|
-
"""
|
479
|
-
...
|
480
|
-
|
481
|
-
@typing.overload
|
482
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
483
|
-
...
|
484
|
-
|
485
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
486
|
-
"""
|
487
|
-
Decorator prototype for all step decorators. This function gets specialized
|
488
|
-
and imported for all decorators types by _import_plugin_decorators().
|
489
|
-
"""
|
490
|
-
...
|
491
|
-
|
492
|
-
@typing.overload
|
493
|
-
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]]]:
|
446
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', 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]]]:
|
494
447
|
"""
|
495
|
-
|
448
|
+
Specifies that this step should execute on Kubernetes.
|
496
449
|
|
497
|
-
|
450
|
+
|
451
|
+
Parameters
|
452
|
+
----------
|
453
|
+
cpu : int, default 1
|
454
|
+
Number of CPUs required for this step. If `@resources` is
|
455
|
+
also present, the maximum value from all decorators is used.
|
456
|
+
memory : int, default 4096
|
457
|
+
Memory size (in MB) required for this step. If
|
458
|
+
`@resources` is also present, the maximum value from all decorators is
|
459
|
+
used.
|
460
|
+
disk : int, default 10240
|
461
|
+
Disk size (in MB) required for this step. If
|
462
|
+
`@resources` is also present, the maximum value from all decorators is
|
463
|
+
used.
|
464
|
+
image : str, optional, default None
|
465
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
466
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
467
|
+
not, a default Docker image mapping to the current version of Python is used.
|
468
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
469
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
470
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
471
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
472
|
+
secrets : List[str], optional, default None
|
473
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
474
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
475
|
+
in Metaflow configuration.
|
476
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
477
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
478
|
+
Can be passed in as a comma separated string of values e.g.
|
479
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
480
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
481
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
482
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
483
|
+
gpu : int, optional, default None
|
484
|
+
Number of GPUs required for this step. A value of zero implies that
|
485
|
+
the scheduled node should not have GPUs.
|
486
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
487
|
+
The vendor of the GPUs to be used for this step.
|
488
|
+
tolerations : List[str], default []
|
489
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
490
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
491
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
492
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
493
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
494
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
495
|
+
use_tmpfs : bool, default False
|
496
|
+
This enables an explicit tmpfs mount for this step.
|
497
|
+
tmpfs_tempdir : bool, default True
|
498
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
499
|
+
tmpfs_size : int, optional, default: None
|
500
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
501
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
502
|
+
memory allocated for this step.
|
503
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
504
|
+
Path to tmpfs mount for this step.
|
505
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
506
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
507
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
508
|
+
shared_memory: int, optional
|
509
|
+
Shared memory size (in MiB) required for this step
|
510
|
+
port: int, optional
|
511
|
+
Port number to specify in the Kubernetes job object
|
512
|
+
compute_pool : str, optional, default None
|
513
|
+
Compute pool to be used for for this step.
|
514
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
515
|
+
hostname_resolution_timeout: int, default 10 * 60
|
516
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
517
|
+
Only applicable when @parallel is used.
|
518
|
+
qos: str, default: Burstable
|
519
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
520
|
+
|
521
|
+
security_context: Dict[str, Any], optional, default None
|
522
|
+
Container security context. Applies to the task container. Allows the following keys:
|
523
|
+
- privileged: bool, optional, default None
|
524
|
+
- allow_privilege_escalation: bool, optional, default None
|
525
|
+
- run_as_user: int, optional, default None
|
526
|
+
- run_as_group: int, optional, default None
|
527
|
+
- run_as_non_root: bool, optional, default None
|
528
|
+
"""
|
529
|
+
...
|
530
|
+
|
531
|
+
def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> 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]]]:
|
532
|
+
"""
|
533
|
+
Specifies that this step should execute on DGX cloud.
|
498
534
|
|
499
535
|
|
500
536
|
Parameters
|
501
537
|
----------
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
timeout : int, default 45
|
509
|
-
Interrupt reporting if it takes more than this many seconds.
|
538
|
+
gpu : int
|
539
|
+
Number of GPUs to use.
|
540
|
+
gpu_type : str
|
541
|
+
Type of Nvidia GPU to use.
|
542
|
+
queue_timeout : int
|
543
|
+
Time to keep the job in NVCF's queue.
|
510
544
|
"""
|
511
545
|
...
|
512
546
|
|
513
547
|
@typing.overload
|
514
|
-
def
|
548
|
+
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]]]:
|
549
|
+
"""
|
550
|
+
Specifies environment variables to be set prior to the execution of a step.
|
551
|
+
|
552
|
+
|
553
|
+
Parameters
|
554
|
+
----------
|
555
|
+
vars : Dict[str, str], default {}
|
556
|
+
Dictionary of environment variables to set.
|
557
|
+
"""
|
515
558
|
...
|
516
559
|
|
517
560
|
@typing.overload
|
518
|
-
def
|
561
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
519
562
|
...
|
520
563
|
|
521
|
-
|
564
|
+
@typing.overload
|
565
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
566
|
+
...
|
567
|
+
|
568
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
522
569
|
"""
|
523
|
-
|
570
|
+
Specifies environment variables to be set prior to the execution of a step.
|
524
571
|
|
525
|
-
|
572
|
+
|
573
|
+
Parameters
|
574
|
+
----------
|
575
|
+
vars : Dict[str, str], default {}
|
576
|
+
Dictionary of environment variables to set.
|
577
|
+
"""
|
578
|
+
...
|
579
|
+
|
580
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], 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]]]:
|
581
|
+
"""
|
582
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
526
583
|
|
527
584
|
|
528
585
|
Parameters
|
529
586
|
----------
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
587
|
+
temp_dir_root : str, optional
|
588
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
589
|
+
|
590
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
591
|
+
The list of repos (models/datasets) to load.
|
592
|
+
|
593
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
594
|
+
|
595
|
+
- If repo (model/dataset) is not found in the datastore:
|
596
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
597
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
598
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
599
|
+
|
600
|
+
- If repo is found in the datastore:
|
601
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
538
602
|
"""
|
539
603
|
...
|
540
604
|
|
541
605
|
@typing.overload
|
542
|
-
def
|
606
|
+
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]]]:
|
543
607
|
"""
|
544
|
-
|
608
|
+
Specifies the number of times the task corresponding
|
609
|
+
to a step needs to be retried.
|
610
|
+
|
611
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
612
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
613
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
545
614
|
|
615
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
616
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
617
|
+
ensuring that the flow execution can continue.
|
546
618
|
|
547
619
|
|
548
620
|
Parameters
|
549
621
|
----------
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
will be loaded at the start of the task.
|
555
|
-
- "none": Do not load any checkpoint
|
556
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
557
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
558
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
559
|
-
created within the task will be loaded when the task is retries execution on failure.
|
560
|
-
|
561
|
-
temp_dir_root : str, default: None
|
562
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
622
|
+
times : int, default 3
|
623
|
+
Number of times to retry this task.
|
624
|
+
minutes_between_retries : int, default 2
|
625
|
+
Number of minutes between retries.
|
563
626
|
"""
|
564
627
|
...
|
565
628
|
|
566
629
|
@typing.overload
|
567
|
-
def
|
630
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
568
631
|
...
|
569
632
|
|
570
633
|
@typing.overload
|
571
|
-
def
|
634
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
572
635
|
...
|
573
636
|
|
574
|
-
def
|
637
|
+
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):
|
575
638
|
"""
|
576
|
-
|
639
|
+
Specifies the number of times the task corresponding
|
640
|
+
to a step needs to be retried.
|
577
641
|
|
642
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
643
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
644
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
645
|
+
|
646
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
647
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
648
|
+
ensuring that the flow execution can continue.
|
578
649
|
|
579
650
|
|
580
651
|
Parameters
|
581
652
|
----------
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
will be loaded at the start of the task.
|
587
|
-
- "none": Do not load any checkpoint
|
588
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
589
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
590
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
591
|
-
created within the task will be loaded when the task is retries execution on failure.
|
592
|
-
|
593
|
-
temp_dir_root : str, default: None
|
594
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
653
|
+
times : int, default 3
|
654
|
+
Number of times to retry this task.
|
655
|
+
minutes_between_retries : int, default 2
|
656
|
+
Number of minutes between retries.
|
595
657
|
"""
|
596
658
|
...
|
597
659
|
|
598
660
|
@typing.overload
|
599
|
-
def
|
661
|
+
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]]]:
|
600
662
|
"""
|
601
|
-
Specifies
|
602
|
-
|
663
|
+
Specifies a timeout for your step.
|
664
|
+
|
665
|
+
This decorator is useful if this step may hang indefinitely.
|
666
|
+
|
667
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
668
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
669
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
670
|
+
|
671
|
+
Note that all the values specified in parameters are added together so if you specify
|
672
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
603
673
|
|
604
674
|
|
605
675
|
Parameters
|
606
676
|
----------
|
607
|
-
|
608
|
-
|
677
|
+
seconds : int, default 0
|
678
|
+
Number of seconds to wait prior to timing out.
|
679
|
+
minutes : int, default 0
|
680
|
+
Number of minutes to wait prior to timing out.
|
681
|
+
hours : int, default 0
|
682
|
+
Number of hours to wait prior to timing out.
|
609
683
|
"""
|
610
684
|
...
|
611
685
|
|
612
686
|
@typing.overload
|
613
|
-
def
|
687
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
614
688
|
...
|
615
689
|
|
616
690
|
@typing.overload
|
617
|
-
def
|
691
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
618
692
|
...
|
619
693
|
|
620
|
-
def
|
694
|
+
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):
|
621
695
|
"""
|
622
|
-
Specifies
|
623
|
-
|
696
|
+
Specifies a timeout for your step.
|
697
|
+
|
698
|
+
This decorator is useful if this step may hang indefinitely.
|
699
|
+
|
700
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
701
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
702
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
703
|
+
|
704
|
+
Note that all the values specified in parameters are added together so if you specify
|
705
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
624
706
|
|
625
707
|
|
626
708
|
Parameters
|
627
709
|
----------
|
628
|
-
|
629
|
-
|
710
|
+
seconds : int, default 0
|
711
|
+
Number of seconds to wait prior to timing out.
|
712
|
+
minutes : int, default 0
|
713
|
+
Number of minutes to wait prior to timing out.
|
714
|
+
hours : int, default 0
|
715
|
+
Number of hours to wait prior to timing out.
|
630
716
|
"""
|
631
717
|
...
|
632
718
|
|
633
719
|
@typing.overload
|
634
|
-
def
|
720
|
+
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]]]:
|
635
721
|
"""
|
636
|
-
|
722
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
637
723
|
|
638
|
-
|
639
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
640
|
-
you can use `@pypi_base` to set packages required by all
|
641
|
-
steps and use `@pypi` to specify step-specific overrides.
|
724
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
642
725
|
|
643
726
|
|
644
727
|
Parameters
|
645
728
|
----------
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
729
|
+
type : str, default 'default'
|
730
|
+
Card type.
|
731
|
+
id : str, optional, default None
|
732
|
+
If multiple cards are present, use this id to identify this card.
|
733
|
+
options : Dict[str, Any], default {}
|
734
|
+
Options passed to the card. The contents depend on the card type.
|
735
|
+
timeout : int, default 45
|
736
|
+
Interrupt reporting if it takes more than this many seconds.
|
652
737
|
"""
|
653
738
|
...
|
654
739
|
|
655
740
|
@typing.overload
|
656
|
-
def
|
741
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
657
742
|
...
|
658
743
|
|
659
744
|
@typing.overload
|
660
|
-
def
|
745
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
661
746
|
...
|
662
747
|
|
663
|
-
def
|
748
|
+
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):
|
664
749
|
"""
|
665
|
-
|
750
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
666
751
|
|
667
|
-
|
668
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
669
|
-
you can use `@pypi_base` to set packages required by all
|
670
|
-
steps and use `@pypi` to specify step-specific overrides.
|
752
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
671
753
|
|
672
754
|
|
673
755
|
Parameters
|
674
756
|
----------
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
757
|
+
type : str, default 'default'
|
758
|
+
Card type.
|
759
|
+
id : str, optional, default None
|
760
|
+
If multiple cards are present, use this id to identify this card.
|
761
|
+
options : Dict[str, Any], default {}
|
762
|
+
Options passed to the card. The contents depend on the card type.
|
763
|
+
timeout : int, default 45
|
764
|
+
Interrupt reporting if it takes more than this many seconds.
|
681
765
|
"""
|
682
766
|
...
|
683
767
|
|
684
768
|
@typing.overload
|
685
|
-
def
|
769
|
+
def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: 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]]]:
|
686
770
|
"""
|
687
|
-
|
771
|
+
Enables checkpointing for a step.
|
688
772
|
|
689
|
-
The decorator will create an optional artifact, specified by `var`, which
|
690
|
-
contains the exception raised. You can use it to detect the presence
|
691
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
692
|
-
are missing.
|
693
773
|
|
694
774
|
|
695
775
|
Parameters
|
696
776
|
----------
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
777
|
+
load_policy : str, default: "fresh"
|
778
|
+
The policy for loading the checkpoint. The following policies are supported:
|
779
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
780
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
781
|
+
will be loaded at the start of the task.
|
782
|
+
- "none": Do not load any checkpoint
|
783
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
784
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
785
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
786
|
+
created within the task will be loaded when the task is retries execution on failure.
|
787
|
+
|
788
|
+
temp_dir_root : str, default: None
|
789
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
703
790
|
"""
|
704
791
|
...
|
705
792
|
|
706
793
|
@typing.overload
|
707
|
-
def
|
794
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
708
795
|
...
|
709
796
|
|
710
797
|
@typing.overload
|
711
|
-
def
|
798
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
712
799
|
...
|
713
800
|
|
714
|
-
def
|
801
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
715
802
|
"""
|
716
|
-
|
803
|
+
Enables checkpointing for a step.
|
717
804
|
|
718
|
-
The decorator will create an optional artifact, specified by `var`, which
|
719
|
-
contains the exception raised. You can use it to detect the presence
|
720
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
721
|
-
are missing.
|
722
805
|
|
723
806
|
|
724
807
|
Parameters
|
725
808
|
----------
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
809
|
+
load_policy : str, default: "fresh"
|
810
|
+
The policy for loading the checkpoint. The following policies are supported:
|
811
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
812
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
813
|
+
will be loaded at the start of the task.
|
814
|
+
- "none": Do not load any checkpoint
|
815
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
816
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
817
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
818
|
+
created within the task will be loaded when the task is retries execution on failure.
|
819
|
+
|
820
|
+
temp_dir_root : str, default: None
|
821
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
732
822
|
"""
|
733
823
|
...
|
734
824
|
|
735
825
|
@typing.overload
|
736
|
-
def
|
826
|
+
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]]]:
|
737
827
|
"""
|
738
|
-
|
828
|
+
Specifies the Conda environment for the step.
|
739
829
|
|
830
|
+
Information in this decorator will augment any
|
831
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
832
|
+
you can use `@conda_base` to set packages required by all
|
833
|
+
steps and use `@conda` to specify step-specific overrides.
|
740
834
|
|
741
835
|
|
742
836
|
Parameters
|
743
837
|
----------
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
If
|
754
|
-
|
755
|
-
temp_dir_root : str, default: None
|
756
|
-
The root directory under which `current.model.loaded` will store loaded models
|
838
|
+
packages : Dict[str, str], default {}
|
839
|
+
Packages to use for this step. The key is the name of the package
|
840
|
+
and the value is the version to use.
|
841
|
+
libraries : Dict[str, str], default {}
|
842
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
843
|
+
python : str, optional, default None
|
844
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
845
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
846
|
+
disabled : bool, default False
|
847
|
+
If set to True, disables @conda.
|
757
848
|
"""
|
758
849
|
...
|
759
850
|
|
760
851
|
@typing.overload
|
761
|
-
def
|
852
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
762
853
|
...
|
763
854
|
|
764
855
|
@typing.overload
|
765
|
-
def
|
856
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
766
857
|
...
|
767
858
|
|
768
|
-
def
|
859
|
+
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):
|
769
860
|
"""
|
770
|
-
|
861
|
+
Specifies the Conda environment for the step.
|
771
862
|
|
863
|
+
Information in this decorator will augment any
|
864
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
865
|
+
you can use `@conda_base` to set packages required by all
|
866
|
+
steps and use `@conda` to specify step-specific overrides.
|
772
867
|
|
773
868
|
|
774
869
|
Parameters
|
775
870
|
----------
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
If
|
786
|
-
|
787
|
-
temp_dir_root : str, default: None
|
788
|
-
The root directory under which `current.model.loaded` will store loaded models
|
871
|
+
packages : Dict[str, str], default {}
|
872
|
+
Packages to use for this step. The key is the name of the package
|
873
|
+
and the value is the version to use.
|
874
|
+
libraries : Dict[str, str], default {}
|
875
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
876
|
+
python : str, optional, default None
|
877
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
878
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
879
|
+
disabled : bool, default False
|
880
|
+
If set to True, disables @conda.
|
789
881
|
"""
|
790
882
|
...
|
791
883
|
|
792
|
-
|
884
|
+
@typing.overload
|
885
|
+
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]]]:
|
793
886
|
"""
|
794
|
-
Specifies
|
887
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
888
|
+
the execution of a step.
|
795
889
|
|
796
890
|
|
797
891
|
Parameters
|
798
892
|
----------
|
799
|
-
|
800
|
-
|
801
|
-
also present, the maximum value from all decorators is used.
|
802
|
-
memory : int, default 4096
|
803
|
-
Memory size (in MB) required for this step. If
|
804
|
-
`@resources` is also present, the maximum value from all decorators is
|
805
|
-
used.
|
806
|
-
disk : int, default 10240
|
807
|
-
Disk size (in MB) required for this step. If
|
808
|
-
`@resources` is also present, the maximum value from all decorators is
|
809
|
-
used.
|
810
|
-
image : str, optional, default None
|
811
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
812
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
813
|
-
not, a default Docker image mapping to the current version of Python is used.
|
814
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
815
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
816
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
817
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
818
|
-
secrets : List[str], optional, default None
|
819
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
820
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
821
|
-
in Metaflow configuration.
|
822
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
823
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
824
|
-
Can be passed in as a comma separated string of values e.g.
|
825
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
826
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
827
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
828
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
829
|
-
gpu : int, optional, default None
|
830
|
-
Number of GPUs required for this step. A value of zero implies that
|
831
|
-
the scheduled node should not have GPUs.
|
832
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
833
|
-
The vendor of the GPUs to be used for this step.
|
834
|
-
tolerations : List[str], default []
|
835
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
836
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
837
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
838
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
839
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
840
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
841
|
-
use_tmpfs : bool, default False
|
842
|
-
This enables an explicit tmpfs mount for this step.
|
843
|
-
tmpfs_tempdir : bool, default True
|
844
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
845
|
-
tmpfs_size : int, optional, default: None
|
846
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
847
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
848
|
-
memory allocated for this step.
|
849
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
850
|
-
Path to tmpfs mount for this step.
|
851
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
852
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
853
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
854
|
-
shared_memory: int, optional
|
855
|
-
Shared memory size (in MiB) required for this step
|
856
|
-
port: int, optional
|
857
|
-
Port number to specify in the Kubernetes job object
|
858
|
-
compute_pool : str, optional, default None
|
859
|
-
Compute pool to be used for for this step.
|
860
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
861
|
-
hostname_resolution_timeout: int, default 10 * 60
|
862
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
863
|
-
Only applicable when @parallel is used.
|
864
|
-
qos: str, default: Burstable
|
865
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
866
|
-
|
867
|
-
security_context: Dict[str, Any], optional, default None
|
868
|
-
Container security context. Applies to the task container. Allows the following keys:
|
869
|
-
- privileged: bool, optional, default None
|
870
|
-
- allow_privilege_escalation: bool, optional, default None
|
871
|
-
- run_as_user: int, optional, default None
|
872
|
-
- run_as_group: int, optional, default None
|
873
|
-
- run_as_non_root: bool, optional, default None
|
893
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
894
|
+
List of secret specs, defining how the secrets are to be retrieved
|
874
895
|
"""
|
875
896
|
...
|
876
897
|
|
877
|
-
|
898
|
+
@typing.overload
|
899
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
900
|
+
...
|
901
|
+
|
902
|
+
@typing.overload
|
903
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
904
|
+
...
|
905
|
+
|
906
|
+
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]]] = []):
|
878
907
|
"""
|
879
|
-
Specifies
|
908
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
909
|
+
the execution of a step.
|
880
910
|
|
881
911
|
|
882
912
|
Parameters
|
883
913
|
----------
|
884
|
-
|
885
|
-
|
886
|
-
gpu_type : str
|
887
|
-
Type of Nvidia GPU to use.
|
888
|
-
queue_timeout : int
|
889
|
-
Time to keep the job in NVCF's queue.
|
914
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
915
|
+
List of secret specs, defining how the secrets are to be retrieved
|
890
916
|
"""
|
891
917
|
...
|
892
918
|
|
893
919
|
@typing.overload
|
894
|
-
def
|
920
|
+
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]]]:
|
895
921
|
"""
|
896
|
-
Specifies the
|
922
|
+
Specifies the PyPI packages for the step.
|
897
923
|
|
898
924
|
Information in this decorator will augment any
|
899
|
-
attributes set in the `@
|
900
|
-
you can use `@
|
901
|
-
steps and use `@
|
925
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
926
|
+
you can use `@pypi_base` to set packages required by all
|
927
|
+
steps and use `@pypi` to specify step-specific overrides.
|
902
928
|
|
903
929
|
|
904
930
|
Parameters
|
905
931
|
----------
|
906
|
-
packages : Dict[str, str], default {}
|
932
|
+
packages : Dict[str, str], default: {}
|
907
933
|
Packages to use for this step. The key is the name of the package
|
908
934
|
and the value is the version to use.
|
909
|
-
|
910
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
911
|
-
python : str, optional, default None
|
935
|
+
python : str, optional, default: None
|
912
936
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
913
937
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
914
|
-
disabled : bool, default False
|
915
|
-
If set to True, disables @conda.
|
916
938
|
"""
|
917
939
|
...
|
918
940
|
|
919
941
|
@typing.overload
|
920
|
-
def
|
942
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
921
943
|
...
|
922
944
|
|
923
945
|
@typing.overload
|
924
|
-
def
|
946
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
925
947
|
...
|
926
948
|
|
927
|
-
def
|
949
|
+
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):
|
928
950
|
"""
|
929
|
-
Specifies the
|
951
|
+
Specifies the PyPI packages for the step.
|
930
952
|
|
931
953
|
Information in this decorator will augment any
|
932
|
-
attributes set in the `@
|
933
|
-
you can use `@
|
934
|
-
steps and use `@
|
954
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
955
|
+
you can use `@pypi_base` to set packages required by all
|
956
|
+
steps and use `@pypi` to specify step-specific overrides.
|
935
957
|
|
936
958
|
|
937
959
|
Parameters
|
938
960
|
----------
|
939
|
-
packages : Dict[str, str], default {}
|
961
|
+
packages : Dict[str, str], default: {}
|
940
962
|
Packages to use for this step. The key is the name of the package
|
941
963
|
and the value is the version to use.
|
942
|
-
|
943
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
944
|
-
python : str, optional, default None
|
964
|
+
python : str, optional, default: None
|
945
965
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
946
966
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
947
|
-
disabled : bool, default False
|
948
|
-
If set to True, disables @conda.
|
949
967
|
"""
|
950
968
|
...
|
951
969
|
|
952
970
|
@typing.overload
|
953
|
-
def
|
971
|
+
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]]:
|
954
972
|
"""
|
955
|
-
|
973
|
+
Specifies the event(s) that this flow depends on.
|
974
|
+
|
975
|
+
```
|
976
|
+
@trigger(event='foo')
|
977
|
+
```
|
978
|
+
or
|
979
|
+
```
|
980
|
+
@trigger(events=['foo', 'bar'])
|
981
|
+
```
|
982
|
+
|
983
|
+
Additionally, you can specify the parameter mappings
|
984
|
+
to map event payload to Metaflow parameters for the flow.
|
985
|
+
```
|
986
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
987
|
+
```
|
988
|
+
or
|
989
|
+
```
|
990
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
991
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
992
|
+
```
|
993
|
+
|
994
|
+
'parameters' can also be a list of strings and tuples like so:
|
995
|
+
```
|
996
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
997
|
+
```
|
998
|
+
This is equivalent to:
|
999
|
+
```
|
1000
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1001
|
+
```
|
1002
|
+
|
1003
|
+
|
1004
|
+
Parameters
|
1005
|
+
----------
|
1006
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1007
|
+
Event dependency for this flow.
|
1008
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1009
|
+
Events dependency for this flow.
|
1010
|
+
options : Dict[str, Any], default {}
|
1011
|
+
Backend-specific configuration for tuning eventing behavior.
|
956
1012
|
"""
|
957
1013
|
...
|
958
1014
|
|
959
1015
|
@typing.overload
|
960
|
-
def
|
1016
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
961
1017
|
...
|
962
1018
|
|
963
|
-
def
|
1019
|
+
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] = {}):
|
964
1020
|
"""
|
965
|
-
|
1021
|
+
Specifies the event(s) that this flow depends on.
|
1022
|
+
|
1023
|
+
```
|
1024
|
+
@trigger(event='foo')
|
1025
|
+
```
|
1026
|
+
or
|
1027
|
+
```
|
1028
|
+
@trigger(events=['foo', 'bar'])
|
1029
|
+
```
|
1030
|
+
|
1031
|
+
Additionally, you can specify the parameter mappings
|
1032
|
+
to map event payload to Metaflow parameters for the flow.
|
1033
|
+
```
|
1034
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1035
|
+
```
|
1036
|
+
or
|
1037
|
+
```
|
1038
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1039
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1040
|
+
```
|
1041
|
+
|
1042
|
+
'parameters' can also be a list of strings and tuples like so:
|
1043
|
+
```
|
1044
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1045
|
+
```
|
1046
|
+
This is equivalent to:
|
1047
|
+
```
|
1048
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1049
|
+
```
|
1050
|
+
|
1051
|
+
|
1052
|
+
Parameters
|
1053
|
+
----------
|
1054
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1055
|
+
Event dependency for this flow.
|
1056
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1057
|
+
Events dependency for this flow.
|
1058
|
+
options : Dict[str, Any], default {}
|
1059
|
+
Backend-specific configuration for tuning eventing behavior.
|
966
1060
|
"""
|
967
1061
|
...
|
968
1062
|
|
@@ -1068,43 +1162,147 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1068
1162
|
...
|
1069
1163
|
|
1070
1164
|
@typing.overload
|
1071
|
-
def
|
1165
|
+
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]]:
|
1072
1166
|
"""
|
1073
|
-
Specifies the
|
1167
|
+
Specifies the Conda environment for all steps of the flow.
|
1168
|
+
|
1169
|
+
Use `@conda_base` to set common libraries required by all
|
1170
|
+
steps and use `@conda` to specify step-specific additions.
|
1074
1171
|
|
1075
|
-
Use `@pypi_base` to set common packages required by all
|
1076
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1077
1172
|
|
1078
1173
|
Parameters
|
1079
1174
|
----------
|
1080
|
-
packages : Dict[str, str], default
|
1175
|
+
packages : Dict[str, str], default {}
|
1081
1176
|
Packages to use for this flow. The key is the name of the package
|
1082
1177
|
and the value is the version to use.
|
1083
|
-
|
1178
|
+
libraries : Dict[str, str], default {}
|
1179
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1180
|
+
python : str, optional, default None
|
1084
1181
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1085
1182
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1183
|
+
disabled : bool, default False
|
1184
|
+
If set to True, disables Conda.
|
1086
1185
|
"""
|
1087
1186
|
...
|
1088
1187
|
|
1089
1188
|
@typing.overload
|
1090
|
-
def
|
1189
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1091
1190
|
...
|
1092
1191
|
|
1093
|
-
def
|
1192
|
+
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):
|
1094
1193
|
"""
|
1095
|
-
Specifies the
|
1194
|
+
Specifies the Conda environment for all steps of the flow.
|
1195
|
+
|
1196
|
+
Use `@conda_base` to set common libraries required by all
|
1197
|
+
steps and use `@conda` to specify step-specific additions.
|
1096
1198
|
|
1097
|
-
Use `@pypi_base` to set common packages required by all
|
1098
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1099
1199
|
|
1100
1200
|
Parameters
|
1101
1201
|
----------
|
1102
|
-
packages : Dict[str, str], default
|
1202
|
+
packages : Dict[str, str], default {}
|
1103
1203
|
Packages to use for this flow. The key is the name of the package
|
1104
1204
|
and the value is the version to use.
|
1105
|
-
|
1205
|
+
libraries : Dict[str, str], default {}
|
1206
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1207
|
+
python : str, optional, default None
|
1106
1208
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1107
1209
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1210
|
+
disabled : bool, default False
|
1211
|
+
If set to True, disables Conda.
|
1212
|
+
"""
|
1213
|
+
...
|
1214
|
+
|
1215
|
+
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]]:
|
1216
|
+
"""
|
1217
|
+
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)
|
1218
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1219
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1220
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1221
|
+
starts only after all sensors finish.
|
1222
|
+
|
1223
|
+
|
1224
|
+
Parameters
|
1225
|
+
----------
|
1226
|
+
timeout : int
|
1227
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1228
|
+
poke_interval : int
|
1229
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1230
|
+
mode : str
|
1231
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1232
|
+
exponential_backoff : bool
|
1233
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1234
|
+
pool : str
|
1235
|
+
the slot pool this task should run in,
|
1236
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1237
|
+
soft_fail : bool
|
1238
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1239
|
+
name : str
|
1240
|
+
Name of the sensor on Airflow
|
1241
|
+
description : str
|
1242
|
+
Description of sensor in the Airflow UI
|
1243
|
+
bucket_key : Union[str, List[str]]
|
1244
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1245
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1246
|
+
bucket_name : str
|
1247
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1248
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1249
|
+
wildcard_match : bool
|
1250
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1251
|
+
aws_conn_id : str
|
1252
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1253
|
+
verify : bool
|
1254
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1255
|
+
"""
|
1256
|
+
...
|
1257
|
+
|
1258
|
+
@typing.overload
|
1259
|
+
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]]:
|
1260
|
+
"""
|
1261
|
+
Specifies the times when the flow should be run when running on a
|
1262
|
+
production scheduler.
|
1263
|
+
|
1264
|
+
|
1265
|
+
Parameters
|
1266
|
+
----------
|
1267
|
+
hourly : bool, default False
|
1268
|
+
Run the workflow hourly.
|
1269
|
+
daily : bool, default True
|
1270
|
+
Run the workflow daily.
|
1271
|
+
weekly : bool, default False
|
1272
|
+
Run the workflow weekly.
|
1273
|
+
cron : str, optional, default None
|
1274
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1275
|
+
specified by this expression.
|
1276
|
+
timezone : str, optional, default None
|
1277
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1278
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1279
|
+
"""
|
1280
|
+
...
|
1281
|
+
|
1282
|
+
@typing.overload
|
1283
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1284
|
+
...
|
1285
|
+
|
1286
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1287
|
+
"""
|
1288
|
+
Specifies the times when the flow should be run when running on a
|
1289
|
+
production scheduler.
|
1290
|
+
|
1291
|
+
|
1292
|
+
Parameters
|
1293
|
+
----------
|
1294
|
+
hourly : bool, default False
|
1295
|
+
Run the workflow hourly.
|
1296
|
+
daily : bool, default True
|
1297
|
+
Run the workflow daily.
|
1298
|
+
weekly : bool, default False
|
1299
|
+
Run the workflow weekly.
|
1300
|
+
cron : str, optional, default None
|
1301
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1302
|
+
specified by this expression.
|
1303
|
+
timezone : str, optional, default None
|
1304
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1305
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1108
1306
|
"""
|
1109
1307
|
...
|
1110
1308
|
|
@@ -1143,6 +1341,47 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
|
|
1143
1341
|
"""
|
1144
1342
|
...
|
1145
1343
|
|
1344
|
+
@typing.overload
|
1345
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1346
|
+
"""
|
1347
|
+
Specifies the PyPI packages for all steps of the flow.
|
1348
|
+
|
1349
|
+
Use `@pypi_base` to set common packages required by all
|
1350
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1351
|
+
|
1352
|
+
Parameters
|
1353
|
+
----------
|
1354
|
+
packages : Dict[str, str], default: {}
|
1355
|
+
Packages to use for this flow. The key is the name of the package
|
1356
|
+
and the value is the version to use.
|
1357
|
+
python : str, optional, default: None
|
1358
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1359
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1360
|
+
"""
|
1361
|
+
...
|
1362
|
+
|
1363
|
+
@typing.overload
|
1364
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1365
|
+
...
|
1366
|
+
|
1367
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1368
|
+
"""
|
1369
|
+
Specifies the PyPI packages for all steps of the flow.
|
1370
|
+
|
1371
|
+
Use `@pypi_base` to set common packages required by all
|
1372
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1373
|
+
|
1374
|
+
Parameters
|
1375
|
+
----------
|
1376
|
+
packages : Dict[str, str], default: {}
|
1377
|
+
Packages to use for this flow. The key is the name of the package
|
1378
|
+
and the value is the version to use.
|
1379
|
+
python : str, optional, default: None
|
1380
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1381
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1382
|
+
"""
|
1383
|
+
...
|
1384
|
+
|
1146
1385
|
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
1147
1386
|
"""
|
1148
1387
|
Allows setting external datastores to save data for the
|
@@ -1257,150 +1496,6 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1257
1496
|
"""
|
1258
1497
|
...
|
1259
1498
|
|
1260
|
-
@typing.overload
|
1261
|
-
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]]:
|
1262
|
-
"""
|
1263
|
-
Specifies the Conda environment for all steps of the flow.
|
1264
|
-
|
1265
|
-
Use `@conda_base` to set common libraries required by all
|
1266
|
-
steps and use `@conda` to specify step-specific additions.
|
1267
|
-
|
1268
|
-
|
1269
|
-
Parameters
|
1270
|
-
----------
|
1271
|
-
packages : Dict[str, str], default {}
|
1272
|
-
Packages to use for this flow. The key is the name of the package
|
1273
|
-
and the value is the version to use.
|
1274
|
-
libraries : Dict[str, str], default {}
|
1275
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1276
|
-
python : str, optional, default None
|
1277
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1278
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1279
|
-
disabled : bool, default False
|
1280
|
-
If set to True, disables Conda.
|
1281
|
-
"""
|
1282
|
-
...
|
1283
|
-
|
1284
|
-
@typing.overload
|
1285
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1286
|
-
...
|
1287
|
-
|
1288
|
-
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):
|
1289
|
-
"""
|
1290
|
-
Specifies the Conda environment for all steps of the flow.
|
1291
|
-
|
1292
|
-
Use `@conda_base` to set common libraries required by all
|
1293
|
-
steps and use `@conda` to specify step-specific additions.
|
1294
|
-
|
1295
|
-
|
1296
|
-
Parameters
|
1297
|
-
----------
|
1298
|
-
packages : Dict[str, str], default {}
|
1299
|
-
Packages to use for this flow. The key is the name of the package
|
1300
|
-
and the value is the version to use.
|
1301
|
-
libraries : Dict[str, str], default {}
|
1302
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1303
|
-
python : str, optional, default None
|
1304
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1305
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1306
|
-
disabled : bool, default False
|
1307
|
-
If set to True, disables Conda.
|
1308
|
-
"""
|
1309
|
-
...
|
1310
|
-
|
1311
|
-
@typing.overload
|
1312
|
-
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]]:
|
1313
|
-
"""
|
1314
|
-
Specifies the event(s) that this flow depends on.
|
1315
|
-
|
1316
|
-
```
|
1317
|
-
@trigger(event='foo')
|
1318
|
-
```
|
1319
|
-
or
|
1320
|
-
```
|
1321
|
-
@trigger(events=['foo', 'bar'])
|
1322
|
-
```
|
1323
|
-
|
1324
|
-
Additionally, you can specify the parameter mappings
|
1325
|
-
to map event payload to Metaflow parameters for the flow.
|
1326
|
-
```
|
1327
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1328
|
-
```
|
1329
|
-
or
|
1330
|
-
```
|
1331
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1332
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1333
|
-
```
|
1334
|
-
|
1335
|
-
'parameters' can also be a list of strings and tuples like so:
|
1336
|
-
```
|
1337
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1338
|
-
```
|
1339
|
-
This is equivalent to:
|
1340
|
-
```
|
1341
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1342
|
-
```
|
1343
|
-
|
1344
|
-
|
1345
|
-
Parameters
|
1346
|
-
----------
|
1347
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1348
|
-
Event dependency for this flow.
|
1349
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1350
|
-
Events dependency for this flow.
|
1351
|
-
options : Dict[str, Any], default {}
|
1352
|
-
Backend-specific configuration for tuning eventing behavior.
|
1353
|
-
"""
|
1354
|
-
...
|
1355
|
-
|
1356
|
-
@typing.overload
|
1357
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1358
|
-
...
|
1359
|
-
|
1360
|
-
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] = {}):
|
1361
|
-
"""
|
1362
|
-
Specifies the event(s) that this flow depends on.
|
1363
|
-
|
1364
|
-
```
|
1365
|
-
@trigger(event='foo')
|
1366
|
-
```
|
1367
|
-
or
|
1368
|
-
```
|
1369
|
-
@trigger(events=['foo', 'bar'])
|
1370
|
-
```
|
1371
|
-
|
1372
|
-
Additionally, you can specify the parameter mappings
|
1373
|
-
to map event payload to Metaflow parameters for the flow.
|
1374
|
-
```
|
1375
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1376
|
-
```
|
1377
|
-
or
|
1378
|
-
```
|
1379
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1380
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1381
|
-
```
|
1382
|
-
|
1383
|
-
'parameters' can also be a list of strings and tuples like so:
|
1384
|
-
```
|
1385
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1386
|
-
```
|
1387
|
-
This is equivalent to:
|
1388
|
-
```
|
1389
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1390
|
-
```
|
1391
|
-
|
1392
|
-
|
1393
|
-
Parameters
|
1394
|
-
----------
|
1395
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1396
|
-
Event dependency for this flow.
|
1397
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1398
|
-
Events dependency for this flow.
|
1399
|
-
options : Dict[str, Any], default {}
|
1400
|
-
Backend-specific configuration for tuning eventing behavior.
|
1401
|
-
"""
|
1402
|
-
...
|
1403
|
-
|
1404
1499
|
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]]:
|
1405
1500
|
"""
|
1406
1501
|
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.
|
@@ -1444,99 +1539,5 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1444
1539
|
"""
|
1445
1540
|
...
|
1446
1541
|
|
1447
|
-
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]]:
|
1448
|
-
"""
|
1449
|
-
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)
|
1450
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1451
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1452
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1453
|
-
starts only after all sensors finish.
|
1454
|
-
|
1455
|
-
|
1456
|
-
Parameters
|
1457
|
-
----------
|
1458
|
-
timeout : int
|
1459
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1460
|
-
poke_interval : int
|
1461
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1462
|
-
mode : str
|
1463
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1464
|
-
exponential_backoff : bool
|
1465
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1466
|
-
pool : str
|
1467
|
-
the slot pool this task should run in,
|
1468
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1469
|
-
soft_fail : bool
|
1470
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1471
|
-
name : str
|
1472
|
-
Name of the sensor on Airflow
|
1473
|
-
description : str
|
1474
|
-
Description of sensor in the Airflow UI
|
1475
|
-
bucket_key : Union[str, List[str]]
|
1476
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1477
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1478
|
-
bucket_name : str
|
1479
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1480
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1481
|
-
wildcard_match : bool
|
1482
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1483
|
-
aws_conn_id : str
|
1484
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1485
|
-
verify : bool
|
1486
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1487
|
-
"""
|
1488
|
-
...
|
1489
|
-
|
1490
|
-
@typing.overload
|
1491
|
-
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]]:
|
1492
|
-
"""
|
1493
|
-
Specifies the times when the flow should be run when running on a
|
1494
|
-
production scheduler.
|
1495
|
-
|
1496
|
-
|
1497
|
-
Parameters
|
1498
|
-
----------
|
1499
|
-
hourly : bool, default False
|
1500
|
-
Run the workflow hourly.
|
1501
|
-
daily : bool, default True
|
1502
|
-
Run the workflow daily.
|
1503
|
-
weekly : bool, default False
|
1504
|
-
Run the workflow weekly.
|
1505
|
-
cron : str, optional, default None
|
1506
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1507
|
-
specified by this expression.
|
1508
|
-
timezone : str, optional, default None
|
1509
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1510
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1511
|
-
"""
|
1512
|
-
...
|
1513
|
-
|
1514
|
-
@typing.overload
|
1515
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1516
|
-
...
|
1517
|
-
|
1518
|
-
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1519
|
-
"""
|
1520
|
-
Specifies the times when the flow should be run when running on a
|
1521
|
-
production scheduler.
|
1522
|
-
|
1523
|
-
|
1524
|
-
Parameters
|
1525
|
-
----------
|
1526
|
-
hourly : bool, default False
|
1527
|
-
Run the workflow hourly.
|
1528
|
-
daily : bool, default True
|
1529
|
-
Run the workflow daily.
|
1530
|
-
weekly : bool, default False
|
1531
|
-
Run the workflow weekly.
|
1532
|
-
cron : str, optional, default None
|
1533
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1534
|
-
specified by this expression.
|
1535
|
-
timezone : str, optional, default None
|
1536
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1537
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1538
|
-
"""
|
1539
|
-
...
|
1540
|
-
|
1541
1542
|
pkg_name: str
|
1542
1543
|
|