ob-metaflow-stubs 6.0.3.179rc2__py2.py3-none-any.whl → 6.0.3.179rc4__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 +701 -701
- metaflow-stubs/cards.pyi +1 -1
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/cli_components/__init__.pyi +1 -1
- metaflow-stubs/cli_components/utils.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +1 -1
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +2 -2
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +108 -108
- metaflow-stubs/metaflow_git.pyi +1 -1
- metaflow-stubs/mf_extensions/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/ob_internal.pyi +1 -1
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +10 -10
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_client.pyi +1 -1
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +1 -1
- metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +1 -1
- metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
- metaflow-stubs/plugins/torchtune/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/uv_environment.pyi +1 -1
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +5 -5
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +1 -1
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +4 -4
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.179rc2.dist-info → ob_metaflow_stubs-6.0.3.179rc4.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.179rc4.dist-info/RECORD +220 -0
- ob_metaflow_stubs-6.0.3.179rc2.dist-info/RECORD +0 -220
- {ob_metaflow_stubs-6.0.3.179rc2.dist-info → ob_metaflow_stubs-6.0.3.179rc4.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.179rc2.dist-info → ob_metaflow_stubs-6.0.3.179rc4.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
3
|
# MF version: 2.15.17.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-06-
|
4
|
+
# Generated on 2025-06-13T21:20:48.635887 #
|
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
|
|
@@ -36,8 +36,8 @@ 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
38
|
from . import cards as cards
|
39
|
-
from . import tuple_util as tuple_util
|
40
39
|
from . import metaflow_git as metaflow_git
|
40
|
+
from . import tuple_util as tuple_util
|
41
41
|
from . import events as events
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
@@ -45,8 +45,8 @@ from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package imp
|
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
47
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
48
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
49
48
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -156,108 +156,224 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
156
156
|
...
|
157
157
|
|
158
158
|
@typing.overload
|
159
|
-
def
|
159
|
+
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]]]:
|
160
160
|
"""
|
161
|
-
|
161
|
+
Specifies the resources needed when executing this step.
|
162
162
|
|
163
|
-
|
163
|
+
Use `@resources` to specify the resource requirements
|
164
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
165
|
+
|
166
|
+
You can choose the compute layer on the command line by executing e.g.
|
167
|
+
```
|
168
|
+
python myflow.py run --with batch
|
169
|
+
```
|
170
|
+
or
|
171
|
+
```
|
172
|
+
python myflow.py run --with kubernetes
|
173
|
+
```
|
174
|
+
which executes the flow on the desired system using the
|
175
|
+
requirements specified in `@resources`.
|
164
176
|
|
165
177
|
|
166
178
|
Parameters
|
167
179
|
----------
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
180
|
+
cpu : int, default 1
|
181
|
+
Number of CPUs required for this step.
|
182
|
+
gpu : int, optional, default None
|
183
|
+
Number of GPUs required for this step.
|
184
|
+
disk : int, optional, default None
|
185
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
186
|
+
memory : int, default 4096
|
187
|
+
Memory size (in MB) required for this step.
|
188
|
+
shared_memory : int, optional, default None
|
189
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
190
|
+
This parameter maps to the `--shm-size` option in Docker.
|
176
191
|
"""
|
177
192
|
...
|
178
193
|
|
179
194
|
@typing.overload
|
180
|
-
def
|
195
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
181
196
|
...
|
182
197
|
|
183
198
|
@typing.overload
|
184
|
-
def
|
199
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
185
200
|
...
|
186
201
|
|
187
|
-
def
|
202
|
+
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):
|
188
203
|
"""
|
189
|
-
|
204
|
+
Specifies the resources needed when executing this step.
|
190
205
|
|
191
|
-
|
206
|
+
Use `@resources` to specify the resource requirements
|
207
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
208
|
+
|
209
|
+
You can choose the compute layer on the command line by executing e.g.
|
210
|
+
```
|
211
|
+
python myflow.py run --with batch
|
212
|
+
```
|
213
|
+
or
|
214
|
+
```
|
215
|
+
python myflow.py run --with kubernetes
|
216
|
+
```
|
217
|
+
which executes the flow on the desired system using the
|
218
|
+
requirements specified in `@resources`.
|
192
219
|
|
193
220
|
|
194
221
|
Parameters
|
195
222
|
----------
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
223
|
+
cpu : int, default 1
|
224
|
+
Number of CPUs required for this step.
|
225
|
+
gpu : int, optional, default None
|
226
|
+
Number of GPUs required for this step.
|
227
|
+
disk : int, optional, default None
|
228
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
229
|
+
memory : int, default 4096
|
230
|
+
Memory size (in MB) required for this step.
|
231
|
+
shared_memory : int, optional, default None
|
232
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
233
|
+
This parameter maps to the `--shm-size` option in Docker.
|
204
234
|
"""
|
205
235
|
...
|
206
236
|
|
207
237
|
@typing.overload
|
208
|
-
def
|
238
|
+
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]]]:
|
209
239
|
"""
|
210
|
-
|
240
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
241
|
+
the execution of a step.
|
242
|
+
|
211
243
|
|
244
|
+
Parameters
|
245
|
+
----------
|
246
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
247
|
+
List of secret specs, defining how the secrets are to be retrieved
|
248
|
+
"""
|
249
|
+
...
|
250
|
+
|
251
|
+
@typing.overload
|
252
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
253
|
+
...
|
254
|
+
|
255
|
+
@typing.overload
|
256
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
257
|
+
...
|
258
|
+
|
259
|
+
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]]] = []):
|
260
|
+
"""
|
261
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
262
|
+
the execution of a step.
|
212
263
|
|
213
264
|
|
214
265
|
Parameters
|
215
266
|
----------
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
225
|
-
created within the task will be loaded when the task is retries execution on failure.
|
267
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
268
|
+
List of secret specs, defining how the secrets are to be retrieved
|
269
|
+
"""
|
270
|
+
...
|
271
|
+
|
272
|
+
def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> 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]]]:
|
273
|
+
"""
|
274
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
226
275
|
|
227
|
-
|
228
|
-
|
276
|
+
User code call
|
277
|
+
--------------
|
278
|
+
@ollama(
|
279
|
+
models=[...],
|
280
|
+
...
|
281
|
+
)
|
282
|
+
|
283
|
+
Valid backend options
|
284
|
+
---------------------
|
285
|
+
- 'local': Run as a separate process on the local task machine.
|
286
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
287
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
288
|
+
|
289
|
+
Valid model options
|
290
|
+
-------------------
|
291
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
292
|
+
|
293
|
+
|
294
|
+
Parameters
|
295
|
+
----------
|
296
|
+
models: list[str]
|
297
|
+
List of Ollama containers running models in sidecars.
|
298
|
+
backend: str
|
299
|
+
Determines where and how to run the Ollama process.
|
300
|
+
force_pull: bool
|
301
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
302
|
+
cache_update_policy: str
|
303
|
+
Cache update policy: "auto", "force", or "never".
|
304
|
+
force_cache_update: bool
|
305
|
+
Simple override for "force" cache update policy.
|
306
|
+
debug: bool
|
307
|
+
Whether to turn on verbose debugging logs.
|
308
|
+
circuit_breaker_config: dict
|
309
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
310
|
+
timeout_config: dict
|
311
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
229
312
|
"""
|
230
313
|
...
|
231
314
|
|
232
315
|
@typing.overload
|
233
|
-
def
|
316
|
+
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]]]:
|
317
|
+
"""
|
318
|
+
Specifies the PyPI packages for the step.
|
319
|
+
|
320
|
+
Information in this decorator will augment any
|
321
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
322
|
+
you can use `@pypi_base` to set packages required by all
|
323
|
+
steps and use `@pypi` to specify step-specific overrides.
|
324
|
+
|
325
|
+
|
326
|
+
Parameters
|
327
|
+
----------
|
328
|
+
packages : Dict[str, str], default: {}
|
329
|
+
Packages to use for this step. The key is the name of the package
|
330
|
+
and the value is the version to use.
|
331
|
+
python : str, optional, default: None
|
332
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
333
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
334
|
+
"""
|
234
335
|
...
|
235
336
|
|
236
337
|
@typing.overload
|
237
|
-
def
|
338
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
238
339
|
...
|
239
340
|
|
240
|
-
|
341
|
+
@typing.overload
|
342
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
343
|
+
...
|
344
|
+
|
345
|
+
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):
|
241
346
|
"""
|
242
|
-
|
347
|
+
Specifies the PyPI packages for the step.
|
243
348
|
|
349
|
+
Information in this decorator will augment any
|
350
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
351
|
+
you can use `@pypi_base` to set packages required by all
|
352
|
+
steps and use `@pypi` to specify step-specific overrides.
|
244
353
|
|
245
354
|
|
246
355
|
Parameters
|
247
356
|
----------
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
357
|
+
packages : Dict[str, str], default: {}
|
358
|
+
Packages to use for this step. The key is the name of the package
|
359
|
+
and the value is the version to use.
|
360
|
+
python : str, optional, default: None
|
361
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
362
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
363
|
+
"""
|
364
|
+
...
|
365
|
+
|
366
|
+
def nvct(*, gpu: int, gpu_type: 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]]]:
|
367
|
+
"""
|
368
|
+
Specifies that this step should execute on DGX cloud.
|
258
369
|
|
259
|
-
|
260
|
-
|
370
|
+
|
371
|
+
Parameters
|
372
|
+
----------
|
373
|
+
gpu : int
|
374
|
+
Number of GPUs to use.
|
375
|
+
gpu_type : str
|
376
|
+
Type of Nvidia GPU to use.
|
261
377
|
"""
|
262
378
|
...
|
263
379
|
|
@@ -320,153 +436,60 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
320
436
|
"""
|
321
437
|
...
|
322
438
|
|
323
|
-
|
439
|
+
@typing.overload
|
440
|
+
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
324
441
|
"""
|
325
|
-
|
442
|
+
Enables loading / saving of models within a step.
|
443
|
+
|
326
444
|
|
327
445
|
|
328
446
|
Parameters
|
329
447
|
----------
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
448
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
449
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
450
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
451
|
+
- `current.checkpoint`
|
452
|
+
- `current.model`
|
453
|
+
- `current.huggingface_hub`
|
454
|
+
|
455
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
456
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
457
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
458
|
+
|
459
|
+
temp_dir_root : str, default: None
|
460
|
+
The root directory under which `current.model.loaded` will store loaded models
|
334
461
|
"""
|
335
462
|
...
|
336
463
|
|
337
464
|
@typing.overload
|
338
|
-
def
|
339
|
-
"""
|
340
|
-
Specifies environment variables to be set prior to the execution of a step.
|
341
|
-
|
342
|
-
|
343
|
-
Parameters
|
344
|
-
----------
|
345
|
-
vars : Dict[str, str], default {}
|
346
|
-
Dictionary of environment variables to set.
|
347
|
-
"""
|
348
|
-
...
|
349
|
-
|
350
|
-
@typing.overload
|
351
|
-
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
352
|
-
...
|
353
|
-
|
354
|
-
@typing.overload
|
355
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
356
|
-
...
|
357
|
-
|
358
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
359
|
-
"""
|
360
|
-
Specifies environment variables to be set prior to the execution of a step.
|
361
|
-
|
362
|
-
|
363
|
-
Parameters
|
364
|
-
----------
|
365
|
-
vars : Dict[str, str], default {}
|
366
|
-
Dictionary of environment variables to set.
|
367
|
-
"""
|
368
|
-
...
|
369
|
-
|
370
|
-
@typing.overload
|
371
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
372
|
-
"""
|
373
|
-
Internal decorator to support Fast bakery
|
374
|
-
"""
|
375
|
-
...
|
376
|
-
|
377
|
-
@typing.overload
|
378
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
379
|
-
...
|
380
|
-
|
381
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
382
|
-
"""
|
383
|
-
Internal decorator to support Fast bakery
|
384
|
-
"""
|
385
|
-
...
|
386
|
-
|
387
|
-
@typing.overload
|
388
|
-
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]]]:
|
389
|
-
"""
|
390
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
391
|
-
the execution of a step.
|
392
|
-
|
393
|
-
|
394
|
-
Parameters
|
395
|
-
----------
|
396
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
397
|
-
List of secret specs, defining how the secrets are to be retrieved
|
398
|
-
"""
|
399
|
-
...
|
400
|
-
|
401
|
-
@typing.overload
|
402
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
465
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
403
466
|
...
|
404
467
|
|
405
468
|
@typing.overload
|
406
|
-
def
|
407
|
-
...
|
408
|
-
|
409
|
-
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]]] = []):
|
410
|
-
"""
|
411
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
412
|
-
the execution of a step.
|
413
|
-
|
414
|
-
|
415
|
-
Parameters
|
416
|
-
----------
|
417
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
418
|
-
List of secret specs, defining how the secrets are to be retrieved
|
419
|
-
"""
|
469
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
420
470
|
...
|
421
471
|
|
422
|
-
|
423
|
-
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]]]:
|
472
|
+
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
424
473
|
"""
|
425
|
-
|
474
|
+
Enables loading / saving of models within a step.
|
426
475
|
|
427
|
-
Information in this decorator will augment any
|
428
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
429
|
-
you can use `@pypi_base` to set packages required by all
|
430
|
-
steps and use `@pypi` to specify step-specific overrides.
|
431
476
|
|
432
477
|
|
433
478
|
Parameters
|
434
479
|
----------
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
"""
|
442
|
-
...
|
443
|
-
|
444
|
-
@typing.overload
|
445
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
446
|
-
...
|
447
|
-
|
448
|
-
@typing.overload
|
449
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
450
|
-
...
|
451
|
-
|
452
|
-
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):
|
453
|
-
"""
|
454
|
-
Specifies the PyPI packages for the step.
|
455
|
-
|
456
|
-
Information in this decorator will augment any
|
457
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
458
|
-
you can use `@pypi_base` to set packages required by all
|
459
|
-
steps and use `@pypi` to specify step-specific overrides.
|
480
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
481
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
482
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
483
|
+
- `current.checkpoint`
|
484
|
+
- `current.model`
|
485
|
+
- `current.huggingface_hub`
|
460
486
|
|
487
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
488
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
489
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
461
490
|
|
462
|
-
|
463
|
-
|
464
|
-
packages : Dict[str, str], default: {}
|
465
|
-
Packages to use for this step. The key is the name of the package
|
466
|
-
and the value is the version to use.
|
467
|
-
python : str, optional, default: None
|
468
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
469
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
491
|
+
temp_dir_root : str, default: None
|
492
|
+
The root directory under which `current.model.loaded` will store loaded models
|
470
493
|
"""
|
471
494
|
...
|
472
495
|
|
@@ -559,103 +582,18 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
559
582
|
"""
|
560
583
|
...
|
561
584
|
|
562
|
-
|
563
|
-
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
564
|
-
"""
|
565
|
-
Enables loading / saving of models within a step.
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
Parameters
|
570
|
-
----------
|
571
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
572
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
573
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
574
|
-
- `current.checkpoint`
|
575
|
-
- `current.model`
|
576
|
-
- `current.huggingface_hub`
|
577
|
-
|
578
|
-
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
579
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
580
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
581
|
-
|
582
|
-
temp_dir_root : str, default: None
|
583
|
-
The root directory under which `current.model.loaded` will store loaded models
|
584
|
-
"""
|
585
|
-
...
|
586
|
-
|
587
|
-
@typing.overload
|
588
|
-
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
589
|
-
...
|
590
|
-
|
591
|
-
@typing.overload
|
592
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
593
|
-
...
|
594
|
-
|
595
|
-
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
596
|
-
"""
|
597
|
-
Enables loading / saving of models within a step.
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
Parameters
|
602
|
-
----------
|
603
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
604
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
605
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
606
|
-
- `current.checkpoint`
|
607
|
-
- `current.model`
|
608
|
-
- `current.huggingface_hub`
|
609
|
-
|
610
|
-
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
611
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
612
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
613
|
-
|
614
|
-
temp_dir_root : str, default: None
|
615
|
-
The root directory under which `current.model.loaded` will store loaded models
|
616
|
-
"""
|
617
|
-
...
|
618
|
-
|
619
|
-
def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> 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]]]:
|
585
|
+
def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
620
586
|
"""
|
621
|
-
|
622
|
-
|
623
|
-
User code call
|
624
|
-
--------------
|
625
|
-
@ollama(
|
626
|
-
models=[...],
|
627
|
-
...
|
628
|
-
)
|
629
|
-
|
630
|
-
Valid backend options
|
631
|
-
---------------------
|
632
|
-
- 'local': Run as a separate process on the local task machine.
|
633
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
634
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
635
|
-
|
636
|
-
Valid model options
|
637
|
-
-------------------
|
638
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
587
|
+
Specifies that this step is used to deploy an instance of the app.
|
588
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
639
589
|
|
640
590
|
|
641
591
|
Parameters
|
642
592
|
----------
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
force_pull: bool
|
648
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
649
|
-
cache_update_policy: str
|
650
|
-
Cache update policy: "auto", "force", or "never".
|
651
|
-
force_cache_update: bool
|
652
|
-
Simple override for "force" cache update policy.
|
653
|
-
debug: bool
|
654
|
-
Whether to turn on verbose debugging logs.
|
655
|
-
circuit_breaker_config: dict
|
656
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
657
|
-
timeout_config: dict
|
658
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
593
|
+
app_port : int
|
594
|
+
Number of GPUs to use.
|
595
|
+
app_name : str
|
596
|
+
Name of the app to deploy.
|
659
597
|
"""
|
660
598
|
...
|
661
599
|
|
@@ -719,81 +657,149 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
719
657
|
...
|
720
658
|
|
721
659
|
@typing.overload
|
722
|
-
def
|
660
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
723
661
|
"""
|
724
|
-
|
662
|
+
Decorator prototype for all step decorators. This function gets specialized
|
663
|
+
and imported for all decorators types by _import_plugin_decorators().
|
664
|
+
"""
|
665
|
+
...
|
666
|
+
|
667
|
+
@typing.overload
|
668
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
669
|
+
...
|
670
|
+
|
671
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
672
|
+
"""
|
673
|
+
Decorator prototype for all step decorators. This function gets specialized
|
674
|
+
and imported for all decorators types by _import_plugin_decorators().
|
675
|
+
"""
|
676
|
+
...
|
677
|
+
|
678
|
+
def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
679
|
+
"""
|
680
|
+
Specifies that this step should execute on DGX cloud.
|
725
681
|
|
726
|
-
Use `@resources` to specify the resource requirements
|
727
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
728
682
|
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
683
|
+
Parameters
|
684
|
+
----------
|
685
|
+
gpu : int
|
686
|
+
Number of GPUs to use.
|
687
|
+
gpu_type : str
|
688
|
+
Type of Nvidia GPU to use.
|
689
|
+
queue_timeout : int
|
690
|
+
Time to keep the job in NVCF's queue.
|
691
|
+
"""
|
692
|
+
...
|
693
|
+
|
694
|
+
@typing.overload
|
695
|
+
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]]]:
|
696
|
+
"""
|
697
|
+
Enables checkpointing for a step.
|
698
|
+
|
739
699
|
|
740
700
|
|
741
701
|
Parameters
|
742
702
|
----------
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
753
|
-
|
703
|
+
load_policy : str, default: "fresh"
|
704
|
+
The policy for loading the checkpoint. The following policies are supported:
|
705
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
706
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
707
|
+
will be loaded at the start of the task.
|
708
|
+
- "none": Do not load any checkpoint
|
709
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
710
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
711
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
712
|
+
created within the task will be loaded when the task is retries execution on failure.
|
713
|
+
|
714
|
+
temp_dir_root : str, default: None
|
715
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
754
716
|
"""
|
755
717
|
...
|
756
718
|
|
757
719
|
@typing.overload
|
758
|
-
def
|
720
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
759
721
|
...
|
760
722
|
|
761
723
|
@typing.overload
|
762
|
-
def
|
724
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
763
725
|
...
|
764
726
|
|
765
|
-
def
|
727
|
+
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):
|
766
728
|
"""
|
767
|
-
|
729
|
+
Enables checkpointing for a step.
|
768
730
|
|
769
|
-
Use `@resources` to specify the resource requirements
|
770
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
771
731
|
|
772
|
-
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
732
|
+
|
733
|
+
Parameters
|
734
|
+
----------
|
735
|
+
load_policy : str, default: "fresh"
|
736
|
+
The policy for loading the checkpoint. The following policies are supported:
|
737
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
738
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
739
|
+
will be loaded at the start of the task.
|
740
|
+
- "none": Do not load any checkpoint
|
741
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
742
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
743
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
744
|
+
created within the task will be loaded when the task is retries execution on failure.
|
745
|
+
|
746
|
+
temp_dir_root : str, default: None
|
747
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
748
|
+
"""
|
749
|
+
...
|
750
|
+
|
751
|
+
@typing.overload
|
752
|
+
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]]]:
|
753
|
+
"""
|
754
|
+
Specifies the number of times the task corresponding
|
755
|
+
to a step needs to be retried.
|
756
|
+
|
757
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
758
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
759
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
760
|
+
|
761
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
762
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
763
|
+
ensuring that the flow execution can continue.
|
782
764
|
|
783
765
|
|
784
766
|
Parameters
|
785
767
|
----------
|
786
|
-
|
787
|
-
Number of
|
788
|
-
|
789
|
-
Number of
|
790
|
-
|
791
|
-
|
792
|
-
|
793
|
-
|
794
|
-
|
795
|
-
|
796
|
-
|
768
|
+
times : int, default 3
|
769
|
+
Number of times to retry this task.
|
770
|
+
minutes_between_retries : int, default 2
|
771
|
+
Number of minutes between retries.
|
772
|
+
"""
|
773
|
+
...
|
774
|
+
|
775
|
+
@typing.overload
|
776
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
777
|
+
...
|
778
|
+
|
779
|
+
@typing.overload
|
780
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
781
|
+
...
|
782
|
+
|
783
|
+
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):
|
784
|
+
"""
|
785
|
+
Specifies the number of times the task corresponding
|
786
|
+
to a step needs to be retried.
|
787
|
+
|
788
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
789
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
790
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
791
|
+
|
792
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
793
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
794
|
+
ensuring that the flow execution can continue.
|
795
|
+
|
796
|
+
|
797
|
+
Parameters
|
798
|
+
----------
|
799
|
+
times : int, default 3
|
800
|
+
Number of times to retry this task.
|
801
|
+
minutes_between_retries : int, default 2
|
802
|
+
Number of minutes between retries.
|
797
803
|
"""
|
798
804
|
...
|
799
805
|
|
@@ -822,6 +828,72 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
|
|
822
828
|
"""
|
823
829
|
...
|
824
830
|
|
831
|
+
@typing.overload
|
832
|
+
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]]]:
|
833
|
+
"""
|
834
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
835
|
+
|
836
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
837
|
+
|
838
|
+
|
839
|
+
Parameters
|
840
|
+
----------
|
841
|
+
type : str, default 'default'
|
842
|
+
Card type.
|
843
|
+
id : str, optional, default None
|
844
|
+
If multiple cards are present, use this id to identify this card.
|
845
|
+
options : Dict[str, Any], default {}
|
846
|
+
Options passed to the card. The contents depend on the card type.
|
847
|
+
timeout : int, default 45
|
848
|
+
Interrupt reporting if it takes more than this many seconds.
|
849
|
+
"""
|
850
|
+
...
|
851
|
+
|
852
|
+
@typing.overload
|
853
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
854
|
+
...
|
855
|
+
|
856
|
+
@typing.overload
|
857
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
858
|
+
...
|
859
|
+
|
860
|
+
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):
|
861
|
+
"""
|
862
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
863
|
+
|
864
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
865
|
+
|
866
|
+
|
867
|
+
Parameters
|
868
|
+
----------
|
869
|
+
type : str, default 'default'
|
870
|
+
Card type.
|
871
|
+
id : str, optional, default None
|
872
|
+
If multiple cards are present, use this id to identify this card.
|
873
|
+
options : Dict[str, Any], default {}
|
874
|
+
Options passed to the card. The contents depend on the card type.
|
875
|
+
timeout : int, default 45
|
876
|
+
Interrupt reporting if it takes more than this many seconds.
|
877
|
+
"""
|
878
|
+
...
|
879
|
+
|
880
|
+
@typing.overload
|
881
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
882
|
+
"""
|
883
|
+
Internal decorator to support Fast bakery
|
884
|
+
"""
|
885
|
+
...
|
886
|
+
|
887
|
+
@typing.overload
|
888
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
889
|
+
...
|
890
|
+
|
891
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
892
|
+
"""
|
893
|
+
Internal decorator to support Fast bakery
|
894
|
+
"""
|
895
|
+
...
|
896
|
+
|
825
897
|
@typing.overload
|
826
898
|
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]]]:
|
827
899
|
"""
|
@@ -873,252 +945,112 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
873
945
|
"""
|
874
946
|
...
|
875
947
|
|
876
|
-
def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
877
|
-
"""
|
878
|
-
Specifies that this step is used to deploy an instance of the app.
|
879
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
880
|
-
|
881
|
-
|
882
|
-
Parameters
|
883
|
-
----------
|
884
|
-
app_port : int
|
885
|
-
Number of GPUs to use.
|
886
|
-
app_name : str
|
887
|
-
Name of the app to deploy.
|
888
|
-
"""
|
889
|
-
...
|
890
|
-
|
891
948
|
@typing.overload
|
892
|
-
def
|
949
|
+
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]]]:
|
893
950
|
"""
|
894
|
-
Specifies
|
895
|
-
to a step needs to be retried.
|
896
|
-
|
897
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
898
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
899
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
900
|
-
|
901
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
902
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
903
|
-
ensuring that the flow execution can continue.
|
951
|
+
Specifies environment variables to be set prior to the execution of a step.
|
904
952
|
|
905
953
|
|
906
954
|
Parameters
|
907
955
|
----------
|
908
|
-
|
909
|
-
|
910
|
-
minutes_between_retries : int, default 2
|
911
|
-
Number of minutes between retries.
|
956
|
+
vars : Dict[str, str], default {}
|
957
|
+
Dictionary of environment variables to set.
|
912
958
|
"""
|
913
959
|
...
|
914
960
|
|
915
961
|
@typing.overload
|
916
|
-
def
|
962
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
917
963
|
...
|
918
964
|
|
919
965
|
@typing.overload
|
920
|
-
def
|
966
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
921
967
|
...
|
922
968
|
|
923
|
-
def
|
969
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
924
970
|
"""
|
925
|
-
Specifies
|
926
|
-
to a step needs to be retried.
|
927
|
-
|
928
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
929
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
930
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
931
|
-
|
932
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
933
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
934
|
-
ensuring that the flow execution can continue.
|
971
|
+
Specifies environment variables to be set prior to the execution of a step.
|
935
972
|
|
936
973
|
|
937
974
|
Parameters
|
938
975
|
----------
|
939
|
-
|
940
|
-
|
941
|
-
minutes_between_retries : int, default 2
|
942
|
-
Number of minutes between retries.
|
976
|
+
vars : Dict[str, str], default {}
|
977
|
+
Dictionary of environment variables to set.
|
943
978
|
"""
|
944
979
|
...
|
945
980
|
|
946
|
-
def
|
981
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
947
982
|
"""
|
948
|
-
Specifies
|
983
|
+
Specifies what flows belong to the same project.
|
984
|
+
|
985
|
+
A project-specific namespace is created for all flows that
|
986
|
+
use the same `@project(name)`.
|
949
987
|
|
950
988
|
|
951
989
|
Parameters
|
952
990
|
----------
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
963
|
-
|
964
|
-
|
965
|
-
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
"""
|
976
|
-
Decorator prototype for all step decorators. This function gets specialized
|
977
|
-
and imported for all decorators types by _import_plugin_decorators().
|
991
|
+
name : str
|
992
|
+
Project name. Make sure that the name is unique amongst all
|
993
|
+
projects that use the same production scheduler. The name may
|
994
|
+
contain only lowercase alphanumeric characters and underscores.
|
995
|
+
|
996
|
+
branch : Optional[str], default None
|
997
|
+
The branch to use. If not specified, the branch is set to
|
998
|
+
`user.<username>` unless `production` is set to `True`. This can
|
999
|
+
also be set on the command line using `--branch` as a top-level option.
|
1000
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1001
|
+
|
1002
|
+
production : bool, default False
|
1003
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1004
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1005
|
+
`production` in the decorator and on the command line.
|
1006
|
+
The project branch name will be:
|
1007
|
+
- if `branch` is specified:
|
1008
|
+
- if `production` is True: `prod.<branch>`
|
1009
|
+
- if `production` is False: `test.<branch>`
|
1010
|
+
- if `branch` is not specified:
|
1011
|
+
- if `production` is True: `prod`
|
1012
|
+
- if `production` is False: `user.<username>`
|
978
1013
|
"""
|
979
1014
|
...
|
980
1015
|
|
981
1016
|
@typing.overload
|
982
|
-
def
|
1017
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
983
1018
|
"""
|
984
|
-
Specifies the
|
985
|
-
|
986
|
-
```
|
987
|
-
@trigger_on_finish(flow='FooFlow')
|
988
|
-
```
|
989
|
-
or
|
990
|
-
```
|
991
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
992
|
-
```
|
993
|
-
This decorator respects the @project decorator and triggers the flow
|
994
|
-
when upstream runs within the same namespace complete successfully
|
995
|
-
|
996
|
-
Additionally, you can specify project aware upstream flow dependencies
|
997
|
-
by specifying the fully qualified project_flow_name.
|
998
|
-
```
|
999
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1000
|
-
```
|
1001
|
-
or
|
1002
|
-
```
|
1003
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1004
|
-
```
|
1005
|
-
|
1006
|
-
You can also specify just the project or project branch (other values will be
|
1007
|
-
inferred from the current project or project branch):
|
1008
|
-
```
|
1009
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1010
|
-
```
|
1011
|
-
|
1012
|
-
Note that `branch` is typically one of:
|
1013
|
-
- `prod`
|
1014
|
-
- `user.bob`
|
1015
|
-
- `test.my_experiment`
|
1016
|
-
- `prod.staging`
|
1019
|
+
Specifies the PyPI packages for all steps of the flow.
|
1017
1020
|
|
1021
|
+
Use `@pypi_base` to set common packages required by all
|
1022
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1018
1023
|
|
1019
1024
|
Parameters
|
1020
1025
|
----------
|
1021
|
-
|
1022
|
-
|
1023
|
-
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1026
|
+
packages : Dict[str, str], default: {}
|
1027
|
+
Packages to use for this flow. The key is the name of the package
|
1028
|
+
and the value is the version to use.
|
1029
|
+
python : str, optional, default: None
|
1030
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1031
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1027
1032
|
"""
|
1028
1033
|
...
|
1029
1034
|
|
1030
1035
|
@typing.overload
|
1031
|
-
def
|
1032
|
-
...
|
1033
|
-
|
1034
|
-
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] = {}):
|
1035
|
-
"""
|
1036
|
-
Specifies the flow(s) that this flow depends on.
|
1037
|
-
|
1038
|
-
```
|
1039
|
-
@trigger_on_finish(flow='FooFlow')
|
1040
|
-
```
|
1041
|
-
or
|
1042
|
-
```
|
1043
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1044
|
-
```
|
1045
|
-
This decorator respects the @project decorator and triggers the flow
|
1046
|
-
when upstream runs within the same namespace complete successfully
|
1047
|
-
|
1048
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1049
|
-
by specifying the fully qualified project_flow_name.
|
1050
|
-
```
|
1051
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1052
|
-
```
|
1053
|
-
or
|
1054
|
-
```
|
1055
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1056
|
-
```
|
1057
|
-
|
1058
|
-
You can also specify just the project or project branch (other values will be
|
1059
|
-
inferred from the current project or project branch):
|
1060
|
-
```
|
1061
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1062
|
-
```
|
1063
|
-
|
1064
|
-
Note that `branch` is typically one of:
|
1065
|
-
- `prod`
|
1066
|
-
- `user.bob`
|
1067
|
-
- `test.my_experiment`
|
1068
|
-
- `prod.staging`
|
1069
|
-
|
1070
|
-
|
1071
|
-
Parameters
|
1072
|
-
----------
|
1073
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
1074
|
-
Upstream flow dependency for this flow.
|
1075
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
1076
|
-
Upstream flow dependencies for this flow.
|
1077
|
-
options : Dict[str, Any], default {}
|
1078
|
-
Backend-specific configuration for tuning eventing behavior.
|
1079
|
-
"""
|
1036
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1080
1037
|
...
|
1081
1038
|
|
1082
|
-
def
|
1039
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1083
1040
|
"""
|
1084
|
-
|
1085
|
-
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.
|
1041
|
+
Specifies the PyPI packages for all steps of the flow.
|
1086
1042
|
|
1043
|
+
Use `@pypi_base` to set common packages required by all
|
1044
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1087
1045
|
|
1088
1046
|
Parameters
|
1089
1047
|
----------
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
exponential_backoff : bool
|
1097
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1098
|
-
pool : str
|
1099
|
-
the slot pool this task should run in,
|
1100
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1101
|
-
soft_fail : bool
|
1102
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1103
|
-
name : str
|
1104
|
-
Name of the sensor on Airflow
|
1105
|
-
description : str
|
1106
|
-
Description of sensor in the Airflow UI
|
1107
|
-
external_dag_id : str
|
1108
|
-
The dag_id that contains the task you want to wait for.
|
1109
|
-
external_task_ids : List[str]
|
1110
|
-
The list of task_ids that you want to wait for.
|
1111
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1112
|
-
allowed_states : List[str]
|
1113
|
-
Iterable of allowed states, (Default: ['success'])
|
1114
|
-
failed_states : List[str]
|
1115
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1116
|
-
execution_delta : datetime.timedelta
|
1117
|
-
time difference with the previous execution to look at,
|
1118
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1119
|
-
check_existence: bool
|
1120
|
-
Set to True to check if the external task exists or check if
|
1121
|
-
the DAG to wait for exists. (Default: True)
|
1048
|
+
packages : Dict[str, str], default: {}
|
1049
|
+
Packages to use for this flow. The key is the name of the package
|
1050
|
+
and the value is the version to use.
|
1051
|
+
python : str, optional, default: None
|
1052
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1053
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1122
1054
|
"""
|
1123
1055
|
...
|
1124
1056
|
|
@@ -1236,134 +1168,244 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1236
1168
|
"""
|
1237
1169
|
...
|
1238
1170
|
|
1239
|
-
def
|
1171
|
+
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]]:
|
1240
1172
|
"""
|
1241
|
-
|
1242
|
-
|
1243
|
-
|
1244
|
-
|
1173
|
+
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)
|
1174
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1175
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1176
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1177
|
+
starts only after all sensors finish.
|
1245
1178
|
|
1246
1179
|
|
1247
1180
|
Parameters
|
1248
1181
|
----------
|
1182
|
+
timeout : int
|
1183
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1184
|
+
poke_interval : int
|
1185
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1186
|
+
mode : str
|
1187
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1188
|
+
exponential_backoff : bool
|
1189
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1190
|
+
pool : str
|
1191
|
+
the slot pool this task should run in,
|
1192
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1193
|
+
soft_fail : bool
|
1194
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1249
1195
|
name : str
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1254
|
-
|
1255
|
-
|
1256
|
-
|
1257
|
-
|
1258
|
-
|
1259
|
-
|
1260
|
-
|
1261
|
-
|
1262
|
-
|
1263
|
-
|
1264
|
-
|
1265
|
-
- if `branch` is specified:
|
1266
|
-
- if `production` is True: `prod.<branch>`
|
1267
|
-
- if `production` is False: `test.<branch>`
|
1268
|
-
- if `branch` is not specified:
|
1269
|
-
- if `production` is True: `prod`
|
1270
|
-
- if `production` is False: `user.<username>`
|
1196
|
+
Name of the sensor on Airflow
|
1197
|
+
description : str
|
1198
|
+
Description of sensor in the Airflow UI
|
1199
|
+
bucket_key : Union[str, List[str]]
|
1200
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1201
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1202
|
+
bucket_name : str
|
1203
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1204
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1205
|
+
wildcard_match : bool
|
1206
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1207
|
+
aws_conn_id : str
|
1208
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1209
|
+
verify : bool
|
1210
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1271
1211
|
"""
|
1272
1212
|
...
|
1273
1213
|
|
1274
1214
|
@typing.overload
|
1275
|
-
def
|
1215
|
+
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]]:
|
1276
1216
|
"""
|
1277
|
-
Specifies the
|
1217
|
+
Specifies the times when the flow should be run when running on a
|
1218
|
+
production scheduler.
|
1219
|
+
|
1220
|
+
|
1221
|
+
Parameters
|
1222
|
+
----------
|
1223
|
+
hourly : bool, default False
|
1224
|
+
Run the workflow hourly.
|
1225
|
+
daily : bool, default True
|
1226
|
+
Run the workflow daily.
|
1227
|
+
weekly : bool, default False
|
1228
|
+
Run the workflow weekly.
|
1229
|
+
cron : str, optional, default None
|
1230
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1231
|
+
specified by this expression.
|
1232
|
+
timezone : str, optional, default None
|
1233
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1234
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1235
|
+
"""
|
1236
|
+
...
|
1237
|
+
|
1238
|
+
@typing.overload
|
1239
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1240
|
+
...
|
1241
|
+
|
1242
|
+
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):
|
1243
|
+
"""
|
1244
|
+
Specifies the times when the flow should be run when running on a
|
1245
|
+
production scheduler.
|
1246
|
+
|
1247
|
+
|
1248
|
+
Parameters
|
1249
|
+
----------
|
1250
|
+
hourly : bool, default False
|
1251
|
+
Run the workflow hourly.
|
1252
|
+
daily : bool, default True
|
1253
|
+
Run the workflow daily.
|
1254
|
+
weekly : bool, default False
|
1255
|
+
Run the workflow weekly.
|
1256
|
+
cron : str, optional, default None
|
1257
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1258
|
+
specified by this expression.
|
1259
|
+
timezone : str, optional, default None
|
1260
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1261
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1262
|
+
"""
|
1263
|
+
...
|
1264
|
+
|
1265
|
+
@typing.overload
|
1266
|
+
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]]:
|
1267
|
+
"""
|
1268
|
+
Specifies the flow(s) that this flow depends on.
|
1278
1269
|
|
1279
1270
|
```
|
1280
|
-
@
|
1271
|
+
@trigger_on_finish(flow='FooFlow')
|
1281
1272
|
```
|
1282
1273
|
or
|
1283
1274
|
```
|
1284
|
-
@
|
1275
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1285
1276
|
```
|
1277
|
+
This decorator respects the @project decorator and triggers the flow
|
1278
|
+
when upstream runs within the same namespace complete successfully
|
1286
1279
|
|
1287
|
-
Additionally, you can specify
|
1288
|
-
|
1280
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1281
|
+
by specifying the fully qualified project_flow_name.
|
1289
1282
|
```
|
1290
|
-
@
|
1283
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1291
1284
|
```
|
1292
1285
|
or
|
1293
1286
|
```
|
1294
|
-
@
|
1295
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1287
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1296
1288
|
```
|
1297
1289
|
|
1298
|
-
|
1299
|
-
|
1300
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1301
|
-
```
|
1302
|
-
This is equivalent to:
|
1290
|
+
You can also specify just the project or project branch (other values will be
|
1291
|
+
inferred from the current project or project branch):
|
1303
1292
|
```
|
1304
|
-
@
|
1293
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1305
1294
|
```
|
1306
1295
|
|
1296
|
+
Note that `branch` is typically one of:
|
1297
|
+
- `prod`
|
1298
|
+
- `user.bob`
|
1299
|
+
- `test.my_experiment`
|
1300
|
+
- `prod.staging`
|
1301
|
+
|
1307
1302
|
|
1308
1303
|
Parameters
|
1309
1304
|
----------
|
1310
|
-
|
1311
|
-
|
1312
|
-
|
1313
|
-
|
1305
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1306
|
+
Upstream flow dependency for this flow.
|
1307
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1308
|
+
Upstream flow dependencies for this flow.
|
1314
1309
|
options : Dict[str, Any], default {}
|
1315
1310
|
Backend-specific configuration for tuning eventing behavior.
|
1316
1311
|
"""
|
1317
1312
|
...
|
1318
1313
|
|
1319
1314
|
@typing.overload
|
1320
|
-
def
|
1315
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1321
1316
|
...
|
1322
1317
|
|
1323
|
-
def
|
1318
|
+
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] = {}):
|
1324
1319
|
"""
|
1325
|
-
Specifies the
|
1320
|
+
Specifies the flow(s) that this flow depends on.
|
1326
1321
|
|
1327
1322
|
```
|
1328
|
-
@
|
1323
|
+
@trigger_on_finish(flow='FooFlow')
|
1329
1324
|
```
|
1330
1325
|
or
|
1331
1326
|
```
|
1332
|
-
@
|
1327
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1333
1328
|
```
|
1329
|
+
This decorator respects the @project decorator and triggers the flow
|
1330
|
+
when upstream runs within the same namespace complete successfully
|
1334
1331
|
|
1335
|
-
Additionally, you can specify
|
1336
|
-
|
1332
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1333
|
+
by specifying the fully qualified project_flow_name.
|
1337
1334
|
```
|
1338
|
-
@
|
1335
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1339
1336
|
```
|
1340
1337
|
or
|
1341
1338
|
```
|
1342
|
-
@
|
1343
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1339
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1344
1340
|
```
|
1345
1341
|
|
1346
|
-
|
1347
|
-
|
1348
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1349
|
-
```
|
1350
|
-
This is equivalent to:
|
1342
|
+
You can also specify just the project or project branch (other values will be
|
1343
|
+
inferred from the current project or project branch):
|
1351
1344
|
```
|
1352
|
-
@
|
1345
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1353
1346
|
```
|
1354
1347
|
|
1348
|
+
Note that `branch` is typically one of:
|
1349
|
+
- `prod`
|
1350
|
+
- `user.bob`
|
1351
|
+
- `test.my_experiment`
|
1352
|
+
- `prod.staging`
|
1353
|
+
|
1355
1354
|
|
1356
1355
|
Parameters
|
1357
1356
|
----------
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1357
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1358
|
+
Upstream flow dependency for this flow.
|
1359
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1360
|
+
Upstream flow dependencies for this flow.
|
1362
1361
|
options : Dict[str, Any], default {}
|
1363
1362
|
Backend-specific configuration for tuning eventing behavior.
|
1364
1363
|
"""
|
1365
1364
|
...
|
1366
1365
|
|
1366
|
+
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]]:
|
1367
|
+
"""
|
1368
|
+
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.
|
1369
|
+
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.
|
1370
|
+
|
1371
|
+
|
1372
|
+
Parameters
|
1373
|
+
----------
|
1374
|
+
timeout : int
|
1375
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1376
|
+
poke_interval : int
|
1377
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1378
|
+
mode : str
|
1379
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1380
|
+
exponential_backoff : bool
|
1381
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1382
|
+
pool : str
|
1383
|
+
the slot pool this task should run in,
|
1384
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1385
|
+
soft_fail : bool
|
1386
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1387
|
+
name : str
|
1388
|
+
Name of the sensor on Airflow
|
1389
|
+
description : str
|
1390
|
+
Description of sensor in the Airflow UI
|
1391
|
+
external_dag_id : str
|
1392
|
+
The dag_id that contains the task you want to wait for.
|
1393
|
+
external_task_ids : List[str]
|
1394
|
+
The list of task_ids that you want to wait for.
|
1395
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1396
|
+
allowed_states : List[str]
|
1397
|
+
Iterable of allowed states, (Default: ['success'])
|
1398
|
+
failed_states : List[str]
|
1399
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1400
|
+
execution_delta : datetime.timedelta
|
1401
|
+
time difference with the previous execution to look at,
|
1402
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1403
|
+
check_existence: bool
|
1404
|
+
Set to True to check if the external task exists or check if
|
1405
|
+
the DAG to wait for exists. (Default: True)
|
1406
|
+
"""
|
1407
|
+
...
|
1408
|
+
|
1367
1409
|
@typing.overload
|
1368
1410
|
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1369
1411
|
"""
|
@@ -1415,138 +1457,96 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1415
1457
|
"""
|
1416
1458
|
...
|
1417
1459
|
|
1418
|
-
|
1460
|
+
@typing.overload
|
1461
|
+
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1419
1462
|
"""
|
1420
|
-
|
1421
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1422
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1423
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1424
|
-
starts only after all sensors finish.
|
1463
|
+
Specifies the event(s) that this flow depends on.
|
1425
1464
|
|
1465
|
+
```
|
1466
|
+
@trigger(event='foo')
|
1467
|
+
```
|
1468
|
+
or
|
1469
|
+
```
|
1470
|
+
@trigger(events=['foo', 'bar'])
|
1471
|
+
```
|
1426
1472
|
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
|
1446
|
-
bucket_key : Union[str, List[str]]
|
1447
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1448
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1449
|
-
bucket_name : str
|
1450
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1451
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1452
|
-
wildcard_match : bool
|
1453
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1454
|
-
aws_conn_id : str
|
1455
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1456
|
-
verify : bool
|
1457
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1458
|
-
"""
|
1459
|
-
...
|
1460
|
-
|
1461
|
-
@typing.overload
|
1462
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1463
|
-
"""
|
1464
|
-
Specifies the PyPI packages for all steps of the flow.
|
1473
|
+
Additionally, you can specify the parameter mappings
|
1474
|
+
to map event payload to Metaflow parameters for the flow.
|
1475
|
+
```
|
1476
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1477
|
+
```
|
1478
|
+
or
|
1479
|
+
```
|
1480
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1481
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1482
|
+
```
|
1483
|
+
|
1484
|
+
'parameters' can also be a list of strings and tuples like so:
|
1485
|
+
```
|
1486
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1487
|
+
```
|
1488
|
+
This is equivalent to:
|
1489
|
+
```
|
1490
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1491
|
+
```
|
1465
1492
|
|
1466
|
-
Use `@pypi_base` to set common packages required by all
|
1467
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1468
1493
|
|
1469
1494
|
Parameters
|
1470
1495
|
----------
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
1474
|
-
|
1475
|
-
|
1476
|
-
|
1496
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1497
|
+
Event dependency for this flow.
|
1498
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1499
|
+
Events dependency for this flow.
|
1500
|
+
options : Dict[str, Any], default {}
|
1501
|
+
Backend-specific configuration for tuning eventing behavior.
|
1477
1502
|
"""
|
1478
1503
|
...
|
1479
1504
|
|
1480
1505
|
@typing.overload
|
1481
|
-
def
|
1506
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1482
1507
|
...
|
1483
1508
|
|
1484
|
-
def
|
1509
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1485
1510
|
"""
|
1486
|
-
Specifies the
|
1487
|
-
|
1488
|
-
Use `@pypi_base` to set common packages required by all
|
1489
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1511
|
+
Specifies the event(s) that this flow depends on.
|
1490
1512
|
|
1491
|
-
|
1492
|
-
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1499
|
-
"""
|
1500
|
-
...
|
1501
|
-
|
1502
|
-
@typing.overload
|
1503
|
-
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]]:
|
1504
|
-
"""
|
1505
|
-
Specifies the times when the flow should be run when running on a
|
1506
|
-
production scheduler.
|
1513
|
+
```
|
1514
|
+
@trigger(event='foo')
|
1515
|
+
```
|
1516
|
+
or
|
1517
|
+
```
|
1518
|
+
@trigger(events=['foo', 'bar'])
|
1519
|
+
```
|
1507
1520
|
|
1521
|
+
Additionally, you can specify the parameter mappings
|
1522
|
+
to map event payload to Metaflow parameters for the flow.
|
1523
|
+
```
|
1524
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1525
|
+
```
|
1526
|
+
or
|
1527
|
+
```
|
1528
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1529
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1530
|
+
```
|
1508
1531
|
|
1509
|
-
|
1510
|
-
|
1511
|
-
|
1512
|
-
|
1513
|
-
|
1514
|
-
|
1515
|
-
|
1516
|
-
|
1517
|
-
cron : str, optional, default None
|
1518
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1519
|
-
specified by this expression.
|
1520
|
-
timezone : str, optional, default None
|
1521
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1522
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1523
|
-
"""
|
1524
|
-
...
|
1525
|
-
|
1526
|
-
@typing.overload
|
1527
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1528
|
-
...
|
1529
|
-
|
1530
|
-
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):
|
1531
|
-
"""
|
1532
|
-
Specifies the times when the flow should be run when running on a
|
1533
|
-
production scheduler.
|
1532
|
+
'parameters' can also be a list of strings and tuples like so:
|
1533
|
+
```
|
1534
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1535
|
+
```
|
1536
|
+
This is equivalent to:
|
1537
|
+
```
|
1538
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1539
|
+
```
|
1534
1540
|
|
1535
1541
|
|
1536
1542
|
Parameters
|
1537
1543
|
----------
|
1538
|
-
|
1539
|
-
|
1540
|
-
|
1541
|
-
|
1542
|
-
|
1543
|
-
|
1544
|
-
cron : str, optional, default None
|
1545
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1546
|
-
specified by this expression.
|
1547
|
-
timezone : str, optional, default None
|
1548
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1549
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1544
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1545
|
+
Event dependency for this flow.
|
1546
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1547
|
+
Events dependency for this flow.
|
1548
|
+
options : Dict[str, Any], default {}
|
1549
|
+
Backend-specific configuration for tuning eventing behavior.
|
1550
1550
|
"""
|
1551
1551
|
...
|
1552
1552
|
|