ob-metaflow-stubs 6.0.3.145__py2.py3-none-any.whl → 6.0.3.147__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 +553 -553
- 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 +3 -3
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +115 -115
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +4 -4
- 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 +5 -5
- 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 +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +5 -5
- 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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +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 +4 -4
- 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 +3 -3
- metaflow-stubs/plugins/__init__.pyi +11 -11
- 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 +3 -3
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +30 -30
- 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 +2 -2
- 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 +6 -6
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.145.dist-info → ob_metaflow_stubs-6.0.3.147.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.147.dist-info/RECORD +197 -0
- ob_metaflow_stubs-6.0.3.145.dist-info/RECORD +0 -197
- {ob_metaflow_stubs-6.0.3.145.dist-info → ob_metaflow_stubs-6.0.3.147.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.145.dist-info → ob_metaflow_stubs-6.0.3.147.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.
|
4
|
-
# Generated on 2025-
|
3
|
+
# MF version: 2.15.0.1+obcheckpoint(0.1.9);ob(v1) #
|
4
|
+
# Generated on 2025-03-03T17:55:45.268987 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import typing
|
12
11
|
import datetime
|
12
|
+
import typing
|
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
|
38
39
|
from . import cards as cards
|
39
40
|
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,23 +147,61 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
147
147
|
...
|
148
148
|
|
149
149
|
@typing.overload
|
150
|
-
def
|
150
|
+
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]]]:
|
151
151
|
"""
|
152
|
-
|
152
|
+
Specifies a timeout for your step.
|
153
|
+
|
154
|
+
This decorator is useful if this step may hang indefinitely.
|
155
|
+
|
156
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
157
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
158
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
159
|
+
|
160
|
+
Note that all the values specified in parameters are added together so if you specify
|
161
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
162
|
+
|
163
|
+
|
153
164
|
Parameters
|
154
165
|
----------
|
166
|
+
seconds : int, default 0
|
167
|
+
Number of seconds to wait prior to timing out.
|
168
|
+
minutes : int, default 0
|
169
|
+
Number of minutes to wait prior to timing out.
|
170
|
+
hours : int, default 0
|
171
|
+
Number of hours to wait prior to timing out.
|
155
172
|
"""
|
156
173
|
...
|
157
174
|
|
158
175
|
@typing.overload
|
159
|
-
def
|
176
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
160
177
|
...
|
161
178
|
|
162
|
-
|
179
|
+
@typing.overload
|
180
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
181
|
+
...
|
182
|
+
|
183
|
+
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):
|
163
184
|
"""
|
164
|
-
|
185
|
+
Specifies a timeout for your step.
|
186
|
+
|
187
|
+
This decorator is useful if this step may hang indefinitely.
|
188
|
+
|
189
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
190
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
191
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
192
|
+
|
193
|
+
Note that all the values specified in parameters are added together so if you specify
|
194
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
195
|
+
|
196
|
+
|
165
197
|
Parameters
|
166
198
|
----------
|
199
|
+
seconds : int, default 0
|
200
|
+
Number of seconds to wait prior to timing out.
|
201
|
+
minutes : int, default 0
|
202
|
+
Number of minutes to wait prior to timing out.
|
203
|
+
hours : int, default 0
|
204
|
+
Number of hours to wait prior to timing out.
|
167
205
|
"""
|
168
206
|
...
|
169
207
|
|
@@ -226,88 +264,6 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
226
264
|
"""
|
227
265
|
...
|
228
266
|
|
229
|
-
@typing.overload
|
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]]]:
|
231
|
-
"""
|
232
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
233
|
-
|
234
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
235
|
-
|
236
|
-
|
237
|
-
Parameters
|
238
|
-
----------
|
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.
|
247
|
-
"""
|
248
|
-
...
|
249
|
-
|
250
|
-
@typing.overload
|
251
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
252
|
-
...
|
253
|
-
|
254
|
-
@typing.overload
|
255
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
256
|
-
...
|
257
|
-
|
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):
|
259
|
-
"""
|
260
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
261
|
-
|
262
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
263
|
-
|
264
|
-
|
265
|
-
Parameters
|
266
|
-
----------
|
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.
|
275
|
-
"""
|
276
|
-
...
|
277
|
-
|
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]]]:
|
280
|
-
"""
|
281
|
-
Specifies environment variables to be set prior to the execution of a step.
|
282
|
-
|
283
|
-
|
284
|
-
Parameters
|
285
|
-
----------
|
286
|
-
vars : Dict[str, str], default {}
|
287
|
-
Dictionary of environment variables to set.
|
288
|
-
"""
|
289
|
-
...
|
290
|
-
|
291
|
-
@typing.overload
|
292
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
293
|
-
...
|
294
|
-
|
295
|
-
@typing.overload
|
296
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
297
|
-
...
|
298
|
-
|
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] = {}):
|
300
|
-
"""
|
301
|
-
Specifies environment variables to be set prior to the execution of a step.
|
302
|
-
|
303
|
-
|
304
|
-
Parameters
|
305
|
-
----------
|
306
|
-
vars : Dict[str, str], default {}
|
307
|
-
Dictionary of environment variables to set.
|
308
|
-
"""
|
309
|
-
...
|
310
|
-
|
311
267
|
@typing.overload
|
312
268
|
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]]]:
|
313
269
|
"""
|
@@ -387,82 +343,6 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
387
343
|
"""
|
388
344
|
...
|
389
345
|
|
390
|
-
@typing.overload
|
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]]]:
|
392
|
-
"""
|
393
|
-
Enables checkpointing for a step.
|
394
|
-
|
395
|
-
|
396
|
-
|
397
|
-
Parameters
|
398
|
-
----------
|
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.
|
412
|
-
"""
|
413
|
-
...
|
414
|
-
|
415
|
-
@typing.overload
|
416
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
417
|
-
...
|
418
|
-
|
419
|
-
@typing.overload
|
420
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
421
|
-
...
|
422
|
-
|
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):
|
424
|
-
"""
|
425
|
-
Enables checkpointing for a step.
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
Parameters
|
430
|
-
----------
|
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.
|
444
|
-
"""
|
445
|
-
...
|
446
|
-
|
447
|
-
@typing.overload
|
448
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
449
|
-
"""
|
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
346
|
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
347
|
"""
|
468
348
|
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
@@ -489,92 +369,157 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
|
|
489
369
|
...
|
490
370
|
|
491
371
|
@typing.overload
|
492
|
-
def
|
372
|
+
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]]]:
|
493
373
|
"""
|
494
|
-
|
374
|
+
Specifies the number of times the task corresponding
|
375
|
+
to a step needs to be retried.
|
376
|
+
|
377
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
378
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
379
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
495
380
|
|
381
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
382
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
383
|
+
ensuring that the flow execution can continue.
|
496
384
|
|
497
385
|
|
498
386
|
Parameters
|
499
387
|
----------
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
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
|
388
|
+
times : int, default 3
|
389
|
+
Number of times to retry this task.
|
390
|
+
minutes_between_retries : int, default 2
|
391
|
+
Number of minutes between retries.
|
513
392
|
"""
|
514
393
|
...
|
515
394
|
|
516
395
|
@typing.overload
|
517
|
-
def
|
396
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
518
397
|
...
|
519
398
|
|
520
399
|
@typing.overload
|
521
|
-
def
|
400
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
522
401
|
...
|
523
402
|
|
524
|
-
def
|
403
|
+
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):
|
525
404
|
"""
|
526
|
-
|
405
|
+
Specifies the number of times the task corresponding
|
406
|
+
to a step needs to be retried.
|
527
407
|
|
408
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
409
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
410
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
411
|
+
|
412
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
413
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
414
|
+
ensuring that the flow execution can continue.
|
528
415
|
|
529
416
|
|
530
417
|
Parameters
|
531
418
|
----------
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
419
|
+
times : int, default 3
|
420
|
+
Number of times to retry this task.
|
421
|
+
minutes_between_retries : int, default 2
|
422
|
+
Number of minutes between retries.
|
423
|
+
"""
|
424
|
+
...
|
425
|
+
|
426
|
+
@typing.overload
|
427
|
+
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]]]:
|
428
|
+
"""
|
429
|
+
Specifies the PyPI packages for the step.
|
538
430
|
|
539
|
-
|
540
|
-
|
541
|
-
|
431
|
+
Information in this decorator will augment any
|
432
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
433
|
+
you can use `@pypi_base` to set packages required by all
|
434
|
+
steps and use `@pypi` to specify step-specific overrides.
|
542
435
|
|
543
|
-
|
544
|
-
|
436
|
+
|
437
|
+
Parameters
|
438
|
+
----------
|
439
|
+
packages : Dict[str, str], default: {}
|
440
|
+
Packages to use for this step. The key is the name of the package
|
441
|
+
and the value is the version to use.
|
442
|
+
python : str, optional, default: None
|
443
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
444
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
545
445
|
"""
|
546
446
|
...
|
547
447
|
|
548
|
-
|
448
|
+
@typing.overload
|
449
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
450
|
+
...
|
451
|
+
|
452
|
+
@typing.overload
|
453
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
454
|
+
...
|
455
|
+
|
456
|
+
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):
|
549
457
|
"""
|
550
|
-
|
458
|
+
Specifies the PyPI packages for the step.
|
551
459
|
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
backend='managed'
|
557
|
-
)
|
460
|
+
Information in this decorator will augment any
|
461
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
462
|
+
you can use `@pypi_base` to set packages required by all
|
463
|
+
steps and use `@pypi` to specify step-specific overrides.
|
558
464
|
|
559
|
-
Valid backend options
|
560
|
-
---------------------
|
561
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
562
465
|
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
466
|
+
Parameters
|
467
|
+
----------
|
468
|
+
packages : Dict[str, str], default: {}
|
469
|
+
Packages to use for this step. The key is the name of the package
|
470
|
+
and the value is the version to use.
|
471
|
+
python : str, optional, default: None
|
472
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
473
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
474
|
+
"""
|
475
|
+
...
|
476
|
+
|
477
|
+
@typing.overload
|
478
|
+
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]]]:
|
479
|
+
"""
|
480
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
481
|
+
|
482
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
568
483
|
|
569
484
|
|
570
485
|
Parameters
|
571
486
|
----------
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
|
577
|
-
|
487
|
+
type : str, default 'default'
|
488
|
+
Card type.
|
489
|
+
id : str, optional, default None
|
490
|
+
If multiple cards are present, use this id to identify this card.
|
491
|
+
options : Dict[str, Any], default {}
|
492
|
+
Options passed to the card. The contents depend on the card type.
|
493
|
+
timeout : int, default 45
|
494
|
+
Interrupt reporting if it takes more than this many seconds.
|
495
|
+
"""
|
496
|
+
...
|
497
|
+
|
498
|
+
@typing.overload
|
499
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
500
|
+
...
|
501
|
+
|
502
|
+
@typing.overload
|
503
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
504
|
+
...
|
505
|
+
|
506
|
+
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):
|
507
|
+
"""
|
508
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
509
|
+
|
510
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
511
|
+
|
512
|
+
|
513
|
+
Parameters
|
514
|
+
----------
|
515
|
+
type : str, default 'default'
|
516
|
+
Card type.
|
517
|
+
id : str, optional, default None
|
518
|
+
If multiple cards are present, use this id to identify this card.
|
519
|
+
options : Dict[str, Any], default {}
|
520
|
+
Options passed to the card. The contents depend on the card type.
|
521
|
+
timeout : int, default 45
|
522
|
+
Interrupt reporting if it takes more than this many seconds.
|
578
523
|
"""
|
579
524
|
...
|
580
525
|
|
@@ -630,61 +575,236 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
630
575
|
...
|
631
576
|
|
632
577
|
@typing.overload
|
633
|
-
def
|
578
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
634
579
|
"""
|
635
|
-
|
580
|
+
Internal decorator to support Fast bakery
|
581
|
+
Parameters
|
582
|
+
----------
|
583
|
+
"""
|
584
|
+
...
|
585
|
+
|
586
|
+
@typing.overload
|
587
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
588
|
+
...
|
589
|
+
|
590
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
591
|
+
"""
|
592
|
+
Internal decorator to support Fast bakery
|
593
|
+
Parameters
|
594
|
+
----------
|
595
|
+
"""
|
596
|
+
...
|
597
|
+
|
598
|
+
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]]]:
|
599
|
+
"""
|
600
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
636
601
|
|
637
|
-
|
602
|
+
User code call
|
603
|
+
-----------
|
604
|
+
@ollama(
|
605
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
606
|
+
backend='local'
|
607
|
+
)
|
638
608
|
|
639
|
-
|
640
|
-
|
641
|
-
|
609
|
+
Valid backend options
|
610
|
+
---------------------
|
611
|
+
- 'local': Run as a separate process on the local task machine.
|
612
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
613
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
642
614
|
|
643
|
-
|
644
|
-
|
615
|
+
Valid model options
|
616
|
+
----------------
|
617
|
+
- 'llama3.2'
|
618
|
+
- 'llama3.3'
|
619
|
+
- any model here https://ollama.com/search
|
645
620
|
|
646
621
|
|
647
622
|
Parameters
|
648
623
|
----------
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
|
654
|
-
|
624
|
+
models: list[Ollama]
|
625
|
+
List of Ollama containers running models in sidecars.
|
626
|
+
backend: str
|
627
|
+
Determines where and how to run the Ollama process.
|
628
|
+
"""
|
629
|
+
...
|
630
|
+
|
631
|
+
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]]]:
|
632
|
+
"""
|
633
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
634
|
+
|
635
|
+
User code call
|
636
|
+
-----------
|
637
|
+
@nim(
|
638
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
639
|
+
backend='managed'
|
640
|
+
)
|
641
|
+
|
642
|
+
Valid backend options
|
643
|
+
---------------------
|
644
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
645
|
+
|
646
|
+
Valid model options
|
647
|
+
----------------
|
648
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
649
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
650
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
651
|
+
|
652
|
+
|
653
|
+
Parameters
|
654
|
+
----------
|
655
|
+
models: list[NIM]
|
656
|
+
List of NIM containers running models in sidecars.
|
657
|
+
backend: str
|
658
|
+
Compute provider to run the NIM container.
|
659
|
+
queue_timeout : int
|
660
|
+
Time to keep the job in NVCF's queue.
|
655
661
|
"""
|
656
662
|
...
|
657
663
|
|
658
664
|
@typing.overload
|
659
|
-
def
|
665
|
+
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]]]:
|
666
|
+
"""
|
667
|
+
Enables loading / saving of models within a step.
|
668
|
+
|
669
|
+
|
670
|
+
|
671
|
+
Parameters
|
672
|
+
----------
|
673
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
674
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
675
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
676
|
+
- `current.checkpoint`
|
677
|
+
- `current.model`
|
678
|
+
- `current.huggingface_hub`
|
679
|
+
|
680
|
+
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
|
681
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
682
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
683
|
+
|
684
|
+
temp_dir_root : str, default: None
|
685
|
+
The root directory under which `current.model.loaded` will store loaded models
|
686
|
+
"""
|
660
687
|
...
|
661
688
|
|
662
689
|
@typing.overload
|
663
|
-
def
|
690
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
664
691
|
...
|
665
692
|
|
666
|
-
|
693
|
+
@typing.overload
|
694
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
695
|
+
...
|
696
|
+
|
697
|
+
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):
|
667
698
|
"""
|
668
|
-
|
699
|
+
Enables loading / saving of models within a step.
|
669
700
|
|
670
|
-
This decorator is useful if this step may hang indefinitely.
|
671
701
|
|
672
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
673
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
674
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
675
702
|
|
676
|
-
|
677
|
-
|
703
|
+
Parameters
|
704
|
+
----------
|
705
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
706
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
707
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
708
|
+
- `current.checkpoint`
|
709
|
+
- `current.model`
|
710
|
+
- `current.huggingface_hub`
|
711
|
+
|
712
|
+
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
|
713
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
714
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
715
|
+
|
716
|
+
temp_dir_root : str, default: None
|
717
|
+
The root directory under which `current.model.loaded` will store loaded models
|
718
|
+
"""
|
719
|
+
...
|
720
|
+
|
721
|
+
@typing.overload
|
722
|
+
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]]]:
|
723
|
+
"""
|
724
|
+
Specifies environment variables to be set prior to the execution of a step.
|
725
|
+
|
726
|
+
|
727
|
+
Parameters
|
728
|
+
----------
|
729
|
+
vars : Dict[str, str], default {}
|
730
|
+
Dictionary of environment variables to set.
|
731
|
+
"""
|
732
|
+
...
|
733
|
+
|
734
|
+
@typing.overload
|
735
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
736
|
+
...
|
737
|
+
|
738
|
+
@typing.overload
|
739
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
740
|
+
...
|
741
|
+
|
742
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
743
|
+
"""
|
744
|
+
Specifies environment variables to be set prior to the execution of a step.
|
745
|
+
|
746
|
+
|
747
|
+
Parameters
|
748
|
+
----------
|
749
|
+
vars : Dict[str, str], default {}
|
750
|
+
Dictionary of environment variables to set.
|
751
|
+
"""
|
752
|
+
...
|
753
|
+
|
754
|
+
@typing.overload
|
755
|
+
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]]]:
|
756
|
+
"""
|
757
|
+
Enables checkpointing for a step.
|
758
|
+
|
759
|
+
|
760
|
+
|
761
|
+
Parameters
|
762
|
+
----------
|
763
|
+
load_policy : str, default: "fresh"
|
764
|
+
The policy for loading the checkpoint. The following policies are supported:
|
765
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
766
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
767
|
+
will be loaded at the start of the task.
|
768
|
+
- "none": Do not load any checkpoint
|
769
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
770
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
771
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
772
|
+
created within the task will be loaded when the task is retries execution on failure.
|
773
|
+
|
774
|
+
temp_dir_root : str, default: None
|
775
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
776
|
+
"""
|
777
|
+
...
|
778
|
+
|
779
|
+
@typing.overload
|
780
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
781
|
+
...
|
782
|
+
|
783
|
+
@typing.overload
|
784
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
785
|
+
...
|
786
|
+
|
787
|
+
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):
|
788
|
+
"""
|
789
|
+
Enables checkpointing for a step.
|
790
|
+
|
678
791
|
|
679
792
|
|
680
793
|
Parameters
|
681
794
|
----------
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
795
|
+
load_policy : str, default: "fresh"
|
796
|
+
The policy for loading the checkpoint. The following policies are supported:
|
797
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
798
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
799
|
+
will be loaded at the start of the task.
|
800
|
+
- "none": Do not load any checkpoint
|
801
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
802
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
803
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
804
|
+
created within the task will be loaded when the task is retries execution on failure.
|
805
|
+
|
806
|
+
temp_dir_root : str, default: None
|
807
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
688
808
|
"""
|
689
809
|
...
|
690
810
|
|
@@ -765,39 +885,6 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
765
885
|
"""
|
766
886
|
...
|
767
887
|
|
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]]]:
|
769
|
-
"""
|
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.
|
784
|
-
|
785
|
-
Valid model options
|
786
|
-
----------------
|
787
|
-
- 'llama3.2'
|
788
|
-
- 'llama3.3'
|
789
|
-
- any model here https://ollama.com/search
|
790
|
-
|
791
|
-
|
792
|
-
Parameters
|
793
|
-
----------
|
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.
|
798
|
-
"""
|
799
|
-
...
|
800
|
-
|
801
888
|
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]]]:
|
802
889
|
"""
|
803
890
|
Specifies that this step should execute on DGX cloud.
|
@@ -850,243 +937,72 @@ def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
850
937
|
...
|
851
938
|
|
852
939
|
@typing.overload
|
853
|
-
def
|
854
|
-
"""
|
855
|
-
Specifies the number of times the task corresponding
|
856
|
-
to a step needs to be retried.
|
857
|
-
|
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.
|
865
|
-
|
866
|
-
|
867
|
-
Parameters
|
868
|
-
----------
|
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
|
922
|
-
and the value is the version to use.
|
923
|
-
python : str, optional, default: None
|
924
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
925
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
926
|
-
"""
|
927
|
-
...
|
928
|
-
|
929
|
-
@typing.overload
|
930
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
931
|
-
...
|
932
|
-
|
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):
|
938
|
-
"""
|
939
|
-
Specifies the PyPI packages for the step.
|
940
|
-
|
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.
|
945
|
-
|
946
|
-
|
947
|
-
Parameters
|
948
|
-
----------
|
949
|
-
packages : Dict[str, str], default: {}
|
950
|
-
Packages to use for this step. The key is the name of the package
|
951
|
-
and the value is the version to use.
|
952
|
-
python : str, optional, default: None
|
953
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
954
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
955
|
-
"""
|
956
|
-
...
|
957
|
-
|
958
|
-
@typing.overload
|
959
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
940
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
960
941
|
"""
|
961
|
-
Specifies the PyPI packages for all steps of the flow.
|
962
|
-
|
963
|
-
Use `@pypi_base` to set common packages required by all
|
964
|
-
steps and use `@pypi` to specify step-specific overrides.
|
965
|
-
|
966
942
|
Parameters
|
967
943
|
----------
|
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
944
|
"""
|
975
945
|
...
|
976
946
|
|
977
947
|
@typing.overload
|
978
|
-
def
|
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.
|
984
|
-
|
985
|
-
Use `@pypi_base` to set common packages required by all
|
986
|
-
steps and use `@pypi` to specify step-specific overrides.
|
987
|
-
|
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
|
-
"""
|
948
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
997
949
|
...
|
998
950
|
|
999
|
-
def
|
951
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1000
952
|
"""
|
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.
|
1003
|
-
|
1004
|
-
|
1005
953
|
Parameters
|
1006
954
|
----------
|
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)
|
1039
955
|
"""
|
1040
956
|
...
|
1041
957
|
|
1042
958
|
@typing.overload
|
1043
|
-
def
|
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]]:
|
1044
960
|
"""
|
1045
|
-
Specifies the
|
1046
|
-
|
1047
|
-
Use `@conda_base` to set common libraries required by all
|
1048
|
-
steps and use `@conda` to specify step-specific additions.
|
961
|
+
Specifies the times when the flow should be run when running on a
|
962
|
+
production scheduler.
|
1049
963
|
|
1050
964
|
|
1051
965
|
Parameters
|
1052
966
|
----------
|
1053
|
-
|
1054
|
-
|
1055
|
-
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
967
|
+
hourly : bool, default False
|
968
|
+
Run the workflow hourly.
|
969
|
+
daily : bool, default True
|
970
|
+
Run the workflow daily.
|
971
|
+
weekly : bool, default False
|
972
|
+
Run the workflow weekly.
|
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).
|
1063
979
|
"""
|
1064
980
|
...
|
1065
981
|
|
1066
982
|
@typing.overload
|
1067
|
-
def
|
983
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1068
984
|
...
|
1069
985
|
|
1070
|
-
def
|
986
|
+
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):
|
1071
987
|
"""
|
1072
|
-
Specifies the
|
1073
|
-
|
1074
|
-
Use `@conda_base` to set common libraries required by all
|
1075
|
-
steps and use `@conda` to specify step-specific additions.
|
988
|
+
Specifies the times when the flow should be run when running on a
|
989
|
+
production scheduler.
|
1076
990
|
|
1077
991
|
|
1078
992
|
Parameters
|
1079
993
|
----------
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
994
|
+
hourly : bool, default False
|
995
|
+
Run the workflow hourly.
|
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).
|
1090
1006
|
"""
|
1091
1007
|
...
|
1092
1008
|
|
@@ -1183,41 +1099,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1183
1099
|
"""
|
1184
1100
|
...
|
1185
1101
|
|
1186
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1187
|
-
"""
|
1188
|
-
Specifies what flows belong to the same project.
|
1189
|
-
|
1190
|
-
A project-specific namespace is created for all flows that
|
1191
|
-
use the same `@project(name)`.
|
1192
|
-
|
1193
|
-
|
1194
|
-
Parameters
|
1195
|
-
----------
|
1196
|
-
name : str
|
1197
|
-
Project name. Make sure that the name is unique amongst all
|
1198
|
-
projects that use the same production scheduler. The name may
|
1199
|
-
contain only lowercase alphanumeric characters and underscores.
|
1200
|
-
|
1201
|
-
branch : Optional[str], default None
|
1202
|
-
The branch to use. If not specified, the branch is set to
|
1203
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1204
|
-
also be set on the command line using `--branch` as a top-level option.
|
1205
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1206
|
-
|
1207
|
-
production : bool, default False
|
1208
|
-
Whether or not the branch is the production branch. This can also be set on the
|
1209
|
-
command line using `--production` as a top-level option. It is an error to specify
|
1210
|
-
`production` in the decorator and on the command line.
|
1211
|
-
The project branch name will be:
|
1212
|
-
- if `branch` is specified:
|
1213
|
-
- if `production` is True: `prod.<branch>`
|
1214
|
-
- if `production` is False: `test.<branch>`
|
1215
|
-
- if `branch` is not specified:
|
1216
|
-
- if `production` is True: `prod`
|
1217
|
-
- if `production` is False: `user.<username>`
|
1218
|
-
"""
|
1219
|
-
...
|
1220
|
-
|
1221
1102
|
@typing.overload
|
1222
1103
|
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
1104
|
"""
|
@@ -1319,6 +1200,82 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1319
1200
|
"""
|
1320
1201
|
...
|
1321
1202
|
|
1203
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1204
|
+
"""
|
1205
|
+
Specifies what flows belong to the same project.
|
1206
|
+
|
1207
|
+
A project-specific namespace is created for all flows that
|
1208
|
+
use the same `@project(name)`.
|
1209
|
+
|
1210
|
+
|
1211
|
+
Parameters
|
1212
|
+
----------
|
1213
|
+
name : str
|
1214
|
+
Project name. Make sure that the name is unique amongst all
|
1215
|
+
projects that use the same production scheduler. The name may
|
1216
|
+
contain only lowercase alphanumeric characters and underscores.
|
1217
|
+
|
1218
|
+
branch : Optional[str], default None
|
1219
|
+
The branch to use. If not specified, the branch is set to
|
1220
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1221
|
+
also be set on the command line using `--branch` as a top-level option.
|
1222
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1223
|
+
|
1224
|
+
production : bool, default False
|
1225
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1226
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1227
|
+
`production` in the decorator and on the command line.
|
1228
|
+
The project branch name will be:
|
1229
|
+
- if `branch` is specified:
|
1230
|
+
- if `production` is True: `prod.<branch>`
|
1231
|
+
- if `production` is False: `test.<branch>`
|
1232
|
+
- if `branch` is not specified:
|
1233
|
+
- if `production` is True: `prod`
|
1234
|
+
- if `production` is False: `user.<username>`
|
1235
|
+
"""
|
1236
|
+
...
|
1237
|
+
|
1238
|
+
@typing.overload
|
1239
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1240
|
+
"""
|
1241
|
+
Specifies the PyPI packages for all steps of the flow.
|
1242
|
+
|
1243
|
+
Use `@pypi_base` to set common packages required by all
|
1244
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1245
|
+
|
1246
|
+
Parameters
|
1247
|
+
----------
|
1248
|
+
packages : Dict[str, str], default: {}
|
1249
|
+
Packages to use for this flow. The key is the name of the package
|
1250
|
+
and the value is the version to use.
|
1251
|
+
python : str, optional, default: None
|
1252
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1253
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1254
|
+
"""
|
1255
|
+
...
|
1256
|
+
|
1257
|
+
@typing.overload
|
1258
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1259
|
+
...
|
1260
|
+
|
1261
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1262
|
+
"""
|
1263
|
+
Specifies the PyPI packages for all steps of the flow.
|
1264
|
+
|
1265
|
+
Use `@pypi_base` to set common packages required by all
|
1266
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1267
|
+
|
1268
|
+
Parameters
|
1269
|
+
----------
|
1270
|
+
packages : Dict[str, str], default: {}
|
1271
|
+
Packages to use for this flow. The key is the name of the package
|
1272
|
+
and the value is the version to use.
|
1273
|
+
python : str, optional, default: None
|
1274
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1275
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1276
|
+
"""
|
1277
|
+
...
|
1278
|
+
|
1322
1279
|
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]]:
|
1323
1280
|
"""
|
1324
1281
|
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)
|
@@ -1362,54 +1319,97 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1362
1319
|
"""
|
1363
1320
|
...
|
1364
1321
|
|
1322
|
+
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]]:
|
1323
|
+
"""
|
1324
|
+
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.
|
1325
|
+
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.
|
1326
|
+
|
1327
|
+
|
1328
|
+
Parameters
|
1329
|
+
----------
|
1330
|
+
timeout : int
|
1331
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1332
|
+
poke_interval : int
|
1333
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1334
|
+
mode : str
|
1335
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1336
|
+
exponential_backoff : bool
|
1337
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1338
|
+
pool : str
|
1339
|
+
the slot pool this task should run in,
|
1340
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1341
|
+
soft_fail : bool
|
1342
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1343
|
+
name : str
|
1344
|
+
Name of the sensor on Airflow
|
1345
|
+
description : str
|
1346
|
+
Description of sensor in the Airflow UI
|
1347
|
+
external_dag_id : str
|
1348
|
+
The dag_id that contains the task you want to wait for.
|
1349
|
+
external_task_ids : List[str]
|
1350
|
+
The list of task_ids that you want to wait for.
|
1351
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1352
|
+
allowed_states : List[str]
|
1353
|
+
Iterable of allowed states, (Default: ['success'])
|
1354
|
+
failed_states : List[str]
|
1355
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1356
|
+
execution_delta : datetime.timedelta
|
1357
|
+
time difference with the previous execution to look at,
|
1358
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1359
|
+
check_existence: bool
|
1360
|
+
Set to True to check if the external task exists or check if
|
1361
|
+
the DAG to wait for exists. (Default: True)
|
1362
|
+
"""
|
1363
|
+
...
|
1364
|
+
|
1365
1365
|
@typing.overload
|
1366
|
-
def
|
1366
|
+
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]]:
|
1367
1367
|
"""
|
1368
|
-
Specifies the
|
1369
|
-
|
1368
|
+
Specifies the Conda environment for all steps of the flow.
|
1369
|
+
|
1370
|
+
Use `@conda_base` to set common libraries required by all
|
1371
|
+
steps and use `@conda` to specify step-specific additions.
|
1370
1372
|
|
1371
1373
|
|
1372
1374
|
Parameters
|
1373
1375
|
----------
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
1381
|
-
|
1382
|
-
|
1383
|
-
|
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).
|
1376
|
+
packages : Dict[str, str], default {}
|
1377
|
+
Packages to use for this flow. The key is the name of the package
|
1378
|
+
and the value is the version to use.
|
1379
|
+
libraries : Dict[str, str], default {}
|
1380
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1381
|
+
python : str, optional, default None
|
1382
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1383
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1384
|
+
disabled : bool, default False
|
1385
|
+
If set to True, disables Conda.
|
1386
1386
|
"""
|
1387
1387
|
...
|
1388
1388
|
|
1389
1389
|
@typing.overload
|
1390
|
-
def
|
1390
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1391
1391
|
...
|
1392
1392
|
|
1393
|
-
def
|
1393
|
+
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):
|
1394
1394
|
"""
|
1395
|
-
Specifies the
|
1396
|
-
|
1395
|
+
Specifies the Conda environment for all steps of the flow.
|
1396
|
+
|
1397
|
+
Use `@conda_base` to set common libraries required by all
|
1398
|
+
steps and use `@conda` to specify step-specific additions.
|
1397
1399
|
|
1398
1400
|
|
1399
1401
|
Parameters
|
1400
1402
|
----------
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
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).
|
1403
|
+
packages : Dict[str, str], default {}
|
1404
|
+
Packages to use for this flow. The key is the name of the package
|
1405
|
+
and the value is the version to use.
|
1406
|
+
libraries : Dict[str, str], default {}
|
1407
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1408
|
+
python : str, optional, default None
|
1409
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1410
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1411
|
+
disabled : bool, default False
|
1412
|
+
If set to True, disables Conda.
|
1413
1413
|
"""
|
1414
1414
|
...
|
1415
1415
|
|