ob-metaflow-stubs 6.0.3.182rc0__py2.py3-none-any.whl → 6.0.3.182rc2__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 +742 -742
- metaflow-stubs/cards.pyi +1 -1
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/cli_components/__init__.pyi +1 -1
- metaflow-stubs/cli_components/utils.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +1 -1
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +1 -1
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +92 -92
- metaflow-stubs/metaflow_git.pyi +1 -1
- metaflow-stubs/mf_extensions/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/ob_internal.pyi +1 -1
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +11 -11
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/torchtune/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/uv_environment.pyi +1 -1
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +29 -29
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +1 -1
- metaflow-stubs/user_configs/config_parameters.pyi +4 -4
- {ob_metaflow_stubs-6.0.3.182rc0.dist-info → ob_metaflow_stubs-6.0.3.182rc2.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.182rc2.dist-info/RECORD +220 -0
- ob_metaflow_stubs-6.0.3.182rc0.dist-info/RECORD +0 -220
- {ob_metaflow_stubs-6.0.3.182rc0.dist-info → ob_metaflow_stubs-6.0.3.182rc2.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.182rc0.dist-info → ob_metaflow_stubs-6.0.3.182rc2.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.15.17.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-06-
|
4
|
+
# Generated on 2025-06-18T10:30:41.738497 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import datetime
|
12
11
|
import typing
|
12
|
+
import datetime
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -35,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 cards as cards
|
39
38
|
from . import tuple_util as tuple_util
|
40
|
-
from . import
|
39
|
+
from . import cards as cards
|
41
40
|
from . import events as events
|
41
|
+
from . import metaflow_git as metaflow_git
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
48
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
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
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -155,63 +155,110 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
155
155
|
"""
|
156
156
|
...
|
157
157
|
|
158
|
-
def
|
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
159
|
"""
|
160
|
-
|
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.
|
161
162
|
|
162
|
-
User code call
|
163
|
-
--------------
|
164
|
-
@ollama(
|
165
|
-
models=[...],
|
166
|
-
...
|
167
|
-
)
|
168
163
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
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
|
+
@typing.overload
|
193
|
+
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]]]:
|
194
|
+
"""
|
195
|
+
Enables loading / saving of models within a step.
|
174
196
|
|
175
|
-
Valid model options
|
176
|
-
-------------------
|
177
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
178
197
|
|
179
198
|
|
180
199
|
Parameters
|
181
200
|
----------
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
196
|
-
timeout_config: dict
|
197
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
201
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
202
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
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
|
198
214
|
"""
|
199
215
|
...
|
200
216
|
|
201
217
|
@typing.overload
|
202
|
-
def
|
203
|
-
"""
|
204
|
-
Internal decorator to support Fast bakery
|
205
|
-
"""
|
218
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
206
219
|
...
|
207
220
|
|
208
221
|
@typing.overload
|
209
|
-
def
|
222
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
210
223
|
...
|
211
224
|
|
212
|
-
def
|
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):
|
213
226
|
"""
|
214
|
-
|
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
|
+
"""
|
247
|
+
...
|
248
|
+
|
249
|
+
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]]]:
|
250
|
+
"""
|
251
|
+
Specifies that this step should execute on DGX cloud.
|
252
|
+
|
253
|
+
|
254
|
+
Parameters
|
255
|
+
----------
|
256
|
+
gpu : int
|
257
|
+
Number of GPUs to use.
|
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.
|
215
262
|
"""
|
216
263
|
...
|
217
264
|
|
@@ -272,274 +319,107 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
272
319
|
"""
|
273
320
|
...
|
274
321
|
|
275
|
-
|
276
|
-
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]]]:
|
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]]]:
|
277
323
|
"""
|
278
|
-
Specifies
|
279
|
-
to a step needs to be retried.
|
280
|
-
|
281
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
282
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
283
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
284
|
-
|
285
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
286
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
287
|
-
ensuring that the flow execution can continue.
|
324
|
+
Specifies that this step should execute on DGX cloud.
|
288
325
|
|
289
326
|
|
290
327
|
Parameters
|
291
328
|
----------
|
292
|
-
|
293
|
-
Number of
|
294
|
-
|
295
|
-
|
329
|
+
gpu : int
|
330
|
+
Number of GPUs to use.
|
331
|
+
gpu_type : str
|
332
|
+
Type of Nvidia GPU to use.
|
296
333
|
"""
|
297
334
|
...
|
298
335
|
|
299
|
-
|
300
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
301
|
-
...
|
302
|
-
|
303
|
-
@typing.overload
|
304
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
305
|
-
...
|
306
|
-
|
307
|
-
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):
|
336
|
+
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]]]:
|
308
337
|
"""
|
309
|
-
|
310
|
-
to a step needs to be retried.
|
311
|
-
|
312
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
313
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
314
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
315
|
-
|
316
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
317
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
318
|
-
ensuring that the flow execution can continue.
|
338
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
319
339
|
|
320
340
|
|
321
341
|
Parameters
|
322
342
|
----------
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
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)
|
327
358
|
"""
|
328
359
|
...
|
329
360
|
|
330
361
|
@typing.overload
|
331
|
-
def
|
362
|
+
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]]]:
|
332
363
|
"""
|
333
|
-
Specifies
|
334
|
-
|
364
|
+
Specifies a timeout for your step.
|
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.
|
335
374
|
|
336
375
|
|
337
376
|
Parameters
|
338
377
|
----------
|
339
|
-
|
340
|
-
|
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.
|
341
384
|
"""
|
342
385
|
...
|
343
386
|
|
344
387
|
@typing.overload
|
345
|
-
def
|
388
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
346
389
|
...
|
347
390
|
|
348
391
|
@typing.overload
|
349
|
-
def
|
392
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
350
393
|
...
|
351
394
|
|
352
|
-
def
|
395
|
+
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):
|
353
396
|
"""
|
354
|
-
Specifies
|
355
|
-
|
397
|
+
Specifies a timeout for your step.
|
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.
|
356
407
|
|
357
408
|
|
358
409
|
Parameters
|
359
410
|
----------
|
360
|
-
|
361
|
-
|
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.
|
362
417
|
"""
|
363
418
|
...
|
364
419
|
|
365
|
-
def
|
420
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
366
421
|
"""
|
367
|
-
Specifies that this step should execute on
|
368
|
-
|
369
|
-
|
370
|
-
Parameters
|
371
|
-
----------
|
372
|
-
gpu : int
|
373
|
-
Number of GPUs to use.
|
374
|
-
gpu_type : str
|
375
|
-
Type of Nvidia GPU to use.
|
376
|
-
"""
|
377
|
-
...
|
378
|
-
|
379
|
-
@typing.overload
|
380
|
-
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
381
|
-
"""
|
382
|
-
Specifies that the step will success under all circumstances.
|
383
|
-
|
384
|
-
The decorator will create an optional artifact, specified by `var`, which
|
385
|
-
contains the exception raised. You can use it to detect the presence
|
386
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
387
|
-
are missing.
|
388
|
-
|
389
|
-
|
390
|
-
Parameters
|
391
|
-
----------
|
392
|
-
var : str, optional, default None
|
393
|
-
Name of the artifact in which to store the caught exception.
|
394
|
-
If not specified, the exception is not stored.
|
395
|
-
print_exception : bool, default True
|
396
|
-
Determines whether or not the exception is printed to
|
397
|
-
stdout when caught.
|
398
|
-
"""
|
399
|
-
...
|
400
|
-
|
401
|
-
@typing.overload
|
402
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
403
|
-
...
|
404
|
-
|
405
|
-
@typing.overload
|
406
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
407
|
-
...
|
408
|
-
|
409
|
-
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
410
|
-
"""
|
411
|
-
Specifies that the step will success under all circumstances.
|
412
|
-
|
413
|
-
The decorator will create an optional artifact, specified by `var`, which
|
414
|
-
contains the exception raised. You can use it to detect the presence
|
415
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
416
|
-
are missing.
|
417
|
-
|
418
|
-
|
419
|
-
Parameters
|
420
|
-
----------
|
421
|
-
var : str, optional, default None
|
422
|
-
Name of the artifact in which to store the caught exception.
|
423
|
-
If not specified, the exception is not stored.
|
424
|
-
print_exception : bool, default True
|
425
|
-
Determines whether or not the exception is printed to
|
426
|
-
stdout when caught.
|
427
|
-
"""
|
428
|
-
...
|
429
|
-
|
430
|
-
def vllm(*, model: str, backend: str, debug: bool, kwargs: typing.Any) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
431
|
-
"""
|
432
|
-
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
433
|
-
|
434
|
-
User code call
|
435
|
-
--------------
|
436
|
-
@vllm(
|
437
|
-
model="...",
|
438
|
-
...
|
439
|
-
)
|
440
|
-
|
441
|
-
Valid backend options
|
442
|
-
---------------------
|
443
|
-
- 'local': Run as a separate process on the local task machine.
|
444
|
-
|
445
|
-
Valid model options
|
446
|
-
-------------------
|
447
|
-
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
448
|
-
|
449
|
-
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
450
|
-
If you need multiple models, you must create multiple @vllm decorators.
|
451
|
-
|
452
|
-
|
453
|
-
Parameters
|
454
|
-
----------
|
455
|
-
model: str
|
456
|
-
HuggingFace model identifier to be served by vLLM.
|
457
|
-
backend: str
|
458
|
-
Determines where and how to run the vLLM process.
|
459
|
-
debug: bool
|
460
|
-
Whether to turn on verbose debugging logs.
|
461
|
-
kwargs : Any
|
462
|
-
Any other keyword arguments are passed directly to the vLLM engine.
|
463
|
-
This allows for flexible configuration of vLLM server settings.
|
464
|
-
For example, `tensor_parallel_size=2`.
|
465
|
-
"""
|
466
|
-
...
|
467
|
-
|
468
|
-
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]]]:
|
469
|
-
"""
|
470
|
-
Specifies that this step is used to deploy an instance of the app.
|
471
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
472
|
-
|
473
|
-
|
474
|
-
Parameters
|
475
|
-
----------
|
476
|
-
app_port : int
|
477
|
-
Number of GPUs to use.
|
478
|
-
app_name : str
|
479
|
-
Name of the app to deploy.
|
480
|
-
"""
|
481
|
-
...
|
482
|
-
|
483
|
-
@typing.overload
|
484
|
-
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]]]:
|
485
|
-
"""
|
486
|
-
Enables loading / saving of models within a step.
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
Parameters
|
491
|
-
----------
|
492
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
493
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
494
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
495
|
-
- `current.checkpoint`
|
496
|
-
- `current.model`
|
497
|
-
- `current.huggingface_hub`
|
498
|
-
|
499
|
-
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
|
500
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
501
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
502
|
-
|
503
|
-
temp_dir_root : str, default: None
|
504
|
-
The root directory under which `current.model.loaded` will store loaded models
|
505
|
-
"""
|
506
|
-
...
|
507
|
-
|
508
|
-
@typing.overload
|
509
|
-
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
510
|
-
...
|
511
|
-
|
512
|
-
@typing.overload
|
513
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
514
|
-
...
|
515
|
-
|
516
|
-
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):
|
517
|
-
"""
|
518
|
-
Enables loading / saving of models within a step.
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
Parameters
|
523
|
-
----------
|
524
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
525
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
526
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
527
|
-
- `current.checkpoint`
|
528
|
-
- `current.model`
|
529
|
-
- `current.huggingface_hub`
|
530
|
-
|
531
|
-
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
|
532
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
533
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
534
|
-
|
535
|
-
temp_dir_root : str, default: None
|
536
|
-
The root directory under which `current.model.loaded` will store loaded models
|
537
|
-
"""
|
538
|
-
...
|
539
|
-
|
540
|
-
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
541
|
-
"""
|
542
|
-
Specifies that this step should execute on Kubernetes.
|
422
|
+
Specifies that this step should execute on Kubernetes.
|
543
423
|
|
544
424
|
|
545
425
|
Parameters
|
@@ -627,205 +507,100 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
627
507
|
...
|
628
508
|
|
629
509
|
@typing.overload
|
630
|
-
def
|
631
|
-
"""
|
632
|
-
Decorator prototype for all step decorators. This function gets specialized
|
633
|
-
and imported for all decorators types by _import_plugin_decorators().
|
634
|
-
"""
|
635
|
-
...
|
636
|
-
|
637
|
-
@typing.overload
|
638
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
639
|
-
...
|
640
|
-
|
641
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
642
|
-
"""
|
643
|
-
Decorator prototype for all step decorators. This function gets specialized
|
644
|
-
and imported for all decorators types by _import_plugin_decorators().
|
645
|
-
"""
|
646
|
-
...
|
647
|
-
|
648
|
-
@typing.overload
|
649
|
-
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]]]:
|
510
|
+
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]]]:
|
650
511
|
"""
|
651
|
-
Specifies the
|
512
|
+
Specifies the number of times the task corresponding
|
513
|
+
to a step needs to be retried.
|
652
514
|
|
653
|
-
|
654
|
-
|
655
|
-
|
656
|
-
|
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.
|
657
522
|
|
658
523
|
|
659
524
|
Parameters
|
660
525
|
----------
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
666
|
-
python : str, optional, default None
|
667
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
668
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
669
|
-
disabled : bool, default False
|
670
|
-
If set to True, disables @conda.
|
526
|
+
times : int, default 3
|
527
|
+
Number of times to retry this task.
|
528
|
+
minutes_between_retries : int, default 2
|
529
|
+
Number of minutes between retries.
|
671
530
|
"""
|
672
531
|
...
|
673
532
|
|
674
533
|
@typing.overload
|
675
|
-
def
|
534
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
676
535
|
...
|
677
536
|
|
678
537
|
@typing.overload
|
679
|
-
def
|
538
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
680
539
|
...
|
681
540
|
|
682
|
-
def
|
541
|
+
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):
|
683
542
|
"""
|
684
|
-
Specifies the
|
543
|
+
Specifies the number of times the task corresponding
|
544
|
+
to a step needs to be retried.
|
685
545
|
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
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)`.
|
549
|
+
|
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.
|
690
553
|
|
691
554
|
|
692
555
|
Parameters
|
693
556
|
----------
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
699
|
-
python : str, optional, default None
|
700
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
701
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
702
|
-
disabled : bool, default False
|
703
|
-
If set to True, disables @conda.
|
557
|
+
times : int, default 3
|
558
|
+
Number of times to retry this task.
|
559
|
+
minutes_between_retries : int, default 2
|
560
|
+
Number of minutes between retries.
|
704
561
|
"""
|
705
562
|
...
|
706
563
|
|
707
|
-
def
|
564
|
+
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]]]:
|
708
565
|
"""
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
Parameters
|
713
|
-
----------
|
714
|
-
temp_dir_root : str, optional
|
715
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
716
|
-
|
717
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
718
|
-
The list of repos (models/datasets) to load.
|
719
|
-
|
720
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
721
|
-
|
722
|
-
- If repo (model/dataset) is not found in the datastore:
|
723
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
724
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
725
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
726
|
-
|
727
|
-
- If repo is found in the datastore:
|
728
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
729
|
-
"""
|
730
|
-
...
|
731
|
-
|
732
|
-
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]]]:
|
733
|
-
"""
|
734
|
-
Specifies that this step should execute on DGX cloud.
|
735
|
-
|
736
|
-
|
737
|
-
Parameters
|
738
|
-
----------
|
739
|
-
gpu : int
|
740
|
-
Number of GPUs to use.
|
741
|
-
gpu_type : str
|
742
|
-
Type of Nvidia GPU to use.
|
743
|
-
queue_timeout : int
|
744
|
-
Time to keep the job in NVCF's queue.
|
745
|
-
"""
|
746
|
-
...
|
747
|
-
|
748
|
-
@typing.overload
|
749
|
-
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]]]:
|
750
|
-
"""
|
751
|
-
Specifies environment variables to be set prior to the execution of a step.
|
752
|
-
|
753
|
-
|
754
|
-
Parameters
|
755
|
-
----------
|
756
|
-
vars : Dict[str, str], default {}
|
757
|
-
Dictionary of environment variables to set.
|
758
|
-
"""
|
759
|
-
...
|
760
|
-
|
761
|
-
@typing.overload
|
762
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
763
|
-
...
|
764
|
-
|
765
|
-
@typing.overload
|
766
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
767
|
-
...
|
768
|
-
|
769
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
770
|
-
"""
|
771
|
-
Specifies environment variables to be set prior to the execution of a step.
|
772
|
-
|
773
|
-
|
774
|
-
Parameters
|
775
|
-
----------
|
776
|
-
vars : Dict[str, str], default {}
|
777
|
-
Dictionary of environment variables to set.
|
778
|
-
"""
|
779
|
-
...
|
780
|
-
|
781
|
-
@typing.overload
|
782
|
-
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]]]:
|
783
|
-
"""
|
784
|
-
Specifies the PyPI packages for the step.
|
785
|
-
|
786
|
-
Information in this decorator will augment any
|
787
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
788
|
-
you can use `@pypi_base` to set packages required by all
|
789
|
-
steps and use `@pypi` to specify step-specific overrides.
|
566
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
790
567
|
|
568
|
+
User code call
|
569
|
+
--------------
|
570
|
+
@ollama(
|
571
|
+
models=[...],
|
572
|
+
...
|
573
|
+
)
|
791
574
|
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
797
|
-
python : str, optional, default: None
|
798
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
799
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
800
|
-
"""
|
801
|
-
...
|
802
|
-
|
803
|
-
@typing.overload
|
804
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
805
|
-
...
|
806
|
-
|
807
|
-
@typing.overload
|
808
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
809
|
-
...
|
810
|
-
|
811
|
-
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):
|
812
|
-
"""
|
813
|
-
Specifies the PyPI packages for the step.
|
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.
|
814
580
|
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
steps and use `@pypi` to specify step-specific overrides.
|
581
|
+
Valid model options
|
582
|
+
-------------------
|
583
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
819
584
|
|
820
585
|
|
821
586
|
Parameters
|
822
587
|
----------
|
823
|
-
|
824
|
-
|
825
|
-
|
826
|
-
|
827
|
-
|
828
|
-
|
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.
|
829
604
|
"""
|
830
605
|
...
|
831
606
|
|
@@ -909,167 +684,243 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
909
684
|
...
|
910
685
|
|
911
686
|
@typing.overload
|
912
|
-
def
|
687
|
+
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
913
688
|
"""
|
914
|
-
|
689
|
+
Specifies that the step will success under all circumstances.
|
915
690
|
|
916
|
-
|
691
|
+
The decorator will create an optional artifact, specified by `var`, which
|
692
|
+
contains the exception raised. You can use it to detect the presence
|
693
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
694
|
+
are missing.
|
917
695
|
|
918
696
|
|
919
697
|
Parameters
|
920
698
|
----------
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
timeout : int, default 45
|
928
|
-
Interrupt reporting if it takes more than this many seconds.
|
699
|
+
var : str, optional, default None
|
700
|
+
Name of the artifact in which to store the caught exception.
|
701
|
+
If not specified, the exception is not stored.
|
702
|
+
print_exception : bool, default True
|
703
|
+
Determines whether or not the exception is printed to
|
704
|
+
stdout when caught.
|
929
705
|
"""
|
930
706
|
...
|
931
707
|
|
932
708
|
@typing.overload
|
933
|
-
def
|
709
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
934
710
|
...
|
935
711
|
|
936
712
|
@typing.overload
|
937
|
-
def
|
713
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
938
714
|
...
|
939
715
|
|
940
|
-
def
|
716
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
941
717
|
"""
|
942
|
-
|
718
|
+
Specifies that the step will success under all circumstances.
|
943
719
|
|
944
|
-
|
720
|
+
The decorator will create an optional artifact, specified by `var`, which
|
721
|
+
contains the exception raised. You can use it to detect the presence
|
722
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
723
|
+
are missing.
|
945
724
|
|
946
725
|
|
947
726
|
Parameters
|
948
727
|
----------
|
949
|
-
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
timeout : int, default 45
|
956
|
-
Interrupt reporting if it takes more than this many seconds.
|
728
|
+
var : str, optional, default None
|
729
|
+
Name of the artifact in which to store the caught exception.
|
730
|
+
If not specified, the exception is not stored.
|
731
|
+
print_exception : bool, default True
|
732
|
+
Determines whether or not the exception is printed to
|
733
|
+
stdout when caught.
|
957
734
|
"""
|
958
735
|
...
|
959
736
|
|
960
737
|
@typing.overload
|
961
|
-
def
|
738
|
+
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]]]:
|
962
739
|
"""
|
963
|
-
Specifies
|
964
|
-
|
965
|
-
This decorator is useful if this step may hang indefinitely.
|
966
|
-
|
967
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
968
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
969
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
970
|
-
|
971
|
-
Note that all the values specified in parameters are added together so if you specify
|
972
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
740
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
741
|
+
the execution of a step.
|
973
742
|
|
974
743
|
|
975
744
|
Parameters
|
976
745
|
----------
|
977
|
-
|
978
|
-
|
979
|
-
minutes : int, default 0
|
980
|
-
Number of minutes to wait prior to timing out.
|
981
|
-
hours : int, default 0
|
982
|
-
Number of hours to wait prior to timing out.
|
746
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
747
|
+
List of secret specs, defining how the secrets are to be retrieved
|
983
748
|
"""
|
984
749
|
...
|
985
750
|
|
986
751
|
@typing.overload
|
987
|
-
def
|
752
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
988
753
|
...
|
989
754
|
|
990
755
|
@typing.overload
|
991
|
-
def
|
756
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
992
757
|
...
|
993
758
|
|
994
|
-
def
|
759
|
+
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]]] = []):
|
995
760
|
"""
|
996
|
-
Specifies
|
997
|
-
|
998
|
-
This decorator is useful if this step may hang indefinitely.
|
999
|
-
|
1000
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1001
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1002
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1003
|
-
|
1004
|
-
Note that all the values specified in parameters are added together so if you specify
|
1005
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
761
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
762
|
+
the execution of a step.
|
1006
763
|
|
1007
764
|
|
1008
765
|
Parameters
|
1009
766
|
----------
|
1010
|
-
|
1011
|
-
|
1012
|
-
minutes : int, default 0
|
1013
|
-
Number of minutes to wait prior to timing out.
|
1014
|
-
hours : int, default 0
|
1015
|
-
Number of hours to wait prior to timing out.
|
767
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
768
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1016
769
|
"""
|
1017
770
|
...
|
1018
771
|
|
1019
772
|
@typing.overload
|
1020
|
-
def
|
773
|
+
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]]]:
|
1021
774
|
"""
|
1022
|
-
Specifies
|
775
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1023
776
|
|
1024
|
-
Use `@pypi_base` to set common packages required by all
|
1025
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1026
777
|
|
1027
778
|
Parameters
|
1028
779
|
----------
|
1029
|
-
|
1030
|
-
|
1031
|
-
and the value is the version to use.
|
1032
|
-
python : str, optional, default: None
|
1033
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1034
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
780
|
+
vars : Dict[str, str], default {}
|
781
|
+
Dictionary of environment variables to set.
|
1035
782
|
"""
|
1036
783
|
...
|
1037
784
|
|
1038
785
|
@typing.overload
|
1039
|
-
def
|
786
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1040
787
|
...
|
1041
788
|
|
1042
|
-
|
789
|
+
@typing.overload
|
790
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
791
|
+
...
|
792
|
+
|
793
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
1043
794
|
"""
|
1044
|
-
Specifies
|
795
|
+
Specifies environment variables to be set prior to the execution of a step.
|
1045
796
|
|
1046
|
-
Use `@pypi_base` to set common packages required by all
|
1047
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1048
797
|
|
1049
798
|
Parameters
|
1050
799
|
----------
|
1051
|
-
|
1052
|
-
|
1053
|
-
and the value is the version to use.
|
1054
|
-
python : str, optional, default: None
|
1055
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1056
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
800
|
+
vars : Dict[str, str], default {}
|
801
|
+
Dictionary of environment variables to set.
|
1057
802
|
"""
|
1058
803
|
...
|
1059
804
|
|
1060
805
|
@typing.overload
|
1061
|
-
def
|
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]]]:
|
1062
807
|
"""
|
1063
|
-
|
808
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1064
809
|
|
1065
|
-
|
1066
|
-
|
810
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
811
|
+
|
812
|
+
|
813
|
+
Parameters
|
814
|
+
----------
|
815
|
+
type : str, default 'default'
|
816
|
+
Card type.
|
817
|
+
id : str, optional, default None
|
818
|
+
If multiple cards are present, use this id to identify this card.
|
819
|
+
options : Dict[str, Any], default {}
|
820
|
+
Options passed to the card. The contents depend on the card type.
|
821
|
+
timeout : int, default 45
|
822
|
+
Interrupt reporting if it takes more than this many seconds.
|
823
|
+
"""
|
824
|
+
...
|
825
|
+
|
826
|
+
@typing.overload
|
827
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
828
|
+
...
|
829
|
+
|
830
|
+
@typing.overload
|
831
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
832
|
+
...
|
833
|
+
|
834
|
+
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):
|
835
|
+
"""
|
836
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
837
|
+
|
838
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
839
|
+
|
840
|
+
|
841
|
+
Parameters
|
842
|
+
----------
|
843
|
+
type : str, default 'default'
|
844
|
+
Card type.
|
845
|
+
id : str, optional, default None
|
846
|
+
If multiple cards are present, use this id to identify this card.
|
847
|
+
options : Dict[str, Any], default {}
|
848
|
+
Options passed to the card. The contents depend on the card type.
|
849
|
+
timeout : int, default 45
|
850
|
+
Interrupt reporting if it takes more than this many seconds.
|
851
|
+
"""
|
852
|
+
...
|
853
|
+
|
854
|
+
@typing.overload
|
855
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
856
|
+
"""
|
857
|
+
Internal decorator to support Fast bakery
|
858
|
+
"""
|
859
|
+
...
|
860
|
+
|
861
|
+
@typing.overload
|
862
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
863
|
+
...
|
864
|
+
|
865
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
866
|
+
"""
|
867
|
+
Internal decorator to support Fast bakery
|
868
|
+
"""
|
869
|
+
...
|
870
|
+
|
871
|
+
def vllm(*, model: str, backend: str, debug: bool, kwargs: typing.Any) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
872
|
+
"""
|
873
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
874
|
+
|
875
|
+
User code call
|
876
|
+
--------------
|
877
|
+
@vllm(
|
878
|
+
model="...",
|
879
|
+
...
|
880
|
+
)
|
881
|
+
|
882
|
+
Valid backend options
|
883
|
+
---------------------
|
884
|
+
- 'local': Run as a separate process on the local task machine.
|
885
|
+
|
886
|
+
Valid model options
|
887
|
+
-------------------
|
888
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
889
|
+
|
890
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
891
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
892
|
+
|
893
|
+
|
894
|
+
Parameters
|
895
|
+
----------
|
896
|
+
model: str
|
897
|
+
HuggingFace model identifier to be served by vLLM.
|
898
|
+
backend: str
|
899
|
+
Determines where and how to run the vLLM process.
|
900
|
+
debug: bool
|
901
|
+
Whether to turn on verbose debugging logs.
|
902
|
+
kwargs : Any
|
903
|
+
Any other keyword arguments are passed directly to the vLLM engine.
|
904
|
+
This allows for flexible configuration of vLLM server settings.
|
905
|
+
For example, `tensor_parallel_size=2`.
|
906
|
+
"""
|
907
|
+
...
|
908
|
+
|
909
|
+
@typing.overload
|
910
|
+
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]]]:
|
911
|
+
"""
|
912
|
+
Specifies the Conda environment for the step.
|
913
|
+
|
914
|
+
Information in this decorator will augment any
|
915
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
916
|
+
you can use `@conda_base` to set packages required by all
|
917
|
+
steps and use `@conda` to specify step-specific overrides.
|
1067
918
|
|
1068
919
|
|
1069
920
|
Parameters
|
1070
921
|
----------
|
1071
922
|
packages : Dict[str, str], default {}
|
1072
|
-
Packages to use for this
|
923
|
+
Packages to use for this step. The key is the name of the package
|
1073
924
|
and the value is the version to use.
|
1074
925
|
libraries : Dict[str, str], default {}
|
1075
926
|
Supported for backward compatibility. When used with packages, packages will take precedence.
|
@@ -1077,26 +928,32 @@ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[s
|
|
1077
928
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1078
929
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1079
930
|
disabled : bool, default False
|
1080
|
-
If set to True, disables
|
931
|
+
If set to True, disables @conda.
|
1081
932
|
"""
|
1082
933
|
...
|
1083
934
|
|
1084
935
|
@typing.overload
|
1085
|
-
def
|
936
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1086
937
|
...
|
1087
938
|
|
1088
|
-
|
939
|
+
@typing.overload
|
940
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
941
|
+
...
|
942
|
+
|
943
|
+
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):
|
1089
944
|
"""
|
1090
|
-
Specifies the Conda environment for
|
945
|
+
Specifies the Conda environment for the step.
|
1091
946
|
|
1092
|
-
|
1093
|
-
|
947
|
+
Information in this decorator will augment any
|
948
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
949
|
+
you can use `@conda_base` to set packages required by all
|
950
|
+
steps and use `@conda` to specify step-specific overrides.
|
1094
951
|
|
1095
952
|
|
1096
953
|
Parameters
|
1097
954
|
----------
|
1098
955
|
packages : Dict[str, str], default {}
|
1099
|
-
Packages to use for this
|
956
|
+
Packages to use for this step. The key is the name of the package
|
1100
957
|
and the value is the version to use.
|
1101
958
|
libraries : Dict[str, str], default {}
|
1102
959
|
Supported for backward compatibility. When used with packages, packages will take precedence.
|
@@ -1104,100 +961,271 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1104
961
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1105
962
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1106
963
|
disabled : bool, default False
|
1107
|
-
If set to True, disables
|
964
|
+
If set to True, disables @conda.
|
1108
965
|
"""
|
1109
966
|
...
|
1110
967
|
|
1111
968
|
@typing.overload
|
1112
|
-
def
|
969
|
+
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]]]:
|
1113
970
|
"""
|
1114
|
-
Specifies the
|
971
|
+
Specifies the PyPI packages for the step.
|
1115
972
|
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
```
|
1121
|
-
@trigger(events=['foo', 'bar'])
|
1122
|
-
```
|
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.
|
1123
977
|
|
1124
|
-
Additionally, you can specify the parameter mappings
|
1125
|
-
to map event payload to Metaflow parameters for the flow.
|
1126
|
-
```
|
1127
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1128
|
-
```
|
1129
|
-
or
|
1130
|
-
```
|
1131
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1132
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1133
|
-
```
|
1134
978
|
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
979
|
+
Parameters
|
980
|
+
----------
|
981
|
+
packages : Dict[str, str], default: {}
|
982
|
+
Packages to use for this step. The key is the name of the package
|
983
|
+
and the value is the version to use.
|
984
|
+
python : str, optional, default: None
|
985
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
986
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
987
|
+
"""
|
988
|
+
...
|
989
|
+
|
990
|
+
@typing.overload
|
991
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
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.
|
1143
1006
|
|
1144
1007
|
|
1145
1008
|
Parameters
|
1146
1009
|
----------
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
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
|
+
"""
|
1017
|
+
...
|
1018
|
+
|
1019
|
+
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]]:
|
1020
|
+
"""
|
1021
|
+
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.
|
1022
|
+
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.
|
1023
|
+
|
1024
|
+
|
1025
|
+
Parameters
|
1026
|
+
----------
|
1027
|
+
timeout : int
|
1028
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1029
|
+
poke_interval : int
|
1030
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1031
|
+
mode : str
|
1032
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1033
|
+
exponential_backoff : bool
|
1034
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1035
|
+
pool : str
|
1036
|
+
the slot pool this task should run in,
|
1037
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1038
|
+
soft_fail : bool
|
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)
|
1153
1059
|
"""
|
1154
1060
|
...
|
1155
1061
|
|
1156
1062
|
@typing.overload
|
1157
|
-
def
|
1063
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1064
|
+
"""
|
1065
|
+
Specifies the PyPI packages for all steps of the flow.
|
1066
|
+
|
1067
|
+
Use `@pypi_base` to set common packages required by all
|
1068
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1069
|
+
|
1070
|
+
Parameters
|
1071
|
+
----------
|
1072
|
+
packages : Dict[str, str], default: {}
|
1073
|
+
Packages to use for this flow. The key is the name of the package
|
1074
|
+
and the value is the version to use.
|
1075
|
+
python : str, optional, default: None
|
1076
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1077
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1078
|
+
"""
|
1158
1079
|
...
|
1159
1080
|
|
1160
|
-
|
1081
|
+
@typing.overload
|
1082
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1083
|
+
...
|
1084
|
+
|
1085
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1161
1086
|
"""
|
1162
|
-
Specifies the
|
1087
|
+
Specifies the PyPI packages for all steps of the flow.
|
1163
1088
|
|
1164
|
-
|
1165
|
-
|
1166
|
-
```
|
1167
|
-
or
|
1168
|
-
```
|
1169
|
-
@trigger(events=['foo', 'bar'])
|
1170
|
-
```
|
1089
|
+
Use `@pypi_base` to set common packages required by all
|
1090
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1171
1091
|
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1092
|
+
Parameters
|
1093
|
+
----------
|
1094
|
+
packages : Dict[str, str], default: {}
|
1095
|
+
Packages to use for this flow. The key is the name of the package
|
1096
|
+
and the value is the version to use.
|
1097
|
+
python : str, optional, default: None
|
1098
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1099
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1100
|
+
"""
|
1101
|
+
...
|
1102
|
+
|
1103
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1104
|
+
"""
|
1105
|
+
Specifies what flows belong to the same project.
|
1182
1106
|
|
1183
|
-
|
1184
|
-
|
1185
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1186
|
-
```
|
1187
|
-
This is equivalent to:
|
1188
|
-
```
|
1189
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1190
|
-
```
|
1107
|
+
A project-specific namespace is created for all flows that
|
1108
|
+
use the same `@project(name)`.
|
1191
1109
|
|
1192
1110
|
|
1193
1111
|
Parameters
|
1194
1112
|
----------
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1113
|
+
name : str
|
1114
|
+
Project name. Make sure that the name is unique amongst all
|
1115
|
+
projects that use the same production scheduler. The name may
|
1116
|
+
contain only lowercase alphanumeric characters and underscores.
|
1117
|
+
|
1118
|
+
branch : Optional[str], default None
|
1119
|
+
The branch to use. If not specified, the branch is set to
|
1120
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1121
|
+
also be set on the command line using `--branch` as a top-level option.
|
1122
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1123
|
+
|
1124
|
+
production : bool, default False
|
1125
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1126
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1127
|
+
`production` in the decorator and on the command line.
|
1128
|
+
The project branch name will be:
|
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.
|
1143
|
+
|
1144
|
+
|
1145
|
+
Parameters
|
1146
|
+
----------
|
1147
|
+
hourly : bool, default False
|
1148
|
+
Run the workflow hourly.
|
1149
|
+
daily : bool, default True
|
1150
|
+
Run the workflow daily.
|
1151
|
+
weekly : bool, default False
|
1152
|
+
Run the workflow weekly.
|
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).
|
1159
|
+
"""
|
1160
|
+
...
|
1161
|
+
|
1162
|
+
@typing.overload
|
1163
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1164
|
+
...
|
1165
|
+
|
1166
|
+
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):
|
1167
|
+
"""
|
1168
|
+
Specifies the times when the flow should be run when running on a
|
1169
|
+
production scheduler.
|
1170
|
+
|
1171
|
+
|
1172
|
+
Parameters
|
1173
|
+
----------
|
1174
|
+
hourly : bool, default False
|
1175
|
+
Run the workflow hourly.
|
1176
|
+
daily : bool, default True
|
1177
|
+
Run the workflow daily.
|
1178
|
+
weekly : bool, default False
|
1179
|
+
Run the workflow weekly.
|
1180
|
+
cron : str, optional, default None
|
1181
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1182
|
+
specified by this expression.
|
1183
|
+
timezone : str, optional, default None
|
1184
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1185
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1186
|
+
"""
|
1187
|
+
...
|
1188
|
+
|
1189
|
+
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]]:
|
1190
|
+
"""
|
1191
|
+
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)
|
1192
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
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.
|
1196
|
+
|
1197
|
+
|
1198
|
+
Parameters
|
1199
|
+
----------
|
1200
|
+
timeout : int
|
1201
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1202
|
+
poke_interval : int
|
1203
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1204
|
+
mode : str
|
1205
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
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)
|
1201
1229
|
"""
|
1202
1230
|
...
|
1203
1231
|
|
@@ -1315,89 +1343,147 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1315
1343
|
"""
|
1316
1344
|
...
|
1317
1345
|
|
1318
|
-
|
1346
|
+
@typing.overload
|
1347
|
+
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1319
1348
|
"""
|
1320
|
-
Specifies
|
1349
|
+
Specifies the event(s) that this flow depends on.
|
1321
1350
|
|
1322
|
-
|
1323
|
-
|
1351
|
+
```
|
1352
|
+
@trigger(event='foo')
|
1353
|
+
```
|
1354
|
+
or
|
1355
|
+
```
|
1356
|
+
@trigger(events=['foo', 'bar'])
|
1357
|
+
```
|
1358
|
+
|
1359
|
+
Additionally, you can specify the parameter mappings
|
1360
|
+
to map event payload to Metaflow parameters for the flow.
|
1361
|
+
```
|
1362
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1363
|
+
```
|
1364
|
+
or
|
1365
|
+
```
|
1366
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1367
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1368
|
+
```
|
1369
|
+
|
1370
|
+
'parameters' can also be a list of strings and tuples like so:
|
1371
|
+
```
|
1372
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1373
|
+
```
|
1374
|
+
This is equivalent to:
|
1375
|
+
```
|
1376
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1377
|
+
```
|
1324
1378
|
|
1325
1379
|
|
1326
1380
|
Parameters
|
1327
1381
|
----------
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1382
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1383
|
+
Event dependency for this flow.
|
1384
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1385
|
+
Events dependency for this flow.
|
1386
|
+
options : Dict[str, Any], default {}
|
1387
|
+
Backend-specific configuration for tuning eventing behavior.
|
1388
|
+
"""
|
1389
|
+
...
|
1390
|
+
|
1391
|
+
@typing.overload
|
1392
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1393
|
+
...
|
1394
|
+
|
1395
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1396
|
+
"""
|
1397
|
+
Specifies the event(s) that this flow depends on.
|
1332
1398
|
|
1333
|
-
|
1334
|
-
|
1335
|
-
|
1336
|
-
|
1337
|
-
|
1399
|
+
```
|
1400
|
+
@trigger(event='foo')
|
1401
|
+
```
|
1402
|
+
or
|
1403
|
+
```
|
1404
|
+
@trigger(events=['foo', 'bar'])
|
1405
|
+
```
|
1338
1406
|
|
1339
|
-
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1407
|
+
Additionally, you can specify the parameter mappings
|
1408
|
+
to map event payload to Metaflow parameters for the flow.
|
1409
|
+
```
|
1410
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1411
|
+
```
|
1412
|
+
or
|
1413
|
+
```
|
1414
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1415
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1416
|
+
```
|
1417
|
+
|
1418
|
+
'parameters' can also be a list of strings and tuples like so:
|
1419
|
+
```
|
1420
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1421
|
+
```
|
1422
|
+
This is equivalent to:
|
1423
|
+
```
|
1424
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1425
|
+
```
|
1426
|
+
|
1427
|
+
|
1428
|
+
Parameters
|
1429
|
+
----------
|
1430
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1431
|
+
Event dependency for this flow.
|
1432
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1433
|
+
Events dependency for this flow.
|
1434
|
+
options : Dict[str, Any], default {}
|
1435
|
+
Backend-specific configuration for tuning eventing behavior.
|
1350
1436
|
"""
|
1351
1437
|
...
|
1352
1438
|
|
1353
1439
|
@typing.overload
|
1354
|
-
def
|
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]]:
|
1355
1441
|
"""
|
1356
|
-
Specifies the
|
1357
|
-
|
1442
|
+
Specifies the Conda environment for all steps of the flow.
|
1443
|
+
|
1444
|
+
Use `@conda_base` to set common libraries required by all
|
1445
|
+
steps and use `@conda` to specify step-specific additions.
|
1358
1446
|
|
1359
1447
|
|
1360
1448
|
Parameters
|
1361
1449
|
----------
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1373
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1450
|
+
packages : Dict[str, str], default {}
|
1451
|
+
Packages to use for this flow. The key is the name of the package
|
1452
|
+
and the value is the version to use.
|
1453
|
+
libraries : Dict[str, str], default {}
|
1454
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1455
|
+
python : str, optional, default None
|
1456
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1457
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1458
|
+
disabled : bool, default False
|
1459
|
+
If set to True, disables Conda.
|
1374
1460
|
"""
|
1375
1461
|
...
|
1376
1462
|
|
1377
1463
|
@typing.overload
|
1378
|
-
def
|
1464
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1379
1465
|
...
|
1380
1466
|
|
1381
|
-
def
|
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):
|
1382
1468
|
"""
|
1383
|
-
Specifies the
|
1384
|
-
|
1469
|
+
Specifies the Conda environment for all steps of the flow.
|
1470
|
+
|
1471
|
+
Use `@conda_base` to set common libraries required by all
|
1472
|
+
steps and use `@conda` to specify step-specific additions.
|
1385
1473
|
|
1386
1474
|
|
1387
1475
|
Parameters
|
1388
1476
|
----------
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1400
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1477
|
+
packages : Dict[str, str], default {}
|
1478
|
+
Packages to use for this flow. The key is the name of the package
|
1479
|
+
and the value is the version to use.
|
1480
|
+
libraries : Dict[str, str], default {}
|
1481
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1482
|
+
python : str, optional, default None
|
1483
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1484
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1485
|
+
disabled : bool, default False
|
1486
|
+
If set to True, disables Conda.
|
1401
1487
|
"""
|
1402
1488
|
...
|
1403
1489
|
|
@@ -1502,91 +1588,5 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1502
1588
|
"""
|
1503
1589
|
...
|
1504
1590
|
|
1505
|
-
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]]:
|
1506
|
-
"""
|
1507
|
-
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)
|
1508
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1509
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1510
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1511
|
-
starts only after all sensors finish.
|
1512
|
-
|
1513
|
-
|
1514
|
-
Parameters
|
1515
|
-
----------
|
1516
|
-
timeout : int
|
1517
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1518
|
-
poke_interval : int
|
1519
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1520
|
-
mode : str
|
1521
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1522
|
-
exponential_backoff : bool
|
1523
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1524
|
-
pool : str
|
1525
|
-
the slot pool this task should run in,
|
1526
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1527
|
-
soft_fail : bool
|
1528
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1529
|
-
name : str
|
1530
|
-
Name of the sensor on Airflow
|
1531
|
-
description : str
|
1532
|
-
Description of sensor in the Airflow UI
|
1533
|
-
bucket_key : Union[str, List[str]]
|
1534
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1535
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1536
|
-
bucket_name : str
|
1537
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1538
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1539
|
-
wildcard_match : bool
|
1540
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1541
|
-
aws_conn_id : str
|
1542
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1543
|
-
verify : bool
|
1544
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1545
|
-
"""
|
1546
|
-
...
|
1547
|
-
|
1548
|
-
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]]:
|
1549
|
-
"""
|
1550
|
-
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.
|
1551
|
-
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.
|
1552
|
-
|
1553
|
-
|
1554
|
-
Parameters
|
1555
|
-
----------
|
1556
|
-
timeout : int
|
1557
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1558
|
-
poke_interval : int
|
1559
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1560
|
-
mode : str
|
1561
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1562
|
-
exponential_backoff : bool
|
1563
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1564
|
-
pool : str
|
1565
|
-
the slot pool this task should run in,
|
1566
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1567
|
-
soft_fail : bool
|
1568
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1569
|
-
name : str
|
1570
|
-
Name of the sensor on Airflow
|
1571
|
-
description : str
|
1572
|
-
Description of sensor in the Airflow UI
|
1573
|
-
external_dag_id : str
|
1574
|
-
The dag_id that contains the task you want to wait for.
|
1575
|
-
external_task_ids : List[str]
|
1576
|
-
The list of task_ids that you want to wait for.
|
1577
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1578
|
-
allowed_states : List[str]
|
1579
|
-
Iterable of allowed states, (Default: ['success'])
|
1580
|
-
failed_states : List[str]
|
1581
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1582
|
-
execution_delta : datetime.timedelta
|
1583
|
-
time difference with the previous execution to look at,
|
1584
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1585
|
-
check_existence: bool
|
1586
|
-
Set to True to check if the external task exists or check if
|
1587
|
-
the DAG to wait for exists. (Default: True)
|
1588
|
-
"""
|
1589
|
-
...
|
1590
|
-
|
1591
1591
|
pkg_name: str
|
1592
1592
|
|