ob-metaflow-stubs 6.0.3.175rc0__py2.py3-none-any.whl → 6.0.3.176__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 +680 -674
- 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 +2 -2
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +5 -5
- 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 +2 -2
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +113 -113
- 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 +2 -2
- 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 +4 -4
- 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 +3 -3
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- 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 +3 -3
- 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 +3 -3
- 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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- 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/{fast_bakery → aws}/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +52 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +60 -0
- 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/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 +60 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +73 -0
- 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 -2
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +10 -10
- 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 +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +1 -1
- 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 +2 -2
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +12 -3
- 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 +4 -4
- 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 +2 -2
- 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 +1 -1
- 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 +28 -28
- 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 +2 -2
- 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 +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.3.175rc0.dist-info → ob_metaflow_stubs-6.0.3.176.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.176.dist-info/RECORD +215 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +0 -51
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +0 -65
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +0 -74
- metaflow-stubs/ob_internal.pyi +0 -11
- ob_metaflow_stubs-6.0.3.175rc0.dist-info/RECORD +0 -216
- {ob_metaflow_stubs-6.0.3.175rc0.dist-info → ob_metaflow_stubs-6.0.3.176.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.175rc0.dist-info → ob_metaflow_stubs-6.0.3.176.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.15.14.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-
|
4
|
+
# Generated on 2025-06-09T21:12:38.857633 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import datetime
|
12
11
|
import typing
|
12
|
+
import datetime
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -36,17 +36,17 @@ from .user_configs.config_parameters import config_expr as config_expr
|
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
38
|
from . import cards as cards
|
39
|
-
from . import metaflow_git as metaflow_git
|
40
39
|
from . import tuple_util as tuple_util
|
40
|
+
from . import metaflow_git as metaflow_git
|
41
41
|
from . import events as events
|
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
|
47
48
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
48
49
|
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
|
@@ -72,12 +72,12 @@ from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package imp
|
|
72
72
|
from .mf_extensions.outerbounds.plugins.snowflake.snowflake import Snowflake as Snowflake
|
73
73
|
from .mf_extensions.outerbounds.plugins.checkpoint_datastores.nebius import nebius_checkpoints as nebius_checkpoints
|
74
74
|
from .mf_extensions.outerbounds.plugins.checkpoint_datastores.coreweave import coreweave_checkpoints as coreweave_checkpoints
|
75
|
+
from .mf_extensions.outerbounds.plugins.aws.assume_role_decorator import assume_role as assume_role
|
75
76
|
from . import cli_components as cli_components
|
76
77
|
from . import system as system
|
77
78
|
from . import pylint_wrapper as pylint_wrapper
|
78
79
|
from . import cli as cli
|
79
80
|
from . import profilers as profilers
|
80
|
-
from . import ob_internal as ob_internal
|
81
81
|
|
82
82
|
EXT_PKG: str
|
83
83
|
|
@@ -155,108 +155,154 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
155
155
|
...
|
156
156
|
|
157
157
|
@typing.overload
|
158
|
-
def
|
158
|
+
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]]]:
|
159
159
|
"""
|
160
|
-
Specifies
|
160
|
+
Specifies a timeout for your step.
|
161
161
|
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
162
|
+
This decorator is useful if this step may hang indefinitely.
|
163
|
+
|
164
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
165
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
166
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
167
|
+
|
168
|
+
Note that all the values specified in parameters are added together so if you specify
|
169
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
166
170
|
|
167
171
|
|
168
172
|
Parameters
|
169
173
|
----------
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
174
|
+
seconds : int, default 0
|
175
|
+
Number of seconds to wait prior to timing out.
|
176
|
+
minutes : int, default 0
|
177
|
+
Number of minutes to wait prior to timing out.
|
178
|
+
hours : int, default 0
|
179
|
+
Number of hours to wait prior to timing out.
|
176
180
|
"""
|
177
181
|
...
|
178
182
|
|
179
183
|
@typing.overload
|
180
|
-
def
|
184
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
181
185
|
...
|
182
186
|
|
183
187
|
@typing.overload
|
184
|
-
def
|
188
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
185
189
|
...
|
186
190
|
|
187
|
-
def
|
191
|
+
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):
|
188
192
|
"""
|
189
|
-
Specifies
|
193
|
+
Specifies a timeout for your step.
|
190
194
|
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
+
This decorator is useful if this step may hang indefinitely.
|
196
|
+
|
197
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
198
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
199
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
200
|
+
|
201
|
+
Note that all the values specified in parameters are added together so if you specify
|
202
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
195
203
|
|
196
204
|
|
197
205
|
Parameters
|
198
206
|
----------
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
207
|
+
seconds : int, default 0
|
208
|
+
Number of seconds to wait prior to timing out.
|
209
|
+
minutes : int, default 0
|
210
|
+
Number of minutes to wait prior to timing out.
|
211
|
+
hours : int, default 0
|
212
|
+
Number of hours to wait prior to timing out.
|
213
|
+
"""
|
214
|
+
...
|
215
|
+
|
216
|
+
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]]]:
|
217
|
+
"""
|
218
|
+
Specifies that this step is used to deploy an instance of the app.
|
219
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
220
|
+
|
221
|
+
|
222
|
+
Parameters
|
223
|
+
----------
|
224
|
+
app_port : int
|
225
|
+
Number of GPUs to use.
|
226
|
+
app_name : str
|
227
|
+
Name of the app to deploy.
|
205
228
|
"""
|
206
229
|
...
|
207
230
|
|
208
231
|
@typing.overload
|
209
|
-
def
|
232
|
+
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]]]:
|
210
233
|
"""
|
211
|
-
|
234
|
+
Enables checkpointing for a step.
|
212
235
|
|
213
|
-
The decorator will create an optional artifact, specified by `var`, which
|
214
|
-
contains the exception raised. You can use it to detect the presence
|
215
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
216
|
-
are missing.
|
217
236
|
|
218
237
|
|
219
238
|
Parameters
|
220
239
|
----------
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
240
|
+
load_policy : str, default: "fresh"
|
241
|
+
The policy for loading the checkpoint. The following policies are supported:
|
242
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
243
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
244
|
+
will be loaded at the start of the task.
|
245
|
+
- "none": Do not load any checkpoint
|
246
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
247
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
248
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
249
|
+
created within the task will be loaded when the task is retries execution on failure.
|
250
|
+
|
251
|
+
temp_dir_root : str, default: None
|
252
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
227
253
|
"""
|
228
254
|
...
|
229
255
|
|
230
256
|
@typing.overload
|
231
|
-
def
|
257
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
232
258
|
...
|
233
259
|
|
234
260
|
@typing.overload
|
235
|
-
def
|
261
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
236
262
|
...
|
237
263
|
|
238
|
-
def
|
264
|
+
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):
|
239
265
|
"""
|
240
|
-
|
266
|
+
Enables checkpointing for a step.
|
241
267
|
|
242
|
-
The decorator will create an optional artifact, specified by `var`, which
|
243
|
-
contains the exception raised. You can use it to detect the presence
|
244
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
245
|
-
are missing.
|
246
268
|
|
247
269
|
|
248
270
|
Parameters
|
249
271
|
----------
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
272
|
+
load_policy : str, default: "fresh"
|
273
|
+
The policy for loading the checkpoint. The following policies are supported:
|
274
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
275
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
276
|
+
will be loaded at the start of the task.
|
277
|
+
- "none": Do not load any checkpoint
|
278
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
279
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
280
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
281
|
+
created within the task will be loaded when the task is retries execution on failure.
|
282
|
+
|
283
|
+
temp_dir_root : str, default: None
|
284
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
285
|
+
"""
|
286
|
+
...
|
287
|
+
|
288
|
+
@typing.overload
|
289
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
290
|
+
"""
|
291
|
+
Internal decorator to support Fast bakery
|
292
|
+
"""
|
293
|
+
...
|
294
|
+
|
295
|
+
@typing.overload
|
296
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
297
|
+
...
|
298
|
+
|
299
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
300
|
+
"""
|
301
|
+
Internal decorator to support Fast bakery
|
256
302
|
"""
|
257
303
|
...
|
258
304
|
|
259
|
-
def ollama(*, models: list, backend: str, force_pull: bool,
|
305
|
+
def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> 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]]]:
|
260
306
|
"""
|
261
307
|
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
262
308
|
|
@@ -286,296 +332,100 @@ def ollama(*, models: list, backend: str, force_pull: bool, skip_push_check: boo
|
|
286
332
|
Determines where and how to run the Ollama process.
|
287
333
|
force_pull: bool
|
288
334
|
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
289
|
-
|
290
|
-
|
335
|
+
cache_update_policy: str
|
336
|
+
Cache update policy: "auto", "force", or "never".
|
337
|
+
force_cache_update: bool
|
338
|
+
Simple override for "force" cache update policy.
|
291
339
|
debug: bool
|
292
340
|
Whether to turn on verbose debugging logs.
|
341
|
+
circuit_breaker_config: dict
|
342
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
343
|
+
timeout_config: dict
|
344
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
293
345
|
"""
|
294
346
|
...
|
295
347
|
|
296
|
-
|
348
|
+
@typing.overload
|
349
|
+
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]]]:
|
297
350
|
"""
|
298
|
-
Specifies
|
351
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
352
|
+
the execution of a step.
|
299
353
|
|
300
354
|
|
301
355
|
Parameters
|
302
356
|
----------
|
303
|
-
|
304
|
-
|
305
|
-
also present, the maximum value from all decorators is used.
|
306
|
-
memory : int, default 4096
|
307
|
-
Memory size (in MB) required for this step. If
|
308
|
-
`@resources` is also present, the maximum value from all decorators is
|
309
|
-
used.
|
310
|
-
disk : int, default 10240
|
311
|
-
Disk size (in MB) required for this step. If
|
312
|
-
`@resources` is also present, the maximum value from all decorators is
|
313
|
-
used.
|
314
|
-
image : str, optional, default None
|
315
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
316
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
317
|
-
not, a default Docker image mapping to the current version of Python is used.
|
318
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
319
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
320
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
321
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
322
|
-
secrets : List[str], optional, default None
|
323
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
324
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
325
|
-
in Metaflow configuration.
|
326
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
327
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
328
|
-
Can be passed in as a comma separated string of values e.g.
|
329
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
330
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
331
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
332
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
333
|
-
gpu : int, optional, default None
|
334
|
-
Number of GPUs required for this step. A value of zero implies that
|
335
|
-
the scheduled node should not have GPUs.
|
336
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
337
|
-
The vendor of the GPUs to be used for this step.
|
338
|
-
tolerations : List[str], default []
|
339
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
340
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
341
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
342
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
343
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
344
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
345
|
-
use_tmpfs : bool, default False
|
346
|
-
This enables an explicit tmpfs mount for this step.
|
347
|
-
tmpfs_tempdir : bool, default True
|
348
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
349
|
-
tmpfs_size : int, optional, default: None
|
350
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
351
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
352
|
-
memory allocated for this step.
|
353
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
354
|
-
Path to tmpfs mount for this step.
|
355
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
356
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
357
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
358
|
-
shared_memory: int, optional
|
359
|
-
Shared memory size (in MiB) required for this step
|
360
|
-
port: int, optional
|
361
|
-
Port number to specify in the Kubernetes job object
|
362
|
-
compute_pool : str, optional, default None
|
363
|
-
Compute pool to be used for for this step.
|
364
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
365
|
-
hostname_resolution_timeout: int, default 10 * 60
|
366
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
367
|
-
Only applicable when @parallel is used.
|
368
|
-
qos: str, default: Burstable
|
369
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
370
|
-
|
371
|
-
security_context: Dict[str, Any], optional, default None
|
372
|
-
Container security context. Applies to the task container. Allows the following keys:
|
373
|
-
- privileged: bool, optional, default None
|
374
|
-
- allow_privilege_escalation: bool, optional, default None
|
375
|
-
- run_as_user: int, optional, default None
|
376
|
-
- run_as_group: int, optional, default None
|
377
|
-
- run_as_non_root: bool, optional, default None
|
357
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
358
|
+
List of secret specs, defining how the secrets are to be retrieved
|
378
359
|
"""
|
379
360
|
...
|
380
361
|
|
381
362
|
@typing.overload
|
382
|
-
def
|
363
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
364
|
+
...
|
365
|
+
|
366
|
+
@typing.overload
|
367
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
368
|
+
...
|
369
|
+
|
370
|
+
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]]] = []):
|
383
371
|
"""
|
384
|
-
|
385
|
-
|
372
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
373
|
+
the execution of a step.
|
386
374
|
|
387
375
|
|
388
376
|
Parameters
|
389
377
|
----------
|
390
|
-
|
391
|
-
|
392
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
393
|
-
- `current.checkpoint`
|
394
|
-
- `current.model`
|
395
|
-
- `current.huggingface_hub`
|
396
|
-
|
397
|
-
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
|
398
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
399
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
400
|
-
|
401
|
-
temp_dir_root : str, default: None
|
402
|
-
The root directory under which `current.model.loaded` will store loaded models
|
403
|
-
"""
|
404
|
-
...
|
405
|
-
|
406
|
-
@typing.overload
|
407
|
-
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
408
|
-
...
|
409
|
-
|
410
|
-
@typing.overload
|
411
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
412
|
-
...
|
413
|
-
|
414
|
-
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):
|
415
|
-
"""
|
416
|
-
Enables loading / saving of models within a step.
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
Parameters
|
421
|
-
----------
|
422
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
423
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
424
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
425
|
-
- `current.checkpoint`
|
426
|
-
- `current.model`
|
427
|
-
- `current.huggingface_hub`
|
428
|
-
|
429
|
-
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
|
430
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
431
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
432
|
-
|
433
|
-
temp_dir_root : str, default: None
|
434
|
-
The root directory under which `current.model.loaded` will store loaded models
|
435
|
-
"""
|
436
|
-
...
|
437
|
-
|
438
|
-
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]]]:
|
439
|
-
"""
|
440
|
-
Specifies that this step is used to deploy an instance of the app.
|
441
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
442
|
-
|
443
|
-
|
444
|
-
Parameters
|
445
|
-
----------
|
446
|
-
app_port : int
|
447
|
-
Number of GPUs to use.
|
448
|
-
app_name : str
|
449
|
-
Name of the app to deploy.
|
450
|
-
"""
|
451
|
-
...
|
452
|
-
|
453
|
-
@typing.overload
|
454
|
-
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]]]:
|
455
|
-
"""
|
456
|
-
Specifies the number of times the task corresponding
|
457
|
-
to a step needs to be retried.
|
458
|
-
|
459
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
460
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
461
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
462
|
-
|
463
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
464
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
465
|
-
ensuring that the flow execution can continue.
|
466
|
-
|
467
|
-
|
468
|
-
Parameters
|
469
|
-
----------
|
470
|
-
times : int, default 3
|
471
|
-
Number of times to retry this task.
|
472
|
-
minutes_between_retries : int, default 2
|
473
|
-
Number of minutes between retries.
|
474
|
-
"""
|
475
|
-
...
|
476
|
-
|
477
|
-
@typing.overload
|
478
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
479
|
-
...
|
480
|
-
|
481
|
-
@typing.overload
|
482
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
483
|
-
...
|
484
|
-
|
485
|
-
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):
|
486
|
-
"""
|
487
|
-
Specifies the number of times the task corresponding
|
488
|
-
to a step needs to be retried.
|
489
|
-
|
490
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
491
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
492
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
493
|
-
|
494
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
495
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
496
|
-
ensuring that the flow execution can continue.
|
497
|
-
|
498
|
-
|
499
|
-
Parameters
|
500
|
-
----------
|
501
|
-
times : int, default 3
|
502
|
-
Number of times to retry this task.
|
503
|
-
minutes_between_retries : int, default 2
|
504
|
-
Number of minutes between retries.
|
378
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
379
|
+
List of secret specs, defining how the secrets are to be retrieved
|
505
380
|
"""
|
506
381
|
...
|
507
382
|
|
508
383
|
@typing.overload
|
509
|
-
def
|
384
|
+
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]]]:
|
510
385
|
"""
|
511
|
-
|
386
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
512
387
|
|
388
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
513
389
|
|
514
390
|
|
515
391
|
Parameters
|
516
392
|
----------
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
526
|
-
created within the task will be loaded when the task is retries execution on failure.
|
527
|
-
|
528
|
-
temp_dir_root : str, default: None
|
529
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
393
|
+
type : str, default 'default'
|
394
|
+
Card type.
|
395
|
+
id : str, optional, default None
|
396
|
+
If multiple cards are present, use this id to identify this card.
|
397
|
+
options : Dict[str, Any], default {}
|
398
|
+
Options passed to the card. The contents depend on the card type.
|
399
|
+
timeout : int, default 45
|
400
|
+
Interrupt reporting if it takes more than this many seconds.
|
530
401
|
"""
|
531
402
|
...
|
532
403
|
|
533
404
|
@typing.overload
|
534
|
-
def
|
405
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
535
406
|
...
|
536
407
|
|
537
408
|
@typing.overload
|
538
|
-
def
|
409
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
539
410
|
...
|
540
411
|
|
541
|
-
def
|
412
|
+
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):
|
542
413
|
"""
|
543
|
-
|
414
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
544
415
|
|
416
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
545
417
|
|
546
418
|
|
547
419
|
Parameters
|
548
420
|
----------
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
558
|
-
created within the task will be loaded when the task is retries execution on failure.
|
559
|
-
|
560
|
-
temp_dir_root : str, default: None
|
561
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
562
|
-
"""
|
563
|
-
...
|
564
|
-
|
565
|
-
@typing.overload
|
566
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
567
|
-
"""
|
568
|
-
Internal decorator to support Fast bakery
|
569
|
-
"""
|
570
|
-
...
|
571
|
-
|
572
|
-
@typing.overload
|
573
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
574
|
-
...
|
575
|
-
|
576
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
577
|
-
"""
|
578
|
-
Internal decorator to support Fast bakery
|
421
|
+
type : str, default 'default'
|
422
|
+
Card type.
|
423
|
+
id : str, optional, default None
|
424
|
+
If multiple cards are present, use this id to identify this card.
|
425
|
+
options : Dict[str, Any], default {}
|
426
|
+
Options passed to the card. The contents depend on the card type.
|
427
|
+
timeout : int, default 45
|
428
|
+
Interrupt reporting if it takes more than this many seconds.
|
579
429
|
"""
|
580
430
|
...
|
581
431
|
|
@@ -658,312 +508,468 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
658
508
|
"""
|
659
509
|
...
|
660
510
|
|
661
|
-
|
511
|
+
@typing.overload
|
512
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
662
513
|
"""
|
663
|
-
Decorator
|
664
|
-
|
665
|
-
|
666
|
-
Parameters
|
667
|
-
----------
|
668
|
-
temp_dir_root : str, optional
|
669
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
670
|
-
|
671
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
672
|
-
The list of repos (models/datasets) to load.
|
673
|
-
|
674
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
675
|
-
|
676
|
-
- If repo (model/dataset) is not found in the datastore:
|
677
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
678
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
679
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
680
|
-
|
681
|
-
- If repo is found in the datastore:
|
682
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
514
|
+
Decorator prototype for all step decorators. This function gets specialized
|
515
|
+
and imported for all decorators types by _import_plugin_decorators().
|
683
516
|
"""
|
684
517
|
...
|
685
518
|
|
686
519
|
@typing.overload
|
687
|
-
def
|
520
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
521
|
+
...
|
522
|
+
|
523
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
688
524
|
"""
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
525
|
+
Decorator prototype for all step decorators. This function gets specialized
|
526
|
+
and imported for all decorators types by _import_plugin_decorators().
|
527
|
+
"""
|
528
|
+
...
|
529
|
+
|
530
|
+
@typing.overload
|
531
|
+
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]]]:
|
532
|
+
"""
|
533
|
+
Specifies the Conda environment for the step.
|
696
534
|
|
697
|
-
|
698
|
-
|
535
|
+
Information in this decorator will augment any
|
536
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
537
|
+
you can use `@conda_base` to set packages required by all
|
538
|
+
steps and use `@conda` to specify step-specific overrides.
|
699
539
|
|
700
540
|
|
701
541
|
Parameters
|
702
542
|
----------
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
543
|
+
packages : Dict[str, str], default {}
|
544
|
+
Packages to use for this step. The key is the name of the package
|
545
|
+
and the value is the version to use.
|
546
|
+
libraries : Dict[str, str], default {}
|
547
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
548
|
+
python : str, optional, default None
|
549
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
550
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
551
|
+
disabled : bool, default False
|
552
|
+
If set to True, disables @conda.
|
709
553
|
"""
|
710
554
|
...
|
711
555
|
|
712
556
|
@typing.overload
|
713
|
-
def
|
557
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
714
558
|
...
|
715
559
|
|
716
560
|
@typing.overload
|
717
|
-
def
|
561
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
718
562
|
...
|
719
563
|
|
720
|
-
def
|
564
|
+
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):
|
721
565
|
"""
|
722
|
-
Specifies
|
566
|
+
Specifies the Conda environment for the step.
|
723
567
|
|
724
|
-
|
568
|
+
Information in this decorator will augment any
|
569
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
570
|
+
you can use `@conda_base` to set packages required by all
|
571
|
+
steps and use `@conda` to specify step-specific overrides.
|
725
572
|
|
726
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
727
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
728
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
729
573
|
|
730
|
-
|
731
|
-
|
574
|
+
Parameters
|
575
|
+
----------
|
576
|
+
packages : Dict[str, str], default {}
|
577
|
+
Packages to use for this step. The key is the name of the package
|
578
|
+
and the value is the version to use.
|
579
|
+
libraries : Dict[str, str], default {}
|
580
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
581
|
+
python : str, optional, default None
|
582
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
583
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
584
|
+
disabled : bool, default False
|
585
|
+
If set to True, disables @conda.
|
586
|
+
"""
|
587
|
+
...
|
588
|
+
|
589
|
+
@typing.overload
|
590
|
+
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]]]:
|
591
|
+
"""
|
592
|
+
Specifies that the step will success under all circumstances.
|
593
|
+
|
594
|
+
The decorator will create an optional artifact, specified by `var`, which
|
595
|
+
contains the exception raised. You can use it to detect the presence
|
596
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
597
|
+
are missing.
|
732
598
|
|
733
599
|
|
734
600
|
Parameters
|
735
601
|
----------
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
602
|
+
var : str, optional, default None
|
603
|
+
Name of the artifact in which to store the caught exception.
|
604
|
+
If not specified, the exception is not stored.
|
605
|
+
print_exception : bool, default True
|
606
|
+
Determines whether or not the exception is printed to
|
607
|
+
stdout when caught.
|
742
608
|
"""
|
743
609
|
...
|
744
610
|
|
745
611
|
@typing.overload
|
746
|
-
def
|
612
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
613
|
+
...
|
614
|
+
|
615
|
+
@typing.overload
|
616
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
617
|
+
...
|
618
|
+
|
619
|
+
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):
|
747
620
|
"""
|
748
|
-
|
621
|
+
Specifies that the step will success under all circumstances.
|
749
622
|
|
750
|
-
|
623
|
+
The decorator will create an optional artifact, specified by `var`, which
|
624
|
+
contains the exception raised. You can use it to detect the presence
|
625
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
626
|
+
are missing.
|
751
627
|
|
752
628
|
|
753
629
|
Parameters
|
754
630
|
----------
|
755
|
-
|
756
|
-
|
757
|
-
|
758
|
-
|
759
|
-
|
760
|
-
|
761
|
-
|
762
|
-
|
631
|
+
var : str, optional, default None
|
632
|
+
Name of the artifact in which to store the caught exception.
|
633
|
+
If not specified, the exception is not stored.
|
634
|
+
print_exception : bool, default True
|
635
|
+
Determines whether or not the exception is printed to
|
636
|
+
stdout when caught.
|
637
|
+
"""
|
638
|
+
...
|
639
|
+
|
640
|
+
def nvct(*, gpu: int, gpu_type: 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]]]:
|
641
|
+
"""
|
642
|
+
Specifies that this step should execute on DGX cloud.
|
643
|
+
|
644
|
+
|
645
|
+
Parameters
|
646
|
+
----------
|
647
|
+
gpu : int
|
648
|
+
Number of GPUs to use.
|
649
|
+
gpu_type : str
|
650
|
+
Type of Nvidia GPU to use.
|
651
|
+
"""
|
652
|
+
...
|
653
|
+
|
654
|
+
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]]]:
|
655
|
+
"""
|
656
|
+
Specifies that this step should execute on DGX cloud.
|
657
|
+
|
658
|
+
|
659
|
+
Parameters
|
660
|
+
----------
|
661
|
+
gpu : int
|
662
|
+
Number of GPUs to use.
|
663
|
+
gpu_type : str
|
664
|
+
Type of Nvidia GPU to use.
|
665
|
+
queue_timeout : int
|
666
|
+
Time to keep the job in NVCF's queue.
|
763
667
|
"""
|
764
668
|
...
|
765
669
|
|
766
670
|
@typing.overload
|
767
|
-
def
|
671
|
+
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]]]:
|
672
|
+
"""
|
673
|
+
Specifies the PyPI packages for the step.
|
674
|
+
|
675
|
+
Information in this decorator will augment any
|
676
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
677
|
+
you can use `@pypi_base` to set packages required by all
|
678
|
+
steps and use `@pypi` to specify step-specific overrides.
|
679
|
+
|
680
|
+
|
681
|
+
Parameters
|
682
|
+
----------
|
683
|
+
packages : Dict[str, str], default: {}
|
684
|
+
Packages to use for this step. The key is the name of the package
|
685
|
+
and the value is the version to use.
|
686
|
+
python : str, optional, default: None
|
687
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
688
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
689
|
+
"""
|
768
690
|
...
|
769
691
|
|
770
692
|
@typing.overload
|
771
|
-
def
|
693
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
772
694
|
...
|
773
695
|
|
774
|
-
|
696
|
+
@typing.overload
|
697
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
698
|
+
...
|
699
|
+
|
700
|
+
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):
|
775
701
|
"""
|
776
|
-
|
702
|
+
Specifies the PyPI packages for the step.
|
777
703
|
|
778
|
-
|
704
|
+
Information in this decorator will augment any
|
705
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
706
|
+
you can use `@pypi_base` to set packages required by all
|
707
|
+
steps and use `@pypi` to specify step-specific overrides.
|
779
708
|
|
780
709
|
|
781
710
|
Parameters
|
782
711
|
----------
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
timeout : int, default 45
|
790
|
-
Interrupt reporting if it takes more than this many seconds.
|
712
|
+
packages : Dict[str, str], default: {}
|
713
|
+
Packages to use for this step. The key is the name of the package
|
714
|
+
and the value is the version to use.
|
715
|
+
python : str, optional, default: None
|
716
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
717
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
791
718
|
"""
|
792
719
|
...
|
793
720
|
|
794
721
|
@typing.overload
|
795
|
-
def
|
722
|
+
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]]]:
|
796
723
|
"""
|
797
|
-
|
724
|
+
Enables loading / saving of models within a step.
|
725
|
+
|
798
726
|
|
799
727
|
|
800
728
|
Parameters
|
801
729
|
----------
|
802
|
-
|
803
|
-
|
730
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
731
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
732
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
733
|
+
- `current.checkpoint`
|
734
|
+
- `current.model`
|
735
|
+
- `current.huggingface_hub`
|
736
|
+
|
737
|
+
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
|
738
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
739
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
740
|
+
|
741
|
+
temp_dir_root : str, default: None
|
742
|
+
The root directory under which `current.model.loaded` will store loaded models
|
804
743
|
"""
|
805
744
|
...
|
806
745
|
|
807
746
|
@typing.overload
|
808
|
-
def
|
747
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
809
748
|
...
|
810
749
|
|
811
750
|
@typing.overload
|
812
|
-
def
|
751
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
813
752
|
...
|
814
753
|
|
815
|
-
def
|
754
|
+
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):
|
816
755
|
"""
|
817
|
-
|
756
|
+
Enables loading / saving of models within a step.
|
757
|
+
|
818
758
|
|
819
759
|
|
820
760
|
Parameters
|
821
761
|
----------
|
822
|
-
|
823
|
-
|
762
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
763
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
764
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
765
|
+
- `current.checkpoint`
|
766
|
+
- `current.model`
|
767
|
+
- `current.huggingface_hub`
|
768
|
+
|
769
|
+
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
|
770
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
771
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
772
|
+
|
773
|
+
temp_dir_root : str, default: None
|
774
|
+
The root directory under which `current.model.loaded` will store loaded models
|
824
775
|
"""
|
825
776
|
...
|
826
777
|
|
827
|
-
def
|
778
|
+
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]]]:
|
828
779
|
"""
|
829
|
-
|
780
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
830
781
|
|
831
782
|
|
832
783
|
Parameters
|
833
784
|
----------
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
785
|
+
temp_dir_root : str, optional
|
786
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
787
|
+
|
788
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
789
|
+
The list of repos (models/datasets) to load.
|
790
|
+
|
791
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
792
|
+
|
793
|
+
- If repo (model/dataset) is not found in the datastore:
|
794
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
795
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
796
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
797
|
+
|
798
|
+
- If repo is found in the datastore:
|
799
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
840
800
|
"""
|
841
801
|
...
|
842
802
|
|
843
|
-
def
|
803
|
+
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]]]:
|
844
804
|
"""
|
845
|
-
Specifies that this step should execute on
|
805
|
+
Specifies that this step should execute on Kubernetes.
|
846
806
|
|
847
807
|
|
848
808
|
Parameters
|
849
809
|
----------
|
850
|
-
|
851
|
-
Number of
|
852
|
-
|
853
|
-
|
810
|
+
cpu : int, default 1
|
811
|
+
Number of CPUs required for this step. If `@resources` is
|
812
|
+
also present, the maximum value from all decorators is used.
|
813
|
+
memory : int, default 4096
|
814
|
+
Memory size (in MB) required for this step. If
|
815
|
+
`@resources` is also present, the maximum value from all decorators is
|
816
|
+
used.
|
817
|
+
disk : int, default 10240
|
818
|
+
Disk size (in MB) required for this step. If
|
819
|
+
`@resources` is also present, the maximum value from all decorators is
|
820
|
+
used.
|
821
|
+
image : str, optional, default None
|
822
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
823
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
824
|
+
not, a default Docker image mapping to the current version of Python is used.
|
825
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
826
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
827
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
828
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
829
|
+
secrets : List[str], optional, default None
|
830
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
831
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
832
|
+
in Metaflow configuration.
|
833
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
834
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
835
|
+
Can be passed in as a comma separated string of values e.g.
|
836
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
837
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
838
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
839
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
840
|
+
gpu : int, optional, default None
|
841
|
+
Number of GPUs required for this step. A value of zero implies that
|
842
|
+
the scheduled node should not have GPUs.
|
843
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
844
|
+
The vendor of the GPUs to be used for this step.
|
845
|
+
tolerations : List[str], default []
|
846
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
847
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
848
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
849
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
850
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
851
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
852
|
+
use_tmpfs : bool, default False
|
853
|
+
This enables an explicit tmpfs mount for this step.
|
854
|
+
tmpfs_tempdir : bool, default True
|
855
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
856
|
+
tmpfs_size : int, optional, default: None
|
857
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
858
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
859
|
+
memory allocated for this step.
|
860
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
861
|
+
Path to tmpfs mount for this step.
|
862
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
863
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
864
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
865
|
+
shared_memory: int, optional
|
866
|
+
Shared memory size (in MiB) required for this step
|
867
|
+
port: int, optional
|
868
|
+
Port number to specify in the Kubernetes job object
|
869
|
+
compute_pool : str, optional, default None
|
870
|
+
Compute pool to be used for for this step.
|
871
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
872
|
+
hostname_resolution_timeout: int, default 10 * 60
|
873
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
874
|
+
Only applicable when @parallel is used.
|
875
|
+
qos: str, default: Burstable
|
876
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
877
|
+
|
878
|
+
security_context: Dict[str, Any], optional, default None
|
879
|
+
Container security context. Applies to the task container. Allows the following keys:
|
880
|
+
- privileged: bool, optional, default None
|
881
|
+
- allow_privilege_escalation: bool, optional, default None
|
882
|
+
- run_as_user: int, optional, default None
|
883
|
+
- run_as_group: int, optional, default None
|
884
|
+
- run_as_non_root: bool, optional, default None
|
854
885
|
"""
|
855
886
|
...
|
856
887
|
|
857
888
|
@typing.overload
|
858
|
-
def
|
889
|
+
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]]]:
|
859
890
|
"""
|
860
|
-
Specifies
|
861
|
-
|
891
|
+
Specifies the number of times the task corresponding
|
892
|
+
to a step needs to be retried.
|
893
|
+
|
894
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
895
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
896
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
897
|
+
|
898
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
899
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
900
|
+
ensuring that the flow execution can continue.
|
862
901
|
|
863
902
|
|
864
903
|
Parameters
|
865
904
|
----------
|
866
|
-
|
867
|
-
|
905
|
+
times : int, default 3
|
906
|
+
Number of times to retry this task.
|
907
|
+
minutes_between_retries : int, default 2
|
908
|
+
Number of minutes between retries.
|
868
909
|
"""
|
869
910
|
...
|
870
911
|
|
871
912
|
@typing.overload
|
872
|
-
def
|
913
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
873
914
|
...
|
874
915
|
|
875
916
|
@typing.overload
|
876
|
-
def
|
917
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
877
918
|
...
|
878
919
|
|
879
|
-
def
|
920
|
+
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):
|
880
921
|
"""
|
881
|
-
Specifies
|
882
|
-
|
922
|
+
Specifies the number of times the task corresponding
|
923
|
+
to a step needs to be retried.
|
924
|
+
|
925
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
926
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
927
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
928
|
+
|
929
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
930
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
931
|
+
ensuring that the flow execution can continue.
|
883
932
|
|
884
933
|
|
885
934
|
Parameters
|
886
935
|
----------
|
887
|
-
|
888
|
-
|
936
|
+
times : int, default 3
|
937
|
+
Number of times to retry this task.
|
938
|
+
minutes_between_retries : int, default 2
|
939
|
+
Number of minutes between retries.
|
889
940
|
"""
|
890
941
|
...
|
891
942
|
|
892
943
|
@typing.overload
|
893
|
-
def
|
944
|
+
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]]]:
|
894
945
|
"""
|
895
|
-
Specifies
|
896
|
-
|
897
|
-
Information in this decorator will augment any
|
898
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
899
|
-
you can use `@conda_base` to set packages required by all
|
900
|
-
steps and use `@conda` to specify step-specific overrides.
|
946
|
+
Specifies environment variables to be set prior to the execution of a step.
|
901
947
|
|
902
948
|
|
903
949
|
Parameters
|
904
950
|
----------
|
905
|
-
|
906
|
-
|
907
|
-
and the value is the version to use.
|
908
|
-
libraries : Dict[str, str], default {}
|
909
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
910
|
-
python : str, optional, default None
|
911
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
912
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
913
|
-
disabled : bool, default False
|
914
|
-
If set to True, disables @conda.
|
951
|
+
vars : Dict[str, str], default {}
|
952
|
+
Dictionary of environment variables to set.
|
915
953
|
"""
|
916
954
|
...
|
917
955
|
|
918
956
|
@typing.overload
|
919
|
-
def
|
957
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
920
958
|
...
|
921
959
|
|
922
960
|
@typing.overload
|
923
|
-
def
|
961
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
924
962
|
...
|
925
963
|
|
926
|
-
def
|
964
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
927
965
|
"""
|
928
|
-
Specifies
|
929
|
-
|
930
|
-
Information in this decorator will augment any
|
931
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
932
|
-
you can use `@conda_base` to set packages required by all
|
933
|
-
steps and use `@conda` to specify step-specific overrides.
|
966
|
+
Specifies environment variables to be set prior to the execution of a step.
|
934
967
|
|
935
968
|
|
936
969
|
Parameters
|
937
970
|
----------
|
938
|
-
|
939
|
-
|
940
|
-
and the value is the version to use.
|
941
|
-
libraries : Dict[str, str], default {}
|
942
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
943
|
-
python : str, optional, default None
|
944
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
945
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
946
|
-
disabled : bool, default False
|
947
|
-
If set to True, disables @conda.
|
948
|
-
"""
|
949
|
-
...
|
950
|
-
|
951
|
-
@typing.overload
|
952
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
953
|
-
"""
|
954
|
-
Decorator prototype for all step decorators. This function gets specialized
|
955
|
-
and imported for all decorators types by _import_plugin_decorators().
|
956
|
-
"""
|
957
|
-
...
|
958
|
-
|
959
|
-
@typing.overload
|
960
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
961
|
-
...
|
962
|
-
|
963
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
964
|
-
"""
|
965
|
-
Decorator prototype for all step decorators. This function gets specialized
|
966
|
-
and imported for all decorators types by _import_plugin_decorators().
|
971
|
+
vars : Dict[str, str], default {}
|
972
|
+
Dictionary of environment variables to set.
|
967
973
|
"""
|
968
974
|
...
|
969
975
|
|
@@ -1161,6 +1167,184 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1161
1167
|
"""
|
1162
1168
|
...
|
1163
1169
|
|
1170
|
+
@typing.overload
|
1171
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1172
|
+
"""
|
1173
|
+
Specifies the PyPI packages for all steps of the flow.
|
1174
|
+
|
1175
|
+
Use `@pypi_base` to set common packages required by all
|
1176
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1177
|
+
|
1178
|
+
Parameters
|
1179
|
+
----------
|
1180
|
+
packages : Dict[str, str], default: {}
|
1181
|
+
Packages to use for this flow. The key is the name of the package
|
1182
|
+
and the value is the version to use.
|
1183
|
+
python : str, optional, default: None
|
1184
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1185
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1186
|
+
"""
|
1187
|
+
...
|
1188
|
+
|
1189
|
+
@typing.overload
|
1190
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1191
|
+
...
|
1192
|
+
|
1193
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1194
|
+
"""
|
1195
|
+
Specifies the PyPI packages for all steps of the flow.
|
1196
|
+
|
1197
|
+
Use `@pypi_base` to set common packages required by all
|
1198
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1199
|
+
|
1200
|
+
Parameters
|
1201
|
+
----------
|
1202
|
+
packages : Dict[str, str], default: {}
|
1203
|
+
Packages to use for this flow. The key is the name of the package
|
1204
|
+
and the value is the version to use.
|
1205
|
+
python : str, optional, default: None
|
1206
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1207
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1208
|
+
"""
|
1209
|
+
...
|
1210
|
+
|
1211
|
+
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]]:
|
1212
|
+
"""
|
1213
|
+
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.
|
1214
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1215
|
+
|
1216
|
+
|
1217
|
+
Parameters
|
1218
|
+
----------
|
1219
|
+
timeout : int
|
1220
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1221
|
+
poke_interval : int
|
1222
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1223
|
+
mode : str
|
1224
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1225
|
+
exponential_backoff : bool
|
1226
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1227
|
+
pool : str
|
1228
|
+
the slot pool this task should run in,
|
1229
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1230
|
+
soft_fail : bool
|
1231
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1232
|
+
name : str
|
1233
|
+
Name of the sensor on Airflow
|
1234
|
+
description : str
|
1235
|
+
Description of sensor in the Airflow UI
|
1236
|
+
external_dag_id : str
|
1237
|
+
The dag_id that contains the task you want to wait for.
|
1238
|
+
external_task_ids : List[str]
|
1239
|
+
The list of task_ids that you want to wait for.
|
1240
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1241
|
+
allowed_states : List[str]
|
1242
|
+
Iterable of allowed states, (Default: ['success'])
|
1243
|
+
failed_states : List[str]
|
1244
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1245
|
+
execution_delta : datetime.timedelta
|
1246
|
+
time difference with the previous execution to look at,
|
1247
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1248
|
+
check_existence: bool
|
1249
|
+
Set to True to check if the external task exists or check if
|
1250
|
+
the DAG to wait for exists. (Default: True)
|
1251
|
+
"""
|
1252
|
+
...
|
1253
|
+
|
1254
|
+
@typing.overload
|
1255
|
+
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]]:
|
1256
|
+
"""
|
1257
|
+
Specifies the Conda environment for all steps of the flow.
|
1258
|
+
|
1259
|
+
Use `@conda_base` to set common libraries required by all
|
1260
|
+
steps and use `@conda` to specify step-specific additions.
|
1261
|
+
|
1262
|
+
|
1263
|
+
Parameters
|
1264
|
+
----------
|
1265
|
+
packages : Dict[str, str], default {}
|
1266
|
+
Packages to use for this flow. The key is the name of the package
|
1267
|
+
and the value is the version to use.
|
1268
|
+
libraries : Dict[str, str], default {}
|
1269
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1270
|
+
python : str, optional, default None
|
1271
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1272
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1273
|
+
disabled : bool, default False
|
1274
|
+
If set to True, disables Conda.
|
1275
|
+
"""
|
1276
|
+
...
|
1277
|
+
|
1278
|
+
@typing.overload
|
1279
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1280
|
+
...
|
1281
|
+
|
1282
|
+
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):
|
1283
|
+
"""
|
1284
|
+
Specifies the Conda environment for all steps of the flow.
|
1285
|
+
|
1286
|
+
Use `@conda_base` to set common libraries required by all
|
1287
|
+
steps and use `@conda` to specify step-specific additions.
|
1288
|
+
|
1289
|
+
|
1290
|
+
Parameters
|
1291
|
+
----------
|
1292
|
+
packages : Dict[str, str], default {}
|
1293
|
+
Packages to use for this flow. The key is the name of the package
|
1294
|
+
and the value is the version to use.
|
1295
|
+
libraries : Dict[str, str], default {}
|
1296
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1297
|
+
python : str, optional, default None
|
1298
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1299
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1300
|
+
disabled : bool, default False
|
1301
|
+
If set to True, disables Conda.
|
1302
|
+
"""
|
1303
|
+
...
|
1304
|
+
|
1305
|
+
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]]:
|
1306
|
+
"""
|
1307
|
+
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)
|
1308
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1309
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1310
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1311
|
+
starts only after all sensors finish.
|
1312
|
+
|
1313
|
+
|
1314
|
+
Parameters
|
1315
|
+
----------
|
1316
|
+
timeout : int
|
1317
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1318
|
+
poke_interval : int
|
1319
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1320
|
+
mode : str
|
1321
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1322
|
+
exponential_backoff : bool
|
1323
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1324
|
+
pool : str
|
1325
|
+
the slot pool this task should run in,
|
1326
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1327
|
+
soft_fail : bool
|
1328
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1329
|
+
name : str
|
1330
|
+
Name of the sensor on Airflow
|
1331
|
+
description : str
|
1332
|
+
Description of sensor in the Airflow UI
|
1333
|
+
bucket_key : Union[str, List[str]]
|
1334
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1335
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1336
|
+
bucket_name : str
|
1337
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1338
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1339
|
+
wildcard_match : bool
|
1340
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1341
|
+
aws_conn_id : str
|
1342
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1343
|
+
verify : bool
|
1344
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1345
|
+
"""
|
1346
|
+
...
|
1347
|
+
|
1164
1348
|
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
1165
1349
|
"""
|
1166
1350
|
Allows setting external datastores to save data for the
|
@@ -1275,54 +1459,38 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1275
1459
|
"""
|
1276
1460
|
...
|
1277
1461
|
|
1278
|
-
|
1279
|
-
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]]:
|
1462
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1280
1463
|
"""
|
1281
|
-
Specifies
|
1464
|
+
Specifies what flows belong to the same project.
|
1282
1465
|
|
1283
|
-
|
1284
|
-
|
1466
|
+
A project-specific namespace is created for all flows that
|
1467
|
+
use the same `@project(name)`.
|
1285
1468
|
|
1286
1469
|
|
1287
1470
|
Parameters
|
1288
1471
|
----------
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1294
|
-
python : str, optional, default None
|
1295
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1296
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1297
|
-
disabled : bool, default False
|
1298
|
-
If set to True, disables Conda.
|
1299
|
-
"""
|
1300
|
-
...
|
1301
|
-
|
1302
|
-
@typing.overload
|
1303
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1304
|
-
...
|
1305
|
-
|
1306
|
-
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):
|
1307
|
-
"""
|
1308
|
-
Specifies the Conda environment for all steps of the flow.
|
1309
|
-
|
1310
|
-
Use `@conda_base` to set common libraries required by all
|
1311
|
-
steps and use `@conda` to specify step-specific additions.
|
1472
|
+
name : str
|
1473
|
+
Project name. Make sure that the name is unique amongst all
|
1474
|
+
projects that use the same production scheduler. The name may
|
1475
|
+
contain only lowercase alphanumeric characters and underscores.
|
1312
1476
|
|
1477
|
+
branch : Optional[str], default None
|
1478
|
+
The branch to use. If not specified, the branch is set to
|
1479
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1480
|
+
also be set on the command line using `--branch` as a top-level option.
|
1481
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1313
1482
|
|
1314
|
-
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1324
|
-
|
1325
|
-
If set to True, disables Conda.
|
1483
|
+
production : bool, default False
|
1484
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1485
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1486
|
+
`production` in the decorator and on the command line.
|
1487
|
+
The project branch name will be:
|
1488
|
+
- if `branch` is specified:
|
1489
|
+
- if `production` is True: `prod.<branch>`
|
1490
|
+
- if `production` is False: `test.<branch>`
|
1491
|
+
- if `branch` is not specified:
|
1492
|
+
- if `production` is True: `prod`
|
1493
|
+
- if `production` is False: `user.<username>`
|
1326
1494
|
"""
|
1327
1495
|
...
|
1328
1496
|
|
@@ -1377,167 +1545,5 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1377
1545
|
"""
|
1378
1546
|
...
|
1379
1547
|
|
1380
|
-
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]]:
|
1381
|
-
"""
|
1382
|
-
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)
|
1383
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1384
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1385
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1386
|
-
starts only after all sensors finish.
|
1387
|
-
|
1388
|
-
|
1389
|
-
Parameters
|
1390
|
-
----------
|
1391
|
-
timeout : int
|
1392
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1393
|
-
poke_interval : int
|
1394
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1395
|
-
mode : str
|
1396
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1397
|
-
exponential_backoff : bool
|
1398
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1399
|
-
pool : str
|
1400
|
-
the slot pool this task should run in,
|
1401
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1402
|
-
soft_fail : bool
|
1403
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1404
|
-
name : str
|
1405
|
-
Name of the sensor on Airflow
|
1406
|
-
description : str
|
1407
|
-
Description of sensor in the Airflow UI
|
1408
|
-
bucket_key : Union[str, List[str]]
|
1409
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1410
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1411
|
-
bucket_name : str
|
1412
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1413
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1414
|
-
wildcard_match : bool
|
1415
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1416
|
-
aws_conn_id : str
|
1417
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1418
|
-
verify : bool
|
1419
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1420
|
-
"""
|
1421
|
-
...
|
1422
|
-
|
1423
|
-
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]]:
|
1424
|
-
"""
|
1425
|
-
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.
|
1426
|
-
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1427
|
-
|
1428
|
-
|
1429
|
-
Parameters
|
1430
|
-
----------
|
1431
|
-
timeout : int
|
1432
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1433
|
-
poke_interval : int
|
1434
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1435
|
-
mode : str
|
1436
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1437
|
-
exponential_backoff : bool
|
1438
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1439
|
-
pool : str
|
1440
|
-
the slot pool this task should run in,
|
1441
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1442
|
-
soft_fail : bool
|
1443
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1444
|
-
name : str
|
1445
|
-
Name of the sensor on Airflow
|
1446
|
-
description : str
|
1447
|
-
Description of sensor in the Airflow UI
|
1448
|
-
external_dag_id : str
|
1449
|
-
The dag_id that contains the task you want to wait for.
|
1450
|
-
external_task_ids : List[str]
|
1451
|
-
The list of task_ids that you want to wait for.
|
1452
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1453
|
-
allowed_states : List[str]
|
1454
|
-
Iterable of allowed states, (Default: ['success'])
|
1455
|
-
failed_states : List[str]
|
1456
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1457
|
-
execution_delta : datetime.timedelta
|
1458
|
-
time difference with the previous execution to look at,
|
1459
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1460
|
-
check_existence: bool
|
1461
|
-
Set to True to check if the external task exists or check if
|
1462
|
-
the DAG to wait for exists. (Default: True)
|
1463
|
-
"""
|
1464
|
-
...
|
1465
|
-
|
1466
|
-
@typing.overload
|
1467
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1468
|
-
"""
|
1469
|
-
Specifies the PyPI packages for all steps of the flow.
|
1470
|
-
|
1471
|
-
Use `@pypi_base` to set common packages required by all
|
1472
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1473
|
-
|
1474
|
-
Parameters
|
1475
|
-
----------
|
1476
|
-
packages : Dict[str, str], default: {}
|
1477
|
-
Packages to use for this flow. The key is the name of the package
|
1478
|
-
and the value is the version to use.
|
1479
|
-
python : str, optional, default: None
|
1480
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1481
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1482
|
-
"""
|
1483
|
-
...
|
1484
|
-
|
1485
|
-
@typing.overload
|
1486
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1487
|
-
...
|
1488
|
-
|
1489
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1490
|
-
"""
|
1491
|
-
Specifies the PyPI packages for all steps of the flow.
|
1492
|
-
|
1493
|
-
Use `@pypi_base` to set common packages required by all
|
1494
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1495
|
-
|
1496
|
-
Parameters
|
1497
|
-
----------
|
1498
|
-
packages : Dict[str, str], default: {}
|
1499
|
-
Packages to use for this flow. The key is the name of the package
|
1500
|
-
and the value is the version to use.
|
1501
|
-
python : str, optional, default: None
|
1502
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1503
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1504
|
-
"""
|
1505
|
-
...
|
1506
|
-
|
1507
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1508
|
-
"""
|
1509
|
-
Specifies what flows belong to the same project.
|
1510
|
-
|
1511
|
-
A project-specific namespace is created for all flows that
|
1512
|
-
use the same `@project(name)`.
|
1513
|
-
|
1514
|
-
|
1515
|
-
Parameters
|
1516
|
-
----------
|
1517
|
-
name : str
|
1518
|
-
Project name. Make sure that the name is unique amongst all
|
1519
|
-
projects that use the same production scheduler. The name may
|
1520
|
-
contain only lowercase alphanumeric characters and underscores.
|
1521
|
-
|
1522
|
-
branch : Optional[str], default None
|
1523
|
-
The branch to use. If not specified, the branch is set to
|
1524
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1525
|
-
also be set on the command line using `--branch` as a top-level option.
|
1526
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1527
|
-
|
1528
|
-
production : bool, default False
|
1529
|
-
Whether or not the branch is the production branch. This can also be set on the
|
1530
|
-
command line using `--production` as a top-level option. It is an error to specify
|
1531
|
-
`production` in the decorator and on the command line.
|
1532
|
-
The project branch name will be:
|
1533
|
-
- if `branch` is specified:
|
1534
|
-
- if `production` is True: `prod.<branch>`
|
1535
|
-
- if `production` is False: `test.<branch>`
|
1536
|
-
- if `branch` is not specified:
|
1537
|
-
- if `production` is True: `prod`
|
1538
|
-
- if `production` is False: `user.<username>`
|
1539
|
-
"""
|
1540
|
-
...
|
1541
|
-
|
1542
1548
|
pkg_name: str
|
1543
1549
|
|