ob-metaflow-stubs 6.0.3.146__py2.py3-none-any.whl → 6.0.3.148__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 +715 -716
- 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 +3 -3
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +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 +2 -2
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +4 -2
- metaflow-stubs/metaflow_current.pyi +90 -90
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
- 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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +15 -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 +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +4 -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 +2 -2
- 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 +4 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/parsers.pyi +113 -0
- 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 +2 -2
- 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 +2 -2
- 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 +4 -4
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +4 -4
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.3.146.dist-info → ob_metaflow_stubs-6.0.3.148.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.148.dist-info/RECORD +198 -0
- ob_metaflow_stubs-6.0.3.146.dist-info/RECORD +0 -197
- {ob_metaflow_stubs-6.0.3.146.dist-info → ob_metaflow_stubs-6.0.3.148.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.146.dist-info → ob_metaflow_stubs-6.0.3.148.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.15.
|
4
|
-
# Generated on 2025-
|
3
|
+
# MF version: 2.15.3.1+obcheckpoint(0.1.9);ob(v1) #
|
4
|
+
# Generated on 2025-03-03T22:55:42.139654 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import datetime
|
12
11
|
import typing
|
12
|
+
import datetime
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -35,14 +35,17 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import tuple_util as tuple_util
|
39
38
|
from . import cards as cards
|
39
|
+
from . import tuple_util as tuple_util
|
40
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
|
44
44
|
from . import includefile as includefile
|
45
45
|
from .includefile import IncludeFile as IncludeFile
|
46
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
47
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
48
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
46
49
|
from . import client as client
|
47
50
|
from .client.core import namespace as namespace
|
48
51
|
from .client.core import get_namespace as get_namespace
|
@@ -146,201 +149,219 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
146
149
|
"""
|
147
150
|
...
|
148
151
|
|
149
|
-
|
150
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
152
|
+
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]]]:
|
151
153
|
"""
|
154
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
155
|
+
|
156
|
+
User code call
|
157
|
+
-----------
|
158
|
+
@nim(
|
159
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
160
|
+
backend='managed'
|
161
|
+
)
|
162
|
+
|
163
|
+
Valid backend options
|
164
|
+
---------------------
|
165
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
166
|
+
|
167
|
+
Valid model options
|
168
|
+
----------------
|
169
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
170
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
171
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
172
|
+
|
173
|
+
|
152
174
|
Parameters
|
153
175
|
----------
|
176
|
+
models: list[NIM]
|
177
|
+
List of NIM containers running models in sidecars.
|
178
|
+
backend: str
|
179
|
+
Compute provider to run the NIM container.
|
180
|
+
queue_timeout : int
|
181
|
+
Time to keep the job in NVCF's queue.
|
154
182
|
"""
|
155
183
|
...
|
156
184
|
|
157
|
-
|
158
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
159
|
-
...
|
160
|
-
|
161
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
185
|
+
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]]]:
|
162
186
|
"""
|
187
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
188
|
+
|
189
|
+
User code call
|
190
|
+
-----------
|
191
|
+
@ollama(
|
192
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
193
|
+
backend='local'
|
194
|
+
)
|
195
|
+
|
196
|
+
Valid backend options
|
197
|
+
---------------------
|
198
|
+
- 'local': Run as a separate process on the local task machine.
|
199
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
200
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
201
|
+
|
202
|
+
Valid model options
|
203
|
+
----------------
|
204
|
+
- 'llama3.2'
|
205
|
+
- 'llama3.3'
|
206
|
+
- any model here https://ollama.com/search
|
207
|
+
|
208
|
+
|
163
209
|
Parameters
|
164
210
|
----------
|
211
|
+
models: list[Ollama]
|
212
|
+
List of Ollama containers running models in sidecars.
|
213
|
+
backend: str
|
214
|
+
Determines where and how to run the Ollama process.
|
165
215
|
"""
|
166
216
|
...
|
167
217
|
|
168
218
|
@typing.overload
|
169
|
-
def
|
219
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
170
220
|
"""
|
171
|
-
|
172
|
-
|
173
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
174
|
-
|
175
|
-
|
176
|
-
Parameters
|
177
|
-
----------
|
178
|
-
type : str, default 'default'
|
179
|
-
Card type.
|
180
|
-
id : str, optional, default None
|
181
|
-
If multiple cards are present, use this id to identify this card.
|
182
|
-
options : Dict[str, Any], default {}
|
183
|
-
Options passed to the card. The contents depend on the card type.
|
184
|
-
timeout : int, default 45
|
185
|
-
Interrupt reporting if it takes more than this many seconds.
|
221
|
+
Decorator prototype for all step decorators. This function gets specialized
|
222
|
+
and imported for all decorators types by _import_plugin_decorators().
|
186
223
|
"""
|
187
224
|
...
|
188
225
|
|
189
226
|
@typing.overload
|
190
|
-
def
|
227
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
191
228
|
...
|
192
229
|
|
193
|
-
|
194
|
-
|
230
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
231
|
+
"""
|
232
|
+
Decorator prototype for all step decorators. This function gets specialized
|
233
|
+
and imported for all decorators types by _import_plugin_decorators().
|
234
|
+
"""
|
195
235
|
...
|
196
236
|
|
197
|
-
def
|
237
|
+
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]]]:
|
198
238
|
"""
|
199
|
-
|
200
|
-
|
201
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
239
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
202
240
|
|
203
241
|
|
204
242
|
Parameters
|
205
243
|
----------
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
244
|
+
temp_dir_root : str, optional
|
245
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
246
|
+
|
247
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
248
|
+
The list of repos (models/datasets) to load.
|
249
|
+
|
250
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
251
|
+
|
252
|
+
- If repo (model/dataset) is not found in the datastore:
|
253
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
254
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
255
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
256
|
+
|
257
|
+
- If repo is found in the datastore:
|
258
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
214
259
|
"""
|
215
260
|
...
|
216
261
|
|
217
262
|
@typing.overload
|
218
|
-
def
|
263
|
+
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]]]:
|
219
264
|
"""
|
220
|
-
Specifies the
|
221
|
-
|
222
|
-
Use `@resources` to specify the resource requirements
|
223
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
265
|
+
Specifies that the step will success under all circumstances.
|
224
266
|
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
or
|
230
|
-
```
|
231
|
-
python myflow.py run --with kubernetes
|
232
|
-
```
|
233
|
-
which executes the flow on the desired system using the
|
234
|
-
requirements specified in `@resources`.
|
267
|
+
The decorator will create an optional artifact, specified by `var`, which
|
268
|
+
contains the exception raised. You can use it to detect the presence
|
269
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
270
|
+
are missing.
|
235
271
|
|
236
272
|
|
237
273
|
Parameters
|
238
274
|
----------
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
memory : int, default 4096
|
246
|
-
Memory size (in MB) required for this step.
|
247
|
-
shared_memory : int, optional, default None
|
248
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
249
|
-
This parameter maps to the `--shm-size` option in Docker.
|
275
|
+
var : str, optional, default None
|
276
|
+
Name of the artifact in which to store the caught exception.
|
277
|
+
If not specified, the exception is not stored.
|
278
|
+
print_exception : bool, default True
|
279
|
+
Determines whether or not the exception is printed to
|
280
|
+
stdout when caught.
|
250
281
|
"""
|
251
282
|
...
|
252
283
|
|
253
284
|
@typing.overload
|
254
|
-
def
|
285
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
255
286
|
...
|
256
287
|
|
257
288
|
@typing.overload
|
258
|
-
def
|
289
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
259
290
|
...
|
260
291
|
|
261
|
-
def
|
292
|
+
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):
|
262
293
|
"""
|
263
|
-
Specifies the
|
264
|
-
|
265
|
-
Use `@resources` to specify the resource requirements
|
266
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
294
|
+
Specifies that the step will success under all circumstances.
|
267
295
|
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
|
272
|
-
or
|
273
|
-
```
|
274
|
-
python myflow.py run --with kubernetes
|
275
|
-
```
|
276
|
-
which executes the flow on the desired system using the
|
277
|
-
requirements specified in `@resources`.
|
296
|
+
The decorator will create an optional artifact, specified by `var`, which
|
297
|
+
contains the exception raised. You can use it to detect the presence
|
298
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
299
|
+
are missing.
|
278
300
|
|
279
301
|
|
280
302
|
Parameters
|
281
303
|
----------
|
282
|
-
|
283
|
-
|
284
|
-
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
memory : int, default 4096
|
289
|
-
Memory size (in MB) required for this step.
|
290
|
-
shared_memory : int, optional, default None
|
291
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
292
|
-
This parameter maps to the `--shm-size` option in Docker.
|
304
|
+
var : str, optional, default None
|
305
|
+
Name of the artifact in which to store the caught exception.
|
306
|
+
If not specified, the exception is not stored.
|
307
|
+
print_exception : bool, default True
|
308
|
+
Determines whether or not the exception is printed to
|
309
|
+
stdout when caught.
|
293
310
|
"""
|
294
311
|
...
|
295
312
|
|
296
313
|
@typing.overload
|
297
|
-
def
|
314
|
+
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]]]:
|
298
315
|
"""
|
299
|
-
Specifies the
|
316
|
+
Specifies the number of times the task corresponding
|
317
|
+
to a step needs to be retried.
|
300
318
|
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
319
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
320
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
321
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
322
|
+
|
323
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
324
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
325
|
+
ensuring that the flow execution can continue.
|
305
326
|
|
306
327
|
|
307
328
|
Parameters
|
308
329
|
----------
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
314
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
330
|
+
times : int, default 3
|
331
|
+
Number of times to retry this task.
|
332
|
+
minutes_between_retries : int, default 2
|
333
|
+
Number of minutes between retries.
|
315
334
|
"""
|
316
335
|
...
|
317
336
|
|
318
337
|
@typing.overload
|
319
|
-
def
|
338
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
320
339
|
...
|
321
340
|
|
322
341
|
@typing.overload
|
323
|
-
def
|
342
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
324
343
|
...
|
325
344
|
|
326
|
-
def
|
345
|
+
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):
|
327
346
|
"""
|
328
|
-
Specifies the
|
347
|
+
Specifies the number of times the task corresponding
|
348
|
+
to a step needs to be retried.
|
329
349
|
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
350
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
351
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
352
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
353
|
+
|
354
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
355
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
356
|
+
ensuring that the flow execution can continue.
|
334
357
|
|
335
358
|
|
336
359
|
Parameters
|
337
360
|
----------
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
343
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
361
|
+
times : int, default 3
|
362
|
+
Number of times to retry this task.
|
363
|
+
minutes_between_retries : int, default 2
|
364
|
+
Number of minutes between retries.
|
344
365
|
"""
|
345
366
|
...
|
346
367
|
|
@@ -421,166 +442,6 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
421
442
|
"""
|
422
443
|
...
|
423
444
|
|
424
|
-
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]]]:
|
425
|
-
"""
|
426
|
-
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
427
|
-
|
428
|
-
|
429
|
-
Parameters
|
430
|
-
----------
|
431
|
-
temp_dir_root : str, optional
|
432
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
433
|
-
|
434
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
435
|
-
The list of repos (models/datasets) to load.
|
436
|
-
|
437
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
438
|
-
|
439
|
-
- If repo (model/dataset) is not found in the datastore:
|
440
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
441
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
442
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
443
|
-
|
444
|
-
- If repo is found in the datastore:
|
445
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
446
|
-
"""
|
447
|
-
...
|
448
|
-
|
449
|
-
@typing.overload
|
450
|
-
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]]]:
|
451
|
-
"""
|
452
|
-
Specifies the number of times the task corresponding
|
453
|
-
to a step needs to be retried.
|
454
|
-
|
455
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
456
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
457
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
458
|
-
|
459
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
460
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
461
|
-
ensuring that the flow execution can continue.
|
462
|
-
|
463
|
-
|
464
|
-
Parameters
|
465
|
-
----------
|
466
|
-
times : int, default 3
|
467
|
-
Number of times to retry this task.
|
468
|
-
minutes_between_retries : int, default 2
|
469
|
-
Number of minutes between retries.
|
470
|
-
"""
|
471
|
-
...
|
472
|
-
|
473
|
-
@typing.overload
|
474
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
475
|
-
...
|
476
|
-
|
477
|
-
@typing.overload
|
478
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
479
|
-
...
|
480
|
-
|
481
|
-
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):
|
482
|
-
"""
|
483
|
-
Specifies the number of times the task corresponding
|
484
|
-
to a step needs to be retried.
|
485
|
-
|
486
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
487
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
488
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
489
|
-
|
490
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
491
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
492
|
-
ensuring that the flow execution can continue.
|
493
|
-
|
494
|
-
|
495
|
-
Parameters
|
496
|
-
----------
|
497
|
-
times : int, default 3
|
498
|
-
Number of times to retry this task.
|
499
|
-
minutes_between_retries : int, default 2
|
500
|
-
Number of minutes between retries.
|
501
|
-
"""
|
502
|
-
...
|
503
|
-
|
504
|
-
@typing.overload
|
505
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
506
|
-
"""
|
507
|
-
Internal decorator to support Fast bakery
|
508
|
-
Parameters
|
509
|
-
----------
|
510
|
-
"""
|
511
|
-
...
|
512
|
-
|
513
|
-
@typing.overload
|
514
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
515
|
-
...
|
516
|
-
|
517
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
518
|
-
"""
|
519
|
-
Internal decorator to support Fast bakery
|
520
|
-
Parameters
|
521
|
-
----------
|
522
|
-
"""
|
523
|
-
...
|
524
|
-
|
525
|
-
@typing.overload
|
526
|
-
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]]]:
|
527
|
-
"""
|
528
|
-
Specifies a timeout for your step.
|
529
|
-
|
530
|
-
This decorator is useful if this step may hang indefinitely.
|
531
|
-
|
532
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
533
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
534
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
535
|
-
|
536
|
-
Note that all the values specified in parameters are added together so if you specify
|
537
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
538
|
-
|
539
|
-
|
540
|
-
Parameters
|
541
|
-
----------
|
542
|
-
seconds : int, default 0
|
543
|
-
Number of seconds to wait prior to timing out.
|
544
|
-
minutes : int, default 0
|
545
|
-
Number of minutes to wait prior to timing out.
|
546
|
-
hours : int, default 0
|
547
|
-
Number of hours to wait prior to timing out.
|
548
|
-
"""
|
549
|
-
...
|
550
|
-
|
551
|
-
@typing.overload
|
552
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
553
|
-
...
|
554
|
-
|
555
|
-
@typing.overload
|
556
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
557
|
-
...
|
558
|
-
|
559
|
-
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):
|
560
|
-
"""
|
561
|
-
Specifies a timeout for your step.
|
562
|
-
|
563
|
-
This decorator is useful if this step may hang indefinitely.
|
564
|
-
|
565
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
566
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
567
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
568
|
-
|
569
|
-
Note that all the values specified in parameters are added together so if you specify
|
570
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
571
|
-
|
572
|
-
|
573
|
-
Parameters
|
574
|
-
----------
|
575
|
-
seconds : int, default 0
|
576
|
-
Number of seconds to wait prior to timing out.
|
577
|
-
minutes : int, default 0
|
578
|
-
Number of minutes to wait prior to timing out.
|
579
|
-
hours : int, default 0
|
580
|
-
Number of hours to wait prior to timing out.
|
581
|
-
"""
|
582
|
-
...
|
583
|
-
|
584
445
|
@typing.overload
|
585
446
|
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]]]:
|
586
447
|
"""
|
@@ -656,194 +517,120 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
|
|
656
517
|
"""
|
657
518
|
...
|
658
519
|
|
659
|
-
|
520
|
+
@typing.overload
|
521
|
+
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]]]:
|
660
522
|
"""
|
661
|
-
|
662
|
-
|
663
|
-
User code call
|
664
|
-
-----------
|
665
|
-
@nim(
|
666
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
667
|
-
backend='managed'
|
668
|
-
)
|
669
|
-
|
670
|
-
Valid backend options
|
671
|
-
---------------------
|
672
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
523
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
673
524
|
|
674
|
-
|
675
|
-
----------------
|
676
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
677
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
678
|
-
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
525
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
679
526
|
|
680
527
|
|
681
528
|
Parameters
|
682
529
|
----------
|
683
|
-
|
684
|
-
|
685
|
-
|
686
|
-
|
687
|
-
|
688
|
-
|
530
|
+
type : str, default 'default'
|
531
|
+
Card type.
|
532
|
+
id : str, optional, default None
|
533
|
+
If multiple cards are present, use this id to identify this card.
|
534
|
+
options : Dict[str, Any], default {}
|
535
|
+
Options passed to the card. The contents depend on the card type.
|
536
|
+
timeout : int, default 45
|
537
|
+
Interrupt reporting if it takes more than this many seconds.
|
689
538
|
"""
|
690
539
|
...
|
691
540
|
|
692
541
|
@typing.overload
|
693
|
-
def
|
542
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
543
|
+
...
|
544
|
+
|
545
|
+
@typing.overload
|
546
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
547
|
+
...
|
548
|
+
|
549
|
+
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):
|
694
550
|
"""
|
695
|
-
|
551
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
552
|
+
|
553
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
696
554
|
|
697
555
|
|
698
556
|
Parameters
|
699
557
|
----------
|
700
|
-
|
701
|
-
|
558
|
+
type : str, default 'default'
|
559
|
+
Card type.
|
560
|
+
id : str, optional, default None
|
561
|
+
If multiple cards are present, use this id to identify this card.
|
562
|
+
options : Dict[str, Any], default {}
|
563
|
+
Options passed to the card. The contents depend on the card type.
|
564
|
+
timeout : int, default 45
|
565
|
+
Interrupt reporting if it takes more than this many seconds.
|
702
566
|
"""
|
703
567
|
...
|
704
568
|
|
705
569
|
@typing.overload
|
706
|
-
def
|
570
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
571
|
+
"""
|
572
|
+
Internal decorator to support Fast bakery
|
573
|
+
"""
|
707
574
|
...
|
708
575
|
|
709
576
|
@typing.overload
|
710
|
-
def
|
577
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
711
578
|
...
|
712
579
|
|
713
|
-
def
|
580
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
714
581
|
"""
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
Parameters
|
719
|
-
----------
|
720
|
-
vars : Dict[str, str], default {}
|
721
|
-
Dictionary of environment variables to set.
|
582
|
+
Internal decorator to support Fast bakery
|
722
583
|
"""
|
723
584
|
...
|
724
585
|
|
725
586
|
@typing.overload
|
726
|
-
def
|
587
|
+
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]]]:
|
727
588
|
"""
|
728
|
-
|
589
|
+
Specifies the PyPI packages for the step.
|
729
590
|
|
591
|
+
Information in this decorator will augment any
|
592
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
593
|
+
you can use `@pypi_base` to set packages required by all
|
594
|
+
steps and use `@pypi` to specify step-specific overrides.
|
730
595
|
|
731
596
|
|
732
597
|
Parameters
|
733
598
|
----------
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
741
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
742
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
743
|
-
created within the task will be loaded when the task is retries execution on failure.
|
744
|
-
|
745
|
-
temp_dir_root : str, default: None
|
746
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
747
|
-
"""
|
748
|
-
...
|
749
|
-
|
750
|
-
@typing.overload
|
751
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
752
|
-
...
|
753
|
-
|
754
|
-
@typing.overload
|
755
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
756
|
-
...
|
757
|
-
|
758
|
-
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):
|
759
|
-
"""
|
760
|
-
Enables checkpointing for a step.
|
761
|
-
|
762
|
-
|
763
|
-
|
764
|
-
Parameters
|
765
|
-
----------
|
766
|
-
load_policy : str, default: "fresh"
|
767
|
-
The policy for loading the checkpoint. The following policies are supported:
|
768
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
769
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
770
|
-
will be loaded at the start of the task.
|
771
|
-
- "none": Do not load any checkpoint
|
772
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
773
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
774
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
775
|
-
created within the task will be loaded when the task is retries execution on failure.
|
776
|
-
|
777
|
-
temp_dir_root : str, default: None
|
778
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
779
|
-
"""
|
780
|
-
...
|
781
|
-
|
782
|
-
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]]]:
|
783
|
-
"""
|
784
|
-
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
785
|
-
|
786
|
-
User code call
|
787
|
-
-----------
|
788
|
-
@ollama(
|
789
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
790
|
-
backend='local'
|
791
|
-
)
|
792
|
-
|
793
|
-
Valid backend options
|
794
|
-
---------------------
|
795
|
-
- 'local': Run as a separate process on the local task machine.
|
796
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
797
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
798
|
-
|
799
|
-
Valid model options
|
800
|
-
----------------
|
801
|
-
- 'llama3.2'
|
802
|
-
- 'llama3.3'
|
803
|
-
- any model here https://ollama.com/search
|
804
|
-
|
805
|
-
|
806
|
-
Parameters
|
807
|
-
----------
|
808
|
-
models: list[Ollama]
|
809
|
-
List of Ollama containers running models in sidecars.
|
810
|
-
backend: str
|
811
|
-
Determines where and how to run the Ollama process.
|
812
|
-
"""
|
813
|
-
...
|
814
|
-
|
815
|
-
@typing.overload
|
816
|
-
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]]]:
|
817
|
-
"""
|
818
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
819
|
-
the execution of a step.
|
820
|
-
|
821
|
-
|
822
|
-
Parameters
|
823
|
-
----------
|
824
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
825
|
-
List of secret specs, defining how the secrets are to be retrieved
|
599
|
+
packages : Dict[str, str], default: {}
|
600
|
+
Packages to use for this step. The key is the name of the package
|
601
|
+
and the value is the version to use.
|
602
|
+
python : str, optional, default: None
|
603
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
604
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
826
605
|
"""
|
827
606
|
...
|
828
607
|
|
829
608
|
@typing.overload
|
830
|
-
def
|
609
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
831
610
|
...
|
832
611
|
|
833
612
|
@typing.overload
|
834
|
-
def
|
613
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
835
614
|
...
|
836
615
|
|
837
|
-
def
|
616
|
+
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):
|
838
617
|
"""
|
839
|
-
Specifies
|
840
|
-
|
618
|
+
Specifies the PyPI packages for the step.
|
619
|
+
|
620
|
+
Information in this decorator will augment any
|
621
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
622
|
+
you can use `@pypi_base` to set packages required by all
|
623
|
+
steps and use `@pypi` to specify step-specific overrides.
|
841
624
|
|
842
625
|
|
843
626
|
Parameters
|
844
627
|
----------
|
845
|
-
|
846
|
-
|
628
|
+
packages : Dict[str, str], default: {}
|
629
|
+
Packages to use for this step. The key is the name of the package
|
630
|
+
and the value is the version to use.
|
631
|
+
python : str, optional, default: None
|
632
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
633
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
847
634
|
"""
|
848
635
|
...
|
849
636
|
|
@@ -905,139 +692,528 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
905
692
|
...
|
906
693
|
|
907
694
|
@typing.overload
|
908
|
-
def
|
695
|
+
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]]]:
|
909
696
|
"""
|
910
|
-
Specifies
|
911
|
-
|
912
|
-
The decorator will create an optional artifact, specified by `var`, which
|
913
|
-
contains the exception raised. You can use it to detect the presence
|
914
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
915
|
-
are missing.
|
697
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
698
|
+
the execution of a step.
|
916
699
|
|
917
700
|
|
918
701
|
Parameters
|
919
702
|
----------
|
920
|
-
|
921
|
-
|
922
|
-
If not specified, the exception is not stored.
|
923
|
-
print_exception : bool, default True
|
924
|
-
Determines whether or not the exception is printed to
|
925
|
-
stdout when caught.
|
703
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
704
|
+
List of secret specs, defining how the secrets are to be retrieved
|
926
705
|
"""
|
927
706
|
...
|
928
707
|
|
929
708
|
@typing.overload
|
930
|
-
def
|
709
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
931
710
|
...
|
932
711
|
|
933
712
|
@typing.overload
|
934
|
-
def
|
713
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
935
714
|
...
|
936
715
|
|
937
|
-
def
|
716
|
+
def secrets(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []):
|
938
717
|
"""
|
939
|
-
Specifies
|
940
|
-
|
941
|
-
The decorator will create an optional artifact, specified by `var`, which
|
942
|
-
contains the exception raised. You can use it to detect the presence
|
943
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
944
|
-
are missing.
|
718
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
719
|
+
the execution of a step.
|
945
720
|
|
946
721
|
|
947
722
|
Parameters
|
948
723
|
----------
|
949
|
-
|
950
|
-
|
951
|
-
If not specified, the exception is not stored.
|
952
|
-
print_exception : bool, default True
|
953
|
-
Determines whether or not the exception is printed to
|
954
|
-
stdout when caught.
|
724
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
725
|
+
List of secret specs, defining how the secrets are to be retrieved
|
955
726
|
"""
|
956
727
|
...
|
957
728
|
|
958
|
-
|
729
|
+
@typing.overload
|
730
|
+
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]]]:
|
959
731
|
"""
|
960
|
-
Specifies
|
732
|
+
Specifies a timeout for your step.
|
961
733
|
|
962
|
-
|
963
|
-
use the same `@project(name)`.
|
734
|
+
This decorator is useful if this step may hang indefinitely.
|
964
735
|
|
736
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
737
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
738
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
965
739
|
|
966
|
-
|
967
|
-
|
968
|
-
name : str
|
969
|
-
Project name. Make sure that the name is unique amongst all
|
970
|
-
projects that use the same production scheduler. The name may
|
971
|
-
contain only lowercase alphanumeric characters and underscores.
|
740
|
+
Note that all the values specified in parameters are added together so if you specify
|
741
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
972
742
|
|
973
|
-
branch : Optional[str], default None
|
974
|
-
The branch to use. If not specified, the branch is set to
|
975
|
-
`user.<username>` unless `production` is set to `True`. This can
|
976
|
-
also be set on the command line using `--branch` as a top-level option.
|
977
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
978
743
|
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
- if `branch` is not specified:
|
988
|
-
- if `production` is True: `prod`
|
989
|
-
- if `production` is False: `user.<username>`
|
744
|
+
Parameters
|
745
|
+
----------
|
746
|
+
seconds : int, default 0
|
747
|
+
Number of seconds to wait prior to timing out.
|
748
|
+
minutes : int, default 0
|
749
|
+
Number of minutes to wait prior to timing out.
|
750
|
+
hours : int, default 0
|
751
|
+
Number of hours to wait prior to timing out.
|
990
752
|
"""
|
991
753
|
...
|
992
754
|
|
993
755
|
@typing.overload
|
994
|
-
def
|
756
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
757
|
+
...
|
758
|
+
|
759
|
+
@typing.overload
|
760
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
761
|
+
...
|
762
|
+
|
763
|
+
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):
|
995
764
|
"""
|
996
|
-
Specifies
|
997
|
-
|
765
|
+
Specifies a timeout for your step.
|
766
|
+
|
767
|
+
This decorator is useful if this step may hang indefinitely.
|
768
|
+
|
769
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
770
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
771
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
772
|
+
|
773
|
+
Note that all the values specified in parameters are added together so if you specify
|
774
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
998
775
|
|
999
776
|
|
1000
777
|
Parameters
|
1001
778
|
----------
|
1002
|
-
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
cron : str, optional, default None
|
1009
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1010
|
-
specified by this expression.
|
1011
|
-
timezone : str, optional, default None
|
1012
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1013
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
779
|
+
seconds : int, default 0
|
780
|
+
Number of seconds to wait prior to timing out.
|
781
|
+
minutes : int, default 0
|
782
|
+
Number of minutes to wait prior to timing out.
|
783
|
+
hours : int, default 0
|
784
|
+
Number of hours to wait prior to timing out.
|
1014
785
|
"""
|
1015
786
|
...
|
1016
787
|
|
1017
788
|
@typing.overload
|
1018
|
-
def
|
1019
|
-
...
|
1020
|
-
|
1021
|
-
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):
|
789
|
+
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]]]:
|
1022
790
|
"""
|
1023
|
-
|
1024
|
-
|
791
|
+
Enables checkpointing for a step.
|
792
|
+
|
1025
793
|
|
1026
794
|
|
1027
795
|
Parameters
|
1028
796
|
----------
|
1029
|
-
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
797
|
+
load_policy : str, default: "fresh"
|
798
|
+
The policy for loading the checkpoint. The following policies are supported:
|
799
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
800
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
801
|
+
will be loaded at the start of the task.
|
802
|
+
- "none": Do not load any checkpoint
|
803
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
804
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
805
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
806
|
+
created within the task will be loaded when the task is retries execution on failure.
|
807
|
+
|
808
|
+
temp_dir_root : str, default: None
|
809
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
810
|
+
"""
|
811
|
+
...
|
812
|
+
|
813
|
+
@typing.overload
|
814
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
815
|
+
...
|
816
|
+
|
817
|
+
@typing.overload
|
818
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
819
|
+
...
|
820
|
+
|
821
|
+
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):
|
822
|
+
"""
|
823
|
+
Enables checkpointing for a step.
|
824
|
+
|
825
|
+
|
826
|
+
|
827
|
+
Parameters
|
828
|
+
----------
|
829
|
+
load_policy : str, default: "fresh"
|
830
|
+
The policy for loading the checkpoint. The following policies are supported:
|
831
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
832
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
833
|
+
will be loaded at the start of the task.
|
834
|
+
- "none": Do not load any checkpoint
|
835
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
836
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
837
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
838
|
+
created within the task will be loaded when the task is retries execution on failure.
|
839
|
+
|
840
|
+
temp_dir_root : str, default: None
|
841
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
842
|
+
"""
|
843
|
+
...
|
844
|
+
|
845
|
+
@typing.overload
|
846
|
+
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]]]:
|
847
|
+
"""
|
848
|
+
Specifies environment variables to be set prior to the execution of a step.
|
849
|
+
|
850
|
+
|
851
|
+
Parameters
|
852
|
+
----------
|
853
|
+
vars : Dict[str, str], default {}
|
854
|
+
Dictionary of environment variables to set.
|
855
|
+
"""
|
856
|
+
...
|
857
|
+
|
858
|
+
@typing.overload
|
859
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
860
|
+
...
|
861
|
+
|
862
|
+
@typing.overload
|
863
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
864
|
+
...
|
865
|
+
|
866
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
867
|
+
"""
|
868
|
+
Specifies environment variables to be set prior to the execution of a step.
|
869
|
+
|
870
|
+
|
871
|
+
Parameters
|
872
|
+
----------
|
873
|
+
vars : Dict[str, str], default {}
|
874
|
+
Dictionary of environment variables to set.
|
875
|
+
"""
|
876
|
+
...
|
877
|
+
|
878
|
+
@typing.overload
|
879
|
+
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]]]:
|
880
|
+
"""
|
881
|
+
Specifies the resources needed when executing this step.
|
882
|
+
|
883
|
+
Use `@resources` to specify the resource requirements
|
884
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
885
|
+
|
886
|
+
You can choose the compute layer on the command line by executing e.g.
|
887
|
+
```
|
888
|
+
python myflow.py run --with batch
|
889
|
+
```
|
890
|
+
or
|
891
|
+
```
|
892
|
+
python myflow.py run --with kubernetes
|
893
|
+
```
|
894
|
+
which executes the flow on the desired system using the
|
895
|
+
requirements specified in `@resources`.
|
896
|
+
|
897
|
+
|
898
|
+
Parameters
|
899
|
+
----------
|
900
|
+
cpu : int, default 1
|
901
|
+
Number of CPUs required for this step.
|
902
|
+
gpu : int, optional, default None
|
903
|
+
Number of GPUs required for this step.
|
904
|
+
disk : int, optional, default None
|
905
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
906
|
+
memory : int, default 4096
|
907
|
+
Memory size (in MB) required for this step.
|
908
|
+
shared_memory : int, optional, default None
|
909
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
910
|
+
This parameter maps to the `--shm-size` option in Docker.
|
911
|
+
"""
|
912
|
+
...
|
913
|
+
|
914
|
+
@typing.overload
|
915
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
916
|
+
...
|
917
|
+
|
918
|
+
@typing.overload
|
919
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
920
|
+
...
|
921
|
+
|
922
|
+
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):
|
923
|
+
"""
|
924
|
+
Specifies the resources needed when executing this step.
|
925
|
+
|
926
|
+
Use `@resources` to specify the resource requirements
|
927
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
928
|
+
|
929
|
+
You can choose the compute layer on the command line by executing e.g.
|
930
|
+
```
|
931
|
+
python myflow.py run --with batch
|
932
|
+
```
|
933
|
+
or
|
934
|
+
```
|
935
|
+
python myflow.py run --with kubernetes
|
936
|
+
```
|
937
|
+
which executes the flow on the desired system using the
|
938
|
+
requirements specified in `@resources`.
|
939
|
+
|
940
|
+
|
941
|
+
Parameters
|
942
|
+
----------
|
943
|
+
cpu : int, default 1
|
944
|
+
Number of CPUs required for this step.
|
945
|
+
gpu : int, optional, default None
|
946
|
+
Number of GPUs required for this step.
|
947
|
+
disk : int, optional, default None
|
948
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
949
|
+
memory : int, default 4096
|
950
|
+
Memory size (in MB) required for this step.
|
951
|
+
shared_memory : int, optional, default None
|
952
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
953
|
+
This parameter maps to the `--shm-size` option in Docker.
|
954
|
+
"""
|
955
|
+
...
|
956
|
+
|
957
|
+
@typing.overload
|
958
|
+
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]]:
|
959
|
+
"""
|
960
|
+
Specifies the flow(s) that this flow depends on.
|
961
|
+
|
962
|
+
```
|
963
|
+
@trigger_on_finish(flow='FooFlow')
|
964
|
+
```
|
965
|
+
or
|
966
|
+
```
|
967
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
968
|
+
```
|
969
|
+
This decorator respects the @project decorator and triggers the flow
|
970
|
+
when upstream runs within the same namespace complete successfully
|
971
|
+
|
972
|
+
Additionally, you can specify project aware upstream flow dependencies
|
973
|
+
by specifying the fully qualified project_flow_name.
|
974
|
+
```
|
975
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
976
|
+
```
|
977
|
+
or
|
978
|
+
```
|
979
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
980
|
+
```
|
981
|
+
|
982
|
+
You can also specify just the project or project branch (other values will be
|
983
|
+
inferred from the current project or project branch):
|
984
|
+
```
|
985
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
986
|
+
```
|
987
|
+
|
988
|
+
Note that `branch` is typically one of:
|
989
|
+
- `prod`
|
990
|
+
- `user.bob`
|
991
|
+
- `test.my_experiment`
|
992
|
+
- `prod.staging`
|
993
|
+
|
994
|
+
|
995
|
+
Parameters
|
996
|
+
----------
|
997
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
998
|
+
Upstream flow dependency for this flow.
|
999
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1000
|
+
Upstream flow dependencies for this flow.
|
1001
|
+
options : Dict[str, Any], default {}
|
1002
|
+
Backend-specific configuration for tuning eventing behavior.
|
1003
|
+
"""
|
1004
|
+
...
|
1005
|
+
|
1006
|
+
@typing.overload
|
1007
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1008
|
+
...
|
1009
|
+
|
1010
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1011
|
+
"""
|
1012
|
+
Specifies the flow(s) that this flow depends on.
|
1013
|
+
|
1014
|
+
```
|
1015
|
+
@trigger_on_finish(flow='FooFlow')
|
1016
|
+
```
|
1017
|
+
or
|
1018
|
+
```
|
1019
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1020
|
+
```
|
1021
|
+
This decorator respects the @project decorator and triggers the flow
|
1022
|
+
when upstream runs within the same namespace complete successfully
|
1023
|
+
|
1024
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1025
|
+
by specifying the fully qualified project_flow_name.
|
1026
|
+
```
|
1027
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1028
|
+
```
|
1029
|
+
or
|
1030
|
+
```
|
1031
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1032
|
+
```
|
1033
|
+
|
1034
|
+
You can also specify just the project or project branch (other values will be
|
1035
|
+
inferred from the current project or project branch):
|
1036
|
+
```
|
1037
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1038
|
+
```
|
1039
|
+
|
1040
|
+
Note that `branch` is typically one of:
|
1041
|
+
- `prod`
|
1042
|
+
- `user.bob`
|
1043
|
+
- `test.my_experiment`
|
1044
|
+
- `prod.staging`
|
1045
|
+
|
1046
|
+
|
1047
|
+
Parameters
|
1048
|
+
----------
|
1049
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1050
|
+
Upstream flow dependency for this flow.
|
1051
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1052
|
+
Upstream flow dependencies for this flow.
|
1053
|
+
options : Dict[str, Any], default {}
|
1054
|
+
Backend-specific configuration for tuning eventing behavior.
|
1055
|
+
"""
|
1056
|
+
...
|
1057
|
+
|
1058
|
+
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]]:
|
1059
|
+
"""
|
1060
|
+
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)
|
1061
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1062
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1063
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1064
|
+
starts only after all sensors finish.
|
1065
|
+
|
1066
|
+
|
1067
|
+
Parameters
|
1068
|
+
----------
|
1069
|
+
timeout : int
|
1070
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1071
|
+
poke_interval : int
|
1072
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1073
|
+
mode : str
|
1074
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1075
|
+
exponential_backoff : bool
|
1076
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1077
|
+
pool : str
|
1078
|
+
the slot pool this task should run in,
|
1079
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1080
|
+
soft_fail : bool
|
1081
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1082
|
+
name : str
|
1083
|
+
Name of the sensor on Airflow
|
1084
|
+
description : str
|
1085
|
+
Description of sensor in the Airflow UI
|
1086
|
+
bucket_key : Union[str, List[str]]
|
1087
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1088
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1089
|
+
bucket_name : str
|
1090
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1091
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1092
|
+
wildcard_match : bool
|
1093
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1094
|
+
aws_conn_id : str
|
1095
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1096
|
+
verify : bool
|
1097
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1098
|
+
"""
|
1099
|
+
...
|
1100
|
+
|
1101
|
+
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]]:
|
1102
|
+
"""
|
1103
|
+
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.
|
1104
|
+
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.
|
1105
|
+
|
1106
|
+
|
1107
|
+
Parameters
|
1108
|
+
----------
|
1109
|
+
timeout : int
|
1110
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1111
|
+
poke_interval : int
|
1112
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1113
|
+
mode : str
|
1114
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1115
|
+
exponential_backoff : bool
|
1116
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1117
|
+
pool : str
|
1118
|
+
the slot pool this task should run in,
|
1119
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1120
|
+
soft_fail : bool
|
1121
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1122
|
+
name : str
|
1123
|
+
Name of the sensor on Airflow
|
1124
|
+
description : str
|
1125
|
+
Description of sensor in the Airflow UI
|
1126
|
+
external_dag_id : str
|
1127
|
+
The dag_id that contains the task you want to wait for.
|
1128
|
+
external_task_ids : List[str]
|
1129
|
+
The list of task_ids that you want to wait for.
|
1130
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1131
|
+
allowed_states : List[str]
|
1132
|
+
Iterable of allowed states, (Default: ['success'])
|
1133
|
+
failed_states : List[str]
|
1134
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1135
|
+
execution_delta : datetime.timedelta
|
1136
|
+
time difference with the previous execution to look at,
|
1137
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1138
|
+
check_existence: bool
|
1139
|
+
Set to True to check if the external task exists or check if
|
1140
|
+
the DAG to wait for exists. (Default: True)
|
1141
|
+
"""
|
1142
|
+
...
|
1143
|
+
|
1144
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1145
|
+
"""
|
1146
|
+
Specifies what flows belong to the same project.
|
1147
|
+
|
1148
|
+
A project-specific namespace is created for all flows that
|
1149
|
+
use the same `@project(name)`.
|
1150
|
+
|
1151
|
+
|
1152
|
+
Parameters
|
1153
|
+
----------
|
1154
|
+
name : str
|
1155
|
+
Project name. Make sure that the name is unique amongst all
|
1156
|
+
projects that use the same production scheduler. The name may
|
1157
|
+
contain only lowercase alphanumeric characters and underscores.
|
1158
|
+
|
1159
|
+
branch : Optional[str], default None
|
1160
|
+
The branch to use. If not specified, the branch is set to
|
1161
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1162
|
+
also be set on the command line using `--branch` as a top-level option.
|
1163
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1164
|
+
|
1165
|
+
production : bool, default False
|
1166
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1167
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1168
|
+
`production` in the decorator and on the command line.
|
1169
|
+
The project branch name will be:
|
1170
|
+
- if `branch` is specified:
|
1171
|
+
- if `production` is True: `prod.<branch>`
|
1172
|
+
- if `production` is False: `test.<branch>`
|
1173
|
+
- if `branch` is not specified:
|
1174
|
+
- if `production` is True: `prod`
|
1175
|
+
- if `production` is False: `user.<username>`
|
1176
|
+
"""
|
1177
|
+
...
|
1178
|
+
|
1179
|
+
@typing.overload
|
1180
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1181
|
+
"""
|
1182
|
+
Specifies the PyPI packages for all steps of the flow.
|
1183
|
+
|
1184
|
+
Use `@pypi_base` to set common packages required by all
|
1185
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1186
|
+
|
1187
|
+
Parameters
|
1188
|
+
----------
|
1189
|
+
packages : Dict[str, str], default: {}
|
1190
|
+
Packages to use for this flow. The key is the name of the package
|
1191
|
+
and the value is the version to use.
|
1192
|
+
python : str, optional, default: None
|
1193
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1194
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1195
|
+
"""
|
1196
|
+
...
|
1197
|
+
|
1198
|
+
@typing.overload
|
1199
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1200
|
+
...
|
1201
|
+
|
1202
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1203
|
+
"""
|
1204
|
+
Specifies the PyPI packages for all steps of the flow.
|
1205
|
+
|
1206
|
+
Use `@pypi_base` to set common packages required by all
|
1207
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1208
|
+
|
1209
|
+
Parameters
|
1210
|
+
----------
|
1211
|
+
packages : Dict[str, str], default: {}
|
1212
|
+
Packages to use for this flow. The key is the name of the package
|
1213
|
+
and the value is the version to use.
|
1214
|
+
python : str, optional, default: None
|
1215
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1216
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1041
1217
|
"""
|
1042
1218
|
...
|
1043
1219
|
|
@@ -1134,147 +1310,54 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1134
1310
|
"""
|
1135
1311
|
...
|
1136
1312
|
|
1137
|
-
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]]:
|
1138
|
-
"""
|
1139
|
-
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.
|
1140
|
-
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.
|
1141
|
-
|
1142
|
-
|
1143
|
-
Parameters
|
1144
|
-
----------
|
1145
|
-
timeout : int
|
1146
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1147
|
-
poke_interval : int
|
1148
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1149
|
-
mode : str
|
1150
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1151
|
-
exponential_backoff : bool
|
1152
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1153
|
-
pool : str
|
1154
|
-
the slot pool this task should run in,
|
1155
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1156
|
-
soft_fail : bool
|
1157
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1158
|
-
name : str
|
1159
|
-
Name of the sensor on Airflow
|
1160
|
-
description : str
|
1161
|
-
Description of sensor in the Airflow UI
|
1162
|
-
external_dag_id : str
|
1163
|
-
The dag_id that contains the task you want to wait for.
|
1164
|
-
external_task_ids : List[str]
|
1165
|
-
The list of task_ids that you want to wait for.
|
1166
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1167
|
-
allowed_states : List[str]
|
1168
|
-
Iterable of allowed states, (Default: ['success'])
|
1169
|
-
failed_states : List[str]
|
1170
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1171
|
-
execution_delta : datetime.timedelta
|
1172
|
-
time difference with the previous execution to look at,
|
1173
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1174
|
-
check_existence: bool
|
1175
|
-
Set to True to check if the external task exists or check if
|
1176
|
-
the DAG to wait for exists. (Default: True)
|
1177
|
-
"""
|
1178
|
-
...
|
1179
|
-
|
1180
1313
|
@typing.overload
|
1181
|
-
def
|
1314
|
+
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]]:
|
1182
1315
|
"""
|
1183
|
-
Specifies the
|
1184
|
-
|
1185
|
-
```
|
1186
|
-
@trigger_on_finish(flow='FooFlow')
|
1187
|
-
```
|
1188
|
-
or
|
1189
|
-
```
|
1190
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1191
|
-
```
|
1192
|
-
This decorator respects the @project decorator and triggers the flow
|
1193
|
-
when upstream runs within the same namespace complete successfully
|
1194
|
-
|
1195
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1196
|
-
by specifying the fully qualified project_flow_name.
|
1197
|
-
```
|
1198
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1199
|
-
```
|
1200
|
-
or
|
1201
|
-
```
|
1202
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1203
|
-
```
|
1204
|
-
|
1205
|
-
You can also specify just the project or project branch (other values will be
|
1206
|
-
inferred from the current project or project branch):
|
1207
|
-
```
|
1208
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1209
|
-
```
|
1210
|
-
|
1211
|
-
Note that `branch` is typically one of:
|
1212
|
-
- `prod`
|
1213
|
-
- `user.bob`
|
1214
|
-
- `test.my_experiment`
|
1215
|
-
- `prod.staging`
|
1316
|
+
Specifies the times when the flow should be run when running on a
|
1317
|
+
production scheduler.
|
1216
1318
|
|
1217
1319
|
|
1218
1320
|
Parameters
|
1219
1321
|
----------
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1322
|
+
hourly : bool, default False
|
1323
|
+
Run the workflow hourly.
|
1324
|
+
daily : bool, default True
|
1325
|
+
Run the workflow daily.
|
1326
|
+
weekly : bool, default False
|
1327
|
+
Run the workflow weekly.
|
1328
|
+
cron : str, optional, default None
|
1329
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1330
|
+
specified by this expression.
|
1331
|
+
timezone : str, optional, default None
|
1332
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1333
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1226
1334
|
"""
|
1227
1335
|
...
|
1228
1336
|
|
1229
1337
|
@typing.overload
|
1230
|
-
def
|
1338
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1231
1339
|
...
|
1232
1340
|
|
1233
|
-
def
|
1341
|
+
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):
|
1234
1342
|
"""
|
1235
|
-
Specifies the
|
1236
|
-
|
1237
|
-
```
|
1238
|
-
@trigger_on_finish(flow='FooFlow')
|
1239
|
-
```
|
1240
|
-
or
|
1241
|
-
```
|
1242
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1243
|
-
```
|
1244
|
-
This decorator respects the @project decorator and triggers the flow
|
1245
|
-
when upstream runs within the same namespace complete successfully
|
1246
|
-
|
1247
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1248
|
-
by specifying the fully qualified project_flow_name.
|
1249
|
-
```
|
1250
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1251
|
-
```
|
1252
|
-
or
|
1253
|
-
```
|
1254
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1255
|
-
```
|
1256
|
-
|
1257
|
-
You can also specify just the project or project branch (other values will be
|
1258
|
-
inferred from the current project or project branch):
|
1259
|
-
```
|
1260
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1261
|
-
```
|
1262
|
-
|
1263
|
-
Note that `branch` is typically one of:
|
1264
|
-
- `prod`
|
1265
|
-
- `user.bob`
|
1266
|
-
- `test.my_experiment`
|
1267
|
-
- `prod.staging`
|
1343
|
+
Specifies the times when the flow should be run when running on a
|
1344
|
+
production scheduler.
|
1268
1345
|
|
1269
1346
|
|
1270
1347
|
Parameters
|
1271
1348
|
----------
|
1272
|
-
|
1273
|
-
|
1274
|
-
|
1275
|
-
|
1276
|
-
|
1277
|
-
|
1349
|
+
hourly : bool, default False
|
1350
|
+
Run the workflow hourly.
|
1351
|
+
daily : bool, default True
|
1352
|
+
Run the workflow daily.
|
1353
|
+
weekly : bool, default False
|
1354
|
+
Run the workflow weekly.
|
1355
|
+
cron : str, optional, default None
|
1356
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1357
|
+
specified by this expression.
|
1358
|
+
timezone : str, optional, default None
|
1359
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1360
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1278
1361
|
"""
|
1279
1362
|
...
|
1280
1363
|
|
@@ -1329,89 +1412,5 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1329
1412
|
"""
|
1330
1413
|
...
|
1331
1414
|
|
1332
|
-
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]]:
|
1333
|
-
"""
|
1334
|
-
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)
|
1335
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1336
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1337
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1338
|
-
starts only after all sensors finish.
|
1339
|
-
|
1340
|
-
|
1341
|
-
Parameters
|
1342
|
-
----------
|
1343
|
-
timeout : int
|
1344
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1345
|
-
poke_interval : int
|
1346
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1347
|
-
mode : str
|
1348
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1349
|
-
exponential_backoff : bool
|
1350
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1351
|
-
pool : str
|
1352
|
-
the slot pool this task should run in,
|
1353
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1354
|
-
soft_fail : bool
|
1355
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1356
|
-
name : str
|
1357
|
-
Name of the sensor on Airflow
|
1358
|
-
description : str
|
1359
|
-
Description of sensor in the Airflow UI
|
1360
|
-
bucket_key : Union[str, List[str]]
|
1361
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1362
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1363
|
-
bucket_name : str
|
1364
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1365
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1366
|
-
wildcard_match : bool
|
1367
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1368
|
-
aws_conn_id : str
|
1369
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1370
|
-
verify : bool
|
1371
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1372
|
-
"""
|
1373
|
-
...
|
1374
|
-
|
1375
|
-
@typing.overload
|
1376
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1377
|
-
"""
|
1378
|
-
Specifies the PyPI packages for all steps of the flow.
|
1379
|
-
|
1380
|
-
Use `@pypi_base` to set common packages required by all
|
1381
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1382
|
-
|
1383
|
-
Parameters
|
1384
|
-
----------
|
1385
|
-
packages : Dict[str, str], default: {}
|
1386
|
-
Packages to use for this flow. The key is the name of the package
|
1387
|
-
and the value is the version to use.
|
1388
|
-
python : str, optional, default: None
|
1389
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1390
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1391
|
-
"""
|
1392
|
-
...
|
1393
|
-
|
1394
|
-
@typing.overload
|
1395
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1396
|
-
...
|
1397
|
-
|
1398
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1399
|
-
"""
|
1400
|
-
Specifies the PyPI packages for all steps of the flow.
|
1401
|
-
|
1402
|
-
Use `@pypi_base` to set common packages required by all
|
1403
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1404
|
-
|
1405
|
-
Parameters
|
1406
|
-
----------
|
1407
|
-
packages : Dict[str, str], default: {}
|
1408
|
-
Packages to use for this flow. The key is the name of the package
|
1409
|
-
and the value is the version to use.
|
1410
|
-
python : str, optional, default: None
|
1411
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1412
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1413
|
-
"""
|
1414
|
-
...
|
1415
|
-
|
1416
1415
|
pkg_name: str
|
1417
1416
|
|