ob-metaflow-stubs 6.0.3.183rc1__py2.py3-none-any.whl → 6.0.3.185__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 +867 -867
- metaflow-stubs/cards.pyi +1 -1
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/cli_components/__init__.pyi +1 -1
- metaflow-stubs/cli_components/utils.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +1 -1
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +1 -1
- 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 +79 -79
- metaflow-stubs/metaflow_git.pyi +1 -1
- metaflow-stubs/mf_extensions/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +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 +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +1 -1
- 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 +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/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 -2
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +10 -10
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +1 -1
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +1 -1
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_client.pyi +1 -1
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +1 -1
- 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 +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- 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 +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/torchtune/__init__.pyi +3 -2
- 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 +27 -27
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +1 -1
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +1 -1
- metaflow-stubs/user_configs/config_parameters.pyi +4 -4
- {ob_metaflow_stubs-6.0.3.183rc1.dist-info → ob_metaflow_stubs-6.0.3.185.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.185.dist-info/RECORD +216 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +0 -6
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +0 -51
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +0 -65
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +0 -74
- ob_metaflow_stubs-6.0.3.183rc1.dist-info/RECORD +0 -220
- {ob_metaflow_stubs-6.0.3.183rc1.dist-info → ob_metaflow_stubs-6.0.3.185.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.183rc1.dist-info → ob_metaflow_stubs-6.0.3.185.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.18.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-06-
|
4
|
+
# Generated on 2025-06-26T22:38:03.208016 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import typing
|
12
11
|
import datetime
|
12
|
+
import typing
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -35,18 +35,18 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import events as events
|
39
38
|
from . import cards as cards
|
40
39
|
from . import metaflow_git as metaflow_git
|
41
40
|
from . import tuple_util as tuple_util
|
41
|
+
from . import events as events
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
47
48
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
48
49
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
49
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -155,436 +155,267 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
155
155
|
"""
|
156
156
|
...
|
157
157
|
|
158
|
+
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]]]:
|
159
|
+
"""
|
160
|
+
Specifies that this step should execute on DGX cloud.
|
161
|
+
|
162
|
+
|
163
|
+
Parameters
|
164
|
+
----------
|
165
|
+
gpu : int
|
166
|
+
Number of GPUs to use.
|
167
|
+
gpu_type : str
|
168
|
+
Type of Nvidia GPU to use.
|
169
|
+
"""
|
170
|
+
...
|
171
|
+
|
172
|
+
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]]]:
|
173
|
+
"""
|
174
|
+
Specifies that this step is used to deploy an instance of the app.
|
175
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
176
|
+
|
177
|
+
|
178
|
+
Parameters
|
179
|
+
----------
|
180
|
+
app_port : int
|
181
|
+
Number of GPUs to use.
|
182
|
+
app_name : str
|
183
|
+
Name of the app to deploy.
|
184
|
+
"""
|
185
|
+
...
|
186
|
+
|
187
|
+
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]]]:
|
188
|
+
"""
|
189
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
190
|
+
|
191
|
+
User code call
|
192
|
+
--------------
|
193
|
+
@ollama(
|
194
|
+
models=[...],
|
195
|
+
...
|
196
|
+
)
|
197
|
+
|
198
|
+
Valid backend options
|
199
|
+
---------------------
|
200
|
+
- 'local': Run as a separate process on the local task machine.
|
201
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
202
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
203
|
+
|
204
|
+
Valid model options
|
205
|
+
-------------------
|
206
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
207
|
+
|
208
|
+
|
209
|
+
Parameters
|
210
|
+
----------
|
211
|
+
models: list[str]
|
212
|
+
List of Ollama containers running models in sidecars.
|
213
|
+
backend: str
|
214
|
+
Determines where and how to run the Ollama process.
|
215
|
+
force_pull: bool
|
216
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
217
|
+
cache_update_policy: str
|
218
|
+
Cache update policy: "auto", "force", or "never".
|
219
|
+
force_cache_update: bool
|
220
|
+
Simple override for "force" cache update policy.
|
221
|
+
debug: bool
|
222
|
+
Whether to turn on verbose debugging logs.
|
223
|
+
circuit_breaker_config: dict
|
224
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
225
|
+
timeout_config: dict
|
226
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
227
|
+
"""
|
228
|
+
...
|
229
|
+
|
158
230
|
@typing.overload
|
159
|
-
def
|
231
|
+
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]]]:
|
160
232
|
"""
|
161
|
-
Specifies
|
162
|
-
|
233
|
+
Specifies the PyPI packages for the step.
|
234
|
+
|
235
|
+
Information in this decorator will augment any
|
236
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
237
|
+
you can use `@pypi_base` to set packages required by all
|
238
|
+
steps and use `@pypi` to specify step-specific overrides.
|
163
239
|
|
164
240
|
|
165
241
|
Parameters
|
166
242
|
----------
|
167
|
-
|
168
|
-
|
243
|
+
packages : Dict[str, str], default: {}
|
244
|
+
Packages to use for this step. The key is the name of the package
|
245
|
+
and the value is the version to use.
|
246
|
+
python : str, optional, default: None
|
247
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
248
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
169
249
|
"""
|
170
250
|
...
|
171
251
|
|
172
252
|
@typing.overload
|
173
|
-
def
|
253
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
174
254
|
...
|
175
255
|
|
176
256
|
@typing.overload
|
177
|
-
def
|
257
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
178
258
|
...
|
179
259
|
|
180
|
-
def
|
260
|
+
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):
|
181
261
|
"""
|
182
|
-
Specifies
|
183
|
-
|
262
|
+
Specifies the PyPI packages for the step.
|
263
|
+
|
264
|
+
Information in this decorator will augment any
|
265
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
266
|
+
you can use `@pypi_base` to set packages required by all
|
267
|
+
steps and use `@pypi` to specify step-specific overrides.
|
184
268
|
|
185
269
|
|
186
270
|
Parameters
|
187
271
|
----------
|
188
|
-
|
189
|
-
|
272
|
+
packages : Dict[str, str], default: {}
|
273
|
+
Packages to use for this step. The key is the name of the package
|
274
|
+
and the value is the version to use.
|
275
|
+
python : str, optional, default: None
|
276
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
277
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
190
278
|
"""
|
191
279
|
...
|
192
280
|
|
193
281
|
@typing.overload
|
194
|
-
def
|
282
|
+
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]]]:
|
195
283
|
"""
|
196
|
-
Specifies
|
284
|
+
Specifies that the step will success under all circumstances.
|
197
285
|
|
198
|
-
|
286
|
+
The decorator will create an optional artifact, specified by `var`, which
|
287
|
+
contains the exception raised. You can use it to detect the presence
|
288
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
289
|
+
are missing.
|
199
290
|
|
200
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
201
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
202
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
203
291
|
|
204
|
-
|
205
|
-
|
292
|
+
Parameters
|
293
|
+
----------
|
294
|
+
var : str, optional, default None
|
295
|
+
Name of the artifact in which to store the caught exception.
|
296
|
+
If not specified, the exception is not stored.
|
297
|
+
print_exception : bool, default True
|
298
|
+
Determines whether or not the exception is printed to
|
299
|
+
stdout when caught.
|
300
|
+
"""
|
301
|
+
...
|
302
|
+
|
303
|
+
@typing.overload
|
304
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
305
|
+
...
|
306
|
+
|
307
|
+
@typing.overload
|
308
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
309
|
+
...
|
310
|
+
|
311
|
+
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):
|
312
|
+
"""
|
313
|
+
Specifies that the step will success under all circumstances.
|
314
|
+
|
315
|
+
The decorator will create an optional artifact, specified by `var`, which
|
316
|
+
contains the exception raised. You can use it to detect the presence
|
317
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
318
|
+
are missing.
|
206
319
|
|
207
320
|
|
208
321
|
Parameters
|
209
322
|
----------
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
323
|
+
var : str, optional, default None
|
324
|
+
Name of the artifact in which to store the caught exception.
|
325
|
+
If not specified, the exception is not stored.
|
326
|
+
print_exception : bool, default True
|
327
|
+
Determines whether or not the exception is printed to
|
328
|
+
stdout when caught.
|
216
329
|
"""
|
217
330
|
...
|
218
331
|
|
219
332
|
@typing.overload
|
220
|
-
def
|
333
|
+
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]]]:
|
334
|
+
"""
|
335
|
+
Enables loading / saving of models within a step.
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
Parameters
|
340
|
+
----------
|
341
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
342
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
343
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
344
|
+
- `current.checkpoint`
|
345
|
+
- `current.model`
|
346
|
+
- `current.huggingface_hub`
|
347
|
+
|
348
|
+
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
|
349
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
350
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
351
|
+
|
352
|
+
temp_dir_root : str, default: None
|
353
|
+
The root directory under which `current.model.loaded` will store loaded models
|
354
|
+
"""
|
221
355
|
...
|
222
356
|
|
223
357
|
@typing.overload
|
224
|
-
def
|
358
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
225
359
|
...
|
226
360
|
|
227
|
-
|
361
|
+
@typing.overload
|
362
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
363
|
+
...
|
364
|
+
|
365
|
+
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):
|
228
366
|
"""
|
229
|
-
|
367
|
+
Enables loading / saving of models within a step.
|
230
368
|
|
231
|
-
This decorator is useful if this step may hang indefinitely.
|
232
369
|
|
233
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
234
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
235
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
236
370
|
|
237
|
-
|
238
|
-
|
371
|
+
Parameters
|
372
|
+
----------
|
373
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
374
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
375
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
376
|
+
- `current.checkpoint`
|
377
|
+
- `current.model`
|
378
|
+
- `current.huggingface_hub`
|
379
|
+
|
380
|
+
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
|
381
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
382
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
383
|
+
|
384
|
+
temp_dir_root : str, default: None
|
385
|
+
The root directory under which `current.model.loaded` will store loaded models
|
386
|
+
"""
|
387
|
+
...
|
388
|
+
|
389
|
+
@typing.overload
|
390
|
+
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]]]:
|
391
|
+
"""
|
392
|
+
Specifies environment variables to be set prior to the execution of a step.
|
239
393
|
|
240
394
|
|
241
395
|
Parameters
|
242
396
|
----------
|
243
|
-
|
244
|
-
|
245
|
-
minutes : int, default 0
|
246
|
-
Number of minutes to wait prior to timing out.
|
247
|
-
hours : int, default 0
|
248
|
-
Number of hours to wait prior to timing out.
|
397
|
+
vars : Dict[str, str], default {}
|
398
|
+
Dictionary of environment variables to set.
|
249
399
|
"""
|
250
400
|
...
|
251
401
|
|
252
|
-
|
402
|
+
@typing.overload
|
403
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
404
|
+
...
|
405
|
+
|
406
|
+
@typing.overload
|
407
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
408
|
+
...
|
409
|
+
|
410
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
253
411
|
"""
|
254
|
-
Specifies
|
412
|
+
Specifies environment variables to be set prior to the execution of a step.
|
255
413
|
|
256
414
|
|
257
415
|
Parameters
|
258
416
|
----------
|
259
|
-
|
260
|
-
|
261
|
-
also present, the maximum value from all decorators is used.
|
262
|
-
memory : int, default 4096
|
263
|
-
Memory size (in MB) required for this step. If
|
264
|
-
`@resources` is also present, the maximum value from all decorators is
|
265
|
-
used.
|
266
|
-
disk : int, default 10240
|
267
|
-
Disk size (in MB) required for this step. If
|
268
|
-
`@resources` is also present, the maximum value from all decorators is
|
269
|
-
used.
|
270
|
-
image : str, optional, default None
|
271
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
272
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
273
|
-
not, a default Docker image mapping to the current version of Python is used.
|
274
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
275
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
276
|
-
image_pull_secrets: List[str], default []
|
277
|
-
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
278
|
-
Kubernetes image pull secrets to use when pulling container images
|
279
|
-
in Kubernetes.
|
280
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
281
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
282
|
-
secrets : List[str], optional, default None
|
283
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
284
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
285
|
-
in Metaflow configuration.
|
286
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
287
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
288
|
-
Can be passed in as a comma separated string of values e.g.
|
289
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
290
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
291
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
292
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
293
|
-
gpu : int, optional, default None
|
294
|
-
Number of GPUs required for this step. A value of zero implies that
|
295
|
-
the scheduled node should not have GPUs.
|
296
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
297
|
-
The vendor of the GPUs to be used for this step.
|
298
|
-
tolerations : List[str], default []
|
299
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
300
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
301
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
302
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
303
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
304
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
305
|
-
use_tmpfs : bool, default False
|
306
|
-
This enables an explicit tmpfs mount for this step.
|
307
|
-
tmpfs_tempdir : bool, default True
|
308
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
309
|
-
tmpfs_size : int, optional, default: None
|
310
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
311
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
312
|
-
memory allocated for this step.
|
313
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
314
|
-
Path to tmpfs mount for this step.
|
315
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
316
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
317
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
318
|
-
shared_memory: int, optional
|
319
|
-
Shared memory size (in MiB) required for this step
|
320
|
-
port: int, optional
|
321
|
-
Port number to specify in the Kubernetes job object
|
322
|
-
compute_pool : str, optional, default None
|
323
|
-
Compute pool to be used for for this step.
|
324
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
325
|
-
hostname_resolution_timeout: int, default 10 * 60
|
326
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
327
|
-
Only applicable when @parallel is used.
|
328
|
-
qos: str, default: Burstable
|
329
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
330
|
-
|
331
|
-
security_context: Dict[str, Any], optional, default None
|
332
|
-
Container security context. Applies to the task container. Allows the following keys:
|
333
|
-
- privileged: bool, optional, default None
|
334
|
-
- allow_privilege_escalation: bool, optional, default None
|
335
|
-
- run_as_user: int, optional, default None
|
336
|
-
- run_as_group: int, optional, default None
|
337
|
-
- run_as_non_root: bool, optional, default None
|
338
|
-
"""
|
339
|
-
...
|
340
|
-
|
341
|
-
@typing.overload
|
342
|
-
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
343
|
-
"""
|
344
|
-
Specifies the resources needed when executing this step.
|
345
|
-
|
346
|
-
Use `@resources` to specify the resource requirements
|
347
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
348
|
-
|
349
|
-
You can choose the compute layer on the command line by executing e.g.
|
350
|
-
```
|
351
|
-
python myflow.py run --with batch
|
352
|
-
```
|
353
|
-
or
|
354
|
-
```
|
355
|
-
python myflow.py run --with kubernetes
|
356
|
-
```
|
357
|
-
which executes the flow on the desired system using the
|
358
|
-
requirements specified in `@resources`.
|
359
|
-
|
360
|
-
|
361
|
-
Parameters
|
362
|
-
----------
|
363
|
-
cpu : int, default 1
|
364
|
-
Number of CPUs required for this step.
|
365
|
-
gpu : int, optional, default None
|
366
|
-
Number of GPUs required for this step.
|
367
|
-
disk : int, optional, default None
|
368
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
369
|
-
memory : int, default 4096
|
370
|
-
Memory size (in MB) required for this step.
|
371
|
-
shared_memory : int, optional, default None
|
372
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
373
|
-
This parameter maps to the `--shm-size` option in Docker.
|
374
|
-
"""
|
375
|
-
...
|
376
|
-
|
377
|
-
@typing.overload
|
378
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
379
|
-
...
|
380
|
-
|
381
|
-
@typing.overload
|
382
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
383
|
-
...
|
384
|
-
|
385
|
-
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
386
|
-
"""
|
387
|
-
Specifies the resources needed when executing this step.
|
388
|
-
|
389
|
-
Use `@resources` to specify the resource requirements
|
390
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
391
|
-
|
392
|
-
You can choose the compute layer on the command line by executing e.g.
|
393
|
-
```
|
394
|
-
python myflow.py run --with batch
|
395
|
-
```
|
396
|
-
or
|
397
|
-
```
|
398
|
-
python myflow.py run --with kubernetes
|
399
|
-
```
|
400
|
-
which executes the flow on the desired system using the
|
401
|
-
requirements specified in `@resources`.
|
402
|
-
|
403
|
-
|
404
|
-
Parameters
|
405
|
-
----------
|
406
|
-
cpu : int, default 1
|
407
|
-
Number of CPUs required for this step.
|
408
|
-
gpu : int, optional, default None
|
409
|
-
Number of GPUs required for this step.
|
410
|
-
disk : int, optional, default None
|
411
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
412
|
-
memory : int, default 4096
|
413
|
-
Memory size (in MB) required for this step.
|
414
|
-
shared_memory : int, optional, default None
|
415
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
416
|
-
This parameter maps to the `--shm-size` option in Docker.
|
417
|
-
"""
|
418
|
-
...
|
419
|
-
|
420
|
-
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]]]:
|
421
|
-
"""
|
422
|
-
Specifies that this step should execute on DGX cloud.
|
423
|
-
|
424
|
-
|
425
|
-
Parameters
|
426
|
-
----------
|
427
|
-
gpu : int
|
428
|
-
Number of GPUs to use.
|
429
|
-
gpu_type : str
|
430
|
-
Type of Nvidia GPU to use.
|
431
|
-
"""
|
432
|
-
...
|
433
|
-
|
434
|
-
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]]]:
|
435
|
-
"""
|
436
|
-
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
437
|
-
|
438
|
-
User code call
|
439
|
-
--------------
|
440
|
-
@vllm(
|
441
|
-
model="...",
|
442
|
-
...
|
443
|
-
)
|
444
|
-
|
445
|
-
Valid backend options
|
446
|
-
---------------------
|
447
|
-
- 'local': Run as a separate process on the local task machine.
|
448
|
-
|
449
|
-
Valid model options
|
450
|
-
-------------------
|
451
|
-
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
452
|
-
|
453
|
-
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
454
|
-
If you need multiple models, you must create multiple @vllm decorators.
|
455
|
-
|
456
|
-
|
457
|
-
Parameters
|
458
|
-
----------
|
459
|
-
model: str
|
460
|
-
HuggingFace model identifier to be served by vLLM.
|
461
|
-
backend: str
|
462
|
-
Determines where and how to run the vLLM process.
|
463
|
-
debug: bool
|
464
|
-
Whether to turn on verbose debugging logs.
|
465
|
-
kwargs : Any
|
466
|
-
Any other keyword arguments are passed directly to the vLLM engine.
|
467
|
-
This allows for flexible configuration of vLLM server settings.
|
468
|
-
For example, `tensor_parallel_size=2`.
|
469
|
-
"""
|
470
|
-
...
|
471
|
-
|
472
|
-
@typing.overload
|
473
|
-
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]]]:
|
474
|
-
"""
|
475
|
-
Specifies that the step will success under all circumstances.
|
476
|
-
|
477
|
-
The decorator will create an optional artifact, specified by `var`, which
|
478
|
-
contains the exception raised. You can use it to detect the presence
|
479
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
480
|
-
are missing.
|
481
|
-
|
482
|
-
|
483
|
-
Parameters
|
484
|
-
----------
|
485
|
-
var : str, optional, default None
|
486
|
-
Name of the artifact in which to store the caught exception.
|
487
|
-
If not specified, the exception is not stored.
|
488
|
-
print_exception : bool, default True
|
489
|
-
Determines whether or not the exception is printed to
|
490
|
-
stdout when caught.
|
491
|
-
"""
|
492
|
-
...
|
493
|
-
|
494
|
-
@typing.overload
|
495
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
496
|
-
...
|
497
|
-
|
498
|
-
@typing.overload
|
499
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
500
|
-
...
|
501
|
-
|
502
|
-
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):
|
503
|
-
"""
|
504
|
-
Specifies that the step will success under all circumstances.
|
505
|
-
|
506
|
-
The decorator will create an optional artifact, specified by `var`, which
|
507
|
-
contains the exception raised. You can use it to detect the presence
|
508
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
509
|
-
are missing.
|
510
|
-
|
511
|
-
|
512
|
-
Parameters
|
513
|
-
----------
|
514
|
-
var : str, optional, default None
|
515
|
-
Name of the artifact in which to store the caught exception.
|
516
|
-
If not specified, the exception is not stored.
|
517
|
-
print_exception : bool, default True
|
518
|
-
Determines whether or not the exception is printed to
|
519
|
-
stdout when caught.
|
520
|
-
"""
|
521
|
-
...
|
522
|
-
|
523
|
-
@typing.overload
|
524
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
525
|
-
"""
|
526
|
-
Internal decorator to support Fast bakery
|
527
|
-
"""
|
528
|
-
...
|
529
|
-
|
530
|
-
@typing.overload
|
531
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
532
|
-
...
|
533
|
-
|
534
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
535
|
-
"""
|
536
|
-
Internal decorator to support Fast bakery
|
537
|
-
"""
|
538
|
-
...
|
539
|
-
|
540
|
-
@typing.overload
|
541
|
-
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]]]:
|
542
|
-
"""
|
543
|
-
Specifies the PyPI packages for the step.
|
544
|
-
|
545
|
-
Information in this decorator will augment any
|
546
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
547
|
-
you can use `@pypi_base` to set packages required by all
|
548
|
-
steps and use `@pypi` to specify step-specific overrides.
|
549
|
-
|
550
|
-
|
551
|
-
Parameters
|
552
|
-
----------
|
553
|
-
packages : Dict[str, str], default: {}
|
554
|
-
Packages to use for this step. The key is the name of the package
|
555
|
-
and the value is the version to use.
|
556
|
-
python : str, optional, default: None
|
557
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
558
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
559
|
-
"""
|
560
|
-
...
|
561
|
-
|
562
|
-
@typing.overload
|
563
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
564
|
-
...
|
565
|
-
|
566
|
-
@typing.overload
|
567
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
568
|
-
...
|
569
|
-
|
570
|
-
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):
|
571
|
-
"""
|
572
|
-
Specifies the PyPI packages for the step.
|
573
|
-
|
574
|
-
Information in this decorator will augment any
|
575
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
576
|
-
you can use `@pypi_base` to set packages required by all
|
577
|
-
steps and use `@pypi` to specify step-specific overrides.
|
578
|
-
|
579
|
-
|
580
|
-
Parameters
|
581
|
-
----------
|
582
|
-
packages : Dict[str, str], default: {}
|
583
|
-
Packages to use for this step. The key is the name of the package
|
584
|
-
and the value is the version to use.
|
585
|
-
python : str, optional, default: None
|
586
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
587
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
417
|
+
vars : Dict[str, str], default {}
|
418
|
+
Dictionary of environment variables to set.
|
588
419
|
"""
|
589
420
|
...
|
590
421
|
|
@@ -604,122 +435,6 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
|
|
604
435
|
"""
|
605
436
|
...
|
606
437
|
|
607
|
-
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]]]:
|
608
|
-
"""
|
609
|
-
Specifies that this step is used to deploy an instance of the app.
|
610
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
611
|
-
|
612
|
-
|
613
|
-
Parameters
|
614
|
-
----------
|
615
|
-
app_port : int
|
616
|
-
Number of GPUs to use.
|
617
|
-
app_name : str
|
618
|
-
Name of the app to deploy.
|
619
|
-
"""
|
620
|
-
...
|
621
|
-
|
622
|
-
@typing.overload
|
623
|
-
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]]]:
|
624
|
-
"""
|
625
|
-
Enables loading / saving of models within a step.
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
Parameters
|
630
|
-
----------
|
631
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
632
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
633
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
634
|
-
- `current.checkpoint`
|
635
|
-
- `current.model`
|
636
|
-
- `current.huggingface_hub`
|
637
|
-
|
638
|
-
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
|
639
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
640
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
641
|
-
|
642
|
-
temp_dir_root : str, default: None
|
643
|
-
The root directory under which `current.model.loaded` will store loaded models
|
644
|
-
"""
|
645
|
-
...
|
646
|
-
|
647
|
-
@typing.overload
|
648
|
-
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
649
|
-
...
|
650
|
-
|
651
|
-
@typing.overload
|
652
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
653
|
-
...
|
654
|
-
|
655
|
-
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):
|
656
|
-
"""
|
657
|
-
Enables loading / saving of models within a step.
|
658
|
-
|
659
|
-
|
660
|
-
|
661
|
-
Parameters
|
662
|
-
----------
|
663
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
664
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
665
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
666
|
-
- `current.checkpoint`
|
667
|
-
- `current.model`
|
668
|
-
- `current.huggingface_hub`
|
669
|
-
|
670
|
-
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
|
671
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
672
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
673
|
-
|
674
|
-
temp_dir_root : str, default: None
|
675
|
-
The root directory under which `current.model.loaded` will store loaded models
|
676
|
-
"""
|
677
|
-
...
|
678
|
-
|
679
|
-
@typing.overload
|
680
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
681
|
-
"""
|
682
|
-
Decorator prototype for all step decorators. This function gets specialized
|
683
|
-
and imported for all decorators types by _import_plugin_decorators().
|
684
|
-
"""
|
685
|
-
...
|
686
|
-
|
687
|
-
@typing.overload
|
688
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
689
|
-
...
|
690
|
-
|
691
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
692
|
-
"""
|
693
|
-
Decorator prototype for all step decorators. This function gets specialized
|
694
|
-
and imported for all decorators types by _import_plugin_decorators().
|
695
|
-
"""
|
696
|
-
...
|
697
|
-
|
698
|
-
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]]]:
|
699
|
-
"""
|
700
|
-
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
701
|
-
|
702
|
-
|
703
|
-
Parameters
|
704
|
-
----------
|
705
|
-
temp_dir_root : str, optional
|
706
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
707
|
-
|
708
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
709
|
-
The list of repos (models/datasets) to load.
|
710
|
-
|
711
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
712
|
-
|
713
|
-
- If repo (model/dataset) is not found in the datastore:
|
714
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
715
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
716
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
717
|
-
|
718
|
-
- If repo is found in the datastore:
|
719
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
720
|
-
"""
|
721
|
-
...
|
722
|
-
|
723
438
|
@typing.overload
|
724
439
|
def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
725
440
|
"""
|
@@ -777,46 +492,22 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
777
492
|
"""
|
778
493
|
...
|
779
494
|
|
780
|
-
|
495
|
+
@typing.overload
|
496
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
497
|
+
"""
|
498
|
+
Decorator prototype for all step decorators. This function gets specialized
|
499
|
+
and imported for all decorators types by _import_plugin_decorators().
|
500
|
+
"""
|
501
|
+
...
|
502
|
+
|
503
|
+
@typing.overload
|
504
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
505
|
+
...
|
506
|
+
|
507
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
781
508
|
"""
|
782
|
-
|
783
|
-
|
784
|
-
User code call
|
785
|
-
--------------
|
786
|
-
@ollama(
|
787
|
-
models=[...],
|
788
|
-
...
|
789
|
-
)
|
790
|
-
|
791
|
-
Valid backend options
|
792
|
-
---------------------
|
793
|
-
- 'local': Run as a separate process on the local task machine.
|
794
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
795
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
796
|
-
|
797
|
-
Valid model options
|
798
|
-
-------------------
|
799
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
800
|
-
|
801
|
-
|
802
|
-
Parameters
|
803
|
-
----------
|
804
|
-
models: list[str]
|
805
|
-
List of Ollama containers running models in sidecars.
|
806
|
-
backend: str
|
807
|
-
Determines where and how to run the Ollama process.
|
808
|
-
force_pull: bool
|
809
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
810
|
-
cache_update_policy: str
|
811
|
-
Cache update policy: "auto", "force", or "never".
|
812
|
-
force_cache_update: bool
|
813
|
-
Simple override for "force" cache update policy.
|
814
|
-
debug: bool
|
815
|
-
Whether to turn on verbose debugging logs.
|
816
|
-
circuit_breaker_config: dict
|
817
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
818
|
-
timeout_config: dict
|
819
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
509
|
+
Decorator prototype for all step decorators. This function gets specialized
|
510
|
+
and imported for all decorators types by _import_plugin_decorators().
|
820
511
|
"""
|
821
512
|
...
|
822
513
|
|
@@ -880,84 +571,265 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
880
571
|
...
|
881
572
|
|
882
573
|
@typing.overload
|
883
|
-
def
|
574
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
884
575
|
"""
|
885
|
-
|
576
|
+
Internal decorator to support Fast bakery
|
577
|
+
"""
|
578
|
+
...
|
579
|
+
|
580
|
+
@typing.overload
|
581
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
582
|
+
...
|
583
|
+
|
584
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
585
|
+
"""
|
586
|
+
Internal decorator to support Fast bakery
|
587
|
+
"""
|
588
|
+
...
|
589
|
+
|
590
|
+
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]]]:
|
591
|
+
"""
|
592
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
593
|
+
|
594
|
+
User code call
|
595
|
+
--------------
|
596
|
+
@vllm(
|
597
|
+
model="...",
|
598
|
+
...
|
599
|
+
)
|
600
|
+
|
601
|
+
Valid backend options
|
602
|
+
---------------------
|
603
|
+
- 'local': Run as a separate process on the local task machine.
|
604
|
+
|
605
|
+
Valid model options
|
606
|
+
-------------------
|
607
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
608
|
+
|
609
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
610
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
886
611
|
|
887
612
|
|
888
613
|
Parameters
|
889
614
|
----------
|
890
|
-
|
891
|
-
|
615
|
+
model: str
|
616
|
+
HuggingFace model identifier to be served by vLLM.
|
617
|
+
backend: str
|
618
|
+
Determines where and how to run the vLLM process.
|
619
|
+
debug: bool
|
620
|
+
Whether to turn on verbose debugging logs.
|
621
|
+
kwargs : Any
|
622
|
+
Any other keyword arguments are passed directly to the vLLM engine.
|
623
|
+
This allows for flexible configuration of vLLM server settings.
|
624
|
+
For example, `tensor_parallel_size=2`.
|
892
625
|
"""
|
893
626
|
...
|
894
627
|
|
895
628
|
@typing.overload
|
896
|
-
def
|
629
|
+
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]]]:
|
630
|
+
"""
|
631
|
+
Specifies a timeout for your step.
|
632
|
+
|
633
|
+
This decorator is useful if this step may hang indefinitely.
|
634
|
+
|
635
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
636
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
637
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
638
|
+
|
639
|
+
Note that all the values specified in parameters are added together so if you specify
|
640
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
641
|
+
|
642
|
+
|
643
|
+
Parameters
|
644
|
+
----------
|
645
|
+
seconds : int, default 0
|
646
|
+
Number of seconds to wait prior to timing out.
|
647
|
+
minutes : int, default 0
|
648
|
+
Number of minutes to wait prior to timing out.
|
649
|
+
hours : int, default 0
|
650
|
+
Number of hours to wait prior to timing out.
|
651
|
+
"""
|
897
652
|
...
|
898
653
|
|
899
654
|
@typing.overload
|
900
|
-
def
|
655
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
901
656
|
...
|
902
657
|
|
903
|
-
|
658
|
+
@typing.overload
|
659
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
660
|
+
...
|
661
|
+
|
662
|
+
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):
|
904
663
|
"""
|
905
|
-
Specifies
|
664
|
+
Specifies a timeout for your step.
|
665
|
+
|
666
|
+
This decorator is useful if this step may hang indefinitely.
|
667
|
+
|
668
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
669
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
670
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
671
|
+
|
672
|
+
Note that all the values specified in parameters are added together so if you specify
|
673
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
906
674
|
|
907
675
|
|
908
676
|
Parameters
|
909
677
|
----------
|
910
|
-
|
911
|
-
|
678
|
+
seconds : int, default 0
|
679
|
+
Number of seconds to wait prior to timing out.
|
680
|
+
minutes : int, default 0
|
681
|
+
Number of minutes to wait prior to timing out.
|
682
|
+
hours : int, default 0
|
683
|
+
Number of hours to wait prior to timing out.
|
912
684
|
"""
|
913
685
|
...
|
914
686
|
|
915
|
-
|
916
|
-
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]]]:
|
687
|
+
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]]]:
|
917
688
|
"""
|
918
|
-
|
689
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
919
690
|
|
920
|
-
|
691
|
+
|
692
|
+
Parameters
|
693
|
+
----------
|
694
|
+
temp_dir_root : str, optional
|
695
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
696
|
+
|
697
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
698
|
+
The list of repos (models/datasets) to load.
|
699
|
+
|
700
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
701
|
+
|
702
|
+
- If repo (model/dataset) is not found in the datastore:
|
703
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
704
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
705
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
706
|
+
|
707
|
+
- If repo is found in the datastore:
|
708
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
709
|
+
"""
|
710
|
+
...
|
711
|
+
|
712
|
+
@typing.overload
|
713
|
+
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]]]:
|
714
|
+
"""
|
715
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
716
|
+
the execution of a step.
|
921
717
|
|
922
718
|
|
923
719
|
Parameters
|
924
720
|
----------
|
925
|
-
|
926
|
-
|
927
|
-
id : str, optional, default None
|
928
|
-
If multiple cards are present, use this id to identify this card.
|
929
|
-
options : Dict[str, Any], default {}
|
930
|
-
Options passed to the card. The contents depend on the card type.
|
931
|
-
timeout : int, default 45
|
932
|
-
Interrupt reporting if it takes more than this many seconds.
|
721
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
722
|
+
List of secret specs, defining how the secrets are to be retrieved
|
933
723
|
"""
|
934
724
|
...
|
935
725
|
|
936
726
|
@typing.overload
|
937
|
-
def
|
727
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
938
728
|
...
|
939
729
|
|
940
730
|
@typing.overload
|
941
|
-
def
|
731
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
942
732
|
...
|
943
733
|
|
944
|
-
def
|
734
|
+
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]]] = []):
|
945
735
|
"""
|
946
|
-
|
736
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
737
|
+
the execution of a step.
|
738
|
+
|
739
|
+
|
740
|
+
Parameters
|
741
|
+
----------
|
742
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
743
|
+
List of secret specs, defining how the secrets are to be retrieved
|
744
|
+
"""
|
745
|
+
...
|
746
|
+
|
747
|
+
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]]]:
|
748
|
+
"""
|
749
|
+
Specifies that this step should execute on Kubernetes.
|
947
750
|
|
948
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
949
751
|
|
752
|
+
Parameters
|
753
|
+
----------
|
754
|
+
cpu : int, default 1
|
755
|
+
Number of CPUs required for this step. If `@resources` is
|
756
|
+
also present, the maximum value from all decorators is used.
|
757
|
+
memory : int, default 4096
|
758
|
+
Memory size (in MB) required for this step. If
|
759
|
+
`@resources` is also present, the maximum value from all decorators is
|
760
|
+
used.
|
761
|
+
disk : int, default 10240
|
762
|
+
Disk size (in MB) required for this step. If
|
763
|
+
`@resources` is also present, the maximum value from all decorators is
|
764
|
+
used.
|
765
|
+
image : str, optional, default None
|
766
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
767
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
768
|
+
not, a default Docker image mapping to the current version of Python is used.
|
769
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
770
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
771
|
+
image_pull_secrets: List[str], default []
|
772
|
+
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
773
|
+
Kubernetes image pull secrets to use when pulling container images
|
774
|
+
in Kubernetes.
|
775
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
776
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
777
|
+
secrets : List[str], optional, default None
|
778
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
779
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
780
|
+
in Metaflow configuration.
|
781
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
782
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
783
|
+
Can be passed in as a comma separated string of values e.g.
|
784
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
785
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
786
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
787
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
788
|
+
gpu : int, optional, default None
|
789
|
+
Number of GPUs required for this step. A value of zero implies that
|
790
|
+
the scheduled node should not have GPUs.
|
791
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
792
|
+
The vendor of the GPUs to be used for this step.
|
793
|
+
tolerations : List[str], default []
|
794
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
795
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
796
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
797
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
798
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
799
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
800
|
+
use_tmpfs : bool, default False
|
801
|
+
This enables an explicit tmpfs mount for this step.
|
802
|
+
tmpfs_tempdir : bool, default True
|
803
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
804
|
+
tmpfs_size : int, optional, default: None
|
805
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
806
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
807
|
+
memory allocated for this step.
|
808
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
809
|
+
Path to tmpfs mount for this step.
|
810
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
811
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
812
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
813
|
+
shared_memory: int, optional
|
814
|
+
Shared memory size (in MiB) required for this step
|
815
|
+
port: int, optional
|
816
|
+
Port number to specify in the Kubernetes job object
|
817
|
+
compute_pool : str, optional, default None
|
818
|
+
Compute pool to be used for for this step.
|
819
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
820
|
+
hostname_resolution_timeout: int, default 10 * 60
|
821
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
822
|
+
Only applicable when @parallel is used.
|
823
|
+
qos: str, default: Burstable
|
824
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
950
825
|
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
Options passed to the card. The contents depend on the card type.
|
959
|
-
timeout : int, default 45
|
960
|
-
Interrupt reporting if it takes more than this many seconds.
|
826
|
+
security_context: Dict[str, Any], optional, default None
|
827
|
+
Container security context. Applies to the task container. Allows the following keys:
|
828
|
+
- privileged: bool, optional, default None
|
829
|
+
- allow_privilege_escalation: bool, optional, default None
|
830
|
+
- run_as_user: int, optional, default None
|
831
|
+
- run_as_group: int, optional, default None
|
832
|
+
- run_as_non_root: bool, optional, default None
|
961
833
|
"""
|
962
834
|
...
|
963
835
|
|
@@ -1016,291 +888,166 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
1016
888
|
"""
|
1017
889
|
...
|
1018
890
|
|
1019
|
-
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]]:
|
1020
|
-
"""
|
1021
|
-
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)
|
1022
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1023
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1024
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1025
|
-
starts only after all sensors finish.
|
1026
|
-
|
1027
|
-
|
1028
|
-
Parameters
|
1029
|
-
----------
|
1030
|
-
timeout : int
|
1031
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1032
|
-
poke_interval : int
|
1033
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1034
|
-
mode : str
|
1035
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1036
|
-
exponential_backoff : bool
|
1037
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1038
|
-
pool : str
|
1039
|
-
the slot pool this task should run in,
|
1040
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1041
|
-
soft_fail : bool
|
1042
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1043
|
-
name : str
|
1044
|
-
Name of the sensor on Airflow
|
1045
|
-
description : str
|
1046
|
-
Description of sensor in the Airflow UI
|
1047
|
-
bucket_key : Union[str, List[str]]
|
1048
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1049
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1050
|
-
bucket_name : str
|
1051
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1052
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1053
|
-
wildcard_match : bool
|
1054
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1055
|
-
aws_conn_id : str
|
1056
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1057
|
-
verify : bool
|
1058
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1059
|
-
"""
|
1060
|
-
...
|
1061
|
-
|
1062
891
|
@typing.overload
|
1063
|
-
def
|
892
|
+
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]]]:
|
1064
893
|
"""
|
1065
|
-
|
1066
|
-
|
1067
|
-
```
|
1068
|
-
@trigger_on_finish(flow='FooFlow')
|
1069
|
-
```
|
1070
|
-
or
|
1071
|
-
```
|
1072
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1073
|
-
```
|
1074
|
-
This decorator respects the @project decorator and triggers the flow
|
1075
|
-
when upstream runs within the same namespace complete successfully
|
1076
|
-
|
1077
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1078
|
-
by specifying the fully qualified project_flow_name.
|
1079
|
-
```
|
1080
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1081
|
-
```
|
1082
|
-
or
|
1083
|
-
```
|
1084
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1085
|
-
```
|
1086
|
-
|
1087
|
-
You can also specify just the project or project branch (other values will be
|
1088
|
-
inferred from the current project or project branch):
|
1089
|
-
```
|
1090
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1091
|
-
```
|
894
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1092
895
|
|
1093
|
-
Note that `
|
1094
|
-
- `prod`
|
1095
|
-
- `user.bob`
|
1096
|
-
- `test.my_experiment`
|
1097
|
-
- `prod.staging`
|
896
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1098
897
|
|
1099
898
|
|
1100
899
|
Parameters
|
1101
900
|
----------
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
901
|
+
type : str, default 'default'
|
902
|
+
Card type.
|
903
|
+
id : str, optional, default None
|
904
|
+
If multiple cards are present, use this id to identify this card.
|
1106
905
|
options : Dict[str, Any], default {}
|
1107
|
-
|
906
|
+
Options passed to the card. The contents depend on the card type.
|
907
|
+
timeout : int, default 45
|
908
|
+
Interrupt reporting if it takes more than this many seconds.
|
1108
909
|
"""
|
1109
910
|
...
|
1110
911
|
|
1111
912
|
@typing.overload
|
1112
|
-
def
|
913
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1113
914
|
...
|
1114
915
|
|
1115
|
-
|
916
|
+
@typing.overload
|
917
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
918
|
+
...
|
919
|
+
|
920
|
+
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):
|
1116
921
|
"""
|
1117
|
-
|
1118
|
-
|
1119
|
-
```
|
1120
|
-
@trigger_on_finish(flow='FooFlow')
|
1121
|
-
```
|
1122
|
-
or
|
1123
|
-
```
|
1124
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1125
|
-
```
|
1126
|
-
This decorator respects the @project decorator and triggers the flow
|
1127
|
-
when upstream runs within the same namespace complete successfully
|
1128
|
-
|
1129
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1130
|
-
by specifying the fully qualified project_flow_name.
|
1131
|
-
```
|
1132
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1133
|
-
```
|
1134
|
-
or
|
1135
|
-
```
|
1136
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1137
|
-
```
|
1138
|
-
|
1139
|
-
You can also specify just the project or project branch (other values will be
|
1140
|
-
inferred from the current project or project branch):
|
1141
|
-
```
|
1142
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1143
|
-
```
|
922
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
1144
923
|
|
1145
|
-
Note that `
|
1146
|
-
- `prod`
|
1147
|
-
- `user.bob`
|
1148
|
-
- `test.my_experiment`
|
1149
|
-
- `prod.staging`
|
924
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1150
925
|
|
1151
926
|
|
1152
927
|
Parameters
|
1153
928
|
----------
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
929
|
+
type : str, default 'default'
|
930
|
+
Card type.
|
931
|
+
id : str, optional, default None
|
932
|
+
If multiple cards are present, use this id to identify this card.
|
1158
933
|
options : Dict[str, Any], default {}
|
1159
|
-
|
934
|
+
Options passed to the card. The contents depend on the card type.
|
935
|
+
timeout : int, default 45
|
936
|
+
Interrupt reporting if it takes more than this many seconds.
|
1160
937
|
"""
|
1161
938
|
...
|
1162
939
|
|
1163
940
|
@typing.overload
|
1164
|
-
def
|
941
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1165
942
|
"""
|
1166
|
-
Specifies the
|
943
|
+
Specifies the resources needed when executing this step.
|
1167
944
|
|
1168
|
-
|
1169
|
-
|
1170
|
-
```
|
1171
|
-
or
|
1172
|
-
```
|
1173
|
-
@trigger(events=['foo', 'bar'])
|
1174
|
-
```
|
945
|
+
Use `@resources` to specify the resource requirements
|
946
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1175
947
|
|
1176
|
-
|
1177
|
-
to map event payload to Metaflow parameters for the flow.
|
948
|
+
You can choose the compute layer on the command line by executing e.g.
|
1178
949
|
```
|
1179
|
-
|
950
|
+
python myflow.py run --with batch
|
1180
951
|
```
|
1181
952
|
or
|
1182
953
|
```
|
1183
|
-
|
1184
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1185
|
-
```
|
1186
|
-
|
1187
|
-
'parameters' can also be a list of strings and tuples like so:
|
1188
|
-
```
|
1189
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1190
|
-
```
|
1191
|
-
This is equivalent to:
|
1192
|
-
```
|
1193
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
954
|
+
python myflow.py run --with kubernetes
|
1194
955
|
```
|
956
|
+
which executes the flow on the desired system using the
|
957
|
+
requirements specified in `@resources`.
|
1195
958
|
|
1196
959
|
|
1197
960
|
Parameters
|
1198
961
|
----------
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
962
|
+
cpu : int, default 1
|
963
|
+
Number of CPUs required for this step.
|
964
|
+
gpu : int, optional, default None
|
965
|
+
Number of GPUs required for this step.
|
966
|
+
disk : int, optional, default None
|
967
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
968
|
+
memory : int, default 4096
|
969
|
+
Memory size (in MB) required for this step.
|
970
|
+
shared_memory : int, optional, default None
|
971
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
972
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1205
973
|
"""
|
1206
974
|
...
|
1207
975
|
|
1208
976
|
@typing.overload
|
1209
|
-
def
|
977
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1210
978
|
...
|
1211
979
|
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
or
|
1220
|
-
```
|
1221
|
-
@trigger(events=['foo', 'bar'])
|
1222
|
-
```
|
980
|
+
@typing.overload
|
981
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
982
|
+
...
|
983
|
+
|
984
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
985
|
+
"""
|
986
|
+
Specifies the resources needed when executing this step.
|
1223
987
|
|
1224
|
-
|
1225
|
-
|
1226
|
-
```
|
1227
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1228
|
-
```
|
1229
|
-
or
|
1230
|
-
```
|
1231
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1232
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1233
|
-
```
|
988
|
+
Use `@resources` to specify the resource requirements
|
989
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1234
990
|
|
1235
|
-
|
991
|
+
You can choose the compute layer on the command line by executing e.g.
|
1236
992
|
```
|
1237
|
-
|
993
|
+
python myflow.py run --with batch
|
1238
994
|
```
|
1239
|
-
|
995
|
+
or
|
1240
996
|
```
|
1241
|
-
|
997
|
+
python myflow.py run --with kubernetes
|
1242
998
|
```
|
999
|
+
which executes the flow on the desired system using the
|
1000
|
+
requirements specified in `@resources`.
|
1243
1001
|
|
1244
1002
|
|
1245
1003
|
Parameters
|
1246
1004
|
----------
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1005
|
+
cpu : int, default 1
|
1006
|
+
Number of CPUs required for this step.
|
1007
|
+
gpu : int, optional, default None
|
1008
|
+
Number of GPUs required for this step.
|
1009
|
+
disk : int, optional, default None
|
1010
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1011
|
+
memory : int, default 4096
|
1012
|
+
Memory size (in MB) required for this step.
|
1013
|
+
shared_memory : int, optional, default None
|
1014
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1015
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1253
1016
|
"""
|
1254
1017
|
...
|
1255
1018
|
|
1256
|
-
|
1257
|
-
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]]:
|
1019
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1258
1020
|
"""
|
1259
|
-
Specifies
|
1021
|
+
Specifies what flows belong to the same project.
|
1260
1022
|
|
1261
|
-
|
1262
|
-
|
1023
|
+
A project-specific namespace is created for all flows that
|
1024
|
+
use the same `@project(name)`.
|
1263
1025
|
|
1264
1026
|
|
1265
1027
|
Parameters
|
1266
1028
|
----------
|
1267
|
-
|
1268
|
-
|
1269
|
-
|
1270
|
-
|
1271
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1272
|
-
python : str, optional, default None
|
1273
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1274
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1275
|
-
disabled : bool, default False
|
1276
|
-
If set to True, disables Conda.
|
1277
|
-
"""
|
1278
|
-
...
|
1279
|
-
|
1280
|
-
@typing.overload
|
1281
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1282
|
-
...
|
1283
|
-
|
1284
|
-
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):
|
1285
|
-
"""
|
1286
|
-
Specifies the Conda environment for all steps of the flow.
|
1287
|
-
|
1288
|
-
Use `@conda_base` to set common libraries required by all
|
1289
|
-
steps and use `@conda` to specify step-specific additions.
|
1029
|
+
name : str
|
1030
|
+
Project name. Make sure that the name is unique amongst all
|
1031
|
+
projects that use the same production scheduler. The name may
|
1032
|
+
contain only lowercase alphanumeric characters and underscores.
|
1290
1033
|
|
1034
|
+
branch : Optional[str], default None
|
1035
|
+
The branch to use. If not specified, the branch is set to
|
1036
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1037
|
+
also be set on the command line using `--branch` as a top-level option.
|
1038
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1291
1039
|
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1302
|
-
|
1303
|
-
If set to True, disables Conda.
|
1040
|
+
production : bool, default False
|
1041
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1042
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1043
|
+
`production` in the decorator and on the command line.
|
1044
|
+
The project branch name will be:
|
1045
|
+
- if `branch` is specified:
|
1046
|
+
- if `production` is True: `prod.<branch>`
|
1047
|
+
- if `production` is False: `test.<branch>`
|
1048
|
+
- if `branch` is not specified:
|
1049
|
+
- if `production` is True: `prod`
|
1050
|
+
- if `production` is False: `user.<username>`
|
1304
1051
|
"""
|
1305
1052
|
...
|
1306
1053
|
|
@@ -1461,130 +1208,383 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1461
1208
|
"""
|
1462
1209
|
...
|
1463
1210
|
|
1464
|
-
|
1211
|
+
@typing.overload
|
1212
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1465
1213
|
"""
|
1466
|
-
Specifies
|
1214
|
+
Specifies the PyPI packages for all steps of the flow.
|
1467
1215
|
|
1468
|
-
|
1469
|
-
use
|
1216
|
+
Use `@pypi_base` to set common packages required by all
|
1217
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1218
|
+
|
1219
|
+
Parameters
|
1220
|
+
----------
|
1221
|
+
packages : Dict[str, str], default: {}
|
1222
|
+
Packages to use for this flow. The key is the name of the package
|
1223
|
+
and the value is the version to use.
|
1224
|
+
python : str, optional, default: None
|
1225
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1226
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1227
|
+
"""
|
1228
|
+
...
|
1229
|
+
|
1230
|
+
@typing.overload
|
1231
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1232
|
+
...
|
1233
|
+
|
1234
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1235
|
+
"""
|
1236
|
+
Specifies the PyPI packages for all steps of the flow.
|
1237
|
+
|
1238
|
+
Use `@pypi_base` to set common packages required by all
|
1239
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1240
|
+
|
1241
|
+
Parameters
|
1242
|
+
----------
|
1243
|
+
packages : Dict[str, str], default: {}
|
1244
|
+
Packages to use for this flow. The key is the name of the package
|
1245
|
+
and the value is the version to use.
|
1246
|
+
python : str, optional, default: None
|
1247
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1248
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1249
|
+
"""
|
1250
|
+
...
|
1251
|
+
|
1252
|
+
@typing.overload
|
1253
|
+
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]]:
|
1254
|
+
"""
|
1255
|
+
Specifies the times when the flow should be run when running on a
|
1256
|
+
production scheduler.
|
1257
|
+
|
1258
|
+
|
1259
|
+
Parameters
|
1260
|
+
----------
|
1261
|
+
hourly : bool, default False
|
1262
|
+
Run the workflow hourly.
|
1263
|
+
daily : bool, default True
|
1264
|
+
Run the workflow daily.
|
1265
|
+
weekly : bool, default False
|
1266
|
+
Run the workflow weekly.
|
1267
|
+
cron : str, optional, default None
|
1268
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1269
|
+
specified by this expression.
|
1270
|
+
timezone : str, optional, default None
|
1271
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1272
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1273
|
+
"""
|
1274
|
+
...
|
1275
|
+
|
1276
|
+
@typing.overload
|
1277
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1278
|
+
...
|
1279
|
+
|
1280
|
+
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):
|
1281
|
+
"""
|
1282
|
+
Specifies the times when the flow should be run when running on a
|
1283
|
+
production scheduler.
|
1284
|
+
|
1285
|
+
|
1286
|
+
Parameters
|
1287
|
+
----------
|
1288
|
+
hourly : bool, default False
|
1289
|
+
Run the workflow hourly.
|
1290
|
+
daily : bool, default True
|
1291
|
+
Run the workflow daily.
|
1292
|
+
weekly : bool, default False
|
1293
|
+
Run the workflow weekly.
|
1294
|
+
cron : str, optional, default None
|
1295
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1296
|
+
specified by this expression.
|
1297
|
+
timezone : str, optional, default None
|
1298
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1299
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1300
|
+
"""
|
1301
|
+
...
|
1302
|
+
|
1303
|
+
@typing.overload
|
1304
|
+
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]]:
|
1305
|
+
"""
|
1306
|
+
Specifies the Conda environment for all steps of the flow.
|
1307
|
+
|
1308
|
+
Use `@conda_base` to set common libraries required by all
|
1309
|
+
steps and use `@conda` to specify step-specific additions.
|
1310
|
+
|
1311
|
+
|
1312
|
+
Parameters
|
1313
|
+
----------
|
1314
|
+
packages : Dict[str, str], default {}
|
1315
|
+
Packages to use for this flow. The key is the name of the package
|
1316
|
+
and the value is the version to use.
|
1317
|
+
libraries : Dict[str, str], default {}
|
1318
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1319
|
+
python : str, optional, default None
|
1320
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1321
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1322
|
+
disabled : bool, default False
|
1323
|
+
If set to True, disables Conda.
|
1324
|
+
"""
|
1325
|
+
...
|
1326
|
+
|
1327
|
+
@typing.overload
|
1328
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1329
|
+
...
|
1330
|
+
|
1331
|
+
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):
|
1332
|
+
"""
|
1333
|
+
Specifies the Conda environment for all steps of the flow.
|
1334
|
+
|
1335
|
+
Use `@conda_base` to set common libraries required by all
|
1336
|
+
steps and use `@conda` to specify step-specific additions.
|
1337
|
+
|
1338
|
+
|
1339
|
+
Parameters
|
1340
|
+
----------
|
1341
|
+
packages : Dict[str, str], default {}
|
1342
|
+
Packages to use for this flow. The key is the name of the package
|
1343
|
+
and the value is the version to use.
|
1344
|
+
libraries : Dict[str, str], default {}
|
1345
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1346
|
+
python : str, optional, default None
|
1347
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1348
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1349
|
+
disabled : bool, default False
|
1350
|
+
If set to True, disables Conda.
|
1351
|
+
"""
|
1352
|
+
...
|
1353
|
+
|
1354
|
+
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]]:
|
1355
|
+
"""
|
1356
|
+
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)
|
1357
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1358
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1359
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1360
|
+
starts only after all sensors finish.
|
1470
1361
|
|
1471
1362
|
|
1472
1363
|
Parameters
|
1473
1364
|
----------
|
1365
|
+
timeout : int
|
1366
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1367
|
+
poke_interval : int
|
1368
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1369
|
+
mode : str
|
1370
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1371
|
+
exponential_backoff : bool
|
1372
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1373
|
+
pool : str
|
1374
|
+
the slot pool this task should run in,
|
1375
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1376
|
+
soft_fail : bool
|
1377
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1474
1378
|
name : str
|
1475
|
-
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
1488
|
-
|
1489
|
-
|
1490
|
-
- if `branch` is specified:
|
1491
|
-
- if `production` is True: `prod.<branch>`
|
1492
|
-
- if `production` is False: `test.<branch>`
|
1493
|
-
- if `branch` is not specified:
|
1494
|
-
- if `production` is True: `prod`
|
1495
|
-
- if `production` is False: `user.<username>`
|
1379
|
+
Name of the sensor on Airflow
|
1380
|
+
description : str
|
1381
|
+
Description of sensor in the Airflow UI
|
1382
|
+
bucket_key : Union[str, List[str]]
|
1383
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1384
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1385
|
+
bucket_name : str
|
1386
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1387
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1388
|
+
wildcard_match : bool
|
1389
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1390
|
+
aws_conn_id : str
|
1391
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1392
|
+
verify : bool
|
1393
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1496
1394
|
"""
|
1497
1395
|
...
|
1498
1396
|
|
1499
1397
|
@typing.overload
|
1500
|
-
def
|
1398
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1501
1399
|
"""
|
1502
|
-
Specifies the
|
1503
|
-
|
1400
|
+
Specifies the flow(s) that this flow depends on.
|
1401
|
+
|
1402
|
+
```
|
1403
|
+
@trigger_on_finish(flow='FooFlow')
|
1404
|
+
```
|
1405
|
+
or
|
1406
|
+
```
|
1407
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1408
|
+
```
|
1409
|
+
This decorator respects the @project decorator and triggers the flow
|
1410
|
+
when upstream runs within the same namespace complete successfully
|
1411
|
+
|
1412
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1413
|
+
by specifying the fully qualified project_flow_name.
|
1414
|
+
```
|
1415
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1416
|
+
```
|
1417
|
+
or
|
1418
|
+
```
|
1419
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1420
|
+
```
|
1421
|
+
|
1422
|
+
You can also specify just the project or project branch (other values will be
|
1423
|
+
inferred from the current project or project branch):
|
1424
|
+
```
|
1425
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1426
|
+
```
|
1427
|
+
|
1428
|
+
Note that `branch` is typically one of:
|
1429
|
+
- `prod`
|
1430
|
+
- `user.bob`
|
1431
|
+
- `test.my_experiment`
|
1432
|
+
- `prod.staging`
|
1504
1433
|
|
1505
1434
|
|
1506
1435
|
Parameters
|
1507
1436
|
----------
|
1508
|
-
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
cron : str, optional, default None
|
1515
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1516
|
-
specified by this expression.
|
1517
|
-
timezone : str, optional, default None
|
1518
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1519
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1437
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1438
|
+
Upstream flow dependency for this flow.
|
1439
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1440
|
+
Upstream flow dependencies for this flow.
|
1441
|
+
options : Dict[str, Any], default {}
|
1442
|
+
Backend-specific configuration for tuning eventing behavior.
|
1520
1443
|
"""
|
1521
1444
|
...
|
1522
1445
|
|
1523
1446
|
@typing.overload
|
1524
|
-
def
|
1447
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1525
1448
|
...
|
1526
1449
|
|
1527
|
-
def
|
1450
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1528
1451
|
"""
|
1529
|
-
Specifies the
|
1530
|
-
|
1452
|
+
Specifies the flow(s) that this flow depends on.
|
1453
|
+
|
1454
|
+
```
|
1455
|
+
@trigger_on_finish(flow='FooFlow')
|
1456
|
+
```
|
1457
|
+
or
|
1458
|
+
```
|
1459
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1460
|
+
```
|
1461
|
+
This decorator respects the @project decorator and triggers the flow
|
1462
|
+
when upstream runs within the same namespace complete successfully
|
1463
|
+
|
1464
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1465
|
+
by specifying the fully qualified project_flow_name.
|
1466
|
+
```
|
1467
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1468
|
+
```
|
1469
|
+
or
|
1470
|
+
```
|
1471
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1472
|
+
```
|
1473
|
+
|
1474
|
+
You can also specify just the project or project branch (other values will be
|
1475
|
+
inferred from the current project or project branch):
|
1476
|
+
```
|
1477
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1478
|
+
```
|
1479
|
+
|
1480
|
+
Note that `branch` is typically one of:
|
1481
|
+
- `prod`
|
1482
|
+
- `user.bob`
|
1483
|
+
- `test.my_experiment`
|
1484
|
+
- `prod.staging`
|
1531
1485
|
|
1532
1486
|
|
1533
1487
|
Parameters
|
1534
1488
|
----------
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
cron : str, optional, default None
|
1542
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1543
|
-
specified by this expression.
|
1544
|
-
timezone : str, optional, default None
|
1545
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1546
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1489
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1490
|
+
Upstream flow dependency for this flow.
|
1491
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1492
|
+
Upstream flow dependencies for this flow.
|
1493
|
+
options : Dict[str, Any], default {}
|
1494
|
+
Backend-specific configuration for tuning eventing behavior.
|
1547
1495
|
"""
|
1548
1496
|
...
|
1549
1497
|
|
1550
1498
|
@typing.overload
|
1551
|
-
def
|
1499
|
+
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]]:
|
1552
1500
|
"""
|
1553
|
-
Specifies the
|
1501
|
+
Specifies the event(s) that this flow depends on.
|
1502
|
+
|
1503
|
+
```
|
1504
|
+
@trigger(event='foo')
|
1505
|
+
```
|
1506
|
+
or
|
1507
|
+
```
|
1508
|
+
@trigger(events=['foo', 'bar'])
|
1509
|
+
```
|
1510
|
+
|
1511
|
+
Additionally, you can specify the parameter mappings
|
1512
|
+
to map event payload to Metaflow parameters for the flow.
|
1513
|
+
```
|
1514
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1515
|
+
```
|
1516
|
+
or
|
1517
|
+
```
|
1518
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1519
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1520
|
+
```
|
1521
|
+
|
1522
|
+
'parameters' can also be a list of strings and tuples like so:
|
1523
|
+
```
|
1524
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1525
|
+
```
|
1526
|
+
This is equivalent to:
|
1527
|
+
```
|
1528
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1529
|
+
```
|
1554
1530
|
|
1555
|
-
Use `@pypi_base` to set common packages required by all
|
1556
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1557
1531
|
|
1558
1532
|
Parameters
|
1559
1533
|
----------
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1534
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1535
|
+
Event dependency for this flow.
|
1536
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1537
|
+
Events dependency for this flow.
|
1538
|
+
options : Dict[str, Any], default {}
|
1539
|
+
Backend-specific configuration for tuning eventing behavior.
|
1566
1540
|
"""
|
1567
1541
|
...
|
1568
1542
|
|
1569
1543
|
@typing.overload
|
1570
|
-
def
|
1544
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1571
1545
|
...
|
1572
1546
|
|
1573
|
-
def
|
1547
|
+
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] = {}):
|
1574
1548
|
"""
|
1575
|
-
Specifies the
|
1549
|
+
Specifies the event(s) that this flow depends on.
|
1550
|
+
|
1551
|
+
```
|
1552
|
+
@trigger(event='foo')
|
1553
|
+
```
|
1554
|
+
or
|
1555
|
+
```
|
1556
|
+
@trigger(events=['foo', 'bar'])
|
1557
|
+
```
|
1558
|
+
|
1559
|
+
Additionally, you can specify the parameter mappings
|
1560
|
+
to map event payload to Metaflow parameters for the flow.
|
1561
|
+
```
|
1562
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1563
|
+
```
|
1564
|
+
or
|
1565
|
+
```
|
1566
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1567
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1568
|
+
```
|
1569
|
+
|
1570
|
+
'parameters' can also be a list of strings and tuples like so:
|
1571
|
+
```
|
1572
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1573
|
+
```
|
1574
|
+
This is equivalent to:
|
1575
|
+
```
|
1576
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1577
|
+
```
|
1576
1578
|
|
1577
|
-
Use `@pypi_base` to set common packages required by all
|
1578
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1579
1579
|
|
1580
1580
|
Parameters
|
1581
1581
|
----------
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1582
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1583
|
+
Event dependency for this flow.
|
1584
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1585
|
+
Events dependency for this flow.
|
1586
|
+
options : Dict[str, Any], default {}
|
1587
|
+
Backend-specific configuration for tuning eventing behavior.
|
1588
1588
|
"""
|
1589
1589
|
...
|
1590
1590
|
|