ob-metaflow-stubs 6.0.3.144__py2.py3-none-any.whl → 6.0.3.145__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +662 -662
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +6 -6
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +4 -2
- metaflow-stubs/metaflow_current.pyi +135 -135
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +6 -6
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +12 -12
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +4 -4
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +4 -4
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +6 -6
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +5 -5
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +3 -3
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +7 -7
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +7 -7
- metaflow-stubs/user_configs/config_options.pyi +4 -4
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.3.144.dist-info → ob_metaflow_stubs-6.0.3.145.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.145.dist-info/RECORD +197 -0
- ob_metaflow_stubs-6.0.3.144.dist-info/RECORD +0 -197
- {ob_metaflow_stubs-6.0.3.144.dist-info → ob_metaflow_stubs-6.0.3.145.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.144.dist-info → ob_metaflow_stubs-6.0.3.145.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.14.
|
4
|
-
# Generated on 2025-02-
|
3
|
+
# MF version: 2.14.3.1+obcheckpoint(0.1.8);ob(v1) #
|
4
|
+
# Generated on 2025-02-24T18:52:39.248529 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import datetime
|
12
11
|
import typing
|
12
|
+
import datetime
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -35,9 +35,9 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import tuple_util as tuple_util
|
39
38
|
from . import cards as cards
|
40
39
|
from . import events as events
|
40
|
+
from . import tuple_util as tuple_util
|
41
41
|
from . import runner as runner
|
42
42
|
from . import plugins as plugins
|
43
43
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
@@ -147,204 +147,23 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
147
147
|
...
|
148
148
|
|
149
149
|
@typing.overload
|
150
|
-
def
|
151
|
-
"""
|
152
|
-
Enables loading / saving of models within a step.
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
Parameters
|
157
|
-
----------
|
158
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
159
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
160
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
161
|
-
- `current.checkpoint`
|
162
|
-
- `current.model`
|
163
|
-
- `current.huggingface_hub`
|
164
|
-
|
165
|
-
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
166
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
167
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
168
|
-
|
169
|
-
temp_dir_root : str, default: None
|
170
|
-
The root directory under which `current.model.loaded` will store loaded models
|
171
|
-
"""
|
172
|
-
...
|
173
|
-
|
174
|
-
@typing.overload
|
175
|
-
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
176
|
-
...
|
177
|
-
|
178
|
-
@typing.overload
|
179
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
180
|
-
...
|
181
|
-
|
182
|
-
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
183
|
-
"""
|
184
|
-
Enables loading / saving of models within a step.
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
Parameters
|
189
|
-
----------
|
190
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
191
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
192
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
193
|
-
- `current.checkpoint`
|
194
|
-
- `current.model`
|
195
|
-
- `current.huggingface_hub`
|
196
|
-
|
197
|
-
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
198
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
199
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
200
|
-
|
201
|
-
temp_dir_root : str, default: None
|
202
|
-
The root directory under which `current.model.loaded` will store loaded models
|
203
|
-
"""
|
204
|
-
...
|
205
|
-
|
206
|
-
@typing.overload
|
207
|
-
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]]]:
|
208
|
-
"""
|
209
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
210
|
-
the execution of a step.
|
211
|
-
|
212
|
-
|
213
|
-
Parameters
|
214
|
-
----------
|
215
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
216
|
-
List of secret specs, defining how the secrets are to be retrieved
|
217
|
-
"""
|
218
|
-
...
|
219
|
-
|
220
|
-
@typing.overload
|
221
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
222
|
-
...
|
223
|
-
|
224
|
-
@typing.overload
|
225
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
226
|
-
...
|
227
|
-
|
228
|
-
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]]] = []):
|
229
|
-
"""
|
230
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
231
|
-
the execution of a step.
|
232
|
-
|
233
|
-
|
234
|
-
Parameters
|
235
|
-
----------
|
236
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
237
|
-
List of secret specs, defining how the secrets are to be retrieved
|
238
|
-
"""
|
239
|
-
...
|
240
|
-
|
241
|
-
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]]]:
|
242
|
-
"""
|
243
|
-
Specifies that this step should execute on Kubernetes.
|
244
|
-
|
245
|
-
|
246
|
-
Parameters
|
247
|
-
----------
|
248
|
-
cpu : int, default 1
|
249
|
-
Number of CPUs required for this step. If `@resources` is
|
250
|
-
also present, the maximum value from all decorators is used.
|
251
|
-
memory : int, default 4096
|
252
|
-
Memory size (in MB) required for this step. If
|
253
|
-
`@resources` is also present, the maximum value from all decorators is
|
254
|
-
used.
|
255
|
-
disk : int, default 10240
|
256
|
-
Disk size (in MB) required for this step. If
|
257
|
-
`@resources` is also present, the maximum value from all decorators is
|
258
|
-
used.
|
259
|
-
image : str, optional, default None
|
260
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
261
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
262
|
-
not, a default Docker image mapping to the current version of Python is used.
|
263
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
264
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
265
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
266
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
267
|
-
secrets : List[str], optional, default None
|
268
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
269
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
270
|
-
in Metaflow configuration.
|
271
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
272
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
273
|
-
Can be passed in as a comma separated string of values e.g.
|
274
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
275
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
276
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
277
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
278
|
-
gpu : int, optional, default None
|
279
|
-
Number of GPUs required for this step. A value of zero implies that
|
280
|
-
the scheduled node should not have GPUs.
|
281
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
282
|
-
The vendor of the GPUs to be used for this step.
|
283
|
-
tolerations : List[str], default []
|
284
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
285
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
286
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
287
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
288
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
289
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
290
|
-
use_tmpfs : bool, default False
|
291
|
-
This enables an explicit tmpfs mount for this step.
|
292
|
-
tmpfs_tempdir : bool, default True
|
293
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
294
|
-
tmpfs_size : int, optional, default: None
|
295
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
296
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
297
|
-
memory allocated for this step.
|
298
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
299
|
-
Path to tmpfs mount for this step.
|
300
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
301
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
302
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
303
|
-
shared_memory: int, optional
|
304
|
-
Shared memory size (in MiB) required for this step
|
305
|
-
port: int, optional
|
306
|
-
Port number to specify in the Kubernetes job object
|
307
|
-
compute_pool : str, optional, default None
|
308
|
-
Compute pool to be used for for this step.
|
309
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
310
|
-
hostname_resolution_timeout: int, default 10 * 60
|
311
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
312
|
-
Only applicable when @parallel is used.
|
313
|
-
qos: str, default: Burstable
|
314
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
315
|
-
"""
|
316
|
-
...
|
317
|
-
|
318
|
-
@typing.overload
|
319
|
-
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]]]:
|
150
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
320
151
|
"""
|
321
|
-
|
322
|
-
|
323
|
-
|
152
|
+
Internal decorator to support Fast bakery
|
324
153
|
Parameters
|
325
154
|
----------
|
326
|
-
vars : Dict[str, str], default {}
|
327
|
-
Dictionary of environment variables to set.
|
328
155
|
"""
|
329
156
|
...
|
330
157
|
|
331
158
|
@typing.overload
|
332
|
-
def
|
333
|
-
...
|
334
|
-
|
335
|
-
@typing.overload
|
336
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
159
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
337
160
|
...
|
338
161
|
|
339
|
-
def
|
162
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
340
163
|
"""
|
341
|
-
|
342
|
-
|
343
|
-
|
164
|
+
Internal decorator to support Fast bakery
|
344
165
|
Parameters
|
345
166
|
----------
|
346
|
-
vars : Dict[str, str], default {}
|
347
|
-
Dictionary of environment variables to set.
|
348
167
|
"""
|
349
168
|
...
|
350
169
|
|
@@ -408,183 +227,84 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
408
227
|
...
|
409
228
|
|
410
229
|
@typing.overload
|
411
|
-
def
|
230
|
+
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]]]:
|
412
231
|
"""
|
413
|
-
|
414
|
-
to a step needs to be retried.
|
415
|
-
|
416
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
417
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
418
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
232
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
419
233
|
|
420
|
-
|
421
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
422
|
-
ensuring that the flow execution can continue.
|
234
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
423
235
|
|
424
236
|
|
425
237
|
Parameters
|
426
238
|
----------
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
239
|
+
type : str, default 'default'
|
240
|
+
Card type.
|
241
|
+
id : str, optional, default None
|
242
|
+
If multiple cards are present, use this id to identify this card.
|
243
|
+
options : Dict[str, Any], default {}
|
244
|
+
Options passed to the card. The contents depend on the card type.
|
245
|
+
timeout : int, default 45
|
246
|
+
Interrupt reporting if it takes more than this many seconds.
|
431
247
|
"""
|
432
248
|
...
|
433
249
|
|
434
250
|
@typing.overload
|
435
|
-
def
|
251
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
436
252
|
...
|
437
253
|
|
438
254
|
@typing.overload
|
439
|
-
def
|
255
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
440
256
|
...
|
441
257
|
|
442
|
-
def
|
258
|
+
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):
|
443
259
|
"""
|
444
|
-
|
445
|
-
to a step needs to be retried.
|
446
|
-
|
447
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
448
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
449
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
260
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
450
261
|
|
451
|
-
|
452
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
453
|
-
ensuring that the flow execution can continue.
|
262
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
454
263
|
|
455
264
|
|
456
265
|
Parameters
|
457
266
|
----------
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
267
|
+
type : str, default 'default'
|
268
|
+
Card type.
|
269
|
+
id : str, optional, default None
|
270
|
+
If multiple cards are present, use this id to identify this card.
|
271
|
+
options : Dict[str, Any], default {}
|
272
|
+
Options passed to the card. The contents depend on the card type.
|
273
|
+
timeout : int, default 45
|
274
|
+
Interrupt reporting if it takes more than this many seconds.
|
462
275
|
"""
|
463
276
|
...
|
464
277
|
|
465
|
-
|
278
|
+
@typing.overload
|
279
|
+
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]]]:
|
466
280
|
"""
|
467
|
-
|
281
|
+
Specifies environment variables to be set prior to the execution of a step.
|
468
282
|
|
469
283
|
|
470
284
|
Parameters
|
471
285
|
----------
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
476
|
-
The list of repos (models/datasets) to load.
|
477
|
-
|
478
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
479
|
-
|
480
|
-
- If repo (model/dataset) is not found in the datastore:
|
481
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
482
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
483
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
484
|
-
|
485
|
-
- If repo is found in the datastore:
|
486
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
487
|
-
"""
|
488
|
-
...
|
489
|
-
|
490
|
-
@typing.overload
|
491
|
-
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]]]:
|
492
|
-
"""
|
493
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
494
|
-
|
495
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
496
|
-
|
497
|
-
|
498
|
-
Parameters
|
499
|
-
----------
|
500
|
-
type : str, default 'default'
|
501
|
-
Card type.
|
502
|
-
id : str, optional, default None
|
503
|
-
If multiple cards are present, use this id to identify this card.
|
504
|
-
options : Dict[str, Any], default {}
|
505
|
-
Options passed to the card. The contents depend on the card type.
|
506
|
-
timeout : int, default 45
|
507
|
-
Interrupt reporting if it takes more than this many seconds.
|
286
|
+
vars : Dict[str, str], default {}
|
287
|
+
Dictionary of environment variables to set.
|
508
288
|
"""
|
509
289
|
...
|
510
290
|
|
511
291
|
@typing.overload
|
512
|
-
def
|
292
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
513
293
|
...
|
514
294
|
|
515
295
|
@typing.overload
|
516
|
-
def
|
517
|
-
...
|
518
|
-
|
519
|
-
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):
|
520
|
-
"""
|
521
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
522
|
-
|
523
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
524
|
-
|
525
|
-
|
526
|
-
Parameters
|
527
|
-
----------
|
528
|
-
type : str, default 'default'
|
529
|
-
Card type.
|
530
|
-
id : str, optional, default None
|
531
|
-
If multiple cards are present, use this id to identify this card.
|
532
|
-
options : Dict[str, Any], default {}
|
533
|
-
Options passed to the card. The contents depend on the card type.
|
534
|
-
timeout : int, default 45
|
535
|
-
Interrupt reporting if it takes more than this many seconds.
|
536
|
-
"""
|
296
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
537
297
|
...
|
538
298
|
|
539
|
-
def
|
299
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
540
300
|
"""
|
541
|
-
|
542
|
-
|
543
|
-
User code call
|
544
|
-
-----------
|
545
|
-
@ollama(
|
546
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
547
|
-
backend='local'
|
548
|
-
)
|
549
|
-
|
550
|
-
Valid backend options
|
551
|
-
---------------------
|
552
|
-
- 'local': Run as a separate process on the local task machine.
|
553
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
554
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
555
|
-
|
556
|
-
Valid model options
|
557
|
-
----------------
|
558
|
-
- 'llama3.2'
|
559
|
-
- 'llama3.3'
|
560
|
-
- any model here https://ollama.com/search
|
301
|
+
Specifies environment variables to be set prior to the execution of a step.
|
561
302
|
|
562
303
|
|
563
304
|
Parameters
|
564
305
|
----------
|
565
|
-
|
566
|
-
|
567
|
-
backend: str
|
568
|
-
Determines where and how to run the Ollama process.
|
569
|
-
"""
|
570
|
-
...
|
571
|
-
|
572
|
-
@typing.overload
|
573
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
574
|
-
"""
|
575
|
-
Parameters
|
576
|
-
----------
|
577
|
-
"""
|
578
|
-
...
|
579
|
-
|
580
|
-
@typing.overload
|
581
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
582
|
-
...
|
583
|
-
|
584
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
585
|
-
"""
|
586
|
-
Parameters
|
587
|
-
----------
|
306
|
+
vars : Dict[str, str], default {}
|
307
|
+
Dictionary of environment variables to set.
|
588
308
|
"""
|
589
309
|
...
|
590
310
|
|
@@ -668,174 +388,244 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
668
388
|
...
|
669
389
|
|
670
390
|
@typing.overload
|
671
|
-
def
|
391
|
+
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]]]:
|
672
392
|
"""
|
673
|
-
|
393
|
+
Enables checkpointing for a step.
|
674
394
|
|
675
|
-
The decorator will create an optional artifact, specified by `var`, which
|
676
|
-
contains the exception raised. You can use it to detect the presence
|
677
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
678
|
-
are missing.
|
679
395
|
|
680
396
|
|
681
397
|
Parameters
|
682
398
|
----------
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
399
|
+
load_policy : str, default: "fresh"
|
400
|
+
The policy for loading the checkpoint. The following policies are supported:
|
401
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
402
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
403
|
+
will be loaded at the start of the task.
|
404
|
+
- "none": Do not load any checkpoint
|
405
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
406
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
407
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
408
|
+
created within the task will be loaded when the task is retries execution on failure.
|
409
|
+
|
410
|
+
temp_dir_root : str, default: None
|
411
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
689
412
|
"""
|
690
413
|
...
|
691
414
|
|
692
415
|
@typing.overload
|
693
|
-
def
|
416
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
694
417
|
...
|
695
418
|
|
696
419
|
@typing.overload
|
697
|
-
def
|
420
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
698
421
|
...
|
699
422
|
|
700
|
-
def
|
423
|
+
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):
|
701
424
|
"""
|
702
|
-
|
425
|
+
Enables checkpointing for a step.
|
703
426
|
|
704
|
-
The decorator will create an optional artifact, specified by `var`, which
|
705
|
-
contains the exception raised. You can use it to detect the presence
|
706
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
707
|
-
are missing.
|
708
427
|
|
709
428
|
|
710
429
|
Parameters
|
711
430
|
----------
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
431
|
+
load_policy : str, default: "fresh"
|
432
|
+
The policy for loading the checkpoint. The following policies are supported:
|
433
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
434
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
435
|
+
will be loaded at the start of the task.
|
436
|
+
- "none": Do not load any checkpoint
|
437
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
438
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
439
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
440
|
+
created within the task will be loaded when the task is retries execution on failure.
|
441
|
+
|
442
|
+
temp_dir_root : str, default: None
|
443
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
718
444
|
"""
|
719
445
|
...
|
720
446
|
|
721
|
-
|
447
|
+
@typing.overload
|
448
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
722
449
|
"""
|
723
|
-
|
450
|
+
Parameters
|
451
|
+
----------
|
452
|
+
"""
|
453
|
+
...
|
454
|
+
|
455
|
+
@typing.overload
|
456
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
457
|
+
...
|
458
|
+
|
459
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
460
|
+
"""
|
461
|
+
Parameters
|
462
|
+
----------
|
463
|
+
"""
|
464
|
+
...
|
465
|
+
|
466
|
+
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]]]:
|
467
|
+
"""
|
468
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
724
469
|
|
725
|
-
User code call
|
726
|
-
-----------
|
727
|
-
@nim(
|
728
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
729
|
-
backend='managed'
|
730
|
-
)
|
731
470
|
|
732
|
-
|
733
|
-
|
734
|
-
|
471
|
+
Parameters
|
472
|
+
----------
|
473
|
+
temp_dir_root : str, optional
|
474
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
735
475
|
|
736
|
-
|
737
|
-
|
738
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
739
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
740
|
-
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
476
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
477
|
+
The list of repos (models/datasets) to load.
|
741
478
|
|
479
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
742
480
|
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
Time to keep the job in NVCF's queue.
|
481
|
+
- If repo (model/dataset) is not found in the datastore:
|
482
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
483
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
484
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
485
|
+
|
486
|
+
- If repo is found in the datastore:
|
487
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
751
488
|
"""
|
752
489
|
...
|
753
490
|
|
754
491
|
@typing.overload
|
755
|
-
def
|
492
|
+
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
756
493
|
"""
|
757
|
-
|
494
|
+
Enables loading / saving of models within a step.
|
758
495
|
|
759
|
-
Information in this decorator will augment any
|
760
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
761
|
-
you can use `@pypi_base` to set packages required by all
|
762
|
-
steps and use `@pypi` to specify step-specific overrides.
|
763
496
|
|
764
497
|
|
765
498
|
Parameters
|
766
499
|
----------
|
767
|
-
|
768
|
-
|
769
|
-
|
770
|
-
|
771
|
-
|
772
|
-
|
500
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
501
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
502
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
503
|
+
- `current.checkpoint`
|
504
|
+
- `current.model`
|
505
|
+
- `current.huggingface_hub`
|
506
|
+
|
507
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
508
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
509
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
510
|
+
|
511
|
+
temp_dir_root : str, default: None
|
512
|
+
The root directory under which `current.model.loaded` will store loaded models
|
773
513
|
"""
|
774
514
|
...
|
775
515
|
|
776
516
|
@typing.overload
|
777
|
-
def
|
517
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
778
518
|
...
|
779
519
|
|
780
520
|
@typing.overload
|
781
|
-
def
|
521
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
782
522
|
...
|
783
523
|
|
784
|
-
def
|
524
|
+
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
785
525
|
"""
|
786
|
-
|
526
|
+
Enables loading / saving of models within a step.
|
787
527
|
|
788
|
-
Information in this decorator will augment any
|
789
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
790
|
-
you can use `@pypi_base` to set packages required by all
|
791
|
-
steps and use `@pypi` to specify step-specific overrides.
|
792
528
|
|
793
529
|
|
794
530
|
Parameters
|
795
531
|
----------
|
796
|
-
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
532
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
533
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
534
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
535
|
+
- `current.checkpoint`
|
536
|
+
- `current.model`
|
537
|
+
- `current.huggingface_hub`
|
538
|
+
|
539
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
540
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
541
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
542
|
+
|
543
|
+
temp_dir_root : str, default: None
|
544
|
+
The root directory under which `current.model.loaded` will store loaded models
|
802
545
|
"""
|
803
546
|
...
|
804
547
|
|
805
|
-
|
806
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
548
|
+
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]]]:
|
807
549
|
"""
|
808
|
-
|
550
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
551
|
+
|
552
|
+
User code call
|
553
|
+
-----------
|
554
|
+
@nim(
|
555
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
556
|
+
backend='managed'
|
557
|
+
)
|
558
|
+
|
559
|
+
Valid backend options
|
560
|
+
---------------------
|
561
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
562
|
+
|
563
|
+
Valid model options
|
564
|
+
----------------
|
565
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
566
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
567
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
568
|
+
|
569
|
+
|
809
570
|
Parameters
|
810
571
|
----------
|
572
|
+
models: list[NIM]
|
573
|
+
List of NIM containers running models in sidecars.
|
574
|
+
backend: str
|
575
|
+
Compute provider to run the NIM container.
|
576
|
+
queue_timeout : int
|
577
|
+
Time to keep the job in NVCF's queue.
|
811
578
|
"""
|
812
579
|
...
|
813
580
|
|
814
581
|
@typing.overload
|
815
|
-
def
|
816
|
-
...
|
817
|
-
|
818
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
582
|
+
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
819
583
|
"""
|
820
|
-
|
584
|
+
Specifies that the step will success under all circumstances.
|
585
|
+
|
586
|
+
The decorator will create an optional artifact, specified by `var`, which
|
587
|
+
contains the exception raised. You can use it to detect the presence
|
588
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
589
|
+
are missing.
|
590
|
+
|
591
|
+
|
821
592
|
Parameters
|
822
593
|
----------
|
594
|
+
var : str, optional, default None
|
595
|
+
Name of the artifact in which to store the caught exception.
|
596
|
+
If not specified, the exception is not stored.
|
597
|
+
print_exception : bool, default True
|
598
|
+
Determines whether or not the exception is printed to
|
599
|
+
stdout when caught.
|
823
600
|
"""
|
824
601
|
...
|
825
602
|
|
826
|
-
|
603
|
+
@typing.overload
|
604
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
605
|
+
...
|
606
|
+
|
607
|
+
@typing.overload
|
608
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
609
|
+
...
|
610
|
+
|
611
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
827
612
|
"""
|
828
|
-
Specifies that
|
613
|
+
Specifies that the step will success under all circumstances.
|
614
|
+
|
615
|
+
The decorator will create an optional artifact, specified by `var`, which
|
616
|
+
contains the exception raised. You can use it to detect the presence
|
617
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
618
|
+
are missing.
|
829
619
|
|
830
620
|
|
831
621
|
Parameters
|
832
622
|
----------
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
838
|
-
|
623
|
+
var : str, optional, default None
|
624
|
+
Name of the artifact in which to store the caught exception.
|
625
|
+
If not specified, the exception is not stored.
|
626
|
+
print_exception : bool, default True
|
627
|
+
Determines whether or not the exception is printed to
|
628
|
+
stdout when caught.
|
839
629
|
"""
|
840
630
|
...
|
841
631
|
|
@@ -898,263 +688,405 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
898
688
|
"""
|
899
689
|
...
|
900
690
|
|
901
|
-
|
902
|
-
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]]]:
|
691
|
+
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]]]:
|
903
692
|
"""
|
904
|
-
|
905
|
-
|
693
|
+
Specifies that this step should execute on Kubernetes.
|
906
694
|
|
907
695
|
|
908
696
|
Parameters
|
909
697
|
----------
|
910
|
-
|
911
|
-
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
920
|
-
|
921
|
-
|
922
|
-
|
698
|
+
cpu : int, default 1
|
699
|
+
Number of CPUs required for this step. If `@resources` is
|
700
|
+
also present, the maximum value from all decorators is used.
|
701
|
+
memory : int, default 4096
|
702
|
+
Memory size (in MB) required for this step. If
|
703
|
+
`@resources` is also present, the maximum value from all decorators is
|
704
|
+
used.
|
705
|
+
disk : int, default 10240
|
706
|
+
Disk size (in MB) required for this step. If
|
707
|
+
`@resources` is also present, the maximum value from all decorators is
|
708
|
+
used.
|
709
|
+
image : str, optional, default None
|
710
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
711
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
712
|
+
not, a default Docker image mapping to the current version of Python is used.
|
713
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
714
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
715
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
716
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
717
|
+
secrets : List[str], optional, default None
|
718
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
719
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
720
|
+
in Metaflow configuration.
|
721
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
722
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
723
|
+
Can be passed in as a comma separated string of values e.g.
|
724
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
725
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
726
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
727
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
728
|
+
gpu : int, optional, default None
|
729
|
+
Number of GPUs required for this step. A value of zero implies that
|
730
|
+
the scheduled node should not have GPUs.
|
731
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
732
|
+
The vendor of the GPUs to be used for this step.
|
733
|
+
tolerations : List[str], default []
|
734
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
735
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
736
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
737
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
738
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
739
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
740
|
+
use_tmpfs : bool, default False
|
741
|
+
This enables an explicit tmpfs mount for this step.
|
742
|
+
tmpfs_tempdir : bool, default True
|
743
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
744
|
+
tmpfs_size : int, optional, default: None
|
745
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
746
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
747
|
+
memory allocated for this step.
|
748
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
749
|
+
Path to tmpfs mount for this step.
|
750
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
751
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
752
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
753
|
+
shared_memory: int, optional
|
754
|
+
Shared memory size (in MiB) required for this step
|
755
|
+
port: int, optional
|
756
|
+
Port number to specify in the Kubernetes job object
|
757
|
+
compute_pool : str, optional, default None
|
758
|
+
Compute pool to be used for for this step.
|
759
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
760
|
+
hostname_resolution_timeout: int, default 10 * 60
|
761
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
762
|
+
Only applicable when @parallel is used.
|
763
|
+
qos: str, default: Burstable
|
764
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
923
765
|
"""
|
924
766
|
...
|
925
767
|
|
926
|
-
|
927
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
928
|
-
...
|
929
|
-
|
930
|
-
@typing.overload
|
931
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
932
|
-
...
|
933
|
-
|
934
|
-
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):
|
768
|
+
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]]]:
|
935
769
|
"""
|
936
|
-
|
770
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
771
|
+
|
772
|
+
User code call
|
773
|
+
-----------
|
774
|
+
@ollama(
|
775
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
776
|
+
backend='local'
|
777
|
+
)
|
778
|
+
|
779
|
+
Valid backend options
|
780
|
+
---------------------
|
781
|
+
- 'local': Run as a separate process on the local task machine.
|
782
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
783
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
937
784
|
|
785
|
+
Valid model options
|
786
|
+
----------------
|
787
|
+
- 'llama3.2'
|
788
|
+
- 'llama3.3'
|
789
|
+
- any model here https://ollama.com/search
|
938
790
|
|
939
791
|
|
940
792
|
Parameters
|
941
793
|
----------
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
will be loaded at the start of the task.
|
947
|
-
- "none": Do not load any checkpoint
|
948
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
949
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
950
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
951
|
-
created within the task will be loaded when the task is retries execution on failure.
|
952
|
-
|
953
|
-
temp_dir_root : str, default: None
|
954
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
794
|
+
models: list[Ollama]
|
795
|
+
List of Ollama containers running models in sidecars.
|
796
|
+
backend: str
|
797
|
+
Determines where and how to run the Ollama process.
|
955
798
|
"""
|
956
799
|
...
|
957
800
|
|
958
|
-
|
959
|
-
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]]:
|
801
|
+
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]]]:
|
960
802
|
"""
|
961
|
-
Specifies
|
962
|
-
production scheduler.
|
803
|
+
Specifies that this step should execute on DGX cloud.
|
963
804
|
|
964
805
|
|
965
806
|
Parameters
|
966
807
|
----------
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
cron : str, optional, default None
|
974
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
975
|
-
specified by this expression.
|
976
|
-
timezone : str, optional, default None
|
977
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
978
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
808
|
+
gpu : int
|
809
|
+
Number of GPUs to use.
|
810
|
+
gpu_type : str
|
811
|
+
Type of Nvidia GPU to use.
|
812
|
+
queue_timeout : int
|
813
|
+
Time to keep the job in NVCF's queue.
|
979
814
|
"""
|
980
815
|
...
|
981
816
|
|
982
817
|
@typing.overload
|
983
|
-
def
|
818
|
+
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]]]:
|
819
|
+
"""
|
820
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
821
|
+
the execution of a step.
|
822
|
+
|
823
|
+
|
824
|
+
Parameters
|
825
|
+
----------
|
826
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
827
|
+
List of secret specs, defining how the secrets are to be retrieved
|
828
|
+
"""
|
984
829
|
...
|
985
830
|
|
986
|
-
|
831
|
+
@typing.overload
|
832
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
833
|
+
...
|
834
|
+
|
835
|
+
@typing.overload
|
836
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
837
|
+
...
|
838
|
+
|
839
|
+
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]]] = []):
|
987
840
|
"""
|
988
|
-
Specifies
|
989
|
-
|
841
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
842
|
+
the execution of a step.
|
990
843
|
|
991
844
|
|
992
845
|
Parameters
|
993
846
|
----------
|
994
|
-
|
995
|
-
|
996
|
-
daily : bool, default True
|
997
|
-
Run the workflow daily.
|
998
|
-
weekly : bool, default False
|
999
|
-
Run the workflow weekly.
|
1000
|
-
cron : str, optional, default None
|
1001
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1002
|
-
specified by this expression.
|
1003
|
-
timezone : str, optional, default None
|
1004
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1005
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
847
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
848
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1006
849
|
"""
|
1007
850
|
...
|
1008
851
|
|
1009
852
|
@typing.overload
|
1010
|
-
def
|
853
|
+
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]]]:
|
1011
854
|
"""
|
1012
|
-
Specifies the
|
855
|
+
Specifies the number of times the task corresponding
|
856
|
+
to a step needs to be retried.
|
1013
857
|
|
1014
|
-
|
1015
|
-
|
858
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
859
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
860
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
861
|
+
|
862
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
863
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
864
|
+
ensuring that the flow execution can continue.
|
1016
865
|
|
1017
866
|
|
1018
867
|
Parameters
|
1019
868
|
----------
|
1020
|
-
|
1021
|
-
|
869
|
+
times : int, default 3
|
870
|
+
Number of times to retry this task.
|
871
|
+
minutes_between_retries : int, default 2
|
872
|
+
Number of minutes between retries.
|
873
|
+
"""
|
874
|
+
...
|
875
|
+
|
876
|
+
@typing.overload
|
877
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
878
|
+
...
|
879
|
+
|
880
|
+
@typing.overload
|
881
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
882
|
+
...
|
883
|
+
|
884
|
+
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):
|
885
|
+
"""
|
886
|
+
Specifies the number of times the task corresponding
|
887
|
+
to a step needs to be retried.
|
888
|
+
|
889
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
890
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
891
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
892
|
+
|
893
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
894
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
895
|
+
ensuring that the flow execution can continue.
|
896
|
+
|
897
|
+
|
898
|
+
Parameters
|
899
|
+
----------
|
900
|
+
times : int, default 3
|
901
|
+
Number of times to retry this task.
|
902
|
+
minutes_between_retries : int, default 2
|
903
|
+
Number of minutes between retries.
|
904
|
+
"""
|
905
|
+
...
|
906
|
+
|
907
|
+
@typing.overload
|
908
|
+
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]]]:
|
909
|
+
"""
|
910
|
+
Specifies the PyPI packages for the step.
|
911
|
+
|
912
|
+
Information in this decorator will augment any
|
913
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
914
|
+
you can use `@pypi_base` to set packages required by all
|
915
|
+
steps and use `@pypi` to specify step-specific overrides.
|
916
|
+
|
917
|
+
|
918
|
+
Parameters
|
919
|
+
----------
|
920
|
+
packages : Dict[str, str], default: {}
|
921
|
+
Packages to use for this step. The key is the name of the package
|
1022
922
|
and the value is the version to use.
|
1023
|
-
|
1024
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1025
|
-
python : str, optional, default None
|
923
|
+
python : str, optional, default: None
|
1026
924
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1027
925
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1028
|
-
disabled : bool, default False
|
1029
|
-
If set to True, disables Conda.
|
1030
926
|
"""
|
1031
927
|
...
|
1032
928
|
|
1033
929
|
@typing.overload
|
1034
|
-
def
|
930
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1035
931
|
...
|
1036
932
|
|
1037
|
-
|
933
|
+
@typing.overload
|
934
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
935
|
+
...
|
936
|
+
|
937
|
+
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):
|
1038
938
|
"""
|
1039
|
-
Specifies the
|
939
|
+
Specifies the PyPI packages for the step.
|
1040
940
|
|
1041
|
-
|
1042
|
-
|
941
|
+
Information in this decorator will augment any
|
942
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
943
|
+
you can use `@pypi_base` to set packages required by all
|
944
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1043
945
|
|
1044
946
|
|
1045
947
|
Parameters
|
1046
948
|
----------
|
1047
|
-
packages : Dict[str, str], default {}
|
1048
|
-
Packages to use for this
|
949
|
+
packages : Dict[str, str], default: {}
|
950
|
+
Packages to use for this step. The key is the name of the package
|
1049
951
|
and the value is the version to use.
|
1050
|
-
|
1051
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1052
|
-
python : str, optional, default None
|
952
|
+
python : str, optional, default: None
|
1053
953
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1054
954
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1055
|
-
disabled : bool, default False
|
1056
|
-
If set to True, disables Conda.
|
1057
955
|
"""
|
1058
956
|
...
|
1059
957
|
|
1060
958
|
@typing.overload
|
1061
|
-
def
|
959
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1062
960
|
"""
|
1063
|
-
Specifies the
|
961
|
+
Specifies the PyPI packages for all steps of the flow.
|
1064
962
|
|
1065
|
-
|
1066
|
-
|
1067
|
-
```
|
1068
|
-
or
|
1069
|
-
```
|
1070
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1071
|
-
```
|
1072
|
-
This decorator respects the @project decorator and triggers the flow
|
1073
|
-
when upstream runs within the same namespace complete successfully
|
963
|
+
Use `@pypi_base` to set common packages required by all
|
964
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1074
965
|
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
966
|
+
Parameters
|
967
|
+
----------
|
968
|
+
packages : Dict[str, str], default: {}
|
969
|
+
Packages to use for this flow. The key is the name of the package
|
970
|
+
and the value is the version to use.
|
971
|
+
python : str, optional, default: None
|
972
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
973
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
974
|
+
"""
|
975
|
+
...
|
976
|
+
|
977
|
+
@typing.overload
|
978
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
979
|
+
...
|
980
|
+
|
981
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
982
|
+
"""
|
983
|
+
Specifies the PyPI packages for all steps of the flow.
|
1084
984
|
|
1085
|
-
|
1086
|
-
|
1087
|
-
```
|
1088
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1089
|
-
```
|
985
|
+
Use `@pypi_base` to set common packages required by all
|
986
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1090
987
|
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
988
|
+
Parameters
|
989
|
+
----------
|
990
|
+
packages : Dict[str, str], default: {}
|
991
|
+
Packages to use for this flow. The key is the name of the package
|
992
|
+
and the value is the version to use.
|
993
|
+
python : str, optional, default: None
|
994
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
995
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
996
|
+
"""
|
997
|
+
...
|
998
|
+
|
999
|
+
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]]:
|
1000
|
+
"""
|
1001
|
+
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.
|
1002
|
+
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.
|
1096
1003
|
|
1097
1004
|
|
1098
1005
|
Parameters
|
1099
1006
|
----------
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1007
|
+
timeout : int
|
1008
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1009
|
+
poke_interval : int
|
1010
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1011
|
+
mode : str
|
1012
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1013
|
+
exponential_backoff : bool
|
1014
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1015
|
+
pool : str
|
1016
|
+
the slot pool this task should run in,
|
1017
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1018
|
+
soft_fail : bool
|
1019
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1020
|
+
name : str
|
1021
|
+
Name of the sensor on Airflow
|
1022
|
+
description : str
|
1023
|
+
Description of sensor in the Airflow UI
|
1024
|
+
external_dag_id : str
|
1025
|
+
The dag_id that contains the task you want to wait for.
|
1026
|
+
external_task_ids : List[str]
|
1027
|
+
The list of task_ids that you want to wait for.
|
1028
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1029
|
+
allowed_states : List[str]
|
1030
|
+
Iterable of allowed states, (Default: ['success'])
|
1031
|
+
failed_states : List[str]
|
1032
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1033
|
+
execution_delta : datetime.timedelta
|
1034
|
+
time difference with the previous execution to look at,
|
1035
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1036
|
+
check_existence: bool
|
1037
|
+
Set to True to check if the external task exists or check if
|
1038
|
+
the DAG to wait for exists. (Default: True)
|
1106
1039
|
"""
|
1107
1040
|
...
|
1108
1041
|
|
1109
1042
|
@typing.overload
|
1110
|
-
def
|
1111
|
-
...
|
1112
|
-
|
1113
|
-
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1043
|
+
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]]:
|
1114
1044
|
"""
|
1115
|
-
Specifies the
|
1045
|
+
Specifies the Conda environment for all steps of the flow.
|
1116
1046
|
|
1117
|
-
|
1118
|
-
|
1119
|
-
```
|
1120
|
-
or
|
1121
|
-
```
|
1122
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1123
|
-
```
|
1124
|
-
This decorator respects the @project decorator and triggers the flow
|
1125
|
-
when upstream runs within the same namespace complete successfully
|
1047
|
+
Use `@conda_base` to set common libraries required by all
|
1048
|
+
steps and use `@conda` to specify step-specific additions.
|
1126
1049
|
|
1127
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1128
|
-
by specifying the fully qualified project_flow_name.
|
1129
|
-
```
|
1130
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1131
|
-
```
|
1132
|
-
or
|
1133
|
-
```
|
1134
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1135
|
-
```
|
1136
1050
|
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1051
|
+
Parameters
|
1052
|
+
----------
|
1053
|
+
packages : Dict[str, str], default {}
|
1054
|
+
Packages to use for this flow. The key is the name of the package
|
1055
|
+
and the value is the version to use.
|
1056
|
+
libraries : Dict[str, str], default {}
|
1057
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1058
|
+
python : str, optional, default None
|
1059
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1060
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1061
|
+
disabled : bool, default False
|
1062
|
+
If set to True, disables Conda.
|
1063
|
+
"""
|
1064
|
+
...
|
1065
|
+
|
1066
|
+
@typing.overload
|
1067
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1068
|
+
...
|
1069
|
+
|
1070
|
+
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):
|
1071
|
+
"""
|
1072
|
+
Specifies the Conda environment for all steps of the flow.
|
1142
1073
|
|
1143
|
-
|
1144
|
-
|
1145
|
-
- `user.bob`
|
1146
|
-
- `test.my_experiment`
|
1147
|
-
- `prod.staging`
|
1074
|
+
Use `@conda_base` to set common libraries required by all
|
1075
|
+
steps and use `@conda` to specify step-specific additions.
|
1148
1076
|
|
1149
1077
|
|
1150
1078
|
Parameters
|
1151
1079
|
----------
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1157
|
-
|
1080
|
+
packages : Dict[str, str], default {}
|
1081
|
+
Packages to use for this flow. The key is the name of the package
|
1082
|
+
and the value is the version to use.
|
1083
|
+
libraries : Dict[str, str], default {}
|
1084
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1085
|
+
python : str, optional, default None
|
1086
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1087
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1088
|
+
disabled : bool, default False
|
1089
|
+
If set to True, disables Conda.
|
1158
1090
|
"""
|
1159
1091
|
...
|
1160
1092
|
|
@@ -1251,47 +1183,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1251
1183
|
"""
|
1252
1184
|
...
|
1253
1185
|
|
1254
|
-
@typing.overload
|
1255
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1256
|
-
"""
|
1257
|
-
Specifies the PyPI packages for all steps of the flow.
|
1258
|
-
|
1259
|
-
Use `@pypi_base` to set common packages required by all
|
1260
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1261
|
-
|
1262
|
-
Parameters
|
1263
|
-
----------
|
1264
|
-
packages : Dict[str, str], default: {}
|
1265
|
-
Packages to use for this flow. The key is the name of the package
|
1266
|
-
and the value is the version to use.
|
1267
|
-
python : str, optional, default: None
|
1268
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1269
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1270
|
-
"""
|
1271
|
-
...
|
1272
|
-
|
1273
|
-
@typing.overload
|
1274
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1275
|
-
...
|
1276
|
-
|
1277
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1278
|
-
"""
|
1279
|
-
Specifies the PyPI packages for all steps of the flow.
|
1280
|
-
|
1281
|
-
Use `@pypi_base` to set common packages required by all
|
1282
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1283
|
-
|
1284
|
-
Parameters
|
1285
|
-
----------
|
1286
|
-
packages : Dict[str, str], default: {}
|
1287
|
-
Packages to use for this flow. The key is the name of the package
|
1288
|
-
and the value is the version to use.
|
1289
|
-
python : str, optional, default: None
|
1290
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1291
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1292
|
-
"""
|
1293
|
-
...
|
1294
|
-
|
1295
1186
|
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1296
1187
|
"""
|
1297
1188
|
Specifies what flows belong to the same project.
|
@@ -1327,6 +1218,107 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
|
|
1327
1218
|
"""
|
1328
1219
|
...
|
1329
1220
|
|
1221
|
+
@typing.overload
|
1222
|
+
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]]:
|
1223
|
+
"""
|
1224
|
+
Specifies the flow(s) that this flow depends on.
|
1225
|
+
|
1226
|
+
```
|
1227
|
+
@trigger_on_finish(flow='FooFlow')
|
1228
|
+
```
|
1229
|
+
or
|
1230
|
+
```
|
1231
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1232
|
+
```
|
1233
|
+
This decorator respects the @project decorator and triggers the flow
|
1234
|
+
when upstream runs within the same namespace complete successfully
|
1235
|
+
|
1236
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1237
|
+
by specifying the fully qualified project_flow_name.
|
1238
|
+
```
|
1239
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1240
|
+
```
|
1241
|
+
or
|
1242
|
+
```
|
1243
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1244
|
+
```
|
1245
|
+
|
1246
|
+
You can also specify just the project or project branch (other values will be
|
1247
|
+
inferred from the current project or project branch):
|
1248
|
+
```
|
1249
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1250
|
+
```
|
1251
|
+
|
1252
|
+
Note that `branch` is typically one of:
|
1253
|
+
- `prod`
|
1254
|
+
- `user.bob`
|
1255
|
+
- `test.my_experiment`
|
1256
|
+
- `prod.staging`
|
1257
|
+
|
1258
|
+
|
1259
|
+
Parameters
|
1260
|
+
----------
|
1261
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1262
|
+
Upstream flow dependency for this flow.
|
1263
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1264
|
+
Upstream flow dependencies for this flow.
|
1265
|
+
options : Dict[str, Any], default {}
|
1266
|
+
Backend-specific configuration for tuning eventing behavior.
|
1267
|
+
"""
|
1268
|
+
...
|
1269
|
+
|
1270
|
+
@typing.overload
|
1271
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1272
|
+
...
|
1273
|
+
|
1274
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1275
|
+
"""
|
1276
|
+
Specifies the flow(s) that this flow depends on.
|
1277
|
+
|
1278
|
+
```
|
1279
|
+
@trigger_on_finish(flow='FooFlow')
|
1280
|
+
```
|
1281
|
+
or
|
1282
|
+
```
|
1283
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1284
|
+
```
|
1285
|
+
This decorator respects the @project decorator and triggers the flow
|
1286
|
+
when upstream runs within the same namespace complete successfully
|
1287
|
+
|
1288
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1289
|
+
by specifying the fully qualified project_flow_name.
|
1290
|
+
```
|
1291
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1292
|
+
```
|
1293
|
+
or
|
1294
|
+
```
|
1295
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1296
|
+
```
|
1297
|
+
|
1298
|
+
You can also specify just the project or project branch (other values will be
|
1299
|
+
inferred from the current project or project branch):
|
1300
|
+
```
|
1301
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1302
|
+
```
|
1303
|
+
|
1304
|
+
Note that `branch` is typically one of:
|
1305
|
+
- `prod`
|
1306
|
+
- `user.bob`
|
1307
|
+
- `test.my_experiment`
|
1308
|
+
- `prod.staging`
|
1309
|
+
|
1310
|
+
|
1311
|
+
Parameters
|
1312
|
+
----------
|
1313
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1314
|
+
Upstream flow dependency for this flow.
|
1315
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1316
|
+
Upstream flow dependencies for this flow.
|
1317
|
+
options : Dict[str, Any], default {}
|
1318
|
+
Backend-specific configuration for tuning eventing behavior.
|
1319
|
+
"""
|
1320
|
+
...
|
1321
|
+
|
1330
1322
|
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]]:
|
1331
1323
|
"""
|
1332
1324
|
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)
|
@@ -1370,46 +1362,54 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1370
1362
|
"""
|
1371
1363
|
...
|
1372
1364
|
|
1373
|
-
|
1365
|
+
@typing.overload
|
1366
|
+
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]]:
|
1374
1367
|
"""
|
1375
|
-
|
1376
|
-
|
1368
|
+
Specifies the times when the flow should be run when running on a
|
1369
|
+
production scheduler.
|
1377
1370
|
|
1378
1371
|
|
1379
1372
|
Parameters
|
1380
1373
|
----------
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1374
|
+
hourly : bool, default False
|
1375
|
+
Run the workflow hourly.
|
1376
|
+
daily : bool, default True
|
1377
|
+
Run the workflow daily.
|
1378
|
+
weekly : bool, default False
|
1379
|
+
Run the workflow weekly.
|
1380
|
+
cron : str, optional, default None
|
1381
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1382
|
+
specified by this expression.
|
1383
|
+
timezone : str, optional, default None
|
1384
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1385
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1386
|
+
"""
|
1387
|
+
...
|
1388
|
+
|
1389
|
+
@typing.overload
|
1390
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1391
|
+
...
|
1392
|
+
|
1393
|
+
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):
|
1394
|
+
"""
|
1395
|
+
Specifies the times when the flow should be run when running on a
|
1396
|
+
production scheduler.
|
1397
|
+
|
1398
|
+
|
1399
|
+
Parameters
|
1400
|
+
----------
|
1401
|
+
hourly : bool, default False
|
1402
|
+
Run the workflow hourly.
|
1403
|
+
daily : bool, default True
|
1404
|
+
Run the workflow daily.
|
1405
|
+
weekly : bool, default False
|
1406
|
+
Run the workflow weekly.
|
1407
|
+
cron : str, optional, default None
|
1408
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1409
|
+
specified by this expression.
|
1410
|
+
timezone : str, optional, default None
|
1411
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1412
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1413
1413
|
"""
|
1414
1414
|
...
|
1415
1415
|
|