ob-metaflow-stubs 6.0.3.180rc1__py2.py3-none-any.whl → 6.0.3.180rc2__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 +715 -715
- 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 +2 -2
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +2 -2
- 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 +67 -67
- 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 +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/ob_internal.pyi +1 -1
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +11 -11
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +1 -1
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +1 -1
- metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
- metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
- metaflow-stubs/plugins/torchtune/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/uv_environment.pyi +1 -1
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +4 -4
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +3 -3
- metaflow-stubs/user_configs/config_options.pyi +1 -1
- metaflow-stubs/user_configs/config_parameters.pyi +3 -3
- {ob_metaflow_stubs-6.0.3.180rc1.dist-info → ob_metaflow_stubs-6.0.3.180rc2.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.180rc2.dist-info/RECORD +220 -0
- ob_metaflow_stubs-6.0.3.180rc1.dist-info/RECORD +0 -220
- {ob_metaflow_stubs-6.0.3.180rc1.dist-info → ob_metaflow_stubs-6.0.3.180rc2.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.180rc1.dist-info → ob_metaflow_stubs-6.0.3.180rc2.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.15.17.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-06-17T09:
|
4
|
+
# Generated on 2025-06-17T09:53:19.248370 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -35,18 +35,18 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
+
from . import tuple_util as tuple_util
|
38
39
|
from . import cards as cards
|
39
|
-
from . import metaflow_git as metaflow_git
|
40
40
|
from . import events as events
|
41
|
-
from . import
|
41
|
+
from . import metaflow_git as metaflow_git
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
47
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
48
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
49
48
|
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
|
@@ -156,268 +156,316 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
156
156
|
...
|
157
157
|
|
158
158
|
@typing.overload
|
159
|
-
def
|
159
|
+
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
160
160
|
"""
|
161
|
-
|
161
|
+
Specifies environment variables to be set prior to the execution of a step.
|
162
|
+
|
163
|
+
|
164
|
+
Parameters
|
165
|
+
----------
|
166
|
+
vars : Dict[str, str], default {}
|
167
|
+
Dictionary of environment variables to set.
|
162
168
|
"""
|
163
169
|
...
|
164
170
|
|
165
171
|
@typing.overload
|
166
|
-
def
|
172
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
167
173
|
...
|
168
174
|
|
169
|
-
|
170
|
-
|
171
|
-
Internal decorator to support Fast bakery
|
172
|
-
"""
|
175
|
+
@typing.overload
|
176
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
173
177
|
...
|
174
178
|
|
175
|
-
def
|
179
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
176
180
|
"""
|
177
|
-
|
178
|
-
|
179
|
-
User code call
|
180
|
-
--------------
|
181
|
-
@ollama(
|
182
|
-
models=[...],
|
183
|
-
...
|
184
|
-
)
|
185
|
-
|
186
|
-
Valid backend options
|
187
|
-
---------------------
|
188
|
-
- 'local': Run as a separate process on the local task machine.
|
189
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
190
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
191
|
-
|
192
|
-
Valid model options
|
193
|
-
-------------------
|
194
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
181
|
+
Specifies environment variables to be set prior to the execution of a step.
|
195
182
|
|
196
183
|
|
197
184
|
Parameters
|
198
185
|
----------
|
199
|
-
|
200
|
-
|
201
|
-
backend: str
|
202
|
-
Determines where and how to run the Ollama process.
|
203
|
-
force_pull: bool
|
204
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
205
|
-
cache_update_policy: str
|
206
|
-
Cache update policy: "auto", "force", or "never".
|
207
|
-
force_cache_update: bool
|
208
|
-
Simple override for "force" cache update policy.
|
209
|
-
debug: bool
|
210
|
-
Whether to turn on verbose debugging logs.
|
211
|
-
circuit_breaker_config: dict
|
212
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
213
|
-
timeout_config: dict
|
214
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
186
|
+
vars : Dict[str, str], default {}
|
187
|
+
Dictionary of environment variables to set.
|
215
188
|
"""
|
216
189
|
...
|
217
190
|
|
218
191
|
@typing.overload
|
219
|
-
def
|
192
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
220
193
|
"""
|
221
|
-
|
222
|
-
|
223
|
-
Information in this decorator will augment any
|
224
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
225
|
-
you can use `@conda_base` to set packages required by all
|
226
|
-
steps and use `@conda` to specify step-specific overrides.
|
227
|
-
|
228
|
-
|
229
|
-
Parameters
|
230
|
-
----------
|
231
|
-
packages : Dict[str, str], default {}
|
232
|
-
Packages to use for this step. The key is the name of the package
|
233
|
-
and the value is the version to use.
|
234
|
-
libraries : Dict[str, str], default {}
|
235
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
236
|
-
python : str, optional, default None
|
237
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
238
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
239
|
-
disabled : bool, default False
|
240
|
-
If set to True, disables @conda.
|
194
|
+
Decorator prototype for all step decorators. This function gets specialized
|
195
|
+
and imported for all decorators types by _import_plugin_decorators().
|
241
196
|
"""
|
242
197
|
...
|
243
198
|
|
244
199
|
@typing.overload
|
245
|
-
def
|
200
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
246
201
|
...
|
247
202
|
|
248
|
-
|
249
|
-
|
203
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
204
|
+
"""
|
205
|
+
Decorator prototype for all step decorators. This function gets specialized
|
206
|
+
and imported for all decorators types by _import_plugin_decorators().
|
207
|
+
"""
|
250
208
|
...
|
251
209
|
|
252
|
-
def
|
210
|
+
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]]]:
|
253
211
|
"""
|
254
|
-
Specifies
|
255
|
-
|
256
|
-
Information in this decorator will augment any
|
257
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
258
|
-
you can use `@conda_base` to set packages required by all
|
259
|
-
steps and use `@conda` to specify step-specific overrides.
|
212
|
+
Specifies that this step is used to deploy an instance of the app.
|
213
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
260
214
|
|
261
215
|
|
262
216
|
Parameters
|
263
217
|
----------
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
269
|
-
python : str, optional, default None
|
270
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
271
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
272
|
-
disabled : bool, default False
|
273
|
-
If set to True, disables @conda.
|
218
|
+
app_port : int
|
219
|
+
Number of GPUs to use.
|
220
|
+
app_name : str
|
221
|
+
Name of the app to deploy.
|
274
222
|
"""
|
275
223
|
...
|
276
224
|
|
277
225
|
@typing.overload
|
278
|
-
def
|
226
|
+
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]]]:
|
279
227
|
"""
|
280
|
-
|
228
|
+
Enables loading / saving of models within a step.
|
229
|
+
|
281
230
|
|
282
231
|
|
283
232
|
Parameters
|
284
233
|
----------
|
285
|
-
|
286
|
-
|
234
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
235
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
236
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
237
|
+
- `current.checkpoint`
|
238
|
+
- `current.model`
|
239
|
+
- `current.huggingface_hub`
|
240
|
+
|
241
|
+
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
|
242
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
243
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
244
|
+
|
245
|
+
temp_dir_root : str, default: None
|
246
|
+
The root directory under which `current.model.loaded` will store loaded models
|
287
247
|
"""
|
288
248
|
...
|
289
249
|
|
290
250
|
@typing.overload
|
291
|
-
def
|
251
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
292
252
|
...
|
293
253
|
|
294
254
|
@typing.overload
|
295
|
-
def
|
255
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
296
256
|
...
|
297
257
|
|
298
|
-
def
|
258
|
+
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):
|
299
259
|
"""
|
300
|
-
|
260
|
+
Enables loading / saving of models within a step.
|
261
|
+
|
301
262
|
|
302
263
|
|
303
264
|
Parameters
|
304
265
|
----------
|
305
|
-
|
306
|
-
|
266
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
267
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
268
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
269
|
+
- `current.checkpoint`
|
270
|
+
- `current.model`
|
271
|
+
- `current.huggingface_hub`
|
272
|
+
|
273
|
+
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
|
274
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
275
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
276
|
+
|
277
|
+
temp_dir_root : str, default: None
|
278
|
+
The root directory under which `current.model.loaded` will store loaded models
|
307
279
|
"""
|
308
280
|
...
|
309
281
|
|
310
282
|
@typing.overload
|
311
|
-
def
|
283
|
+
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]]]:
|
312
284
|
"""
|
313
|
-
|
314
|
-
|
285
|
+
Enables checkpointing for a step.
|
286
|
+
|
315
287
|
|
316
288
|
|
317
289
|
Parameters
|
318
290
|
----------
|
319
|
-
|
320
|
-
|
291
|
+
load_policy : str, default: "fresh"
|
292
|
+
The policy for loading the checkpoint. The following policies are supported:
|
293
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
294
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
295
|
+
will be loaded at the start of the task.
|
296
|
+
- "none": Do not load any checkpoint
|
297
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
298
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
299
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
300
|
+
created within the task will be loaded when the task is retries execution on failure.
|
301
|
+
|
302
|
+
temp_dir_root : str, default: None
|
303
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
321
304
|
"""
|
322
305
|
...
|
323
306
|
|
324
307
|
@typing.overload
|
325
|
-
def
|
308
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
326
309
|
...
|
327
310
|
|
328
311
|
@typing.overload
|
329
|
-
def
|
312
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
330
313
|
...
|
331
314
|
|
332
|
-
def
|
315
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
333
316
|
"""
|
334
|
-
|
335
|
-
|
317
|
+
Enables checkpointing for a step.
|
318
|
+
|
336
319
|
|
337
320
|
|
338
321
|
Parameters
|
339
322
|
----------
|
340
|
-
|
341
|
-
|
323
|
+
load_policy : str, default: "fresh"
|
324
|
+
The policy for loading the checkpoint. The following policies are supported:
|
325
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
326
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
327
|
+
will be loaded at the start of the task.
|
328
|
+
- "none": Do not load any checkpoint
|
329
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
330
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
331
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
332
|
+
created within the task will be loaded when the task is retries execution on failure.
|
333
|
+
|
334
|
+
temp_dir_root : str, default: None
|
335
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
342
336
|
"""
|
343
337
|
...
|
344
338
|
|
345
|
-
|
346
|
-
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]]]:
|
339
|
+
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]]]:
|
347
340
|
"""
|
348
|
-
|
341
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
349
342
|
|
350
|
-
|
351
|
-
|
343
|
+
User code call
|
344
|
+
--------------
|
345
|
+
@ollama(
|
346
|
+
models=[...],
|
347
|
+
...
|
348
|
+
)
|
352
349
|
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
requirements specified in `@resources`.
|
350
|
+
Valid backend options
|
351
|
+
---------------------
|
352
|
+
- 'local': Run as a separate process on the local task machine.
|
353
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
354
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
355
|
+
|
356
|
+
Valid model options
|
357
|
+
-------------------
|
358
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
363
359
|
|
364
360
|
|
365
361
|
Parameters
|
366
362
|
----------
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
363
|
+
models: list[str]
|
364
|
+
List of Ollama containers running models in sidecars.
|
365
|
+
backend: str
|
366
|
+
Determines where and how to run the Ollama process.
|
367
|
+
force_pull: bool
|
368
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
369
|
+
cache_update_policy: str
|
370
|
+
Cache update policy: "auto", "force", or "never".
|
371
|
+
force_cache_update: bool
|
372
|
+
Simple override for "force" cache update policy.
|
373
|
+
debug: bool
|
374
|
+
Whether to turn on verbose debugging logs.
|
375
|
+
circuit_breaker_config: dict
|
376
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
377
|
+
timeout_config: dict
|
378
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
379
|
+
"""
|
380
|
+
...
|
381
|
+
|
382
|
+
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]]]:
|
383
|
+
"""
|
384
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
385
|
+
|
386
|
+
User code call
|
387
|
+
--------------
|
388
|
+
@vllm(
|
389
|
+
model="...",
|
390
|
+
...
|
391
|
+
)
|
392
|
+
|
393
|
+
Valid backend options
|
394
|
+
---------------------
|
395
|
+
- 'local': Run as a separate process on the local task machine.
|
396
|
+
|
397
|
+
Valid model options
|
398
|
+
-------------------
|
399
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
400
|
+
|
401
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
402
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
403
|
+
|
404
|
+
|
405
|
+
Parameters
|
406
|
+
----------
|
407
|
+
model: str
|
408
|
+
HuggingFace model identifier to be served by vLLM.
|
409
|
+
backend: str
|
410
|
+
Determines where and how to run the vLLM process.
|
411
|
+
debug: bool
|
412
|
+
Whether to turn on verbose debugging logs.
|
413
|
+
kwargs : Any
|
414
|
+
Any other keyword arguments are passed directly to the vLLM engine.
|
415
|
+
This allows for flexible configuration of vLLM server settings.
|
416
|
+
For example, `tensor_parallel_size=2`.
|
417
|
+
"""
|
418
|
+
...
|
419
|
+
|
381
420
|
@typing.overload
|
382
|
-
def
|
421
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
422
|
+
"""
|
423
|
+
Internal decorator to support Fast bakery
|
424
|
+
"""
|
383
425
|
...
|
384
426
|
|
385
427
|
@typing.overload
|
386
|
-
def
|
428
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
387
429
|
...
|
388
430
|
|
389
|
-
def
|
431
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
390
432
|
"""
|
391
|
-
|
433
|
+
Internal decorator to support Fast bakery
|
434
|
+
"""
|
435
|
+
...
|
436
|
+
|
437
|
+
@typing.overload
|
438
|
+
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]]]:
|
439
|
+
"""
|
440
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
441
|
+
the execution of a step.
|
392
442
|
|
393
|
-
Use `@resources` to specify the resource requirements
|
394
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
395
443
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
405
|
-
|
444
|
+
Parameters
|
445
|
+
----------
|
446
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
447
|
+
List of secret specs, defining how the secrets are to be retrieved
|
448
|
+
"""
|
449
|
+
...
|
450
|
+
|
451
|
+
@typing.overload
|
452
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
453
|
+
...
|
454
|
+
|
455
|
+
@typing.overload
|
456
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
457
|
+
...
|
458
|
+
|
459
|
+
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]]] = []):
|
460
|
+
"""
|
461
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
462
|
+
the execution of a step.
|
406
463
|
|
407
464
|
|
408
465
|
Parameters
|
409
466
|
----------
|
410
|
-
|
411
|
-
|
412
|
-
gpu : int, optional, default None
|
413
|
-
Number of GPUs required for this step.
|
414
|
-
disk : int, optional, default None
|
415
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
416
|
-
memory : int, default 4096
|
417
|
-
Memory size (in MB) required for this step.
|
418
|
-
shared_memory : int, optional, default None
|
419
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
420
|
-
This parameter maps to the `--shm-size` option in Docker.
|
467
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
468
|
+
List of secret specs, defining how the secrets are to be retrieved
|
421
469
|
"""
|
422
470
|
...
|
423
471
|
|
@@ -472,149 +520,87 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
472
520
|
"""
|
473
521
|
...
|
474
522
|
|
475
|
-
|
476
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
477
|
-
"""
|
478
|
-
Decorator prototype for all step decorators. This function gets specialized
|
479
|
-
and imported for all decorators types by _import_plugin_decorators().
|
480
|
-
"""
|
481
|
-
...
|
482
|
-
|
483
|
-
@typing.overload
|
484
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
485
|
-
...
|
486
|
-
|
487
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
488
|
-
"""
|
489
|
-
Decorator prototype for all step decorators. This function gets specialized
|
490
|
-
and imported for all decorators types by _import_plugin_decorators().
|
491
|
-
"""
|
492
|
-
...
|
493
|
-
|
494
|
-
@typing.overload
|
495
|
-
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]]]:
|
523
|
+
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]]]:
|
496
524
|
"""
|
497
|
-
|
498
|
-
|
499
|
-
This decorator is useful if this step may hang indefinitely.
|
500
|
-
|
501
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
502
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
503
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
504
|
-
|
505
|
-
Note that all the values specified in parameters are added together so if you specify
|
506
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
525
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
507
526
|
|
508
527
|
|
509
528
|
Parameters
|
510
529
|
----------
|
511
|
-
|
512
|
-
|
513
|
-
minutes : int, default 0
|
514
|
-
Number of minutes to wait prior to timing out.
|
515
|
-
hours : int, default 0
|
516
|
-
Number of hours to wait prior to timing out.
|
517
|
-
"""
|
518
|
-
...
|
519
|
-
|
520
|
-
@typing.overload
|
521
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
522
|
-
...
|
523
|
-
|
524
|
-
@typing.overload
|
525
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
526
|
-
...
|
527
|
-
|
528
|
-
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
529
|
-
"""
|
530
|
-
Specifies a timeout for your step.
|
531
|
-
|
532
|
-
This decorator is useful if this step may hang indefinitely.
|
533
|
-
|
534
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
535
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
536
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
537
|
-
|
538
|
-
Note that all the values specified in parameters are added together so if you specify
|
539
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
530
|
+
temp_dir_root : str, optional
|
531
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
540
532
|
|
533
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
534
|
+
The list of repos (models/datasets) to load.
|
541
535
|
|
542
|
-
|
543
|
-
----------
|
544
|
-
seconds : int, default 0
|
545
|
-
Number of seconds to wait prior to timing out.
|
546
|
-
minutes : int, default 0
|
547
|
-
Number of minutes to wait prior to timing out.
|
548
|
-
hours : int, default 0
|
549
|
-
Number of hours to wait prior to timing out.
|
550
|
-
"""
|
551
|
-
...
|
552
|
-
|
553
|
-
def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
554
|
-
"""
|
555
|
-
Specifies that this step is used to deploy an instance of the app.
|
556
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
536
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
557
537
|
|
538
|
+
- If repo (model/dataset) is not found in the datastore:
|
539
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
540
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
541
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
558
542
|
|
559
|
-
|
560
|
-
|
561
|
-
app_port : int
|
562
|
-
Number of GPUs to use.
|
563
|
-
app_name : str
|
564
|
-
Name of the app to deploy.
|
543
|
+
- If repo is found in the datastore:
|
544
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
565
545
|
"""
|
566
546
|
...
|
567
547
|
|
568
548
|
@typing.overload
|
569
|
-
def
|
549
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
570
550
|
"""
|
571
|
-
|
551
|
+
Specifies the number of times the task corresponding
|
552
|
+
to a step needs to be retried.
|
572
553
|
|
573
|
-
|
554
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
555
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
556
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
557
|
+
|
558
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
559
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
560
|
+
ensuring that the flow execution can continue.
|
574
561
|
|
575
562
|
|
576
563
|
Parameters
|
577
564
|
----------
|
578
|
-
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
options : Dict[str, Any], default {}
|
583
|
-
Options passed to the card. The contents depend on the card type.
|
584
|
-
timeout : int, default 45
|
585
|
-
Interrupt reporting if it takes more than this many seconds.
|
565
|
+
times : int, default 3
|
566
|
+
Number of times to retry this task.
|
567
|
+
minutes_between_retries : int, default 2
|
568
|
+
Number of minutes between retries.
|
586
569
|
"""
|
587
570
|
...
|
588
571
|
|
589
572
|
@typing.overload
|
590
|
-
def
|
573
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
591
574
|
...
|
592
575
|
|
593
576
|
@typing.overload
|
594
|
-
def
|
577
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
595
578
|
...
|
596
579
|
|
597
|
-
def
|
580
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
598
581
|
"""
|
599
|
-
|
582
|
+
Specifies the number of times the task corresponding
|
583
|
+
to a step needs to be retried.
|
600
584
|
|
601
|
-
|
585
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
586
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
587
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
588
|
+
|
589
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
590
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
591
|
+
ensuring that the flow execution can continue.
|
602
592
|
|
603
593
|
|
604
594
|
Parameters
|
605
595
|
----------
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
options : Dict[str, Any], default {}
|
611
|
-
Options passed to the card. The contents depend on the card type.
|
612
|
-
timeout : int, default 45
|
613
|
-
Interrupt reporting if it takes more than this many seconds.
|
596
|
+
times : int, default 3
|
597
|
+
Number of times to retry this task.
|
598
|
+
minutes_between_retries : int, default 2
|
599
|
+
Number of minutes between retries.
|
614
600
|
"""
|
615
601
|
...
|
616
602
|
|
617
|
-
def
|
603
|
+
def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
618
604
|
"""
|
619
605
|
Specifies that this step should execute on DGX cloud.
|
620
606
|
|
@@ -625,152 +611,87 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
|
|
625
611
|
Number of GPUs to use.
|
626
612
|
gpu_type : str
|
627
613
|
Type of Nvidia GPU to use.
|
614
|
+
queue_timeout : int
|
615
|
+
Time to keep the job in NVCF's queue.
|
628
616
|
"""
|
629
617
|
...
|
630
618
|
|
631
619
|
@typing.overload
|
632
|
-
def
|
633
|
-
"""
|
634
|
-
Specifies the PyPI packages for the step.
|
635
|
-
|
636
|
-
Information in this decorator will augment any
|
637
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
638
|
-
you can use `@pypi_base` to set packages required by all
|
639
|
-
steps and use `@pypi` to specify step-specific overrides.
|
640
|
-
|
641
|
-
|
642
|
-
Parameters
|
643
|
-
----------
|
644
|
-
packages : Dict[str, str], default: {}
|
645
|
-
Packages to use for this step. The key is the name of the package
|
646
|
-
and the value is the version to use.
|
647
|
-
python : str, optional, default: None
|
648
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
649
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
650
|
-
"""
|
651
|
-
...
|
652
|
-
|
653
|
-
@typing.overload
|
654
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
655
|
-
...
|
656
|
-
|
657
|
-
@typing.overload
|
658
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
659
|
-
...
|
660
|
-
|
661
|
-
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):
|
620
|
+
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]]]:
|
662
621
|
"""
|
663
|
-
Specifies the
|
664
|
-
|
665
|
-
Information in this decorator will augment any
|
666
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
667
|
-
you can use `@pypi_base` to set packages required by all
|
668
|
-
steps and use `@pypi` to specify step-specific overrides.
|
669
|
-
|
622
|
+
Specifies the resources needed when executing this step.
|
670
623
|
|
671
|
-
|
672
|
-
|
673
|
-
packages : Dict[str, str], default: {}
|
674
|
-
Packages to use for this step. The key is the name of the package
|
675
|
-
and the value is the version to use.
|
676
|
-
python : str, optional, default: None
|
677
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
678
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
679
|
-
"""
|
680
|
-
...
|
681
|
-
|
682
|
-
@typing.overload
|
683
|
-
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]]]:
|
684
|
-
"""
|
685
|
-
Enables checkpointing for a step.
|
624
|
+
Use `@resources` to specify the resource requirements
|
625
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
686
626
|
|
627
|
+
You can choose the compute layer on the command line by executing e.g.
|
628
|
+
```
|
629
|
+
python myflow.py run --with batch
|
630
|
+
```
|
631
|
+
or
|
632
|
+
```
|
633
|
+
python myflow.py run --with kubernetes
|
634
|
+
```
|
635
|
+
which executes the flow on the desired system using the
|
636
|
+
requirements specified in `@resources`.
|
687
637
|
|
688
638
|
|
689
639
|
Parameters
|
690
640
|
----------
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
temp_dir_root : str, default: None
|
703
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
641
|
+
cpu : int, default 1
|
642
|
+
Number of CPUs required for this step.
|
643
|
+
gpu : int, optional, default None
|
644
|
+
Number of GPUs required for this step.
|
645
|
+
disk : int, optional, default None
|
646
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
647
|
+
memory : int, default 4096
|
648
|
+
Memory size (in MB) required for this step.
|
649
|
+
shared_memory : int, optional, default None
|
650
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
651
|
+
This parameter maps to the `--shm-size` option in Docker.
|
704
652
|
"""
|
705
653
|
...
|
706
654
|
|
707
655
|
@typing.overload
|
708
|
-
def
|
656
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
709
657
|
...
|
710
658
|
|
711
659
|
@typing.overload
|
712
|
-
def
|
713
|
-
...
|
714
|
-
|
715
|
-
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
716
|
-
"""
|
717
|
-
Enables checkpointing for a step.
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
Parameters
|
722
|
-
----------
|
723
|
-
load_policy : str, default: "fresh"
|
724
|
-
The policy for loading the checkpoint. The following policies are supported:
|
725
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
726
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
727
|
-
will be loaded at the start of the task.
|
728
|
-
- "none": Do not load any checkpoint
|
729
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
730
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
731
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
732
|
-
created within the task will be loaded when the task is retries execution on failure.
|
733
|
-
|
734
|
-
temp_dir_root : str, default: None
|
735
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
736
|
-
"""
|
660
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
737
661
|
...
|
738
662
|
|
739
|
-
def
|
740
|
-
"""
|
741
|
-
|
742
|
-
|
743
|
-
User code call
|
744
|
-
--------------
|
745
|
-
@vllm(
|
746
|
-
model="...",
|
747
|
-
...
|
748
|
-
)
|
749
|
-
|
750
|
-
Valid backend options
|
751
|
-
---------------------
|
752
|
-
- 'local': Run as a separate process on the local task machine.
|
663
|
+
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):
|
664
|
+
"""
|
665
|
+
Specifies the resources needed when executing this step.
|
753
666
|
|
754
|
-
|
755
|
-
|
756
|
-
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
667
|
+
Use `@resources` to specify the resource requirements
|
668
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
757
669
|
|
758
|
-
|
759
|
-
|
670
|
+
You can choose the compute layer on the command line by executing e.g.
|
671
|
+
```
|
672
|
+
python myflow.py run --with batch
|
673
|
+
```
|
674
|
+
or
|
675
|
+
```
|
676
|
+
python myflow.py run --with kubernetes
|
677
|
+
```
|
678
|
+
which executes the flow on the desired system using the
|
679
|
+
requirements specified in `@resources`.
|
760
680
|
|
761
681
|
|
762
682
|
Parameters
|
763
683
|
----------
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
773
|
-
|
684
|
+
cpu : int, default 1
|
685
|
+
Number of CPUs required for this step.
|
686
|
+
gpu : int, optional, default None
|
687
|
+
Number of GPUs required for this step.
|
688
|
+
disk : int, optional, default None
|
689
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
690
|
+
memory : int, default 4096
|
691
|
+
Memory size (in MB) required for this step.
|
692
|
+
shared_memory : int, optional, default None
|
693
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
694
|
+
This parameter maps to the `--shm-size` option in Docker.
|
774
695
|
"""
|
775
696
|
...
|
776
697
|
|
@@ -863,89 +784,166 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
863
784
|
"""
|
864
785
|
...
|
865
786
|
|
866
|
-
|
787
|
+
@typing.overload
|
788
|
+
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]]]:
|
867
789
|
"""
|
868
|
-
|
790
|
+
Specifies the PyPI packages for the step.
|
791
|
+
|
792
|
+
Information in this decorator will augment any
|
793
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
794
|
+
you can use `@pypi_base` to set packages required by all
|
795
|
+
steps and use `@pypi` to specify step-specific overrides.
|
869
796
|
|
870
797
|
|
871
798
|
Parameters
|
872
799
|
----------
|
873
|
-
|
874
|
-
|
800
|
+
packages : Dict[str, str], default: {}
|
801
|
+
Packages to use for this step. The key is the name of the package
|
802
|
+
and the value is the version to use.
|
803
|
+
python : str, optional, default: None
|
804
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
805
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
806
|
+
"""
|
807
|
+
...
|
808
|
+
|
809
|
+
@typing.overload
|
810
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
811
|
+
...
|
812
|
+
|
813
|
+
@typing.overload
|
814
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
815
|
+
...
|
816
|
+
|
817
|
+
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):
|
818
|
+
"""
|
819
|
+
Specifies the PyPI packages for the step.
|
875
820
|
|
876
|
-
|
877
|
-
|
821
|
+
Information in this decorator will augment any
|
822
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
823
|
+
you can use `@pypi_base` to set packages required by all
|
824
|
+
steps and use `@pypi` to specify step-specific overrides.
|
878
825
|
|
879
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
880
826
|
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
827
|
+
Parameters
|
828
|
+
----------
|
829
|
+
packages : Dict[str, str], default: {}
|
830
|
+
Packages to use for this step. The key is the name of the package
|
831
|
+
and the value is the version to use.
|
832
|
+
python : str, optional, default: None
|
833
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
834
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
835
|
+
"""
|
836
|
+
...
|
837
|
+
|
838
|
+
@typing.overload
|
839
|
+
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]]]:
|
840
|
+
"""
|
841
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
885
842
|
|
886
|
-
|
887
|
-
|
843
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
844
|
+
|
845
|
+
|
846
|
+
Parameters
|
847
|
+
----------
|
848
|
+
type : str, default 'default'
|
849
|
+
Card type.
|
850
|
+
id : str, optional, default None
|
851
|
+
If multiple cards are present, use this id to identify this card.
|
852
|
+
options : Dict[str, Any], default {}
|
853
|
+
Options passed to the card. The contents depend on the card type.
|
854
|
+
timeout : int, default 45
|
855
|
+
Interrupt reporting if it takes more than this many seconds.
|
888
856
|
"""
|
889
857
|
...
|
890
858
|
|
891
859
|
@typing.overload
|
892
|
-
def
|
860
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
861
|
+
...
|
862
|
+
|
863
|
+
@typing.overload
|
864
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
865
|
+
...
|
866
|
+
|
867
|
+
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):
|
893
868
|
"""
|
894
|
-
|
869
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
895
870
|
|
871
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
896
872
|
|
897
873
|
|
898
874
|
Parameters
|
899
875
|
----------
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
876
|
+
type : str, default 'default'
|
877
|
+
Card type.
|
878
|
+
id : str, optional, default None
|
879
|
+
If multiple cards are present, use this id to identify this card.
|
880
|
+
options : Dict[str, Any], default {}
|
881
|
+
Options passed to the card. The contents depend on the card type.
|
882
|
+
timeout : int, default 45
|
883
|
+
Interrupt reporting if it takes more than this many seconds.
|
884
|
+
"""
|
885
|
+
...
|
886
|
+
|
887
|
+
@typing.overload
|
888
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
889
|
+
"""
|
890
|
+
Specifies the Conda environment for the step.
|
906
891
|
|
907
|
-
|
908
|
-
|
909
|
-
|
892
|
+
Information in this decorator will augment any
|
893
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
894
|
+
you can use `@conda_base` to set packages required by all
|
895
|
+
steps and use `@conda` to specify step-specific overrides.
|
910
896
|
|
911
|
-
|
912
|
-
|
897
|
+
|
898
|
+
Parameters
|
899
|
+
----------
|
900
|
+
packages : Dict[str, str], default {}
|
901
|
+
Packages to use for this step. The key is the name of the package
|
902
|
+
and the value is the version to use.
|
903
|
+
libraries : Dict[str, str], default {}
|
904
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
905
|
+
python : str, optional, default None
|
906
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
907
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
908
|
+
disabled : bool, default False
|
909
|
+
If set to True, disables @conda.
|
913
910
|
"""
|
914
911
|
...
|
915
912
|
|
916
913
|
@typing.overload
|
917
|
-
def
|
914
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
918
915
|
...
|
919
916
|
|
920
917
|
@typing.overload
|
921
|
-
def
|
918
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
922
919
|
...
|
923
920
|
|
924
|
-
def
|
921
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
925
922
|
"""
|
926
|
-
|
923
|
+
Specifies the Conda environment for the step.
|
927
924
|
|
925
|
+
Information in this decorator will augment any
|
926
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
927
|
+
you can use `@conda_base` to set packages required by all
|
928
|
+
steps and use `@conda` to specify step-specific overrides.
|
928
929
|
|
929
930
|
|
930
931
|
Parameters
|
931
932
|
----------
|
932
|
-
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
|
940
|
-
|
941
|
-
If
|
942
|
-
|
943
|
-
temp_dir_root : str, default: None
|
944
|
-
The root directory under which `current.model.loaded` will store loaded models
|
933
|
+
packages : Dict[str, str], default {}
|
934
|
+
Packages to use for this step. The key is the name of the package
|
935
|
+
and the value is the version to use.
|
936
|
+
libraries : Dict[str, str], default {}
|
937
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
938
|
+
python : str, optional, default None
|
939
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
940
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
941
|
+
disabled : bool, default False
|
942
|
+
If set to True, disables @conda.
|
945
943
|
"""
|
946
944
|
...
|
947
945
|
|
948
|
-
def
|
946
|
+
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]]]:
|
949
947
|
"""
|
950
948
|
Specifies that this step should execute on DGX cloud.
|
951
949
|
|
@@ -956,156 +954,157 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
|
|
956
954
|
Number of GPUs to use.
|
957
955
|
gpu_type : str
|
958
956
|
Type of Nvidia GPU to use.
|
959
|
-
queue_timeout : int
|
960
|
-
Time to keep the job in NVCF's queue.
|
961
957
|
"""
|
962
958
|
...
|
963
959
|
|
964
960
|
@typing.overload
|
965
|
-
def
|
961
|
+
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]]]:
|
962
|
+
"""
|
963
|
+
Specifies a timeout for your step.
|
964
|
+
|
965
|
+
This decorator is useful if this step may hang indefinitely.
|
966
|
+
|
967
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
968
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
969
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
970
|
+
|
971
|
+
Note that all the values specified in parameters are added together so if you specify
|
972
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
973
|
+
|
974
|
+
|
975
|
+
Parameters
|
976
|
+
----------
|
977
|
+
seconds : int, default 0
|
978
|
+
Number of seconds to wait prior to timing out.
|
979
|
+
minutes : int, default 0
|
980
|
+
Number of minutes to wait prior to timing out.
|
981
|
+
hours : int, default 0
|
982
|
+
Number of hours to wait prior to timing out.
|
983
|
+
"""
|
984
|
+
...
|
985
|
+
|
986
|
+
@typing.overload
|
987
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
988
|
+
...
|
989
|
+
|
990
|
+
@typing.overload
|
991
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
992
|
+
...
|
993
|
+
|
994
|
+
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):
|
995
|
+
"""
|
996
|
+
Specifies a timeout for your step.
|
997
|
+
|
998
|
+
This decorator is useful if this step may hang indefinitely.
|
999
|
+
|
1000
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
1001
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
1002
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1003
|
+
|
1004
|
+
Note that all the values specified in parameters are added together so if you specify
|
1005
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1006
|
+
|
1007
|
+
|
1008
|
+
Parameters
|
1009
|
+
----------
|
1010
|
+
seconds : int, default 0
|
1011
|
+
Number of seconds to wait prior to timing out.
|
1012
|
+
minutes : int, default 0
|
1013
|
+
Number of minutes to wait prior to timing out.
|
1014
|
+
hours : int, default 0
|
1015
|
+
Number of hours to wait prior to timing out.
|
1016
|
+
"""
|
1017
|
+
...
|
1018
|
+
|
1019
|
+
@typing.overload
|
1020
|
+
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
966
1021
|
"""
|
967
|
-
Specifies the
|
968
|
-
to a step needs to be retried.
|
969
|
-
|
970
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
971
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
972
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1022
|
+
Specifies the Conda environment for all steps of the flow.
|
973
1023
|
|
974
|
-
|
975
|
-
|
976
|
-
ensuring that the flow execution can continue.
|
1024
|
+
Use `@conda_base` to set common libraries required by all
|
1025
|
+
steps and use `@conda` to specify step-specific additions.
|
977
1026
|
|
978
1027
|
|
979
1028
|
Parameters
|
980
1029
|
----------
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
1030
|
+
packages : Dict[str, str], default {}
|
1031
|
+
Packages to use for this flow. The key is the name of the package
|
1032
|
+
and the value is the version to use.
|
1033
|
+
libraries : Dict[str, str], default {}
|
1034
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1035
|
+
python : str, optional, default None
|
1036
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1037
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1038
|
+
disabled : bool, default False
|
1039
|
+
If set to True, disables Conda.
|
985
1040
|
"""
|
986
1041
|
...
|
987
1042
|
|
988
1043
|
@typing.overload
|
989
|
-
def
|
990
|
-
...
|
991
|
-
|
992
|
-
@typing.overload
|
993
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1044
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
994
1045
|
...
|
995
1046
|
|
996
|
-
def
|
1047
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
997
1048
|
"""
|
998
|
-
Specifies the
|
999
|
-
to a step needs to be retried.
|
1000
|
-
|
1001
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
1002
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
1003
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
1049
|
+
Specifies the Conda environment for all steps of the flow.
|
1004
1050
|
|
1005
|
-
|
1006
|
-
|
1007
|
-
ensuring that the flow execution can continue.
|
1051
|
+
Use `@conda_base` to set common libraries required by all
|
1052
|
+
steps and use `@conda` to specify step-specific additions.
|
1008
1053
|
|
1009
1054
|
|
1010
1055
|
Parameters
|
1011
1056
|
----------
|
1012
|
-
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
1057
|
+
packages : Dict[str, str], default {}
|
1058
|
+
Packages to use for this flow. The key is the name of the package
|
1059
|
+
and the value is the version to use.
|
1060
|
+
libraries : Dict[str, str], default {}
|
1061
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1062
|
+
python : str, optional, default None
|
1063
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1064
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1065
|
+
disabled : bool, default False
|
1066
|
+
If set to True, disables Conda.
|
1016
1067
|
"""
|
1017
1068
|
...
|
1018
1069
|
|
1019
1070
|
@typing.overload
|
1020
|
-
def
|
1071
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1021
1072
|
"""
|
1022
|
-
Specifies the
|
1023
|
-
|
1024
|
-
```
|
1025
|
-
@trigger(event='foo')
|
1026
|
-
```
|
1027
|
-
or
|
1028
|
-
```
|
1029
|
-
@trigger(events=['foo', 'bar'])
|
1030
|
-
```
|
1031
|
-
|
1032
|
-
Additionally, you can specify the parameter mappings
|
1033
|
-
to map event payload to Metaflow parameters for the flow.
|
1034
|
-
```
|
1035
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1036
|
-
```
|
1037
|
-
or
|
1038
|
-
```
|
1039
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1040
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1041
|
-
```
|
1042
|
-
|
1043
|
-
'parameters' can also be a list of strings and tuples like so:
|
1044
|
-
```
|
1045
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1046
|
-
```
|
1047
|
-
This is equivalent to:
|
1048
|
-
```
|
1049
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1050
|
-
```
|
1073
|
+
Specifies the PyPI packages for all steps of the flow.
|
1051
1074
|
|
1075
|
+
Use `@pypi_base` to set common packages required by all
|
1076
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1052
1077
|
|
1053
1078
|
Parameters
|
1054
1079
|
----------
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1080
|
+
packages : Dict[str, str], default: {}
|
1081
|
+
Packages to use for this flow. The key is the name of the package
|
1082
|
+
and the value is the version to use.
|
1083
|
+
python : str, optional, default: None
|
1084
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1085
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1061
1086
|
"""
|
1062
1087
|
...
|
1063
1088
|
|
1064
1089
|
@typing.overload
|
1065
|
-
def
|
1090
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1066
1091
|
...
|
1067
1092
|
|
1068
|
-
def
|
1093
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1069
1094
|
"""
|
1070
|
-
Specifies the
|
1071
|
-
|
1072
|
-
```
|
1073
|
-
@trigger(event='foo')
|
1074
|
-
```
|
1075
|
-
or
|
1076
|
-
```
|
1077
|
-
@trigger(events=['foo', 'bar'])
|
1078
|
-
```
|
1079
|
-
|
1080
|
-
Additionally, you can specify the parameter mappings
|
1081
|
-
to map event payload to Metaflow parameters for the flow.
|
1082
|
-
```
|
1083
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1084
|
-
```
|
1085
|
-
or
|
1086
|
-
```
|
1087
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1088
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1089
|
-
```
|
1090
|
-
|
1091
|
-
'parameters' can also be a list of strings and tuples like so:
|
1092
|
-
```
|
1093
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1094
|
-
```
|
1095
|
-
This is equivalent to:
|
1096
|
-
```
|
1097
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1098
|
-
```
|
1095
|
+
Specifies the PyPI packages for all steps of the flow.
|
1099
1096
|
|
1097
|
+
Use `@pypi_base` to set common packages required by all
|
1098
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1100
1099
|
|
1101
1100
|
Parameters
|
1102
1101
|
----------
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1102
|
+
packages : Dict[str, str], default: {}
|
1103
|
+
Packages to use for this flow. The key is the name of the package
|
1104
|
+
and the value is the version to use.
|
1105
|
+
python : str, optional, default: None
|
1106
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1107
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1109
1108
|
"""
|
1110
1109
|
...
|
1111
1110
|
|
@@ -1223,175 +1222,96 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1223
1222
|
"""
|
1224
1223
|
...
|
1225
1224
|
|
1226
|
-
|
1227
|
-
|
1228
|
-
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)
|
1229
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1230
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1231
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1232
|
-
starts only after all sensors finish.
|
1233
|
-
|
1234
|
-
|
1235
|
-
Parameters
|
1236
|
-
----------
|
1237
|
-
timeout : int
|
1238
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1239
|
-
poke_interval : int
|
1240
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1241
|
-
mode : str
|
1242
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1243
|
-
exponential_backoff : bool
|
1244
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1245
|
-
pool : str
|
1246
|
-
the slot pool this task should run in,
|
1247
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1248
|
-
soft_fail : bool
|
1249
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1250
|
-
name : str
|
1251
|
-
Name of the sensor on Airflow
|
1252
|
-
description : str
|
1253
|
-
Description of sensor in the Airflow UI
|
1254
|
-
bucket_key : Union[str, List[str]]
|
1255
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1256
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1257
|
-
bucket_name : str
|
1258
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1259
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1260
|
-
wildcard_match : bool
|
1261
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1262
|
-
aws_conn_id : str
|
1263
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1264
|
-
verify : bool
|
1265
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1266
|
-
"""
|
1267
|
-
...
|
1268
|
-
|
1269
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1225
|
+
@typing.overload
|
1226
|
+
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]]:
|
1270
1227
|
"""
|
1271
|
-
Specifies
|
1272
|
-
|
1273
|
-
A project-specific namespace is created for all flows that
|
1274
|
-
use the same `@project(name)`.
|
1275
|
-
|
1276
|
-
|
1277
|
-
Parameters
|
1278
|
-
----------
|
1279
|
-
name : str
|
1280
|
-
Project name. Make sure that the name is unique amongst all
|
1281
|
-
projects that use the same production scheduler. The name may
|
1282
|
-
contain only lowercase alphanumeric characters and underscores.
|
1228
|
+
Specifies the event(s) that this flow depends on.
|
1283
1229
|
|
1284
|
-
|
1285
|
-
|
1286
|
-
|
1287
|
-
|
1288
|
-
|
1230
|
+
```
|
1231
|
+
@trigger(event='foo')
|
1232
|
+
```
|
1233
|
+
or
|
1234
|
+
```
|
1235
|
+
@trigger(events=['foo', 'bar'])
|
1236
|
+
```
|
1289
1237
|
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1295
|
-
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
- if `production` is False: `user.<username>`
|
1301
|
-
"""
|
1302
|
-
...
|
1303
|
-
|
1304
|
-
@typing.overload
|
1305
|
-
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]]:
|
1306
|
-
"""
|
1307
|
-
Specifies the Conda environment for all steps of the flow.
|
1238
|
+
Additionally, you can specify the parameter mappings
|
1239
|
+
to map event payload to Metaflow parameters for the flow.
|
1240
|
+
```
|
1241
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1242
|
+
```
|
1243
|
+
or
|
1244
|
+
```
|
1245
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1246
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1247
|
+
```
|
1308
1248
|
|
1309
|
-
|
1310
|
-
|
1249
|
+
'parameters' can also be a list of strings and tuples like so:
|
1250
|
+
```
|
1251
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1252
|
+
```
|
1253
|
+
This is equivalent to:
|
1254
|
+
```
|
1255
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1256
|
+
```
|
1311
1257
|
|
1312
1258
|
|
1313
1259
|
Parameters
|
1314
1260
|
----------
|
1315
|
-
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1322
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1323
|
-
disabled : bool, default False
|
1324
|
-
If set to True, disables Conda.
|
1261
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1262
|
+
Event dependency for this flow.
|
1263
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1264
|
+
Events dependency for this flow.
|
1265
|
+
options : Dict[str, Any], default {}
|
1266
|
+
Backend-specific configuration for tuning eventing behavior.
|
1325
1267
|
"""
|
1326
1268
|
...
|
1327
1269
|
|
1328
1270
|
@typing.overload
|
1329
|
-
def
|
1271
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1330
1272
|
...
|
1331
1273
|
|
1332
|
-
def
|
1274
|
+
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] = {}):
|
1333
1275
|
"""
|
1334
|
-
Specifies the
|
1276
|
+
Specifies the event(s) that this flow depends on.
|
1335
1277
|
|
1336
|
-
|
1337
|
-
|
1278
|
+
```
|
1279
|
+
@trigger(event='foo')
|
1280
|
+
```
|
1281
|
+
or
|
1282
|
+
```
|
1283
|
+
@trigger(events=['foo', 'bar'])
|
1284
|
+
```
|
1338
1285
|
|
1286
|
+
Additionally, you can specify the parameter mappings
|
1287
|
+
to map event payload to Metaflow parameters for the flow.
|
1288
|
+
```
|
1289
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1290
|
+
```
|
1291
|
+
or
|
1292
|
+
```
|
1293
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1294
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1295
|
+
```
|
1339
1296
|
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1349
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1350
|
-
disabled : bool, default False
|
1351
|
-
If set to True, disables Conda.
|
1352
|
-
"""
|
1353
|
-
...
|
1354
|
-
|
1355
|
-
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1356
|
-
"""
|
1357
|
-
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1358
|
-
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1297
|
+
'parameters' can also be a list of strings and tuples like so:
|
1298
|
+
```
|
1299
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1300
|
+
```
|
1301
|
+
This is equivalent to:
|
1302
|
+
```
|
1303
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1304
|
+
```
|
1359
1305
|
|
1360
1306
|
|
1361
1307
|
Parameters
|
1362
1308
|
----------
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
exponential_backoff : bool
|
1370
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1371
|
-
pool : str
|
1372
|
-
the slot pool this task should run in,
|
1373
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1374
|
-
soft_fail : bool
|
1375
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1376
|
-
name : str
|
1377
|
-
Name of the sensor on Airflow
|
1378
|
-
description : str
|
1379
|
-
Description of sensor in the Airflow UI
|
1380
|
-
external_dag_id : str
|
1381
|
-
The dag_id that contains the task you want to wait for.
|
1382
|
-
external_task_ids : List[str]
|
1383
|
-
The list of task_ids that you want to wait for.
|
1384
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1385
|
-
allowed_states : List[str]
|
1386
|
-
Iterable of allowed states, (Default: ['success'])
|
1387
|
-
failed_states : List[str]
|
1388
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1389
|
-
execution_delta : datetime.timedelta
|
1390
|
-
time difference with the previous execution to look at,
|
1391
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1392
|
-
check_existence: bool
|
1393
|
-
Set to True to check if the external task exists or check if
|
1394
|
-
the DAG to wait for exists. (Default: True)
|
1309
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1310
|
+
Event dependency for this flow.
|
1311
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1312
|
+
Events dependency for this flow.
|
1313
|
+
options : Dict[str, Any], default {}
|
1314
|
+
Backend-specific configuration for tuning eventing behavior.
|
1395
1315
|
"""
|
1396
1316
|
...
|
1397
1317
|
|
@@ -1446,6 +1366,49 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1446
1366
|
"""
|
1447
1367
|
...
|
1448
1368
|
|
1369
|
+
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]]:
|
1370
|
+
"""
|
1371
|
+
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)
|
1372
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1373
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1374
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1375
|
+
starts only after all sensors finish.
|
1376
|
+
|
1377
|
+
|
1378
|
+
Parameters
|
1379
|
+
----------
|
1380
|
+
timeout : int
|
1381
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1382
|
+
poke_interval : int
|
1383
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1384
|
+
mode : str
|
1385
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1386
|
+
exponential_backoff : bool
|
1387
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1388
|
+
pool : str
|
1389
|
+
the slot pool this task should run in,
|
1390
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1391
|
+
soft_fail : bool
|
1392
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1393
|
+
name : str
|
1394
|
+
Name of the sensor on Airflow
|
1395
|
+
description : str
|
1396
|
+
Description of sensor in the Airflow UI
|
1397
|
+
bucket_key : Union[str, List[str]]
|
1398
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1399
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1400
|
+
bucket_name : str
|
1401
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1402
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1403
|
+
wildcard_match : bool
|
1404
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1405
|
+
aws_conn_id : str
|
1406
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1407
|
+
verify : bool
|
1408
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1409
|
+
"""
|
1410
|
+
...
|
1411
|
+
|
1449
1412
|
@typing.overload
|
1450
1413
|
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]]:
|
1451
1414
|
"""
|
@@ -1547,44 +1510,81 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1547
1510
|
"""
|
1548
1511
|
...
|
1549
1512
|
|
1550
|
-
|
1551
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1513
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1552
1514
|
"""
|
1553
|
-
Specifies
|
1515
|
+
Specifies what flows belong to the same project.
|
1516
|
+
|
1517
|
+
A project-specific namespace is created for all flows that
|
1518
|
+
use the same `@project(name)`.
|
1554
1519
|
|
1555
|
-
Use `@pypi_base` to set common packages required by all
|
1556
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1557
1520
|
|
1558
1521
|
Parameters
|
1559
1522
|
----------
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1523
|
+
name : str
|
1524
|
+
Project name. Make sure that the name is unique amongst all
|
1525
|
+
projects that use the same production scheduler. The name may
|
1526
|
+
contain only lowercase alphanumeric characters and underscores.
|
1527
|
+
|
1528
|
+
branch : Optional[str], default None
|
1529
|
+
The branch to use. If not specified, the branch is set to
|
1530
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1531
|
+
also be set on the command line using `--branch` as a top-level option.
|
1532
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1533
|
+
|
1534
|
+
production : bool, default False
|
1535
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1536
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1537
|
+
`production` in the decorator and on the command line.
|
1538
|
+
The project branch name will be:
|
1539
|
+
- if `branch` is specified:
|
1540
|
+
- if `production` is True: `prod.<branch>`
|
1541
|
+
- if `production` is False: `test.<branch>`
|
1542
|
+
- if `branch` is not specified:
|
1543
|
+
- if `production` is True: `prod`
|
1544
|
+
- if `production` is False: `user.<username>`
|
1566
1545
|
"""
|
1567
1546
|
...
|
1568
1547
|
|
1569
|
-
|
1570
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1571
|
-
...
|
1572
|
-
|
1573
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1548
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1574
1549
|
"""
|
1575
|
-
|
1550
|
+
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1551
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1576
1552
|
|
1577
|
-
Use `@pypi_base` to set common packages required by all
|
1578
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1579
1553
|
|
1580
1554
|
Parameters
|
1581
1555
|
----------
|
1582
|
-
|
1583
|
-
|
1584
|
-
|
1585
|
-
|
1586
|
-
|
1587
|
-
|
1556
|
+
timeout : int
|
1557
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1558
|
+
poke_interval : int
|
1559
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1560
|
+
mode : str
|
1561
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1562
|
+
exponential_backoff : bool
|
1563
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1564
|
+
pool : str
|
1565
|
+
the slot pool this task should run in,
|
1566
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1567
|
+
soft_fail : bool
|
1568
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1569
|
+
name : str
|
1570
|
+
Name of the sensor on Airflow
|
1571
|
+
description : str
|
1572
|
+
Description of sensor in the Airflow UI
|
1573
|
+
external_dag_id : str
|
1574
|
+
The dag_id that contains the task you want to wait for.
|
1575
|
+
external_task_ids : List[str]
|
1576
|
+
The list of task_ids that you want to wait for.
|
1577
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1578
|
+
allowed_states : List[str]
|
1579
|
+
Iterable of allowed states, (Default: ['success'])
|
1580
|
+
failed_states : List[str]
|
1581
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1582
|
+
execution_delta : datetime.timedelta
|
1583
|
+
time difference with the previous execution to look at,
|
1584
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1585
|
+
check_existence: bool
|
1586
|
+
Set to True to check if the external task exists or check if
|
1587
|
+
the DAG to wait for exists. (Default: True)
|
1588
1588
|
"""
|
1589
1589
|
...
|
1590
1590
|
|