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