ob-metaflow-stubs 6.0.3.157__py2.py3-none-any.whl → 6.0.3.158__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 +644 -644
- metaflow-stubs/cards.pyi +1 -1
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/cli_components/__init__.pyi +1 -1
- metaflow-stubs/cli_components/utils.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +1 -1
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +3 -3
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +1 -1
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +1 -1
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +90 -90
- metaflow-stubs/mf_extensions/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +1 -1
- 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 +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.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/parameters.pyi +1 -1
- metaflow-stubs/plugins/__init__.pyi +11 -11
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +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 +2 -2
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +1 -1
- metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3.pyi +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 +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
- metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +4 -4
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +1 -1
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +1 -1
- metaflow-stubs/user_configs/config_parameters.pyi +4 -4
- {ob_metaflow_stubs-6.0.3.157.dist-info → ob_metaflow_stubs-6.0.3.158.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.158.dist-info/RECORD +200 -0
- ob_metaflow_stubs-6.0.3.157.dist-info/RECORD +0 -200
- {ob_metaflow_stubs-6.0.3.157.dist-info → ob_metaflow_stubs-6.0.3.158.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.157.dist-info → ob_metaflow_stubs-6.0.3.158.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.7.2+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-04-
|
4
|
+
# Generated on 2025-04-17T20:45:30.855915 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -35,16 +35,16 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import events as events
|
39
|
-
from . import tuple_util as tuple_util
|
40
38
|
from . import cards as cards
|
39
|
+
from . import tuple_util as tuple_util
|
40
|
+
from . import events as events
|
41
41
|
from . import runner as runner
|
42
42
|
from . import plugins as plugins
|
43
43
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
44
44
|
from . import includefile as includefile
|
45
45
|
from .includefile import IncludeFile as IncludeFile
|
46
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
47
46
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
47
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
48
48
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
49
49
|
from . import client as client
|
50
50
|
from .client.core import namespace as namespace
|
@@ -150,136 +150,213 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
150
150
|
"""
|
151
151
|
...
|
152
152
|
|
153
|
-
|
153
|
+
@typing.overload
|
154
|
+
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]]]:
|
154
155
|
"""
|
155
|
-
|
156
|
+
Specifies that the step will success under all circumstances.
|
157
|
+
|
158
|
+
The decorator will create an optional artifact, specified by `var`, which
|
159
|
+
contains the exception raised. You can use it to detect the presence
|
160
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
161
|
+
are missing.
|
156
162
|
|
157
163
|
|
158
164
|
Parameters
|
159
165
|
----------
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
166
|
+
var : str, optional, default None
|
167
|
+
Name of the artifact in which to store the caught exception.
|
168
|
+
If not specified, the exception is not stored.
|
169
|
+
print_exception : bool, default True
|
170
|
+
Determines whether or not the exception is printed to
|
171
|
+
stdout when caught.
|
172
|
+
"""
|
173
|
+
...
|
174
|
+
|
175
|
+
@typing.overload
|
176
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
177
|
+
...
|
178
|
+
|
179
|
+
@typing.overload
|
180
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
181
|
+
...
|
182
|
+
|
183
|
+
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):
|
184
|
+
"""
|
185
|
+
Specifies that the step will success under all circumstances.
|
165
186
|
|
166
|
-
|
187
|
+
The decorator will create an optional artifact, specified by `var`, which
|
188
|
+
contains the exception raised. You can use it to detect the presence
|
189
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
190
|
+
are missing.
|
167
191
|
|
168
|
-
- If repo (model/dataset) is not found in the datastore:
|
169
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
170
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
171
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
172
192
|
|
173
|
-
|
174
|
-
|
193
|
+
Parameters
|
194
|
+
----------
|
195
|
+
var : str, optional, default None
|
196
|
+
Name of the artifact in which to store the caught exception.
|
197
|
+
If not specified, the exception is not stored.
|
198
|
+
print_exception : bool, default True
|
199
|
+
Determines whether or not the exception is printed to
|
200
|
+
stdout when caught.
|
175
201
|
"""
|
176
202
|
...
|
177
203
|
|
178
204
|
@typing.overload
|
179
|
-
def
|
205
|
+
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]]]:
|
180
206
|
"""
|
181
|
-
|
207
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
182
208
|
|
209
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
183
210
|
|
184
211
|
|
185
212
|
Parameters
|
186
213
|
----------
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
196
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
197
|
-
|
198
|
-
temp_dir_root : str, default: None
|
199
|
-
The root directory under which `current.model.loaded` will store loaded models
|
214
|
+
type : str, default 'default'
|
215
|
+
Card type.
|
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.
|
200
222
|
"""
|
201
223
|
...
|
202
224
|
|
203
225
|
@typing.overload
|
204
|
-
def
|
226
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
205
227
|
...
|
206
228
|
|
207
229
|
@typing.overload
|
208
|
-
def
|
230
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
209
231
|
...
|
210
232
|
|
211
|
-
def
|
233
|
+
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):
|
212
234
|
"""
|
213
|
-
|
235
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
214
236
|
|
237
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
215
238
|
|
216
239
|
|
217
240
|
Parameters
|
218
241
|
----------
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
228
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
229
|
-
|
230
|
-
temp_dir_root : str, default: None
|
231
|
-
The root directory under which `current.model.loaded` will store loaded models
|
242
|
+
type : str, default 'default'
|
243
|
+
Card type.
|
244
|
+
id : str, optional, default None
|
245
|
+
If multiple cards are present, use this id to identify this card.
|
246
|
+
options : Dict[str, Any], default {}
|
247
|
+
Options passed to the card. The contents depend on the card type.
|
248
|
+
timeout : int, default 45
|
249
|
+
Interrupt reporting if it takes more than this many seconds.
|
232
250
|
"""
|
233
251
|
...
|
234
252
|
|
235
|
-
|
236
|
-
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]]]:
|
253
|
+
def ollama(*, models: "list[Ollama]", backend: 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]]]:
|
237
254
|
"""
|
238
|
-
|
255
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
239
256
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
257
|
+
User code call
|
258
|
+
-----------
|
259
|
+
@ollama(
|
260
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
261
|
+
backend='local'
|
262
|
+
)
|
263
|
+
|
264
|
+
Valid backend options
|
265
|
+
---------------------
|
266
|
+
- 'local': Run as a separate process on the local task machine.
|
267
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
268
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
269
|
+
|
270
|
+
Valid model options
|
271
|
+
----------------
|
272
|
+
- 'llama3.2'
|
273
|
+
- 'llama3.3'
|
274
|
+
- any model here https://ollama.com/search
|
244
275
|
|
245
276
|
|
246
277
|
Parameters
|
247
278
|
----------
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
253
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
279
|
+
models: list[Ollama]
|
280
|
+
List of Ollama containers running models in sidecars.
|
281
|
+
backend: str
|
282
|
+
Determines where and how to run the Ollama process.
|
254
283
|
"""
|
255
284
|
...
|
256
285
|
|
257
|
-
|
258
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
259
|
-
...
|
260
|
-
|
261
|
-
@typing.overload
|
262
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
263
|
-
...
|
264
|
-
|
265
|
-
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):
|
286
|
+
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') -> 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]]]:
|
266
287
|
"""
|
267
|
-
Specifies
|
268
|
-
|
269
|
-
Information in this decorator will augment any
|
270
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
271
|
-
you can use `@pypi_base` to set packages required by all
|
272
|
-
steps and use `@pypi` to specify step-specific overrides.
|
288
|
+
Specifies that this step should execute on Kubernetes.
|
273
289
|
|
274
290
|
|
275
291
|
Parameters
|
276
292
|
----------
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
293
|
+
cpu : int, default 1
|
294
|
+
Number of CPUs required for this step. If `@resources` is
|
295
|
+
also present, the maximum value from all decorators is used.
|
296
|
+
memory : int, default 4096
|
297
|
+
Memory size (in MB) required for this step. If
|
298
|
+
`@resources` is also present, the maximum value from all decorators is
|
299
|
+
used.
|
300
|
+
disk : int, default 10240
|
301
|
+
Disk size (in MB) required for this step. If
|
302
|
+
`@resources` is also present, the maximum value from all decorators is
|
303
|
+
used.
|
304
|
+
image : str, optional, default None
|
305
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
306
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
307
|
+
not, a default Docker image mapping to the current version of Python is used.
|
308
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
309
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
310
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
311
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
312
|
+
secrets : List[str], optional, default None
|
313
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
314
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
315
|
+
in Metaflow configuration.
|
316
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
317
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
318
|
+
Can be passed in as a comma separated string of values e.g.
|
319
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
320
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
321
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
322
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
323
|
+
gpu : int, optional, default None
|
324
|
+
Number of GPUs required for this step. A value of zero implies that
|
325
|
+
the scheduled node should not have GPUs.
|
326
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
327
|
+
The vendor of the GPUs to be used for this step.
|
328
|
+
tolerations : List[str], default []
|
329
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
330
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
331
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
332
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
333
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
334
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
335
|
+
use_tmpfs : bool, default False
|
336
|
+
This enables an explicit tmpfs mount for this step.
|
337
|
+
tmpfs_tempdir : bool, default True
|
338
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
339
|
+
tmpfs_size : int, optional, default: None
|
340
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
341
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
342
|
+
memory allocated for this step.
|
343
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
344
|
+
Path to tmpfs mount for this step.
|
345
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
346
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
347
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
348
|
+
shared_memory: int, optional
|
349
|
+
Shared memory size (in MiB) required for this step
|
350
|
+
port: int, optional
|
351
|
+
Port number to specify in the Kubernetes job object
|
352
|
+
compute_pool : str, optional, default None
|
353
|
+
Compute pool to be used for for this step.
|
354
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
355
|
+
hostname_resolution_timeout: int, default 10 * 60
|
356
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
357
|
+
Only applicable when @parallel is used.
|
358
|
+
qos: str, default: Burstable
|
359
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
283
360
|
"""
|
284
361
|
...
|
285
362
|
|
@@ -317,101 +394,7 @@ def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Call
|
|
317
394
|
...
|
318
395
|
|
319
396
|
@typing.overload
|
320
|
-
def
|
321
|
-
"""
|
322
|
-
Decorator prototype for all step decorators. This function gets specialized
|
323
|
-
and imported for all decorators types by _import_plugin_decorators().
|
324
|
-
"""
|
325
|
-
...
|
326
|
-
|
327
|
-
@typing.overload
|
328
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
329
|
-
...
|
330
|
-
|
331
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
332
|
-
"""
|
333
|
-
Decorator prototype for all step decorators. This function gets specialized
|
334
|
-
and imported for all decorators types by _import_plugin_decorators().
|
335
|
-
"""
|
336
|
-
...
|
337
|
-
|
338
|
-
@typing.overload
|
339
|
-
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]]]:
|
340
|
-
"""
|
341
|
-
Specifies a timeout for your step.
|
342
|
-
|
343
|
-
This decorator is useful if this step may hang indefinitely.
|
344
|
-
|
345
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
346
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
347
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
348
|
-
|
349
|
-
Note that all the values specified in parameters are added together so if you specify
|
350
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
351
|
-
|
352
|
-
|
353
|
-
Parameters
|
354
|
-
----------
|
355
|
-
seconds : int, default 0
|
356
|
-
Number of seconds to wait prior to timing out.
|
357
|
-
minutes : int, default 0
|
358
|
-
Number of minutes to wait prior to timing out.
|
359
|
-
hours : int, default 0
|
360
|
-
Number of hours to wait prior to timing out.
|
361
|
-
"""
|
362
|
-
...
|
363
|
-
|
364
|
-
@typing.overload
|
365
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
366
|
-
...
|
367
|
-
|
368
|
-
@typing.overload
|
369
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
370
|
-
...
|
371
|
-
|
372
|
-
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):
|
373
|
-
"""
|
374
|
-
Specifies a timeout for your step.
|
375
|
-
|
376
|
-
This decorator is useful if this step may hang indefinitely.
|
377
|
-
|
378
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
379
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
380
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
381
|
-
|
382
|
-
Note that all the values specified in parameters are added together so if you specify
|
383
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
384
|
-
|
385
|
-
|
386
|
-
Parameters
|
387
|
-
----------
|
388
|
-
seconds : int, default 0
|
389
|
-
Number of seconds to wait prior to timing out.
|
390
|
-
minutes : int, default 0
|
391
|
-
Number of minutes to wait prior to timing out.
|
392
|
-
hours : int, default 0
|
393
|
-
Number of hours to wait prior to timing out.
|
394
|
-
"""
|
395
|
-
...
|
396
|
-
|
397
|
-
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]]]:
|
398
|
-
"""
|
399
|
-
Specifies that this step should execute on DGX cloud.
|
400
|
-
|
401
|
-
|
402
|
-
Parameters
|
403
|
-
----------
|
404
|
-
gpu : int
|
405
|
-
Number of GPUs to use.
|
406
|
-
gpu_type : str
|
407
|
-
Type of Nvidia GPU to use.
|
408
|
-
queue_timeout : int
|
409
|
-
Time to keep the job in NVCF's queue.
|
410
|
-
"""
|
411
|
-
...
|
412
|
-
|
413
|
-
@typing.overload
|
414
|
-
def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
397
|
+
def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
415
398
|
"""
|
416
399
|
Enables checkpointing for a step.
|
417
400
|
|
@@ -468,135 +451,228 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
468
451
|
...
|
469
452
|
|
470
453
|
@typing.overload
|
471
|
-
def
|
454
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
472
455
|
"""
|
473
|
-
|
456
|
+
Internal decorator to support Fast bakery
|
457
|
+
"""
|
458
|
+
...
|
459
|
+
|
460
|
+
@typing.overload
|
461
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
462
|
+
...
|
463
|
+
|
464
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
465
|
+
"""
|
466
|
+
Internal decorator to support Fast bakery
|
467
|
+
"""
|
468
|
+
...
|
469
|
+
|
470
|
+
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]]]:
|
471
|
+
"""
|
472
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
474
473
|
|
475
474
|
|
476
475
|
Parameters
|
477
476
|
----------
|
478
|
-
|
479
|
-
|
477
|
+
temp_dir_root : str, optional
|
478
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
479
|
+
|
480
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
481
|
+
The list of repos (models/datasets) to load.
|
482
|
+
|
483
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
484
|
+
|
485
|
+
- If repo (model/dataset) is not found in the datastore:
|
486
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
487
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
488
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
489
|
+
|
490
|
+
- If repo is found in the datastore:
|
491
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
480
492
|
"""
|
481
493
|
...
|
482
494
|
|
483
495
|
@typing.overload
|
484
|
-
def
|
496
|
+
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
497
|
+
"""
|
498
|
+
Enables loading / saving of models within a step.
|
499
|
+
|
500
|
+
|
501
|
+
|
502
|
+
Parameters
|
503
|
+
----------
|
504
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
505
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
506
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
507
|
+
- `current.checkpoint`
|
508
|
+
- `current.model`
|
509
|
+
- `current.huggingface_hub`
|
510
|
+
|
511
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
512
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
513
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
514
|
+
|
515
|
+
temp_dir_root : str, default: None
|
516
|
+
The root directory under which `current.model.loaded` will store loaded models
|
517
|
+
"""
|
485
518
|
...
|
486
519
|
|
487
520
|
@typing.overload
|
488
|
-
def
|
521
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
489
522
|
...
|
490
523
|
|
491
|
-
|
524
|
+
@typing.overload
|
525
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
526
|
+
...
|
527
|
+
|
528
|
+
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
492
529
|
"""
|
493
|
-
|
530
|
+
Enables loading / saving of models within a step.
|
531
|
+
|
494
532
|
|
495
533
|
|
496
534
|
Parameters
|
497
535
|
----------
|
498
|
-
|
499
|
-
|
536
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
537
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
538
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
539
|
+
- `current.checkpoint`
|
540
|
+
- `current.model`
|
541
|
+
- `current.huggingface_hub`
|
542
|
+
|
543
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
544
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
545
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
546
|
+
|
547
|
+
temp_dir_root : str, default: None
|
548
|
+
The root directory under which `current.model.loaded` will store loaded models
|
500
549
|
"""
|
501
550
|
...
|
502
551
|
|
503
552
|
@typing.overload
|
504
|
-
def
|
553
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
505
554
|
"""
|
506
|
-
|
555
|
+
Decorator prototype for all step decorators. This function gets specialized
|
556
|
+
and imported for all decorators types by _import_plugin_decorators().
|
557
|
+
"""
|
558
|
+
...
|
559
|
+
|
560
|
+
@typing.overload
|
561
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
562
|
+
...
|
563
|
+
|
564
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
565
|
+
"""
|
566
|
+
Decorator prototype for all step decorators. This function gets specialized
|
567
|
+
and imported for all decorators types by _import_plugin_decorators().
|
568
|
+
"""
|
569
|
+
...
|
570
|
+
|
571
|
+
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]]]:
|
572
|
+
"""
|
573
|
+
Specifies that this step should execute on DGX cloud.
|
507
574
|
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
575
|
+
|
576
|
+
Parameters
|
577
|
+
----------
|
578
|
+
gpu : int
|
579
|
+
Number of GPUs to use.
|
580
|
+
gpu_type : str
|
581
|
+
Type of Nvidia GPU to use.
|
582
|
+
queue_timeout : int
|
583
|
+
Time to keep the job in NVCF's queue.
|
584
|
+
"""
|
585
|
+
...
|
586
|
+
|
587
|
+
@typing.overload
|
588
|
+
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]]]:
|
589
|
+
"""
|
590
|
+
Specifies environment variables to be set prior to the execution of a step.
|
512
591
|
|
513
592
|
|
514
593
|
Parameters
|
515
594
|
----------
|
516
|
-
|
517
|
-
|
518
|
-
If not specified, the exception is not stored.
|
519
|
-
print_exception : bool, default True
|
520
|
-
Determines whether or not the exception is printed to
|
521
|
-
stdout when caught.
|
595
|
+
vars : Dict[str, str], default {}
|
596
|
+
Dictionary of environment variables to set.
|
522
597
|
"""
|
523
598
|
...
|
524
599
|
|
525
600
|
@typing.overload
|
526
|
-
def
|
601
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
527
602
|
...
|
528
603
|
|
529
604
|
@typing.overload
|
530
|
-
def
|
605
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
531
606
|
...
|
532
607
|
|
533
|
-
def
|
608
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
534
609
|
"""
|
535
|
-
Specifies
|
536
|
-
|
537
|
-
The decorator will create an optional artifact, specified by `var`, which
|
538
|
-
contains the exception raised. You can use it to detect the presence
|
539
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
540
|
-
are missing.
|
610
|
+
Specifies environment variables to be set prior to the execution of a step.
|
541
611
|
|
542
612
|
|
543
613
|
Parameters
|
544
614
|
----------
|
545
|
-
|
546
|
-
|
547
|
-
If not specified, the exception is not stored.
|
548
|
-
print_exception : bool, default True
|
549
|
-
Determines whether or not the exception is printed to
|
550
|
-
stdout when caught.
|
615
|
+
vars : Dict[str, str], default {}
|
616
|
+
Dictionary of environment variables to set.
|
551
617
|
"""
|
552
618
|
...
|
553
619
|
|
554
620
|
@typing.overload
|
555
|
-
def
|
621
|
+
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]]]:
|
556
622
|
"""
|
557
|
-
|
623
|
+
Specifies a timeout for your step.
|
558
624
|
|
559
|
-
|
625
|
+
This decorator is useful if this step may hang indefinitely.
|
626
|
+
|
627
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
628
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
629
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
630
|
+
|
631
|
+
Note that all the values specified in parameters are added together so if you specify
|
632
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
560
633
|
|
561
634
|
|
562
635
|
Parameters
|
563
636
|
----------
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
timeout : int, default 45
|
571
|
-
Interrupt reporting if it takes more than this many seconds.
|
637
|
+
seconds : int, default 0
|
638
|
+
Number of seconds to wait prior to timing out.
|
639
|
+
minutes : int, default 0
|
640
|
+
Number of minutes to wait prior to timing out.
|
641
|
+
hours : int, default 0
|
642
|
+
Number of hours to wait prior to timing out.
|
572
643
|
"""
|
573
644
|
...
|
574
645
|
|
575
646
|
@typing.overload
|
576
|
-
def
|
647
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
577
648
|
...
|
578
649
|
|
579
650
|
@typing.overload
|
580
|
-
def
|
651
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
581
652
|
...
|
582
653
|
|
583
|
-
def
|
654
|
+
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):
|
584
655
|
"""
|
585
|
-
|
656
|
+
Specifies a timeout for your step.
|
586
657
|
|
587
|
-
|
658
|
+
This decorator is useful if this step may hang indefinitely.
|
659
|
+
|
660
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
661
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
662
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
663
|
+
|
664
|
+
Note that all the values specified in parameters are added together so if you specify
|
665
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
588
666
|
|
589
667
|
|
590
668
|
Parameters
|
591
669
|
----------
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
timeout : int, default 45
|
599
|
-
Interrupt reporting if it takes more than this many seconds.
|
670
|
+
seconds : int, default 0
|
671
|
+
Number of seconds to wait prior to timing out.
|
672
|
+
minutes : int, default 0
|
673
|
+
Number of minutes to wait prior to timing out.
|
674
|
+
hours : int, default 0
|
675
|
+
Number of hours to wait prior to timing out.
|
600
676
|
"""
|
601
677
|
...
|
602
678
|
|
@@ -616,54 +692,53 @@ def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union
|
|
616
692
|
...
|
617
693
|
|
618
694
|
@typing.overload
|
619
|
-
def
|
620
|
-
"""
|
621
|
-
Internal decorator to support Fast bakery
|
622
|
-
"""
|
623
|
-
...
|
624
|
-
|
625
|
-
@typing.overload
|
626
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
627
|
-
...
|
628
|
-
|
629
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
630
|
-
"""
|
631
|
-
Internal decorator to support Fast bakery
|
632
|
-
"""
|
633
|
-
...
|
634
|
-
|
635
|
-
@typing.overload
|
636
|
-
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]]]:
|
695
|
+
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]]]:
|
637
696
|
"""
|
638
|
-
Specifies
|
639
|
-
|
697
|
+
Specifies the PyPI packages for the step.
|
698
|
+
|
699
|
+
Information in this decorator will augment any
|
700
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
701
|
+
you can use `@pypi_base` to set packages required by all
|
702
|
+
steps and use `@pypi` to specify step-specific overrides.
|
640
703
|
|
641
704
|
|
642
705
|
Parameters
|
643
706
|
----------
|
644
|
-
|
645
|
-
|
707
|
+
packages : Dict[str, str], default: {}
|
708
|
+
Packages to use for this step. The key is the name of the package
|
709
|
+
and the value is the version to use.
|
710
|
+
python : str, optional, default: None
|
711
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
712
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
646
713
|
"""
|
647
714
|
...
|
648
715
|
|
649
716
|
@typing.overload
|
650
|
-
def
|
717
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
651
718
|
...
|
652
719
|
|
653
720
|
@typing.overload
|
654
|
-
def
|
721
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
655
722
|
...
|
656
723
|
|
657
|
-
def
|
724
|
+
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):
|
658
725
|
"""
|
659
|
-
Specifies
|
660
|
-
|
726
|
+
Specifies the PyPI packages for the step.
|
727
|
+
|
728
|
+
Information in this decorator will augment any
|
729
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
730
|
+
you can use `@pypi_base` to set packages required by all
|
731
|
+
steps and use `@pypi` to specify step-specific overrides.
|
661
732
|
|
662
733
|
|
663
734
|
Parameters
|
664
735
|
----------
|
665
|
-
|
666
|
-
|
736
|
+
packages : Dict[str, str], default: {}
|
737
|
+
Packages to use for this step. The key is the name of the package
|
738
|
+
and the value is the version to use.
|
739
|
+
python : str, optional, default: None
|
740
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
741
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
667
742
|
"""
|
668
743
|
...
|
669
744
|
|
@@ -746,83 +821,6 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
746
821
|
"""
|
747
822
|
...
|
748
823
|
|
749
|
-
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') -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
750
|
-
"""
|
751
|
-
Specifies that this step should execute on Kubernetes.
|
752
|
-
|
753
|
-
|
754
|
-
Parameters
|
755
|
-
----------
|
756
|
-
cpu : int, default 1
|
757
|
-
Number of CPUs required for this step. If `@resources` is
|
758
|
-
also present, the maximum value from all decorators is used.
|
759
|
-
memory : int, default 4096
|
760
|
-
Memory size (in MB) required for this step. If
|
761
|
-
`@resources` is also present, the maximum value from all decorators is
|
762
|
-
used.
|
763
|
-
disk : int, default 10240
|
764
|
-
Disk size (in MB) required for this step. If
|
765
|
-
`@resources` is also present, the maximum value from all decorators is
|
766
|
-
used.
|
767
|
-
image : str, optional, default None
|
768
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
769
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
770
|
-
not, a default Docker image mapping to the current version of Python is used.
|
771
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
772
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
773
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
774
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
775
|
-
secrets : List[str], optional, default None
|
776
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
777
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
778
|
-
in Metaflow configuration.
|
779
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
780
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
781
|
-
Can be passed in as a comma separated string of values e.g.
|
782
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
783
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
784
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
785
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
786
|
-
gpu : int, optional, default None
|
787
|
-
Number of GPUs required for this step. A value of zero implies that
|
788
|
-
the scheduled node should not have GPUs.
|
789
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
790
|
-
The vendor of the GPUs to be used for this step.
|
791
|
-
tolerations : List[str], default []
|
792
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
793
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
794
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
795
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
796
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
797
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
798
|
-
use_tmpfs : bool, default False
|
799
|
-
This enables an explicit tmpfs mount for this step.
|
800
|
-
tmpfs_tempdir : bool, default True
|
801
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
802
|
-
tmpfs_size : int, optional, default: None
|
803
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
804
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
805
|
-
memory allocated for this step.
|
806
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
807
|
-
Path to tmpfs mount for this step.
|
808
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
809
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
810
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
811
|
-
shared_memory: int, optional
|
812
|
-
Shared memory size (in MiB) required for this step
|
813
|
-
port: int, optional
|
814
|
-
Port number to specify in the Kubernetes job object
|
815
|
-
compute_pool : str, optional, default None
|
816
|
-
Compute pool to be used for for this step.
|
817
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
818
|
-
hostname_resolution_timeout: int, default 10 * 60
|
819
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
820
|
-
Only applicable when @parallel is used.
|
821
|
-
qos: str, default: Burstable
|
822
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
823
|
-
"""
|
824
|
-
...
|
825
|
-
|
826
824
|
@typing.overload
|
827
825
|
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]]]:
|
828
826
|
"""
|
@@ -883,166 +881,92 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
883
881
|
...
|
884
882
|
|
885
883
|
@typing.overload
|
886
|
-
def
|
884
|
+
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]]]:
|
887
885
|
"""
|
888
|
-
Specifies
|
889
|
-
|
890
|
-
|
891
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
892
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
893
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
894
|
-
|
895
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
896
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
897
|
-
ensuring that the flow execution can continue.
|
886
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
887
|
+
the execution of a step.
|
898
888
|
|
899
889
|
|
900
890
|
Parameters
|
901
891
|
----------
|
902
|
-
|
903
|
-
|
904
|
-
minutes_between_retries : int, default 2
|
905
|
-
Number of minutes between retries.
|
892
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
893
|
+
List of secret specs, defining how the secrets are to be retrieved
|
906
894
|
"""
|
907
895
|
...
|
908
896
|
|
909
897
|
@typing.overload
|
910
|
-
def
|
898
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
911
899
|
...
|
912
900
|
|
913
901
|
@typing.overload
|
914
|
-
def
|
915
|
-
...
|
916
|
-
|
917
|
-
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):
|
918
|
-
"""
|
919
|
-
Specifies the number of times the task corresponding
|
920
|
-
to a step needs to be retried.
|
921
|
-
|
922
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
923
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
924
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
925
|
-
|
926
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
927
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
928
|
-
ensuring that the flow execution can continue.
|
929
|
-
|
930
|
-
|
931
|
-
Parameters
|
932
|
-
----------
|
933
|
-
times : int, default 3
|
934
|
-
Number of times to retry this task.
|
935
|
-
minutes_between_retries : int, default 2
|
936
|
-
Number of minutes between retries.
|
937
|
-
"""
|
938
|
-
...
|
939
|
-
|
940
|
-
def ollama(*, models: "list[Ollama]", backend: 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]]]:
|
941
|
-
"""
|
942
|
-
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
943
|
-
|
944
|
-
User code call
|
945
|
-
-----------
|
946
|
-
@ollama(
|
947
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
948
|
-
backend='local'
|
949
|
-
)
|
950
|
-
|
951
|
-
Valid backend options
|
952
|
-
---------------------
|
953
|
-
- 'local': Run as a separate process on the local task machine.
|
954
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
955
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
956
|
-
|
957
|
-
Valid model options
|
958
|
-
----------------
|
959
|
-
- 'llama3.2'
|
960
|
-
- 'llama3.3'
|
961
|
-
- any model here https://ollama.com/search
|
962
|
-
|
963
|
-
|
964
|
-
Parameters
|
965
|
-
----------
|
966
|
-
models: list[Ollama]
|
967
|
-
List of Ollama containers running models in sidecars.
|
968
|
-
backend: str
|
969
|
-
Determines where and how to run the Ollama process.
|
970
|
-
"""
|
902
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
971
903
|
...
|
972
904
|
|
973
|
-
def
|
905
|
+
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]]] = []):
|
974
906
|
"""
|
975
|
-
Specifies
|
976
|
-
|
977
|
-
A project-specific namespace is created for all flows that
|
978
|
-
use the same `@project(name)`.
|
907
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
908
|
+
the execution of a step.
|
979
909
|
|
980
910
|
|
981
911
|
Parameters
|
982
912
|
----------
|
983
|
-
|
984
|
-
|
985
|
-
projects that use the same production scheduler. The name may
|
986
|
-
contain only lowercase alphanumeric characters and underscores.
|
987
|
-
|
988
|
-
branch : Optional[str], default None
|
989
|
-
The branch to use. If not specified, the branch is set to
|
990
|
-
`user.<username>` unless `production` is set to `True`. This can
|
991
|
-
also be set on the command line using `--branch` as a top-level option.
|
992
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
993
|
-
|
994
|
-
production : bool, default False
|
995
|
-
Whether or not the branch is the production branch. This can also be set on the
|
996
|
-
command line using `--production` as a top-level option. It is an error to specify
|
997
|
-
`production` in the decorator and on the command line.
|
998
|
-
The project branch name will be:
|
999
|
-
- if `branch` is specified:
|
1000
|
-
- if `production` is True: `prod.<branch>`
|
1001
|
-
- if `production` is False: `test.<branch>`
|
1002
|
-
- if `branch` is not specified:
|
1003
|
-
- if `production` is True: `prod`
|
1004
|
-
- if `production` is False: `user.<username>`
|
913
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
914
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1005
915
|
"""
|
1006
916
|
...
|
1007
917
|
|
1008
918
|
@typing.overload
|
1009
|
-
def
|
919
|
+
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]]]:
|
1010
920
|
"""
|
1011
|
-
Specifies the
|
921
|
+
Specifies the number of times the task corresponding
|
922
|
+
to a step needs to be retried.
|
923
|
+
|
924
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
925
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
926
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
927
|
+
|
928
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
929
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
930
|
+
ensuring that the flow execution can continue.
|
1012
931
|
|
1013
|
-
Use `@pypi_base` to set common packages required by all
|
1014
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1015
932
|
|
1016
933
|
Parameters
|
1017
934
|
----------
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1023
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
935
|
+
times : int, default 3
|
936
|
+
Number of times to retry this task.
|
937
|
+
minutes_between_retries : int, default 2
|
938
|
+
Number of minutes between retries.
|
1024
939
|
"""
|
1025
940
|
...
|
1026
941
|
|
1027
942
|
@typing.overload
|
1028
|
-
def
|
943
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1029
944
|
...
|
1030
945
|
|
1031
|
-
|
946
|
+
@typing.overload
|
947
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
948
|
+
...
|
949
|
+
|
950
|
+
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):
|
1032
951
|
"""
|
1033
|
-
Specifies the
|
952
|
+
Specifies the number of times the task corresponding
|
953
|
+
to a step needs to be retried.
|
954
|
+
|
955
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
956
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
957
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
958
|
+
|
959
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
960
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
961
|
+
ensuring that the flow execution can continue.
|
1034
962
|
|
1035
|
-
Use `@pypi_base` to set common packages required by all
|
1036
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1037
963
|
|
1038
964
|
Parameters
|
1039
965
|
----------
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1045
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
966
|
+
times : int, default 3
|
967
|
+
Number of times to retry this task.
|
968
|
+
minutes_between_retries : int, default 2
|
969
|
+
Number of minutes between retries.
|
1046
970
|
"""
|
1047
971
|
...
|
1048
972
|
|
@@ -1148,189 +1072,43 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1148
1072
|
...
|
1149
1073
|
|
1150
1074
|
@typing.overload
|
1151
|
-
def
|
1152
|
-
"""
|
1153
|
-
Specifies the times when the flow should be run when running on a
|
1154
|
-
production scheduler.
|
1155
|
-
|
1156
|
-
|
1157
|
-
Parameters
|
1158
|
-
----------
|
1159
|
-
hourly : bool, default False
|
1160
|
-
Run the workflow hourly.
|
1161
|
-
daily : bool, default True
|
1162
|
-
Run the workflow daily.
|
1163
|
-
weekly : bool, default False
|
1164
|
-
Run the workflow weekly.
|
1165
|
-
cron : str, optional, default None
|
1166
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1167
|
-
specified by this expression.
|
1168
|
-
timezone : str, optional, default None
|
1169
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1170
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1171
|
-
"""
|
1172
|
-
...
|
1173
|
-
|
1174
|
-
@typing.overload
|
1175
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1176
|
-
...
|
1177
|
-
|
1178
|
-
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):
|
1179
|
-
"""
|
1180
|
-
Specifies the times when the flow should be run when running on a
|
1181
|
-
production scheduler.
|
1182
|
-
|
1183
|
-
|
1184
|
-
Parameters
|
1185
|
-
----------
|
1186
|
-
hourly : bool, default False
|
1187
|
-
Run the workflow hourly.
|
1188
|
-
daily : bool, default True
|
1189
|
-
Run the workflow daily.
|
1190
|
-
weekly : bool, default False
|
1191
|
-
Run the workflow weekly.
|
1192
|
-
cron : str, optional, default None
|
1193
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1194
|
-
specified by this expression.
|
1195
|
-
timezone : str, optional, default None
|
1196
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1197
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1198
|
-
"""
|
1199
|
-
...
|
1200
|
-
|
1201
|
-
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]]:
|
1202
|
-
"""
|
1203
|
-
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.
|
1204
|
-
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.
|
1205
|
-
|
1206
|
-
|
1207
|
-
Parameters
|
1208
|
-
----------
|
1209
|
-
timeout : int
|
1210
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1211
|
-
poke_interval : int
|
1212
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1213
|
-
mode : str
|
1214
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1215
|
-
exponential_backoff : bool
|
1216
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1217
|
-
pool : str
|
1218
|
-
the slot pool this task should run in,
|
1219
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1220
|
-
soft_fail : bool
|
1221
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1222
|
-
name : str
|
1223
|
-
Name of the sensor on Airflow
|
1224
|
-
description : str
|
1225
|
-
Description of sensor in the Airflow UI
|
1226
|
-
external_dag_id : str
|
1227
|
-
The dag_id that contains the task you want to wait for.
|
1228
|
-
external_task_ids : List[str]
|
1229
|
-
The list of task_ids that you want to wait for.
|
1230
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1231
|
-
allowed_states : List[str]
|
1232
|
-
Iterable of allowed states, (Default: ['success'])
|
1233
|
-
failed_states : List[str]
|
1234
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1235
|
-
execution_delta : datetime.timedelta
|
1236
|
-
time difference with the previous execution to look at,
|
1237
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1238
|
-
check_existence: bool
|
1239
|
-
Set to True to check if the external task exists or check if
|
1240
|
-
the DAG to wait for exists. (Default: True)
|
1241
|
-
"""
|
1242
|
-
...
|
1243
|
-
|
1244
|
-
@typing.overload
|
1245
|
-
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1246
|
-
"""
|
1247
|
-
Specifies the event(s) that this flow depends on.
|
1248
|
-
|
1249
|
-
```
|
1250
|
-
@trigger(event='foo')
|
1251
|
-
```
|
1252
|
-
or
|
1253
|
-
```
|
1254
|
-
@trigger(events=['foo', 'bar'])
|
1255
|
-
```
|
1256
|
-
|
1257
|
-
Additionally, you can specify the parameter mappings
|
1258
|
-
to map event payload to Metaflow parameters for the flow.
|
1259
|
-
```
|
1260
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1261
|
-
```
|
1262
|
-
or
|
1263
|
-
```
|
1264
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1265
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1266
|
-
```
|
1267
|
-
|
1268
|
-
'parameters' can also be a list of strings and tuples like so:
|
1269
|
-
```
|
1270
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1271
|
-
```
|
1272
|
-
This is equivalent to:
|
1273
|
-
```
|
1274
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1275
|
-
```
|
1276
|
-
|
1277
|
-
|
1278
|
-
Parameters
|
1279
|
-
----------
|
1280
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1281
|
-
Event dependency for this flow.
|
1282
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1283
|
-
Events dependency for this flow.
|
1284
|
-
options : Dict[str, Any], default {}
|
1285
|
-
Backend-specific configuration for tuning eventing behavior.
|
1286
|
-
"""
|
1287
|
-
...
|
1288
|
-
|
1289
|
-
@typing.overload
|
1290
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1291
|
-
...
|
1292
|
-
|
1293
|
-
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1075
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1294
1076
|
"""
|
1295
|
-
Specifies the
|
1296
|
-
|
1297
|
-
```
|
1298
|
-
@trigger(event='foo')
|
1299
|
-
```
|
1300
|
-
or
|
1301
|
-
```
|
1302
|
-
@trigger(events=['foo', 'bar'])
|
1303
|
-
```
|
1304
|
-
|
1305
|
-
Additionally, you can specify the parameter mappings
|
1306
|
-
to map event payload to Metaflow parameters for the flow.
|
1307
|
-
```
|
1308
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1309
|
-
```
|
1310
|
-
or
|
1311
|
-
```
|
1312
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1313
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1314
|
-
```
|
1077
|
+
Specifies the PyPI packages for all steps of the flow.
|
1315
1078
|
|
1316
|
-
|
1317
|
-
|
1318
|
-
|
1319
|
-
|
1320
|
-
|
1321
|
-
|
1322
|
-
|
1323
|
-
|
1079
|
+
Use `@pypi_base` to set common packages required by all
|
1080
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1081
|
+
|
1082
|
+
Parameters
|
1083
|
+
----------
|
1084
|
+
packages : Dict[str, str], default: {}
|
1085
|
+
Packages to use for this flow. The key is the name of the package
|
1086
|
+
and the value is the version to use.
|
1087
|
+
python : str, optional, default: None
|
1088
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1089
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1090
|
+
"""
|
1091
|
+
...
|
1092
|
+
|
1093
|
+
@typing.overload
|
1094
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1095
|
+
...
|
1096
|
+
|
1097
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1098
|
+
"""
|
1099
|
+
Specifies the PyPI packages for all steps of the flow.
|
1324
1100
|
|
1101
|
+
Use `@pypi_base` to set common packages required by all
|
1102
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1325
1103
|
|
1326
1104
|
Parameters
|
1327
1105
|
----------
|
1328
|
-
|
1329
|
-
|
1330
|
-
|
1331
|
-
|
1332
|
-
|
1333
|
-
|
1106
|
+
packages : Dict[str, str], default: {}
|
1107
|
+
Packages to use for this flow. The key is the name of the package
|
1108
|
+
and the value is the version to use.
|
1109
|
+
python : str, optional, default: None
|
1110
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1111
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1334
1112
|
"""
|
1335
1113
|
...
|
1336
1114
|
|
@@ -1491,6 +1269,228 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1491
1269
|
"""
|
1492
1270
|
...
|
1493
1271
|
|
1272
|
+
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]]:
|
1273
|
+
"""
|
1274
|
+
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.
|
1275
|
+
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.
|
1276
|
+
|
1277
|
+
|
1278
|
+
Parameters
|
1279
|
+
----------
|
1280
|
+
timeout : int
|
1281
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1282
|
+
poke_interval : int
|
1283
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1284
|
+
mode : str
|
1285
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1286
|
+
exponential_backoff : bool
|
1287
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1288
|
+
pool : str
|
1289
|
+
the slot pool this task should run in,
|
1290
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1291
|
+
soft_fail : bool
|
1292
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1293
|
+
name : str
|
1294
|
+
Name of the sensor on Airflow
|
1295
|
+
description : str
|
1296
|
+
Description of sensor in the Airflow UI
|
1297
|
+
external_dag_id : str
|
1298
|
+
The dag_id that contains the task you want to wait for.
|
1299
|
+
external_task_ids : List[str]
|
1300
|
+
The list of task_ids that you want to wait for.
|
1301
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1302
|
+
allowed_states : List[str]
|
1303
|
+
Iterable of allowed states, (Default: ['success'])
|
1304
|
+
failed_states : List[str]
|
1305
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1306
|
+
execution_delta : datetime.timedelta
|
1307
|
+
time difference with the previous execution to look at,
|
1308
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1309
|
+
check_existence: bool
|
1310
|
+
Set to True to check if the external task exists or check if
|
1311
|
+
the DAG to wait for exists. (Default: True)
|
1312
|
+
"""
|
1313
|
+
...
|
1314
|
+
|
1315
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1316
|
+
"""
|
1317
|
+
Specifies what flows belong to the same project.
|
1318
|
+
|
1319
|
+
A project-specific namespace is created for all flows that
|
1320
|
+
use the same `@project(name)`.
|
1321
|
+
|
1322
|
+
|
1323
|
+
Parameters
|
1324
|
+
----------
|
1325
|
+
name : str
|
1326
|
+
Project name. Make sure that the name is unique amongst all
|
1327
|
+
projects that use the same production scheduler. The name may
|
1328
|
+
contain only lowercase alphanumeric characters and underscores.
|
1329
|
+
|
1330
|
+
branch : Optional[str], default None
|
1331
|
+
The branch to use. If not specified, the branch is set to
|
1332
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1333
|
+
also be set on the command line using `--branch` as a top-level option.
|
1334
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1335
|
+
|
1336
|
+
production : bool, default False
|
1337
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1338
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1339
|
+
`production` in the decorator and on the command line.
|
1340
|
+
The project branch name will be:
|
1341
|
+
- if `branch` is specified:
|
1342
|
+
- if `production` is True: `prod.<branch>`
|
1343
|
+
- if `production` is False: `test.<branch>`
|
1344
|
+
- if `branch` is not specified:
|
1345
|
+
- if `production` is True: `prod`
|
1346
|
+
- if `production` is False: `user.<username>`
|
1347
|
+
"""
|
1348
|
+
...
|
1349
|
+
|
1350
|
+
@typing.overload
|
1351
|
+
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]]:
|
1352
|
+
"""
|
1353
|
+
Specifies the times when the flow should be run when running on a
|
1354
|
+
production scheduler.
|
1355
|
+
|
1356
|
+
|
1357
|
+
Parameters
|
1358
|
+
----------
|
1359
|
+
hourly : bool, default False
|
1360
|
+
Run the workflow hourly.
|
1361
|
+
daily : bool, default True
|
1362
|
+
Run the workflow daily.
|
1363
|
+
weekly : bool, default False
|
1364
|
+
Run the workflow weekly.
|
1365
|
+
cron : str, optional, default None
|
1366
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1367
|
+
specified by this expression.
|
1368
|
+
timezone : str, optional, default None
|
1369
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1370
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1371
|
+
"""
|
1372
|
+
...
|
1373
|
+
|
1374
|
+
@typing.overload
|
1375
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1376
|
+
...
|
1377
|
+
|
1378
|
+
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):
|
1379
|
+
"""
|
1380
|
+
Specifies the times when the flow should be run when running on a
|
1381
|
+
production scheduler.
|
1382
|
+
|
1383
|
+
|
1384
|
+
Parameters
|
1385
|
+
----------
|
1386
|
+
hourly : bool, default False
|
1387
|
+
Run the workflow hourly.
|
1388
|
+
daily : bool, default True
|
1389
|
+
Run the workflow daily.
|
1390
|
+
weekly : bool, default False
|
1391
|
+
Run the workflow weekly.
|
1392
|
+
cron : str, optional, default None
|
1393
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1394
|
+
specified by this expression.
|
1395
|
+
timezone : str, optional, default None
|
1396
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1397
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1398
|
+
"""
|
1399
|
+
...
|
1400
|
+
|
1401
|
+
@typing.overload
|
1402
|
+
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1403
|
+
"""
|
1404
|
+
Specifies the event(s) that this flow depends on.
|
1405
|
+
|
1406
|
+
```
|
1407
|
+
@trigger(event='foo')
|
1408
|
+
```
|
1409
|
+
or
|
1410
|
+
```
|
1411
|
+
@trigger(events=['foo', 'bar'])
|
1412
|
+
```
|
1413
|
+
|
1414
|
+
Additionally, you can specify the parameter mappings
|
1415
|
+
to map event payload to Metaflow parameters for the flow.
|
1416
|
+
```
|
1417
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1418
|
+
```
|
1419
|
+
or
|
1420
|
+
```
|
1421
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1422
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1423
|
+
```
|
1424
|
+
|
1425
|
+
'parameters' can also be a list of strings and tuples like so:
|
1426
|
+
```
|
1427
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1428
|
+
```
|
1429
|
+
This is equivalent to:
|
1430
|
+
```
|
1431
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1432
|
+
```
|
1433
|
+
|
1434
|
+
|
1435
|
+
Parameters
|
1436
|
+
----------
|
1437
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1438
|
+
Event dependency for this flow.
|
1439
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1440
|
+
Events dependency for this flow.
|
1441
|
+
options : Dict[str, Any], default {}
|
1442
|
+
Backend-specific configuration for tuning eventing behavior.
|
1443
|
+
"""
|
1444
|
+
...
|
1445
|
+
|
1446
|
+
@typing.overload
|
1447
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1448
|
+
...
|
1449
|
+
|
1450
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1451
|
+
"""
|
1452
|
+
Specifies the event(s) that this flow depends on.
|
1453
|
+
|
1454
|
+
```
|
1455
|
+
@trigger(event='foo')
|
1456
|
+
```
|
1457
|
+
or
|
1458
|
+
```
|
1459
|
+
@trigger(events=['foo', 'bar'])
|
1460
|
+
```
|
1461
|
+
|
1462
|
+
Additionally, you can specify the parameter mappings
|
1463
|
+
to map event payload to Metaflow parameters for the flow.
|
1464
|
+
```
|
1465
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1466
|
+
```
|
1467
|
+
or
|
1468
|
+
```
|
1469
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1470
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1471
|
+
```
|
1472
|
+
|
1473
|
+
'parameters' can also be a list of strings and tuples like so:
|
1474
|
+
```
|
1475
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1476
|
+
```
|
1477
|
+
This is equivalent to:
|
1478
|
+
```
|
1479
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1480
|
+
```
|
1481
|
+
|
1482
|
+
|
1483
|
+
Parameters
|
1484
|
+
----------
|
1485
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1486
|
+
Event dependency for this flow.
|
1487
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1488
|
+
Events dependency for this flow.
|
1489
|
+
options : Dict[str, Any], default {}
|
1490
|
+
Backend-specific configuration for tuning eventing behavior.
|
1491
|
+
"""
|
1492
|
+
...
|
1493
|
+
|
1494
1494
|
@typing.overload
|
1495
1495
|
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]]:
|
1496
1496
|
"""
|