ob-metaflow-stubs 6.0.3.182rc2__py2.py3-none-any.whl → 6.0.3.183__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 +728 -728
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -4
- metaflow-stubs/metaflow_current.pyi +91 -91
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/ob_internal.pyi +2 -3
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +13 -13
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +4 -4
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -4
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +5 -5
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +7 -7
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +5 -5
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +4 -4
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.3.182rc2.dist-info → ob_metaflow_stubs-6.0.3.183.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.183.dist-info/RECORD +216 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +0 -6
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +0 -51
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +0 -65
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +0 -74
- ob_metaflow_stubs-6.0.3.182rc2.dist-info/RECORD +0 -220
- {ob_metaflow_stubs-6.0.3.182rc2.dist-info → ob_metaflow_stubs-6.0.3.183.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.182rc2.dist-info → ob_metaflow_stubs-6.0.3.183.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.15.
|
4
|
-
# Generated on 2025-06-
|
3
|
+
# MF version: 2.15.18.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
+
# Generated on 2025-06-25T00:26:31.628989 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import typing
|
12
11
|
import datetime
|
12
|
+
import typing
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -35,18 +35,18 @@ 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 tuple_util as tuple_util
|
39
38
|
from . import cards as cards
|
40
39
|
from . import events as events
|
40
|
+
from . import tuple_util as tuple_util
|
41
41
|
from . import metaflow_git as metaflow_git
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
48
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
47
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
48
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -155,265 +155,72 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
155
155
|
"""
|
156
156
|
...
|
157
157
|
|
158
|
-
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]]]:
|
159
|
-
"""
|
160
|
-
Specifies that this step is used to deploy an instance of the app.
|
161
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
162
|
-
|
163
|
-
|
164
|
-
Parameters
|
165
|
-
----------
|
166
|
-
app_port : int
|
167
|
-
Number of GPUs to use.
|
168
|
-
app_name : str
|
169
|
-
Name of the app to deploy.
|
170
|
-
"""
|
171
|
-
...
|
172
|
-
|
173
|
-
@typing.overload
|
174
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
175
|
-
"""
|
176
|
-
Decorator prototype for all step decorators. This function gets specialized
|
177
|
-
and imported for all decorators types by _import_plugin_decorators().
|
178
|
-
"""
|
179
|
-
...
|
180
|
-
|
181
|
-
@typing.overload
|
182
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
183
|
-
...
|
184
|
-
|
185
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
186
|
-
"""
|
187
|
-
Decorator prototype for all step decorators. This function gets specialized
|
188
|
-
and imported for all decorators types by _import_plugin_decorators().
|
189
|
-
"""
|
190
|
-
...
|
191
|
-
|
192
158
|
@typing.overload
|
193
|
-
def
|
159
|
+
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]]]:
|
194
160
|
"""
|
195
|
-
|
196
|
-
|
161
|
+
Specifies environment variables to be set prior to the execution of a step.
|
197
162
|
|
198
163
|
|
199
164
|
Parameters
|
200
165
|
----------
|
201
|
-
|
202
|
-
|
203
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
204
|
-
- `current.checkpoint`
|
205
|
-
- `current.model`
|
206
|
-
- `current.huggingface_hub`
|
207
|
-
|
208
|
-
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
|
209
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
210
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
211
|
-
|
212
|
-
temp_dir_root : str, default: None
|
213
|
-
The root directory under which `current.model.loaded` will store loaded models
|
166
|
+
vars : Dict[str, str], default {}
|
167
|
+
Dictionary of environment variables to set.
|
214
168
|
"""
|
215
169
|
...
|
216
170
|
|
217
171
|
@typing.overload
|
218
|
-
def
|
172
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
219
173
|
...
|
220
174
|
|
221
175
|
@typing.overload
|
222
|
-
def
|
223
|
-
...
|
224
|
-
|
225
|
-
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):
|
226
|
-
"""
|
227
|
-
Enables loading / saving of models within a step.
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
Parameters
|
232
|
-
----------
|
233
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
234
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
235
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
236
|
-
- `current.checkpoint`
|
237
|
-
- `current.model`
|
238
|
-
- `current.huggingface_hub`
|
239
|
-
|
240
|
-
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
|
241
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
242
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
243
|
-
|
244
|
-
temp_dir_root : str, default: None
|
245
|
-
The root directory under which `current.model.loaded` will store loaded models
|
246
|
-
"""
|
176
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
247
177
|
...
|
248
178
|
|
249
|
-
def
|
179
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
250
180
|
"""
|
251
|
-
Specifies
|
181
|
+
Specifies environment variables to be set prior to the execution of a step.
|
252
182
|
|
253
183
|
|
254
184
|
Parameters
|
255
185
|
----------
|
256
|
-
|
257
|
-
|
258
|
-
gpu_type : str
|
259
|
-
Type of Nvidia GPU to use.
|
260
|
-
queue_timeout : int
|
261
|
-
Time to keep the job in NVCF's queue.
|
186
|
+
vars : Dict[str, str], default {}
|
187
|
+
Dictionary of environment variables to set.
|
262
188
|
"""
|
263
189
|
...
|
264
190
|
|
265
191
|
@typing.overload
|
266
|
-
def
|
192
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
267
193
|
"""
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
Parameters
|
273
|
-
----------
|
274
|
-
load_policy : str, default: "fresh"
|
275
|
-
The policy for loading the checkpoint. The following policies are supported:
|
276
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
277
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
278
|
-
will be loaded at the start of the task.
|
279
|
-
- "none": Do not load any checkpoint
|
280
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
281
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
282
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
283
|
-
created within the task will be loaded when the task is retries execution on failure.
|
284
|
-
|
285
|
-
temp_dir_root : str, default: None
|
286
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
194
|
+
Decorator prototype for all step decorators. This function gets specialized
|
195
|
+
and imported for all decorators types by _import_plugin_decorators().
|
287
196
|
"""
|
288
197
|
...
|
289
198
|
|
290
199
|
@typing.overload
|
291
|
-
def
|
292
|
-
...
|
293
|
-
|
294
|
-
@typing.overload
|
295
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
296
|
-
...
|
297
|
-
|
298
|
-
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):
|
299
|
-
"""
|
300
|
-
Enables checkpointing for a step.
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
Parameters
|
305
|
-
----------
|
306
|
-
load_policy : str, default: "fresh"
|
307
|
-
The policy for loading the checkpoint. The following policies are supported:
|
308
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
309
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
310
|
-
will be loaded at the start of the task.
|
311
|
-
- "none": Do not load any checkpoint
|
312
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
313
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
314
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
315
|
-
created within the task will be loaded when the task is retries execution on failure.
|
316
|
-
|
317
|
-
temp_dir_root : str, default: None
|
318
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
319
|
-
"""
|
320
|
-
...
|
321
|
-
|
322
|
-
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]]]:
|
323
|
-
"""
|
324
|
-
Specifies that this step should execute on DGX cloud.
|
325
|
-
|
326
|
-
|
327
|
-
Parameters
|
328
|
-
----------
|
329
|
-
gpu : int
|
330
|
-
Number of GPUs to use.
|
331
|
-
gpu_type : str
|
332
|
-
Type of Nvidia GPU to use.
|
333
|
-
"""
|
200
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
334
201
|
...
|
335
202
|
|
336
|
-
def
|
203
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
337
204
|
"""
|
338
|
-
Decorator
|
339
|
-
|
340
|
-
|
341
|
-
Parameters
|
342
|
-
----------
|
343
|
-
temp_dir_root : str, optional
|
344
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
345
|
-
|
346
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
347
|
-
The list of repos (models/datasets) to load.
|
348
|
-
|
349
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
350
|
-
|
351
|
-
- If repo (model/dataset) is not found in the datastore:
|
352
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
353
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
354
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
355
|
-
|
356
|
-
- If repo is found in the datastore:
|
357
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
205
|
+
Decorator prototype for all step decorators. This function gets specialized
|
206
|
+
and imported for all decorators types by _import_plugin_decorators().
|
358
207
|
"""
|
359
208
|
...
|
360
209
|
|
361
210
|
@typing.overload
|
362
|
-
def
|
211
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
363
212
|
"""
|
364
|
-
|
365
|
-
|
366
|
-
This decorator is useful if this step may hang indefinitely.
|
367
|
-
|
368
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
369
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
370
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
371
|
-
|
372
|
-
Note that all the values specified in parameters are added together so if you specify
|
373
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
374
|
-
|
375
|
-
|
376
|
-
Parameters
|
377
|
-
----------
|
378
|
-
seconds : int, default 0
|
379
|
-
Number of seconds to wait prior to timing out.
|
380
|
-
minutes : int, default 0
|
381
|
-
Number of minutes to wait prior to timing out.
|
382
|
-
hours : int, default 0
|
383
|
-
Number of hours to wait prior to timing out.
|
213
|
+
Internal decorator to support Fast bakery
|
384
214
|
"""
|
385
215
|
...
|
386
216
|
|
387
217
|
@typing.overload
|
388
|
-
def
|
389
|
-
...
|
390
|
-
|
391
|
-
@typing.overload
|
392
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
218
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
393
219
|
...
|
394
220
|
|
395
|
-
def
|
221
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
396
222
|
"""
|
397
|
-
|
398
|
-
|
399
|
-
This decorator is useful if this step may hang indefinitely.
|
400
|
-
|
401
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
402
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
403
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
404
|
-
|
405
|
-
Note that all the values specified in parameters are added together so if you specify
|
406
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
407
|
-
|
408
|
-
|
409
|
-
Parameters
|
410
|
-
----------
|
411
|
-
seconds : int, default 0
|
412
|
-
Number of seconds to wait prior to timing out.
|
413
|
-
minutes : int, default 0
|
414
|
-
Number of minutes to wait prior to timing out.
|
415
|
-
hours : int, default 0
|
416
|
-
Number of hours to wait prior to timing out.
|
223
|
+
Internal decorator to support Fast bakery
|
417
224
|
"""
|
418
225
|
...
|
419
226
|
|
@@ -507,179 +314,108 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
507
314
|
...
|
508
315
|
|
509
316
|
@typing.overload
|
510
|
-
def
|
317
|
+
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]]]:
|
511
318
|
"""
|
512
|
-
|
513
|
-
to a step needs to be retried.
|
319
|
+
Enables checkpointing for a step.
|
514
320
|
|
515
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
516
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
517
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
518
|
-
|
519
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
520
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
521
|
-
ensuring that the flow execution can continue.
|
522
321
|
|
523
322
|
|
524
323
|
Parameters
|
525
324
|
----------
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
325
|
+
load_policy : str, default: "fresh"
|
326
|
+
The policy for loading the checkpoint. The following policies are supported:
|
327
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
328
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
329
|
+
will be loaded at the start of the task.
|
330
|
+
- "none": Do not load any checkpoint
|
331
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
332
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
333
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
334
|
+
created within the task will be loaded when the task is retries execution on failure.
|
335
|
+
|
336
|
+
temp_dir_root : str, default: None
|
337
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
530
338
|
"""
|
531
339
|
...
|
532
340
|
|
533
341
|
@typing.overload
|
534
|
-
def
|
342
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
535
343
|
...
|
536
344
|
|
537
345
|
@typing.overload
|
538
|
-
def
|
346
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
539
347
|
...
|
540
348
|
|
541
|
-
def
|
349
|
+
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):
|
542
350
|
"""
|
543
|
-
|
544
|
-
to a step needs to be retried.
|
545
|
-
|
546
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
547
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
548
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
351
|
+
Enables checkpointing for a step.
|
549
352
|
|
550
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
551
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
552
|
-
ensuring that the flow execution can continue.
|
553
353
|
|
554
354
|
|
555
355
|
Parameters
|
556
356
|
----------
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
User code call
|
569
|
-
--------------
|
570
|
-
@ollama(
|
571
|
-
models=[...],
|
572
|
-
...
|
573
|
-
)
|
574
|
-
|
575
|
-
Valid backend options
|
576
|
-
---------------------
|
577
|
-
- 'local': Run as a separate process on the local task machine.
|
578
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
579
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
580
|
-
|
581
|
-
Valid model options
|
582
|
-
-------------------
|
583
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
584
|
-
|
357
|
+
load_policy : str, default: "fresh"
|
358
|
+
The policy for loading the checkpoint. The following policies are supported:
|
359
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
360
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
361
|
+
will be loaded at the start of the task.
|
362
|
+
- "none": Do not load any checkpoint
|
363
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
364
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
365
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
366
|
+
created within the task will be loaded when the task is retries execution on failure.
|
585
367
|
|
586
|
-
|
587
|
-
|
588
|
-
models: list[str]
|
589
|
-
List of Ollama containers running models in sidecars.
|
590
|
-
backend: str
|
591
|
-
Determines where and how to run the Ollama process.
|
592
|
-
force_pull: bool
|
593
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
594
|
-
cache_update_policy: str
|
595
|
-
Cache update policy: "auto", "force", or "never".
|
596
|
-
force_cache_update: bool
|
597
|
-
Simple override for "force" cache update policy.
|
598
|
-
debug: bool
|
599
|
-
Whether to turn on verbose debugging logs.
|
600
|
-
circuit_breaker_config: dict
|
601
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
602
|
-
timeout_config: dict
|
603
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
368
|
+
temp_dir_root : str, default: None
|
369
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
604
370
|
"""
|
605
371
|
...
|
606
372
|
|
607
373
|
@typing.overload
|
608
|
-
def
|
374
|
+
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]]]:
|
609
375
|
"""
|
610
|
-
|
611
|
-
|
612
|
-
Use `@resources` to specify the resource requirements
|
613
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
376
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
614
377
|
|
615
|
-
|
616
|
-
```
|
617
|
-
python myflow.py run --with batch
|
618
|
-
```
|
619
|
-
or
|
620
|
-
```
|
621
|
-
python myflow.py run --with kubernetes
|
622
|
-
```
|
623
|
-
which executes the flow on the desired system using the
|
624
|
-
requirements specified in `@resources`.
|
378
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
625
379
|
|
626
380
|
|
627
381
|
Parameters
|
628
382
|
----------
|
629
|
-
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
634
|
-
|
635
|
-
|
636
|
-
|
637
|
-
shared_memory : int, optional, default None
|
638
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
639
|
-
This parameter maps to the `--shm-size` option in Docker.
|
383
|
+
type : str, default 'default'
|
384
|
+
Card type.
|
385
|
+
id : str, optional, default None
|
386
|
+
If multiple cards are present, use this id to identify this card.
|
387
|
+
options : Dict[str, Any], default {}
|
388
|
+
Options passed to the card. The contents depend on the card type.
|
389
|
+
timeout : int, default 45
|
390
|
+
Interrupt reporting if it takes more than this many seconds.
|
640
391
|
"""
|
641
392
|
...
|
642
393
|
|
643
394
|
@typing.overload
|
644
|
-
def
|
395
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
645
396
|
...
|
646
397
|
|
647
398
|
@typing.overload
|
648
|
-
def
|
399
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
649
400
|
...
|
650
401
|
|
651
|
-
def
|
402
|
+
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):
|
652
403
|
"""
|
653
|
-
|
654
|
-
|
655
|
-
Use `@resources` to specify the resource requirements
|
656
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
404
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
657
405
|
|
658
|
-
|
659
|
-
```
|
660
|
-
python myflow.py run --with batch
|
661
|
-
```
|
662
|
-
or
|
663
|
-
```
|
664
|
-
python myflow.py run --with kubernetes
|
665
|
-
```
|
666
|
-
which executes the flow on the desired system using the
|
667
|
-
requirements specified in `@resources`.
|
406
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
668
407
|
|
669
408
|
|
670
409
|
Parameters
|
671
410
|
----------
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
shared_memory : int, optional, default None
|
681
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
682
|
-
This parameter maps to the `--shm-size` option in Docker.
|
411
|
+
type : str, default 'default'
|
412
|
+
Card type.
|
413
|
+
id : str, optional, default None
|
414
|
+
If multiple cards are present, use this id to identify this card.
|
415
|
+
options : Dict[str, Any], default {}
|
416
|
+
Options passed to the card. The contents depend on the card type.
|
417
|
+
timeout : int, default 45
|
418
|
+
Interrupt reporting if it takes more than this many seconds.
|
683
419
|
"""
|
684
420
|
...
|
685
421
|
|
@@ -735,136 +471,510 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
735
471
|
...
|
736
472
|
|
737
473
|
@typing.overload
|
738
|
-
def
|
474
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
739
475
|
"""
|
740
|
-
Specifies
|
741
|
-
|
476
|
+
Specifies the Conda environment for the step.
|
477
|
+
|
478
|
+
Information in this decorator will augment any
|
479
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
480
|
+
you can use `@conda_base` to set packages required by all
|
481
|
+
steps and use `@conda` to specify step-specific overrides.
|
742
482
|
|
743
483
|
|
744
484
|
Parameters
|
745
485
|
----------
|
746
|
-
|
747
|
-
|
486
|
+
packages : Dict[str, str], default {}
|
487
|
+
Packages to use for this step. The key is the name of the package
|
488
|
+
and the value is the version to use.
|
489
|
+
libraries : Dict[str, str], default {}
|
490
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
491
|
+
python : str, optional, default None
|
492
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
493
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
494
|
+
disabled : bool, default False
|
495
|
+
If set to True, disables @conda.
|
748
496
|
"""
|
749
497
|
...
|
750
498
|
|
751
499
|
@typing.overload
|
752
|
-
def
|
500
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
753
501
|
...
|
754
502
|
|
755
503
|
@typing.overload
|
756
|
-
def
|
504
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
757
505
|
...
|
758
506
|
|
759
|
-
def
|
507
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
760
508
|
"""
|
761
|
-
Specifies
|
762
|
-
|
509
|
+
Specifies the Conda environment for the step.
|
510
|
+
|
511
|
+
Information in this decorator will augment any
|
512
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
513
|
+
you can use `@conda_base` to set packages required by all
|
514
|
+
steps and use `@conda` to specify step-specific overrides.
|
763
515
|
|
764
516
|
|
765
517
|
Parameters
|
766
518
|
----------
|
767
|
-
|
768
|
-
|
519
|
+
packages : Dict[str, str], default {}
|
520
|
+
Packages to use for this step. The key is the name of the package
|
521
|
+
and the value is the version to use.
|
522
|
+
libraries : Dict[str, str], default {}
|
523
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
524
|
+
python : str, optional, default None
|
525
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
526
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
527
|
+
disabled : bool, default False
|
528
|
+
If set to True, disables @conda.
|
769
529
|
"""
|
770
530
|
...
|
771
531
|
|
772
532
|
@typing.overload
|
773
|
-
def
|
533
|
+
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]]]:
|
774
534
|
"""
|
775
|
-
|
535
|
+
Enables loading / saving of models within a step.
|
536
|
+
|
776
537
|
|
777
538
|
|
778
539
|
Parameters
|
779
540
|
----------
|
780
|
-
|
781
|
-
|
541
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
542
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
543
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
544
|
+
- `current.checkpoint`
|
545
|
+
- `current.model`
|
546
|
+
- `current.huggingface_hub`
|
547
|
+
|
548
|
+
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
|
549
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
550
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
551
|
+
|
552
|
+
temp_dir_root : str, default: None
|
553
|
+
The root directory under which `current.model.loaded` will store loaded models
|
782
554
|
"""
|
783
555
|
...
|
784
556
|
|
785
557
|
@typing.overload
|
786
|
-
def
|
558
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
787
559
|
...
|
788
560
|
|
789
561
|
@typing.overload
|
790
|
-
def
|
562
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
791
563
|
...
|
792
564
|
|
793
|
-
def
|
565
|
+
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):
|
794
566
|
"""
|
795
|
-
|
567
|
+
Enables loading / saving of models within a step.
|
568
|
+
|
796
569
|
|
797
570
|
|
798
571
|
Parameters
|
799
572
|
----------
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
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]]]:
|
807
|
-
"""
|
808
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
573
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
574
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
575
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
576
|
+
- `current.checkpoint`
|
577
|
+
- `current.model`
|
578
|
+
- `current.huggingface_hub`
|
809
579
|
|
810
|
-
|
580
|
+
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
|
581
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
582
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
583
|
+
|
584
|
+
temp_dir_root : str, default: None
|
585
|
+
The root directory under which `current.model.loaded` will store loaded models
|
586
|
+
"""
|
587
|
+
...
|
588
|
+
|
589
|
+
@typing.overload
|
590
|
+
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
591
|
+
"""
|
592
|
+
Specifies the PyPI packages for the step.
|
593
|
+
|
594
|
+
Information in this decorator will augment any
|
595
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
596
|
+
you can use `@pypi_base` to set packages required by all
|
597
|
+
steps and use `@pypi` to specify step-specific overrides.
|
811
598
|
|
812
599
|
|
813
600
|
Parameters
|
814
601
|
----------
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
821
|
-
timeout : int, default 45
|
822
|
-
Interrupt reporting if it takes more than this many seconds.
|
602
|
+
packages : Dict[str, str], default: {}
|
603
|
+
Packages to use for this step. The key is the name of the package
|
604
|
+
and the value is the version to use.
|
605
|
+
python : str, optional, default: None
|
606
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
607
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
823
608
|
"""
|
824
609
|
...
|
825
610
|
|
826
611
|
@typing.overload
|
827
|
-
def
|
612
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
828
613
|
...
|
829
614
|
|
830
615
|
@typing.overload
|
831
|
-
def
|
616
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
832
617
|
...
|
833
618
|
|
834
|
-
def
|
619
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
835
620
|
"""
|
836
|
-
|
621
|
+
Specifies the PyPI packages for the step.
|
837
622
|
|
838
|
-
|
623
|
+
Information in this decorator will augment any
|
624
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
625
|
+
you can use `@pypi_base` to set packages required by all
|
626
|
+
steps and use `@pypi` to specify step-specific overrides.
|
839
627
|
|
840
628
|
|
841
629
|
Parameters
|
842
630
|
----------
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
631
|
+
packages : Dict[str, str], default: {}
|
632
|
+
Packages to use for this step. The key is the name of the package
|
633
|
+
and the value is the version to use.
|
634
|
+
python : str, optional, default: None
|
635
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
636
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
637
|
+
"""
|
638
|
+
...
|
639
|
+
|
640
|
+
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]]]:
|
641
|
+
"""
|
642
|
+
Specifies that this step should execute on DGX cloud.
|
643
|
+
|
644
|
+
|
645
|
+
Parameters
|
646
|
+
----------
|
647
|
+
gpu : int
|
648
|
+
Number of GPUs to use.
|
649
|
+
gpu_type : str
|
650
|
+
Type of Nvidia GPU to use.
|
651
|
+
queue_timeout : int
|
652
|
+
Time to keep the job in NVCF's queue.
|
851
653
|
"""
|
852
654
|
...
|
853
655
|
|
854
656
|
@typing.overload
|
855
|
-
def
|
657
|
+
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]]]:
|
856
658
|
"""
|
857
|
-
|
659
|
+
Specifies a timeout for your step.
|
660
|
+
|
661
|
+
This decorator is useful if this step may hang indefinitely.
|
662
|
+
|
663
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
664
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
665
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
666
|
+
|
667
|
+
Note that all the values specified in parameters are added together so if you specify
|
668
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
669
|
+
|
670
|
+
|
671
|
+
Parameters
|
672
|
+
----------
|
673
|
+
seconds : int, default 0
|
674
|
+
Number of seconds to wait prior to timing out.
|
675
|
+
minutes : int, default 0
|
676
|
+
Number of minutes to wait prior to timing out.
|
677
|
+
hours : int, default 0
|
678
|
+
Number of hours to wait prior to timing out.
|
858
679
|
"""
|
859
680
|
...
|
860
681
|
|
861
682
|
@typing.overload
|
862
|
-
def
|
683
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
863
684
|
...
|
864
685
|
|
865
|
-
|
686
|
+
@typing.overload
|
687
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
688
|
+
...
|
689
|
+
|
690
|
+
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):
|
866
691
|
"""
|
867
|
-
|
692
|
+
Specifies a timeout for your step.
|
693
|
+
|
694
|
+
This decorator is useful if this step may hang indefinitely.
|
695
|
+
|
696
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
697
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
698
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
699
|
+
|
700
|
+
Note that all the values specified in parameters are added together so if you specify
|
701
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
702
|
+
|
703
|
+
|
704
|
+
Parameters
|
705
|
+
----------
|
706
|
+
seconds : int, default 0
|
707
|
+
Number of seconds to wait prior to timing out.
|
708
|
+
minutes : int, default 0
|
709
|
+
Number of minutes to wait prior to timing out.
|
710
|
+
hours : int, default 0
|
711
|
+
Number of hours to wait prior to timing out.
|
712
|
+
"""
|
713
|
+
...
|
714
|
+
|
715
|
+
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]]]:
|
716
|
+
"""
|
717
|
+
Specifies that this step should execute on DGX cloud.
|
718
|
+
|
719
|
+
|
720
|
+
Parameters
|
721
|
+
----------
|
722
|
+
gpu : int
|
723
|
+
Number of GPUs to use.
|
724
|
+
gpu_type : str
|
725
|
+
Type of Nvidia GPU to use.
|
726
|
+
"""
|
727
|
+
...
|
728
|
+
|
729
|
+
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]]]:
|
730
|
+
"""
|
731
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
732
|
+
|
733
|
+
User code call
|
734
|
+
--------------
|
735
|
+
@ollama(
|
736
|
+
models=[...],
|
737
|
+
...
|
738
|
+
)
|
739
|
+
|
740
|
+
Valid backend options
|
741
|
+
---------------------
|
742
|
+
- 'local': Run as a separate process on the local task machine.
|
743
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
744
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
745
|
+
|
746
|
+
Valid model options
|
747
|
+
-------------------
|
748
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
749
|
+
|
750
|
+
|
751
|
+
Parameters
|
752
|
+
----------
|
753
|
+
models: list[str]
|
754
|
+
List of Ollama containers running models in sidecars.
|
755
|
+
backend: str
|
756
|
+
Determines where and how to run the Ollama process.
|
757
|
+
force_pull: bool
|
758
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
759
|
+
cache_update_policy: str
|
760
|
+
Cache update policy: "auto", "force", or "never".
|
761
|
+
force_cache_update: bool
|
762
|
+
Simple override for "force" cache update policy.
|
763
|
+
debug: bool
|
764
|
+
Whether to turn on verbose debugging logs.
|
765
|
+
circuit_breaker_config: dict
|
766
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
767
|
+
timeout_config: dict
|
768
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
769
|
+
"""
|
770
|
+
...
|
771
|
+
|
772
|
+
@typing.overload
|
773
|
+
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]]]:
|
774
|
+
"""
|
775
|
+
Specifies the number of times the task corresponding
|
776
|
+
to a step needs to be retried.
|
777
|
+
|
778
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
779
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
780
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
781
|
+
|
782
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
783
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
784
|
+
ensuring that the flow execution can continue.
|
785
|
+
|
786
|
+
|
787
|
+
Parameters
|
788
|
+
----------
|
789
|
+
times : int, default 3
|
790
|
+
Number of times to retry this task.
|
791
|
+
minutes_between_retries : int, default 2
|
792
|
+
Number of minutes between retries.
|
793
|
+
"""
|
794
|
+
...
|
795
|
+
|
796
|
+
@typing.overload
|
797
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
798
|
+
...
|
799
|
+
|
800
|
+
@typing.overload
|
801
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
802
|
+
...
|
803
|
+
|
804
|
+
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):
|
805
|
+
"""
|
806
|
+
Specifies the number of times the task corresponding
|
807
|
+
to a step needs to be retried.
|
808
|
+
|
809
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
810
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
811
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
812
|
+
|
813
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
814
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
815
|
+
ensuring that the flow execution can continue.
|
816
|
+
|
817
|
+
|
818
|
+
Parameters
|
819
|
+
----------
|
820
|
+
times : int, default 3
|
821
|
+
Number of times to retry this task.
|
822
|
+
minutes_between_retries : int, default 2
|
823
|
+
Number of minutes between retries.
|
824
|
+
"""
|
825
|
+
...
|
826
|
+
|
827
|
+
@typing.overload
|
828
|
+
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]]]:
|
829
|
+
"""
|
830
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
831
|
+
the execution of a step.
|
832
|
+
|
833
|
+
|
834
|
+
Parameters
|
835
|
+
----------
|
836
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
837
|
+
List of secret specs, defining how the secrets are to be retrieved
|
838
|
+
"""
|
839
|
+
...
|
840
|
+
|
841
|
+
@typing.overload
|
842
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
843
|
+
...
|
844
|
+
|
845
|
+
@typing.overload
|
846
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
847
|
+
...
|
848
|
+
|
849
|
+
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]]] = []):
|
850
|
+
"""
|
851
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
852
|
+
the execution of a step.
|
853
|
+
|
854
|
+
|
855
|
+
Parameters
|
856
|
+
----------
|
857
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
858
|
+
List of secret specs, defining how the secrets are to be retrieved
|
859
|
+
"""
|
860
|
+
...
|
861
|
+
|
862
|
+
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]]]:
|
863
|
+
"""
|
864
|
+
Specifies that this step is used to deploy an instance of the app.
|
865
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
866
|
+
|
867
|
+
|
868
|
+
Parameters
|
869
|
+
----------
|
870
|
+
app_port : int
|
871
|
+
Number of GPUs to use.
|
872
|
+
app_name : str
|
873
|
+
Name of the app to deploy.
|
874
|
+
"""
|
875
|
+
...
|
876
|
+
|
877
|
+
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]]]:
|
878
|
+
"""
|
879
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
880
|
+
|
881
|
+
|
882
|
+
Parameters
|
883
|
+
----------
|
884
|
+
temp_dir_root : str, optional
|
885
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
886
|
+
|
887
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
888
|
+
The list of repos (models/datasets) to load.
|
889
|
+
|
890
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
891
|
+
|
892
|
+
- If repo (model/dataset) is not found in the datastore:
|
893
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
894
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
895
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
896
|
+
|
897
|
+
- If repo is found in the datastore:
|
898
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
899
|
+
"""
|
900
|
+
...
|
901
|
+
|
902
|
+
@typing.overload
|
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]]]:
|
904
|
+
"""
|
905
|
+
Specifies the resources needed when executing this step.
|
906
|
+
|
907
|
+
Use `@resources` to specify the resource requirements
|
908
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
909
|
+
|
910
|
+
You can choose the compute layer on the command line by executing e.g.
|
911
|
+
```
|
912
|
+
python myflow.py run --with batch
|
913
|
+
```
|
914
|
+
or
|
915
|
+
```
|
916
|
+
python myflow.py run --with kubernetes
|
917
|
+
```
|
918
|
+
which executes the flow on the desired system using the
|
919
|
+
requirements specified in `@resources`.
|
920
|
+
|
921
|
+
|
922
|
+
Parameters
|
923
|
+
----------
|
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.
|
935
|
+
"""
|
936
|
+
...
|
937
|
+
|
938
|
+
@typing.overload
|
939
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
940
|
+
...
|
941
|
+
|
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):
|
947
|
+
"""
|
948
|
+
Specifies the resources needed when executing this step.
|
949
|
+
|
950
|
+
Use `@resources` to specify the resource requirements
|
951
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
952
|
+
|
953
|
+
You can choose the compute layer on the command line by executing e.g.
|
954
|
+
```
|
955
|
+
python myflow.py run --with batch
|
956
|
+
```
|
957
|
+
or
|
958
|
+
```
|
959
|
+
python myflow.py run --with kubernetes
|
960
|
+
```
|
961
|
+
which executes the flow on the desired system using the
|
962
|
+
requirements specified in `@resources`.
|
963
|
+
|
964
|
+
|
965
|
+
Parameters
|
966
|
+
----------
|
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.
|
868
978
|
"""
|
869
979
|
...
|
870
980
|
|
@@ -907,20 +1017,18 @@ def vllm(*, model: str, backend: str, debug: bool, kwargs: typing.Any) -> typing
|
|
907
1017
|
...
|
908
1018
|
|
909
1019
|
@typing.overload
|
910
|
-
def
|
1020
|
+
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
911
1021
|
"""
|
912
|
-
Specifies the Conda environment for the
|
1022
|
+
Specifies the Conda environment for all steps of the flow.
|
913
1023
|
|
914
|
-
|
915
|
-
|
916
|
-
you can use `@conda_base` to set packages required by all
|
917
|
-
steps and use `@conda` to specify step-specific overrides.
|
1024
|
+
Use `@conda_base` to set common libraries required by all
|
1025
|
+
steps and use `@conda` to specify step-specific additions.
|
918
1026
|
|
919
1027
|
|
920
1028
|
Parameters
|
921
1029
|
----------
|
922
1030
|
packages : Dict[str, str], default {}
|
923
|
-
Packages to use for this
|
1031
|
+
Packages to use for this flow. The key is the name of the package
|
924
1032
|
and the value is the version to use.
|
925
1033
|
libraries : Dict[str, str], default {}
|
926
1034
|
Supported for backward compatibility. When used with packages, packages will take precedence.
|
@@ -928,32 +1036,26 @@ def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, s
|
|
928
1036
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
929
1037
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
930
1038
|
disabled : bool, default False
|
931
|
-
If set to True, disables
|
1039
|
+
If set to True, disables Conda.
|
932
1040
|
"""
|
933
1041
|
...
|
934
1042
|
|
935
1043
|
@typing.overload
|
936
|
-
def
|
937
|
-
...
|
938
|
-
|
939
|
-
@typing.overload
|
940
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1044
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
941
1045
|
...
|
942
1046
|
|
943
|
-
def
|
1047
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
944
1048
|
"""
|
945
|
-
Specifies the Conda environment for the
|
946
|
-
|
947
|
-
|
948
|
-
|
949
|
-
you can use `@conda_base` to set packages required by all
|
950
|
-
steps and use `@conda` to specify step-specific overrides.
|
1049
|
+
Specifies the Conda environment for all steps of the flow.
|
1050
|
+
|
1051
|
+
Use `@conda_base` to set common libraries required by all
|
1052
|
+
steps and use `@conda` to specify step-specific additions.
|
951
1053
|
|
952
1054
|
|
953
1055
|
Parameters
|
954
1056
|
----------
|
955
1057
|
packages : Dict[str, str], default {}
|
956
|
-
Packages to use for this
|
1058
|
+
Packages to use for this flow. The key is the name of the package
|
957
1059
|
and the value is the version to use.
|
958
1060
|
libraries : Dict[str, str], default {}
|
959
1061
|
Supported for backward compatibility. When used with packages, packages will take precedence.
|
@@ -961,101 +1063,58 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
961
1063
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
962
1064
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
963
1065
|
disabled : bool, default False
|
964
|
-
If set to True, disables
|
1066
|
+
If set to True, disables Conda.
|
965
1067
|
"""
|
966
1068
|
...
|
967
1069
|
|
968
1070
|
@typing.overload
|
969
|
-
def
|
1071
|
+
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]]:
|
970
1072
|
"""
|
971
|
-
Specifies the
|
972
|
-
|
973
|
-
Information in this decorator will augment any
|
974
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
975
|
-
you can use `@pypi_base` to set packages required by all
|
976
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1073
|
+
Specifies the times when the flow should be run when running on a
|
1074
|
+
production scheduler.
|
977
1075
|
|
978
1076
|
|
979
1077
|
Parameters
|
980
1078
|
----------
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
1079
|
+
hourly : bool, default False
|
1080
|
+
Run the workflow hourly.
|
1081
|
+
daily : bool, default True
|
1082
|
+
Run the workflow daily.
|
1083
|
+
weekly : bool, default False
|
1084
|
+
Run the workflow weekly.
|
1085
|
+
cron : str, optional, default None
|
1086
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1087
|
+
specified by this expression.
|
1088
|
+
timezone : str, optional, default None
|
1089
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1090
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
987
1091
|
"""
|
988
1092
|
...
|
989
1093
|
|
990
1094
|
@typing.overload
|
991
|
-
def
|
992
|
-
...
|
993
|
-
|
994
|
-
@typing.overload
|
995
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
996
|
-
...
|
997
|
-
|
998
|
-
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
999
|
-
"""
|
1000
|
-
Specifies the PyPI packages for the step.
|
1001
|
-
|
1002
|
-
Information in this decorator will augment any
|
1003
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1004
|
-
you can use `@pypi_base` to set packages required by all
|
1005
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1006
|
-
|
1007
|
-
|
1008
|
-
Parameters
|
1009
|
-
----------
|
1010
|
-
packages : Dict[str, str], default: {}
|
1011
|
-
Packages to use for this step. The key is the name of the package
|
1012
|
-
and the value is the version to use.
|
1013
|
-
python : str, optional, default: None
|
1014
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1015
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1016
|
-
"""
|
1095
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1017
1096
|
...
|
1018
1097
|
|
1019
|
-
def
|
1098
|
+
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):
|
1020
1099
|
"""
|
1021
|
-
|
1022
|
-
|
1100
|
+
Specifies the times when the flow should be run when running on a
|
1101
|
+
production scheduler.
|
1023
1102
|
|
1024
1103
|
|
1025
1104
|
Parameters
|
1026
1105
|
----------
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1040
|
-
name : str
|
1041
|
-
Name of the sensor on Airflow
|
1042
|
-
description : str
|
1043
|
-
Description of sensor in the Airflow UI
|
1044
|
-
external_dag_id : str
|
1045
|
-
The dag_id that contains the task you want to wait for.
|
1046
|
-
external_task_ids : List[str]
|
1047
|
-
The list of task_ids that you want to wait for.
|
1048
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1049
|
-
allowed_states : List[str]
|
1050
|
-
Iterable of allowed states, (Default: ['success'])
|
1051
|
-
failed_states : List[str]
|
1052
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1053
|
-
execution_delta : datetime.timedelta
|
1054
|
-
time difference with the previous execution to look at,
|
1055
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1056
|
-
check_existence: bool
|
1057
|
-
Set to True to check if the external task exists or check if
|
1058
|
-
the DAG to wait for exists. (Default: True)
|
1106
|
+
hourly : bool, default False
|
1107
|
+
Run the workflow hourly.
|
1108
|
+
daily : bool, default True
|
1109
|
+
Run the workflow daily.
|
1110
|
+
weekly : bool, default False
|
1111
|
+
Run the workflow weekly.
|
1112
|
+
cron : str, optional, default None
|
1113
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1114
|
+
specified by this expression.
|
1115
|
+
timezone : str, optional, default None
|
1116
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1117
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1059
1118
|
"""
|
1060
1119
|
...
|
1061
1120
|
|
@@ -1100,132 +1159,104 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1100
1159
|
"""
|
1101
1160
|
...
|
1102
1161
|
|
1103
|
-
|
1162
|
+
@typing.overload
|
1163
|
+
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]]:
|
1104
1164
|
"""
|
1105
|
-
Specifies
|
1106
|
-
|
1107
|
-
A project-specific namespace is created for all flows that
|
1108
|
-
use the same `@project(name)`.
|
1165
|
+
Specifies the flow(s) that this flow depends on.
|
1109
1166
|
|
1167
|
+
```
|
1168
|
+
@trigger_on_finish(flow='FooFlow')
|
1169
|
+
```
|
1170
|
+
or
|
1171
|
+
```
|
1172
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1173
|
+
```
|
1174
|
+
This decorator respects the @project decorator and triggers the flow
|
1175
|
+
when upstream runs within the same namespace complete successfully
|
1110
1176
|
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1177
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1178
|
+
by specifying the fully qualified project_flow_name.
|
1179
|
+
```
|
1180
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1181
|
+
```
|
1182
|
+
or
|
1183
|
+
```
|
1184
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1185
|
+
```
|
1117
1186
|
|
1118
|
-
branch
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1187
|
+
You can also specify just the project or project branch (other values will be
|
1188
|
+
inferred from the current project or project branch):
|
1189
|
+
```
|
1190
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1191
|
+
```
|
1123
1192
|
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
1129
|
-
- if `branch` is specified:
|
1130
|
-
- if `production` is True: `prod.<branch>`
|
1131
|
-
- if `production` is False: `test.<branch>`
|
1132
|
-
- if `branch` is not specified:
|
1133
|
-
- if `production` is True: `prod`
|
1134
|
-
- if `production` is False: `user.<username>`
|
1135
|
-
"""
|
1136
|
-
...
|
1137
|
-
|
1138
|
-
@typing.overload
|
1139
|
-
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]]:
|
1140
|
-
"""
|
1141
|
-
Specifies the times when the flow should be run when running on a
|
1142
|
-
production scheduler.
|
1193
|
+
Note that `branch` is typically one of:
|
1194
|
+
- `prod`
|
1195
|
+
- `user.bob`
|
1196
|
+
- `test.my_experiment`
|
1197
|
+
- `prod.staging`
|
1143
1198
|
|
1144
1199
|
|
1145
1200
|
Parameters
|
1146
1201
|
----------
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
cron : str, optional, default None
|
1154
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1155
|
-
specified by this expression.
|
1156
|
-
timezone : str, optional, default None
|
1157
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1158
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1202
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1203
|
+
Upstream flow dependency for this flow.
|
1204
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1205
|
+
Upstream flow dependencies for this flow.
|
1206
|
+
options : Dict[str, Any], default {}
|
1207
|
+
Backend-specific configuration for tuning eventing behavior.
|
1159
1208
|
"""
|
1160
1209
|
...
|
1161
1210
|
|
1162
1211
|
@typing.overload
|
1163
|
-
def
|
1212
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1164
1213
|
...
|
1165
1214
|
|
1166
|
-
def
|
1215
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1167
1216
|
"""
|
1168
|
-
Specifies the
|
1169
|
-
production scheduler.
|
1217
|
+
Specifies the flow(s) that this flow depends on.
|
1170
1218
|
|
1219
|
+
```
|
1220
|
+
@trigger_on_finish(flow='FooFlow')
|
1221
|
+
```
|
1222
|
+
or
|
1223
|
+
```
|
1224
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1225
|
+
```
|
1226
|
+
This decorator respects the @project decorator and triggers the flow
|
1227
|
+
when upstream runs within the same namespace complete successfully
|
1171
1228
|
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1190
|
-
|
1191
|
-
|
1192
|
-
|
1193
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1194
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1195
|
-
starts only after all sensors finish.
|
1229
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1230
|
+
by specifying the fully qualified project_flow_name.
|
1231
|
+
```
|
1232
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1233
|
+
```
|
1234
|
+
or
|
1235
|
+
```
|
1236
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1237
|
+
```
|
1238
|
+
|
1239
|
+
You can also specify just the project or project branch (other values will be
|
1240
|
+
inferred from the current project or project branch):
|
1241
|
+
```
|
1242
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1243
|
+
```
|
1244
|
+
|
1245
|
+
Note that `branch` is typically one of:
|
1246
|
+
- `prod`
|
1247
|
+
- `user.bob`
|
1248
|
+
- `test.my_experiment`
|
1249
|
+
- `prod.staging`
|
1196
1250
|
|
1197
1251
|
|
1198
1252
|
Parameters
|
1199
1253
|
----------
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
exponential_backoff : bool
|
1207
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1208
|
-
pool : str
|
1209
|
-
the slot pool this task should run in,
|
1210
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1211
|
-
soft_fail : bool
|
1212
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1213
|
-
name : str
|
1214
|
-
Name of the sensor on Airflow
|
1215
|
-
description : str
|
1216
|
-
Description of sensor in the Airflow UI
|
1217
|
-
bucket_key : Union[str, List[str]]
|
1218
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1219
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1220
|
-
bucket_name : str
|
1221
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1222
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1223
|
-
wildcard_match : bool
|
1224
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1225
|
-
aws_conn_id : str
|
1226
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1227
|
-
verify : bool
|
1228
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1254
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1255
|
+
Upstream flow dependency for this flow.
|
1256
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1257
|
+
Upstream flow dependencies for this flow.
|
1258
|
+
options : Dict[str, Any], default {}
|
1259
|
+
Backend-specific configuration for tuning eventing behavior.
|
1229
1260
|
"""
|
1230
1261
|
...
|
1231
1262
|
|
@@ -1436,155 +1467,124 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1436
1467
|
"""
|
1437
1468
|
...
|
1438
1469
|
|
1439
|
-
|
1440
|
-
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]]:
|
1470
|
+
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]]:
|
1441
1471
|
"""
|
1442
|
-
|
1443
|
-
|
1444
|
-
Use `@conda_base` to set common libraries required by all
|
1445
|
-
steps and use `@conda` to specify step-specific additions.
|
1472
|
+
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.
|
1473
|
+
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.
|
1446
1474
|
|
1447
1475
|
|
1448
1476
|
Parameters
|
1449
1477
|
----------
|
1450
|
-
|
1451
|
-
|
1452
|
-
|
1453
|
-
|
1454
|
-
|
1455
|
-
|
1456
|
-
|
1457
|
-
|
1458
|
-
|
1459
|
-
|
1478
|
+
timeout : int
|
1479
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1480
|
+
poke_interval : int
|
1481
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1482
|
+
mode : str
|
1483
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1484
|
+
exponential_backoff : bool
|
1485
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1486
|
+
pool : str
|
1487
|
+
the slot pool this task should run in,
|
1488
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1489
|
+
soft_fail : bool
|
1490
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1491
|
+
name : str
|
1492
|
+
Name of the sensor on Airflow
|
1493
|
+
description : str
|
1494
|
+
Description of sensor in the Airflow UI
|
1495
|
+
external_dag_id : str
|
1496
|
+
The dag_id that contains the task you want to wait for.
|
1497
|
+
external_task_ids : List[str]
|
1498
|
+
The list of task_ids that you want to wait for.
|
1499
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1500
|
+
allowed_states : List[str]
|
1501
|
+
Iterable of allowed states, (Default: ['success'])
|
1502
|
+
failed_states : List[str]
|
1503
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1504
|
+
execution_delta : datetime.timedelta
|
1505
|
+
time difference with the previous execution to look at,
|
1506
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1507
|
+
check_existence: bool
|
1508
|
+
Set to True to check if the external task exists or check if
|
1509
|
+
the DAG to wait for exists. (Default: True)
|
1460
1510
|
"""
|
1461
1511
|
...
|
1462
1512
|
|
1463
|
-
|
1464
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1465
|
-
...
|
1466
|
-
|
1467
|
-
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):
|
1513
|
+
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]]:
|
1468
1514
|
"""
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1515
|
+
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)
|
1516
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1517
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1518
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1519
|
+
starts only after all sensors finish.
|
1473
1520
|
|
1474
1521
|
|
1475
1522
|
Parameters
|
1476
1523
|
----------
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1524
|
+
timeout : int
|
1525
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1526
|
+
poke_interval : int
|
1527
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1528
|
+
mode : str
|
1529
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1530
|
+
exponential_backoff : bool
|
1531
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1532
|
+
pool : str
|
1533
|
+
the slot pool this task should run in,
|
1534
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1535
|
+
soft_fail : bool
|
1536
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1537
|
+
name : str
|
1538
|
+
Name of the sensor on Airflow
|
1539
|
+
description : str
|
1540
|
+
Description of sensor in the Airflow UI
|
1541
|
+
bucket_key : Union[str, List[str]]
|
1542
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1543
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1544
|
+
bucket_name : str
|
1545
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1546
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1547
|
+
wildcard_match : bool
|
1548
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1549
|
+
aws_conn_id : str
|
1550
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1551
|
+
verify : bool
|
1552
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1487
1553
|
"""
|
1488
1554
|
...
|
1489
1555
|
|
1490
|
-
|
1491
|
-
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]]:
|
1556
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1492
1557
|
"""
|
1493
|
-
Specifies
|
1494
|
-
|
1495
|
-
```
|
1496
|
-
@trigger_on_finish(flow='FooFlow')
|
1497
|
-
```
|
1498
|
-
or
|
1499
|
-
```
|
1500
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1501
|
-
```
|
1502
|
-
This decorator respects the @project decorator and triggers the flow
|
1503
|
-
when upstream runs within the same namespace complete successfully
|
1504
|
-
|
1505
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1506
|
-
by specifying the fully qualified project_flow_name.
|
1507
|
-
```
|
1508
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1509
|
-
```
|
1510
|
-
or
|
1511
|
-
```
|
1512
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1513
|
-
```
|
1514
|
-
|
1515
|
-
You can also specify just the project or project branch (other values will be
|
1516
|
-
inferred from the current project or project branch):
|
1517
|
-
```
|
1518
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1519
|
-
```
|
1558
|
+
Specifies what flows belong to the same project.
|
1520
1559
|
|
1521
|
-
|
1522
|
-
|
1523
|
-
- `user.bob`
|
1524
|
-
- `test.my_experiment`
|
1525
|
-
- `prod.staging`
|
1560
|
+
A project-specific namespace is created for all flows that
|
1561
|
+
use the same `@project(name)`.
|
1526
1562
|
|
1527
1563
|
|
1528
1564
|
Parameters
|
1529
1565
|
----------
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
options : Dict[str, Any], default {}
|
1535
|
-
Backend-specific configuration for tuning eventing behavior.
|
1536
|
-
"""
|
1537
|
-
...
|
1538
|
-
|
1539
|
-
@typing.overload
|
1540
|
-
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1541
|
-
...
|
1542
|
-
|
1543
|
-
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1544
|
-
"""
|
1545
|
-
Specifies the flow(s) that this flow depends on.
|
1546
|
-
|
1547
|
-
```
|
1548
|
-
@trigger_on_finish(flow='FooFlow')
|
1549
|
-
```
|
1550
|
-
or
|
1551
|
-
```
|
1552
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1553
|
-
```
|
1554
|
-
This decorator respects the @project decorator and triggers the flow
|
1555
|
-
when upstream runs within the same namespace complete successfully
|
1556
|
-
|
1557
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1558
|
-
by specifying the fully qualified project_flow_name.
|
1559
|
-
```
|
1560
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1561
|
-
```
|
1562
|
-
or
|
1563
|
-
```
|
1564
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1565
|
-
```
|
1566
|
-
|
1567
|
-
You can also specify just the project or project branch (other values will be
|
1568
|
-
inferred from the current project or project branch):
|
1569
|
-
```
|
1570
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1571
|
-
```
|
1572
|
-
|
1573
|
-
Note that `branch` is typically one of:
|
1574
|
-
- `prod`
|
1575
|
-
- `user.bob`
|
1576
|
-
- `test.my_experiment`
|
1577
|
-
- `prod.staging`
|
1566
|
+
name : str
|
1567
|
+
Project name. Make sure that the name is unique amongst all
|
1568
|
+
projects that use the same production scheduler. The name may
|
1569
|
+
contain only lowercase alphanumeric characters and underscores.
|
1578
1570
|
|
1571
|
+
branch : Optional[str], default None
|
1572
|
+
The branch to use. If not specified, the branch is set to
|
1573
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1574
|
+
also be set on the command line using `--branch` as a top-level option.
|
1575
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1579
1576
|
|
1580
|
-
|
1581
|
-
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1577
|
+
production : bool, default False
|
1578
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1579
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1580
|
+
`production` in the decorator and on the command line.
|
1581
|
+
The project branch name will be:
|
1582
|
+
- if `branch` is specified:
|
1583
|
+
- if `production` is True: `prod.<branch>`
|
1584
|
+
- if `production` is False: `test.<branch>`
|
1585
|
+
- if `branch` is not specified:
|
1586
|
+
- if `production` is True: `prod`
|
1587
|
+
- if `production` is False: `user.<username>`
|
1588
1588
|
"""
|
1589
1589
|
...
|
1590
1590
|
|