ob-metaflow-stubs 6.0.3.151__py2.py3-none-any.whl → 6.0.3.153__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 +687 -672
- 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 +4 -4
- metaflow-stubs/client/filecache.pyi +2 -2
- 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 +2 -2
- 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 +95 -95
- 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 +2 -2
- 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 +2 -2
- 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 +3 -3
- 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 +4 -4
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- metaflow-stubs/plugins/__init__.pyi +14 -14
- 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 +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +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 +4 -4
- 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 +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- 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 +4 -4
- 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 +4 -4
- 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 +3 -3
- 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 +4 -4
- 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 +5 -5
- 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 +3 -3
- 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 +3 -3
- 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 +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- 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 +3 -3
- 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 +4 -4
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.151.dist-info → ob_metaflow_stubs-6.0.3.153.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.153.dist-info/RECORD +198 -0
- ob_metaflow_stubs-6.0.3.151.dist-info/RECORD +0 -198
- {ob_metaflow_stubs-6.0.3.151.dist-info → ob_metaflow_stubs-6.0.3.153.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.151.dist-info → ob_metaflow_stubs-6.0.3.153.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.15.
|
4
|
-
# Generated on 2025-03-
|
3
|
+
# MF version: 2.15.7.1+obcheckpoint(0.1.9);ob(v1) #
|
4
|
+
# Generated on 2025-03-25T18:39:51.892760 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import datetime
|
12
11
|
import typing
|
12
|
+
import datetime
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -44,8 +44,8 @@ from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package imp
|
|
44
44
|
from . import includefile as includefile
|
45
45
|
from .includefile import IncludeFile as IncludeFile
|
46
46
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
47
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
48
47
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
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
|
51
51
|
from .client.core import get_namespace as get_namespace
|
@@ -149,69 +149,134 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
149
149
|
"""
|
150
150
|
...
|
151
151
|
|
152
|
-
|
152
|
+
@typing.overload
|
153
|
+
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]]]:
|
153
154
|
"""
|
154
|
-
|
155
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
155
156
|
|
156
|
-
|
157
|
-
-----------
|
158
|
-
@ollama(
|
159
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
160
|
-
backend='local'
|
161
|
-
)
|
157
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
162
158
|
|
163
|
-
Valid backend options
|
164
|
-
---------------------
|
165
|
-
- 'local': Run as a separate process on the local task machine.
|
166
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
167
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
168
159
|
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
160
|
+
Parameters
|
161
|
+
----------
|
162
|
+
type : str, default 'default'
|
163
|
+
Card type.
|
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.
|
170
|
+
"""
|
171
|
+
...
|
172
|
+
|
173
|
+
@typing.overload
|
174
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
175
|
+
...
|
176
|
+
|
177
|
+
@typing.overload
|
178
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
179
|
+
...
|
180
|
+
|
181
|
+
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):
|
182
|
+
"""
|
183
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
184
|
+
|
185
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
174
186
|
|
175
187
|
|
176
188
|
Parameters
|
177
189
|
----------
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
190
|
+
type : str, default 'default'
|
191
|
+
Card type.
|
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
198
|
"""
|
183
199
|
...
|
184
200
|
|
185
201
|
@typing.overload
|
186
|
-
def
|
202
|
+
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]]]:
|
187
203
|
"""
|
188
|
-
|
204
|
+
Enables checkpointing for a step.
|
205
|
+
|
189
206
|
|
190
207
|
|
191
208
|
Parameters
|
192
209
|
----------
|
193
|
-
|
194
|
-
|
210
|
+
load_policy : str, default: "fresh"
|
211
|
+
The policy for loading the checkpoint. The following policies are supported:
|
212
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
213
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
214
|
+
will be loaded at the start of the task.
|
215
|
+
- "none": Do not load any checkpoint
|
216
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
217
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
218
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
219
|
+
created within the task will be loaded when the task is retries execution on failure.
|
220
|
+
|
221
|
+
temp_dir_root : str, default: None
|
222
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
195
223
|
"""
|
196
224
|
...
|
197
225
|
|
198
226
|
@typing.overload
|
199
|
-
def
|
227
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
200
228
|
...
|
201
229
|
|
202
230
|
@typing.overload
|
203
|
-
def
|
231
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
204
232
|
...
|
205
233
|
|
206
|
-
def
|
234
|
+
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):
|
207
235
|
"""
|
208
|
-
|
236
|
+
Enables checkpointing for a step.
|
237
|
+
|
209
238
|
|
210
239
|
|
211
240
|
Parameters
|
212
241
|
----------
|
213
|
-
|
214
|
-
|
242
|
+
load_policy : str, default: "fresh"
|
243
|
+
The policy for loading the checkpoint. The following policies are supported:
|
244
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
245
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
246
|
+
will be loaded at the start of the task.
|
247
|
+
- "none": Do not load any checkpoint
|
248
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
249
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
250
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
251
|
+
created within the task will be loaded when the task is retries execution on failure.
|
252
|
+
|
253
|
+
temp_dir_root : str, default: None
|
254
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
255
|
+
"""
|
256
|
+
...
|
257
|
+
|
258
|
+
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]]]:
|
259
|
+
"""
|
260
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
261
|
+
|
262
|
+
|
263
|
+
Parameters
|
264
|
+
----------
|
265
|
+
temp_dir_root : str, optional
|
266
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
267
|
+
|
268
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
269
|
+
The list of repos (models/datasets) to load.
|
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)
|
215
280
|
"""
|
216
281
|
...
|
217
282
|
|
@@ -270,98 +335,6 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
270
335
|
"""
|
271
336
|
...
|
272
337
|
|
273
|
-
@typing.overload
|
274
|
-
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]]]:
|
275
|
-
"""
|
276
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
277
|
-
the execution of a step.
|
278
|
-
|
279
|
-
|
280
|
-
Parameters
|
281
|
-
----------
|
282
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
283
|
-
List of secret specs, defining how the secrets are to be retrieved
|
284
|
-
"""
|
285
|
-
...
|
286
|
-
|
287
|
-
@typing.overload
|
288
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
289
|
-
...
|
290
|
-
|
291
|
-
@typing.overload
|
292
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
293
|
-
...
|
294
|
-
|
295
|
-
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]]] = []):
|
296
|
-
"""
|
297
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
298
|
-
the execution of a step.
|
299
|
-
|
300
|
-
|
301
|
-
Parameters
|
302
|
-
----------
|
303
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
304
|
-
List of secret specs, defining how the secrets are to be retrieved
|
305
|
-
"""
|
306
|
-
...
|
307
|
-
|
308
|
-
@typing.overload
|
309
|
-
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]]]:
|
310
|
-
"""
|
311
|
-
Enables checkpointing for a step.
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
Parameters
|
316
|
-
----------
|
317
|
-
load_policy : str, default: "fresh"
|
318
|
-
The policy for loading the checkpoint. The following policies are supported:
|
319
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
320
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
321
|
-
will be loaded at the start of the task.
|
322
|
-
- "none": Do not load any checkpoint
|
323
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
324
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
325
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
326
|
-
created within the task will be loaded when the task is retries execution on failure.
|
327
|
-
|
328
|
-
temp_dir_root : str, default: None
|
329
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
330
|
-
"""
|
331
|
-
...
|
332
|
-
|
333
|
-
@typing.overload
|
334
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
335
|
-
...
|
336
|
-
|
337
|
-
@typing.overload
|
338
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
339
|
-
...
|
340
|
-
|
341
|
-
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):
|
342
|
-
"""
|
343
|
-
Enables checkpointing for a step.
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
Parameters
|
348
|
-
----------
|
349
|
-
load_policy : str, default: "fresh"
|
350
|
-
The policy for loading the checkpoint. The following policies are supported:
|
351
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
352
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
353
|
-
will be loaded at the start of the task.
|
354
|
-
- "none": Do not load any checkpoint
|
355
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
356
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
357
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
358
|
-
created within the task will be loaded when the task is retries execution on failure.
|
359
|
-
|
360
|
-
temp_dir_root : str, default: None
|
361
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
362
|
-
"""
|
363
|
-
...
|
364
|
-
|
365
338
|
@typing.overload
|
366
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]]]:
|
367
340
|
"""
|
@@ -419,116 +392,103 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
419
392
|
"""
|
420
393
|
...
|
421
394
|
|
422
|
-
def
|
395
|
+
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]]]:
|
423
396
|
"""
|
424
|
-
|
397
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
398
|
+
|
399
|
+
User code call
|
400
|
+
-----------
|
401
|
+
@nim(
|
402
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
403
|
+
backend='managed'
|
404
|
+
)
|
405
|
+
|
406
|
+
Valid backend options
|
407
|
+
---------------------
|
408
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
409
|
+
|
410
|
+
Valid model options
|
411
|
+
----------------
|
412
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
413
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
414
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
425
415
|
|
426
416
|
|
427
417
|
Parameters
|
428
418
|
----------
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
used.
|
436
|
-
disk : int, default 10240
|
437
|
-
Disk size (in MB) required for this step. If
|
438
|
-
`@resources` is also present, the maximum value from all decorators is
|
439
|
-
used.
|
440
|
-
image : str, optional, default None
|
441
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
442
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
443
|
-
not, a default Docker image mapping to the current version of Python is used.
|
444
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
445
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
446
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
447
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
448
|
-
secrets : List[str], optional, default None
|
449
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
450
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
451
|
-
in Metaflow configuration.
|
452
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
453
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
454
|
-
Can be passed in as a comma separated string of values e.g.
|
455
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
456
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
457
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
458
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
459
|
-
gpu : int, optional, default None
|
460
|
-
Number of GPUs required for this step. A value of zero implies that
|
461
|
-
the scheduled node should not have GPUs.
|
462
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
463
|
-
The vendor of the GPUs to be used for this step.
|
464
|
-
tolerations : List[str], default []
|
465
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
466
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
467
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
468
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
469
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
470
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
471
|
-
use_tmpfs : bool, default False
|
472
|
-
This enables an explicit tmpfs mount for this step.
|
473
|
-
tmpfs_tempdir : bool, default True
|
474
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
475
|
-
tmpfs_size : int, optional, default: None
|
476
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
477
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
478
|
-
memory allocated for this step.
|
479
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
480
|
-
Path to tmpfs mount for this step.
|
481
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
482
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
483
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
484
|
-
shared_memory: int, optional
|
485
|
-
Shared memory size (in MiB) required for this step
|
486
|
-
port: int, optional
|
487
|
-
Port number to specify in the Kubernetes job object
|
488
|
-
compute_pool : str, optional, default None
|
489
|
-
Compute pool to be used for for this step.
|
490
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
491
|
-
hostname_resolution_timeout: int, default 10 * 60
|
492
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
493
|
-
Only applicable when @parallel is used.
|
494
|
-
qos: str, default: Burstable
|
495
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
419
|
+
models: list[NIM]
|
420
|
+
List of NIM containers running models in sidecars.
|
421
|
+
backend: str
|
422
|
+
Compute provider to run the NIM container.
|
423
|
+
queue_timeout : int
|
424
|
+
Time to keep the job in NVCF's queue.
|
496
425
|
"""
|
497
426
|
...
|
498
427
|
|
499
428
|
@typing.overload
|
500
|
-
def
|
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]]]:
|
501
430
|
"""
|
502
|
-
|
503
|
-
|
431
|
+
Specifies that the step will success under all circumstances.
|
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.
|
437
|
+
|
438
|
+
|
439
|
+
Parameters
|
440
|
+
----------
|
441
|
+
var : str, optional, default None
|
442
|
+
Name of the artifact in which to store the caught exception.
|
443
|
+
If not specified, the exception is not stored.
|
444
|
+
print_exception : bool, default True
|
445
|
+
Determines whether or not the exception is printed to
|
446
|
+
stdout when caught.
|
504
447
|
"""
|
505
448
|
...
|
506
449
|
|
507
450
|
@typing.overload
|
508
|
-
def
|
451
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
509
452
|
...
|
510
453
|
|
511
|
-
|
512
|
-
|
513
|
-
Decorator prototype for all step decorators. This function gets specialized
|
514
|
-
and imported for all decorators types by _import_plugin_decorators().
|
515
|
-
"""
|
454
|
+
@typing.overload
|
455
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
516
456
|
...
|
517
457
|
|
518
|
-
|
519
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
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):
|
520
459
|
"""
|
521
|
-
|
460
|
+
Specifies that the step will success under all circumstances.
|
461
|
+
|
462
|
+
The decorator will create an optional artifact, specified by `var`, which
|
463
|
+
contains the exception raised. You can use it to detect the presence
|
464
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
465
|
+
are missing.
|
466
|
+
|
467
|
+
|
468
|
+
Parameters
|
469
|
+
----------
|
470
|
+
var : str, optional, default None
|
471
|
+
Name of the artifact in which to store the caught exception.
|
472
|
+
If not specified, the exception is not stored.
|
473
|
+
print_exception : bool, default True
|
474
|
+
Determines whether or not the exception is printed to
|
475
|
+
stdout when caught.
|
522
476
|
"""
|
523
477
|
...
|
524
478
|
|
525
|
-
|
526
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
527
|
-
...
|
528
|
-
|
529
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
479
|
+
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]]]:
|
530
480
|
"""
|
531
|
-
|
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.
|
532
492
|
"""
|
533
493
|
...
|
534
494
|
|
@@ -591,110 +551,142 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
591
551
|
"""
|
592
552
|
...
|
593
553
|
|
594
|
-
|
595
|
-
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]]]:
|
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]]]:
|
596
555
|
"""
|
597
|
-
Specifies
|
598
|
-
|
599
|
-
This decorator is useful if this step may hang indefinitely.
|
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.
|
600
558
|
|
601
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
602
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
603
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
604
559
|
|
605
|
-
|
606
|
-
|
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.
|
607
574
|
|
608
575
|
|
609
576
|
Parameters
|
610
577
|
----------
|
611
|
-
|
612
|
-
|
613
|
-
minutes : int, default 0
|
614
|
-
Number of minutes to wait prior to timing out.
|
615
|
-
hours : int, default 0
|
616
|
-
Number of hours to wait prior to timing out.
|
578
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
579
|
+
List of secret specs, defining how the secrets are to be retrieved
|
617
580
|
"""
|
618
581
|
...
|
619
582
|
|
620
583
|
@typing.overload
|
621
|
-
def
|
584
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
622
585
|
...
|
623
586
|
|
624
587
|
@typing.overload
|
625
|
-
def
|
588
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
626
589
|
...
|
627
590
|
|
628
|
-
def
|
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]]] = []):
|
629
592
|
"""
|
630
|
-
Specifies
|
593
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
594
|
+
the execution of a step.
|
631
595
|
|
632
|
-
This decorator is useful if this step may hang indefinitely.
|
633
596
|
|
634
|
-
|
635
|
-
|
636
|
-
|
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.
|
637
607
|
|
638
|
-
|
639
|
-
|
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
|
640
626
|
|
641
627
|
|
642
628
|
Parameters
|
643
629
|
----------
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
648
|
-
hours : int, default 0
|
649
|
-
Number of hours to wait prior to timing out.
|
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.
|
650
634
|
"""
|
651
635
|
...
|
652
636
|
|
653
637
|
@typing.overload
|
654
|
-
def
|
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]]]:
|
655
639
|
"""
|
656
|
-
Specifies the
|
657
|
-
|
658
|
-
Use `@resources` to specify the resource requirements
|
659
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
640
|
+
Specifies the PyPI packages for the step.
|
660
641
|
|
661
|
-
|
662
|
-
|
663
|
-
|
664
|
-
|
665
|
-
or
|
666
|
-
```
|
667
|
-
python myflow.py run --with kubernetes
|
668
|
-
```
|
669
|
-
which executes the flow on the desired system using the
|
670
|
-
requirements specified in `@resources`.
|
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.
|
671
646
|
|
672
647
|
|
673
648
|
Parameters
|
674
649
|
----------
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
memory : int, default 4096
|
682
|
-
Memory size (in MB) required for this step.
|
683
|
-
shared_memory : int, optional, default None
|
684
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
685
|
-
This parameter maps to the `--shm-size` option in Docker.
|
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.
|
686
656
|
"""
|
687
657
|
...
|
688
658
|
|
689
659
|
@typing.overload
|
690
|
-
def
|
660
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
691
661
|
...
|
692
662
|
|
693
663
|
@typing.overload
|
694
|
-
def
|
664
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
695
665
|
...
|
696
666
|
|
697
|
-
def
|
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]]]:
|
698
690
|
"""
|
699
691
|
Specifies the resources needed when executing this step.
|
700
692
|
|
@@ -729,321 +721,312 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
729
721
|
"""
|
730
722
|
...
|
731
723
|
|
732
|
-
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]]]:
|
733
|
-
"""
|
734
|
-
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
735
|
-
|
736
|
-
|
737
|
-
Parameters
|
738
|
-
----------
|
739
|
-
temp_dir_root : str, optional
|
740
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
741
|
-
|
742
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
743
|
-
The list of repos (models/datasets) to load.
|
744
|
-
|
745
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
746
|
-
|
747
|
-
- If repo (model/dataset) is not found in the datastore:
|
748
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
749
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
750
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
751
|
-
|
752
|
-
- If repo is found in the datastore:
|
753
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
754
|
-
"""
|
755
|
-
...
|
756
|
-
|
757
|
-
@typing.overload
|
758
|
-
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]]]:
|
759
|
-
"""
|
760
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
761
|
-
|
762
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
763
|
-
|
764
|
-
|
765
|
-
Parameters
|
766
|
-
----------
|
767
|
-
type : str, default 'default'
|
768
|
-
Card type.
|
769
|
-
id : str, optional, default None
|
770
|
-
If multiple cards are present, use this id to identify this card.
|
771
|
-
options : Dict[str, Any], default {}
|
772
|
-
Options passed to the card. The contents depend on the card type.
|
773
|
-
timeout : int, default 45
|
774
|
-
Interrupt reporting if it takes more than this many seconds.
|
775
|
-
"""
|
776
|
-
...
|
777
|
-
|
778
724
|
@typing.overload
|
779
|
-
def
|
725
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
780
726
|
...
|
781
727
|
|
782
728
|
@typing.overload
|
783
|
-
def
|
729
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
784
730
|
...
|
785
731
|
|
786
|
-
def
|
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):
|
787
733
|
"""
|
788
|
-
|
734
|
+
Specifies the resources needed when executing this step.
|
789
735
|
|
790
|
-
|
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`.
|
791
749
|
|
792
750
|
|
793
751
|
Parameters
|
794
752
|
----------
|
795
|
-
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
|
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.
|
803
764
|
"""
|
804
765
|
...
|
805
766
|
|
806
767
|
@typing.overload
|
807
|
-
def
|
768
|
+
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]]]:
|
808
769
|
"""
|
809
|
-
Specifies
|
770
|
+
Specifies a timeout for your step.
|
810
771
|
|
811
|
-
|
812
|
-
|
813
|
-
|
814
|
-
|
772
|
+
This decorator is useful if this step may hang indefinitely.
|
773
|
+
|
774
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
775
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
776
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
777
|
+
|
778
|
+
Note that all the values specified in parameters are added together so if you specify
|
779
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
815
780
|
|
816
781
|
|
817
782
|
Parameters
|
818
783
|
----------
|
819
|
-
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
784
|
+
seconds : int, default 0
|
785
|
+
Number of seconds to wait prior to timing out.
|
786
|
+
minutes : int, default 0
|
787
|
+
Number of minutes to wait prior to timing out.
|
788
|
+
hours : int, default 0
|
789
|
+
Number of hours to wait prior to timing out.
|
825
790
|
"""
|
826
791
|
...
|
827
792
|
|
828
793
|
@typing.overload
|
829
|
-
def
|
794
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
830
795
|
...
|
831
796
|
|
832
797
|
@typing.overload
|
833
|
-
def
|
834
|
-
...
|
835
|
-
|
836
|
-
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):
|
837
|
-
"""
|
838
|
-
Specifies the PyPI packages for the step.
|
839
|
-
|
840
|
-
Information in this decorator will augment any
|
841
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
842
|
-
you can use `@pypi_base` to set packages required by all
|
843
|
-
steps and use `@pypi` to specify step-specific overrides.
|
844
|
-
|
845
|
-
|
846
|
-
Parameters
|
847
|
-
----------
|
848
|
-
packages : Dict[str, str], default: {}
|
849
|
-
Packages to use for this step. The key is the name of the package
|
850
|
-
and the value is the version to use.
|
851
|
-
python : str, optional, default: None
|
852
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
853
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
854
|
-
"""
|
798
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
855
799
|
...
|
856
800
|
|
857
|
-
def
|
801
|
+
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):
|
858
802
|
"""
|
859
|
-
|
803
|
+
Specifies a timeout for your step.
|
860
804
|
|
861
|
-
|
862
|
-
-----------
|
863
|
-
@nim(
|
864
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
865
|
-
backend='managed'
|
866
|
-
)
|
805
|
+
This decorator is useful if this step may hang indefinitely.
|
867
806
|
|
868
|
-
|
869
|
-
|
870
|
-
|
807
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
808
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
809
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
871
810
|
|
872
|
-
|
873
|
-
|
874
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
875
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
876
|
-
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
811
|
+
Note that all the values specified in parameters are added together so if you specify
|
812
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
877
813
|
|
878
814
|
|
879
815
|
Parameters
|
880
816
|
----------
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
817
|
+
seconds : int, default 0
|
818
|
+
Number of seconds to wait prior to timing out.
|
819
|
+
minutes : int, default 0
|
820
|
+
Number of minutes to wait prior to timing out.
|
821
|
+
hours : int, default 0
|
822
|
+
Number of hours to wait prior to timing out.
|
887
823
|
"""
|
888
824
|
...
|
889
825
|
|
890
826
|
@typing.overload
|
891
|
-
def
|
827
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
892
828
|
"""
|
893
|
-
|
894
|
-
|
895
|
-
The decorator will create an optional artifact, specified by `var`, which
|
896
|
-
contains the exception raised. You can use it to detect the presence
|
897
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
898
|
-
are missing.
|
899
|
-
|
900
|
-
|
901
|
-
Parameters
|
902
|
-
----------
|
903
|
-
var : str, optional, default None
|
904
|
-
Name of the artifact in which to store the caught exception.
|
905
|
-
If not specified, the exception is not stored.
|
906
|
-
print_exception : bool, default True
|
907
|
-
Determines whether or not the exception is printed to
|
908
|
-
stdout when caught.
|
829
|
+
Internal decorator to support Fast bakery
|
909
830
|
"""
|
910
831
|
...
|
911
832
|
|
912
833
|
@typing.overload
|
913
|
-
def
|
914
|
-
...
|
915
|
-
|
916
|
-
@typing.overload
|
917
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
834
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
918
835
|
...
|
919
836
|
|
920
|
-
def
|
837
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
921
838
|
"""
|
922
|
-
|
923
|
-
|
924
|
-
The decorator will create an optional artifact, specified by `var`, which
|
925
|
-
contains the exception raised. You can use it to detect the presence
|
926
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
927
|
-
are missing.
|
928
|
-
|
929
|
-
|
930
|
-
Parameters
|
931
|
-
----------
|
932
|
-
var : str, optional, default None
|
933
|
-
Name of the artifact in which to store the caught exception.
|
934
|
-
If not specified, the exception is not stored.
|
935
|
-
print_exception : bool, default True
|
936
|
-
Determines whether or not the exception is printed to
|
937
|
-
stdout when caught.
|
839
|
+
Internal decorator to support Fast bakery
|
938
840
|
"""
|
939
841
|
...
|
940
842
|
|
941
|
-
def
|
843
|
+
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]]]:
|
942
844
|
"""
|
943
|
-
Specifies that this step should execute on
|
845
|
+
Specifies that this step should execute on Kubernetes.
|
944
846
|
|
945
847
|
|
946
848
|
Parameters
|
947
849
|
----------
|
948
|
-
|
949
|
-
Number of
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
850
|
+
cpu : int, default 1
|
851
|
+
Number of CPUs required for this step. If `@resources` is
|
852
|
+
also present, the maximum value from all decorators is used.
|
853
|
+
memory : int, default 4096
|
854
|
+
Memory size (in MB) required for this step. If
|
855
|
+
`@resources` is also present, the maximum value from all decorators is
|
856
|
+
used.
|
857
|
+
disk : int, default 10240
|
858
|
+
Disk size (in MB) required for this step. If
|
859
|
+
`@resources` is also present, the maximum value from all decorators is
|
860
|
+
used.
|
861
|
+
image : str, optional, default None
|
862
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
863
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
864
|
+
not, a default Docker image mapping to the current version of Python is used.
|
865
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
866
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
867
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
868
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
869
|
+
secrets : List[str], optional, default None
|
870
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
871
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
872
|
+
in Metaflow configuration.
|
873
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
874
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
875
|
+
Can be passed in as a comma separated string of values e.g.
|
876
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
877
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
878
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
879
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
880
|
+
gpu : int, optional, default None
|
881
|
+
Number of GPUs required for this step. A value of zero implies that
|
882
|
+
the scheduled node should not have GPUs.
|
883
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
884
|
+
The vendor of the GPUs to be used for this step.
|
885
|
+
tolerations : List[str], default []
|
886
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
887
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
888
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
889
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
890
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
891
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
892
|
+
use_tmpfs : bool, default False
|
893
|
+
This enables an explicit tmpfs mount for this step.
|
894
|
+
tmpfs_tempdir : bool, default True
|
895
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
896
|
+
tmpfs_size : int, optional, default: None
|
897
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
898
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
899
|
+
memory allocated for this step.
|
900
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
901
|
+
Path to tmpfs mount for this step.
|
902
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
903
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
904
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
905
|
+
shared_memory: int, optional
|
906
|
+
Shared memory size (in MiB) required for this step
|
907
|
+
port: int, optional
|
908
|
+
Port number to specify in the Kubernetes job object
|
909
|
+
compute_pool : str, optional, default None
|
910
|
+
Compute pool to be used for for this step.
|
911
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
912
|
+
hostname_resolution_timeout: int, default 10 * 60
|
913
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
914
|
+
Only applicable when @parallel is used.
|
915
|
+
qos: str, default: Burstable
|
916
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
959
917
|
"""
|
960
|
-
|
961
|
-
|
918
|
+
...
|
919
|
+
|
920
|
+
@typing.overload
|
921
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
922
|
+
"""
|
923
|
+
Decorator prototype for all step decorators. This function gets specialized
|
924
|
+
and imported for all decorators types by _import_plugin_decorators().
|
925
|
+
"""
|
926
|
+
...
|
927
|
+
|
928
|
+
@typing.overload
|
929
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
930
|
+
...
|
931
|
+
|
932
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
933
|
+
"""
|
934
|
+
Decorator prototype for all step decorators. This function gets specialized
|
935
|
+
and imported for all decorators types by _import_plugin_decorators().
|
936
|
+
"""
|
937
|
+
...
|
938
|
+
|
939
|
+
@typing.overload
|
940
|
+
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]]]:
|
941
|
+
"""
|
942
|
+
Specifies environment variables to be set prior to the execution of a step.
|
962
943
|
|
963
944
|
|
964
945
|
Parameters
|
965
946
|
----------
|
966
|
-
|
967
|
-
|
968
|
-
daily : bool, default True
|
969
|
-
Run the workflow daily.
|
970
|
-
weekly : bool, default False
|
971
|
-
Run the workflow weekly.
|
972
|
-
cron : str, optional, default None
|
973
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
974
|
-
specified by this expression.
|
975
|
-
timezone : str, optional, default None
|
976
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
977
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
947
|
+
vars : Dict[str, str], default {}
|
948
|
+
Dictionary of environment variables to set.
|
978
949
|
"""
|
979
950
|
...
|
980
951
|
|
981
952
|
@typing.overload
|
982
|
-
def
|
953
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
983
954
|
...
|
984
955
|
|
985
|
-
|
956
|
+
@typing.overload
|
957
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
958
|
+
...
|
959
|
+
|
960
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
986
961
|
"""
|
987
|
-
Specifies
|
988
|
-
production scheduler.
|
962
|
+
Specifies environment variables to be set prior to the execution of a step.
|
989
963
|
|
990
964
|
|
991
965
|
Parameters
|
992
966
|
----------
|
993
|
-
|
994
|
-
|
995
|
-
daily : bool, default True
|
996
|
-
Run the workflow daily.
|
997
|
-
weekly : bool, default False
|
998
|
-
Run the workflow weekly.
|
999
|
-
cron : str, optional, default None
|
1000
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1001
|
-
specified by this expression.
|
1002
|
-
timezone : str, optional, default None
|
1003
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1004
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
967
|
+
vars : Dict[str, str], default {}
|
968
|
+
Dictionary of environment variables to set.
|
1005
969
|
"""
|
1006
970
|
...
|
1007
971
|
|
1008
|
-
|
972
|
+
@typing.overload
|
973
|
+
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]]:
|
1009
974
|
"""
|
1010
|
-
Specifies
|
975
|
+
Specifies the Conda environment for all steps of the flow.
|
1011
976
|
|
1012
|
-
|
1013
|
-
use
|
977
|
+
Use `@conda_base` to set common libraries required by all
|
978
|
+
steps and use `@conda` to specify step-specific additions.
|
1014
979
|
|
1015
980
|
|
1016
981
|
Parameters
|
1017
982
|
----------
|
1018
|
-
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
983
|
+
packages : Dict[str, str], default {}
|
984
|
+
Packages to use for this flow. The key is the name of the package
|
985
|
+
and the value is the version to use.
|
986
|
+
libraries : Dict[str, str], default {}
|
987
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
988
|
+
python : str, optional, default None
|
989
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
990
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
991
|
+
disabled : bool, default False
|
992
|
+
If set to True, disables Conda.
|
993
|
+
"""
|
994
|
+
...
|
995
|
+
|
996
|
+
@typing.overload
|
997
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
998
|
+
...
|
999
|
+
|
1000
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1001
|
+
"""
|
1002
|
+
Specifies the Conda environment for all steps of the flow.
|
1022
1003
|
|
1023
|
-
|
1024
|
-
|
1025
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1026
|
-
also be set on the command line using `--branch` as a top-level option.
|
1027
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1004
|
+
Use `@conda_base` to set common libraries required by all
|
1005
|
+
steps and use `@conda` to specify step-specific additions.
|
1028
1006
|
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
The
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1007
|
+
|
1008
|
+
Parameters
|
1009
|
+
----------
|
1010
|
+
packages : Dict[str, str], default {}
|
1011
|
+
Packages to use for this flow. The key is the name of the package
|
1012
|
+
and the value is the version to use.
|
1013
|
+
libraries : Dict[str, str], default {}
|
1014
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1015
|
+
python : str, optional, default None
|
1016
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1017
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1018
|
+
disabled : bool, default False
|
1019
|
+
If set to True, disables Conda.
|
1040
1020
|
"""
|
1041
1021
|
...
|
1042
1022
|
|
1043
|
-
def
|
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]]:
|
1044
1024
|
"""
|
1045
|
-
The `@
|
1046
|
-
This decorator only works when a flow is scheduled on Airflow
|
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.
|
1047
1030
|
|
1048
1031
|
|
1049
1032
|
Parameters
|
@@ -1065,165 +1048,188 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1065
1048
|
Name of the sensor on Airflow
|
1066
1049
|
description : str
|
1067
1050
|
Description of sensor in the Airflow UI
|
1068
|
-
|
1069
|
-
The
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
check_existence: bool
|
1081
|
-
Set to True to check if the external task exists or check if
|
1082
|
-
the DAG to wait for exists. (Default: True)
|
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)
|
1083
1063
|
"""
|
1084
1064
|
...
|
1085
1065
|
|
1086
1066
|
@typing.overload
|
1087
|
-
def
|
1067
|
+
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]]:
|
1088
1068
|
"""
|
1089
|
-
Specifies the
|
1090
|
-
|
1091
|
-
```
|
1092
|
-
@trigger(event='foo')
|
1093
|
-
```
|
1094
|
-
or
|
1095
|
-
```
|
1096
|
-
@trigger(events=['foo', 'bar'])
|
1097
|
-
```
|
1098
|
-
|
1099
|
-
Additionally, you can specify the parameter mappings
|
1100
|
-
to map event payload to Metaflow parameters for the flow.
|
1101
|
-
```
|
1102
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1103
|
-
```
|
1104
|
-
or
|
1105
|
-
```
|
1106
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1107
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1108
|
-
```
|
1109
|
-
|
1110
|
-
'parameters' can also be a list of strings and tuples like so:
|
1111
|
-
```
|
1112
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1113
|
-
```
|
1114
|
-
This is equivalent to:
|
1115
|
-
```
|
1116
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1117
|
-
```
|
1069
|
+
Specifies the times when the flow should be run when running on a
|
1070
|
+
production scheduler.
|
1118
1071
|
|
1119
1072
|
|
1120
1073
|
Parameters
|
1121
1074
|
----------
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1075
|
+
hourly : bool, default False
|
1076
|
+
Run the workflow hourly.
|
1077
|
+
daily : bool, default True
|
1078
|
+
Run the workflow daily.
|
1079
|
+
weekly : bool, default False
|
1080
|
+
Run the workflow weekly.
|
1081
|
+
cron : str, optional, default None
|
1082
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1083
|
+
specified by this expression.
|
1084
|
+
timezone : str, optional, default None
|
1085
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1086
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1128
1087
|
"""
|
1129
1088
|
...
|
1130
1089
|
|
1131
1090
|
@typing.overload
|
1132
|
-
def
|
1091
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1133
1092
|
...
|
1134
1093
|
|
1135
|
-
def
|
1094
|
+
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):
|
1136
1095
|
"""
|
1137
|
-
Specifies the
|
1096
|
+
Specifies the times when the flow should be run when running on a
|
1097
|
+
production scheduler.
|
1138
1098
|
|
1139
|
-
```
|
1140
|
-
@trigger(event='foo')
|
1141
|
-
```
|
1142
|
-
or
|
1143
|
-
```
|
1144
|
-
@trigger(events=['foo', 'bar'])
|
1145
|
-
```
|
1146
1099
|
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1100
|
+
Parameters
|
1101
|
+
----------
|
1102
|
+
hourly : bool, default False
|
1103
|
+
Run the workflow hourly.
|
1104
|
+
daily : bool, default True
|
1105
|
+
Run the workflow daily.
|
1106
|
+
weekly : bool, default False
|
1107
|
+
Run the workflow weekly.
|
1108
|
+
cron : str, optional, default None
|
1109
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1110
|
+
specified by this expression.
|
1111
|
+
timezone : str, optional, default None
|
1112
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1113
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1114
|
+
"""
|
1115
|
+
...
|
1116
|
+
|
1117
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1118
|
+
"""
|
1119
|
+
Specifies what flows belong to the same project.
|
1157
1120
|
|
1158
|
-
|
1159
|
-
|
1160
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1161
|
-
```
|
1162
|
-
This is equivalent to:
|
1163
|
-
```
|
1164
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1165
|
-
```
|
1121
|
+
A project-specific namespace is created for all flows that
|
1122
|
+
use the same `@project(name)`.
|
1166
1123
|
|
1167
1124
|
|
1168
1125
|
Parameters
|
1169
1126
|
----------
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1127
|
+
name : str
|
1128
|
+
Project name. Make sure that the name is unique amongst all
|
1129
|
+
projects that use the same production scheduler. The name may
|
1130
|
+
contain only lowercase alphanumeric characters and underscores.
|
1131
|
+
|
1132
|
+
branch : Optional[str], default None
|
1133
|
+
The branch to use. If not specified, the branch is set to
|
1134
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1135
|
+
also be set on the command line using `--branch` as a top-level option.
|
1136
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1137
|
+
|
1138
|
+
production : bool, default False
|
1139
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1140
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1141
|
+
`production` in the decorator and on the command line.
|
1142
|
+
The project branch name will be:
|
1143
|
+
- if `branch` is specified:
|
1144
|
+
- if `production` is True: `prod.<branch>`
|
1145
|
+
- if `production` is False: `test.<branch>`
|
1146
|
+
- if `branch` is not specified:
|
1147
|
+
- if `production` is True: `prod`
|
1148
|
+
- if `production` is False: `user.<username>`
|
1176
1149
|
"""
|
1177
1150
|
...
|
1178
1151
|
|
1179
1152
|
@typing.overload
|
1180
|
-
def
|
1153
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1181
1154
|
"""
|
1182
|
-
Specifies the
|
1183
|
-
|
1184
|
-
Use `@conda_base` to set common libraries required by all
|
1185
|
-
steps and use `@conda` to specify step-specific additions.
|
1155
|
+
Specifies the PyPI packages for all steps of the flow.
|
1186
1156
|
|
1157
|
+
Use `@pypi_base` to set common packages required by all
|
1158
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1187
1159
|
|
1188
1160
|
Parameters
|
1189
1161
|
----------
|
1190
|
-
packages : Dict[str, str], default {}
|
1162
|
+
packages : Dict[str, str], default: {}
|
1191
1163
|
Packages to use for this flow. The key is the name of the package
|
1192
1164
|
and the value is the version to use.
|
1193
|
-
|
1194
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1195
|
-
python : str, optional, default None
|
1165
|
+
python : str, optional, default: None
|
1196
1166
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1197
1167
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1198
|
-
disabled : bool, default False
|
1199
|
-
If set to True, disables Conda.
|
1200
1168
|
"""
|
1201
1169
|
...
|
1202
1170
|
|
1203
1171
|
@typing.overload
|
1204
|
-
def
|
1172
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1205
1173
|
...
|
1206
1174
|
|
1207
|
-
def
|
1175
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1208
1176
|
"""
|
1209
|
-
Specifies the
|
1210
|
-
|
1211
|
-
Use `@conda_base` to set common libraries required by all
|
1212
|
-
steps and use `@conda` to specify step-specific additions.
|
1177
|
+
Specifies the PyPI packages for all steps of the flow.
|
1213
1178
|
|
1179
|
+
Use `@pypi_base` to set common packages required by all
|
1180
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1214
1181
|
|
1215
1182
|
Parameters
|
1216
1183
|
----------
|
1217
|
-
packages : Dict[str, str], default {}
|
1184
|
+
packages : Dict[str, str], default: {}
|
1218
1185
|
Packages to use for this flow. The key is the name of the package
|
1219
1186
|
and the value is the version to use.
|
1220
|
-
|
1221
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1222
|
-
python : str, optional, default None
|
1187
|
+
python : str, optional, default: None
|
1223
1188
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1224
1189
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1225
|
-
|
1226
|
-
|
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)
|
1227
1233
|
"""
|
1228
1234
|
...
|
1229
1235
|
|
@@ -1328,87 +1334,96 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1328
1334
|
"""
|
1329
1335
|
...
|
1330
1336
|
|
1331
|
-
|
1337
|
+
@typing.overload
|
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]]:
|
1332
1339
|
"""
|
1333
|
-
|
1334
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1335
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1336
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1337
|
-
starts only after all sensors finish.
|
1340
|
+
Specifies the event(s) that this flow depends on.
|
1338
1341
|
|
1342
|
+
```
|
1343
|
+
@trigger(event='foo')
|
1344
|
+
```
|
1345
|
+
or
|
1346
|
+
```
|
1347
|
+
@trigger(events=['foo', 'bar'])
|
1348
|
+
```
|
1339
1349
|
|
1340
|
-
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1354
|
-
|
1355
|
-
|
1356
|
-
|
1357
|
-
|
1358
|
-
|
1359
|
-
bucket_key : Union[str, List[str]]
|
1360
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1361
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1362
|
-
bucket_name : str
|
1363
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1364
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1365
|
-
wildcard_match : bool
|
1366
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1367
|
-
aws_conn_id : str
|
1368
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1369
|
-
verify : bool
|
1370
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1371
|
-
"""
|
1372
|
-
...
|
1373
|
-
|
1374
|
-
@typing.overload
|
1375
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1376
|
-
"""
|
1377
|
-
Specifies the PyPI packages for all steps of the flow.
|
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
|
+
```
|
1378
1369
|
|
1379
|
-
Use `@pypi_base` to set common packages required by all
|
1380
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1381
1370
|
|
1382
1371
|
Parameters
|
1383
1372
|
----------
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
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.
|
1390
1379
|
"""
|
1391
1380
|
...
|
1392
1381
|
|
1393
1382
|
@typing.overload
|
1394
|
-
def
|
1383
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1395
1384
|
...
|
1396
1385
|
|
1397
|
-
def
|
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] = {}):
|
1398
1387
|
"""
|
1399
|
-
Specifies the
|
1388
|
+
Specifies the event(s) that this flow depends on.
|
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
|
+
```
|
1400
1417
|
|
1401
|
-
Use `@pypi_base` to set common packages required by all
|
1402
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1403
1418
|
|
1404
1419
|
Parameters
|
1405
1420
|
----------
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1421
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1422
|
+
Event dependency for this flow.
|
1423
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1424
|
+
Events dependency for this flow.
|
1425
|
+
options : Dict[str, Any], default {}
|
1426
|
+
Backend-specific configuration for tuning eventing behavior.
|
1412
1427
|
"""
|
1413
1428
|
...
|
1414
1429
|
|