ob-metaflow-stubs 6.0.3.153__py2.py3-none-any.whl → 6.0.3.154__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 +654 -654
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +2 -2
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +133 -133
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +12 -12
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +11 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +6 -6
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +3 -3
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +29 -29
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +7 -7
- {ob_metaflow_stubs-6.0.3.153.dist-info → ob_metaflow_stubs-6.0.3.154.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.154.dist-info/RECORD +198 -0
- ob_metaflow_stubs-6.0.3.153.dist-info/RECORD +0 -198
- {ob_metaflow_stubs-6.0.3.153.dist-info → ob_metaflow_stubs-6.0.3.154.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.153.dist-info → ob_metaflow_stubs-6.0.3.154.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
|
-
# MF version: 2.15.7.
|
4
|
-
# Generated on 2025-
|
3
|
+
# MF version: 2.15.7.2+obcheckpoint(0.1.9);ob(v1) #
|
4
|
+
# Generated on 2025-04-10T22:13:15.011907 #
|
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
|
38
39
|
from . import tuple_util as tuple_util
|
39
40
|
from . import cards as cards
|
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,133 +150,129 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
150
150
|
...
|
151
151
|
|
152
152
|
@typing.overload
|
153
|
-
def
|
153
|
+
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]]]:
|
154
154
|
"""
|
155
|
-
|
156
|
-
|
157
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
155
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
156
|
+
the execution of a step.
|
158
157
|
|
159
158
|
|
160
159
|
Parameters
|
161
160
|
----------
|
162
|
-
|
163
|
-
|
164
|
-
id : str, optional, default None
|
165
|
-
If multiple cards are present, use this id to identify this card.
|
166
|
-
options : Dict[str, Any], default {}
|
167
|
-
Options passed to the card. The contents depend on the card type.
|
168
|
-
timeout : int, default 45
|
169
|
-
Interrupt reporting if it takes more than this many seconds.
|
161
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
162
|
+
List of secret specs, defining how the secrets are to be retrieved
|
170
163
|
"""
|
171
164
|
...
|
172
165
|
|
173
166
|
@typing.overload
|
174
|
-
def
|
167
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
175
168
|
...
|
176
169
|
|
177
170
|
@typing.overload
|
178
|
-
def
|
171
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
179
172
|
...
|
180
173
|
|
181
|
-
def
|
174
|
+
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]]] = []):
|
182
175
|
"""
|
183
|
-
|
184
|
-
|
185
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
176
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
177
|
+
the execution of a step.
|
186
178
|
|
187
179
|
|
188
180
|
Parameters
|
189
181
|
----------
|
190
|
-
|
191
|
-
|
192
|
-
id : str, optional, default None
|
193
|
-
If multiple cards are present, use this id to identify this card.
|
194
|
-
options : Dict[str, Any], default {}
|
195
|
-
Options passed to the card. The contents depend on the card type.
|
196
|
-
timeout : int, default 45
|
197
|
-
Interrupt reporting if it takes more than this many seconds.
|
182
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
183
|
+
List of secret specs, defining how the secrets are to be retrieved
|
198
184
|
"""
|
199
185
|
...
|
200
186
|
|
201
187
|
@typing.overload
|
202
|
-
def
|
188
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
203
189
|
"""
|
204
|
-
|
190
|
+
Decorator prototype for all step decorators. This function gets specialized
|
191
|
+
and imported for all decorators types by _import_plugin_decorators().
|
192
|
+
"""
|
193
|
+
...
|
194
|
+
|
195
|
+
@typing.overload
|
196
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
197
|
+
...
|
198
|
+
|
199
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
200
|
+
"""
|
201
|
+
Decorator prototype for all step decorators. This function gets specialized
|
202
|
+
and imported for all decorators types by _import_plugin_decorators().
|
203
|
+
"""
|
204
|
+
...
|
205
|
+
|
206
|
+
@typing.overload
|
207
|
+
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]]]:
|
208
|
+
"""
|
209
|
+
Enables loading / saving of models within a step.
|
205
210
|
|
206
211
|
|
207
212
|
|
208
213
|
Parameters
|
209
214
|
----------
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
215
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
216
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
217
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
218
|
+
- `current.checkpoint`
|
219
|
+
- `current.model`
|
220
|
+
- `current.huggingface_hub`
|
221
|
+
|
222
|
+
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
|
223
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
224
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
220
225
|
|
221
226
|
temp_dir_root : str, default: None
|
222
|
-
The root directory under which `current.
|
227
|
+
The root directory under which `current.model.loaded` will store loaded models
|
223
228
|
"""
|
224
229
|
...
|
225
230
|
|
226
231
|
@typing.overload
|
227
|
-
def
|
232
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
228
233
|
...
|
229
234
|
|
230
235
|
@typing.overload
|
231
|
-
def
|
236
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
232
237
|
...
|
233
238
|
|
234
|
-
def
|
239
|
+
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):
|
235
240
|
"""
|
236
|
-
Enables
|
241
|
+
Enables loading / saving of models within a step.
|
237
242
|
|
238
243
|
|
239
244
|
|
240
245
|
Parameters
|
241
246
|
----------
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
247
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
248
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
249
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
250
|
+
- `current.checkpoint`
|
251
|
+
- `current.model`
|
252
|
+
- `current.huggingface_hub`
|
253
|
+
|
254
|
+
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
|
255
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
256
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
252
257
|
|
253
258
|
temp_dir_root : str, default: None
|
254
|
-
The root directory under which `current.
|
259
|
+
The root directory under which `current.model.loaded` will store loaded models
|
255
260
|
"""
|
256
261
|
...
|
257
262
|
|
258
|
-
def
|
263
|
+
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]]]:
|
259
264
|
"""
|
260
|
-
|
265
|
+
Specifies that this step should execute on DGX cloud.
|
261
266
|
|
262
267
|
|
263
268
|
Parameters
|
264
269
|
----------
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
272
|
-
|
273
|
-
- If repo (model/dataset) is not found in the datastore:
|
274
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
275
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
276
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
277
|
-
|
278
|
-
- If repo is found in the datastore:
|
279
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
270
|
+
gpu : int
|
271
|
+
Number of GPUs to use.
|
272
|
+
gpu_type : str
|
273
|
+
Type of Nvidia GPU to use.
|
274
|
+
queue_timeout : int
|
275
|
+
Time to keep the job in NVCF's queue.
|
280
276
|
"""
|
281
277
|
...
|
282
278
|
|
@@ -335,63 +331,6 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
335
331
|
"""
|
336
332
|
...
|
337
333
|
|
338
|
-
@typing.overload
|
339
|
-
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]]]:
|
340
|
-
"""
|
341
|
-
Enables loading / saving of models within a step.
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
Parameters
|
346
|
-
----------
|
347
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
348
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
349
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
350
|
-
- `current.checkpoint`
|
351
|
-
- `current.model`
|
352
|
-
- `current.huggingface_hub`
|
353
|
-
|
354
|
-
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
|
355
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
356
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
357
|
-
|
358
|
-
temp_dir_root : str, default: None
|
359
|
-
The root directory under which `current.model.loaded` will store loaded models
|
360
|
-
"""
|
361
|
-
...
|
362
|
-
|
363
|
-
@typing.overload
|
364
|
-
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
365
|
-
...
|
366
|
-
|
367
|
-
@typing.overload
|
368
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
369
|
-
...
|
370
|
-
|
371
|
-
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):
|
372
|
-
"""
|
373
|
-
Enables loading / saving of models within a step.
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
Parameters
|
378
|
-
----------
|
379
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
380
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
381
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
382
|
-
- `current.checkpoint`
|
383
|
-
- `current.model`
|
384
|
-
- `current.huggingface_hub`
|
385
|
-
|
386
|
-
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
|
387
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
388
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
389
|
-
|
390
|
-
temp_dir_root : str, default: None
|
391
|
-
The root directory under which `current.model.loaded` will store loaded models
|
392
|
-
"""
|
393
|
-
...
|
394
|
-
|
395
334
|
def nim(*, models: "list[NIM]", backend: 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]]]:
|
396
335
|
"""
|
397
336
|
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
@@ -425,96 +364,44 @@ def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Call
|
|
425
364
|
"""
|
426
365
|
...
|
427
366
|
|
428
|
-
|
429
|
-
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]]]:
|
367
|
+
def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
430
368
|
"""
|
431
|
-
Specifies that
|
432
|
-
|
433
|
-
The decorator will create an optional artifact, specified by `var`, which
|
434
|
-
contains the exception raised. You can use it to detect the presence
|
435
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
436
|
-
are missing.
|
369
|
+
Specifies that this step is used to deploy an instance of the app.
|
370
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
437
371
|
|
438
372
|
|
439
373
|
Parameters
|
440
374
|
----------
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
Determines whether or not the exception is printed to
|
446
|
-
stdout when caught.
|
375
|
+
app_port : int
|
376
|
+
Number of GPUs to use.
|
377
|
+
app_name : str
|
378
|
+
Name of the app to deploy.
|
447
379
|
"""
|
448
380
|
...
|
449
381
|
|
450
382
|
@typing.overload
|
451
|
-
def
|
452
|
-
...
|
453
|
-
|
454
|
-
@typing.overload
|
455
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
456
|
-
...
|
457
|
-
|
458
|
-
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):
|
383
|
+
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]]]:
|
459
384
|
"""
|
460
|
-
Specifies
|
385
|
+
Specifies the Conda environment for the step.
|
461
386
|
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
387
|
+
Information in this decorator will augment any
|
388
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
389
|
+
you can use `@conda_base` to set packages required by all
|
390
|
+
steps and use `@conda` to specify step-specific overrides.
|
466
391
|
|
467
392
|
|
468
393
|
Parameters
|
469
394
|
----------
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
"""
|
481
|
-
Specifies that this step should execute on DGX cloud.
|
482
|
-
|
483
|
-
|
484
|
-
Parameters
|
485
|
-
----------
|
486
|
-
gpu : int
|
487
|
-
Number of GPUs to use.
|
488
|
-
gpu_type : str
|
489
|
-
Type of Nvidia GPU to use.
|
490
|
-
queue_timeout : int
|
491
|
-
Time to keep the job in NVCF's queue.
|
492
|
-
"""
|
493
|
-
...
|
494
|
-
|
495
|
-
@typing.overload
|
496
|
-
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]]]:
|
497
|
-
"""
|
498
|
-
Specifies the Conda environment for the step.
|
499
|
-
|
500
|
-
Information in this decorator will augment any
|
501
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
502
|
-
you can use `@conda_base` to set packages required by all
|
503
|
-
steps and use `@conda` to specify step-specific overrides.
|
504
|
-
|
505
|
-
|
506
|
-
Parameters
|
507
|
-
----------
|
508
|
-
packages : Dict[str, str], default {}
|
509
|
-
Packages to use for this step. The key is the name of the package
|
510
|
-
and the value is the version to use.
|
511
|
-
libraries : Dict[str, str], default {}
|
512
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
513
|
-
python : str, optional, default None
|
514
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
515
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
516
|
-
disabled : bool, default False
|
517
|
-
If set to True, disables @conda.
|
395
|
+
packages : Dict[str, str], default {}
|
396
|
+
Packages to use for this step. The key is the name of the package
|
397
|
+
and the value is the version to use.
|
398
|
+
libraries : Dict[str, str], default {}
|
399
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
400
|
+
python : str, optional, default None
|
401
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
402
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
403
|
+
disabled : bool, default False
|
404
|
+
If set to True, disables @conda.
|
518
405
|
"""
|
519
406
|
...
|
520
407
|
|
@@ -551,219 +438,6 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
551
438
|
"""
|
552
439
|
...
|
553
440
|
|
554
|
-
def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
555
|
-
"""
|
556
|
-
Specifies that this step is used to deploy an instance of the app.
|
557
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
558
|
-
|
559
|
-
|
560
|
-
Parameters
|
561
|
-
----------
|
562
|
-
app_port : int
|
563
|
-
Number of GPUs to use.
|
564
|
-
app_name : str
|
565
|
-
Name of the app to deploy.
|
566
|
-
"""
|
567
|
-
...
|
568
|
-
|
569
|
-
@typing.overload
|
570
|
-
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]]]:
|
571
|
-
"""
|
572
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
573
|
-
the execution of a step.
|
574
|
-
|
575
|
-
|
576
|
-
Parameters
|
577
|
-
----------
|
578
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
579
|
-
List of secret specs, defining how the secrets are to be retrieved
|
580
|
-
"""
|
581
|
-
...
|
582
|
-
|
583
|
-
@typing.overload
|
584
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
585
|
-
...
|
586
|
-
|
587
|
-
@typing.overload
|
588
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
589
|
-
...
|
590
|
-
|
591
|
-
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]]] = []):
|
592
|
-
"""
|
593
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
594
|
-
the execution of a step.
|
595
|
-
|
596
|
-
|
597
|
-
Parameters
|
598
|
-
----------
|
599
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
600
|
-
List of secret specs, defining how the secrets are to be retrieved
|
601
|
-
"""
|
602
|
-
...
|
603
|
-
|
604
|
-
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]]]:
|
605
|
-
"""
|
606
|
-
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
607
|
-
|
608
|
-
User code call
|
609
|
-
-----------
|
610
|
-
@ollama(
|
611
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
612
|
-
backend='local'
|
613
|
-
)
|
614
|
-
|
615
|
-
Valid backend options
|
616
|
-
---------------------
|
617
|
-
- 'local': Run as a separate process on the local task machine.
|
618
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
619
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
620
|
-
|
621
|
-
Valid model options
|
622
|
-
----------------
|
623
|
-
- 'llama3.2'
|
624
|
-
- 'llama3.3'
|
625
|
-
- any model here https://ollama.com/search
|
626
|
-
|
627
|
-
|
628
|
-
Parameters
|
629
|
-
----------
|
630
|
-
models: list[Ollama]
|
631
|
-
List of Ollama containers running models in sidecars.
|
632
|
-
backend: str
|
633
|
-
Determines where and how to run the Ollama process.
|
634
|
-
"""
|
635
|
-
...
|
636
|
-
|
637
|
-
@typing.overload
|
638
|
-
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]]]:
|
639
|
-
"""
|
640
|
-
Specifies the PyPI packages for the step.
|
641
|
-
|
642
|
-
Information in this decorator will augment any
|
643
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
644
|
-
you can use `@pypi_base` to set packages required by all
|
645
|
-
steps and use `@pypi` to specify step-specific overrides.
|
646
|
-
|
647
|
-
|
648
|
-
Parameters
|
649
|
-
----------
|
650
|
-
packages : Dict[str, str], default: {}
|
651
|
-
Packages to use for this step. The key is the name of the package
|
652
|
-
and the value is the version to use.
|
653
|
-
python : str, optional, default: None
|
654
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
655
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
656
|
-
"""
|
657
|
-
...
|
658
|
-
|
659
|
-
@typing.overload
|
660
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
661
|
-
...
|
662
|
-
|
663
|
-
@typing.overload
|
664
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
665
|
-
...
|
666
|
-
|
667
|
-
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):
|
668
|
-
"""
|
669
|
-
Specifies the PyPI packages for the step.
|
670
|
-
|
671
|
-
Information in this decorator will augment any
|
672
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
673
|
-
you can use `@pypi_base` to set packages required by all
|
674
|
-
steps and use `@pypi` to specify step-specific overrides.
|
675
|
-
|
676
|
-
|
677
|
-
Parameters
|
678
|
-
----------
|
679
|
-
packages : Dict[str, str], default: {}
|
680
|
-
Packages to use for this step. The key is the name of the package
|
681
|
-
and the value is the version to use.
|
682
|
-
python : str, optional, default: None
|
683
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
684
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
685
|
-
"""
|
686
|
-
...
|
687
|
-
|
688
|
-
@typing.overload
|
689
|
-
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
690
|
-
"""
|
691
|
-
Specifies the resources needed when executing this step.
|
692
|
-
|
693
|
-
Use `@resources` to specify the resource requirements
|
694
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
695
|
-
|
696
|
-
You can choose the compute layer on the command line by executing e.g.
|
697
|
-
```
|
698
|
-
python myflow.py run --with batch
|
699
|
-
```
|
700
|
-
or
|
701
|
-
```
|
702
|
-
python myflow.py run --with kubernetes
|
703
|
-
```
|
704
|
-
which executes the flow on the desired system using the
|
705
|
-
requirements specified in `@resources`.
|
706
|
-
|
707
|
-
|
708
|
-
Parameters
|
709
|
-
----------
|
710
|
-
cpu : int, default 1
|
711
|
-
Number of CPUs required for this step.
|
712
|
-
gpu : int, optional, default None
|
713
|
-
Number of GPUs required for this step.
|
714
|
-
disk : int, optional, default None
|
715
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
716
|
-
memory : int, default 4096
|
717
|
-
Memory size (in MB) required for this step.
|
718
|
-
shared_memory : int, optional, default None
|
719
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
720
|
-
This parameter maps to the `--shm-size` option in Docker.
|
721
|
-
"""
|
722
|
-
...
|
723
|
-
|
724
|
-
@typing.overload
|
725
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
726
|
-
...
|
727
|
-
|
728
|
-
@typing.overload
|
729
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
730
|
-
...
|
731
|
-
|
732
|
-
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
733
|
-
"""
|
734
|
-
Specifies the resources needed when executing this step.
|
735
|
-
|
736
|
-
Use `@resources` to specify the resource requirements
|
737
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
738
|
-
|
739
|
-
You can choose the compute layer on the command line by executing e.g.
|
740
|
-
```
|
741
|
-
python myflow.py run --with batch
|
742
|
-
```
|
743
|
-
or
|
744
|
-
```
|
745
|
-
python myflow.py run --with kubernetes
|
746
|
-
```
|
747
|
-
which executes the flow on the desired system using the
|
748
|
-
requirements specified in `@resources`.
|
749
|
-
|
750
|
-
|
751
|
-
Parameters
|
752
|
-
----------
|
753
|
-
cpu : int, default 1
|
754
|
-
Number of CPUs required for this step.
|
755
|
-
gpu : int, optional, default None
|
756
|
-
Number of GPUs required for this step.
|
757
|
-
disk : int, optional, default None
|
758
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
759
|
-
memory : int, default 4096
|
760
|
-
Memory size (in MB) required for this step.
|
761
|
-
shared_memory : int, optional, default None
|
762
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
763
|
-
This parameter maps to the `--shm-size` option in Docker.
|
764
|
-
"""
|
765
|
-
...
|
766
|
-
|
767
441
|
@typing.overload
|
768
442
|
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]]]:
|
769
443
|
"""
|
@@ -824,19 +498,35 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
824
498
|
...
|
825
499
|
|
826
500
|
@typing.overload
|
827
|
-
def
|
501
|
+
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]]]:
|
828
502
|
"""
|
829
|
-
|
503
|
+
Specifies environment variables to be set prior to the execution of a step.
|
504
|
+
|
505
|
+
|
506
|
+
Parameters
|
507
|
+
----------
|
508
|
+
vars : Dict[str, str], default {}
|
509
|
+
Dictionary of environment variables to set.
|
830
510
|
"""
|
831
511
|
...
|
832
512
|
|
833
513
|
@typing.overload
|
834
|
-
def
|
514
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
835
515
|
...
|
836
516
|
|
837
|
-
|
517
|
+
@typing.overload
|
518
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
519
|
+
...
|
520
|
+
|
521
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
838
522
|
"""
|
839
|
-
|
523
|
+
Specifies environment variables to be set prior to the execution of a step.
|
524
|
+
|
525
|
+
|
526
|
+
Parameters
|
527
|
+
----------
|
528
|
+
vars : Dict[str, str], default {}
|
529
|
+
Dictionary of environment variables to set.
|
840
530
|
"""
|
841
531
|
...
|
842
532
|
|
@@ -918,54 +608,541 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
918
608
|
...
|
919
609
|
|
920
610
|
@typing.overload
|
921
|
-
def
|
611
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
922
612
|
"""
|
923
|
-
|
924
|
-
and imported for all decorators types by _import_plugin_decorators().
|
613
|
+
Internal decorator to support Fast bakery
|
925
614
|
"""
|
926
615
|
...
|
927
616
|
|
928
617
|
@typing.overload
|
929
|
-
def
|
618
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
930
619
|
...
|
931
620
|
|
932
|
-
def
|
621
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
933
622
|
"""
|
934
|
-
|
935
|
-
and imported for all decorators types by _import_plugin_decorators().
|
623
|
+
Internal decorator to support Fast bakery
|
936
624
|
"""
|
937
625
|
...
|
938
626
|
|
939
627
|
@typing.overload
|
940
|
-
def
|
628
|
+
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]]]:
|
941
629
|
"""
|
942
|
-
|
630
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
631
|
+
|
632
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
943
633
|
|
944
634
|
|
945
635
|
Parameters
|
946
636
|
----------
|
947
|
-
|
948
|
-
|
637
|
+
type : str, default 'default'
|
638
|
+
Card type.
|
639
|
+
id : str, optional, default None
|
640
|
+
If multiple cards are present, use this id to identify this card.
|
641
|
+
options : Dict[str, Any], default {}
|
642
|
+
Options passed to the card. The contents depend on the card type.
|
643
|
+
timeout : int, default 45
|
644
|
+
Interrupt reporting if it takes more than this many seconds.
|
949
645
|
"""
|
950
646
|
...
|
951
647
|
|
952
648
|
@typing.overload
|
953
|
-
def
|
649
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
954
650
|
...
|
955
651
|
|
956
652
|
@typing.overload
|
957
|
-
def
|
653
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
958
654
|
...
|
959
655
|
|
960
|
-
def
|
656
|
+
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):
|
961
657
|
"""
|
962
|
-
|
658
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
659
|
+
|
660
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
661
|
+
|
662
|
+
|
663
|
+
Parameters
|
664
|
+
----------
|
665
|
+
type : str, default 'default'
|
666
|
+
Card type.
|
667
|
+
id : str, optional, default None
|
668
|
+
If multiple cards are present, use this id to identify this card.
|
669
|
+
options : Dict[str, Any], default {}
|
670
|
+
Options passed to the card. The contents depend on the card type.
|
671
|
+
timeout : int, default 45
|
672
|
+
Interrupt reporting if it takes more than this many seconds.
|
673
|
+
"""
|
674
|
+
...
|
675
|
+
|
676
|
+
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]]]:
|
677
|
+
"""
|
678
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
679
|
+
|
680
|
+
|
681
|
+
Parameters
|
682
|
+
----------
|
683
|
+
temp_dir_root : str, optional
|
684
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
685
|
+
|
686
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
687
|
+
The list of repos (models/datasets) to load.
|
688
|
+
|
689
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
690
|
+
|
691
|
+
- If repo (model/dataset) is not found in the datastore:
|
692
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
693
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
694
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
695
|
+
|
696
|
+
- If repo is found in the datastore:
|
697
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
698
|
+
"""
|
699
|
+
...
|
700
|
+
|
701
|
+
@typing.overload
|
702
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
703
|
+
"""
|
704
|
+
Specifies the resources needed when executing this step.
|
705
|
+
|
706
|
+
Use `@resources` to specify the resource requirements
|
707
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
708
|
+
|
709
|
+
You can choose the compute layer on the command line by executing e.g.
|
710
|
+
```
|
711
|
+
python myflow.py run --with batch
|
712
|
+
```
|
713
|
+
or
|
714
|
+
```
|
715
|
+
python myflow.py run --with kubernetes
|
716
|
+
```
|
717
|
+
which executes the flow on the desired system using the
|
718
|
+
requirements specified in `@resources`.
|
719
|
+
|
720
|
+
|
721
|
+
Parameters
|
722
|
+
----------
|
723
|
+
cpu : int, default 1
|
724
|
+
Number of CPUs required for this step.
|
725
|
+
gpu : int, optional, default None
|
726
|
+
Number of GPUs required for this step.
|
727
|
+
disk : int, optional, default None
|
728
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
729
|
+
memory : int, default 4096
|
730
|
+
Memory size (in MB) required for this step.
|
731
|
+
shared_memory : int, optional, default None
|
732
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
733
|
+
This parameter maps to the `--shm-size` option in Docker.
|
734
|
+
"""
|
735
|
+
...
|
736
|
+
|
737
|
+
@typing.overload
|
738
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
739
|
+
...
|
740
|
+
|
741
|
+
@typing.overload
|
742
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
743
|
+
...
|
744
|
+
|
745
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
746
|
+
"""
|
747
|
+
Specifies the resources needed when executing this step.
|
748
|
+
|
749
|
+
Use `@resources` to specify the resource requirements
|
750
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
751
|
+
|
752
|
+
You can choose the compute layer on the command line by executing e.g.
|
753
|
+
```
|
754
|
+
python myflow.py run --with batch
|
755
|
+
```
|
756
|
+
or
|
757
|
+
```
|
758
|
+
python myflow.py run --with kubernetes
|
759
|
+
```
|
760
|
+
which executes the flow on the desired system using the
|
761
|
+
requirements specified in `@resources`.
|
762
|
+
|
763
|
+
|
764
|
+
Parameters
|
765
|
+
----------
|
766
|
+
cpu : int, default 1
|
767
|
+
Number of CPUs required for this step.
|
768
|
+
gpu : int, optional, default None
|
769
|
+
Number of GPUs required for this step.
|
770
|
+
disk : int, optional, default None
|
771
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
772
|
+
memory : int, default 4096
|
773
|
+
Memory size (in MB) required for this step.
|
774
|
+
shared_memory : int, optional, default None
|
775
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
776
|
+
This parameter maps to the `--shm-size` option in Docker.
|
777
|
+
"""
|
778
|
+
...
|
779
|
+
|
780
|
+
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]]]:
|
781
|
+
"""
|
782
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
783
|
+
|
784
|
+
User code call
|
785
|
+
-----------
|
786
|
+
@ollama(
|
787
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
788
|
+
backend='local'
|
789
|
+
)
|
790
|
+
|
791
|
+
Valid backend options
|
792
|
+
---------------------
|
793
|
+
- 'local': Run as a separate process on the local task machine.
|
794
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
795
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
796
|
+
|
797
|
+
Valid model options
|
798
|
+
----------------
|
799
|
+
- 'llama3.2'
|
800
|
+
- 'llama3.3'
|
801
|
+
- any model here https://ollama.com/search
|
802
|
+
|
803
|
+
|
804
|
+
Parameters
|
805
|
+
----------
|
806
|
+
models: list[Ollama]
|
807
|
+
List of Ollama containers running models in sidecars.
|
808
|
+
backend: str
|
809
|
+
Determines where and how to run the Ollama process.
|
810
|
+
"""
|
811
|
+
...
|
812
|
+
|
813
|
+
@typing.overload
|
814
|
+
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]]]:
|
815
|
+
"""
|
816
|
+
Enables checkpointing for a step.
|
817
|
+
|
818
|
+
|
819
|
+
|
820
|
+
Parameters
|
821
|
+
----------
|
822
|
+
load_policy : str, default: "fresh"
|
823
|
+
The policy for loading the checkpoint. The following policies are supported:
|
824
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
825
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
826
|
+
will be loaded at the start of the task.
|
827
|
+
- "none": Do not load any checkpoint
|
828
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
829
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
830
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
831
|
+
created within the task will be loaded when the task is retries execution on failure.
|
832
|
+
|
833
|
+
temp_dir_root : str, default: None
|
834
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
835
|
+
"""
|
836
|
+
...
|
837
|
+
|
838
|
+
@typing.overload
|
839
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
840
|
+
...
|
841
|
+
|
842
|
+
@typing.overload
|
843
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
844
|
+
...
|
845
|
+
|
846
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
847
|
+
"""
|
848
|
+
Enables checkpointing for a step.
|
849
|
+
|
850
|
+
|
851
|
+
|
852
|
+
Parameters
|
853
|
+
----------
|
854
|
+
load_policy : str, default: "fresh"
|
855
|
+
The policy for loading the checkpoint. The following policies are supported:
|
856
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
857
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
858
|
+
will be loaded at the start of the task.
|
859
|
+
- "none": Do not load any checkpoint
|
860
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
861
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
862
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
863
|
+
created within the task will be loaded when the task is retries execution on failure.
|
864
|
+
|
865
|
+
temp_dir_root : str, default: None
|
866
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
867
|
+
"""
|
868
|
+
...
|
869
|
+
|
870
|
+
@typing.overload
|
871
|
+
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]]]:
|
872
|
+
"""
|
873
|
+
Specifies that the step will success under all circumstances.
|
874
|
+
|
875
|
+
The decorator will create an optional artifact, specified by `var`, which
|
876
|
+
contains the exception raised. You can use it to detect the presence
|
877
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
878
|
+
are missing.
|
879
|
+
|
880
|
+
|
881
|
+
Parameters
|
882
|
+
----------
|
883
|
+
var : str, optional, default None
|
884
|
+
Name of the artifact in which to store the caught exception.
|
885
|
+
If not specified, the exception is not stored.
|
886
|
+
print_exception : bool, default True
|
887
|
+
Determines whether or not the exception is printed to
|
888
|
+
stdout when caught.
|
889
|
+
"""
|
890
|
+
...
|
891
|
+
|
892
|
+
@typing.overload
|
893
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
894
|
+
...
|
895
|
+
|
896
|
+
@typing.overload
|
897
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
898
|
+
...
|
899
|
+
|
900
|
+
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):
|
901
|
+
"""
|
902
|
+
Specifies that the step will success under all circumstances.
|
903
|
+
|
904
|
+
The decorator will create an optional artifact, specified by `var`, which
|
905
|
+
contains the exception raised. You can use it to detect the presence
|
906
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
907
|
+
are missing.
|
908
|
+
|
909
|
+
|
910
|
+
Parameters
|
911
|
+
----------
|
912
|
+
var : str, optional, default None
|
913
|
+
Name of the artifact in which to store the caught exception.
|
914
|
+
If not specified, the exception is not stored.
|
915
|
+
print_exception : bool, default True
|
916
|
+
Determines whether or not the exception is printed to
|
917
|
+
stdout when caught.
|
918
|
+
"""
|
919
|
+
...
|
920
|
+
|
921
|
+
@typing.overload
|
922
|
+
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]]]:
|
923
|
+
"""
|
924
|
+
Specifies the PyPI packages for the step.
|
925
|
+
|
926
|
+
Information in this decorator will augment any
|
927
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
928
|
+
you can use `@pypi_base` to set packages required by all
|
929
|
+
steps and use `@pypi` to specify step-specific overrides.
|
930
|
+
|
931
|
+
|
932
|
+
Parameters
|
933
|
+
----------
|
934
|
+
packages : Dict[str, str], default: {}
|
935
|
+
Packages to use for this step. The key is the name of the package
|
936
|
+
and the value is the version to use.
|
937
|
+
python : str, optional, default: None
|
938
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
939
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
940
|
+
"""
|
941
|
+
...
|
942
|
+
|
943
|
+
@typing.overload
|
944
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
945
|
+
...
|
946
|
+
|
947
|
+
@typing.overload
|
948
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
949
|
+
...
|
950
|
+
|
951
|
+
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):
|
952
|
+
"""
|
953
|
+
Specifies the PyPI packages for the step.
|
954
|
+
|
955
|
+
Information in this decorator will augment any
|
956
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
957
|
+
you can use `@pypi_base` to set packages required by all
|
958
|
+
steps and use `@pypi` to specify step-specific overrides.
|
959
|
+
|
960
|
+
|
961
|
+
Parameters
|
962
|
+
----------
|
963
|
+
packages : Dict[str, str], default: {}
|
964
|
+
Packages to use for this step. The key is the name of the package
|
965
|
+
and the value is the version to use.
|
966
|
+
python : str, optional, default: None
|
967
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
968
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
969
|
+
"""
|
970
|
+
...
|
971
|
+
|
972
|
+
@typing.overload
|
973
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
974
|
+
"""
|
975
|
+
Specifies the PyPI packages for all steps of the flow.
|
976
|
+
|
977
|
+
Use `@pypi_base` to set common packages required by all
|
978
|
+
steps and use `@pypi` to specify step-specific overrides.
|
979
|
+
|
980
|
+
Parameters
|
981
|
+
----------
|
982
|
+
packages : Dict[str, str], default: {}
|
983
|
+
Packages to use for this flow. The key is the name of the package
|
984
|
+
and the value is the version to use.
|
985
|
+
python : str, optional, default: None
|
986
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
987
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
988
|
+
"""
|
989
|
+
...
|
990
|
+
|
991
|
+
@typing.overload
|
992
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
993
|
+
...
|
994
|
+
|
995
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
996
|
+
"""
|
997
|
+
Specifies the PyPI packages for all steps of the flow.
|
998
|
+
|
999
|
+
Use `@pypi_base` to set common packages required by all
|
1000
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1001
|
+
|
1002
|
+
Parameters
|
1003
|
+
----------
|
1004
|
+
packages : Dict[str, str], default: {}
|
1005
|
+
Packages to use for this flow. The key is the name of the package
|
1006
|
+
and the value is the version to use.
|
1007
|
+
python : str, optional, default: None
|
1008
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1009
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1010
|
+
"""
|
1011
|
+
...
|
1012
|
+
|
1013
|
+
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1014
|
+
"""
|
1015
|
+
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1016
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1017
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1018
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1019
|
+
starts only after all sensors finish.
|
1020
|
+
|
1021
|
+
|
1022
|
+
Parameters
|
1023
|
+
----------
|
1024
|
+
timeout : int
|
1025
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1026
|
+
poke_interval : int
|
1027
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1028
|
+
mode : str
|
1029
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1030
|
+
exponential_backoff : bool
|
1031
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1032
|
+
pool : str
|
1033
|
+
the slot pool this task should run in,
|
1034
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1035
|
+
soft_fail : bool
|
1036
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1037
|
+
name : str
|
1038
|
+
Name of the sensor on Airflow
|
1039
|
+
description : str
|
1040
|
+
Description of sensor in the Airflow UI
|
1041
|
+
bucket_key : Union[str, List[str]]
|
1042
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1043
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1044
|
+
bucket_name : str
|
1045
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1046
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1047
|
+
wildcard_match : bool
|
1048
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1049
|
+
aws_conn_id : str
|
1050
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1051
|
+
verify : bool
|
1052
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1053
|
+
"""
|
1054
|
+
...
|
1055
|
+
|
1056
|
+
@typing.overload
|
1057
|
+
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]]:
|
1058
|
+
"""
|
1059
|
+
Specifies the event(s) that this flow depends on.
|
1060
|
+
|
1061
|
+
```
|
1062
|
+
@trigger(event='foo')
|
1063
|
+
```
|
1064
|
+
or
|
1065
|
+
```
|
1066
|
+
@trigger(events=['foo', 'bar'])
|
1067
|
+
```
|
1068
|
+
|
1069
|
+
Additionally, you can specify the parameter mappings
|
1070
|
+
to map event payload to Metaflow parameters for the flow.
|
1071
|
+
```
|
1072
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1073
|
+
```
|
1074
|
+
or
|
1075
|
+
```
|
1076
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1077
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1078
|
+
```
|
1079
|
+
|
1080
|
+
'parameters' can also be a list of strings and tuples like so:
|
1081
|
+
```
|
1082
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1083
|
+
```
|
1084
|
+
This is equivalent to:
|
1085
|
+
```
|
1086
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1087
|
+
```
|
1088
|
+
|
1089
|
+
|
1090
|
+
Parameters
|
1091
|
+
----------
|
1092
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1093
|
+
Event dependency for this flow.
|
1094
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1095
|
+
Events dependency for this flow.
|
1096
|
+
options : Dict[str, Any], default {}
|
1097
|
+
Backend-specific configuration for tuning eventing behavior.
|
1098
|
+
"""
|
1099
|
+
...
|
1100
|
+
|
1101
|
+
@typing.overload
|
1102
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1103
|
+
...
|
1104
|
+
|
1105
|
+
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] = {}):
|
1106
|
+
"""
|
1107
|
+
Specifies the event(s) that this flow depends on.
|
1108
|
+
|
1109
|
+
```
|
1110
|
+
@trigger(event='foo')
|
1111
|
+
```
|
1112
|
+
or
|
1113
|
+
```
|
1114
|
+
@trigger(events=['foo', 'bar'])
|
1115
|
+
```
|
1116
|
+
|
1117
|
+
Additionally, you can specify the parameter mappings
|
1118
|
+
to map event payload to Metaflow parameters for the flow.
|
1119
|
+
```
|
1120
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1121
|
+
```
|
1122
|
+
or
|
1123
|
+
```
|
1124
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1125
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1126
|
+
```
|
1127
|
+
|
1128
|
+
'parameters' can also be a list of strings and tuples like so:
|
1129
|
+
```
|
1130
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1131
|
+
```
|
1132
|
+
This is equivalent to:
|
1133
|
+
```
|
1134
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1135
|
+
```
|
963
1136
|
|
964
1137
|
|
965
1138
|
Parameters
|
966
1139
|
----------
|
967
|
-
|
968
|
-
|
1140
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1141
|
+
Event dependency for this flow.
|
1142
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1143
|
+
Events dependency for this flow.
|
1144
|
+
options : Dict[str, Any], default {}
|
1145
|
+
Backend-specific configuration for tuning eventing behavior.
|
969
1146
|
"""
|
970
1147
|
...
|
971
1148
|
|
@@ -1020,49 +1197,6 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1020
1197
|
"""
|
1021
1198
|
...
|
1022
1199
|
|
1023
|
-
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1024
|
-
"""
|
1025
|
-
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1026
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1027
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1028
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1029
|
-
starts only after all sensors finish.
|
1030
|
-
|
1031
|
-
|
1032
|
-
Parameters
|
1033
|
-
----------
|
1034
|
-
timeout : int
|
1035
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1036
|
-
poke_interval : int
|
1037
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1038
|
-
mode : str
|
1039
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1040
|
-
exponential_backoff : bool
|
1041
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1042
|
-
pool : str
|
1043
|
-
the slot pool this task should run in,
|
1044
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1045
|
-
soft_fail : bool
|
1046
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1047
|
-
name : str
|
1048
|
-
Name of the sensor on Airflow
|
1049
|
-
description : str
|
1050
|
-
Description of sensor in the Airflow UI
|
1051
|
-
bucket_key : Union[str, List[str]]
|
1052
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1053
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1054
|
-
bucket_name : str
|
1055
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1056
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1057
|
-
wildcard_match : bool
|
1058
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1059
|
-
aws_conn_id : str
|
1060
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1061
|
-
verify : bool
|
1062
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1063
|
-
"""
|
1064
|
-
...
|
1065
|
-
|
1066
1200
|
@typing.overload
|
1067
1201
|
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]]:
|
1068
1202
|
"""
|
@@ -1149,90 +1283,6 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
|
|
1149
1283
|
"""
|
1150
1284
|
...
|
1151
1285
|
|
1152
|
-
@typing.overload
|
1153
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1154
|
-
"""
|
1155
|
-
Specifies the PyPI packages for all steps of the flow.
|
1156
|
-
|
1157
|
-
Use `@pypi_base` to set common packages required by all
|
1158
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1159
|
-
|
1160
|
-
Parameters
|
1161
|
-
----------
|
1162
|
-
packages : Dict[str, str], default: {}
|
1163
|
-
Packages to use for this flow. The key is the name of the package
|
1164
|
-
and the value is the version to use.
|
1165
|
-
python : str, optional, default: None
|
1166
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1167
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1168
|
-
"""
|
1169
|
-
...
|
1170
|
-
|
1171
|
-
@typing.overload
|
1172
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1173
|
-
...
|
1174
|
-
|
1175
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1176
|
-
"""
|
1177
|
-
Specifies the PyPI packages for all steps of the flow.
|
1178
|
-
|
1179
|
-
Use `@pypi_base` to set common packages required by all
|
1180
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1181
|
-
|
1182
|
-
Parameters
|
1183
|
-
----------
|
1184
|
-
packages : Dict[str, str], default: {}
|
1185
|
-
Packages to use for this flow. The key is the name of the package
|
1186
|
-
and the value is the version to use.
|
1187
|
-
python : str, optional, default: None
|
1188
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1189
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1190
|
-
"""
|
1191
|
-
...
|
1192
|
-
|
1193
|
-
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]]:
|
1194
|
-
"""
|
1195
|
-
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.
|
1196
|
-
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.
|
1197
|
-
|
1198
|
-
|
1199
|
-
Parameters
|
1200
|
-
----------
|
1201
|
-
timeout : int
|
1202
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1203
|
-
poke_interval : int
|
1204
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1205
|
-
mode : str
|
1206
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1207
|
-
exponential_backoff : bool
|
1208
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1209
|
-
pool : str
|
1210
|
-
the slot pool this task should run in,
|
1211
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1212
|
-
soft_fail : bool
|
1213
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1214
|
-
name : str
|
1215
|
-
Name of the sensor on Airflow
|
1216
|
-
description : str
|
1217
|
-
Description of sensor in the Airflow UI
|
1218
|
-
external_dag_id : str
|
1219
|
-
The dag_id that contains the task you want to wait for.
|
1220
|
-
external_task_ids : List[str]
|
1221
|
-
The list of task_ids that you want to wait for.
|
1222
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1223
|
-
allowed_states : List[str]
|
1224
|
-
Iterable of allowed states, (Default: ['success'])
|
1225
|
-
failed_states : List[str]
|
1226
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1227
|
-
execution_delta : datetime.timedelta
|
1228
|
-
time difference with the previous execution to look at,
|
1229
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1230
|
-
check_existence: bool
|
1231
|
-
Set to True to check if the external task exists or check if
|
1232
|
-
the DAG to wait for exists. (Default: True)
|
1233
|
-
"""
|
1234
|
-
...
|
1235
|
-
|
1236
1286
|
@typing.overload
|
1237
1287
|
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1238
1288
|
"""
|
@@ -1334,96 +1384,46 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1334
1384
|
"""
|
1335
1385
|
...
|
1336
1386
|
|
1337
|
-
|
1338
|
-
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]]:
|
1339
|
-
"""
|
1340
|
-
Specifies the event(s) that this flow depends on.
|
1341
|
-
|
1342
|
-
```
|
1343
|
-
@trigger(event='foo')
|
1344
|
-
```
|
1345
|
-
or
|
1346
|
-
```
|
1347
|
-
@trigger(events=['foo', 'bar'])
|
1348
|
-
```
|
1349
|
-
|
1350
|
-
Additionally, you can specify the parameter mappings
|
1351
|
-
to map event payload to Metaflow parameters for the flow.
|
1352
|
-
```
|
1353
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1354
|
-
```
|
1355
|
-
or
|
1356
|
-
```
|
1357
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1358
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1359
|
-
```
|
1360
|
-
|
1361
|
-
'parameters' can also be a list of strings and tuples like so:
|
1362
|
-
```
|
1363
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1364
|
-
```
|
1365
|
-
This is equivalent to:
|
1366
|
-
```
|
1367
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1368
|
-
```
|
1369
|
-
|
1370
|
-
|
1371
|
-
Parameters
|
1372
|
-
----------
|
1373
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1374
|
-
Event dependency for this flow.
|
1375
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1376
|
-
Events dependency for this flow.
|
1377
|
-
options : Dict[str, Any], default {}
|
1378
|
-
Backend-specific configuration for tuning eventing behavior.
|
1379
|
-
"""
|
1380
|
-
...
|
1381
|
-
|
1382
|
-
@typing.overload
|
1383
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1384
|
-
...
|
1385
|
-
|
1386
|
-
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] = {}):
|
1387
|
+
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]]:
|
1387
1388
|
"""
|
1388
|
-
|
1389
|
-
|
1390
|
-
```
|
1391
|
-
@trigger(event='foo')
|
1392
|
-
```
|
1393
|
-
or
|
1394
|
-
```
|
1395
|
-
@trigger(events=['foo', 'bar'])
|
1396
|
-
```
|
1397
|
-
|
1398
|
-
Additionally, you can specify the parameter mappings
|
1399
|
-
to map event payload to Metaflow parameters for the flow.
|
1400
|
-
```
|
1401
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1402
|
-
```
|
1403
|
-
or
|
1404
|
-
```
|
1405
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1406
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1407
|
-
```
|
1408
|
-
|
1409
|
-
'parameters' can also be a list of strings and tuples like so:
|
1410
|
-
```
|
1411
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1412
|
-
```
|
1413
|
-
This is equivalent to:
|
1414
|
-
```
|
1415
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1416
|
-
```
|
1389
|
+
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.
|
1390
|
+
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.
|
1417
1391
|
|
1418
1392
|
|
1419
1393
|
Parameters
|
1420
1394
|
----------
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1395
|
+
timeout : int
|
1396
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1397
|
+
poke_interval : int
|
1398
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1399
|
+
mode : str
|
1400
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1401
|
+
exponential_backoff : bool
|
1402
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1403
|
+
pool : str
|
1404
|
+
the slot pool this task should run in,
|
1405
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1406
|
+
soft_fail : bool
|
1407
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1408
|
+
name : str
|
1409
|
+
Name of the sensor on Airflow
|
1410
|
+
description : str
|
1411
|
+
Description of sensor in the Airflow UI
|
1412
|
+
external_dag_id : str
|
1413
|
+
The dag_id that contains the task you want to wait for.
|
1414
|
+
external_task_ids : List[str]
|
1415
|
+
The list of task_ids that you want to wait for.
|
1416
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1417
|
+
allowed_states : List[str]
|
1418
|
+
Iterable of allowed states, (Default: ['success'])
|
1419
|
+
failed_states : List[str]
|
1420
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1421
|
+
execution_delta : datetime.timedelta
|
1422
|
+
time difference with the previous execution to look at,
|
1423
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1424
|
+
check_existence: bool
|
1425
|
+
Set to True to check if the external task exists or check if
|
1426
|
+
the DAG to wait for exists. (Default: True)
|
1427
1427
|
"""
|
1428
1428
|
...
|
1429
1429
|
|