ob-metaflow-stubs 6.0.3.167__py2.py3-none-any.whl → 6.0.3.168__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 +583 -583
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +6 -6
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -4
- metaflow-stubs/metaflow_current.pyi +86 -86
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +5 -5
- metaflow-stubs/plugins/__init__.pyi +10 -10
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +4 -4
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +6 -6
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +3 -3
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +30 -30
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +3 -3
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +4 -4
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.3.167.dist-info → ob_metaflow_stubs-6.0.3.168.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.168.dist-info/RECORD +206 -0
- ob_metaflow_stubs-6.0.3.167.dist-info/RECORD +0 -206
- {ob_metaflow_stubs-6.0.3.167.dist-info → ob_metaflow_stubs-6.0.3.168.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.167.dist-info → ob_metaflow_stubs-6.0.3.168.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.15.
|
4
|
-
# Generated on 2025-05-
|
3
|
+
# MF version: 2.15.13.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
+
# Generated on 2025-05-20T18:21:15.778004 #
|
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
|
|
@@ -44,9 +44,9 @@ from . import plugins as plugins
|
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
47
48
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
48
49
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
49
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_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
|
@@ -154,283 +154,311 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
154
154
|
...
|
155
155
|
|
156
156
|
@typing.overload
|
157
|
-
def
|
157
|
+
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]]]:
|
158
158
|
"""
|
159
|
-
Specifies
|
160
|
-
|
161
|
-
This decorator is useful if this step may hang indefinitely.
|
159
|
+
Specifies the resources needed when executing this step.
|
162
160
|
|
163
|
-
|
164
|
-
|
165
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
161
|
+
Use `@resources` to specify the resource requirements
|
162
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
166
163
|
|
167
|
-
|
168
|
-
|
164
|
+
You can choose the compute layer on the command line by executing e.g.
|
165
|
+
```
|
166
|
+
python myflow.py run --with batch
|
167
|
+
```
|
168
|
+
or
|
169
|
+
```
|
170
|
+
python myflow.py run --with kubernetes
|
171
|
+
```
|
172
|
+
which executes the flow on the desired system using the
|
173
|
+
requirements specified in `@resources`.
|
169
174
|
|
170
175
|
|
171
176
|
Parameters
|
172
177
|
----------
|
173
|
-
|
174
|
-
Number of
|
175
|
-
|
176
|
-
Number of
|
177
|
-
|
178
|
-
|
178
|
+
cpu : int, default 1
|
179
|
+
Number of CPUs required for this step.
|
180
|
+
gpu : int, optional, default None
|
181
|
+
Number of GPUs required for this step.
|
182
|
+
disk : int, optional, default None
|
183
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
184
|
+
memory : int, default 4096
|
185
|
+
Memory size (in MB) required for this step.
|
186
|
+
shared_memory : int, optional, default None
|
187
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
188
|
+
This parameter maps to the `--shm-size` option in Docker.
|
179
189
|
"""
|
180
190
|
...
|
181
191
|
|
182
192
|
@typing.overload
|
183
|
-
def
|
193
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
184
194
|
...
|
185
195
|
|
186
196
|
@typing.overload
|
187
|
-
def
|
197
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
188
198
|
...
|
189
199
|
|
190
|
-
def
|
200
|
+
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):
|
191
201
|
"""
|
192
|
-
Specifies
|
193
|
-
|
194
|
-
This decorator is useful if this step may hang indefinitely.
|
202
|
+
Specifies the resources needed when executing this step.
|
195
203
|
|
196
|
-
|
197
|
-
|
198
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
204
|
+
Use `@resources` to specify the resource requirements
|
205
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
199
206
|
|
200
|
-
|
201
|
-
|
207
|
+
You can choose the compute layer on the command line by executing e.g.
|
208
|
+
```
|
209
|
+
python myflow.py run --with batch
|
210
|
+
```
|
211
|
+
or
|
212
|
+
```
|
213
|
+
python myflow.py run --with kubernetes
|
214
|
+
```
|
215
|
+
which executes the flow on the desired system using the
|
216
|
+
requirements specified in `@resources`.
|
202
217
|
|
203
218
|
|
204
219
|
Parameters
|
205
220
|
----------
|
206
|
-
|
207
|
-
Number of
|
208
|
-
|
209
|
-
Number of
|
210
|
-
|
211
|
-
|
221
|
+
cpu : int, default 1
|
222
|
+
Number of CPUs required for this step.
|
223
|
+
gpu : int, optional, default None
|
224
|
+
Number of GPUs required for this step.
|
225
|
+
disk : int, optional, default None
|
226
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
227
|
+
memory : int, default 4096
|
228
|
+
Memory size (in MB) required for this step.
|
229
|
+
shared_memory : int, optional, default None
|
230
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
231
|
+
This parameter maps to the `--shm-size` option in Docker.
|
212
232
|
"""
|
213
233
|
...
|
214
234
|
|
215
235
|
@typing.overload
|
216
|
-
def
|
236
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
217
237
|
"""
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
Parameters
|
222
|
-
----------
|
223
|
-
vars : Dict[str, str], default {}
|
224
|
-
Dictionary of environment variables to set.
|
238
|
+
Decorator prototype for all step decorators. This function gets specialized
|
239
|
+
and imported for all decorators types by _import_plugin_decorators().
|
225
240
|
"""
|
226
241
|
...
|
227
242
|
|
228
243
|
@typing.overload
|
229
|
-
def
|
230
|
-
...
|
231
|
-
|
232
|
-
@typing.overload
|
233
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
244
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
234
245
|
...
|
235
246
|
|
236
|
-
def
|
247
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
237
248
|
"""
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
Parameters
|
242
|
-
----------
|
243
|
-
vars : Dict[str, str], default {}
|
244
|
-
Dictionary of environment variables to set.
|
249
|
+
Decorator prototype for all step decorators. This function gets specialized
|
250
|
+
and imported for all decorators types by _import_plugin_decorators().
|
245
251
|
"""
|
246
252
|
...
|
247
253
|
|
248
254
|
@typing.overload
|
249
|
-
def
|
255
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
250
256
|
"""
|
251
|
-
Specifies the
|
257
|
+
Specifies the Conda environment for the step.
|
252
258
|
|
253
259
|
Information in this decorator will augment any
|
254
|
-
attributes set in the `@
|
255
|
-
you can use `@
|
256
|
-
steps and use `@
|
260
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
261
|
+
you can use `@conda_base` to set packages required by all
|
262
|
+
steps and use `@conda` to specify step-specific overrides.
|
257
263
|
|
258
264
|
|
259
265
|
Parameters
|
260
266
|
----------
|
261
|
-
packages : Dict[str, str], default
|
267
|
+
packages : Dict[str, str], default {}
|
262
268
|
Packages to use for this step. The key is the name of the package
|
263
269
|
and the value is the version to use.
|
264
|
-
|
270
|
+
libraries : Dict[str, str], default {}
|
271
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
272
|
+
python : str, optional, default None
|
265
273
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
266
274
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
275
|
+
disabled : bool, default False
|
276
|
+
If set to True, disables @conda.
|
267
277
|
"""
|
268
278
|
...
|
269
279
|
|
270
280
|
@typing.overload
|
271
|
-
def
|
281
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
272
282
|
...
|
273
283
|
|
274
284
|
@typing.overload
|
275
|
-
def
|
285
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
276
286
|
...
|
277
287
|
|
278
|
-
def
|
288
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
279
289
|
"""
|
280
|
-
Specifies the
|
290
|
+
Specifies the Conda environment for the step.
|
281
291
|
|
282
292
|
Information in this decorator will augment any
|
283
|
-
attributes set in the `@
|
284
|
-
you can use `@
|
285
|
-
steps and use `@
|
293
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
294
|
+
you can use `@conda_base` to set packages required by all
|
295
|
+
steps and use `@conda` to specify step-specific overrides.
|
286
296
|
|
287
297
|
|
288
298
|
Parameters
|
289
299
|
----------
|
290
|
-
packages : Dict[str, str], default
|
300
|
+
packages : Dict[str, str], default {}
|
291
301
|
Packages to use for this step. The key is the name of the package
|
292
302
|
and the value is the version to use.
|
293
|
-
|
303
|
+
libraries : Dict[str, str], default {}
|
304
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
305
|
+
python : str, optional, default None
|
294
306
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
295
307
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
308
|
+
disabled : bool, default False
|
309
|
+
If set to True, disables @conda.
|
296
310
|
"""
|
297
311
|
...
|
298
312
|
|
299
|
-
def
|
313
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
300
314
|
"""
|
301
|
-
|
302
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
315
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
303
316
|
|
304
317
|
|
305
318
|
Parameters
|
306
319
|
----------
|
307
|
-
|
308
|
-
|
309
|
-
app_name : str
|
310
|
-
Name of the app to deploy.
|
311
|
-
"""
|
312
|
-
...
|
313
|
-
|
314
|
-
@typing.overload
|
315
|
-
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]]]:
|
316
|
-
"""
|
317
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
320
|
+
temp_dir_root : str, optional
|
321
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
318
322
|
|
319
|
-
|
323
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
324
|
+
The list of repos (models/datasets) to load.
|
320
325
|
|
326
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
321
327
|
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
If
|
328
|
-
|
329
|
-
Options passed to the card. The contents depend on the card type.
|
330
|
-
timeout : int, default 45
|
331
|
-
Interrupt reporting if it takes more than this many seconds.
|
328
|
+
- If repo (model/dataset) is not found in the datastore:
|
329
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
330
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
331
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
332
|
+
|
333
|
+
- If repo is found in the datastore:
|
334
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
332
335
|
"""
|
333
336
|
...
|
334
337
|
|
335
338
|
@typing.overload
|
336
|
-
def
|
339
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
340
|
+
"""
|
341
|
+
Internal decorator to support Fast bakery
|
342
|
+
"""
|
337
343
|
...
|
338
344
|
|
339
345
|
@typing.overload
|
340
|
-
def
|
346
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
341
347
|
...
|
342
348
|
|
343
|
-
def
|
349
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
344
350
|
"""
|
345
|
-
|
346
|
-
|
347
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
348
|
-
|
349
|
-
|
350
|
-
Parameters
|
351
|
-
----------
|
352
|
-
type : str, default 'default'
|
353
|
-
Card type.
|
354
|
-
id : str, optional, default None
|
355
|
-
If multiple cards are present, use this id to identify this card.
|
356
|
-
options : Dict[str, Any], default {}
|
357
|
-
Options passed to the card. The contents depend on the card type.
|
358
|
-
timeout : int, default 45
|
359
|
-
Interrupt reporting if it takes more than this many seconds.
|
351
|
+
Internal decorator to support Fast bakery
|
360
352
|
"""
|
361
353
|
...
|
362
354
|
|
363
355
|
@typing.overload
|
364
|
-
def
|
356
|
+
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]]]:
|
365
357
|
"""
|
366
|
-
|
358
|
+
Specifies that the step will success under all circumstances.
|
367
359
|
|
360
|
+
The decorator will create an optional artifact, specified by `var`, which
|
361
|
+
contains the exception raised. You can use it to detect the presence
|
362
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
363
|
+
are missing.
|
368
364
|
|
369
365
|
|
370
366
|
Parameters
|
371
367
|
----------
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
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
|
380
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
381
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
382
|
-
|
383
|
-
temp_dir_root : str, default: None
|
384
|
-
The root directory under which `current.model.loaded` will store loaded models
|
368
|
+
var : str, optional, default None
|
369
|
+
Name of the artifact in which to store the caught exception.
|
370
|
+
If not specified, the exception is not stored.
|
371
|
+
print_exception : bool, default True
|
372
|
+
Determines whether or not the exception is printed to
|
373
|
+
stdout when caught.
|
385
374
|
"""
|
386
375
|
...
|
387
376
|
|
388
377
|
@typing.overload
|
389
|
-
def
|
378
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
390
379
|
...
|
391
380
|
|
392
381
|
@typing.overload
|
393
|
-
def
|
382
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
394
383
|
...
|
395
384
|
|
396
|
-
def
|
385
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
397
386
|
"""
|
398
|
-
|
399
|
-
|
387
|
+
Specifies that the step will success under all circumstances.
|
388
|
+
|
389
|
+
The decorator will create an optional artifact, specified by `var`, which
|
390
|
+
contains the exception raised. You can use it to detect the presence
|
391
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
392
|
+
are missing.
|
400
393
|
|
401
394
|
|
402
395
|
Parameters
|
403
396
|
----------
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
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
|
412
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
413
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
414
|
-
|
415
|
-
temp_dir_root : str, default: None
|
416
|
-
The root directory under which `current.model.loaded` will store loaded models
|
397
|
+
var : str, optional, default None
|
398
|
+
Name of the artifact in which to store the caught exception.
|
399
|
+
If not specified, the exception is not stored.
|
400
|
+
print_exception : bool, default True
|
401
|
+
Determines whether or not the exception is printed to
|
402
|
+
stdout when caught.
|
417
403
|
"""
|
418
404
|
...
|
419
405
|
|
420
406
|
@typing.overload
|
421
|
-
def
|
407
|
+
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
422
408
|
"""
|
423
|
-
|
409
|
+
Specifies a timeout for your step.
|
410
|
+
|
411
|
+
This decorator is useful if this step may hang indefinitely.
|
412
|
+
|
413
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
414
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
415
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
416
|
+
|
417
|
+
Note that all the values specified in parameters are added together so if you specify
|
418
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
419
|
+
|
420
|
+
|
421
|
+
Parameters
|
422
|
+
----------
|
423
|
+
seconds : int, default 0
|
424
|
+
Number of seconds to wait prior to timing out.
|
425
|
+
minutes : int, default 0
|
426
|
+
Number of minutes to wait prior to timing out.
|
427
|
+
hours : int, default 0
|
428
|
+
Number of hours to wait prior to timing out.
|
424
429
|
"""
|
425
430
|
...
|
426
431
|
|
427
432
|
@typing.overload
|
428
|
-
def
|
433
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
429
434
|
...
|
430
435
|
|
431
|
-
|
436
|
+
@typing.overload
|
437
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
438
|
+
...
|
439
|
+
|
440
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
432
441
|
"""
|
433
|
-
|
442
|
+
Specifies a timeout for your step.
|
443
|
+
|
444
|
+
This decorator is useful if this step may hang indefinitely.
|
445
|
+
|
446
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
447
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
448
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
449
|
+
|
450
|
+
Note that all the values specified in parameters are added together so if you specify
|
451
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
452
|
+
|
453
|
+
|
454
|
+
Parameters
|
455
|
+
----------
|
456
|
+
seconds : int, default 0
|
457
|
+
Number of seconds to wait prior to timing out.
|
458
|
+
minutes : int, default 0
|
459
|
+
Number of minutes to wait prior to timing out.
|
460
|
+
hours : int, default 0
|
461
|
+
Number of hours to wait prior to timing out.
|
434
462
|
"""
|
435
463
|
...
|
436
464
|
|
@@ -574,273 +602,247 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
574
602
|
"""
|
575
603
|
...
|
576
604
|
|
577
|
-
|
578
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
579
|
-
"""
|
580
|
-
Decorator prototype for all step decorators. This function gets specialized
|
581
|
-
and imported for all decorators types by _import_plugin_decorators().
|
582
|
-
"""
|
583
|
-
...
|
584
|
-
|
585
|
-
@typing.overload
|
586
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
587
|
-
...
|
588
|
-
|
589
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
590
|
-
"""
|
591
|
-
Decorator prototype for all step decorators. This function gets specialized
|
592
|
-
and imported for all decorators types by _import_plugin_decorators().
|
593
|
-
"""
|
594
|
-
...
|
595
|
-
|
596
|
-
def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
597
|
-
"""
|
598
|
-
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
599
|
-
|
600
|
-
User code call
|
601
|
-
-----------
|
602
|
-
@ollama(
|
603
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
604
|
-
backend='local'
|
605
|
-
)
|
606
|
-
|
607
|
-
Valid backend options
|
608
|
-
---------------------
|
609
|
-
- 'local': Run as a separate process on the local task machine.
|
610
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
611
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
612
|
-
|
613
|
-
Valid model options
|
614
|
-
----------------
|
615
|
-
- 'llama3.2'
|
616
|
-
- 'llama3.3'
|
617
|
-
- any model here https://ollama.com/search
|
618
|
-
|
619
|
-
|
620
|
-
Parameters
|
621
|
-
----------
|
622
|
-
models: list[Ollama]
|
623
|
-
List of Ollama containers running models in sidecars.
|
624
|
-
backend: str
|
625
|
-
Determines where and how to run the Ollama process.
|
626
|
-
"""
|
627
|
-
...
|
628
|
-
|
629
|
-
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
605
|
+
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]]]:
|
630
606
|
"""
|
631
|
-
|
607
|
+
Specifies that this step is used to deploy an instance of the app.
|
608
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
632
609
|
|
633
610
|
|
634
611
|
Parameters
|
635
612
|
----------
|
636
|
-
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
The list of repos (models/datasets) to load.
|
641
|
-
|
642
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
643
|
-
|
644
|
-
- If repo (model/dataset) is not found in the datastore:
|
645
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
646
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
647
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
648
|
-
|
649
|
-
- If repo is found in the datastore:
|
650
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
613
|
+
app_port : int
|
614
|
+
Number of GPUs to use.
|
615
|
+
app_name : str
|
616
|
+
Name of the app to deploy.
|
651
617
|
"""
|
652
618
|
...
|
653
619
|
|
654
620
|
@typing.overload
|
655
|
-
def
|
621
|
+
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]]]:
|
656
622
|
"""
|
657
|
-
Specifies
|
658
|
-
|
659
|
-
Use `@resources` to specify the resource requirements
|
660
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
661
|
-
|
662
|
-
You can choose the compute layer on the command line by executing e.g.
|
663
|
-
```
|
664
|
-
python myflow.py run --with batch
|
665
|
-
```
|
666
|
-
or
|
667
|
-
```
|
668
|
-
python myflow.py run --with kubernetes
|
669
|
-
```
|
670
|
-
which executes the flow on the desired system using the
|
671
|
-
requirements specified in `@resources`.
|
623
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
624
|
+
the execution of a step.
|
672
625
|
|
673
626
|
|
674
627
|
Parameters
|
675
628
|
----------
|
676
|
-
|
677
|
-
|
678
|
-
gpu : int, optional, default None
|
679
|
-
Number of GPUs required for this step.
|
680
|
-
disk : int, optional, default None
|
681
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
682
|
-
memory : int, default 4096
|
683
|
-
Memory size (in MB) required for this step.
|
684
|
-
shared_memory : int, optional, default None
|
685
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
686
|
-
This parameter maps to the `--shm-size` option in Docker.
|
629
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
630
|
+
List of secret specs, defining how the secrets are to be retrieved
|
687
631
|
"""
|
688
632
|
...
|
689
633
|
|
690
634
|
@typing.overload
|
691
|
-
def
|
635
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
692
636
|
...
|
693
637
|
|
694
638
|
@typing.overload
|
695
|
-
def
|
639
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
696
640
|
...
|
697
641
|
|
698
|
-
def
|
642
|
+
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]]] = []):
|
699
643
|
"""
|
700
|
-
Specifies
|
701
|
-
|
702
|
-
Use `@resources` to specify the resource requirements
|
703
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
704
|
-
|
705
|
-
You can choose the compute layer on the command line by executing e.g.
|
706
|
-
```
|
707
|
-
python myflow.py run --with batch
|
708
|
-
```
|
709
|
-
or
|
710
|
-
```
|
711
|
-
python myflow.py run --with kubernetes
|
712
|
-
```
|
713
|
-
which executes the flow on the desired system using the
|
714
|
-
requirements specified in `@resources`.
|
644
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
645
|
+
the execution of a step.
|
715
646
|
|
716
647
|
|
717
648
|
Parameters
|
718
649
|
----------
|
719
|
-
|
720
|
-
|
721
|
-
gpu : int, optional, default None
|
722
|
-
Number of GPUs required for this step.
|
723
|
-
disk : int, optional, default None
|
724
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
725
|
-
memory : int, default 4096
|
726
|
-
Memory size (in MB) required for this step.
|
727
|
-
shared_memory : int, optional, default None
|
728
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
729
|
-
This parameter maps to the `--shm-size` option in Docker.
|
650
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
651
|
+
List of secret specs, defining how the secrets are to be retrieved
|
730
652
|
"""
|
731
653
|
...
|
732
654
|
|
733
655
|
@typing.overload
|
734
|
-
def
|
656
|
+
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]]]:
|
735
657
|
"""
|
736
|
-
Specifies the
|
658
|
+
Specifies the PyPI packages for the step.
|
737
659
|
|
738
660
|
Information in this decorator will augment any
|
739
|
-
attributes set in the `@
|
740
|
-
you can use `@
|
741
|
-
steps and use `@
|
661
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
662
|
+
you can use `@pypi_base` to set packages required by all
|
663
|
+
steps and use `@pypi` to specify step-specific overrides.
|
742
664
|
|
743
665
|
|
744
666
|
Parameters
|
745
667
|
----------
|
746
|
-
packages : Dict[str, str], default {}
|
668
|
+
packages : Dict[str, str], default: {}
|
747
669
|
Packages to use for this step. The key is the name of the package
|
748
670
|
and the value is the version to use.
|
749
|
-
|
750
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
751
|
-
python : str, optional, default None
|
671
|
+
python : str, optional, default: None
|
752
672
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
753
673
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
754
|
-
disabled : bool, default False
|
755
|
-
If set to True, disables @conda.
|
756
674
|
"""
|
757
675
|
...
|
758
676
|
|
759
677
|
@typing.overload
|
760
|
-
def
|
678
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
761
679
|
...
|
762
680
|
|
763
681
|
@typing.overload
|
764
|
-
def
|
682
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
765
683
|
...
|
766
684
|
|
767
|
-
def
|
685
|
+
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):
|
768
686
|
"""
|
769
|
-
Specifies the
|
687
|
+
Specifies the PyPI packages for the step.
|
770
688
|
|
771
689
|
Information in this decorator will augment any
|
772
|
-
attributes set in the `@
|
773
|
-
you can use `@
|
774
|
-
steps and use `@
|
690
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
691
|
+
you can use `@pypi_base` to set packages required by all
|
692
|
+
steps and use `@pypi` to specify step-specific overrides.
|
775
693
|
|
776
694
|
|
777
695
|
Parameters
|
778
696
|
----------
|
779
|
-
packages : Dict[str, str], default {}
|
697
|
+
packages : Dict[str, str], default: {}
|
780
698
|
Packages to use for this step. The key is the name of the package
|
781
699
|
and the value is the version to use.
|
782
|
-
|
783
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
784
|
-
python : str, optional, default None
|
700
|
+
python : str, optional, default: None
|
785
701
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
786
702
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
787
|
-
disabled : bool, default False
|
788
|
-
If set to True, disables @conda.
|
789
703
|
"""
|
790
704
|
...
|
791
705
|
|
792
706
|
@typing.overload
|
793
|
-
def
|
707
|
+
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]]]:
|
794
708
|
"""
|
795
|
-
|
796
|
-
|
709
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
710
|
+
|
711
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
797
712
|
|
798
713
|
|
799
714
|
Parameters
|
800
715
|
----------
|
801
|
-
|
802
|
-
|
716
|
+
type : str, default 'default'
|
717
|
+
Card type.
|
718
|
+
id : str, optional, default None
|
719
|
+
If multiple cards are present, use this id to identify this card.
|
720
|
+
options : Dict[str, Any], default {}
|
721
|
+
Options passed to the card. The contents depend on the card type.
|
722
|
+
timeout : int, default 45
|
723
|
+
Interrupt reporting if it takes more than this many seconds.
|
803
724
|
"""
|
804
725
|
...
|
805
726
|
|
806
727
|
@typing.overload
|
807
|
-
def
|
728
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
808
729
|
...
|
809
730
|
|
810
731
|
@typing.overload
|
811
|
-
def
|
732
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
812
733
|
...
|
813
734
|
|
814
|
-
def
|
735
|
+
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):
|
815
736
|
"""
|
816
|
-
|
817
|
-
|
737
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
738
|
+
|
739
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
818
740
|
|
819
741
|
|
820
742
|
Parameters
|
821
743
|
----------
|
822
|
-
|
823
|
-
|
744
|
+
type : str, default 'default'
|
745
|
+
Card type.
|
746
|
+
id : str, optional, default None
|
747
|
+
If multiple cards are present, use this id to identify this card.
|
748
|
+
options : Dict[str, Any], default {}
|
749
|
+
Options passed to the card. The contents depend on the card type.
|
750
|
+
timeout : int, default 45
|
751
|
+
Interrupt reporting if it takes more than this many seconds.
|
824
752
|
"""
|
825
753
|
...
|
826
754
|
|
827
|
-
|
755
|
+
@typing.overload
|
756
|
+
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]]]:
|
828
757
|
"""
|
829
|
-
|
758
|
+
Enables checkpointing for a step.
|
759
|
+
|
830
760
|
|
831
761
|
|
832
762
|
Parameters
|
833
763
|
----------
|
834
|
-
|
835
|
-
|
836
|
-
|
837
|
-
|
764
|
+
load_policy : str, default: "fresh"
|
765
|
+
The policy for loading the checkpoint. The following policies are supported:
|
766
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
767
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
768
|
+
will be loaded at the start of the task.
|
769
|
+
- "none": Do not load any checkpoint
|
770
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
771
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
772
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
773
|
+
created within the task will be loaded when the task is retries execution on failure.
|
774
|
+
|
775
|
+
temp_dir_root : str, default: None
|
776
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
777
|
+
"""
|
778
|
+
...
|
779
|
+
|
780
|
+
@typing.overload
|
781
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
782
|
+
...
|
783
|
+
|
784
|
+
@typing.overload
|
785
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
786
|
+
...
|
787
|
+
|
788
|
+
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):
|
789
|
+
"""
|
790
|
+
Enables checkpointing for a step.
|
791
|
+
|
792
|
+
|
793
|
+
|
794
|
+
Parameters
|
795
|
+
----------
|
796
|
+
load_policy : str, default: "fresh"
|
797
|
+
The policy for loading the checkpoint. The following policies are supported:
|
798
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
799
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
800
|
+
will be loaded at the start of the task.
|
801
|
+
- "none": Do not load any checkpoint
|
802
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
803
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
804
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
805
|
+
created within the task will be loaded when the task is retries execution on failure.
|
806
|
+
|
807
|
+
temp_dir_root : str, default: None
|
808
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
809
|
+
"""
|
810
|
+
...
|
811
|
+
|
812
|
+
def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
813
|
+
"""
|
814
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
815
|
+
|
816
|
+
User code call
|
817
|
+
-----------
|
818
|
+
@nim(
|
819
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
820
|
+
backend='managed'
|
821
|
+
)
|
822
|
+
|
823
|
+
Valid backend options
|
824
|
+
---------------------
|
825
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
826
|
+
|
827
|
+
Valid model options
|
828
|
+
----------------
|
829
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
830
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
831
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
832
|
+
|
833
|
+
|
834
|
+
Parameters
|
835
|
+
----------
|
836
|
+
models: list[NIM]
|
837
|
+
List of NIM containers running models in sidecars.
|
838
|
+
backend: str
|
839
|
+
Compute provider to run the NIM container.
|
838
840
|
queue_timeout : int
|
839
841
|
Time to keep the job in NVCF's queue.
|
840
842
|
"""
|
841
843
|
...
|
842
844
|
|
843
|
-
def
|
845
|
+
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]]]:
|
844
846
|
"""
|
845
847
|
Specifies that this step should execute on DGX cloud.
|
846
848
|
|
@@ -851,147 +853,145 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
|
|
851
853
|
Number of GPUs to use.
|
852
854
|
gpu_type : str
|
853
855
|
Type of Nvidia GPU to use.
|
856
|
+
queue_timeout : int
|
857
|
+
Time to keep the job in NVCF's queue.
|
854
858
|
"""
|
855
859
|
...
|
856
860
|
|
857
861
|
@typing.overload
|
858
|
-
def
|
862
|
+
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]]]:
|
859
863
|
"""
|
860
|
-
|
864
|
+
Enables loading / saving of models within a step.
|
861
865
|
|
862
|
-
The decorator will create an optional artifact, specified by `var`, which
|
863
|
-
contains the exception raised. You can use it to detect the presence
|
864
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
865
|
-
are missing.
|
866
866
|
|
867
867
|
|
868
868
|
Parameters
|
869
869
|
----------
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
870
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
871
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
872
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
873
|
+
- `current.checkpoint`
|
874
|
+
- `current.model`
|
875
|
+
- `current.huggingface_hub`
|
876
|
+
|
877
|
+
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
|
878
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
879
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
880
|
+
|
881
|
+
temp_dir_root : str, default: None
|
882
|
+
The root directory under which `current.model.loaded` will store loaded models
|
876
883
|
"""
|
877
884
|
...
|
878
885
|
|
879
886
|
@typing.overload
|
880
|
-
def
|
887
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
881
888
|
...
|
882
889
|
|
883
890
|
@typing.overload
|
884
|
-
def
|
891
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
885
892
|
...
|
886
893
|
|
887
|
-
def
|
894
|
+
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):
|
888
895
|
"""
|
889
|
-
|
896
|
+
Enables loading / saving of models within a step.
|
890
897
|
|
891
|
-
The decorator will create an optional artifact, specified by `var`, which
|
892
|
-
contains the exception raised. You can use it to detect the presence
|
893
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
894
|
-
are missing.
|
895
898
|
|
896
899
|
|
897
900
|
Parameters
|
898
901
|
----------
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
902
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
903
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
904
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
905
|
+
- `current.checkpoint`
|
906
|
+
- `current.model`
|
907
|
+
- `current.huggingface_hub`
|
908
|
+
|
909
|
+
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
|
910
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
911
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
912
|
+
|
913
|
+
temp_dir_root : str, default: None
|
914
|
+
The root directory under which `current.model.loaded` will store loaded models
|
905
915
|
"""
|
906
916
|
...
|
907
917
|
|
908
|
-
def
|
918
|
+
def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
909
919
|
"""
|
910
|
-
This decorator is used to run
|
920
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
911
921
|
|
912
922
|
User code call
|
913
923
|
-----------
|
914
|
-
@
|
924
|
+
@ollama(
|
915
925
|
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
916
|
-
backend='
|
926
|
+
backend='local'
|
917
927
|
)
|
918
928
|
|
919
929
|
Valid backend options
|
920
930
|
---------------------
|
921
|
-
- '
|
931
|
+
- 'local': Run as a separate process on the local task machine.
|
932
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
933
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
922
934
|
|
923
935
|
Valid model options
|
924
936
|
----------------
|
925
|
-
- '
|
926
|
-
- '
|
927
|
-
- any model here
|
937
|
+
- 'llama3.2'
|
938
|
+
- 'llama3.3'
|
939
|
+
- any model here https://ollama.com/search
|
928
940
|
|
929
941
|
|
930
942
|
Parameters
|
931
943
|
----------
|
932
|
-
models: list[
|
933
|
-
List of
|
944
|
+
models: list[Ollama]
|
945
|
+
List of Ollama containers running models in sidecars.
|
934
946
|
backend: str
|
935
|
-
|
936
|
-
queue_timeout : int
|
937
|
-
Time to keep the job in NVCF's queue.
|
947
|
+
Determines where and how to run the Ollama process.
|
938
948
|
"""
|
939
949
|
...
|
940
950
|
|
941
951
|
@typing.overload
|
942
|
-
def
|
952
|
+
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]]]:
|
943
953
|
"""
|
944
|
-
|
945
|
-
|
954
|
+
Specifies environment variables to be set prior to the execution of a step.
|
946
955
|
|
947
956
|
|
948
957
|
Parameters
|
949
958
|
----------
|
950
|
-
|
951
|
-
|
952
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
953
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
954
|
-
will be loaded at the start of the task.
|
955
|
-
- "none": Do not load any checkpoint
|
956
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
957
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
958
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
959
|
-
created within the task will be loaded when the task is retries execution on failure.
|
960
|
-
|
961
|
-
temp_dir_root : str, default: None
|
962
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
959
|
+
vars : Dict[str, str], default {}
|
960
|
+
Dictionary of environment variables to set.
|
963
961
|
"""
|
964
962
|
...
|
965
963
|
|
966
964
|
@typing.overload
|
967
|
-
def
|
965
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
968
966
|
...
|
969
967
|
|
970
968
|
@typing.overload
|
971
|
-
def
|
969
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
972
970
|
...
|
973
971
|
|
974
|
-
def
|
972
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
975
973
|
"""
|
976
|
-
|
977
|
-
|
974
|
+
Specifies environment variables to be set prior to the execution of a step.
|
978
975
|
|
979
976
|
|
980
977
|
Parameters
|
981
978
|
----------
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
991
|
-
created within the task will be loaded when the task is retries execution on failure.
|
979
|
+
vars : Dict[str, str], default {}
|
980
|
+
Dictionary of environment variables to set.
|
981
|
+
"""
|
982
|
+
...
|
983
|
+
|
984
|
+
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]]]:
|
985
|
+
"""
|
986
|
+
Specifies that this step should execute on DGX cloud.
|
992
987
|
|
993
|
-
|
994
|
-
|
988
|
+
|
989
|
+
Parameters
|
990
|
+
----------
|
991
|
+
gpu : int
|
992
|
+
Number of GPUs to use.
|
993
|
+
gpu_type : str
|
994
|
+
Type of Nvidia GPU to use.
|
995
995
|
"""
|
996
996
|
...
|
997
997
|
|
@@ -1089,53 +1089,144 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1089
1089
|
...
|
1090
1090
|
|
1091
1091
|
@typing.overload
|
1092
|
-
def
|
1092
|
+
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]]:
|
1093
1093
|
"""
|
1094
|
-
Specifies the
|
1095
|
-
|
1094
|
+
Specifies the flow(s) that this flow depends on.
|
1095
|
+
|
1096
|
+
```
|
1097
|
+
@trigger_on_finish(flow='FooFlow')
|
1098
|
+
```
|
1099
|
+
or
|
1100
|
+
```
|
1101
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1102
|
+
```
|
1103
|
+
This decorator respects the @project decorator and triggers the flow
|
1104
|
+
when upstream runs within the same namespace complete successfully
|
1105
|
+
|
1106
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1107
|
+
by specifying the fully qualified project_flow_name.
|
1108
|
+
```
|
1109
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1110
|
+
```
|
1111
|
+
or
|
1112
|
+
```
|
1113
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1114
|
+
```
|
1115
|
+
|
1116
|
+
You can also specify just the project or project branch (other values will be
|
1117
|
+
inferred from the current project or project branch):
|
1118
|
+
```
|
1119
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1120
|
+
```
|
1121
|
+
|
1122
|
+
Note that `branch` is typically one of:
|
1123
|
+
- `prod`
|
1124
|
+
- `user.bob`
|
1125
|
+
- `test.my_experiment`
|
1126
|
+
- `prod.staging`
|
1096
1127
|
|
1097
1128
|
|
1098
1129
|
Parameters
|
1099
1130
|
----------
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1131
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1132
|
+
Upstream flow dependency for this flow.
|
1133
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1134
|
+
Upstream flow dependencies for this flow.
|
1135
|
+
options : Dict[str, Any], default {}
|
1136
|
+
Backend-specific configuration for tuning eventing behavior.
|
1137
|
+
"""
|
1138
|
+
...
|
1139
|
+
|
1140
|
+
@typing.overload
|
1141
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1142
|
+
...
|
1143
|
+
|
1144
|
+
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] = {}):
|
1145
|
+
"""
|
1146
|
+
Specifies the flow(s) that this flow depends on.
|
1147
|
+
|
1148
|
+
```
|
1149
|
+
@trigger_on_finish(flow='FooFlow')
|
1150
|
+
```
|
1151
|
+
or
|
1152
|
+
```
|
1153
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1154
|
+
```
|
1155
|
+
This decorator respects the @project decorator and triggers the flow
|
1156
|
+
when upstream runs within the same namespace complete successfully
|
1157
|
+
|
1158
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1159
|
+
by specifying the fully qualified project_flow_name.
|
1160
|
+
```
|
1161
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1162
|
+
```
|
1163
|
+
or
|
1164
|
+
```
|
1165
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1166
|
+
```
|
1167
|
+
|
1168
|
+
You can also specify just the project or project branch (other values will be
|
1169
|
+
inferred from the current project or project branch):
|
1170
|
+
```
|
1171
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1172
|
+
```
|
1173
|
+
|
1174
|
+
Note that `branch` is typically one of:
|
1175
|
+
- `prod`
|
1176
|
+
- `user.bob`
|
1177
|
+
- `test.my_experiment`
|
1178
|
+
- `prod.staging`
|
1179
|
+
|
1180
|
+
|
1181
|
+
Parameters
|
1182
|
+
----------
|
1183
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1184
|
+
Upstream flow dependency for this flow.
|
1185
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1186
|
+
Upstream flow dependencies for this flow.
|
1187
|
+
options : Dict[str, Any], default {}
|
1188
|
+
Backend-specific configuration for tuning eventing behavior.
|
1189
|
+
"""
|
1190
|
+
...
|
1191
|
+
|
1192
|
+
@typing.overload
|
1193
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1194
|
+
"""
|
1195
|
+
Specifies the PyPI packages for all steps of the flow.
|
1196
|
+
|
1197
|
+
Use `@pypi_base` to set common packages required by all
|
1198
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1199
|
+
|
1200
|
+
Parameters
|
1201
|
+
----------
|
1202
|
+
packages : Dict[str, str], default: {}
|
1203
|
+
Packages to use for this flow. The key is the name of the package
|
1204
|
+
and the value is the version to use.
|
1205
|
+
python : str, optional, default: None
|
1206
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1207
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1112
1208
|
"""
|
1113
1209
|
...
|
1114
1210
|
|
1115
1211
|
@typing.overload
|
1116
|
-
def
|
1212
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1117
1213
|
...
|
1118
1214
|
|
1119
|
-
def
|
1215
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1120
1216
|
"""
|
1121
|
-
Specifies the
|
1122
|
-
production scheduler.
|
1217
|
+
Specifies the PyPI packages for all steps of the flow.
|
1123
1218
|
|
1219
|
+
Use `@pypi_base` to set common packages required by all
|
1220
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1124
1221
|
|
1125
1222
|
Parameters
|
1126
1223
|
----------
|
1127
|
-
|
1128
|
-
|
1129
|
-
|
1130
|
-
|
1131
|
-
|
1132
|
-
|
1133
|
-
cron : str, optional, default None
|
1134
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1135
|
-
specified by this expression.
|
1136
|
-
timezone : str, optional, default None
|
1137
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1138
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1224
|
+
packages : Dict[str, str], default: {}
|
1225
|
+
Packages to use for this flow. The key is the name of the package
|
1226
|
+
and the value is the version to use.
|
1227
|
+
python : str, optional, default: None
|
1228
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1229
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1139
1230
|
"""
|
1140
1231
|
...
|
1141
1232
|
|
@@ -1254,103 +1345,53 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1254
1345
|
...
|
1255
1346
|
|
1256
1347
|
@typing.overload
|
1257
|
-
def
|
1348
|
+
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]]:
|
1258
1349
|
"""
|
1259
|
-
Specifies the
|
1260
|
-
|
1261
|
-
```
|
1262
|
-
@trigger_on_finish(flow='FooFlow')
|
1263
|
-
```
|
1264
|
-
or
|
1265
|
-
```
|
1266
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1267
|
-
```
|
1268
|
-
This decorator respects the @project decorator and triggers the flow
|
1269
|
-
when upstream runs within the same namespace complete successfully
|
1270
|
-
|
1271
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1272
|
-
by specifying the fully qualified project_flow_name.
|
1273
|
-
```
|
1274
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1275
|
-
```
|
1276
|
-
or
|
1277
|
-
```
|
1278
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1279
|
-
```
|
1280
|
-
|
1281
|
-
You can also specify just the project or project branch (other values will be
|
1282
|
-
inferred from the current project or project branch):
|
1283
|
-
```
|
1284
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1285
|
-
```
|
1286
|
-
|
1287
|
-
Note that `branch` is typically one of:
|
1288
|
-
- `prod`
|
1289
|
-
- `user.bob`
|
1290
|
-
- `test.my_experiment`
|
1291
|
-
- `prod.staging`
|
1350
|
+
Specifies the times when the flow should be run when running on a
|
1351
|
+
production scheduler.
|
1292
1352
|
|
1293
1353
|
|
1294
1354
|
Parameters
|
1295
1355
|
----------
|
1296
|
-
|
1297
|
-
|
1298
|
-
|
1299
|
-
|
1300
|
-
|
1301
|
-
|
1356
|
+
hourly : bool, default False
|
1357
|
+
Run the workflow hourly.
|
1358
|
+
daily : bool, default True
|
1359
|
+
Run the workflow daily.
|
1360
|
+
weekly : bool, default False
|
1361
|
+
Run the workflow weekly.
|
1362
|
+
cron : str, optional, default None
|
1363
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1364
|
+
specified by this expression.
|
1365
|
+
timezone : str, optional, default None
|
1366
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1367
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1302
1368
|
"""
|
1303
1369
|
...
|
1304
1370
|
|
1305
1371
|
@typing.overload
|
1306
|
-
def
|
1372
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1307
1373
|
...
|
1308
1374
|
|
1309
|
-
def
|
1375
|
+
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):
|
1310
1376
|
"""
|
1311
|
-
Specifies the
|
1312
|
-
|
1313
|
-
```
|
1314
|
-
@trigger_on_finish(flow='FooFlow')
|
1315
|
-
```
|
1316
|
-
or
|
1317
|
-
```
|
1318
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1319
|
-
```
|
1320
|
-
This decorator respects the @project decorator and triggers the flow
|
1321
|
-
when upstream runs within the same namespace complete successfully
|
1322
|
-
|
1323
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1324
|
-
by specifying the fully qualified project_flow_name.
|
1325
|
-
```
|
1326
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1327
|
-
```
|
1328
|
-
or
|
1329
|
-
```
|
1330
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1331
|
-
```
|
1332
|
-
|
1333
|
-
You can also specify just the project or project branch (other values will be
|
1334
|
-
inferred from the current project or project branch):
|
1335
|
-
```
|
1336
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1337
|
-
```
|
1338
|
-
|
1339
|
-
Note that `branch` is typically one of:
|
1340
|
-
- `prod`
|
1341
|
-
- `user.bob`
|
1342
|
-
- `test.my_experiment`
|
1343
|
-
- `prod.staging`
|
1377
|
+
Specifies the times when the flow should be run when running on a
|
1378
|
+
production scheduler.
|
1344
1379
|
|
1345
1380
|
|
1346
1381
|
Parameters
|
1347
1382
|
----------
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1352
|
-
|
1353
|
-
|
1383
|
+
hourly : bool, default False
|
1384
|
+
Run the workflow hourly.
|
1385
|
+
daily : bool, default True
|
1386
|
+
Run the workflow daily.
|
1387
|
+
weekly : bool, default False
|
1388
|
+
Run the workflow weekly.
|
1389
|
+
cron : str, optional, default None
|
1390
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1391
|
+
specified by this expression.
|
1392
|
+
timezone : str, optional, default None
|
1393
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1394
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1354
1395
|
"""
|
1355
1396
|
...
|
1356
1397
|
|
@@ -1405,10 +1446,13 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1405
1446
|
"""
|
1406
1447
|
...
|
1407
1448
|
|
1408
|
-
def
|
1449
|
+
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]]:
|
1409
1450
|
"""
|
1410
|
-
The `@
|
1411
|
-
This decorator only works when a flow is scheduled on Airflow
|
1451
|
+
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)
|
1452
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1453
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1454
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1455
|
+
starts only after all sensors finish.
|
1412
1456
|
|
1413
1457
|
|
1414
1458
|
Parameters
|
@@ -1430,62 +1474,18 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1430
1474
|
Name of the sensor on Airflow
|
1431
1475
|
description : str
|
1432
1476
|
Description of sensor in the Airflow UI
|
1433
|
-
|
1434
|
-
The
|
1435
|
-
|
1436
|
-
|
1437
|
-
|
1438
|
-
|
1439
|
-
|
1440
|
-
|
1441
|
-
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
check_existence: bool
|
1446
|
-
Set to True to check if the external task exists or check if
|
1447
|
-
the DAG to wait for exists. (Default: True)
|
1448
|
-
"""
|
1449
|
-
...
|
1450
|
-
|
1451
|
-
@typing.overload
|
1452
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1453
|
-
"""
|
1454
|
-
Specifies the PyPI packages for all steps of the flow.
|
1455
|
-
|
1456
|
-
Use `@pypi_base` to set common packages required by all
|
1457
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1458
|
-
|
1459
|
-
Parameters
|
1460
|
-
----------
|
1461
|
-
packages : Dict[str, str], default: {}
|
1462
|
-
Packages to use for this flow. The key is the name of the package
|
1463
|
-
and the value is the version to use.
|
1464
|
-
python : str, optional, default: None
|
1465
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1466
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1467
|
-
"""
|
1468
|
-
...
|
1469
|
-
|
1470
|
-
@typing.overload
|
1471
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1472
|
-
...
|
1473
|
-
|
1474
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1475
|
-
"""
|
1476
|
-
Specifies the PyPI packages for all steps of the flow.
|
1477
|
-
|
1478
|
-
Use `@pypi_base` to set common packages required by all
|
1479
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1480
|
-
|
1481
|
-
Parameters
|
1482
|
-
----------
|
1483
|
-
packages : Dict[str, str], default: {}
|
1484
|
-
Packages to use for this flow. The key is the name of the package
|
1485
|
-
and the value is the version to use.
|
1486
|
-
python : str, optional, default: None
|
1487
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1488
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1477
|
+
bucket_key : Union[str, List[str]]
|
1478
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1479
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1480
|
+
bucket_name : str
|
1481
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1482
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1483
|
+
wildcard_match : bool
|
1484
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1485
|
+
aws_conn_id : str
|
1486
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1487
|
+
verify : bool
|
1488
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1489
1489
|
"""
|
1490
1490
|
...
|
1491
1491
|
|
@@ -1524,13 +1524,10 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
|
|
1524
1524
|
"""
|
1525
1525
|
...
|
1526
1526
|
|
1527
|
-
def
|
1527
|
+
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]]:
|
1528
1528
|
"""
|
1529
|
-
The `@
|
1530
|
-
|
1531
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1532
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1533
|
-
starts only after all sensors finish.
|
1529
|
+
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.
|
1530
|
+
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.
|
1534
1531
|
|
1535
1532
|
|
1536
1533
|
Parameters
|
@@ -1552,18 +1549,21 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1552
1549
|
Name of the sensor on Airflow
|
1553
1550
|
description : str
|
1554
1551
|
Description of sensor in the Airflow UI
|
1555
|
-
|
1556
|
-
The
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1552
|
+
external_dag_id : str
|
1553
|
+
The dag_id that contains the task you want to wait for.
|
1554
|
+
external_task_ids : List[str]
|
1555
|
+
The list of task_ids that you want to wait for.
|
1556
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1557
|
+
allowed_states : List[str]
|
1558
|
+
Iterable of allowed states, (Default: ['success'])
|
1559
|
+
failed_states : List[str]
|
1560
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1561
|
+
execution_delta : datetime.timedelta
|
1562
|
+
time difference with the previous execution to look at,
|
1563
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1564
|
+
check_existence: bool
|
1565
|
+
Set to True to check if the external task exists or check if
|
1566
|
+
the DAG to wait for exists. (Default: True)
|
1567
1567
|
"""
|
1568
1568
|
...
|
1569
1569
|
|