ob-metaflow-stubs 6.0.3.152__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.
Potentially problematic release.
This version of ob-metaflow-stubs might be problematic. Click here for more details.
- metaflow-stubs/__init__.pyi +605 -605
- metaflow-stubs/cards.pyi +1 -1
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/cli_components/__init__.pyi +1 -1
- metaflow-stubs/cli_components/utils.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +1 -1
- metaflow-stubs/client/core.pyi +3 -3
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +1 -1
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +106 -106
- metaflow-stubs/mf_extensions/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +9 -9
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +1 -1
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +1 -1
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +5 -5
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +5 -5
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.3.152.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.152.dist-info/RECORD +0 -198
- {ob_metaflow_stubs-6.0.3.152.dist-info → ob_metaflow_stubs-6.0.3.153.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.152.dist-info → ob_metaflow_stubs-6.0.3.153.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
######################################################################################################
|
|
2
2
|
# Auto-generated Metaflow stub file #
|
|
3
3
|
# MF version: 2.15.7.1+obcheckpoint(0.1.9);ob(v1) #
|
|
4
|
-
# Generated on 2025-03-
|
|
4
|
+
# Generated on 2025-03-25T18:39:51.892760 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
@@ -43,9 +43,9 @@ from . import plugins as plugins
|
|
|
43
43
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
|
44
44
|
from . import includefile as includefile
|
|
45
45
|
from .includefile import IncludeFile as IncludeFile
|
|
46
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
47
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
48
46
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
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
|
|
@@ -150,19 +150,188 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
150
150
|
...
|
|
151
151
|
|
|
152
152
|
@typing.overload
|
|
153
|
-
def
|
|
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]]]:
|
|
154
154
|
"""
|
|
155
|
-
|
|
155
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
156
|
+
|
|
157
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
158
|
+
|
|
159
|
+
|
|
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.
|
|
156
170
|
"""
|
|
157
171
|
...
|
|
158
172
|
|
|
159
173
|
@typing.overload
|
|
160
|
-
def
|
|
174
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
161
175
|
...
|
|
162
176
|
|
|
163
|
-
|
|
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):
|
|
164
182
|
"""
|
|
165
|
-
|
|
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.
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
Parameters
|
|
189
|
+
----------
|
|
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.
|
|
198
|
+
"""
|
|
199
|
+
...
|
|
200
|
+
|
|
201
|
+
@typing.overload
|
|
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]]]:
|
|
203
|
+
"""
|
|
204
|
+
Enables checkpointing for a step.
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
Parameters
|
|
209
|
+
----------
|
|
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.
|
|
223
|
+
"""
|
|
224
|
+
...
|
|
225
|
+
|
|
226
|
+
@typing.overload
|
|
227
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
228
|
+
...
|
|
229
|
+
|
|
230
|
+
@typing.overload
|
|
231
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
232
|
+
...
|
|
233
|
+
|
|
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):
|
|
235
|
+
"""
|
|
236
|
+
Enables checkpointing for a step.
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
|
|
240
|
+
Parameters
|
|
241
|
+
----------
|
|
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)
|
|
280
|
+
"""
|
|
281
|
+
...
|
|
282
|
+
|
|
283
|
+
@typing.overload
|
|
284
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
285
|
+
"""
|
|
286
|
+
Specifies the number of times the task corresponding
|
|
287
|
+
to a step needs to be retried.
|
|
288
|
+
|
|
289
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
290
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
291
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
292
|
+
|
|
293
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
294
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
295
|
+
ensuring that the flow execution can continue.
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
Parameters
|
|
299
|
+
----------
|
|
300
|
+
times : int, default 3
|
|
301
|
+
Number of times to retry this task.
|
|
302
|
+
minutes_between_retries : int, default 2
|
|
303
|
+
Number of minutes between retries.
|
|
304
|
+
"""
|
|
305
|
+
...
|
|
306
|
+
|
|
307
|
+
@typing.overload
|
|
308
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
309
|
+
...
|
|
310
|
+
|
|
311
|
+
@typing.overload
|
|
312
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
313
|
+
...
|
|
314
|
+
|
|
315
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
|
316
|
+
"""
|
|
317
|
+
Specifies the number of times the task corresponding
|
|
318
|
+
to a step needs to be retried.
|
|
319
|
+
|
|
320
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
321
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
322
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
323
|
+
|
|
324
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
325
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
326
|
+
ensuring that the flow execution can continue.
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
Parameters
|
|
330
|
+
----------
|
|
331
|
+
times : int, default 3
|
|
332
|
+
Number of times to retry this task.
|
|
333
|
+
minutes_between_retries : int, default 2
|
|
334
|
+
Number of minutes between retries.
|
|
166
335
|
"""
|
|
167
336
|
...
|
|
168
337
|
|
|
@@ -223,62 +392,36 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
223
392
|
"""
|
|
224
393
|
...
|
|
225
394
|
|
|
226
|
-
|
|
227
|
-
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
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]]]:
|
|
228
396
|
"""
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
Information in this decorator will augment any
|
|
232
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
233
|
-
you can use `@conda_base` to set packages required by all
|
|
234
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
397
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
|
235
398
|
|
|
399
|
+
User code call
|
|
400
|
+
-----------
|
|
401
|
+
@nim(
|
|
402
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
|
403
|
+
backend='managed'
|
|
404
|
+
)
|
|
236
405
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
Packages to use for this step. The key is the name of the package
|
|
241
|
-
and the value is the version to use.
|
|
242
|
-
libraries : Dict[str, str], default {}
|
|
243
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
244
|
-
python : str, optional, default None
|
|
245
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
246
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
247
|
-
disabled : bool, default False
|
|
248
|
-
If set to True, disables @conda.
|
|
249
|
-
"""
|
|
250
|
-
...
|
|
251
|
-
|
|
252
|
-
@typing.overload
|
|
253
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
254
|
-
...
|
|
255
|
-
|
|
256
|
-
@typing.overload
|
|
257
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
258
|
-
...
|
|
259
|
-
|
|
260
|
-
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
261
|
-
"""
|
|
262
|
-
Specifies the Conda environment for the step.
|
|
406
|
+
Valid backend options
|
|
407
|
+
---------------------
|
|
408
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
|
263
409
|
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
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
|
|
268
415
|
|
|
269
416
|
|
|
270
417
|
Parameters
|
|
271
418
|
----------
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
279
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
280
|
-
disabled : bool, default False
|
|
281
|
-
If set to True, disables @conda.
|
|
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.
|
|
282
425
|
"""
|
|
283
426
|
...
|
|
284
427
|
|
|
@@ -333,183 +476,212 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
333
476
|
"""
|
|
334
477
|
...
|
|
335
478
|
|
|
336
|
-
def
|
|
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]]]:
|
|
337
480
|
"""
|
|
338
|
-
|
|
481
|
+
Specifies that this step should execute on DGX cloud.
|
|
339
482
|
|
|
340
483
|
|
|
341
484
|
Parameters
|
|
342
485
|
----------
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
|
350
|
-
|
|
351
|
-
- If repo (model/dataset) is not found in the datastore:
|
|
352
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
|
353
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
|
354
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
|
355
|
-
|
|
356
|
-
- If repo is found in the datastore:
|
|
357
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
|
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.
|
|
358
492
|
"""
|
|
359
493
|
...
|
|
360
494
|
|
|
361
495
|
@typing.overload
|
|
362
|
-
def
|
|
496
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
363
497
|
"""
|
|
364
|
-
Specifies the
|
|
498
|
+
Specifies the Conda environment for the step.
|
|
365
499
|
|
|
366
500
|
Information in this decorator will augment any
|
|
367
|
-
attributes set in the `@
|
|
368
|
-
you can use `@
|
|
369
|
-
steps and use `@
|
|
501
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
502
|
+
you can use `@conda_base` to set packages required by all
|
|
503
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
370
504
|
|
|
371
505
|
|
|
372
506
|
Parameters
|
|
373
507
|
----------
|
|
374
|
-
packages : Dict[str, str], default
|
|
508
|
+
packages : Dict[str, str], default {}
|
|
375
509
|
Packages to use for this step. The key is the name of the package
|
|
376
510
|
and the value is the version to use.
|
|
377
|
-
|
|
511
|
+
libraries : Dict[str, str], default {}
|
|
512
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
513
|
+
python : str, optional, default None
|
|
378
514
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
379
515
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
516
|
+
disabled : bool, default False
|
|
517
|
+
If set to True, disables @conda.
|
|
380
518
|
"""
|
|
381
519
|
...
|
|
382
520
|
|
|
383
521
|
@typing.overload
|
|
384
|
-
def
|
|
522
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
385
523
|
...
|
|
386
524
|
|
|
387
525
|
@typing.overload
|
|
388
|
-
def
|
|
526
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
389
527
|
...
|
|
390
528
|
|
|
391
|
-
def
|
|
529
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
392
530
|
"""
|
|
393
|
-
Specifies the
|
|
531
|
+
Specifies the Conda environment for the step.
|
|
394
532
|
|
|
395
533
|
Information in this decorator will augment any
|
|
396
|
-
attributes set in the `@
|
|
397
|
-
you can use `@
|
|
398
|
-
steps and use `@
|
|
534
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
535
|
+
you can use `@conda_base` to set packages required by all
|
|
536
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
399
537
|
|
|
400
538
|
|
|
401
539
|
Parameters
|
|
402
540
|
----------
|
|
403
|
-
packages : Dict[str, str], default
|
|
541
|
+
packages : Dict[str, str], default {}
|
|
404
542
|
Packages to use for this step. The key is the name of the package
|
|
405
543
|
and the value is the version to use.
|
|
406
|
-
|
|
544
|
+
libraries : Dict[str, str], default {}
|
|
545
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
546
|
+
python : str, optional, default None
|
|
407
547
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
408
548
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
549
|
+
disabled : bool, default False
|
|
550
|
+
If set to True, disables @conda.
|
|
409
551
|
"""
|
|
410
552
|
...
|
|
411
553
|
|
|
412
|
-
def
|
|
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]]]:
|
|
413
555
|
"""
|
|
414
|
-
Specifies that this step
|
|
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.
|
|
415
558
|
|
|
416
559
|
|
|
417
560
|
Parameters
|
|
418
561
|
----------
|
|
419
|
-
|
|
562
|
+
app_port : int
|
|
420
563
|
Number of GPUs to use.
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
queue_timeout : int
|
|
424
|
-
Time to keep the job in NVCF's queue.
|
|
564
|
+
app_name : str
|
|
565
|
+
Name of the app to deploy.
|
|
425
566
|
"""
|
|
426
567
|
...
|
|
427
568
|
|
|
428
|
-
|
|
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]]]:
|
|
429
571
|
"""
|
|
430
|
-
|
|
572
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
573
|
+
the execution of a step.
|
|
574
|
+
|
|
575
|
+
|
|
576
|
+
Parameters
|
|
577
|
+
----------
|
|
578
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
579
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
580
|
+
"""
|
|
581
|
+
...
|
|
582
|
+
|
|
583
|
+
@typing.overload
|
|
584
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
585
|
+
...
|
|
586
|
+
|
|
587
|
+
@typing.overload
|
|
588
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
589
|
+
...
|
|
590
|
+
|
|
591
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
|
592
|
+
"""
|
|
593
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
594
|
+
the execution of a step.
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
Parameters
|
|
598
|
+
----------
|
|
599
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
600
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
601
|
+
"""
|
|
602
|
+
...
|
|
603
|
+
|
|
604
|
+
def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
605
|
+
"""
|
|
606
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
|
431
607
|
|
|
432
608
|
User code call
|
|
433
609
|
-----------
|
|
434
|
-
@
|
|
610
|
+
@ollama(
|
|
435
611
|
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
|
436
|
-
backend='
|
|
612
|
+
backend='local'
|
|
437
613
|
)
|
|
438
614
|
|
|
439
615
|
Valid backend options
|
|
440
616
|
---------------------
|
|
441
|
-
- '
|
|
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.
|
|
442
620
|
|
|
443
621
|
Valid model options
|
|
444
622
|
----------------
|
|
445
|
-
- '
|
|
446
|
-
- '
|
|
447
|
-
- any model here
|
|
623
|
+
- 'llama3.2'
|
|
624
|
+
- 'llama3.3'
|
|
625
|
+
- any model here https://ollama.com/search
|
|
448
626
|
|
|
449
627
|
|
|
450
628
|
Parameters
|
|
451
629
|
----------
|
|
452
|
-
models: list[
|
|
453
|
-
List of
|
|
630
|
+
models: list[Ollama]
|
|
631
|
+
List of Ollama containers running models in sidecars.
|
|
454
632
|
backend: str
|
|
455
|
-
|
|
456
|
-
queue_timeout : int
|
|
457
|
-
Time to keep the job in NVCF's queue.
|
|
633
|
+
Determines where and how to run the Ollama process.
|
|
458
634
|
"""
|
|
459
635
|
...
|
|
460
636
|
|
|
461
637
|
@typing.overload
|
|
462
|
-
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]]]:
|
|
463
639
|
"""
|
|
464
|
-
Specifies the
|
|
465
|
-
to a step needs to be retried.
|
|
466
|
-
|
|
467
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
468
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
469
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
640
|
+
Specifies the PyPI packages for the step.
|
|
470
641
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
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.
|
|
474
646
|
|
|
475
647
|
|
|
476
648
|
Parameters
|
|
477
649
|
----------
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
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.
|
|
482
656
|
"""
|
|
483
657
|
...
|
|
484
658
|
|
|
485
659
|
@typing.overload
|
|
486
|
-
def
|
|
660
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
487
661
|
...
|
|
488
662
|
|
|
489
663
|
@typing.overload
|
|
490
|
-
def
|
|
664
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
491
665
|
...
|
|
492
666
|
|
|
493
|
-
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):
|
|
494
668
|
"""
|
|
495
|
-
Specifies the
|
|
496
|
-
to a step needs to be retried.
|
|
497
|
-
|
|
498
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
499
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
500
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
669
|
+
Specifies the PyPI packages for the step.
|
|
501
670
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
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.
|
|
505
675
|
|
|
506
676
|
|
|
507
677
|
Parameters
|
|
508
678
|
----------
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
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.
|
|
513
685
|
"""
|
|
514
686
|
...
|
|
515
687
|
|
|
@@ -592,96 +764,19 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
|
592
764
|
"""
|
|
593
765
|
...
|
|
594
766
|
|
|
595
|
-
|
|
767
|
+
@typing.overload
|
|
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]]]:
|
|
596
769
|
"""
|
|
597
|
-
Specifies
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
608
|
-
used.
|
|
609
|
-
disk : int, default 10240
|
|
610
|
-
Disk size (in MB) required for this step. If
|
|
611
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
612
|
-
used.
|
|
613
|
-
image : str, optional, default None
|
|
614
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
|
615
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
616
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
617
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
618
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
619
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
620
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
|
621
|
-
secrets : List[str], optional, default None
|
|
622
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
623
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
624
|
-
in Metaflow configuration.
|
|
625
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
|
626
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
|
627
|
-
Can be passed in as a comma separated string of values e.g.
|
|
628
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
629
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
630
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
631
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
632
|
-
gpu : int, optional, default None
|
|
633
|
-
Number of GPUs required for this step. A value of zero implies that
|
|
634
|
-
the scheduled node should not have GPUs.
|
|
635
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
636
|
-
The vendor of the GPUs to be used for this step.
|
|
637
|
-
tolerations : List[str], default []
|
|
638
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
639
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
640
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
641
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
|
642
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
643
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
644
|
-
use_tmpfs : bool, default False
|
|
645
|
-
This enables an explicit tmpfs mount for this step.
|
|
646
|
-
tmpfs_tempdir : bool, default True
|
|
647
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
648
|
-
tmpfs_size : int, optional, default: None
|
|
649
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
650
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
651
|
-
memory allocated for this step.
|
|
652
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
|
653
|
-
Path to tmpfs mount for this step.
|
|
654
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
|
655
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
656
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
657
|
-
shared_memory: int, optional
|
|
658
|
-
Shared memory size (in MiB) required for this step
|
|
659
|
-
port: int, optional
|
|
660
|
-
Port number to specify in the Kubernetes job object
|
|
661
|
-
compute_pool : str, optional, default None
|
|
662
|
-
Compute pool to be used for for this step.
|
|
663
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
|
664
|
-
hostname_resolution_timeout: int, default 10 * 60
|
|
665
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
666
|
-
Only applicable when @parallel is used.
|
|
667
|
-
qos: str, default: Burstable
|
|
668
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
669
|
-
"""
|
|
670
|
-
...
|
|
671
|
-
|
|
672
|
-
@typing.overload
|
|
673
|
-
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]]]:
|
|
674
|
-
"""
|
|
675
|
-
Specifies a timeout for your step.
|
|
676
|
-
|
|
677
|
-
This decorator is useful if this step may hang indefinitely.
|
|
678
|
-
|
|
679
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
680
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
681
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
682
|
-
|
|
683
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
684
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
770
|
+
Specifies a timeout for your step.
|
|
771
|
+
|
|
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.
|
|
685
780
|
|
|
686
781
|
|
|
687
782
|
Parameters
|
|
@@ -729,243 +824,293 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
|
729
824
|
...
|
|
730
825
|
|
|
731
826
|
@typing.overload
|
|
732
|
-
def
|
|
827
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
733
828
|
"""
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
Parameters
|
|
739
|
-
----------
|
|
740
|
-
load_policy : str, default: "fresh"
|
|
741
|
-
The policy for loading the checkpoint. The following policies are supported:
|
|
742
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
743
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
744
|
-
will be loaded at the start of the task.
|
|
745
|
-
- "none": Do not load any checkpoint
|
|
746
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
747
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
748
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
749
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
750
|
-
|
|
751
|
-
temp_dir_root : str, default: None
|
|
752
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
829
|
+
Internal decorator to support Fast bakery
|
|
753
830
|
"""
|
|
754
831
|
...
|
|
755
832
|
|
|
756
833
|
@typing.overload
|
|
757
|
-
def
|
|
758
|
-
...
|
|
759
|
-
|
|
760
|
-
@typing.overload
|
|
761
|
-
def checkpoint(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]:
|
|
762
835
|
...
|
|
763
836
|
|
|
764
|
-
def
|
|
837
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
765
838
|
"""
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
Parameters
|
|
771
|
-
----------
|
|
772
|
-
load_policy : str, default: "fresh"
|
|
773
|
-
The policy for loading the checkpoint. The following policies are supported:
|
|
774
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
775
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
776
|
-
will be loaded at the start of the task.
|
|
777
|
-
- "none": Do not load any checkpoint
|
|
778
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
779
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
780
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
781
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
782
|
-
|
|
783
|
-
temp_dir_root : str, default: None
|
|
784
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
839
|
+
Internal decorator to support Fast bakery
|
|
785
840
|
"""
|
|
786
841
|
...
|
|
787
842
|
|
|
788
|
-
|
|
789
|
-
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]]]:
|
|
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]]]:
|
|
790
844
|
"""
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
845
|
+
Specifies that this step should execute on Kubernetes.
|
|
794
846
|
|
|
795
847
|
|
|
796
848
|
Parameters
|
|
797
849
|
----------
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
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
|
|
806
917
|
"""
|
|
807
918
|
...
|
|
808
919
|
|
|
809
920
|
@typing.overload
|
|
810
|
-
def
|
|
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
|
+
"""
|
|
811
926
|
...
|
|
812
927
|
|
|
813
928
|
@typing.overload
|
|
814
|
-
def
|
|
929
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
815
930
|
...
|
|
816
931
|
|
|
817
|
-
def
|
|
932
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
818
933
|
"""
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
Parameters
|
|
825
|
-
----------
|
|
826
|
-
type : str, default 'default'
|
|
827
|
-
Card type.
|
|
828
|
-
id : str, optional, default None
|
|
829
|
-
If multiple cards are present, use this id to identify this card.
|
|
830
|
-
options : Dict[str, Any], default {}
|
|
831
|
-
Options passed to the card. The contents depend on the card type.
|
|
832
|
-
timeout : int, default 45
|
|
833
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
934
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
935
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
834
936
|
"""
|
|
835
937
|
...
|
|
836
938
|
|
|
837
|
-
|
|
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]]]:
|
|
838
941
|
"""
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
User code call
|
|
842
|
-
-----------
|
|
843
|
-
@ollama(
|
|
844
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
|
845
|
-
backend='local'
|
|
846
|
-
)
|
|
847
|
-
|
|
848
|
-
Valid backend options
|
|
849
|
-
---------------------
|
|
850
|
-
- 'local': Run as a separate process on the local task machine.
|
|
851
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
852
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
853
|
-
|
|
854
|
-
Valid model options
|
|
855
|
-
----------------
|
|
856
|
-
- 'llama3.2'
|
|
857
|
-
- 'llama3.3'
|
|
858
|
-
- any model here https://ollama.com/search
|
|
942
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
859
943
|
|
|
860
944
|
|
|
861
945
|
Parameters
|
|
862
946
|
----------
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
backend: str
|
|
866
|
-
Determines where and how to run the Ollama process.
|
|
947
|
+
vars : Dict[str, str], default {}
|
|
948
|
+
Dictionary of environment variables to set.
|
|
867
949
|
"""
|
|
868
950
|
...
|
|
869
951
|
|
|
870
952
|
@typing.overload
|
|
871
|
-
def
|
|
872
|
-
"""
|
|
873
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
874
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
875
|
-
"""
|
|
953
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
876
954
|
...
|
|
877
955
|
|
|
878
956
|
@typing.overload
|
|
879
|
-
def
|
|
957
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
880
958
|
...
|
|
881
959
|
|
|
882
|
-
def
|
|
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] = {}):
|
|
883
961
|
"""
|
|
884
|
-
|
|
885
|
-
|
|
962
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
963
|
+
|
|
964
|
+
|
|
965
|
+
Parameters
|
|
966
|
+
----------
|
|
967
|
+
vars : Dict[str, str], default {}
|
|
968
|
+
Dictionary of environment variables to set.
|
|
886
969
|
"""
|
|
887
970
|
...
|
|
888
971
|
|
|
889
972
|
@typing.overload
|
|
890
|
-
def
|
|
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]]:
|
|
891
974
|
"""
|
|
892
|
-
Specifies
|
|
893
|
-
|
|
975
|
+
Specifies the Conda environment for all steps of the flow.
|
|
976
|
+
|
|
977
|
+
Use `@conda_base` to set common libraries required by all
|
|
978
|
+
steps and use `@conda` to specify step-specific additions.
|
|
894
979
|
|
|
895
980
|
|
|
896
981
|
Parameters
|
|
897
982
|
----------
|
|
898
|
-
|
|
899
|
-
|
|
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.
|
|
900
993
|
"""
|
|
901
994
|
...
|
|
902
995
|
|
|
903
996
|
@typing.overload
|
|
904
|
-
def
|
|
905
|
-
...
|
|
906
|
-
|
|
907
|
-
@typing.overload
|
|
908
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
997
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
909
998
|
...
|
|
910
999
|
|
|
911
|
-
def
|
|
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):
|
|
912
1001
|
"""
|
|
913
|
-
Specifies
|
|
914
|
-
|
|
1002
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1003
|
+
|
|
1004
|
+
Use `@conda_base` to set common libraries required by all
|
|
1005
|
+
steps and use `@conda` to specify step-specific additions.
|
|
915
1006
|
|
|
916
1007
|
|
|
917
1008
|
Parameters
|
|
918
1009
|
----------
|
|
919
|
-
|
|
920
|
-
|
|
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.
|
|
921
1020
|
"""
|
|
922
1021
|
...
|
|
923
1022
|
|
|
924
|
-
|
|
925
|
-
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]]]:
|
|
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]]:
|
|
926
1024
|
"""
|
|
927
|
-
|
|
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.
|
|
928
1030
|
|
|
929
1031
|
|
|
930
1032
|
Parameters
|
|
931
1033
|
----------
|
|
932
|
-
|
|
933
|
-
|
|
1034
|
+
timeout : int
|
|
1035
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1036
|
+
poke_interval : int
|
|
1037
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1038
|
+
mode : str
|
|
1039
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1040
|
+
exponential_backoff : bool
|
|
1041
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1042
|
+
pool : str
|
|
1043
|
+
the slot pool this task should run in,
|
|
1044
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1045
|
+
soft_fail : bool
|
|
1046
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1047
|
+
name : str
|
|
1048
|
+
Name of the sensor on Airflow
|
|
1049
|
+
description : str
|
|
1050
|
+
Description of sensor in the Airflow UI
|
|
1051
|
+
bucket_key : Union[str, List[str]]
|
|
1052
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1053
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1054
|
+
bucket_name : str
|
|
1055
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1056
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1057
|
+
wildcard_match : bool
|
|
1058
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1059
|
+
aws_conn_id : str
|
|
1060
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1061
|
+
verify : bool
|
|
1062
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
934
1063
|
"""
|
|
935
1064
|
...
|
|
936
1065
|
|
|
937
1066
|
@typing.overload
|
|
938
|
-
def
|
|
939
|
-
...
|
|
940
|
-
|
|
941
|
-
@typing.overload
|
|
942
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
943
|
-
...
|
|
944
|
-
|
|
945
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
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]]:
|
|
946
1068
|
"""
|
|
947
|
-
Specifies
|
|
1069
|
+
Specifies the times when the flow should be run when running on a
|
|
1070
|
+
production scheduler.
|
|
948
1071
|
|
|
949
1072
|
|
|
950
1073
|
Parameters
|
|
951
1074
|
----------
|
|
952
|
-
|
|
953
|
-
|
|
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).
|
|
954
1087
|
"""
|
|
955
1088
|
...
|
|
956
1089
|
|
|
957
|
-
|
|
1090
|
+
@typing.overload
|
|
1091
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1092
|
+
...
|
|
1093
|
+
|
|
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):
|
|
958
1095
|
"""
|
|
959
|
-
Specifies
|
|
960
|
-
|
|
1096
|
+
Specifies the times when the flow should be run when running on a
|
|
1097
|
+
production scheduler.
|
|
961
1098
|
|
|
962
1099
|
|
|
963
1100
|
Parameters
|
|
964
1101
|
----------
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
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).
|
|
969
1114
|
"""
|
|
970
1115
|
...
|
|
971
1116
|
|
|
@@ -1004,6 +1149,90 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
|
|
|
1004
1149
|
"""
|
|
1005
1150
|
...
|
|
1006
1151
|
|
|
1152
|
+
@typing.overload
|
|
1153
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1154
|
+
"""
|
|
1155
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1156
|
+
|
|
1157
|
+
Use `@pypi_base` to set common packages required by all
|
|
1158
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1159
|
+
|
|
1160
|
+
Parameters
|
|
1161
|
+
----------
|
|
1162
|
+
packages : Dict[str, str], default: {}
|
|
1163
|
+
Packages to use for this flow. The key is the name of the package
|
|
1164
|
+
and the value is the version to use.
|
|
1165
|
+
python : str, optional, default: None
|
|
1166
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1167
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1168
|
+
"""
|
|
1169
|
+
...
|
|
1170
|
+
|
|
1171
|
+
@typing.overload
|
|
1172
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1173
|
+
...
|
|
1174
|
+
|
|
1175
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1176
|
+
"""
|
|
1177
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1178
|
+
|
|
1179
|
+
Use `@pypi_base` to set common packages required by all
|
|
1180
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1181
|
+
|
|
1182
|
+
Parameters
|
|
1183
|
+
----------
|
|
1184
|
+
packages : Dict[str, str], default: {}
|
|
1185
|
+
Packages to use for this flow. The key is the name of the package
|
|
1186
|
+
and the value is the version to use.
|
|
1187
|
+
python : str, optional, default: None
|
|
1188
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1189
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1190
|
+
"""
|
|
1191
|
+
...
|
|
1192
|
+
|
|
1193
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1194
|
+
"""
|
|
1195
|
+
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
|
1196
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
|
1197
|
+
|
|
1198
|
+
|
|
1199
|
+
Parameters
|
|
1200
|
+
----------
|
|
1201
|
+
timeout : int
|
|
1202
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1203
|
+
poke_interval : int
|
|
1204
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1205
|
+
mode : str
|
|
1206
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1207
|
+
exponential_backoff : bool
|
|
1208
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1209
|
+
pool : str
|
|
1210
|
+
the slot pool this task should run in,
|
|
1211
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1212
|
+
soft_fail : bool
|
|
1213
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1214
|
+
name : str
|
|
1215
|
+
Name of the sensor on Airflow
|
|
1216
|
+
description : str
|
|
1217
|
+
Description of sensor in the Airflow UI
|
|
1218
|
+
external_dag_id : str
|
|
1219
|
+
The dag_id that contains the task you want to wait for.
|
|
1220
|
+
external_task_ids : List[str]
|
|
1221
|
+
The list of task_ids that you want to wait for.
|
|
1222
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1223
|
+
allowed_states : List[str]
|
|
1224
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1225
|
+
failed_states : List[str]
|
|
1226
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1227
|
+
execution_delta : datetime.timedelta
|
|
1228
|
+
time difference with the previous execution to look at,
|
|
1229
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1230
|
+
check_existence: bool
|
|
1231
|
+
Set to True to check if the external task exists or check if
|
|
1232
|
+
the DAG to wait for exists. (Default: True)
|
|
1233
|
+
"""
|
|
1234
|
+
...
|
|
1235
|
+
|
|
1007
1236
|
@typing.overload
|
|
1008
1237
|
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1009
1238
|
"""
|
|
@@ -1105,184 +1334,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
|
1105
1334
|
"""
|
|
1106
1335
|
...
|
|
1107
1336
|
|
|
1108
|
-
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]]:
|
|
1109
|
-
"""
|
|
1110
|
-
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)
|
|
1111
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1112
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1113
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1114
|
-
starts only after all sensors finish.
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
Parameters
|
|
1118
|
-
----------
|
|
1119
|
-
timeout : int
|
|
1120
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1121
|
-
poke_interval : int
|
|
1122
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1123
|
-
mode : str
|
|
1124
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1125
|
-
exponential_backoff : bool
|
|
1126
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1127
|
-
pool : str
|
|
1128
|
-
the slot pool this task should run in,
|
|
1129
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1130
|
-
soft_fail : bool
|
|
1131
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1132
|
-
name : str
|
|
1133
|
-
Name of the sensor on Airflow
|
|
1134
|
-
description : str
|
|
1135
|
-
Description of sensor in the Airflow UI
|
|
1136
|
-
bucket_key : Union[str, List[str]]
|
|
1137
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1138
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1139
|
-
bucket_name : str
|
|
1140
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1141
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1142
|
-
wildcard_match : bool
|
|
1143
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1144
|
-
aws_conn_id : str
|
|
1145
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1146
|
-
verify : bool
|
|
1147
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1148
|
-
"""
|
|
1149
|
-
...
|
|
1150
|
-
|
|
1151
|
-
@typing.overload
|
|
1152
|
-
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]]:
|
|
1153
|
-
"""
|
|
1154
|
-
Specifies the Conda environment for all steps of the flow.
|
|
1155
|
-
|
|
1156
|
-
Use `@conda_base` to set common libraries required by all
|
|
1157
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
Parameters
|
|
1161
|
-
----------
|
|
1162
|
-
packages : Dict[str, str], default {}
|
|
1163
|
-
Packages to use for this flow. The key is the name of the package
|
|
1164
|
-
and the value is the version to use.
|
|
1165
|
-
libraries : Dict[str, str], default {}
|
|
1166
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1167
|
-
python : str, optional, default None
|
|
1168
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1169
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1170
|
-
disabled : bool, default False
|
|
1171
|
-
If set to True, disables Conda.
|
|
1172
|
-
"""
|
|
1173
|
-
...
|
|
1174
|
-
|
|
1175
|
-
@typing.overload
|
|
1176
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1177
|
-
...
|
|
1178
|
-
|
|
1179
|
-
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):
|
|
1180
|
-
"""
|
|
1181
|
-
Specifies the Conda environment for all steps of the flow.
|
|
1182
|
-
|
|
1183
|
-
Use `@conda_base` to set common libraries required by all
|
|
1184
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
Parameters
|
|
1188
|
-
----------
|
|
1189
|
-
packages : Dict[str, str], default {}
|
|
1190
|
-
Packages to use for this flow. The key is the name of the package
|
|
1191
|
-
and the value is the version to use.
|
|
1192
|
-
libraries : Dict[str, str], default {}
|
|
1193
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1194
|
-
python : str, optional, default None
|
|
1195
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1196
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1197
|
-
disabled : bool, default False
|
|
1198
|
-
If set to True, disables Conda.
|
|
1199
|
-
"""
|
|
1200
|
-
...
|
|
1201
|
-
|
|
1202
|
-
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]]:
|
|
1203
|
-
"""
|
|
1204
|
-
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.
|
|
1205
|
-
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.
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
Parameters
|
|
1209
|
-
----------
|
|
1210
|
-
timeout : int
|
|
1211
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1212
|
-
poke_interval : int
|
|
1213
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1214
|
-
mode : str
|
|
1215
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1216
|
-
exponential_backoff : bool
|
|
1217
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1218
|
-
pool : str
|
|
1219
|
-
the slot pool this task should run in,
|
|
1220
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1221
|
-
soft_fail : bool
|
|
1222
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1223
|
-
name : str
|
|
1224
|
-
Name of the sensor on Airflow
|
|
1225
|
-
description : str
|
|
1226
|
-
Description of sensor in the Airflow UI
|
|
1227
|
-
external_dag_id : str
|
|
1228
|
-
The dag_id that contains the task you want to wait for.
|
|
1229
|
-
external_task_ids : List[str]
|
|
1230
|
-
The list of task_ids that you want to wait for.
|
|
1231
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1232
|
-
allowed_states : List[str]
|
|
1233
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1234
|
-
failed_states : List[str]
|
|
1235
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1236
|
-
execution_delta : datetime.timedelta
|
|
1237
|
-
time difference with the previous execution to look at,
|
|
1238
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1239
|
-
check_existence: bool
|
|
1240
|
-
Set to True to check if the external task exists or check if
|
|
1241
|
-
the DAG to wait for exists. (Default: True)
|
|
1242
|
-
"""
|
|
1243
|
-
...
|
|
1244
|
-
|
|
1245
|
-
@typing.overload
|
|
1246
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1247
|
-
"""
|
|
1248
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
1249
|
-
|
|
1250
|
-
Use `@pypi_base` to set common packages required by all
|
|
1251
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1252
|
-
|
|
1253
|
-
Parameters
|
|
1254
|
-
----------
|
|
1255
|
-
packages : Dict[str, str], default: {}
|
|
1256
|
-
Packages to use for this flow. The key is the name of the package
|
|
1257
|
-
and the value is the version to use.
|
|
1258
|
-
python : str, optional, default: None
|
|
1259
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1260
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1261
|
-
"""
|
|
1262
|
-
...
|
|
1263
|
-
|
|
1264
|
-
@typing.overload
|
|
1265
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1266
|
-
...
|
|
1267
|
-
|
|
1268
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1269
|
-
"""
|
|
1270
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
1271
|
-
|
|
1272
|
-
Use `@pypi_base` to set common packages required by all
|
|
1273
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1274
|
-
|
|
1275
|
-
Parameters
|
|
1276
|
-
----------
|
|
1277
|
-
packages : Dict[str, str], default: {}
|
|
1278
|
-
Packages to use for this flow. The key is the name of the package
|
|
1279
|
-
and the value is the version to use.
|
|
1280
|
-
python : str, optional, default: None
|
|
1281
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1282
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1283
|
-
"""
|
|
1284
|
-
...
|
|
1285
|
-
|
|
1286
1337
|
@typing.overload
|
|
1287
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]]:
|
|
1288
1339
|
"""
|
|
@@ -1376,56 +1427,5 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
|
1376
1427
|
"""
|
|
1377
1428
|
...
|
|
1378
1429
|
|
|
1379
|
-
@typing.overload
|
|
1380
|
-
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]]:
|
|
1381
|
-
"""
|
|
1382
|
-
Specifies the times when the flow should be run when running on a
|
|
1383
|
-
production scheduler.
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
Parameters
|
|
1387
|
-
----------
|
|
1388
|
-
hourly : bool, default False
|
|
1389
|
-
Run the workflow hourly.
|
|
1390
|
-
daily : bool, default True
|
|
1391
|
-
Run the workflow daily.
|
|
1392
|
-
weekly : bool, default False
|
|
1393
|
-
Run the workflow weekly.
|
|
1394
|
-
cron : str, optional, default None
|
|
1395
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1396
|
-
specified by this expression.
|
|
1397
|
-
timezone : str, optional, default None
|
|
1398
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1399
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1400
|
-
"""
|
|
1401
|
-
...
|
|
1402
|
-
|
|
1403
|
-
@typing.overload
|
|
1404
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1405
|
-
...
|
|
1406
|
-
|
|
1407
|
-
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):
|
|
1408
|
-
"""
|
|
1409
|
-
Specifies the times when the flow should be run when running on a
|
|
1410
|
-
production scheduler.
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
Parameters
|
|
1414
|
-
----------
|
|
1415
|
-
hourly : bool, default False
|
|
1416
|
-
Run the workflow hourly.
|
|
1417
|
-
daily : bool, default True
|
|
1418
|
-
Run the workflow daily.
|
|
1419
|
-
weekly : bool, default False
|
|
1420
|
-
Run the workflow weekly.
|
|
1421
|
-
cron : str, optional, default None
|
|
1422
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1423
|
-
specified by this expression.
|
|
1424
|
-
timezone : str, optional, default None
|
|
1425
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1426
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1427
|
-
"""
|
|
1428
|
-
...
|
|
1429
|
-
|
|
1430
1430
|
pkg_name: str
|
|
1431
1431
|
|