ob-metaflow-stubs 6.0.3.141__py2.py3-none-any.whl → 6.0.3.143__py2.py3-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- metaflow-stubs/__init__.pyi +583 -550
- metaflow-stubs/cards.pyi +1 -1
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/cli_components/__init__.pyi +1 -1
- metaflow-stubs/cli_components/utils.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +1 -1
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +1 -1
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +147 -147
- metaflow-stubs/mf_extensions/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +23 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +29 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +13 -12
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +1 -1
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +5 -5
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +1 -1
- metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +53 -0
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +6 -6
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +1 -1
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +4 -4
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +4 -4
- {ob_metaflow_stubs-6.0.3.141.dist-info → ob_metaflow_stubs-6.0.3.143.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.143.dist-info/RECORD +197 -0
- ob_metaflow_stubs-6.0.3.141.dist-info/RECORD +0 -192
- {ob_metaflow_stubs-6.0.3.141.dist-info → ob_metaflow_stubs-6.0.3.143.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.141.dist-info → ob_metaflow_stubs-6.0.3.143.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.14.0.1+obcheckpoint(0.1.8);ob(v1) #
|
4
|
-
# Generated on 2025-02-
|
4
|
+
# Generated on 2025-02-17T23:51:59.842077 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -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 events as events
|
39
|
-
from . import tuple_util as tuple_util
|
40
38
|
from . import cards as cards
|
39
|
+
from . import tuple_util as tuple_util
|
40
|
+
from . import events as events
|
41
41
|
from . import runner as runner
|
42
42
|
from . import plugins as plugins
|
43
43
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
@@ -146,182 +146,225 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
146
146
|
"""
|
147
147
|
...
|
148
148
|
|
149
|
-
def
|
149
|
+
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]]]:
|
150
150
|
"""
|
151
|
-
|
151
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
152
|
+
|
153
|
+
User code call
|
154
|
+
-----------
|
155
|
+
@nim(
|
156
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
157
|
+
backend='managed'
|
158
|
+
)
|
159
|
+
|
160
|
+
Valid backend options
|
161
|
+
---------------------
|
162
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
163
|
+
|
164
|
+
Valid model options
|
165
|
+
----------------
|
166
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
167
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
168
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
152
169
|
|
153
170
|
|
154
171
|
Parameters
|
155
172
|
----------
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
173
|
+
models: list[NIM]
|
174
|
+
List of NIM containers running models in sidecars.
|
175
|
+
backend: str
|
176
|
+
Compute provider to run the NIM container.
|
160
177
|
queue_timeout : int
|
161
178
|
Time to keep the job in NVCF's queue.
|
162
179
|
"""
|
163
180
|
...
|
164
181
|
|
165
182
|
@typing.overload
|
166
|
-
def
|
183
|
+
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]]]:
|
167
184
|
"""
|
168
|
-
|
185
|
+
Enables loading / saving of models within a step.
|
169
186
|
|
170
|
-
Information in this decorator will augment any
|
171
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
172
|
-
you can use `@conda_base` to set packages required by all
|
173
|
-
steps and use `@conda` to specify step-specific overrides.
|
174
187
|
|
175
188
|
|
176
189
|
Parameters
|
177
190
|
----------
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
If
|
191
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
192
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
193
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
194
|
+
- `current.checkpoint`
|
195
|
+
- `current.model`
|
196
|
+
- `current.huggingface_hub`
|
197
|
+
|
198
|
+
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
|
199
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
200
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
201
|
+
|
202
|
+
temp_dir_root : str, default: None
|
203
|
+
The root directory under which `current.model.loaded` will store loaded models
|
188
204
|
"""
|
189
205
|
...
|
190
206
|
|
191
207
|
@typing.overload
|
192
|
-
def
|
208
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
193
209
|
...
|
194
210
|
|
195
211
|
@typing.overload
|
196
|
-
def
|
212
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
197
213
|
...
|
198
214
|
|
199
|
-
def
|
215
|
+
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):
|
200
216
|
"""
|
201
|
-
|
217
|
+
Enables loading / saving of models within a step.
|
202
218
|
|
203
|
-
Information in this decorator will augment any
|
204
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
205
|
-
you can use `@conda_base` to set packages required by all
|
206
|
-
steps and use `@conda` to specify step-specific overrides.
|
207
219
|
|
208
220
|
|
209
221
|
Parameters
|
210
222
|
----------
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
If
|
223
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
224
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
225
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
226
|
+
- `current.checkpoint`
|
227
|
+
- `current.model`
|
228
|
+
- `current.huggingface_hub`
|
229
|
+
|
230
|
+
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
|
231
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
232
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
233
|
+
|
234
|
+
temp_dir_root : str, default: None
|
235
|
+
The root directory under which `current.model.loaded` will store loaded models
|
221
236
|
"""
|
222
237
|
...
|
223
238
|
|
224
|
-
|
225
|
-
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]]]:
|
239
|
+
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]]]:
|
226
240
|
"""
|
227
|
-
|
228
|
-
to a step needs to be retried.
|
241
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
229
242
|
|
230
|
-
|
231
|
-
|
232
|
-
|
243
|
+
User code call
|
244
|
+
-----------
|
245
|
+
@ollama(
|
246
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
247
|
+
backend='local'
|
248
|
+
)
|
233
249
|
|
234
|
-
|
235
|
-
|
236
|
-
|
250
|
+
Valid backend options
|
251
|
+
---------------------
|
252
|
+
- 'local': Run as a separate process on the local task machine.
|
253
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
254
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
255
|
+
|
256
|
+
Valid model options
|
257
|
+
----------------
|
258
|
+
- 'llama3.2'
|
259
|
+
- 'llama3.3'
|
260
|
+
- any model here https://ollama.com/search
|
237
261
|
|
238
262
|
|
239
263
|
Parameters
|
240
264
|
----------
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
265
|
+
models: list[Ollama]
|
266
|
+
List of Ollama containers running models in sidecars.
|
267
|
+
backend: str
|
268
|
+
Determines where and how to run the Ollama process.
|
245
269
|
"""
|
246
270
|
...
|
247
271
|
|
248
272
|
@typing.overload
|
249
|
-
def
|
273
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
274
|
+
"""
|
275
|
+
Internal decorator to support Fast bakery
|
276
|
+
Parameters
|
277
|
+
----------
|
278
|
+
"""
|
250
279
|
...
|
251
280
|
|
252
281
|
@typing.overload
|
253
|
-
def
|
282
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
254
283
|
...
|
255
284
|
|
256
|
-
def
|
285
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
257
286
|
"""
|
258
|
-
|
259
|
-
|
287
|
+
Internal decorator to support Fast bakery
|
288
|
+
Parameters
|
289
|
+
----------
|
290
|
+
"""
|
291
|
+
...
|
292
|
+
|
293
|
+
@typing.overload
|
294
|
+
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
295
|
+
"""
|
296
|
+
Specifies a timeout for your step.
|
260
297
|
|
261
|
-
This decorator is useful
|
262
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
263
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
298
|
+
This decorator is useful if this step may hang indefinitely.
|
264
299
|
|
265
|
-
This can be used in conjunction with the `@
|
266
|
-
|
267
|
-
|
300
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
301
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
302
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
303
|
+
|
304
|
+
Note that all the values specified in parameters are added together so if you specify
|
305
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
268
306
|
|
269
307
|
|
270
308
|
Parameters
|
271
309
|
----------
|
272
|
-
|
273
|
-
Number of
|
274
|
-
|
275
|
-
Number of minutes
|
310
|
+
seconds : int, default 0
|
311
|
+
Number of seconds to wait prior to timing out.
|
312
|
+
minutes : int, default 0
|
313
|
+
Number of minutes to wait prior to timing out.
|
314
|
+
hours : int, default 0
|
315
|
+
Number of hours to wait prior to timing out.
|
276
316
|
"""
|
277
317
|
...
|
278
318
|
|
279
319
|
@typing.overload
|
280
|
-
def
|
320
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
321
|
+
...
|
322
|
+
|
323
|
+
@typing.overload
|
324
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
325
|
+
...
|
326
|
+
|
327
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
281
328
|
"""
|
282
|
-
|
329
|
+
Specifies a timeout for your step.
|
283
330
|
|
284
|
-
|
331
|
+
This decorator is useful if this step may hang indefinitely.
|
332
|
+
|
333
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
334
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
335
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
336
|
+
|
337
|
+
Note that all the values specified in parameters are added together so if you specify
|
338
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
285
339
|
|
286
340
|
|
287
341
|
Parameters
|
288
342
|
----------
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
timeout : int, default 45
|
296
|
-
Interrupt reporting if it takes more than this many seconds.
|
343
|
+
seconds : int, default 0
|
344
|
+
Number of seconds to wait prior to timing out.
|
345
|
+
minutes : int, default 0
|
346
|
+
Number of minutes to wait prior to timing out.
|
347
|
+
hours : int, default 0
|
348
|
+
Number of hours to wait prior to timing out.
|
297
349
|
"""
|
298
350
|
...
|
299
351
|
|
300
352
|
@typing.overload
|
301
|
-
def
|
353
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
354
|
+
"""
|
355
|
+
Parameters
|
356
|
+
----------
|
357
|
+
"""
|
302
358
|
...
|
303
359
|
|
304
360
|
@typing.overload
|
305
|
-
def
|
361
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
306
362
|
...
|
307
363
|
|
308
|
-
def
|
364
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
309
365
|
"""
|
310
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
311
|
-
|
312
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
313
|
-
|
314
|
-
|
315
366
|
Parameters
|
316
367
|
----------
|
317
|
-
type : str, default 'default'
|
318
|
-
Card type.
|
319
|
-
id : str, optional, default None
|
320
|
-
If multiple cards are present, use this id to identify this card.
|
321
|
-
options : Dict[str, Any], default {}
|
322
|
-
Options passed to the card. The contents depend on the card type.
|
323
|
-
timeout : int, default 45
|
324
|
-
Interrupt reporting if it takes more than this many seconds.
|
325
368
|
"""
|
326
369
|
...
|
327
370
|
|
@@ -402,60 +445,98 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
402
445
|
"""
|
403
446
|
...
|
404
447
|
|
405
|
-
|
406
|
-
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]]]:
|
448
|
+
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]]]:
|
407
449
|
"""
|
408
|
-
|
409
|
-
|
450
|
+
Specifies that this step should execute on DGX cloud.
|
410
451
|
|
411
452
|
|
412
453
|
Parameters
|
413
454
|
----------
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
421
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
422
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
423
|
-
created within the task will be loaded when the task is retries execution on failure.
|
424
|
-
|
425
|
-
temp_dir_root : str, default: None
|
426
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
455
|
+
gpu : int
|
456
|
+
Number of GPUs to use.
|
457
|
+
gpu_type : str
|
458
|
+
Type of Nvidia GPU to use.
|
459
|
+
queue_timeout : int
|
460
|
+
Time to keep the job in NVCF's queue.
|
427
461
|
"""
|
428
462
|
...
|
429
463
|
|
430
464
|
@typing.overload
|
431
|
-
def
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
465
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
466
|
+
"""
|
467
|
+
Specifies the resources needed when executing this step.
|
468
|
+
|
469
|
+
Use `@resources` to specify the resource requirements
|
470
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
471
|
+
|
472
|
+
You can choose the compute layer on the command line by executing e.g.
|
473
|
+
```
|
474
|
+
python myflow.py run --with batch
|
475
|
+
```
|
476
|
+
or
|
477
|
+
```
|
478
|
+
python myflow.py run --with kubernetes
|
479
|
+
```
|
480
|
+
which executes the flow on the desired system using the
|
481
|
+
requirements specified in `@resources`.
|
482
|
+
|
483
|
+
|
484
|
+
Parameters
|
485
|
+
----------
|
486
|
+
cpu : int, default 1
|
487
|
+
Number of CPUs required for this step.
|
488
|
+
gpu : int, optional, default None
|
489
|
+
Number of GPUs required for this step.
|
490
|
+
disk : int, optional, default None
|
491
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
492
|
+
memory : int, default 4096
|
493
|
+
Memory size (in MB) required for this step.
|
494
|
+
shared_memory : int, optional, default None
|
495
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
496
|
+
This parameter maps to the `--shm-size` option in Docker.
|
497
|
+
"""
|
436
498
|
...
|
437
499
|
|
438
|
-
|
500
|
+
@typing.overload
|
501
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
502
|
+
...
|
503
|
+
|
504
|
+
@typing.overload
|
505
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
506
|
+
...
|
507
|
+
|
508
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
439
509
|
"""
|
440
|
-
|
510
|
+
Specifies the resources needed when executing this step.
|
511
|
+
|
512
|
+
Use `@resources` to specify the resource requirements
|
513
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
441
514
|
|
515
|
+
You can choose the compute layer on the command line by executing e.g.
|
516
|
+
```
|
517
|
+
python myflow.py run --with batch
|
518
|
+
```
|
519
|
+
or
|
520
|
+
```
|
521
|
+
python myflow.py run --with kubernetes
|
522
|
+
```
|
523
|
+
which executes the flow on the desired system using the
|
524
|
+
requirements specified in `@resources`.
|
442
525
|
|
443
526
|
|
444
527
|
Parameters
|
445
528
|
----------
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
temp_dir_root : str, default: None
|
458
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
529
|
+
cpu : int, default 1
|
530
|
+
Number of CPUs required for this step.
|
531
|
+
gpu : int, optional, default None
|
532
|
+
Number of GPUs required for this step.
|
533
|
+
disk : int, optional, default None
|
534
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
535
|
+
memory : int, default 4096
|
536
|
+
Memory size (in MB) required for this step.
|
537
|
+
shared_memory : int, optional, default None
|
538
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
539
|
+
This parameter maps to the `--shm-size` option in Docker.
|
459
540
|
"""
|
460
541
|
...
|
461
542
|
|
@@ -493,82 +574,102 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
|
|
493
574
|
...
|
494
575
|
|
495
576
|
@typing.overload
|
496
|
-
def
|
577
|
+
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]]]:
|
497
578
|
"""
|
498
|
-
|
579
|
+
Specifies that the step will success under all circumstances.
|
580
|
+
|
581
|
+
The decorator will create an optional artifact, specified by `var`, which
|
582
|
+
contains the exception raised. You can use it to detect the presence
|
583
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
584
|
+
are missing.
|
585
|
+
|
586
|
+
|
499
587
|
Parameters
|
500
588
|
----------
|
589
|
+
var : str, optional, default None
|
590
|
+
Name of the artifact in which to store the caught exception.
|
591
|
+
If not specified, the exception is not stored.
|
592
|
+
print_exception : bool, default True
|
593
|
+
Determines whether or not the exception is printed to
|
594
|
+
stdout when caught.
|
501
595
|
"""
|
502
596
|
...
|
503
597
|
|
504
598
|
@typing.overload
|
505
|
-
def
|
599
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
506
600
|
...
|
507
601
|
|
508
|
-
|
602
|
+
@typing.overload
|
603
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
604
|
+
...
|
605
|
+
|
606
|
+
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):
|
509
607
|
"""
|
510
|
-
|
608
|
+
Specifies that the step will success under all circumstances.
|
609
|
+
|
610
|
+
The decorator will create an optional artifact, specified by `var`, which
|
611
|
+
contains the exception raised. You can use it to detect the presence
|
612
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
613
|
+
are missing.
|
614
|
+
|
615
|
+
|
511
616
|
Parameters
|
512
617
|
----------
|
618
|
+
var : str, optional, default None
|
619
|
+
Name of the artifact in which to store the caught exception.
|
620
|
+
If not specified, the exception is not stored.
|
621
|
+
print_exception : bool, default True
|
622
|
+
Determines whether or not the exception is printed to
|
623
|
+
stdout when caught.
|
513
624
|
"""
|
514
625
|
...
|
515
626
|
|
516
627
|
@typing.overload
|
517
|
-
def
|
628
|
+
def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
518
629
|
"""
|
519
|
-
|
520
|
-
|
521
|
-
This decorator is useful if this step may hang indefinitely.
|
522
|
-
|
523
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
524
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
525
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
630
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
526
631
|
|
527
|
-
Note that
|
528
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
632
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
529
633
|
|
530
634
|
|
531
635
|
Parameters
|
532
636
|
----------
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
637
|
+
type : str, default 'default'
|
638
|
+
Card type.
|
639
|
+
id : str, optional, default None
|
640
|
+
If multiple cards are present, use this id to identify this card.
|
641
|
+
options : Dict[str, Any], default {}
|
642
|
+
Options passed to the card. The contents depend on the card type.
|
643
|
+
timeout : int, default 45
|
644
|
+
Interrupt reporting if it takes more than this many seconds.
|
539
645
|
"""
|
540
646
|
...
|
541
647
|
|
542
648
|
@typing.overload
|
543
|
-
def
|
649
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
544
650
|
...
|
545
651
|
|
546
652
|
@typing.overload
|
547
|
-
def
|
653
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
548
654
|
...
|
549
655
|
|
550
|
-
def
|
656
|
+
def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
|
551
657
|
"""
|
552
|
-
|
553
|
-
|
554
|
-
This decorator is useful if this step may hang indefinitely.
|
555
|
-
|
556
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
557
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
558
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
658
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
559
659
|
|
560
|
-
Note that
|
561
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
660
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
562
661
|
|
563
662
|
|
564
663
|
Parameters
|
565
664
|
----------
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
571
|
-
|
665
|
+
type : str, default 'default'
|
666
|
+
Card type.
|
667
|
+
id : str, optional, default None
|
668
|
+
If multiple cards are present, use this id to identify this card.
|
669
|
+
options : Dict[str, Any], default {}
|
670
|
+
Options passed to the card. The contents depend on the card type.
|
671
|
+
timeout : int, default 45
|
672
|
+
Interrupt reporting if it takes more than this many seconds.
|
572
673
|
"""
|
573
674
|
...
|
574
675
|
|
@@ -597,57 +698,6 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
|
|
597
698
|
"""
|
598
699
|
...
|
599
700
|
|
600
|
-
@typing.overload
|
601
|
-
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]]]:
|
602
|
-
"""
|
603
|
-
Specifies that the step will success under all circumstances.
|
604
|
-
|
605
|
-
The decorator will create an optional artifact, specified by `var`, which
|
606
|
-
contains the exception raised. You can use it to detect the presence
|
607
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
608
|
-
are missing.
|
609
|
-
|
610
|
-
|
611
|
-
Parameters
|
612
|
-
----------
|
613
|
-
var : str, optional, default None
|
614
|
-
Name of the artifact in which to store the caught exception.
|
615
|
-
If not specified, the exception is not stored.
|
616
|
-
print_exception : bool, default True
|
617
|
-
Determines whether or not the exception is printed to
|
618
|
-
stdout when caught.
|
619
|
-
"""
|
620
|
-
...
|
621
|
-
|
622
|
-
@typing.overload
|
623
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
624
|
-
...
|
625
|
-
|
626
|
-
@typing.overload
|
627
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
628
|
-
...
|
629
|
-
|
630
|
-
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):
|
631
|
-
"""
|
632
|
-
Specifies that the step will success under all circumstances.
|
633
|
-
|
634
|
-
The decorator will create an optional artifact, specified by `var`, which
|
635
|
-
contains the exception raised. You can use it to detect the presence
|
636
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
637
|
-
are missing.
|
638
|
-
|
639
|
-
|
640
|
-
Parameters
|
641
|
-
----------
|
642
|
-
var : str, optional, default None
|
643
|
-
Name of the artifact in which to store the caught exception.
|
644
|
-
If not specified, the exception is not stored.
|
645
|
-
print_exception : bool, default True
|
646
|
-
Determines whether or not the exception is printed to
|
647
|
-
stdout when caught.
|
648
|
-
"""
|
649
|
-
...
|
650
|
-
|
651
701
|
@typing.overload
|
652
702
|
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]]]:
|
653
703
|
"""
|
@@ -699,25 +749,6 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
699
749
|
"""
|
700
750
|
...
|
701
751
|
|
702
|
-
@typing.overload
|
703
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
704
|
-
"""
|
705
|
-
Parameters
|
706
|
-
----------
|
707
|
-
"""
|
708
|
-
...
|
709
|
-
|
710
|
-
@typing.overload
|
711
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
712
|
-
...
|
713
|
-
|
714
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
715
|
-
"""
|
716
|
-
Parameters
|
717
|
-
----------
|
718
|
-
"""
|
719
|
-
...
|
720
|
-
|
721
752
|
@typing.overload
|
722
753
|
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]]]:
|
723
754
|
"""
|
@@ -753,266 +784,109 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
753
784
|
"""
|
754
785
|
...
|
755
786
|
|
756
|
-
|
787
|
+
@typing.overload
|
788
|
+
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]]]:
|
757
789
|
"""
|
758
|
-
|
790
|
+
Specifies the number of times the task corresponding
|
791
|
+
to a step needs to be retried.
|
759
792
|
|
760
|
-
|
761
|
-
|
762
|
-
|
763
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
764
|
-
backend='managed'
|
765
|
-
)
|
766
|
-
|
767
|
-
Valid backend options
|
768
|
-
---------------------
|
769
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
770
|
-
|
771
|
-
Valid model options
|
772
|
-
----------------
|
773
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
774
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
775
|
-
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
776
|
-
|
777
|
-
|
778
|
-
Parameters
|
779
|
-
----------
|
780
|
-
models: list[NIM]
|
781
|
-
List of NIM containers running models in sidecars.
|
782
|
-
backend: str
|
783
|
-
Compute provider to run the NIM container.
|
784
|
-
queue_timeout : int
|
785
|
-
Time to keep the job in NVCF's queue.
|
786
|
-
"""
|
787
|
-
...
|
788
|
-
|
789
|
-
@typing.overload
|
790
|
-
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
791
|
-
"""
|
792
|
-
Specifies the resources needed when executing this step.
|
793
|
-
|
794
|
-
Use `@resources` to specify the resource requirements
|
795
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
793
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
794
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
795
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
796
796
|
|
797
|
-
|
798
|
-
|
799
|
-
|
800
|
-
```
|
801
|
-
or
|
802
|
-
```
|
803
|
-
python myflow.py run --with kubernetes
|
804
|
-
```
|
805
|
-
which executes the flow on the desired system using the
|
806
|
-
requirements specified in `@resources`.
|
797
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
798
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
799
|
+
ensuring that the flow execution can continue.
|
807
800
|
|
808
801
|
|
809
802
|
Parameters
|
810
803
|
----------
|
811
|
-
|
812
|
-
Number of
|
813
|
-
|
814
|
-
Number of
|
815
|
-
disk : int, optional, default None
|
816
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
817
|
-
memory : int, default 4096
|
818
|
-
Memory size (in MB) required for this step.
|
819
|
-
shared_memory : int, optional, default None
|
820
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
821
|
-
This parameter maps to the `--shm-size` option in Docker.
|
804
|
+
times : int, default 3
|
805
|
+
Number of times to retry this task.
|
806
|
+
minutes_between_retries : int, default 2
|
807
|
+
Number of minutes between retries.
|
822
808
|
"""
|
823
809
|
...
|
824
810
|
|
825
811
|
@typing.overload
|
826
|
-
def
|
812
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
827
813
|
...
|
828
814
|
|
829
815
|
@typing.overload
|
830
|
-
def
|
816
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
831
817
|
...
|
832
818
|
|
833
|
-
def
|
819
|
+
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):
|
834
820
|
"""
|
835
|
-
Specifies the
|
821
|
+
Specifies the number of times the task corresponding
|
822
|
+
to a step needs to be retried.
|
836
823
|
|
837
|
-
|
838
|
-
|
824
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
825
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
826
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
839
827
|
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
```
|
844
|
-
or
|
845
|
-
```
|
846
|
-
python myflow.py run --with kubernetes
|
847
|
-
```
|
848
|
-
which executes the flow on the desired system using the
|
849
|
-
requirements specified in `@resources`.
|
828
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
829
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
830
|
+
ensuring that the flow execution can continue.
|
850
831
|
|
851
832
|
|
852
833
|
Parameters
|
853
834
|
----------
|
854
|
-
|
855
|
-
Number of
|
856
|
-
|
857
|
-
Number of
|
858
|
-
disk : int, optional, default None
|
859
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
860
|
-
memory : int, default 4096
|
861
|
-
Memory size (in MB) required for this step.
|
862
|
-
shared_memory : int, optional, default None
|
863
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
864
|
-
This parameter maps to the `--shm-size` option in Docker.
|
835
|
+
times : int, default 3
|
836
|
+
Number of times to retry this task.
|
837
|
+
minutes_between_retries : int, default 2
|
838
|
+
Number of minutes between retries.
|
865
839
|
"""
|
866
840
|
...
|
867
841
|
|
868
842
|
@typing.overload
|
869
|
-
def
|
843
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
870
844
|
"""
|
871
|
-
|
845
|
+
Specifies the Conda environment for the step.
|
872
846
|
|
847
|
+
Information in this decorator will augment any
|
848
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
849
|
+
you can use `@conda_base` to set packages required by all
|
850
|
+
steps and use `@conda` to specify step-specific overrides.
|
873
851
|
|
874
852
|
|
875
853
|
Parameters
|
876
854
|
----------
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
If
|
887
|
-
|
888
|
-
temp_dir_root : str, default: None
|
889
|
-
The root directory under which `current.model.loaded` will store loaded models
|
855
|
+
packages : Dict[str, str], default {}
|
856
|
+
Packages to use for this step. The key is the name of the package
|
857
|
+
and the value is the version to use.
|
858
|
+
libraries : Dict[str, str], default {}
|
859
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
860
|
+
python : str, optional, default None
|
861
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
862
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
863
|
+
disabled : bool, default False
|
864
|
+
If set to True, disables @conda.
|
890
865
|
"""
|
891
866
|
...
|
892
867
|
|
893
868
|
@typing.overload
|
894
|
-
def
|
869
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
895
870
|
...
|
896
871
|
|
897
872
|
@typing.overload
|
898
|
-
def
|
899
|
-
...
|
900
|
-
|
901
|
-
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):
|
902
|
-
"""
|
903
|
-
Enables loading / saving of models within a step.
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
Parameters
|
908
|
-
----------
|
909
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
910
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
911
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
912
|
-
- `current.checkpoint`
|
913
|
-
- `current.model`
|
914
|
-
- `current.huggingface_hub`
|
915
|
-
|
916
|
-
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
|
917
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
918
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
919
|
-
|
920
|
-
temp_dir_root : str, default: None
|
921
|
-
The root directory under which `current.model.loaded` will store loaded models
|
922
|
-
"""
|
923
|
-
...
|
924
|
-
|
925
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
926
|
-
"""
|
927
|
-
Specifies what flows belong to the same project.
|
928
|
-
|
929
|
-
A project-specific namespace is created for all flows that
|
930
|
-
use the same `@project(name)`.
|
931
|
-
|
932
|
-
|
933
|
-
Parameters
|
934
|
-
----------
|
935
|
-
name : str
|
936
|
-
Project name. Make sure that the name is unique amongst all
|
937
|
-
projects that use the same production scheduler. The name may
|
938
|
-
contain only lowercase alphanumeric characters and underscores.
|
939
|
-
|
940
|
-
branch : Optional[str], default None
|
941
|
-
The branch to use. If not specified, the branch is set to
|
942
|
-
`user.<username>` unless `production` is set to `True`. This can
|
943
|
-
also be set on the command line using `--branch` as a top-level option.
|
944
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
945
|
-
|
946
|
-
production : bool, default False
|
947
|
-
Whether or not the branch is the production branch. This can also be set on the
|
948
|
-
command line using `--production` as a top-level option. It is an error to specify
|
949
|
-
`production` in the decorator and on the command line.
|
950
|
-
The project branch name will be:
|
951
|
-
- if `branch` is specified:
|
952
|
-
- if `production` is True: `prod.<branch>`
|
953
|
-
- if `production` is False: `test.<branch>`
|
954
|
-
- if `branch` is not specified:
|
955
|
-
- if `production` is True: `prod`
|
956
|
-
- if `production` is False: `user.<username>`
|
957
|
-
"""
|
958
|
-
...
|
959
|
-
|
960
|
-
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]]:
|
961
|
-
"""
|
962
|
-
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.
|
963
|
-
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.
|
964
|
-
|
965
|
-
|
966
|
-
Parameters
|
967
|
-
----------
|
968
|
-
timeout : int
|
969
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
970
|
-
poke_interval : int
|
971
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
972
|
-
mode : str
|
973
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
974
|
-
exponential_backoff : bool
|
975
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
976
|
-
pool : str
|
977
|
-
the slot pool this task should run in,
|
978
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
979
|
-
soft_fail : bool
|
980
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
981
|
-
name : str
|
982
|
-
Name of the sensor on Airflow
|
983
|
-
description : str
|
984
|
-
Description of sensor in the Airflow UI
|
985
|
-
external_dag_id : str
|
986
|
-
The dag_id that contains the task you want to wait for.
|
987
|
-
external_task_ids : List[str]
|
988
|
-
The list of task_ids that you want to wait for.
|
989
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
990
|
-
allowed_states : List[str]
|
991
|
-
Iterable of allowed states, (Default: ['success'])
|
992
|
-
failed_states : List[str]
|
993
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
994
|
-
execution_delta : datetime.timedelta
|
995
|
-
time difference with the previous execution to look at,
|
996
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
997
|
-
check_existence: bool
|
998
|
-
Set to True to check if the external task exists or check if
|
999
|
-
the DAG to wait for exists. (Default: True)
|
1000
|
-
"""
|
873
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1001
874
|
...
|
1002
875
|
|
1003
|
-
|
1004
|
-
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]]:
|
876
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1005
877
|
"""
|
1006
|
-
Specifies the Conda environment for
|
878
|
+
Specifies the Conda environment for the step.
|
1007
879
|
|
1008
|
-
|
1009
|
-
|
880
|
+
Information in this decorator will augment any
|
881
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
882
|
+
you can use `@conda_base` to set packages required by all
|
883
|
+
steps and use `@conda` to specify step-specific overrides.
|
1010
884
|
|
1011
885
|
|
1012
886
|
Parameters
|
1013
887
|
----------
|
1014
888
|
packages : Dict[str, str], default {}
|
1015
|
-
Packages to use for this
|
889
|
+
Packages to use for this step. The key is the name of the package
|
1016
890
|
and the value is the version to use.
|
1017
891
|
libraries : Dict[str, str], default {}
|
1018
892
|
Supported for backward compatibility. When used with packages, packages will take precedence.
|
@@ -1020,77 +894,64 @@ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[s
|
|
1020
894
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1021
895
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1022
896
|
disabled : bool, default False
|
1023
|
-
If set to True, disables
|
897
|
+
If set to True, disables @conda.
|
1024
898
|
"""
|
1025
899
|
...
|
1026
900
|
|
1027
901
|
@typing.overload
|
1028
|
-
def
|
1029
|
-
...
|
1030
|
-
|
1031
|
-
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):
|
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]]]:
|
1032
903
|
"""
|
1033
|
-
|
904
|
+
Enables checkpointing for a step.
|
1034
905
|
|
1035
|
-
Use `@conda_base` to set common libraries required by all
|
1036
|
-
steps and use `@conda` to specify step-specific additions.
|
1037
906
|
|
1038
907
|
|
1039
908
|
Parameters
|
1040
909
|
----------
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
910
|
+
load_policy : str, default: "fresh"
|
911
|
+
The policy for loading the checkpoint. The following policies are supported:
|
912
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
913
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
914
|
+
will be loaded at the start of the task.
|
915
|
+
- "none": Do not load any checkpoint
|
916
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
917
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
918
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
919
|
+
created within the task will be loaded when the task is retries execution on failure.
|
920
|
+
|
921
|
+
temp_dir_root : str, default: None
|
922
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
1051
923
|
"""
|
1052
924
|
...
|
1053
925
|
|
1054
|
-
|
926
|
+
@typing.overload
|
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):
|
1055
935
|
"""
|
1056
|
-
|
1057
|
-
|
1058
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1059
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1060
|
-
starts only after all sensors finish.
|
936
|
+
Enables checkpointing for a step.
|
937
|
+
|
1061
938
|
|
1062
939
|
|
1063
940
|
Parameters
|
1064
941
|
----------
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
name : str
|
1079
|
-
Name of the sensor on Airflow
|
1080
|
-
description : str
|
1081
|
-
Description of sensor in the Airflow UI
|
1082
|
-
bucket_key : Union[str, List[str]]
|
1083
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1084
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1085
|
-
bucket_name : str
|
1086
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1087
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1088
|
-
wildcard_match : bool
|
1089
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1090
|
-
aws_conn_id : str
|
1091
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1092
|
-
verify : bool
|
1093
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
942
|
+
load_policy : str, default: "fresh"
|
943
|
+
The policy for loading the checkpoint. The following policies are supported:
|
944
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
945
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
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.
|
1094
955
|
"""
|
1095
956
|
...
|
1096
957
|
|
@@ -1145,47 +1006,6 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1145
1006
|
"""
|
1146
1007
|
...
|
1147
1008
|
|
1148
|
-
@typing.overload
|
1149
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1150
|
-
"""
|
1151
|
-
Specifies the PyPI packages for all steps of the flow.
|
1152
|
-
|
1153
|
-
Use `@pypi_base` to set common packages required by all
|
1154
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1155
|
-
|
1156
|
-
Parameters
|
1157
|
-
----------
|
1158
|
-
packages : Dict[str, str], default: {}
|
1159
|
-
Packages to use for this flow. The key is the name of the package
|
1160
|
-
and the value is the version to use.
|
1161
|
-
python : str, optional, default: None
|
1162
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1163
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1164
|
-
"""
|
1165
|
-
...
|
1166
|
-
|
1167
|
-
@typing.overload
|
1168
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1169
|
-
...
|
1170
|
-
|
1171
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1172
|
-
"""
|
1173
|
-
Specifies the PyPI packages for all steps of the flow.
|
1174
|
-
|
1175
|
-
Use `@pypi_base` to set common packages required by all
|
1176
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1177
|
-
|
1178
|
-
Parameters
|
1179
|
-
----------
|
1180
|
-
packages : Dict[str, str], default: {}
|
1181
|
-
Packages to use for this flow. The key is the name of the package
|
1182
|
-
and the value is the version to use.
|
1183
|
-
python : str, optional, default: None
|
1184
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1185
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1186
|
-
"""
|
1187
|
-
...
|
1188
|
-
|
1189
1009
|
@typing.overload
|
1190
1010
|
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1191
1011
|
"""
|
@@ -1279,6 +1099,100 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1279
1099
|
"""
|
1280
1100
|
...
|
1281
1101
|
|
1102
|
+
@typing.overload
|
1103
|
+
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]]:
|
1104
|
+
"""
|
1105
|
+
Specifies the Conda environment for all steps of the flow.
|
1106
|
+
|
1107
|
+
Use `@conda_base` to set common libraries required by all
|
1108
|
+
steps and use `@conda` to specify step-specific additions.
|
1109
|
+
|
1110
|
+
|
1111
|
+
Parameters
|
1112
|
+
----------
|
1113
|
+
packages : Dict[str, str], default {}
|
1114
|
+
Packages to use for this flow. The key is the name of the package
|
1115
|
+
and the value is the version to use.
|
1116
|
+
libraries : Dict[str, str], default {}
|
1117
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1118
|
+
python : str, optional, default None
|
1119
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1120
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1121
|
+
disabled : bool, default False
|
1122
|
+
If set to True, disables Conda.
|
1123
|
+
"""
|
1124
|
+
...
|
1125
|
+
|
1126
|
+
@typing.overload
|
1127
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1128
|
+
...
|
1129
|
+
|
1130
|
+
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):
|
1131
|
+
"""
|
1132
|
+
Specifies the Conda environment for all steps of the flow.
|
1133
|
+
|
1134
|
+
Use `@conda_base` to set common libraries required by all
|
1135
|
+
steps and use `@conda` to specify step-specific additions.
|
1136
|
+
|
1137
|
+
|
1138
|
+
Parameters
|
1139
|
+
----------
|
1140
|
+
packages : Dict[str, str], default {}
|
1141
|
+
Packages to use for this flow. The key is the name of the package
|
1142
|
+
and the value is the version to use.
|
1143
|
+
libraries : Dict[str, str], default {}
|
1144
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1145
|
+
python : str, optional, default None
|
1146
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1147
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1148
|
+
disabled : bool, default False
|
1149
|
+
If set to True, disables Conda.
|
1150
|
+
"""
|
1151
|
+
...
|
1152
|
+
|
1153
|
+
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]]:
|
1154
|
+
"""
|
1155
|
+
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)
|
1156
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1157
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1158
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1159
|
+
starts only after all sensors finish.
|
1160
|
+
|
1161
|
+
|
1162
|
+
Parameters
|
1163
|
+
----------
|
1164
|
+
timeout : int
|
1165
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1166
|
+
poke_interval : int
|
1167
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1168
|
+
mode : str
|
1169
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1170
|
+
exponential_backoff : bool
|
1171
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1172
|
+
pool : str
|
1173
|
+
the slot pool this task should run in,
|
1174
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1175
|
+
soft_fail : bool
|
1176
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1177
|
+
name : str
|
1178
|
+
Name of the sensor on Airflow
|
1179
|
+
description : str
|
1180
|
+
Description of sensor in the Airflow UI
|
1181
|
+
bucket_key : Union[str, List[str]]
|
1182
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1183
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1184
|
+
bucket_name : str
|
1185
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1186
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1187
|
+
wildcard_match : bool
|
1188
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1189
|
+
aws_conn_id : str
|
1190
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1191
|
+
verify : bool
|
1192
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1193
|
+
"""
|
1194
|
+
...
|
1195
|
+
|
1282
1196
|
@typing.overload
|
1283
1197
|
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]]:
|
1284
1198
|
"""
|
@@ -1380,5 +1294,124 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1380
1294
|
"""
|
1381
1295
|
...
|
1382
1296
|
|
1297
|
+
@typing.overload
|
1298
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1299
|
+
"""
|
1300
|
+
Specifies the PyPI packages for all steps of the flow.
|
1301
|
+
|
1302
|
+
Use `@pypi_base` to set common packages required by all
|
1303
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1304
|
+
|
1305
|
+
Parameters
|
1306
|
+
----------
|
1307
|
+
packages : Dict[str, str], default: {}
|
1308
|
+
Packages to use for this flow. The key is the name of the package
|
1309
|
+
and the value is the version to use.
|
1310
|
+
python : str, optional, default: None
|
1311
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1312
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1313
|
+
"""
|
1314
|
+
...
|
1315
|
+
|
1316
|
+
@typing.overload
|
1317
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1318
|
+
...
|
1319
|
+
|
1320
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1321
|
+
"""
|
1322
|
+
Specifies the PyPI packages for all steps of the flow.
|
1323
|
+
|
1324
|
+
Use `@pypi_base` to set common packages required by all
|
1325
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1326
|
+
|
1327
|
+
Parameters
|
1328
|
+
----------
|
1329
|
+
packages : Dict[str, str], default: {}
|
1330
|
+
Packages to use for this flow. The key is the name of the package
|
1331
|
+
and the value is the version to use.
|
1332
|
+
python : str, optional, default: None
|
1333
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1334
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1335
|
+
"""
|
1336
|
+
...
|
1337
|
+
|
1338
|
+
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]]:
|
1339
|
+
"""
|
1340
|
+
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.
|
1341
|
+
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.
|
1342
|
+
|
1343
|
+
|
1344
|
+
Parameters
|
1345
|
+
----------
|
1346
|
+
timeout : int
|
1347
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1348
|
+
poke_interval : int
|
1349
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1350
|
+
mode : str
|
1351
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1352
|
+
exponential_backoff : bool
|
1353
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1354
|
+
pool : str
|
1355
|
+
the slot pool this task should run in,
|
1356
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1357
|
+
soft_fail : bool
|
1358
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1359
|
+
name : str
|
1360
|
+
Name of the sensor on Airflow
|
1361
|
+
description : str
|
1362
|
+
Description of sensor in the Airflow UI
|
1363
|
+
external_dag_id : str
|
1364
|
+
The dag_id that contains the task you want to wait for.
|
1365
|
+
external_task_ids : List[str]
|
1366
|
+
The list of task_ids that you want to wait for.
|
1367
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1368
|
+
allowed_states : List[str]
|
1369
|
+
Iterable of allowed states, (Default: ['success'])
|
1370
|
+
failed_states : List[str]
|
1371
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1372
|
+
execution_delta : datetime.timedelta
|
1373
|
+
time difference with the previous execution to look at,
|
1374
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1375
|
+
check_existence: bool
|
1376
|
+
Set to True to check if the external task exists or check if
|
1377
|
+
the DAG to wait for exists. (Default: True)
|
1378
|
+
"""
|
1379
|
+
...
|
1380
|
+
|
1381
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1382
|
+
"""
|
1383
|
+
Specifies what flows belong to the same project.
|
1384
|
+
|
1385
|
+
A project-specific namespace is created for all flows that
|
1386
|
+
use the same `@project(name)`.
|
1387
|
+
|
1388
|
+
|
1389
|
+
Parameters
|
1390
|
+
----------
|
1391
|
+
name : str
|
1392
|
+
Project name. Make sure that the name is unique amongst all
|
1393
|
+
projects that use the same production scheduler. The name may
|
1394
|
+
contain only lowercase alphanumeric characters and underscores.
|
1395
|
+
|
1396
|
+
branch : Optional[str], default None
|
1397
|
+
The branch to use. If not specified, the branch is set to
|
1398
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1399
|
+
also be set on the command line using `--branch` as a top-level option.
|
1400
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1401
|
+
|
1402
|
+
production : bool, default False
|
1403
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1404
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1405
|
+
`production` in the decorator and on the command line.
|
1406
|
+
The project branch name will be:
|
1407
|
+
- if `branch` is specified:
|
1408
|
+
- if `production` is True: `prod.<branch>`
|
1409
|
+
- if `production` is False: `test.<branch>`
|
1410
|
+
- if `branch` is not specified:
|
1411
|
+
- if `production` is True: `prod`
|
1412
|
+
- if `production` is False: `user.<username>`
|
1413
|
+
"""
|
1414
|
+
...
|
1415
|
+
|
1383
1416
|
pkg_name: str
|
1384
1417
|
|