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