ob-metaflow-stubs 6.0.3.179rc0__py2.py3-none-any.whl → 6.0.3.179rc1__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 +617 -617
- 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 +3 -3
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +3 -3
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +1 -1
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +136 -136
- 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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- 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 +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +1 -1
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +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 +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +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 +1 -1
- 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 +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
- metaflow-stubs/plugins/timeout_decorator.pyi +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 +3 -3
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.3.179rc0.dist-info → ob_metaflow_stubs-6.0.3.179rc1.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.179rc1.dist-info/RECORD +220 -0
- ob_metaflow_stubs-6.0.3.179rc0.dist-info/RECORD +0 -220
- {ob_metaflow_stubs-6.0.3.179rc0.dist-info → ob_metaflow_stubs-6.0.3.179rc1.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.179rc0.dist-info → ob_metaflow_stubs-6.0.3.179rc1.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-13T20:01:40.043002 #
|
|
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
|
|
|
@@ -35,8 +35,8 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
|
35
35
|
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
|
-
from . import cards as cards
|
|
39
38
|
from . import tuple_util as tuple_util
|
|
39
|
+
from . import cards as cards
|
|
40
40
|
from . import metaflow_git as metaflow_git
|
|
41
41
|
from . import events as events
|
|
42
42
|
from . import runner as runner
|
|
@@ -44,9 +44,9 @@ 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 pyproject_toml_parser as pyproject_toml_parser
|
|
47
48
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
48
49
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
49
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_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,177 +155,191 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
155
155
|
"""
|
|
156
156
|
...
|
|
157
157
|
|
|
158
|
-
|
|
158
|
+
@typing.overload
|
|
159
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
159
160
|
"""
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
Parameters
|
|
164
|
-
----------
|
|
165
|
-
gpu : int
|
|
166
|
-
Number of GPUs to use.
|
|
167
|
-
gpu_type : str
|
|
168
|
-
Type of Nvidia GPU to use.
|
|
169
|
-
queue_timeout : int
|
|
170
|
-
Time to keep the job in NVCF's queue.
|
|
161
|
+
Internal decorator to support Fast bakery
|
|
171
162
|
"""
|
|
172
163
|
...
|
|
173
164
|
|
|
174
165
|
@typing.overload
|
|
175
|
-
def
|
|
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):
|
|
176
170
|
"""
|
|
177
|
-
|
|
171
|
+
Internal decorator to support Fast bakery
|
|
172
|
+
"""
|
|
173
|
+
...
|
|
174
|
+
|
|
175
|
+
@typing.overload
|
|
176
|
+
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]]]:
|
|
177
|
+
"""
|
|
178
|
+
Specifies a timeout for your step.
|
|
178
179
|
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
This decorator is useful if this step may hang indefinitely.
|
|
181
|
+
|
|
182
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
183
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
184
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
185
|
+
|
|
186
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
187
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
183
188
|
|
|
184
189
|
|
|
185
190
|
Parameters
|
|
186
191
|
----------
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
192
|
+
seconds : int, default 0
|
|
193
|
+
Number of seconds to wait prior to timing out.
|
|
194
|
+
minutes : int, default 0
|
|
195
|
+
Number of minutes to wait prior to timing out.
|
|
196
|
+
hours : int, default 0
|
|
197
|
+
Number of hours to wait prior to timing out.
|
|
193
198
|
"""
|
|
194
199
|
...
|
|
195
200
|
|
|
196
201
|
@typing.overload
|
|
197
|
-
def
|
|
202
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
198
203
|
...
|
|
199
204
|
|
|
200
205
|
@typing.overload
|
|
201
|
-
def
|
|
206
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
202
207
|
...
|
|
203
208
|
|
|
204
|
-
def
|
|
209
|
+
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):
|
|
205
210
|
"""
|
|
206
|
-
Specifies
|
|
211
|
+
Specifies a timeout for your step.
|
|
207
212
|
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
213
|
+
This decorator is useful if this step may hang indefinitely.
|
|
214
|
+
|
|
215
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
216
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
217
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
218
|
+
|
|
219
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
220
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
212
221
|
|
|
213
222
|
|
|
214
223
|
Parameters
|
|
215
224
|
----------
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
225
|
+
seconds : int, default 0
|
|
226
|
+
Number of seconds to wait prior to timing out.
|
|
227
|
+
minutes : int, default 0
|
|
228
|
+
Number of minutes to wait prior to timing out.
|
|
229
|
+
hours : int, default 0
|
|
230
|
+
Number of hours to wait prior to timing out.
|
|
222
231
|
"""
|
|
223
232
|
...
|
|
224
233
|
|
|
225
234
|
@typing.overload
|
|
226
|
-
def
|
|
235
|
+
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]]]:
|
|
227
236
|
"""
|
|
228
|
-
Specifies
|
|
237
|
+
Specifies the number of times the task corresponding
|
|
238
|
+
to a step needs to be retried.
|
|
239
|
+
|
|
240
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
241
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
242
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
243
|
+
|
|
244
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
245
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
246
|
+
ensuring that the flow execution can continue.
|
|
229
247
|
|
|
230
248
|
|
|
231
249
|
Parameters
|
|
232
250
|
----------
|
|
233
|
-
|
|
234
|
-
|
|
251
|
+
times : int, default 3
|
|
252
|
+
Number of times to retry this task.
|
|
253
|
+
minutes_between_retries : int, default 2
|
|
254
|
+
Number of minutes between retries.
|
|
235
255
|
"""
|
|
236
256
|
...
|
|
237
257
|
|
|
238
258
|
@typing.overload
|
|
239
|
-
def
|
|
259
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
240
260
|
...
|
|
241
261
|
|
|
242
262
|
@typing.overload
|
|
243
|
-
def
|
|
263
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
244
264
|
...
|
|
245
265
|
|
|
246
|
-
def
|
|
266
|
+
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):
|
|
247
267
|
"""
|
|
248
|
-
Specifies
|
|
268
|
+
Specifies the number of times the task corresponding
|
|
269
|
+
to a step needs to be retried.
|
|
270
|
+
|
|
271
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
272
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
273
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
274
|
+
|
|
275
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
276
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
277
|
+
ensuring that the flow execution can continue.
|
|
249
278
|
|
|
250
279
|
|
|
251
280
|
Parameters
|
|
252
281
|
----------
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
@typing.overload
|
|
259
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
260
|
-
"""
|
|
261
|
-
Internal decorator to support Fast bakery
|
|
262
|
-
"""
|
|
263
|
-
...
|
|
264
|
-
|
|
265
|
-
@typing.overload
|
|
266
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
267
|
-
...
|
|
268
|
-
|
|
269
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
270
|
-
"""
|
|
271
|
-
Internal decorator to support Fast bakery
|
|
282
|
+
times : int, default 3
|
|
283
|
+
Number of times to retry this task.
|
|
284
|
+
minutes_between_retries : int, default 2
|
|
285
|
+
Number of minutes between retries.
|
|
272
286
|
"""
|
|
273
287
|
...
|
|
274
288
|
|
|
275
289
|
@typing.overload
|
|
276
|
-
def
|
|
290
|
+
def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
277
291
|
"""
|
|
278
|
-
Enables
|
|
292
|
+
Enables checkpointing for a step.
|
|
279
293
|
|
|
280
294
|
|
|
281
295
|
|
|
282
296
|
Parameters
|
|
283
297
|
----------
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
298
|
+
load_policy : str, default: "fresh"
|
|
299
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
300
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
301
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
302
|
+
will be loaded at the start of the task.
|
|
303
|
+
- "none": Do not load any checkpoint
|
|
304
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
305
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
306
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
307
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
294
308
|
|
|
295
309
|
temp_dir_root : str, default: None
|
|
296
|
-
The root directory under which `current.
|
|
310
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
297
311
|
"""
|
|
298
312
|
...
|
|
299
313
|
|
|
300
314
|
@typing.overload
|
|
301
|
-
def
|
|
315
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
302
316
|
...
|
|
303
317
|
|
|
304
318
|
@typing.overload
|
|
305
|
-
def
|
|
319
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
306
320
|
...
|
|
307
321
|
|
|
308
|
-
def
|
|
322
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
|
309
323
|
"""
|
|
310
|
-
Enables
|
|
324
|
+
Enables checkpointing for a step.
|
|
311
325
|
|
|
312
326
|
|
|
313
327
|
|
|
314
328
|
Parameters
|
|
315
329
|
----------
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
330
|
+
load_policy : str, default: "fresh"
|
|
331
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
332
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
333
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
334
|
+
will be loaded at the start of the task.
|
|
335
|
+
- "none": Do not load any checkpoint
|
|
336
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
337
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
338
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
339
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
326
340
|
|
|
327
341
|
temp_dir_root : str, default: None
|
|
328
|
-
The root directory under which `current.
|
|
342
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
329
343
|
"""
|
|
330
344
|
...
|
|
331
345
|
|
|
@@ -388,38 +402,85 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
388
402
|
"""
|
|
389
403
|
...
|
|
390
404
|
|
|
405
|
+
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]]]:
|
|
406
|
+
"""
|
|
407
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
Parameters
|
|
411
|
+
----------
|
|
412
|
+
temp_dir_root : str, optional
|
|
413
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
|
414
|
+
|
|
415
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
|
416
|
+
The list of repos (models/datasets) to load.
|
|
417
|
+
|
|
418
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
|
419
|
+
|
|
420
|
+
- If repo (model/dataset) is not found in the datastore:
|
|
421
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
|
422
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
|
423
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
|
424
|
+
|
|
425
|
+
- If repo is found in the datastore:
|
|
426
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
|
427
|
+
"""
|
|
428
|
+
...
|
|
429
|
+
|
|
391
430
|
@typing.overload
|
|
392
|
-
def
|
|
431
|
+
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]]]:
|
|
393
432
|
"""
|
|
394
|
-
|
|
395
|
-
|
|
433
|
+
Enables loading / saving of models within a step.
|
|
434
|
+
|
|
396
435
|
|
|
397
436
|
|
|
398
437
|
Parameters
|
|
399
438
|
----------
|
|
400
|
-
|
|
401
|
-
|
|
439
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
440
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
441
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
|
442
|
+
- `current.checkpoint`
|
|
443
|
+
- `current.model`
|
|
444
|
+
- `current.huggingface_hub`
|
|
445
|
+
|
|
446
|
+
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
|
|
447
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
448
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
449
|
+
|
|
450
|
+
temp_dir_root : str, default: None
|
|
451
|
+
The root directory under which `current.model.loaded` will store loaded models
|
|
402
452
|
"""
|
|
403
453
|
...
|
|
404
454
|
|
|
405
455
|
@typing.overload
|
|
406
|
-
def
|
|
456
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
407
457
|
...
|
|
408
458
|
|
|
409
459
|
@typing.overload
|
|
410
|
-
def
|
|
460
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
411
461
|
...
|
|
412
462
|
|
|
413
|
-
def
|
|
463
|
+
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):
|
|
414
464
|
"""
|
|
415
|
-
|
|
416
|
-
|
|
465
|
+
Enables loading / saving of models within a step.
|
|
466
|
+
|
|
417
467
|
|
|
418
468
|
|
|
419
469
|
Parameters
|
|
420
470
|
----------
|
|
421
|
-
|
|
422
|
-
|
|
471
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
472
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
473
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
|
474
|
+
- `current.checkpoint`
|
|
475
|
+
- `current.model`
|
|
476
|
+
- `current.huggingface_hub`
|
|
477
|
+
|
|
478
|
+
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
|
|
479
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
480
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
481
|
+
|
|
482
|
+
temp_dir_root : str, default: None
|
|
483
|
+
The root directory under which `current.model.loaded` will store loaded models
|
|
423
484
|
"""
|
|
424
485
|
...
|
|
425
486
|
|
|
@@ -443,198 +504,115 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
|
443
504
|
...
|
|
444
505
|
|
|
445
506
|
@typing.overload
|
|
446
|
-
def
|
|
507
|
+
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]]]:
|
|
447
508
|
"""
|
|
448
|
-
Specifies the
|
|
449
|
-
|
|
450
|
-
Use `@resources` to specify the resource requirements
|
|
451
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
509
|
+
Specifies that the step will success under all circumstances.
|
|
452
510
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
or
|
|
458
|
-
```
|
|
459
|
-
python myflow.py run --with kubernetes
|
|
460
|
-
```
|
|
461
|
-
which executes the flow on the desired system using the
|
|
462
|
-
requirements specified in `@resources`.
|
|
511
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
512
|
+
contains the exception raised. You can use it to detect the presence
|
|
513
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
514
|
+
are missing.
|
|
463
515
|
|
|
464
516
|
|
|
465
517
|
Parameters
|
|
466
518
|
----------
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
memory : int, default 4096
|
|
474
|
-
Memory size (in MB) required for this step.
|
|
475
|
-
shared_memory : int, optional, default None
|
|
476
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
477
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
519
|
+
var : str, optional, default None
|
|
520
|
+
Name of the artifact in which to store the caught exception.
|
|
521
|
+
If not specified, the exception is not stored.
|
|
522
|
+
print_exception : bool, default True
|
|
523
|
+
Determines whether or not the exception is printed to
|
|
524
|
+
stdout when caught.
|
|
478
525
|
"""
|
|
479
526
|
...
|
|
480
527
|
|
|
481
528
|
@typing.overload
|
|
482
|
-
def
|
|
529
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
483
530
|
...
|
|
484
531
|
|
|
485
532
|
@typing.overload
|
|
486
|
-
def
|
|
533
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
487
534
|
...
|
|
488
535
|
|
|
489
|
-
def
|
|
536
|
+
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):
|
|
490
537
|
"""
|
|
491
|
-
Specifies the
|
|
492
|
-
|
|
493
|
-
Use `@resources` to specify the resource requirements
|
|
494
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
538
|
+
Specifies that the step will success under all circumstances.
|
|
495
539
|
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
or
|
|
501
|
-
```
|
|
502
|
-
python myflow.py run --with kubernetes
|
|
503
|
-
```
|
|
504
|
-
which executes the flow on the desired system using the
|
|
505
|
-
requirements specified in `@resources`.
|
|
540
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
541
|
+
contains the exception raised. You can use it to detect the presence
|
|
542
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
543
|
+
are missing.
|
|
506
544
|
|
|
507
545
|
|
|
508
546
|
Parameters
|
|
509
547
|
----------
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
memory : int, default 4096
|
|
517
|
-
Memory size (in MB) required for this step.
|
|
518
|
-
shared_memory : int, optional, default None
|
|
519
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
520
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
548
|
+
var : str, optional, default None
|
|
549
|
+
Name of the artifact in which to store the caught exception.
|
|
550
|
+
If not specified, the exception is not stored.
|
|
551
|
+
print_exception : bool, default True
|
|
552
|
+
Determines whether or not the exception is printed to
|
|
553
|
+
stdout when caught.
|
|
521
554
|
"""
|
|
522
555
|
...
|
|
523
556
|
|
|
524
|
-
def
|
|
557
|
+
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]]]:
|
|
525
558
|
"""
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
User code call
|
|
529
|
-
--------------
|
|
530
|
-
@ollama(
|
|
531
|
-
models=[...],
|
|
532
|
-
...
|
|
533
|
-
)
|
|
534
|
-
|
|
535
|
-
Valid backend options
|
|
536
|
-
---------------------
|
|
537
|
-
- 'local': Run as a separate process on the local task machine.
|
|
538
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
539
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
540
|
-
|
|
541
|
-
Valid model options
|
|
542
|
-
-------------------
|
|
543
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
559
|
+
Specifies that this step should execute on DGX cloud.
|
|
544
560
|
|
|
545
561
|
|
|
546
562
|
Parameters
|
|
547
563
|
----------
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
force_pull: bool
|
|
553
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
554
|
-
cache_update_policy: str
|
|
555
|
-
Cache update policy: "auto", "force", or "never".
|
|
556
|
-
force_cache_update: bool
|
|
557
|
-
Simple override for "force" cache update policy.
|
|
558
|
-
debug: bool
|
|
559
|
-
Whether to turn on verbose debugging logs.
|
|
560
|
-
circuit_breaker_config: dict
|
|
561
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
562
|
-
timeout_config: dict
|
|
563
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
564
|
+
gpu : int
|
|
565
|
+
Number of GPUs to use.
|
|
566
|
+
gpu_type : str
|
|
567
|
+
Type of Nvidia GPU to use.
|
|
564
568
|
"""
|
|
565
569
|
...
|
|
566
570
|
|
|
567
|
-
|
|
571
|
+
@typing.overload
|
|
572
|
+
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
568
573
|
"""
|
|
569
|
-
|
|
574
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
570
575
|
|
|
571
576
|
|
|
572
577
|
Parameters
|
|
573
578
|
----------
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
|
578
|
-
The list of repos (models/datasets) to load.
|
|
579
|
-
|
|
580
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
|
581
|
-
|
|
582
|
-
- If repo (model/dataset) is not found in the datastore:
|
|
583
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
|
584
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
|
585
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
|
586
|
-
|
|
587
|
-
- If repo is found in the datastore:
|
|
588
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
|
579
|
+
vars : Dict[str, str], default {}
|
|
580
|
+
Dictionary of environment variables to set.
|
|
589
581
|
"""
|
|
590
582
|
...
|
|
591
583
|
|
|
592
584
|
@typing.overload
|
|
593
|
-
def
|
|
585
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
586
|
+
...
|
|
587
|
+
|
|
588
|
+
@typing.overload
|
|
589
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
590
|
+
...
|
|
591
|
+
|
|
592
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
594
593
|
"""
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
594
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
598
595
|
|
|
599
596
|
|
|
600
597
|
Parameters
|
|
601
598
|
----------
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
id : str, optional, default None
|
|
605
|
-
If multiple cards are present, use this id to identify this card.
|
|
606
|
-
options : Dict[str, Any], default {}
|
|
607
|
-
Options passed to the card. The contents depend on the card type.
|
|
608
|
-
timeout : int, default 45
|
|
609
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
599
|
+
vars : Dict[str, str], default {}
|
|
600
|
+
Dictionary of environment variables to set.
|
|
610
601
|
"""
|
|
611
602
|
...
|
|
612
603
|
|
|
613
|
-
|
|
614
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
615
|
-
...
|
|
616
|
-
|
|
617
|
-
@typing.overload
|
|
618
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
619
|
-
...
|
|
620
|
-
|
|
621
|
-
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):
|
|
604
|
+
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]]]:
|
|
622
605
|
"""
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
606
|
+
Specifies that this step is used to deploy an instance of the app.
|
|
607
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
|
626
608
|
|
|
627
609
|
|
|
628
610
|
Parameters
|
|
629
611
|
----------
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
options : Dict[str, Any], default {}
|
|
635
|
-
Options passed to the card. The contents depend on the card type.
|
|
636
|
-
timeout : int, default 45
|
|
637
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
612
|
+
app_port : int
|
|
613
|
+
Number of GPUs to use.
|
|
614
|
+
app_name : str
|
|
615
|
+
Name of the app to deploy.
|
|
638
616
|
"""
|
|
639
617
|
...
|
|
640
618
|
|
|
@@ -689,132 +667,146 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
|
689
667
|
"""
|
|
690
668
|
...
|
|
691
669
|
|
|
692
|
-
def
|
|
693
|
-
"""
|
|
694
|
-
Specifies that this step is used to deploy an instance of the app.
|
|
695
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
Parameters
|
|
699
|
-
----------
|
|
700
|
-
app_port : int
|
|
701
|
-
Number of GPUs to use.
|
|
702
|
-
app_name : str
|
|
703
|
-
Name of the app to deploy.
|
|
704
|
-
"""
|
|
705
|
-
...
|
|
706
|
-
|
|
707
|
-
@typing.overload
|
|
708
|
-
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]]]:
|
|
670
|
+
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]]]:
|
|
709
671
|
"""
|
|
710
|
-
|
|
672
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
|
711
673
|
|
|
712
|
-
|
|
674
|
+
User code call
|
|
675
|
+
--------------
|
|
676
|
+
@ollama(
|
|
677
|
+
models=[...],
|
|
678
|
+
...
|
|
679
|
+
)
|
|
713
680
|
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
681
|
+
Valid backend options
|
|
682
|
+
---------------------
|
|
683
|
+
- 'local': Run as a separate process on the local task machine.
|
|
684
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
685
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
717
686
|
|
|
718
|
-
|
|
719
|
-
|
|
687
|
+
Valid model options
|
|
688
|
+
-------------------
|
|
689
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
720
690
|
|
|
721
691
|
|
|
722
692
|
Parameters
|
|
723
693
|
----------
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
694
|
+
models: list[str]
|
|
695
|
+
List of Ollama containers running models in sidecars.
|
|
696
|
+
backend: str
|
|
697
|
+
Determines where and how to run the Ollama process.
|
|
698
|
+
force_pull: bool
|
|
699
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
700
|
+
cache_update_policy: str
|
|
701
|
+
Cache update policy: "auto", "force", or "never".
|
|
702
|
+
force_cache_update: bool
|
|
703
|
+
Simple override for "force" cache update policy.
|
|
704
|
+
debug: bool
|
|
705
|
+
Whether to turn on verbose debugging logs.
|
|
706
|
+
circuit_breaker_config: dict
|
|
707
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
708
|
+
timeout_config: dict
|
|
709
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
710
|
+
"""
|
|
711
|
+
...
|
|
712
|
+
|
|
713
|
+
def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
714
|
+
"""
|
|
715
|
+
Specifies that this step should execute on DGX cloud.
|
|
716
|
+
|
|
717
|
+
|
|
718
|
+
Parameters
|
|
719
|
+
----------
|
|
720
|
+
gpu : int
|
|
721
|
+
Number of GPUs to use.
|
|
722
|
+
gpu_type : str
|
|
723
|
+
Type of Nvidia GPU to use.
|
|
724
|
+
queue_timeout : int
|
|
725
|
+
Time to keep the job in NVCF's queue.
|
|
730
726
|
"""
|
|
731
727
|
...
|
|
732
728
|
|
|
733
729
|
@typing.overload
|
|
734
|
-
def
|
|
730
|
+
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]]]:
|
|
731
|
+
"""
|
|
732
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
733
|
+
the execution of a step.
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
Parameters
|
|
737
|
+
----------
|
|
738
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
739
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
740
|
+
"""
|
|
735
741
|
...
|
|
736
742
|
|
|
737
743
|
@typing.overload
|
|
738
|
-
def
|
|
744
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
739
745
|
...
|
|
740
746
|
|
|
741
|
-
|
|
747
|
+
@typing.overload
|
|
748
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
749
|
+
...
|
|
750
|
+
|
|
751
|
+
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]]] = []):
|
|
742
752
|
"""
|
|
743
|
-
Specifies
|
|
744
|
-
|
|
745
|
-
This decorator is useful if this step may hang indefinitely.
|
|
746
|
-
|
|
747
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
748
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
749
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
750
|
-
|
|
751
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
752
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
753
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
754
|
+
the execution of a step.
|
|
753
755
|
|
|
754
756
|
|
|
755
757
|
Parameters
|
|
756
758
|
----------
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
minutes : int, default 0
|
|
760
|
-
Number of minutes to wait prior to timing out.
|
|
761
|
-
hours : int, default 0
|
|
762
|
-
Number of hours to wait prior to timing out.
|
|
759
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
760
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
763
761
|
"""
|
|
764
762
|
...
|
|
765
763
|
|
|
766
764
|
@typing.overload
|
|
767
|
-
def
|
|
765
|
+
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]]]:
|
|
768
766
|
"""
|
|
769
|
-
|
|
770
|
-
to a step needs to be retried.
|
|
771
|
-
|
|
772
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
773
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
774
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
767
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
775
768
|
|
|
776
|
-
|
|
777
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
778
|
-
ensuring that the flow execution can continue.
|
|
769
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
779
770
|
|
|
780
771
|
|
|
781
772
|
Parameters
|
|
782
773
|
----------
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
774
|
+
type : str, default 'default'
|
|
775
|
+
Card type.
|
|
776
|
+
id : str, optional, default None
|
|
777
|
+
If multiple cards are present, use this id to identify this card.
|
|
778
|
+
options : Dict[str, Any], default {}
|
|
779
|
+
Options passed to the card. The contents depend on the card type.
|
|
780
|
+
timeout : int, default 45
|
|
781
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
787
782
|
"""
|
|
788
783
|
...
|
|
789
784
|
|
|
790
785
|
@typing.overload
|
|
791
|
-
def
|
|
786
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
792
787
|
...
|
|
793
788
|
|
|
794
789
|
@typing.overload
|
|
795
|
-
def
|
|
790
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
796
791
|
...
|
|
797
792
|
|
|
798
|
-
def
|
|
793
|
+
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):
|
|
799
794
|
"""
|
|
800
|
-
|
|
801
|
-
to a step needs to be retried.
|
|
802
|
-
|
|
803
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
804
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
805
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
795
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
806
796
|
|
|
807
|
-
|
|
808
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
809
|
-
ensuring that the flow execution can continue.
|
|
797
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
810
798
|
|
|
811
799
|
|
|
812
800
|
Parameters
|
|
813
801
|
----------
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
802
|
+
type : str, default 'default'
|
|
803
|
+
Card type.
|
|
804
|
+
id : str, optional, default None
|
|
805
|
+
If multiple cards are present, use this id to identify this card.
|
|
806
|
+
options : Dict[str, Any], default {}
|
|
807
|
+
Options passed to the card. The contents depend on the card type.
|
|
808
|
+
timeout : int, default 45
|
|
809
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
818
810
|
"""
|
|
819
811
|
...
|
|
820
812
|
|
|
@@ -908,176 +900,88 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
|
908
900
|
...
|
|
909
901
|
|
|
910
902
|
@typing.overload
|
|
911
|
-
def
|
|
912
|
-
"""
|
|
913
|
-
Enables checkpointing for a step.
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
Parameters
|
|
918
|
-
----------
|
|
919
|
-
load_policy : str, default: "fresh"
|
|
920
|
-
The policy for loading the checkpoint. The following policies are supported:
|
|
921
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
922
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
923
|
-
will be loaded at the start of the task.
|
|
924
|
-
- "none": Do not load any checkpoint
|
|
925
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
926
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
927
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
928
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
929
|
-
|
|
930
|
-
temp_dir_root : str, default: None
|
|
931
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
932
|
-
"""
|
|
933
|
-
...
|
|
934
|
-
|
|
935
|
-
@typing.overload
|
|
936
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
937
|
-
...
|
|
938
|
-
|
|
939
|
-
@typing.overload
|
|
940
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
941
|
-
...
|
|
942
|
-
|
|
943
|
-
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
|
944
|
-
"""
|
|
945
|
-
Enables checkpointing for a step.
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
Parameters
|
|
950
|
-
----------
|
|
951
|
-
load_policy : str, default: "fresh"
|
|
952
|
-
The policy for loading the checkpoint. The following policies are supported:
|
|
953
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
954
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
955
|
-
will be loaded at the start of the task.
|
|
956
|
-
- "none": Do not load any checkpoint
|
|
957
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
958
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
959
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
960
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
961
|
-
|
|
962
|
-
temp_dir_root : str, default: None
|
|
963
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
964
|
-
"""
|
|
965
|
-
...
|
|
966
|
-
|
|
967
|
-
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]]]:
|
|
968
|
-
"""
|
|
969
|
-
Specifies that this step should execute on DGX cloud.
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
Parameters
|
|
973
|
-
----------
|
|
974
|
-
gpu : int
|
|
975
|
-
Number of GPUs to use.
|
|
976
|
-
gpu_type : str
|
|
977
|
-
Type of Nvidia GPU to use.
|
|
978
|
-
"""
|
|
979
|
-
...
|
|
980
|
-
|
|
981
|
-
@typing.overload
|
|
982
|
-
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
903
|
+
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]]]:
|
|
983
904
|
"""
|
|
984
|
-
Specifies the
|
|
905
|
+
Specifies the resources needed when executing this step.
|
|
985
906
|
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
```
|
|
989
|
-
or
|
|
990
|
-
```
|
|
991
|
-
@trigger(events=['foo', 'bar'])
|
|
992
|
-
```
|
|
907
|
+
Use `@resources` to specify the resource requirements
|
|
908
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
993
909
|
|
|
994
|
-
|
|
995
|
-
to map event payload to Metaflow parameters for the flow.
|
|
910
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
996
911
|
```
|
|
997
|
-
|
|
912
|
+
python myflow.py run --with batch
|
|
998
913
|
```
|
|
999
914
|
or
|
|
1000
915
|
```
|
|
1001
|
-
|
|
1002
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1003
|
-
```
|
|
1004
|
-
|
|
1005
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
1006
|
-
```
|
|
1007
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1008
|
-
```
|
|
1009
|
-
This is equivalent to:
|
|
1010
|
-
```
|
|
1011
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
916
|
+
python myflow.py run --with kubernetes
|
|
1012
917
|
```
|
|
918
|
+
which executes the flow on the desired system using the
|
|
919
|
+
requirements specified in `@resources`.
|
|
1013
920
|
|
|
1014
921
|
|
|
1015
922
|
Parameters
|
|
1016
923
|
----------
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
924
|
+
cpu : int, default 1
|
|
925
|
+
Number of CPUs required for this step.
|
|
926
|
+
gpu : int, optional, default None
|
|
927
|
+
Number of GPUs required for this step.
|
|
928
|
+
disk : int, optional, default None
|
|
929
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
930
|
+
memory : int, default 4096
|
|
931
|
+
Memory size (in MB) required for this step.
|
|
932
|
+
shared_memory : int, optional, default None
|
|
933
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
934
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
1023
935
|
"""
|
|
1024
936
|
...
|
|
1025
937
|
|
|
1026
938
|
@typing.overload
|
|
1027
|
-
def
|
|
939
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1028
940
|
...
|
|
1029
941
|
|
|
1030
|
-
|
|
942
|
+
@typing.overload
|
|
943
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
944
|
+
...
|
|
945
|
+
|
|
946
|
+
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):
|
|
1031
947
|
"""
|
|
1032
|
-
Specifies the
|
|
948
|
+
Specifies the resources needed when executing this step.
|
|
1033
949
|
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
```
|
|
1037
|
-
or
|
|
1038
|
-
```
|
|
1039
|
-
@trigger(events=['foo', 'bar'])
|
|
1040
|
-
```
|
|
950
|
+
Use `@resources` to specify the resource requirements
|
|
951
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
1041
952
|
|
|
1042
|
-
|
|
1043
|
-
to map event payload to Metaflow parameters for the flow.
|
|
953
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
1044
954
|
```
|
|
1045
|
-
|
|
955
|
+
python myflow.py run --with batch
|
|
1046
956
|
```
|
|
1047
957
|
or
|
|
1048
958
|
```
|
|
1049
|
-
|
|
1050
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1051
|
-
```
|
|
1052
|
-
|
|
1053
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
1054
|
-
```
|
|
1055
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1056
|
-
```
|
|
1057
|
-
This is equivalent to:
|
|
1058
|
-
```
|
|
1059
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
959
|
+
python myflow.py run --with kubernetes
|
|
1060
960
|
```
|
|
961
|
+
which executes the flow on the desired system using the
|
|
962
|
+
requirements specified in `@resources`.
|
|
1061
963
|
|
|
1062
964
|
|
|
1063
965
|
Parameters
|
|
1064
966
|
----------
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
967
|
+
cpu : int, default 1
|
|
968
|
+
Number of CPUs required for this step.
|
|
969
|
+
gpu : int, optional, default None
|
|
970
|
+
Number of GPUs required for this step.
|
|
971
|
+
disk : int, optional, default None
|
|
972
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
973
|
+
memory : int, default 4096
|
|
974
|
+
Memory size (in MB) required for this step.
|
|
975
|
+
shared_memory : int, optional, default None
|
|
976
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
977
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
1071
978
|
"""
|
|
1072
979
|
...
|
|
1073
980
|
|
|
1074
|
-
def
|
|
981
|
+
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]]:
|
|
1075
982
|
"""
|
|
1076
|
-
The `@
|
|
1077
|
-
|
|
1078
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1079
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1080
|
-
starts only after all sensors finish.
|
|
983
|
+
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.
|
|
984
|
+
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.
|
|
1081
985
|
|
|
1082
986
|
|
|
1083
987
|
Parameters
|
|
@@ -1099,18 +1003,21 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
|
1099
1003
|
Name of the sensor on Airflow
|
|
1100
1004
|
description : str
|
|
1101
1005
|
Description of sensor in the Airflow UI
|
|
1102
|
-
|
|
1103
|
-
The
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1006
|
+
external_dag_id : str
|
|
1007
|
+
The dag_id that contains the task you want to wait for.
|
|
1008
|
+
external_task_ids : List[str]
|
|
1009
|
+
The list of task_ids that you want to wait for.
|
|
1010
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1011
|
+
allowed_states : List[str]
|
|
1012
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1013
|
+
failed_states : List[str]
|
|
1014
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1015
|
+
execution_delta : datetime.timedelta
|
|
1016
|
+
time difference with the previous execution to look at,
|
|
1017
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1018
|
+
check_existence: bool
|
|
1019
|
+
Set to True to check if the external task exists or check if
|
|
1020
|
+
the DAG to wait for exists. (Default: True)
|
|
1114
1021
|
"""
|
|
1115
1022
|
...
|
|
1116
1023
|
|
|
@@ -1155,132 +1062,147 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
|
1155
1062
|
"""
|
|
1156
1063
|
...
|
|
1157
1064
|
|
|
1158
|
-
|
|
1065
|
+
@typing.overload
|
|
1066
|
+
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]]:
|
|
1159
1067
|
"""
|
|
1160
|
-
|
|
1161
|
-
|
|
1068
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1069
|
+
|
|
1070
|
+
Use `@conda_base` to set common libraries required by all
|
|
1071
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1162
1072
|
|
|
1163
1073
|
|
|
1164
1074
|
Parameters
|
|
1165
1075
|
----------
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1177
|
-
soft_fail : bool
|
|
1178
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1179
|
-
name : str
|
|
1180
|
-
Name of the sensor on Airflow
|
|
1181
|
-
description : str
|
|
1182
|
-
Description of sensor in the Airflow UI
|
|
1183
|
-
external_dag_id : str
|
|
1184
|
-
The dag_id that contains the task you want to wait for.
|
|
1185
|
-
external_task_ids : List[str]
|
|
1186
|
-
The list of task_ids that you want to wait for.
|
|
1187
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1188
|
-
allowed_states : List[str]
|
|
1189
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1190
|
-
failed_states : List[str]
|
|
1191
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1192
|
-
execution_delta : datetime.timedelta
|
|
1193
|
-
time difference with the previous execution to look at,
|
|
1194
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1195
|
-
check_existence: bool
|
|
1196
|
-
Set to True to check if the external task exists or check if
|
|
1197
|
-
the DAG to wait for exists. (Default: True)
|
|
1076
|
+
packages : Dict[str, str], default {}
|
|
1077
|
+
Packages to use for this flow. The key is the name of the package
|
|
1078
|
+
and the value is the version to use.
|
|
1079
|
+
libraries : Dict[str, str], default {}
|
|
1080
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1081
|
+
python : str, optional, default None
|
|
1082
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1083
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1084
|
+
disabled : bool, default False
|
|
1085
|
+
If set to True, disables Conda.
|
|
1198
1086
|
"""
|
|
1199
1087
|
...
|
|
1200
1088
|
|
|
1201
|
-
|
|
1089
|
+
@typing.overload
|
|
1090
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1091
|
+
...
|
|
1092
|
+
|
|
1093
|
+
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):
|
|
1202
1094
|
"""
|
|
1203
|
-
Specifies
|
|
1095
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1204
1096
|
|
|
1205
|
-
|
|
1206
|
-
use
|
|
1097
|
+
Use `@conda_base` to set common libraries required by all
|
|
1098
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1207
1099
|
|
|
1208
1100
|
|
|
1209
1101
|
Parameters
|
|
1210
1102
|
----------
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
production : bool, default False
|
|
1223
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
1224
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
1225
|
-
`production` in the decorator and on the command line.
|
|
1226
|
-
The project branch name will be:
|
|
1227
|
-
- if `branch` is specified:
|
|
1228
|
-
- if `production` is True: `prod.<branch>`
|
|
1229
|
-
- if `production` is False: `test.<branch>`
|
|
1230
|
-
- if `branch` is not specified:
|
|
1231
|
-
- if `production` is True: `prod`
|
|
1232
|
-
- if `production` is False: `user.<username>`
|
|
1103
|
+
packages : Dict[str, str], default {}
|
|
1104
|
+
Packages to use for this flow. The key is the name of the package
|
|
1105
|
+
and the value is the version to use.
|
|
1106
|
+
libraries : Dict[str, str], default {}
|
|
1107
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1108
|
+
python : str, optional, default None
|
|
1109
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1110
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1111
|
+
disabled : bool, default False
|
|
1112
|
+
If set to True, disables Conda.
|
|
1233
1113
|
"""
|
|
1234
1114
|
...
|
|
1235
1115
|
|
|
1236
1116
|
@typing.overload
|
|
1237
|
-
def
|
|
1117
|
+
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1238
1118
|
"""
|
|
1239
|
-
Specifies the
|
|
1240
|
-
|
|
1119
|
+
Specifies the event(s) that this flow depends on.
|
|
1120
|
+
|
|
1121
|
+
```
|
|
1122
|
+
@trigger(event='foo')
|
|
1123
|
+
```
|
|
1124
|
+
or
|
|
1125
|
+
```
|
|
1126
|
+
@trigger(events=['foo', 'bar'])
|
|
1127
|
+
```
|
|
1128
|
+
|
|
1129
|
+
Additionally, you can specify the parameter mappings
|
|
1130
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1131
|
+
```
|
|
1132
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1133
|
+
```
|
|
1134
|
+
or
|
|
1135
|
+
```
|
|
1136
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1137
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1138
|
+
```
|
|
1139
|
+
|
|
1140
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1141
|
+
```
|
|
1142
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1143
|
+
```
|
|
1144
|
+
This is equivalent to:
|
|
1145
|
+
```
|
|
1146
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1147
|
+
```
|
|
1241
1148
|
|
|
1242
1149
|
|
|
1243
1150
|
Parameters
|
|
1244
1151
|
----------
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
cron : str, optional, default None
|
|
1252
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1253
|
-
specified by this expression.
|
|
1254
|
-
timezone : str, optional, default None
|
|
1255
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1256
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1152
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1153
|
+
Event dependency for this flow.
|
|
1154
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1155
|
+
Events dependency for this flow.
|
|
1156
|
+
options : Dict[str, Any], default {}
|
|
1157
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1257
1158
|
"""
|
|
1258
1159
|
...
|
|
1259
1160
|
|
|
1260
1161
|
@typing.overload
|
|
1261
|
-
def
|
|
1162
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1262
1163
|
...
|
|
1263
1164
|
|
|
1264
|
-
def
|
|
1165
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
1265
1166
|
"""
|
|
1266
|
-
Specifies the
|
|
1267
|
-
|
|
1167
|
+
Specifies the event(s) that this flow depends on.
|
|
1168
|
+
|
|
1169
|
+
```
|
|
1170
|
+
@trigger(event='foo')
|
|
1171
|
+
```
|
|
1172
|
+
or
|
|
1173
|
+
```
|
|
1174
|
+
@trigger(events=['foo', 'bar'])
|
|
1175
|
+
```
|
|
1176
|
+
|
|
1177
|
+
Additionally, you can specify the parameter mappings
|
|
1178
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1179
|
+
```
|
|
1180
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1181
|
+
```
|
|
1182
|
+
or
|
|
1183
|
+
```
|
|
1184
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1185
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1186
|
+
```
|
|
1187
|
+
|
|
1188
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1189
|
+
```
|
|
1190
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1191
|
+
```
|
|
1192
|
+
This is equivalent to:
|
|
1193
|
+
```
|
|
1194
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1195
|
+
```
|
|
1268
1196
|
|
|
1269
1197
|
|
|
1270
1198
|
Parameters
|
|
1271
1199
|
----------
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
cron : str, optional, default None
|
|
1279
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1280
|
-
specified by this expression.
|
|
1281
|
-
timezone : str, optional, default None
|
|
1282
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1283
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1200
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1201
|
+
Event dependency for this flow.
|
|
1202
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1203
|
+
Events dependency for this flow.
|
|
1204
|
+
options : Dict[str, Any], default {}
|
|
1205
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1284
1206
|
"""
|
|
1285
1207
|
...
|
|
1286
1208
|
|
|
@@ -1398,6 +1320,135 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
|
1398
1320
|
"""
|
|
1399
1321
|
...
|
|
1400
1322
|
|
|
1323
|
+
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]]:
|
|
1324
|
+
"""
|
|
1325
|
+
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)
|
|
1326
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1327
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1328
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1329
|
+
starts only after all sensors finish.
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
Parameters
|
|
1333
|
+
----------
|
|
1334
|
+
timeout : int
|
|
1335
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1336
|
+
poke_interval : int
|
|
1337
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1338
|
+
mode : str
|
|
1339
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1340
|
+
exponential_backoff : bool
|
|
1341
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1342
|
+
pool : str
|
|
1343
|
+
the slot pool this task should run in,
|
|
1344
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1345
|
+
soft_fail : bool
|
|
1346
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1347
|
+
name : str
|
|
1348
|
+
Name of the sensor on Airflow
|
|
1349
|
+
description : str
|
|
1350
|
+
Description of sensor in the Airflow UI
|
|
1351
|
+
bucket_key : Union[str, List[str]]
|
|
1352
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1353
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1354
|
+
bucket_name : str
|
|
1355
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1356
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1357
|
+
wildcard_match : bool
|
|
1358
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1359
|
+
aws_conn_id : str
|
|
1360
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1361
|
+
verify : bool
|
|
1362
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1363
|
+
"""
|
|
1364
|
+
...
|
|
1365
|
+
|
|
1366
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1367
|
+
"""
|
|
1368
|
+
Specifies what flows belong to the same project.
|
|
1369
|
+
|
|
1370
|
+
A project-specific namespace is created for all flows that
|
|
1371
|
+
use the same `@project(name)`.
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
Parameters
|
|
1375
|
+
----------
|
|
1376
|
+
name : str
|
|
1377
|
+
Project name. Make sure that the name is unique amongst all
|
|
1378
|
+
projects that use the same production scheduler. The name may
|
|
1379
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1380
|
+
|
|
1381
|
+
branch : Optional[str], default None
|
|
1382
|
+
The branch to use. If not specified, the branch is set to
|
|
1383
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1384
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1385
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1386
|
+
|
|
1387
|
+
production : bool, default False
|
|
1388
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1389
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1390
|
+
`production` in the decorator and on the command line.
|
|
1391
|
+
The project branch name will be:
|
|
1392
|
+
- if `branch` is specified:
|
|
1393
|
+
- if `production` is True: `prod.<branch>`
|
|
1394
|
+
- if `production` is False: `test.<branch>`
|
|
1395
|
+
- if `branch` is not specified:
|
|
1396
|
+
- if `production` is True: `prod`
|
|
1397
|
+
- if `production` is False: `user.<username>`
|
|
1398
|
+
"""
|
|
1399
|
+
...
|
|
1400
|
+
|
|
1401
|
+
@typing.overload
|
|
1402
|
+
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]]:
|
|
1403
|
+
"""
|
|
1404
|
+
Specifies the times when the flow should be run when running on a
|
|
1405
|
+
production scheduler.
|
|
1406
|
+
|
|
1407
|
+
|
|
1408
|
+
Parameters
|
|
1409
|
+
----------
|
|
1410
|
+
hourly : bool, default False
|
|
1411
|
+
Run the workflow hourly.
|
|
1412
|
+
daily : bool, default True
|
|
1413
|
+
Run the workflow daily.
|
|
1414
|
+
weekly : bool, default False
|
|
1415
|
+
Run the workflow weekly.
|
|
1416
|
+
cron : str, optional, default None
|
|
1417
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1418
|
+
specified by this expression.
|
|
1419
|
+
timezone : str, optional, default None
|
|
1420
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1421
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1422
|
+
"""
|
|
1423
|
+
...
|
|
1424
|
+
|
|
1425
|
+
@typing.overload
|
|
1426
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1427
|
+
...
|
|
1428
|
+
|
|
1429
|
+
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):
|
|
1430
|
+
"""
|
|
1431
|
+
Specifies the times when the flow should be run when running on a
|
|
1432
|
+
production scheduler.
|
|
1433
|
+
|
|
1434
|
+
|
|
1435
|
+
Parameters
|
|
1436
|
+
----------
|
|
1437
|
+
hourly : bool, default False
|
|
1438
|
+
Run the workflow hourly.
|
|
1439
|
+
daily : bool, default True
|
|
1440
|
+
Run the workflow daily.
|
|
1441
|
+
weekly : bool, default False
|
|
1442
|
+
Run the workflow weekly.
|
|
1443
|
+
cron : str, optional, default None
|
|
1444
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1445
|
+
specified by this expression.
|
|
1446
|
+
timezone : str, optional, default None
|
|
1447
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1448
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1449
|
+
"""
|
|
1450
|
+
...
|
|
1451
|
+
|
|
1401
1452
|
@typing.overload
|
|
1402
1453
|
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1403
1454
|
"""
|
|
@@ -1499,56 +1550,5 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
|
1499
1550
|
"""
|
|
1500
1551
|
...
|
|
1501
1552
|
|
|
1502
|
-
@typing.overload
|
|
1503
|
-
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]]:
|
|
1504
|
-
"""
|
|
1505
|
-
Specifies the Conda environment for all steps of the flow.
|
|
1506
|
-
|
|
1507
|
-
Use `@conda_base` to set common libraries required by all
|
|
1508
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
Parameters
|
|
1512
|
-
----------
|
|
1513
|
-
packages : Dict[str, str], default {}
|
|
1514
|
-
Packages to use for this flow. The key is the name of the package
|
|
1515
|
-
and the value is the version to use.
|
|
1516
|
-
libraries : Dict[str, str], default {}
|
|
1517
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1518
|
-
python : str, optional, default None
|
|
1519
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1520
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1521
|
-
disabled : bool, default False
|
|
1522
|
-
If set to True, disables Conda.
|
|
1523
|
-
"""
|
|
1524
|
-
...
|
|
1525
|
-
|
|
1526
|
-
@typing.overload
|
|
1527
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1528
|
-
...
|
|
1529
|
-
|
|
1530
|
-
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):
|
|
1531
|
-
"""
|
|
1532
|
-
Specifies the Conda environment for all steps of the flow.
|
|
1533
|
-
|
|
1534
|
-
Use `@conda_base` to set common libraries required by all
|
|
1535
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
Parameters
|
|
1539
|
-
----------
|
|
1540
|
-
packages : Dict[str, str], default {}
|
|
1541
|
-
Packages to use for this flow. The key is the name of the package
|
|
1542
|
-
and the value is the version to use.
|
|
1543
|
-
libraries : Dict[str, str], default {}
|
|
1544
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1545
|
-
python : str, optional, default None
|
|
1546
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1547
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1548
|
-
disabled : bool, default False
|
|
1549
|
-
If set to True, disables Conda.
|
|
1550
|
-
"""
|
|
1551
|
-
...
|
|
1552
|
-
|
|
1553
1553
|
pkg_name: str
|
|
1554
1554
|
|