ob-metaflow-stubs 6.0.3.180rc1__py2.py3-none-any.whl → 6.0.3.180rc3__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 +690 -690
- 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 +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- 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 +75 -75
- 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 +1 -1
- 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 +3 -3
- 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 +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +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 +2 -2
- 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 +2 -2
- 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/aws/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.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 +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/ob_internal.pyi +1 -1
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +11 -11
- 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 +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +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 +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_client.pyi +1 -1
- 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 +3 -3
- 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 +1 -1
- 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 +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +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 +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
- 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 +30 -30
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.180rc1.dist-info → ob_metaflow_stubs-6.0.3.180rc3.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.180rc3.dist-info/RECORD +220 -0
- ob_metaflow_stubs-6.0.3.180rc1.dist-info/RECORD +0 -220
- {ob_metaflow_stubs-6.0.3.180rc1.dist-info → ob_metaflow_stubs-6.0.3.180rc3.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.180rc1.dist-info → ob_metaflow_stubs-6.0.3.180rc3.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.17.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-06-
|
4
|
+
# Generated on 2025-06-17T10:52:54.470733 #
|
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 tuple_util as tuple_util
|
39
40
|
from . import metaflow_git as metaflow_git
|
40
41
|
from . import events as events
|
41
|
-
from . import tuple_util as tuple_util
|
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 conda_environment_yml_parser as conda_environment_yml_parser
|
47
48
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
48
49
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
49
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_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
|
@@ -155,23 +155,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
155
155
|
"""
|
156
156
|
...
|
157
157
|
|
158
|
-
@typing.overload
|
159
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
160
|
-
"""
|
161
|
-
Internal decorator to support Fast bakery
|
162
|
-
"""
|
163
|
-
...
|
164
|
-
|
165
|
-
@typing.overload
|
166
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
167
|
-
...
|
168
|
-
|
169
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
170
|
-
"""
|
171
|
-
Internal decorator to support Fast bakery
|
172
|
-
"""
|
173
|
-
...
|
174
|
-
|
175
158
|
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]]]:
|
176
159
|
"""
|
177
160
|
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
@@ -216,61 +199,110 @@ def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy:
|
|
216
199
|
...
|
217
200
|
|
218
201
|
@typing.overload
|
219
|
-
def
|
202
|
+
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]]]:
|
220
203
|
"""
|
221
|
-
Specifies the
|
204
|
+
Specifies that the step will success under all circumstances.
|
222
205
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
206
|
+
The decorator will create an optional artifact, specified by `var`, which
|
207
|
+
contains the exception raised. You can use it to detect the presence
|
208
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
209
|
+
are missing.
|
227
210
|
|
228
211
|
|
229
212
|
Parameters
|
230
213
|
----------
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
238
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
239
|
-
disabled : bool, default False
|
240
|
-
If set to True, disables @conda.
|
214
|
+
var : str, optional, default None
|
215
|
+
Name of the artifact in which to store the caught exception.
|
216
|
+
If not specified, the exception is not stored.
|
217
|
+
print_exception : bool, default True
|
218
|
+
Determines whether or not the exception is printed to
|
219
|
+
stdout when caught.
|
241
220
|
"""
|
242
221
|
...
|
243
222
|
|
244
223
|
@typing.overload
|
245
|
-
def
|
224
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
246
225
|
...
|
247
226
|
|
248
227
|
@typing.overload
|
249
|
-
def
|
228
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
250
229
|
...
|
251
230
|
|
252
|
-
def
|
231
|
+
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):
|
253
232
|
"""
|
254
|
-
Specifies the
|
233
|
+
Specifies that the step will success under all circumstances.
|
255
234
|
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
235
|
+
The decorator will create an optional artifact, specified by `var`, which
|
236
|
+
contains the exception raised. You can use it to detect the presence
|
237
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
238
|
+
are missing.
|
260
239
|
|
261
240
|
|
262
241
|
Parameters
|
263
242
|
----------
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
|
273
|
-
|
243
|
+
var : str, optional, default None
|
244
|
+
Name of the artifact in which to store the caught exception.
|
245
|
+
If not specified, the exception is not stored.
|
246
|
+
print_exception : bool, default True
|
247
|
+
Determines whether or not the exception is printed to
|
248
|
+
stdout when caught.
|
249
|
+
"""
|
250
|
+
...
|
251
|
+
|
252
|
+
@typing.overload
|
253
|
+
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]]]:
|
254
|
+
"""
|
255
|
+
Enables loading / saving of models within a step.
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
Parameters
|
260
|
+
----------
|
261
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
262
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
263
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
264
|
+
- `current.checkpoint`
|
265
|
+
- `current.model`
|
266
|
+
- `current.huggingface_hub`
|
267
|
+
|
268
|
+
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
|
269
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
270
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
271
|
+
|
272
|
+
temp_dir_root : str, default: None
|
273
|
+
The root directory under which `current.model.loaded` will store loaded models
|
274
|
+
"""
|
275
|
+
...
|
276
|
+
|
277
|
+
@typing.overload
|
278
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
279
|
+
...
|
280
|
+
|
281
|
+
@typing.overload
|
282
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
283
|
+
...
|
284
|
+
|
285
|
+
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):
|
286
|
+
"""
|
287
|
+
Enables loading / saving of models within a step.
|
288
|
+
|
289
|
+
|
290
|
+
|
291
|
+
Parameters
|
292
|
+
----------
|
293
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
294
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
295
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
296
|
+
- `current.checkpoint`
|
297
|
+
- `current.model`
|
298
|
+
- `current.huggingface_hub`
|
299
|
+
|
300
|
+
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
|
301
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
302
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
303
|
+
|
304
|
+
temp_dir_root : str, default: None
|
305
|
+
The root directory under which `current.model.loaded` will store loaded models
|
274
306
|
"""
|
275
307
|
...
|
276
308
|
|
@@ -308,167 +340,112 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
|
|
308
340
|
...
|
309
341
|
|
310
342
|
@typing.overload
|
311
|
-
def
|
343
|
+
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]]]:
|
312
344
|
"""
|
313
|
-
Specifies
|
314
|
-
|
345
|
+
Specifies the PyPI packages for the step.
|
346
|
+
|
347
|
+
Information in this decorator will augment any
|
348
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
349
|
+
you can use `@pypi_base` to set packages required by all
|
350
|
+
steps and use `@pypi` to specify step-specific overrides.
|
315
351
|
|
316
352
|
|
317
353
|
Parameters
|
318
354
|
----------
|
319
|
-
|
320
|
-
|
355
|
+
packages : Dict[str, str], default: {}
|
356
|
+
Packages to use for this step. The key is the name of the package
|
357
|
+
and the value is the version to use.
|
358
|
+
python : str, optional, default: None
|
359
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
360
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
321
361
|
"""
|
322
362
|
...
|
323
363
|
|
324
364
|
@typing.overload
|
325
|
-
def
|
365
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
326
366
|
...
|
327
367
|
|
328
368
|
@typing.overload
|
329
|
-
def
|
369
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
330
370
|
...
|
331
371
|
|
332
|
-
def
|
372
|
+
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):
|
333
373
|
"""
|
334
|
-
Specifies
|
335
|
-
|
374
|
+
Specifies the PyPI packages for the step.
|
375
|
+
|
376
|
+
Information in this decorator will augment any
|
377
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
378
|
+
you can use `@pypi_base` to set packages required by all
|
379
|
+
steps and use `@pypi` to specify step-specific overrides.
|
336
380
|
|
337
381
|
|
338
382
|
Parameters
|
339
383
|
----------
|
340
|
-
|
341
|
-
|
384
|
+
packages : Dict[str, str], default: {}
|
385
|
+
Packages to use for this step. The key is the name of the package
|
386
|
+
and the value is the version to use.
|
387
|
+
python : str, optional, default: None
|
388
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
389
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
342
390
|
"""
|
343
391
|
...
|
344
392
|
|
345
393
|
@typing.overload
|
346
|
-
def
|
394
|
+
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]]]:
|
347
395
|
"""
|
348
|
-
Specifies
|
396
|
+
Specifies a timeout for your step.
|
349
397
|
|
350
|
-
|
351
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
398
|
+
This decorator is useful if this step may hang indefinitely.
|
352
399
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
python myflow.py run --with kubernetes
|
360
|
-
```
|
361
|
-
which executes the flow on the desired system using the
|
362
|
-
requirements specified in `@resources`.
|
400
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
401
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
402
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
403
|
+
|
404
|
+
Note that all the values specified in parameters are added together so if you specify
|
405
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
363
406
|
|
364
407
|
|
365
408
|
Parameters
|
366
409
|
----------
|
367
|
-
|
368
|
-
Number of
|
369
|
-
|
370
|
-
Number of
|
371
|
-
|
372
|
-
|
373
|
-
memory : int, default 4096
|
374
|
-
Memory size (in MB) required for this step.
|
375
|
-
shared_memory : int, optional, default None
|
376
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
377
|
-
This parameter maps to the `--shm-size` option in Docker.
|
410
|
+
seconds : int, default 0
|
411
|
+
Number of seconds to wait prior to timing out.
|
412
|
+
minutes : int, default 0
|
413
|
+
Number of minutes to wait prior to timing out.
|
414
|
+
hours : int, default 0
|
415
|
+
Number of hours to wait prior to timing out.
|
378
416
|
"""
|
379
417
|
...
|
380
418
|
|
381
419
|
@typing.overload
|
382
|
-
def
|
420
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
383
421
|
...
|
384
422
|
|
385
423
|
@typing.overload
|
386
|
-
def
|
424
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
387
425
|
...
|
388
426
|
|
389
|
-
def
|
427
|
+
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):
|
390
428
|
"""
|
391
|
-
Specifies
|
429
|
+
Specifies a timeout for your step.
|
392
430
|
|
393
|
-
|
394
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
431
|
+
This decorator is useful if this step may hang indefinitely.
|
395
432
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
python myflow.py run --with kubernetes
|
403
|
-
```
|
404
|
-
which executes the flow on the desired system using the
|
405
|
-
requirements specified in `@resources`.
|
433
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
434
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
435
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
436
|
+
|
437
|
+
Note that all the values specified in parameters are added together so if you specify
|
438
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
406
439
|
|
407
440
|
|
408
441
|
Parameters
|
409
442
|
----------
|
410
|
-
|
411
|
-
Number of
|
412
|
-
|
413
|
-
Number of
|
414
|
-
|
415
|
-
|
416
|
-
memory : int, default 4096
|
417
|
-
Memory size (in MB) required for this step.
|
418
|
-
shared_memory : int, optional, default None
|
419
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
420
|
-
This parameter maps to the `--shm-size` option in Docker.
|
421
|
-
"""
|
422
|
-
...
|
423
|
-
|
424
|
-
@typing.overload
|
425
|
-
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]]]:
|
426
|
-
"""
|
427
|
-
Specifies that the step will success under all circumstances.
|
428
|
-
|
429
|
-
The decorator will create an optional artifact, specified by `var`, which
|
430
|
-
contains the exception raised. You can use it to detect the presence
|
431
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
432
|
-
are missing.
|
433
|
-
|
434
|
-
|
435
|
-
Parameters
|
436
|
-
----------
|
437
|
-
var : str, optional, default None
|
438
|
-
Name of the artifact in which to store the caught exception.
|
439
|
-
If not specified, the exception is not stored.
|
440
|
-
print_exception : bool, default True
|
441
|
-
Determines whether or not the exception is printed to
|
442
|
-
stdout when caught.
|
443
|
-
"""
|
444
|
-
...
|
445
|
-
|
446
|
-
@typing.overload
|
447
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
448
|
-
...
|
449
|
-
|
450
|
-
@typing.overload
|
451
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
452
|
-
...
|
453
|
-
|
454
|
-
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):
|
455
|
-
"""
|
456
|
-
Specifies that the step will success under all circumstances.
|
457
|
-
|
458
|
-
The decorator will create an optional artifact, specified by `var`, which
|
459
|
-
contains the exception raised. You can use it to detect the presence
|
460
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
461
|
-
are missing.
|
462
|
-
|
463
|
-
|
464
|
-
Parameters
|
465
|
-
----------
|
466
|
-
var : str, optional, default None
|
467
|
-
Name of the artifact in which to store the caught exception.
|
468
|
-
If not specified, the exception is not stored.
|
469
|
-
print_exception : bool, default True
|
470
|
-
Determines whether or not the exception is printed to
|
471
|
-
stdout when caught.
|
443
|
+
seconds : int, default 0
|
444
|
+
Number of seconds to wait prior to timing out.
|
445
|
+
minutes : int, default 0
|
446
|
+
Number of minutes to wait prior to timing out.
|
447
|
+
hours : int, default 0
|
448
|
+
Number of hours to wait prior to timing out.
|
472
449
|
"""
|
473
450
|
...
|
474
451
|
|
@@ -492,190 +469,96 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
492
469
|
...
|
493
470
|
|
494
471
|
@typing.overload
|
495
|
-
def
|
496
|
-
"""
|
497
|
-
Specifies a timeout for your step.
|
498
|
-
|
499
|
-
This decorator is useful if this step may hang indefinitely.
|
500
|
-
|
501
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
502
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
503
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
504
|
-
|
505
|
-
Note that all the values specified in parameters are added together so if you specify
|
506
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
507
|
-
|
508
|
-
|
509
|
-
Parameters
|
510
|
-
----------
|
511
|
-
seconds : int, default 0
|
512
|
-
Number of seconds to wait prior to timing out.
|
513
|
-
minutes : int, default 0
|
514
|
-
Number of minutes to wait prior to timing out.
|
515
|
-
hours : int, default 0
|
516
|
-
Number of hours to wait prior to timing out.
|
517
|
-
"""
|
518
|
-
...
|
519
|
-
|
520
|
-
@typing.overload
|
521
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
522
|
-
...
|
523
|
-
|
524
|
-
@typing.overload
|
525
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
526
|
-
...
|
527
|
-
|
528
|
-
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):
|
529
|
-
"""
|
530
|
-
Specifies a timeout for your step.
|
531
|
-
|
532
|
-
This decorator is useful if this step may hang indefinitely.
|
533
|
-
|
534
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
535
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
536
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
537
|
-
|
538
|
-
Note that all the values specified in parameters are added together so if you specify
|
539
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
540
|
-
|
541
|
-
|
542
|
-
Parameters
|
543
|
-
----------
|
544
|
-
seconds : int, default 0
|
545
|
-
Number of seconds to wait prior to timing out.
|
546
|
-
minutes : int, default 0
|
547
|
-
Number of minutes to wait prior to timing out.
|
548
|
-
hours : int, default 0
|
549
|
-
Number of hours to wait prior to timing out.
|
550
|
-
"""
|
551
|
-
...
|
552
|
-
|
553
|
-
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]]]:
|
554
|
-
"""
|
555
|
-
Specifies that this step is used to deploy an instance of the app.
|
556
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
557
|
-
|
558
|
-
|
559
|
-
Parameters
|
560
|
-
----------
|
561
|
-
app_port : int
|
562
|
-
Number of GPUs to use.
|
563
|
-
app_name : str
|
564
|
-
Name of the app to deploy.
|
565
|
-
"""
|
566
|
-
...
|
567
|
-
|
568
|
-
@typing.overload
|
569
|
-
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]]]:
|
472
|
+
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]]]:
|
570
473
|
"""
|
571
|
-
|
572
|
-
|
573
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
474
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
475
|
+
the execution of a step.
|
574
476
|
|
575
477
|
|
576
478
|
Parameters
|
577
479
|
----------
|
578
|
-
|
579
|
-
|
580
|
-
id : str, optional, default None
|
581
|
-
If multiple cards are present, use this id to identify this card.
|
582
|
-
options : Dict[str, Any], default {}
|
583
|
-
Options passed to the card. The contents depend on the card type.
|
584
|
-
timeout : int, default 45
|
585
|
-
Interrupt reporting if it takes more than this many seconds.
|
480
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
481
|
+
List of secret specs, defining how the secrets are to be retrieved
|
586
482
|
"""
|
587
483
|
...
|
588
484
|
|
589
485
|
@typing.overload
|
590
|
-
def
|
486
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
591
487
|
...
|
592
488
|
|
593
489
|
@typing.overload
|
594
|
-
def
|
595
|
-
...
|
596
|
-
|
597
|
-
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):
|
598
|
-
"""
|
599
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
600
|
-
|
601
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
602
|
-
|
603
|
-
|
604
|
-
Parameters
|
605
|
-
----------
|
606
|
-
type : str, default 'default'
|
607
|
-
Card type.
|
608
|
-
id : str, optional, default None
|
609
|
-
If multiple cards are present, use this id to identify this card.
|
610
|
-
options : Dict[str, Any], default {}
|
611
|
-
Options passed to the card. The contents depend on the card type.
|
612
|
-
timeout : int, default 45
|
613
|
-
Interrupt reporting if it takes more than this many seconds.
|
614
|
-
"""
|
490
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
615
491
|
...
|
616
492
|
|
617
|
-
def
|
493
|
+
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]]] = []):
|
618
494
|
"""
|
619
|
-
Specifies
|
495
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
496
|
+
the execution of a step.
|
620
497
|
|
621
498
|
|
622
499
|
Parameters
|
623
500
|
----------
|
624
|
-
|
625
|
-
|
626
|
-
gpu_type : str
|
627
|
-
Type of Nvidia GPU to use.
|
501
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
502
|
+
List of secret specs, defining how the secrets are to be retrieved
|
628
503
|
"""
|
629
504
|
...
|
630
505
|
|
631
506
|
@typing.overload
|
632
|
-
def
|
507
|
+
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]]]:
|
633
508
|
"""
|
634
|
-
Specifies the
|
509
|
+
Specifies the Conda environment for the step.
|
635
510
|
|
636
511
|
Information in this decorator will augment any
|
637
|
-
attributes set in the `@
|
638
|
-
you can use `@
|
639
|
-
steps and use `@
|
512
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
513
|
+
you can use `@conda_base` to set packages required by all
|
514
|
+
steps and use `@conda` to specify step-specific overrides.
|
640
515
|
|
641
516
|
|
642
517
|
Parameters
|
643
518
|
----------
|
644
|
-
packages : Dict[str, str], default
|
519
|
+
packages : Dict[str, str], default {}
|
645
520
|
Packages to use for this step. The key is the name of the package
|
646
521
|
and the value is the version to use.
|
647
|
-
|
522
|
+
libraries : Dict[str, str], default {}
|
523
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
524
|
+
python : str, optional, default None
|
648
525
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
649
526
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
527
|
+
disabled : bool, default False
|
528
|
+
If set to True, disables @conda.
|
650
529
|
"""
|
651
530
|
...
|
652
531
|
|
653
532
|
@typing.overload
|
654
|
-
def
|
533
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
655
534
|
...
|
656
535
|
|
657
536
|
@typing.overload
|
658
|
-
def
|
537
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
659
538
|
...
|
660
539
|
|
661
|
-
def
|
540
|
+
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):
|
662
541
|
"""
|
663
|
-
Specifies the
|
542
|
+
Specifies the Conda environment for the step.
|
664
543
|
|
665
544
|
Information in this decorator will augment any
|
666
|
-
attributes set in the `@
|
667
|
-
you can use `@
|
668
|
-
steps and use `@
|
545
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
546
|
+
you can use `@conda_base` to set packages required by all
|
547
|
+
steps and use `@conda` to specify step-specific overrides.
|
669
548
|
|
670
549
|
|
671
550
|
Parameters
|
672
551
|
----------
|
673
|
-
packages : Dict[str, str], default
|
552
|
+
packages : Dict[str, str], default {}
|
674
553
|
Packages to use for this step. The key is the name of the package
|
675
554
|
and the value is the version to use.
|
676
|
-
|
555
|
+
libraries : Dict[str, str], default {}
|
556
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
557
|
+
python : str, optional, default None
|
677
558
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
678
559
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
560
|
+
disabled : bool, default False
|
561
|
+
If set to True, disables @conda.
|
679
562
|
"""
|
680
563
|
...
|
681
564
|
|
@@ -736,34 +619,145 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
736
619
|
"""
|
737
620
|
...
|
738
621
|
|
739
|
-
|
622
|
+
@typing.overload
|
623
|
+
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]]]:
|
740
624
|
"""
|
741
|
-
|
742
|
-
|
743
|
-
User code call
|
744
|
-
--------------
|
745
|
-
@vllm(
|
746
|
-
model="...",
|
747
|
-
...
|
748
|
-
)
|
749
|
-
|
750
|
-
Valid backend options
|
751
|
-
---------------------
|
752
|
-
- 'local': Run as a separate process on the local task machine.
|
625
|
+
Specifies the number of times the task corresponding
|
626
|
+
to a step needs to be retried.
|
753
627
|
|
754
|
-
|
755
|
-
|
756
|
-
|
628
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
629
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
630
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
757
631
|
|
758
|
-
|
759
|
-
|
632
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
633
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
634
|
+
ensuring that the flow execution can continue.
|
760
635
|
|
761
636
|
|
762
637
|
Parameters
|
763
638
|
----------
|
764
|
-
|
765
|
-
|
766
|
-
|
639
|
+
times : int, default 3
|
640
|
+
Number of times to retry this task.
|
641
|
+
minutes_between_retries : int, default 2
|
642
|
+
Number of minutes between retries.
|
643
|
+
"""
|
644
|
+
...
|
645
|
+
|
646
|
+
@typing.overload
|
647
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
648
|
+
...
|
649
|
+
|
650
|
+
@typing.overload
|
651
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
652
|
+
...
|
653
|
+
|
654
|
+
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):
|
655
|
+
"""
|
656
|
+
Specifies the number of times the task corresponding
|
657
|
+
to a step needs to be retried.
|
658
|
+
|
659
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
660
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
661
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
662
|
+
|
663
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
664
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
665
|
+
ensuring that the flow execution can continue.
|
666
|
+
|
667
|
+
|
668
|
+
Parameters
|
669
|
+
----------
|
670
|
+
times : int, default 3
|
671
|
+
Number of times to retry this task.
|
672
|
+
minutes_between_retries : int, default 2
|
673
|
+
Number of minutes between retries.
|
674
|
+
"""
|
675
|
+
...
|
676
|
+
|
677
|
+
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]]]:
|
678
|
+
"""
|
679
|
+
Specifies that this step should execute on DGX cloud.
|
680
|
+
|
681
|
+
|
682
|
+
Parameters
|
683
|
+
----------
|
684
|
+
gpu : int
|
685
|
+
Number of GPUs to use.
|
686
|
+
gpu_type : str
|
687
|
+
Type of Nvidia GPU to use.
|
688
|
+
"""
|
689
|
+
...
|
690
|
+
|
691
|
+
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]]]:
|
692
|
+
"""
|
693
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
694
|
+
|
695
|
+
|
696
|
+
Parameters
|
697
|
+
----------
|
698
|
+
temp_dir_root : str, optional
|
699
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
700
|
+
|
701
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
702
|
+
The list of repos (models/datasets) to load.
|
703
|
+
|
704
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
705
|
+
|
706
|
+
- If repo (model/dataset) is not found in the datastore:
|
707
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
708
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
709
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
710
|
+
|
711
|
+
- If repo is found in the datastore:
|
712
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
713
|
+
"""
|
714
|
+
...
|
715
|
+
|
716
|
+
@typing.overload
|
717
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
718
|
+
"""
|
719
|
+
Internal decorator to support Fast bakery
|
720
|
+
"""
|
721
|
+
...
|
722
|
+
|
723
|
+
@typing.overload
|
724
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
725
|
+
...
|
726
|
+
|
727
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
728
|
+
"""
|
729
|
+
Internal decorator to support Fast bakery
|
730
|
+
"""
|
731
|
+
...
|
732
|
+
|
733
|
+
def vllm(*, model: str, backend: str, debug: bool, kwargs: 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]]]:
|
734
|
+
"""
|
735
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
736
|
+
|
737
|
+
User code call
|
738
|
+
--------------
|
739
|
+
@vllm(
|
740
|
+
model="...",
|
741
|
+
...
|
742
|
+
)
|
743
|
+
|
744
|
+
Valid backend options
|
745
|
+
---------------------
|
746
|
+
- 'local': Run as a separate process on the local task machine.
|
747
|
+
|
748
|
+
Valid model options
|
749
|
+
-------------------
|
750
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
751
|
+
|
752
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
753
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
754
|
+
|
755
|
+
|
756
|
+
Parameters
|
757
|
+
----------
|
758
|
+
model: str
|
759
|
+
HuggingFace model identifier to be served by vLLM.
|
760
|
+
backend: str
|
767
761
|
Determines where and how to run the vLLM process.
|
768
762
|
debug: bool
|
769
763
|
Whether to turn on verbose debugging logs.
|
@@ -774,6 +768,85 @@ def vllm(*, model: str, backend: str, debug: bool, kwargs: typing.Any) -> typing
|
|
774
768
|
"""
|
775
769
|
...
|
776
770
|
|
771
|
+
@typing.overload
|
772
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
773
|
+
"""
|
774
|
+
Specifies the resources needed when executing this step.
|
775
|
+
|
776
|
+
Use `@resources` to specify the resource requirements
|
777
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
778
|
+
|
779
|
+
You can choose the compute layer on the command line by executing e.g.
|
780
|
+
```
|
781
|
+
python myflow.py run --with batch
|
782
|
+
```
|
783
|
+
or
|
784
|
+
```
|
785
|
+
python myflow.py run --with kubernetes
|
786
|
+
```
|
787
|
+
which executes the flow on the desired system using the
|
788
|
+
requirements specified in `@resources`.
|
789
|
+
|
790
|
+
|
791
|
+
Parameters
|
792
|
+
----------
|
793
|
+
cpu : int, default 1
|
794
|
+
Number of CPUs required for this step.
|
795
|
+
gpu : int, optional, default None
|
796
|
+
Number of GPUs required for this step.
|
797
|
+
disk : int, optional, default None
|
798
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
799
|
+
memory : int, default 4096
|
800
|
+
Memory size (in MB) required for this step.
|
801
|
+
shared_memory : int, optional, default None
|
802
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
803
|
+
This parameter maps to the `--shm-size` option in Docker.
|
804
|
+
"""
|
805
|
+
...
|
806
|
+
|
807
|
+
@typing.overload
|
808
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
809
|
+
...
|
810
|
+
|
811
|
+
@typing.overload
|
812
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
813
|
+
...
|
814
|
+
|
815
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
816
|
+
"""
|
817
|
+
Specifies the resources needed when executing this step.
|
818
|
+
|
819
|
+
Use `@resources` to specify the resource requirements
|
820
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
821
|
+
|
822
|
+
You can choose the compute layer on the command line by executing e.g.
|
823
|
+
```
|
824
|
+
python myflow.py run --with batch
|
825
|
+
```
|
826
|
+
or
|
827
|
+
```
|
828
|
+
python myflow.py run --with kubernetes
|
829
|
+
```
|
830
|
+
which executes the flow on the desired system using the
|
831
|
+
requirements specified in `@resources`.
|
832
|
+
|
833
|
+
|
834
|
+
Parameters
|
835
|
+
----------
|
836
|
+
cpu : int, default 1
|
837
|
+
Number of CPUs required for this step.
|
838
|
+
gpu : int, optional, default None
|
839
|
+
Number of GPUs required for this step.
|
840
|
+
disk : int, optional, default None
|
841
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
842
|
+
memory : int, default 4096
|
843
|
+
Memory size (in MB) required for this step.
|
844
|
+
shared_memory : int, optional, default None
|
845
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
846
|
+
This parameter maps to the `--shm-size` option in Docker.
|
847
|
+
"""
|
848
|
+
...
|
849
|
+
|
777
850
|
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
778
851
|
"""
|
779
852
|
Specifies that this step should execute on Kubernetes.
|
@@ -863,85 +936,67 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
863
936
|
"""
|
864
937
|
...
|
865
938
|
|
866
|
-
def
|
939
|
+
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]]]:
|
867
940
|
"""
|
868
|
-
|
941
|
+
Specifies that this step is used to deploy an instance of the app.
|
942
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
869
943
|
|
870
944
|
|
871
945
|
Parameters
|
872
946
|
----------
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
877
|
-
The list of repos (models/datasets) to load.
|
878
|
-
|
879
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
880
|
-
|
881
|
-
- If repo (model/dataset) is not found in the datastore:
|
882
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
883
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
884
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
885
|
-
|
886
|
-
- If repo is found in the datastore:
|
887
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
947
|
+
app_port : int
|
948
|
+
Number of GPUs to use.
|
949
|
+
app_name : str
|
950
|
+
Name of the app to deploy.
|
888
951
|
"""
|
889
952
|
...
|
890
953
|
|
891
954
|
@typing.overload
|
892
|
-
def
|
955
|
+
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]]]:
|
893
956
|
"""
|
894
|
-
|
957
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
895
958
|
|
959
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
896
960
|
|
897
961
|
|
898
962
|
Parameters
|
899
963
|
----------
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
909
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
910
|
-
|
911
|
-
temp_dir_root : str, default: None
|
912
|
-
The root directory under which `current.model.loaded` will store loaded models
|
964
|
+
type : str, default 'default'
|
965
|
+
Card type.
|
966
|
+
id : str, optional, default None
|
967
|
+
If multiple cards are present, use this id to identify this card.
|
968
|
+
options : Dict[str, Any], default {}
|
969
|
+
Options passed to the card. The contents depend on the card type.
|
970
|
+
timeout : int, default 45
|
971
|
+
Interrupt reporting if it takes more than this many seconds.
|
913
972
|
"""
|
914
973
|
...
|
915
974
|
|
916
975
|
@typing.overload
|
917
|
-
def
|
976
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
918
977
|
...
|
919
978
|
|
920
979
|
@typing.overload
|
921
|
-
def
|
980
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
922
981
|
...
|
923
982
|
|
924
|
-
def
|
983
|
+
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):
|
925
984
|
"""
|
926
|
-
|
985
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
927
986
|
|
987
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
928
988
|
|
929
989
|
|
930
990
|
Parameters
|
931
991
|
----------
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
941
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
942
|
-
|
943
|
-
temp_dir_root : str, default: None
|
944
|
-
The root directory under which `current.model.loaded` will store loaded models
|
992
|
+
type : str, default 'default'
|
993
|
+
Card type.
|
994
|
+
id : str, optional, default None
|
995
|
+
If multiple cards are present, use this id to identify this card.
|
996
|
+
options : Dict[str, Any], default {}
|
997
|
+
Options passed to the card. The contents depend on the card type.
|
998
|
+
timeout : int, default 45
|
999
|
+
Interrupt reporting if it takes more than this many seconds.
|
945
1000
|
"""
|
946
1001
|
...
|
947
1002
|
|
@@ -962,57 +1017,53 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
|
|
962
1017
|
...
|
963
1018
|
|
964
1019
|
@typing.overload
|
965
|
-
def
|
1020
|
+
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]]:
|
966
1021
|
"""
|
967
|
-
Specifies the
|
968
|
-
to a step needs to be retried.
|
969
|
-
|
970
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
971
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
972
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1022
|
+
Specifies the Conda environment for all steps of the flow.
|
973
1023
|
|
974
|
-
|
975
|
-
|
976
|
-
ensuring that the flow execution can continue.
|
1024
|
+
Use `@conda_base` to set common libraries required by all
|
1025
|
+
steps and use `@conda` to specify step-specific additions.
|
977
1026
|
|
978
1027
|
|
979
1028
|
Parameters
|
980
1029
|
----------
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
1030
|
+
packages : Dict[str, str], default {}
|
1031
|
+
Packages to use for this flow. The key is the name of the package
|
1032
|
+
and the value is the version to use.
|
1033
|
+
libraries : Dict[str, str], default {}
|
1034
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1035
|
+
python : str, optional, default None
|
1036
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1037
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1038
|
+
disabled : bool, default False
|
1039
|
+
If set to True, disables Conda.
|
985
1040
|
"""
|
986
1041
|
...
|
987
1042
|
|
988
1043
|
@typing.overload
|
989
|
-
def
|
990
|
-
...
|
991
|
-
|
992
|
-
@typing.overload
|
993
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1044
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
994
1045
|
...
|
995
1046
|
|
996
|
-
def
|
1047
|
+
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):
|
997
1048
|
"""
|
998
|
-
Specifies the
|
999
|
-
to a step needs to be retried.
|
1000
|
-
|
1001
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1002
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1003
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1049
|
+
Specifies the Conda environment for all steps of the flow.
|
1004
1050
|
|
1005
|
-
|
1006
|
-
|
1007
|
-
ensuring that the flow execution can continue.
|
1051
|
+
Use `@conda_base` to set common libraries required by all
|
1052
|
+
steps and use `@conda` to specify step-specific additions.
|
1008
1053
|
|
1009
1054
|
|
1010
1055
|
Parameters
|
1011
1056
|
----------
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1057
|
+
packages : Dict[str, str], default {}
|
1058
|
+
Packages to use for this flow. The key is the name of the package
|
1059
|
+
and the value is the version to use.
|
1060
|
+
libraries : Dict[str, str], default {}
|
1061
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1062
|
+
python : str, optional, default None
|
1063
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1064
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1065
|
+
disabled : bool, default False
|
1066
|
+
If set to True, disables Conda.
|
1016
1067
|
"""
|
1017
1068
|
...
|
1018
1069
|
|
@@ -1109,120 +1160,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1109
1160
|
"""
|
1110
1161
|
...
|
1111
1162
|
|
1112
|
-
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
1113
|
-
"""
|
1114
|
-
Allows setting external datastores to save data for the
|
1115
|
-
`@checkpoint`/`@model`/`@huggingface_hub` decorators.
|
1116
|
-
|
1117
|
-
This decorator is useful when users wish to save data to a different datastore
|
1118
|
-
than what is configured in Metaflow. This can be for variety of reasons:
|
1119
|
-
|
1120
|
-
1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
|
1121
|
-
2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
|
1122
|
-
- Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
|
1123
|
-
3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
|
1124
|
-
- Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
|
1125
|
-
|
1126
|
-
Usage:
|
1127
|
-
----------
|
1128
|
-
|
1129
|
-
- Using a custom IAM role to access the datastore.
|
1130
|
-
|
1131
|
-
```python
|
1132
|
-
@with_artifact_store(
|
1133
|
-
type="s3",
|
1134
|
-
config=lambda: {
|
1135
|
-
"root": "s3://my-bucket-foo/path/to/root",
|
1136
|
-
"role_arn": ROLE,
|
1137
|
-
},
|
1138
|
-
)
|
1139
|
-
class MyFlow(FlowSpec):
|
1140
|
-
|
1141
|
-
@checkpoint
|
1142
|
-
@step
|
1143
|
-
def start(self):
|
1144
|
-
with open("my_file.txt", "w") as f:
|
1145
|
-
f.write("Hello, World!")
|
1146
|
-
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1147
|
-
self.next(self.end)
|
1148
|
-
|
1149
|
-
```
|
1150
|
-
|
1151
|
-
- Using credentials to access the s3-compatible datastore.
|
1152
|
-
|
1153
|
-
```python
|
1154
|
-
@with_artifact_store(
|
1155
|
-
type="s3",
|
1156
|
-
config=lambda: {
|
1157
|
-
"root": "s3://my-bucket-foo/path/to/root",
|
1158
|
-
"client_params": {
|
1159
|
-
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1160
|
-
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1161
|
-
},
|
1162
|
-
},
|
1163
|
-
)
|
1164
|
-
class MyFlow(FlowSpec):
|
1165
|
-
|
1166
|
-
@checkpoint
|
1167
|
-
@step
|
1168
|
-
def start(self):
|
1169
|
-
with open("my_file.txt", "w") as f:
|
1170
|
-
f.write("Hello, World!")
|
1171
|
-
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1172
|
-
self.next(self.end)
|
1173
|
-
|
1174
|
-
```
|
1175
|
-
|
1176
|
-
- Accessing objects stored in external datastores after task execution.
|
1177
|
-
|
1178
|
-
```python
|
1179
|
-
run = Run("CheckpointsTestsFlow/8992")
|
1180
|
-
with artifact_store_from(run=run, config={
|
1181
|
-
"client_params": {
|
1182
|
-
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1183
|
-
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1184
|
-
},
|
1185
|
-
}):
|
1186
|
-
with Checkpoint() as cp:
|
1187
|
-
latest = cp.list(
|
1188
|
-
task=run["start"].task
|
1189
|
-
)[0]
|
1190
|
-
print(latest)
|
1191
|
-
cp.load(
|
1192
|
-
latest,
|
1193
|
-
"test-checkpoints"
|
1194
|
-
)
|
1195
|
-
|
1196
|
-
task = Task("TorchTuneFlow/8484/train/53673")
|
1197
|
-
with artifact_store_from(run=run, config={
|
1198
|
-
"client_params": {
|
1199
|
-
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1200
|
-
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1201
|
-
},
|
1202
|
-
}):
|
1203
|
-
load_model(
|
1204
|
-
task.data.model_ref,
|
1205
|
-
"test-models"
|
1206
|
-
)
|
1207
|
-
```
|
1208
|
-
Parameters:
|
1209
|
-
----------
|
1210
|
-
|
1211
|
-
type: str
|
1212
|
-
The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
|
1213
|
-
|
1214
|
-
config: dict or Callable
|
1215
|
-
Dictionary of configuration options for the datastore. The following keys are required:
|
1216
|
-
- root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
|
1217
|
-
- example: 's3://bucket-name/path/to/root'
|
1218
|
-
- example: 'gs://bucket-name/path/to/root'
|
1219
|
-
- example: 'https://myblockacc.blob.core.windows.net/metaflow/'
|
1220
|
-
- role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
|
1221
|
-
- session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
|
1222
|
-
- client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
|
1223
|
-
"""
|
1224
|
-
...
|
1225
|
-
|
1226
1163
|
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]]:
|
1227
1164
|
"""
|
1228
1165
|
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)
|
@@ -1266,183 +1203,44 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1266
1203
|
"""
|
1267
1204
|
...
|
1268
1205
|
|
1269
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1270
|
-
"""
|
1271
|
-
Specifies what flows belong to the same project.
|
1272
|
-
|
1273
|
-
A project-specific namespace is created for all flows that
|
1274
|
-
use the same `@project(name)`.
|
1275
|
-
|
1276
|
-
|
1277
|
-
Parameters
|
1278
|
-
----------
|
1279
|
-
name : str
|
1280
|
-
Project name. Make sure that the name is unique amongst all
|
1281
|
-
projects that use the same production scheduler. The name may
|
1282
|
-
contain only lowercase alphanumeric characters and underscores.
|
1283
|
-
|
1284
|
-
branch : Optional[str], default None
|
1285
|
-
The branch to use. If not specified, the branch is set to
|
1286
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1287
|
-
also be set on the command line using `--branch` as a top-level option.
|
1288
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1289
|
-
|
1290
|
-
production : bool, default False
|
1291
|
-
Whether or not the branch is the production branch. This can also be set on the
|
1292
|
-
command line using `--production` as a top-level option. It is an error to specify
|
1293
|
-
`production` in the decorator and on the command line.
|
1294
|
-
The project branch name will be:
|
1295
|
-
- if `branch` is specified:
|
1296
|
-
- if `production` is True: `prod.<branch>`
|
1297
|
-
- if `production` is False: `test.<branch>`
|
1298
|
-
- if `branch` is not specified:
|
1299
|
-
- if `production` is True: `prod`
|
1300
|
-
- if `production` is False: `user.<username>`
|
1301
|
-
"""
|
1302
|
-
...
|
1303
|
-
|
1304
1206
|
@typing.overload
|
1305
|
-
def
|
1207
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1306
1208
|
"""
|
1307
|
-
Specifies the
|
1308
|
-
|
1309
|
-
Use `@conda_base` to set common libraries required by all
|
1310
|
-
steps and use `@conda` to specify step-specific additions.
|
1209
|
+
Specifies the PyPI packages for all steps of the flow.
|
1311
1210
|
|
1211
|
+
Use `@pypi_base` to set common packages required by all
|
1212
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1312
1213
|
|
1313
1214
|
Parameters
|
1314
1215
|
----------
|
1315
|
-
packages : Dict[str, str], default {}
|
1216
|
+
packages : Dict[str, str], default: {}
|
1316
1217
|
Packages to use for this flow. The key is the name of the package
|
1317
1218
|
and the value is the version to use.
|
1318
|
-
|
1319
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1320
|
-
python : str, optional, default None
|
1219
|
+
python : str, optional, default: None
|
1321
1220
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1322
1221
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1323
|
-
disabled : bool, default False
|
1324
|
-
If set to True, disables Conda.
|
1325
1222
|
"""
|
1326
1223
|
...
|
1327
1224
|
|
1328
1225
|
@typing.overload
|
1329
|
-
def
|
1226
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1330
1227
|
...
|
1331
1228
|
|
1332
|
-
def
|
1229
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1333
1230
|
"""
|
1334
|
-
Specifies the
|
1335
|
-
|
1336
|
-
Use `@conda_base` to set common libraries required by all
|
1337
|
-
steps and use `@conda` to specify step-specific additions.
|
1231
|
+
Specifies the PyPI packages for all steps of the flow.
|
1338
1232
|
|
1233
|
+
Use `@pypi_base` to set common packages required by all
|
1234
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1339
1235
|
|
1340
1236
|
Parameters
|
1341
1237
|
----------
|
1342
|
-
packages : Dict[str, str], default {}
|
1238
|
+
packages : Dict[str, str], default: {}
|
1343
1239
|
Packages to use for this flow. The key is the name of the package
|
1344
1240
|
and the value is the version to use.
|
1345
|
-
|
1346
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1347
|
-
python : str, optional, default None
|
1241
|
+
python : str, optional, default: None
|
1348
1242
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1349
1243
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1350
|
-
disabled : bool, default False
|
1351
|
-
If set to True, disables Conda.
|
1352
|
-
"""
|
1353
|
-
...
|
1354
|
-
|
1355
|
-
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]]:
|
1356
|
-
"""
|
1357
|
-
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.
|
1358
|
-
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.
|
1359
|
-
|
1360
|
-
|
1361
|
-
Parameters
|
1362
|
-
----------
|
1363
|
-
timeout : int
|
1364
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1365
|
-
poke_interval : int
|
1366
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1367
|
-
mode : str
|
1368
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1369
|
-
exponential_backoff : bool
|
1370
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1371
|
-
pool : str
|
1372
|
-
the slot pool this task should run in,
|
1373
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1374
|
-
soft_fail : bool
|
1375
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1376
|
-
name : str
|
1377
|
-
Name of the sensor on Airflow
|
1378
|
-
description : str
|
1379
|
-
Description of sensor in the Airflow UI
|
1380
|
-
external_dag_id : str
|
1381
|
-
The dag_id that contains the task you want to wait for.
|
1382
|
-
external_task_ids : List[str]
|
1383
|
-
The list of task_ids that you want to wait for.
|
1384
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1385
|
-
allowed_states : List[str]
|
1386
|
-
Iterable of allowed states, (Default: ['success'])
|
1387
|
-
failed_states : List[str]
|
1388
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1389
|
-
execution_delta : datetime.timedelta
|
1390
|
-
time difference with the previous execution to look at,
|
1391
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1392
|
-
check_existence: bool
|
1393
|
-
Set to True to check if the external task exists or check if
|
1394
|
-
the DAG to wait for exists. (Default: True)
|
1395
|
-
"""
|
1396
|
-
...
|
1397
|
-
|
1398
|
-
@typing.overload
|
1399
|
-
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1400
|
-
"""
|
1401
|
-
Specifies the times when the flow should be run when running on a
|
1402
|
-
production scheduler.
|
1403
|
-
|
1404
|
-
|
1405
|
-
Parameters
|
1406
|
-
----------
|
1407
|
-
hourly : bool, default False
|
1408
|
-
Run the workflow hourly.
|
1409
|
-
daily : bool, default True
|
1410
|
-
Run the workflow daily.
|
1411
|
-
weekly : bool, default False
|
1412
|
-
Run the workflow weekly.
|
1413
|
-
cron : str, optional, default None
|
1414
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1415
|
-
specified by this expression.
|
1416
|
-
timezone : str, optional, default None
|
1417
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1418
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1419
|
-
"""
|
1420
|
-
...
|
1421
|
-
|
1422
|
-
@typing.overload
|
1423
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1424
|
-
...
|
1425
|
-
|
1426
|
-
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1427
|
-
"""
|
1428
|
-
Specifies the times when the flow should be run when running on a
|
1429
|
-
production scheduler.
|
1430
|
-
|
1431
|
-
|
1432
|
-
Parameters
|
1433
|
-
----------
|
1434
|
-
hourly : bool, default False
|
1435
|
-
Run the workflow hourly.
|
1436
|
-
daily : bool, default True
|
1437
|
-
Run the workflow daily.
|
1438
|
-
weekly : bool, default False
|
1439
|
-
Run the workflow weekly.
|
1440
|
-
cron : str, optional, default None
|
1441
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1442
|
-
specified by this expression.
|
1443
|
-
timezone : str, optional, default None
|
1444
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1445
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1446
1244
|
"""
|
1447
1245
|
...
|
1448
1246
|
|
@@ -1548,43 +1346,245 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1548
1346
|
...
|
1549
1347
|
|
1550
1348
|
@typing.overload
|
1551
|
-
def
|
1349
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1552
1350
|
"""
|
1553
|
-
Specifies the
|
1351
|
+
Specifies the times when the flow should be run when running on a
|
1352
|
+
production scheduler.
|
1554
1353
|
|
1555
|
-
Use `@pypi_base` to set common packages required by all
|
1556
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1557
1354
|
|
1558
1355
|
Parameters
|
1559
1356
|
----------
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1357
|
+
hourly : bool, default False
|
1358
|
+
Run the workflow hourly.
|
1359
|
+
daily : bool, default True
|
1360
|
+
Run the workflow daily.
|
1361
|
+
weekly : bool, default False
|
1362
|
+
Run the workflow weekly.
|
1363
|
+
cron : str, optional, default None
|
1364
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1365
|
+
specified by this expression.
|
1366
|
+
timezone : str, optional, default None
|
1367
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1368
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1566
1369
|
"""
|
1567
1370
|
...
|
1568
1371
|
|
1569
1372
|
@typing.overload
|
1570
|
-
def
|
1373
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1571
1374
|
...
|
1572
1375
|
|
1573
|
-
def
|
1376
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1574
1377
|
"""
|
1575
|
-
Specifies the
|
1378
|
+
Specifies the times when the flow should be run when running on a
|
1379
|
+
production scheduler.
|
1576
1380
|
|
1577
|
-
Use `@pypi_base` to set common packages required by all
|
1578
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1579
1381
|
|
1580
1382
|
Parameters
|
1581
1383
|
----------
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1384
|
+
hourly : bool, default False
|
1385
|
+
Run the workflow hourly.
|
1386
|
+
daily : bool, default True
|
1387
|
+
Run the workflow daily.
|
1388
|
+
weekly : bool, default False
|
1389
|
+
Run the workflow weekly.
|
1390
|
+
cron : str, optional, default None
|
1391
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1392
|
+
specified by this expression.
|
1393
|
+
timezone : str, optional, default None
|
1394
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1395
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1396
|
+
"""
|
1397
|
+
...
|
1398
|
+
|
1399
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1400
|
+
"""
|
1401
|
+
Specifies what flows belong to the same project.
|
1402
|
+
|
1403
|
+
A project-specific namespace is created for all flows that
|
1404
|
+
use the same `@project(name)`.
|
1405
|
+
|
1406
|
+
|
1407
|
+
Parameters
|
1408
|
+
----------
|
1409
|
+
name : str
|
1410
|
+
Project name. Make sure that the name is unique amongst all
|
1411
|
+
projects that use the same production scheduler. The name may
|
1412
|
+
contain only lowercase alphanumeric characters and underscores.
|
1413
|
+
|
1414
|
+
branch : Optional[str], default None
|
1415
|
+
The branch to use. If not specified, the branch is set to
|
1416
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1417
|
+
also be set on the command line using `--branch` as a top-level option.
|
1418
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1419
|
+
|
1420
|
+
production : bool, default False
|
1421
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1422
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1423
|
+
`production` in the decorator and on the command line.
|
1424
|
+
The project branch name will be:
|
1425
|
+
- if `branch` is specified:
|
1426
|
+
- if `production` is True: `prod.<branch>`
|
1427
|
+
- if `production` is False: `test.<branch>`
|
1428
|
+
- if `branch` is not specified:
|
1429
|
+
- if `production` is True: `prod`
|
1430
|
+
- if `production` is False: `user.<username>`
|
1431
|
+
"""
|
1432
|
+
...
|
1433
|
+
|
1434
|
+
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]]:
|
1435
|
+
"""
|
1436
|
+
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.
|
1437
|
+
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.
|
1438
|
+
|
1439
|
+
|
1440
|
+
Parameters
|
1441
|
+
----------
|
1442
|
+
timeout : int
|
1443
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1444
|
+
poke_interval : int
|
1445
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1446
|
+
mode : str
|
1447
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1448
|
+
exponential_backoff : bool
|
1449
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1450
|
+
pool : str
|
1451
|
+
the slot pool this task should run in,
|
1452
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1453
|
+
soft_fail : bool
|
1454
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1455
|
+
name : str
|
1456
|
+
Name of the sensor on Airflow
|
1457
|
+
description : str
|
1458
|
+
Description of sensor in the Airflow UI
|
1459
|
+
external_dag_id : str
|
1460
|
+
The dag_id that contains the task you want to wait for.
|
1461
|
+
external_task_ids : List[str]
|
1462
|
+
The list of task_ids that you want to wait for.
|
1463
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1464
|
+
allowed_states : List[str]
|
1465
|
+
Iterable of allowed states, (Default: ['success'])
|
1466
|
+
failed_states : List[str]
|
1467
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1468
|
+
execution_delta : datetime.timedelta
|
1469
|
+
time difference with the previous execution to look at,
|
1470
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1471
|
+
check_existence: bool
|
1472
|
+
Set to True to check if the external task exists or check if
|
1473
|
+
the DAG to wait for exists. (Default: True)
|
1474
|
+
"""
|
1475
|
+
...
|
1476
|
+
|
1477
|
+
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
1478
|
+
"""
|
1479
|
+
Allows setting external datastores to save data for the
|
1480
|
+
`@checkpoint`/`@model`/`@huggingface_hub` decorators.
|
1481
|
+
|
1482
|
+
This decorator is useful when users wish to save data to a different datastore
|
1483
|
+
than what is configured in Metaflow. This can be for variety of reasons:
|
1484
|
+
|
1485
|
+
1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
|
1486
|
+
2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
|
1487
|
+
- Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
|
1488
|
+
3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
|
1489
|
+
- Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
|
1490
|
+
|
1491
|
+
Usage:
|
1492
|
+
----------
|
1493
|
+
|
1494
|
+
- Using a custom IAM role to access the datastore.
|
1495
|
+
|
1496
|
+
```python
|
1497
|
+
@with_artifact_store(
|
1498
|
+
type="s3",
|
1499
|
+
config=lambda: {
|
1500
|
+
"root": "s3://my-bucket-foo/path/to/root",
|
1501
|
+
"role_arn": ROLE,
|
1502
|
+
},
|
1503
|
+
)
|
1504
|
+
class MyFlow(FlowSpec):
|
1505
|
+
|
1506
|
+
@checkpoint
|
1507
|
+
@step
|
1508
|
+
def start(self):
|
1509
|
+
with open("my_file.txt", "w") as f:
|
1510
|
+
f.write("Hello, World!")
|
1511
|
+
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1512
|
+
self.next(self.end)
|
1513
|
+
|
1514
|
+
```
|
1515
|
+
|
1516
|
+
- Using credentials to access the s3-compatible datastore.
|
1517
|
+
|
1518
|
+
```python
|
1519
|
+
@with_artifact_store(
|
1520
|
+
type="s3",
|
1521
|
+
config=lambda: {
|
1522
|
+
"root": "s3://my-bucket-foo/path/to/root",
|
1523
|
+
"client_params": {
|
1524
|
+
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1525
|
+
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1526
|
+
},
|
1527
|
+
},
|
1528
|
+
)
|
1529
|
+
class MyFlow(FlowSpec):
|
1530
|
+
|
1531
|
+
@checkpoint
|
1532
|
+
@step
|
1533
|
+
def start(self):
|
1534
|
+
with open("my_file.txt", "w") as f:
|
1535
|
+
f.write("Hello, World!")
|
1536
|
+
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1537
|
+
self.next(self.end)
|
1538
|
+
|
1539
|
+
```
|
1540
|
+
|
1541
|
+
- Accessing objects stored in external datastores after task execution.
|
1542
|
+
|
1543
|
+
```python
|
1544
|
+
run = Run("CheckpointsTestsFlow/8992")
|
1545
|
+
with artifact_store_from(run=run, config={
|
1546
|
+
"client_params": {
|
1547
|
+
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1548
|
+
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1549
|
+
},
|
1550
|
+
}):
|
1551
|
+
with Checkpoint() as cp:
|
1552
|
+
latest = cp.list(
|
1553
|
+
task=run["start"].task
|
1554
|
+
)[0]
|
1555
|
+
print(latest)
|
1556
|
+
cp.load(
|
1557
|
+
latest,
|
1558
|
+
"test-checkpoints"
|
1559
|
+
)
|
1560
|
+
|
1561
|
+
task = Task("TorchTuneFlow/8484/train/53673")
|
1562
|
+
with artifact_store_from(run=run, config={
|
1563
|
+
"client_params": {
|
1564
|
+
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1565
|
+
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1566
|
+
},
|
1567
|
+
}):
|
1568
|
+
load_model(
|
1569
|
+
task.data.model_ref,
|
1570
|
+
"test-models"
|
1571
|
+
)
|
1572
|
+
```
|
1573
|
+
Parameters:
|
1574
|
+
----------
|
1575
|
+
|
1576
|
+
type: str
|
1577
|
+
The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
|
1578
|
+
|
1579
|
+
config: dict or Callable
|
1580
|
+
Dictionary of configuration options for the datastore. The following keys are required:
|
1581
|
+
- root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
|
1582
|
+
- example: 's3://bucket-name/path/to/root'
|
1583
|
+
- example: 'gs://bucket-name/path/to/root'
|
1584
|
+
- example: 'https://myblockacc.blob.core.windows.net/metaflow/'
|
1585
|
+
- role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
|
1586
|
+
- session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
|
1587
|
+
- client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
|
1588
1588
|
"""
|
1589
1589
|
...
|
1590
1590
|
|