ob-metaflow-stubs 6.0.3.163__py2.py3-none-any.whl → 6.0.3.165__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 +750 -736
- 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 +5 -5
- metaflow-stubs/client/filecache.pyi +1 -1
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- 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 +65 -65
- 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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- 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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +1 -1
- 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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/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/card_utilities/__init__.pyi +1 -1
- 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/ollama/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.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/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +12 -12
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- 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 +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +1 -1
- 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 +4 -4
- 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 +1 -1
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +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 +1 -1
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
- metaflow-stubs/plugins/uv/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
- 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 +4 -4
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- 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 +2 -2
- 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 +5 -5
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.163.dist-info → ob_metaflow_stubs-6.0.3.165.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.165.dist-info/RECORD +206 -0
- ob_metaflow_stubs-6.0.3.163.dist-info/RECORD +0 -206
- {ob_metaflow_stubs-6.0.3.163.dist-info → ob_metaflow_stubs-6.0.3.165.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.163.dist-info → ob_metaflow_stubs-6.0.3.165.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.15.11.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-05-
|
4
|
+
# Generated on 2025-05-08T08:48:06.309319 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -36,9 +36,9 @@ 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 metaflow_git as metaflow_git
|
39
40
|
from . import tuple_util as tuple_util
|
40
41
|
from . import events as events
|
41
|
-
from . import metaflow_git as metaflow_git
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
@@ -154,183 +154,183 @@ 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
|
159
|
+
Specifies the resources needed when executing this step.
|
160
160
|
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
161
|
+
Use `@resources` to specify the resource requirements
|
162
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
163
|
+
|
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`.
|
165
174
|
|
166
175
|
|
167
176
|
Parameters
|
168
177
|
----------
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
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.
|
175
189
|
"""
|
176
190
|
...
|
177
191
|
|
178
192
|
@typing.overload
|
179
|
-
def
|
193
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
180
194
|
...
|
181
195
|
|
182
196
|
@typing.overload
|
183
|
-
def
|
197
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
184
198
|
...
|
185
199
|
|
186
|
-
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):
|
187
201
|
"""
|
188
|
-
Specifies
|
202
|
+
Specifies the resources needed when executing this step.
|
189
203
|
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
204
|
+
Use `@resources` to specify the resource requirements
|
205
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
206
|
+
|
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`.
|
194
217
|
|
195
218
|
|
196
219
|
Parameters
|
197
220
|
----------
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
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.
|
204
232
|
"""
|
205
233
|
...
|
206
234
|
|
207
235
|
@typing.overload
|
208
|
-
def
|
236
|
+
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
237
|
"""
|
210
|
-
Specifies
|
238
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
239
|
+
the execution of a step.
|
211
240
|
|
212
241
|
|
213
242
|
Parameters
|
214
243
|
----------
|
215
|
-
|
216
|
-
|
244
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
245
|
+
List of secret specs, defining how the secrets are to be retrieved
|
217
246
|
"""
|
218
247
|
...
|
219
248
|
|
220
249
|
@typing.overload
|
221
|
-
def
|
250
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
222
251
|
...
|
223
252
|
|
224
253
|
@typing.overload
|
225
|
-
def
|
254
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
226
255
|
...
|
227
256
|
|
228
|
-
def
|
257
|
+
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]]] = []):
|
229
258
|
"""
|
230
|
-
Specifies
|
259
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
260
|
+
the execution of a step.
|
231
261
|
|
232
262
|
|
233
263
|
Parameters
|
234
264
|
----------
|
235
|
-
|
236
|
-
|
265
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
266
|
+
List of secret specs, defining how the secrets are to be retrieved
|
237
267
|
"""
|
238
268
|
...
|
239
269
|
|
240
|
-
def
|
270
|
+
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]]]:
|
241
271
|
"""
|
242
|
-
|
272
|
+
Specifies that this step should execute on DGX cloud.
|
243
273
|
|
244
274
|
|
245
275
|
Parameters
|
246
276
|
----------
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
254
|
-
|
255
|
-
- If repo (model/dataset) is not found in the datastore:
|
256
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
257
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
258
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
259
|
-
|
260
|
-
- If repo is found in the datastore:
|
261
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
277
|
+
gpu : int
|
278
|
+
Number of GPUs to use.
|
279
|
+
gpu_type : str
|
280
|
+
Type of Nvidia GPU to use.
|
281
|
+
queue_timeout : int
|
282
|
+
Time to keep the job in NVCF's queue.
|
262
283
|
"""
|
263
284
|
...
|
264
285
|
|
265
286
|
@typing.overload
|
266
|
-
def
|
287
|
+
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]]]:
|
267
288
|
"""
|
268
|
-
|
289
|
+
Specifies that the step will success under all circumstances.
|
269
290
|
|
291
|
+
The decorator will create an optional artifact, specified by `var`, which
|
292
|
+
contains the exception raised. You can use it to detect the presence
|
293
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
294
|
+
are missing.
|
270
295
|
|
271
296
|
|
272
297
|
Parameters
|
273
298
|
----------
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
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
|
282
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
283
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
284
|
-
|
285
|
-
temp_dir_root : str, default: None
|
286
|
-
The root directory under which `current.model.loaded` will store loaded models
|
299
|
+
var : str, optional, default None
|
300
|
+
Name of the artifact in which to store the caught exception.
|
301
|
+
If not specified, the exception is not stored.
|
302
|
+
print_exception : bool, default True
|
303
|
+
Determines whether or not the exception is printed to
|
304
|
+
stdout when caught.
|
287
305
|
"""
|
288
306
|
...
|
289
307
|
|
290
308
|
@typing.overload
|
291
|
-
def
|
309
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
292
310
|
...
|
293
311
|
|
294
312
|
@typing.overload
|
295
|
-
def
|
313
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
296
314
|
...
|
297
315
|
|
298
|
-
def
|
316
|
+
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):
|
299
317
|
"""
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
Parameters
|
305
|
-
----------
|
306
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
307
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
308
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
309
|
-
- `current.checkpoint`
|
310
|
-
- `current.model`
|
311
|
-
- `current.huggingface_hub`
|
312
|
-
|
313
|
-
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
|
314
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
315
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
318
|
+
Specifies that the step will success under all circumstances.
|
316
319
|
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
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]]]:
|
323
|
-
"""
|
324
|
-
Specifies that this step is used to deploy an instance of the app.
|
325
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
320
|
+
The decorator will create an optional artifact, specified by `var`, which
|
321
|
+
contains the exception raised. You can use it to detect the presence
|
322
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
323
|
+
are missing.
|
326
324
|
|
327
325
|
|
328
326
|
Parameters
|
329
327
|
----------
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
328
|
+
var : str, optional, default None
|
329
|
+
Name of the artifact in which to store the caught exception.
|
330
|
+
If not specified, the exception is not stored.
|
331
|
+
print_exception : bool, default True
|
332
|
+
Determines whether or not the exception is printed to
|
333
|
+
stdout when caught.
|
334
334
|
"""
|
335
335
|
...
|
336
336
|
|
@@ -367,138 +367,62 @@ def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Call
|
|
367
367
|
"""
|
368
368
|
...
|
369
369
|
|
370
|
-
|
370
|
+
@typing.overload
|
371
|
+
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]]]:
|
371
372
|
"""
|
372
|
-
Specifies
|
373
|
+
Specifies the Conda environment for the step.
|
374
|
+
|
375
|
+
Information in this decorator will augment any
|
376
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
377
|
+
you can use `@conda_base` to set packages required by all
|
378
|
+
steps and use `@conda` to specify step-specific overrides.
|
373
379
|
|
374
380
|
|
375
381
|
Parameters
|
376
382
|
----------
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
used.
|
388
|
-
image : str, optional, default None
|
389
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
390
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
391
|
-
not, a default Docker image mapping to the current version of Python is used.
|
392
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
393
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
394
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
395
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
396
|
-
secrets : List[str], optional, default None
|
397
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
398
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
399
|
-
in Metaflow configuration.
|
400
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
401
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
402
|
-
Can be passed in as a comma separated string of values e.g.
|
403
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
404
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
405
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
406
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
407
|
-
gpu : int, optional, default None
|
408
|
-
Number of GPUs required for this step. A value of zero implies that
|
409
|
-
the scheduled node should not have GPUs.
|
410
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
411
|
-
The vendor of the GPUs to be used for this step.
|
412
|
-
tolerations : List[str], default []
|
413
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
414
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
415
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
416
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
417
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
418
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
419
|
-
use_tmpfs : bool, default False
|
420
|
-
This enables an explicit tmpfs mount for this step.
|
421
|
-
tmpfs_tempdir : bool, default True
|
422
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
423
|
-
tmpfs_size : int, optional, default: None
|
424
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
425
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
426
|
-
memory allocated for this step.
|
427
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
428
|
-
Path to tmpfs mount for this step.
|
429
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
430
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
431
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
432
|
-
shared_memory: int, optional
|
433
|
-
Shared memory size (in MiB) required for this step
|
434
|
-
port: int, optional
|
435
|
-
Port number to specify in the Kubernetes job object
|
436
|
-
compute_pool : str, optional, default None
|
437
|
-
Compute pool to be used for for this step.
|
438
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
439
|
-
hostname_resolution_timeout: int, default 10 * 60
|
440
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
441
|
-
Only applicable when @parallel is used.
|
442
|
-
qos: str, default: Burstable
|
443
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
444
|
-
|
445
|
-
security_context: Dict[str, Any], optional, default None
|
446
|
-
Container security context. Applies to the task container. Allows the following keys:
|
447
|
-
- privileged: bool, optional, default None
|
448
|
-
- allow_privilege_escalation: bool, optional, default None
|
449
|
-
- run_as_user: int, optional, default None
|
450
|
-
- run_as_group: int, optional, default None
|
451
|
-
- run_as_non_root: bool, optional, default None
|
452
|
-
"""
|
453
|
-
...
|
454
|
-
|
455
|
-
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]]]:
|
456
|
-
"""
|
457
|
-
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
458
|
-
|
459
|
-
User code call
|
460
|
-
-----------
|
461
|
-
@ollama(
|
462
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
463
|
-
backend='local'
|
464
|
-
)
|
465
|
-
|
466
|
-
Valid backend options
|
467
|
-
---------------------
|
468
|
-
- 'local': Run as a separate process on the local task machine.
|
469
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
470
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
471
|
-
|
472
|
-
Valid model options
|
473
|
-
----------------
|
474
|
-
- 'llama3.2'
|
475
|
-
- 'llama3.3'
|
476
|
-
- any model here https://ollama.com/search
|
477
|
-
|
478
|
-
|
479
|
-
Parameters
|
480
|
-
----------
|
481
|
-
models: list[Ollama]
|
482
|
-
List of Ollama containers running models in sidecars.
|
483
|
-
backend: str
|
484
|
-
Determines where and how to run the Ollama process.
|
383
|
+
packages : Dict[str, str], default {}
|
384
|
+
Packages to use for this step. The key is the name of the package
|
385
|
+
and the value is the version to use.
|
386
|
+
libraries : Dict[str, str], default {}
|
387
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
388
|
+
python : str, optional, default None
|
389
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
390
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
391
|
+
disabled : bool, default False
|
392
|
+
If set to True, disables @conda.
|
485
393
|
"""
|
486
394
|
...
|
487
395
|
|
488
396
|
@typing.overload
|
489
|
-
def
|
490
|
-
"""
|
491
|
-
Internal decorator to support Fast bakery
|
492
|
-
"""
|
397
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
493
398
|
...
|
494
399
|
|
495
400
|
@typing.overload
|
496
|
-
def
|
401
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
497
402
|
...
|
498
403
|
|
499
|
-
def
|
404
|
+
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):
|
500
405
|
"""
|
501
|
-
|
406
|
+
Specifies the Conda environment for the step.
|
407
|
+
|
408
|
+
Information in this decorator will augment any
|
409
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
410
|
+
you can use `@conda_base` to set packages required by all
|
411
|
+
steps and use `@conda` to specify step-specific overrides.
|
412
|
+
|
413
|
+
|
414
|
+
Parameters
|
415
|
+
----------
|
416
|
+
packages : Dict[str, str], default {}
|
417
|
+
Packages to use for this step. The key is the name of the package
|
418
|
+
and the value is the version to use.
|
419
|
+
libraries : Dict[str, str], default {}
|
420
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
421
|
+
python : str, optional, default None
|
422
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
423
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
424
|
+
disabled : bool, default False
|
425
|
+
If set to True, disables @conda.
|
502
426
|
"""
|
503
427
|
...
|
504
428
|
|
@@ -554,157 +478,50 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
554
478
|
...
|
555
479
|
|
556
480
|
@typing.overload
|
557
|
-
def
|
481
|
+
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]]]:
|
558
482
|
"""
|
559
|
-
Specifies
|
560
|
-
|
561
|
-
Use `@resources` to specify the resource requirements
|
562
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
563
|
-
|
564
|
-
You can choose the compute layer on the command line by executing e.g.
|
565
|
-
```
|
566
|
-
python myflow.py run --with batch
|
567
|
-
```
|
568
|
-
or
|
569
|
-
```
|
570
|
-
python myflow.py run --with kubernetes
|
571
|
-
```
|
572
|
-
which executes the flow on the desired system using the
|
573
|
-
requirements specified in `@resources`.
|
483
|
+
Specifies environment variables to be set prior to the execution of a step.
|
574
484
|
|
575
485
|
|
576
486
|
Parameters
|
577
487
|
----------
|
578
|
-
|
579
|
-
|
580
|
-
gpu : int, optional, default None
|
581
|
-
Number of GPUs required for this step.
|
582
|
-
disk : int, optional, default None
|
583
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
584
|
-
memory : int, default 4096
|
585
|
-
Memory size (in MB) required for this step.
|
586
|
-
shared_memory : int, optional, default None
|
587
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
588
|
-
This parameter maps to the `--shm-size` option in Docker.
|
488
|
+
vars : Dict[str, str], default {}
|
489
|
+
Dictionary of environment variables to set.
|
589
490
|
"""
|
590
491
|
...
|
591
492
|
|
592
493
|
@typing.overload
|
593
|
-
def
|
494
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
594
495
|
...
|
595
496
|
|
596
497
|
@typing.overload
|
597
|
-
def
|
598
|
-
...
|
599
|
-
|
600
|
-
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):
|
601
|
-
"""
|
602
|
-
Specifies the resources needed when executing this step.
|
603
|
-
|
604
|
-
Use `@resources` to specify the resource requirements
|
605
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
606
|
-
|
607
|
-
You can choose the compute layer on the command line by executing e.g.
|
608
|
-
```
|
609
|
-
python myflow.py run --with batch
|
610
|
-
```
|
611
|
-
or
|
612
|
-
```
|
613
|
-
python myflow.py run --with kubernetes
|
614
|
-
```
|
615
|
-
which executes the flow on the desired system using the
|
616
|
-
requirements specified in `@resources`.
|
617
|
-
|
618
|
-
|
619
|
-
Parameters
|
620
|
-
----------
|
621
|
-
cpu : int, default 1
|
622
|
-
Number of CPUs required for this step.
|
623
|
-
gpu : int, optional, default None
|
624
|
-
Number of GPUs required for this step.
|
625
|
-
disk : int, optional, default None
|
626
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
627
|
-
memory : int, default 4096
|
628
|
-
Memory size (in MB) required for this step.
|
629
|
-
shared_memory : int, optional, default None
|
630
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
631
|
-
This parameter maps to the `--shm-size` option in Docker.
|
632
|
-
"""
|
498
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
633
499
|
...
|
634
500
|
|
635
|
-
|
636
|
-
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]]]:
|
501
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
637
502
|
"""
|
638
|
-
|
639
|
-
|
503
|
+
Specifies environment variables to be set prior to the execution of a step.
|
640
504
|
|
641
505
|
|
642
506
|
Parameters
|
643
507
|
----------
|
644
|
-
|
645
|
-
|
646
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
647
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
648
|
-
will be loaded at the start of the task.
|
649
|
-
- "none": Do not load any checkpoint
|
650
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
651
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
652
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
653
|
-
created within the task will be loaded when the task is retries execution on failure.
|
654
|
-
|
655
|
-
temp_dir_root : str, default: None
|
656
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
508
|
+
vars : Dict[str, str], default {}
|
509
|
+
Dictionary of environment variables to set.
|
657
510
|
"""
|
658
511
|
...
|
659
512
|
|
660
|
-
|
661
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
662
|
-
...
|
663
|
-
|
664
|
-
@typing.overload
|
665
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
666
|
-
...
|
667
|
-
|
668
|
-
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):
|
513
|
+
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]]]:
|
669
514
|
"""
|
670
|
-
|
671
|
-
|
515
|
+
Specifies that this step is used to deploy an instance of the app.
|
516
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
672
517
|
|
673
518
|
|
674
519
|
Parameters
|
675
520
|
----------
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
will be loaded at the start of the task.
|
681
|
-
- "none": Do not load any checkpoint
|
682
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
683
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
684
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
685
|
-
created within the task will be loaded when the task is retries execution on failure.
|
686
|
-
|
687
|
-
temp_dir_root : str, default: None
|
688
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
689
|
-
"""
|
690
|
-
...
|
691
|
-
|
692
|
-
@typing.overload
|
693
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
694
|
-
"""
|
695
|
-
Decorator prototype for all step decorators. This function gets specialized
|
696
|
-
and imported for all decorators types by _import_plugin_decorators().
|
697
|
-
"""
|
698
|
-
...
|
699
|
-
|
700
|
-
@typing.overload
|
701
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
702
|
-
...
|
703
|
-
|
704
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
705
|
-
"""
|
706
|
-
Decorator prototype for all step decorators. This function gets specialized
|
707
|
-
and imported for all decorators types by _import_plugin_decorators().
|
521
|
+
app_port : int
|
522
|
+
Number of GPUs to use.
|
523
|
+
app_name : str
|
524
|
+
Name of the app to deploy.
|
708
525
|
"""
|
709
526
|
...
|
710
527
|
|
@@ -758,77 +575,46 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
758
575
|
...
|
759
576
|
|
760
577
|
@typing.overload
|
761
|
-
def
|
578
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
762
579
|
"""
|
763
|
-
|
764
|
-
|
765
|
-
Information in this decorator will augment any
|
766
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
767
|
-
you can use `@conda_base` to set packages required by all
|
768
|
-
steps and use `@conda` to specify step-specific overrides.
|
769
|
-
|
770
|
-
|
771
|
-
Parameters
|
772
|
-
----------
|
773
|
-
packages : Dict[str, str], default {}
|
774
|
-
Packages to use for this step. The key is the name of the package
|
775
|
-
and the value is the version to use.
|
776
|
-
libraries : Dict[str, str], default {}
|
777
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
778
|
-
python : str, optional, default None
|
779
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
780
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
781
|
-
disabled : bool, default False
|
782
|
-
If set to True, disables @conda.
|
580
|
+
Decorator prototype for all step decorators. This function gets specialized
|
581
|
+
and imported for all decorators types by _import_plugin_decorators().
|
783
582
|
"""
|
784
583
|
...
|
785
584
|
|
786
585
|
@typing.overload
|
787
|
-
def
|
788
|
-
...
|
789
|
-
|
790
|
-
@typing.overload
|
791
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
586
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
792
587
|
...
|
793
588
|
|
794
|
-
def
|
589
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
795
590
|
"""
|
796
|
-
|
797
|
-
|
798
|
-
Information in this decorator will augment any
|
799
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
800
|
-
you can use `@conda_base` to set packages required by all
|
801
|
-
steps and use `@conda` to specify step-specific overrides.
|
802
|
-
|
803
|
-
|
804
|
-
Parameters
|
805
|
-
----------
|
806
|
-
packages : Dict[str, str], default {}
|
807
|
-
Packages to use for this step. The key is the name of the package
|
808
|
-
and the value is the version to use.
|
809
|
-
libraries : Dict[str, str], default {}
|
810
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
811
|
-
python : str, optional, default None
|
812
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
813
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
814
|
-
disabled : bool, default False
|
815
|
-
If set to True, disables @conda.
|
591
|
+
Decorator prototype for all step decorators. This function gets specialized
|
592
|
+
and imported for all decorators types by _import_plugin_decorators().
|
816
593
|
"""
|
817
594
|
...
|
818
595
|
|
819
|
-
def
|
596
|
+
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]]]:
|
820
597
|
"""
|
821
|
-
|
598
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
822
599
|
|
823
600
|
|
824
601
|
Parameters
|
825
602
|
----------
|
826
|
-
|
827
|
-
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
603
|
+
temp_dir_root : str, optional
|
604
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
605
|
+
|
606
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
607
|
+
The list of repos (models/datasets) to load.
|
608
|
+
|
609
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
610
|
+
|
611
|
+
- If repo (model/dataset) is not found in the datastore:
|
612
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
613
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
614
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
615
|
+
|
616
|
+
- If repo is found in the datastore:
|
617
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
832
618
|
"""
|
833
619
|
...
|
834
620
|
|
@@ -888,356 +674,354 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
888
674
|
...
|
889
675
|
|
890
676
|
@typing.overload
|
891
|
-
def
|
677
|
+
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]]]:
|
892
678
|
"""
|
893
|
-
|
894
|
-
|
895
|
-
This decorator is useful if this step may hang indefinitely.
|
896
|
-
|
897
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
898
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
899
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
679
|
+
Enables loading / saving of models within a step.
|
900
680
|
|
901
|
-
Note that all the values specified in parameters are added together so if you specify
|
902
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
903
681
|
|
904
682
|
|
905
683
|
Parameters
|
906
684
|
----------
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
912
|
-
|
685
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
686
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
687
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
688
|
+
- `current.checkpoint`
|
689
|
+
- `current.model`
|
690
|
+
- `current.huggingface_hub`
|
691
|
+
|
692
|
+
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
|
693
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
694
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
695
|
+
|
696
|
+
temp_dir_root : str, default: None
|
697
|
+
The root directory under which `current.model.loaded` will store loaded models
|
913
698
|
"""
|
914
699
|
...
|
915
700
|
|
916
701
|
@typing.overload
|
917
|
-
def
|
702
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
918
703
|
...
|
919
704
|
|
920
705
|
@typing.overload
|
921
|
-
def
|
706
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
922
707
|
...
|
923
708
|
|
924
|
-
def
|
709
|
+
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):
|
925
710
|
"""
|
926
|
-
|
927
|
-
|
928
|
-
This decorator is useful if this step may hang indefinitely.
|
929
|
-
|
930
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
931
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
932
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
711
|
+
Enables loading / saving of models within a step.
|
933
712
|
|
934
|
-
Note that all the values specified in parameters are added together so if you specify
|
935
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
936
713
|
|
937
714
|
|
938
715
|
Parameters
|
939
716
|
----------
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
"""
|
947
|
-
...
|
948
|
-
|
949
|
-
@typing.overload
|
950
|
-
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]]]:
|
951
|
-
"""
|
952
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
953
|
-
the execution of a step.
|
717
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
718
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
719
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
720
|
+
- `current.checkpoint`
|
721
|
+
- `current.model`
|
722
|
+
- `current.huggingface_hub`
|
954
723
|
|
724
|
+
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
|
725
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
726
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
955
727
|
|
956
|
-
|
957
|
-
|
958
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
959
|
-
List of secret specs, defining how the secrets are to be retrieved
|
728
|
+
temp_dir_root : str, default: None
|
729
|
+
The root directory under which `current.model.loaded` will store loaded models
|
960
730
|
"""
|
961
731
|
...
|
962
732
|
|
963
733
|
@typing.overload
|
964
|
-
def
|
734
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
735
|
+
"""
|
736
|
+
Internal decorator to support Fast bakery
|
737
|
+
"""
|
965
738
|
...
|
966
739
|
|
967
740
|
@typing.overload
|
968
|
-
def
|
741
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
969
742
|
...
|
970
743
|
|
971
|
-
def
|
744
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
972
745
|
"""
|
973
|
-
|
974
|
-
the execution of a step.
|
975
|
-
|
976
|
-
|
977
|
-
Parameters
|
978
|
-
----------
|
979
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
980
|
-
List of secret specs, defining how the secrets are to be retrieved
|
746
|
+
Internal decorator to support Fast bakery
|
981
747
|
"""
|
982
748
|
...
|
983
749
|
|
984
|
-
def
|
750
|
+
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]]]:
|
985
751
|
"""
|
986
|
-
|
987
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
988
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
989
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
990
|
-
starts only after all sensors finish.
|
752
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
991
753
|
|
754
|
+
User code call
|
755
|
+
-----------
|
756
|
+
@ollama(
|
757
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
758
|
+
backend='local'
|
759
|
+
)
|
992
760
|
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
999
|
-
mode : str
|
1000
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1001
|
-
exponential_backoff : bool
|
1002
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1003
|
-
pool : str
|
1004
|
-
the slot pool this task should run in,
|
1005
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1006
|
-
soft_fail : bool
|
1007
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1008
|
-
name : str
|
1009
|
-
Name of the sensor on Airflow
|
1010
|
-
description : str
|
1011
|
-
Description of sensor in the Airflow UI
|
1012
|
-
bucket_key : Union[str, List[str]]
|
1013
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1014
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1015
|
-
bucket_name : str
|
1016
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1017
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1018
|
-
wildcard_match : bool
|
1019
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1020
|
-
aws_conn_id : str
|
1021
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1022
|
-
verify : bool
|
1023
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1024
|
-
"""
|
1025
|
-
...
|
1026
|
-
|
1027
|
-
@typing.overload
|
1028
|
-
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]]:
|
1029
|
-
"""
|
1030
|
-
Specifies the Conda environment for all steps of the flow.
|
761
|
+
Valid backend options
|
762
|
+
---------------------
|
763
|
+
- 'local': Run as a separate process on the local task machine.
|
764
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
765
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
1031
766
|
|
1032
|
-
|
1033
|
-
|
767
|
+
Valid model options
|
768
|
+
----------------
|
769
|
+
- 'llama3.2'
|
770
|
+
- 'llama3.3'
|
771
|
+
- any model here https://ollama.com/search
|
1034
772
|
|
1035
773
|
|
1036
774
|
Parameters
|
1037
775
|
----------
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1043
|
-
python : str, optional, default None
|
1044
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1045
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1046
|
-
disabled : bool, default False
|
1047
|
-
If set to True, disables Conda.
|
776
|
+
models: list[Ollama]
|
777
|
+
List of Ollama containers running models in sidecars.
|
778
|
+
backend: str
|
779
|
+
Determines where and how to run the Ollama process.
|
1048
780
|
"""
|
1049
781
|
...
|
1050
782
|
|
1051
|
-
|
1052
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1053
|
-
...
|
1054
|
-
|
1055
|
-
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
783
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = 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]]]:
|
1056
784
|
"""
|
1057
|
-
Specifies
|
1058
|
-
|
1059
|
-
Use `@conda_base` to set common libraries required by all
|
1060
|
-
steps and use `@conda` to specify step-specific additions.
|
785
|
+
Specifies that this step should execute on Kubernetes.
|
1061
786
|
|
1062
787
|
|
1063
788
|
Parameters
|
1064
789
|
----------
|
1065
|
-
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1074
|
-
|
790
|
+
cpu : int, default 1
|
791
|
+
Number of CPUs required for this step. If `@resources` is
|
792
|
+
also present, the maximum value from all decorators is used.
|
793
|
+
memory : int, default 4096
|
794
|
+
Memory size (in MB) required for this step. If
|
795
|
+
`@resources` is also present, the maximum value from all decorators is
|
796
|
+
used.
|
797
|
+
disk : int, default 10240
|
798
|
+
Disk size (in MB) required for this step. If
|
799
|
+
`@resources` is also present, the maximum value from all decorators is
|
800
|
+
used.
|
801
|
+
image : str, optional, default None
|
802
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
803
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
804
|
+
not, a default Docker image mapping to the current version of Python is used.
|
805
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
806
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
807
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
808
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
809
|
+
secrets : List[str], optional, default None
|
810
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
811
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
812
|
+
in Metaflow configuration.
|
813
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
814
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
815
|
+
Can be passed in as a comma separated string of values e.g.
|
816
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
817
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
818
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
819
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
820
|
+
gpu : int, optional, default None
|
821
|
+
Number of GPUs required for this step. A value of zero implies that
|
822
|
+
the scheduled node should not have GPUs.
|
823
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
824
|
+
The vendor of the GPUs to be used for this step.
|
825
|
+
tolerations : List[str], default []
|
826
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
827
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
828
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
829
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
830
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
831
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
832
|
+
use_tmpfs : bool, default False
|
833
|
+
This enables an explicit tmpfs mount for this step.
|
834
|
+
tmpfs_tempdir : bool, default True
|
835
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
836
|
+
tmpfs_size : int, optional, default: None
|
837
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
838
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
839
|
+
memory allocated for this step.
|
840
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
841
|
+
Path to tmpfs mount for this step.
|
842
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
843
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
844
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
845
|
+
shared_memory: int, optional
|
846
|
+
Shared memory size (in MiB) required for this step
|
847
|
+
port: int, optional
|
848
|
+
Port number to specify in the Kubernetes job object
|
849
|
+
compute_pool : str, optional, default None
|
850
|
+
Compute pool to be used for for this step.
|
851
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
852
|
+
hostname_resolution_timeout: int, default 10 * 60
|
853
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
854
|
+
Only applicable when @parallel is used.
|
855
|
+
qos: str, default: Burstable
|
856
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
857
|
+
|
858
|
+
security_context: Dict[str, Any], optional, default None
|
859
|
+
Container security context. Applies to the task container. Allows the following keys:
|
860
|
+
- privileged: bool, optional, default None
|
861
|
+
- allow_privilege_escalation: bool, optional, default None
|
862
|
+
- run_as_user: int, optional, default None
|
863
|
+
- run_as_group: int, optional, default None
|
864
|
+
- run_as_non_root: bool, optional, default None
|
1075
865
|
"""
|
1076
866
|
...
|
1077
867
|
|
1078
868
|
@typing.overload
|
1079
|
-
def
|
869
|
+
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]]]:
|
1080
870
|
"""
|
1081
|
-
|
1082
|
-
|
1083
|
-
```
|
1084
|
-
@trigger(event='foo')
|
1085
|
-
```
|
1086
|
-
or
|
1087
|
-
```
|
1088
|
-
@trigger(events=['foo', 'bar'])
|
1089
|
-
```
|
1090
|
-
|
1091
|
-
Additionally, you can specify the parameter mappings
|
1092
|
-
to map event payload to Metaflow parameters for the flow.
|
1093
|
-
```
|
1094
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1095
|
-
```
|
1096
|
-
or
|
1097
|
-
```
|
1098
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1099
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1100
|
-
```
|
871
|
+
Enables checkpointing for a step.
|
1101
872
|
|
1102
|
-
'parameters' can also be a list of strings and tuples like so:
|
1103
|
-
```
|
1104
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1105
|
-
```
|
1106
|
-
This is equivalent to:
|
1107
|
-
```
|
1108
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1109
|
-
```
|
1110
873
|
|
1111
874
|
|
1112
875
|
Parameters
|
1113
876
|
----------
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
877
|
+
load_policy : str, default: "fresh"
|
878
|
+
The policy for loading the checkpoint. The following policies are supported:
|
879
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
880
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
881
|
+
will be loaded at the start of the task.
|
882
|
+
- "none": Do not load any checkpoint
|
883
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
884
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
885
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
886
|
+
created within the task will be loaded when the task is retries execution on failure.
|
887
|
+
|
888
|
+
temp_dir_root : str, default: None
|
889
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
1120
890
|
"""
|
1121
891
|
...
|
1122
892
|
|
1123
893
|
@typing.overload
|
1124
|
-
def
|
894
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1125
895
|
...
|
1126
896
|
|
1127
|
-
|
897
|
+
@typing.overload
|
898
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
899
|
+
...
|
900
|
+
|
901
|
+
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):
|
1128
902
|
"""
|
1129
|
-
|
1130
|
-
|
1131
|
-
```
|
1132
|
-
@trigger(event='foo')
|
1133
|
-
```
|
1134
|
-
or
|
1135
|
-
```
|
1136
|
-
@trigger(events=['foo', 'bar'])
|
1137
|
-
```
|
1138
|
-
|
1139
|
-
Additionally, you can specify the parameter mappings
|
1140
|
-
to map event payload to Metaflow parameters for the flow.
|
1141
|
-
```
|
1142
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1143
|
-
```
|
1144
|
-
or
|
1145
|
-
```
|
1146
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1147
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1148
|
-
```
|
903
|
+
Enables checkpointing for a step.
|
1149
904
|
|
1150
|
-
'parameters' can also be a list of strings and tuples like so:
|
1151
|
-
```
|
1152
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1153
|
-
```
|
1154
|
-
This is equivalent to:
|
1155
|
-
```
|
1156
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1157
|
-
```
|
1158
905
|
|
1159
906
|
|
1160
907
|
Parameters
|
1161
908
|
----------
|
1162
|
-
|
1163
|
-
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
909
|
+
load_policy : str, default: "fresh"
|
910
|
+
The policy for loading the checkpoint. The following policies are supported:
|
911
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
912
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
913
|
+
will be loaded at the start of the task.
|
914
|
+
- "none": Do not load any checkpoint
|
915
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
916
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
917
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
918
|
+
created within the task will be loaded when the task is retries execution on failure.
|
919
|
+
|
920
|
+
temp_dir_root : str, default: None
|
921
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
1168
922
|
"""
|
1169
923
|
...
|
1170
924
|
|
1171
|
-
def
|
925
|
+
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]]]:
|
1172
926
|
"""
|
1173
|
-
|
1174
|
-
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.
|
927
|
+
Specifies that this step should execute on DGX cloud.
|
1175
928
|
|
1176
929
|
|
1177
930
|
Parameters
|
1178
931
|
----------
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
mode : str
|
1184
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1185
|
-
exponential_backoff : bool
|
1186
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1187
|
-
pool : str
|
1188
|
-
the slot pool this task should run in,
|
1189
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1190
|
-
soft_fail : bool
|
1191
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1192
|
-
name : str
|
1193
|
-
Name of the sensor on Airflow
|
1194
|
-
description : str
|
1195
|
-
Description of sensor in the Airflow UI
|
1196
|
-
external_dag_id : str
|
1197
|
-
The dag_id that contains the task you want to wait for.
|
1198
|
-
external_task_ids : List[str]
|
1199
|
-
The list of task_ids that you want to wait for.
|
1200
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1201
|
-
allowed_states : List[str]
|
1202
|
-
Iterable of allowed states, (Default: ['success'])
|
1203
|
-
failed_states : List[str]
|
1204
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1205
|
-
execution_delta : datetime.timedelta
|
1206
|
-
time difference with the previous execution to look at,
|
1207
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1208
|
-
check_existence: bool
|
1209
|
-
Set to True to check if the external task exists or check if
|
1210
|
-
the DAG to wait for exists. (Default: True)
|
932
|
+
gpu : int
|
933
|
+
Number of GPUs to use.
|
934
|
+
gpu_type : str
|
935
|
+
Type of Nvidia GPU to use.
|
1211
936
|
"""
|
1212
937
|
...
|
1213
938
|
|
1214
|
-
|
939
|
+
@typing.overload
|
940
|
+
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]]]:
|
1215
941
|
"""
|
1216
|
-
Specifies
|
942
|
+
Specifies a timeout for your step.
|
1217
943
|
|
1218
|
-
|
1219
|
-
use the same `@project(name)`.
|
944
|
+
This decorator is useful if this step may hang indefinitely.
|
1220
945
|
|
946
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
947
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
948
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
1221
949
|
|
1222
|
-
|
1223
|
-
|
1224
|
-
name : str
|
1225
|
-
Project name. Make sure that the name is unique amongst all
|
1226
|
-
projects that use the same production scheduler. The name may
|
1227
|
-
contain only lowercase alphanumeric characters and underscores.
|
950
|
+
Note that all the values specified in parameters are added together so if you specify
|
951
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
1228
952
|
|
1229
|
-
branch : Optional[str], default None
|
1230
|
-
The branch to use. If not specified, the branch is set to
|
1231
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1232
|
-
also be set on the command line using `--branch` as a top-level option.
|
1233
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1234
953
|
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1240
|
-
|
954
|
+
Parameters
|
955
|
+
----------
|
956
|
+
seconds : int, default 0
|
957
|
+
Number of seconds to wait prior to timing out.
|
958
|
+
minutes : int, default 0
|
959
|
+
Number of minutes to wait prior to timing out.
|
960
|
+
hours : int, default 0
|
961
|
+
Number of hours to wait prior to timing out.
|
962
|
+
"""
|
963
|
+
...
|
964
|
+
|
965
|
+
@typing.overload
|
966
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
967
|
+
...
|
968
|
+
|
969
|
+
@typing.overload
|
970
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
971
|
+
...
|
972
|
+
|
973
|
+
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):
|
974
|
+
"""
|
975
|
+
Specifies a timeout for your step.
|
976
|
+
|
977
|
+
This decorator is useful if this step may hang indefinitely.
|
978
|
+
|
979
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
980
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
981
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
982
|
+
|
983
|
+
Note that all the values specified in parameters are added together so if you specify
|
984
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
985
|
+
|
986
|
+
|
987
|
+
Parameters
|
988
|
+
----------
|
989
|
+
seconds : int, default 0
|
990
|
+
Number of seconds to wait prior to timing out.
|
991
|
+
minutes : int, default 0
|
992
|
+
Number of minutes to wait prior to timing out.
|
993
|
+
hours : int, default 0
|
994
|
+
Number of hours to wait prior to timing out.
|
995
|
+
"""
|
996
|
+
...
|
997
|
+
|
998
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
999
|
+
"""
|
1000
|
+
Specifies what flows belong to the same project.
|
1001
|
+
|
1002
|
+
A project-specific namespace is created for all flows that
|
1003
|
+
use the same `@project(name)`.
|
1004
|
+
|
1005
|
+
|
1006
|
+
Parameters
|
1007
|
+
----------
|
1008
|
+
name : str
|
1009
|
+
Project name. Make sure that the name is unique amongst all
|
1010
|
+
projects that use the same production scheduler. The name may
|
1011
|
+
contain only lowercase alphanumeric characters and underscores.
|
1012
|
+
|
1013
|
+
branch : Optional[str], default None
|
1014
|
+
The branch to use. If not specified, the branch is set to
|
1015
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1016
|
+
also be set on the command line using `--branch` as a top-level option.
|
1017
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1018
|
+
|
1019
|
+
production : bool, default False
|
1020
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1021
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1022
|
+
`production` in the decorator and on the command line.
|
1023
|
+
The project branch name will be:
|
1024
|
+
- if `branch` is specified:
|
1241
1025
|
- if `production` is True: `prod.<branch>`
|
1242
1026
|
- if `production` is False: `test.<branch>`
|
1243
1027
|
- if `branch` is not specified:
|
@@ -1247,103 +1031,53 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
|
|
1247
1031
|
...
|
1248
1032
|
|
1249
1033
|
@typing.overload
|
1250
|
-
def
|
1034
|
+
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]]:
|
1251
1035
|
"""
|
1252
|
-
Specifies the
|
1253
|
-
|
1254
|
-
```
|
1255
|
-
@trigger_on_finish(flow='FooFlow')
|
1256
|
-
```
|
1257
|
-
or
|
1258
|
-
```
|
1259
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1260
|
-
```
|
1261
|
-
This decorator respects the @project decorator and triggers the flow
|
1262
|
-
when upstream runs within the same namespace complete successfully
|
1263
|
-
|
1264
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1265
|
-
by specifying the fully qualified project_flow_name.
|
1266
|
-
```
|
1267
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1268
|
-
```
|
1269
|
-
or
|
1270
|
-
```
|
1271
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1272
|
-
```
|
1273
|
-
|
1274
|
-
You can also specify just the project or project branch (other values will be
|
1275
|
-
inferred from the current project or project branch):
|
1276
|
-
```
|
1277
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1278
|
-
```
|
1036
|
+
Specifies the Conda environment for all steps of the flow.
|
1279
1037
|
|
1280
|
-
|
1281
|
-
|
1282
|
-
- `user.bob`
|
1283
|
-
- `test.my_experiment`
|
1284
|
-
- `prod.staging`
|
1038
|
+
Use `@conda_base` to set common libraries required by all
|
1039
|
+
steps and use `@conda` to specify step-specific additions.
|
1285
1040
|
|
1286
1041
|
|
1287
1042
|
Parameters
|
1288
1043
|
----------
|
1289
|
-
|
1290
|
-
|
1291
|
-
|
1292
|
-
|
1293
|
-
|
1294
|
-
|
1044
|
+
packages : Dict[str, str], default {}
|
1045
|
+
Packages to use for this flow. The key is the name of the package
|
1046
|
+
and the value is the version to use.
|
1047
|
+
libraries : Dict[str, str], default {}
|
1048
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1049
|
+
python : str, optional, default None
|
1050
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1051
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1052
|
+
disabled : bool, default False
|
1053
|
+
If set to True, disables Conda.
|
1295
1054
|
"""
|
1296
1055
|
...
|
1297
1056
|
|
1298
1057
|
@typing.overload
|
1299
|
-
def
|
1058
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1300
1059
|
...
|
1301
1060
|
|
1302
|
-
def
|
1061
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1303
1062
|
"""
|
1304
|
-
Specifies the
|
1305
|
-
|
1306
|
-
```
|
1307
|
-
@trigger_on_finish(flow='FooFlow')
|
1308
|
-
```
|
1309
|
-
or
|
1310
|
-
```
|
1311
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1312
|
-
```
|
1313
|
-
This decorator respects the @project decorator and triggers the flow
|
1314
|
-
when upstream runs within the same namespace complete successfully
|
1315
|
-
|
1316
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1317
|
-
by specifying the fully qualified project_flow_name.
|
1318
|
-
```
|
1319
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1320
|
-
```
|
1321
|
-
or
|
1322
|
-
```
|
1323
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1324
|
-
```
|
1325
|
-
|
1326
|
-
You can also specify just the project or project branch (other values will be
|
1327
|
-
inferred from the current project or project branch):
|
1328
|
-
```
|
1329
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1330
|
-
```
|
1063
|
+
Specifies the Conda environment for all steps of the flow.
|
1331
1064
|
|
1332
|
-
|
1333
|
-
|
1334
|
-
- `user.bob`
|
1335
|
-
- `test.my_experiment`
|
1336
|
-
- `prod.staging`
|
1065
|
+
Use `@conda_base` to set common libraries required by all
|
1066
|
+
steps and use `@conda` to specify step-specific additions.
|
1337
1067
|
|
1338
1068
|
|
1339
1069
|
Parameters
|
1340
1070
|
----------
|
1341
|
-
|
1342
|
-
|
1343
|
-
|
1344
|
-
|
1345
|
-
|
1346
|
-
|
1071
|
+
packages : Dict[str, str], default {}
|
1072
|
+
Packages to use for this flow. The key is the name of the package
|
1073
|
+
and the value is the version to use.
|
1074
|
+
libraries : Dict[str, str], default {}
|
1075
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1076
|
+
python : str, optional, default None
|
1077
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1078
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1079
|
+
disabled : bool, default False
|
1080
|
+
If set to True, disables Conda.
|
1347
1081
|
"""
|
1348
1082
|
...
|
1349
1083
|
|
@@ -1553,5 +1287,285 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1553
1287
|
"""
|
1554
1288
|
...
|
1555
1289
|
|
1290
|
+
@typing.overload
|
1291
|
+
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]]:
|
1292
|
+
"""
|
1293
|
+
Specifies the flow(s) that this flow depends on.
|
1294
|
+
|
1295
|
+
```
|
1296
|
+
@trigger_on_finish(flow='FooFlow')
|
1297
|
+
```
|
1298
|
+
or
|
1299
|
+
```
|
1300
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1301
|
+
```
|
1302
|
+
This decorator respects the @project decorator and triggers the flow
|
1303
|
+
when upstream runs within the same namespace complete successfully
|
1304
|
+
|
1305
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1306
|
+
by specifying the fully qualified project_flow_name.
|
1307
|
+
```
|
1308
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1309
|
+
```
|
1310
|
+
or
|
1311
|
+
```
|
1312
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1313
|
+
```
|
1314
|
+
|
1315
|
+
You can also specify just the project or project branch (other values will be
|
1316
|
+
inferred from the current project or project branch):
|
1317
|
+
```
|
1318
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1319
|
+
```
|
1320
|
+
|
1321
|
+
Note that `branch` is typically one of:
|
1322
|
+
- `prod`
|
1323
|
+
- `user.bob`
|
1324
|
+
- `test.my_experiment`
|
1325
|
+
- `prod.staging`
|
1326
|
+
|
1327
|
+
|
1328
|
+
Parameters
|
1329
|
+
----------
|
1330
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1331
|
+
Upstream flow dependency for this flow.
|
1332
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1333
|
+
Upstream flow dependencies for this flow.
|
1334
|
+
options : Dict[str, Any], default {}
|
1335
|
+
Backend-specific configuration for tuning eventing behavior.
|
1336
|
+
"""
|
1337
|
+
...
|
1338
|
+
|
1339
|
+
@typing.overload
|
1340
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1341
|
+
...
|
1342
|
+
|
1343
|
+
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] = {}):
|
1344
|
+
"""
|
1345
|
+
Specifies the flow(s) that this flow depends on.
|
1346
|
+
|
1347
|
+
```
|
1348
|
+
@trigger_on_finish(flow='FooFlow')
|
1349
|
+
```
|
1350
|
+
or
|
1351
|
+
```
|
1352
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1353
|
+
```
|
1354
|
+
This decorator respects the @project decorator and triggers the flow
|
1355
|
+
when upstream runs within the same namespace complete successfully
|
1356
|
+
|
1357
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1358
|
+
by specifying the fully qualified project_flow_name.
|
1359
|
+
```
|
1360
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1361
|
+
```
|
1362
|
+
or
|
1363
|
+
```
|
1364
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1365
|
+
```
|
1366
|
+
|
1367
|
+
You can also specify just the project or project branch (other values will be
|
1368
|
+
inferred from the current project or project branch):
|
1369
|
+
```
|
1370
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1371
|
+
```
|
1372
|
+
|
1373
|
+
Note that `branch` is typically one of:
|
1374
|
+
- `prod`
|
1375
|
+
- `user.bob`
|
1376
|
+
- `test.my_experiment`
|
1377
|
+
- `prod.staging`
|
1378
|
+
|
1379
|
+
|
1380
|
+
Parameters
|
1381
|
+
----------
|
1382
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1383
|
+
Upstream flow dependency for this flow.
|
1384
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1385
|
+
Upstream flow dependencies for this flow.
|
1386
|
+
options : Dict[str, Any], default {}
|
1387
|
+
Backend-specific configuration for tuning eventing behavior.
|
1388
|
+
"""
|
1389
|
+
...
|
1390
|
+
|
1391
|
+
@typing.overload
|
1392
|
+
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]]:
|
1393
|
+
"""
|
1394
|
+
Specifies the event(s) that this flow depends on.
|
1395
|
+
|
1396
|
+
```
|
1397
|
+
@trigger(event='foo')
|
1398
|
+
```
|
1399
|
+
or
|
1400
|
+
```
|
1401
|
+
@trigger(events=['foo', 'bar'])
|
1402
|
+
```
|
1403
|
+
|
1404
|
+
Additionally, you can specify the parameter mappings
|
1405
|
+
to map event payload to Metaflow parameters for the flow.
|
1406
|
+
```
|
1407
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1408
|
+
```
|
1409
|
+
or
|
1410
|
+
```
|
1411
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1412
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1413
|
+
```
|
1414
|
+
|
1415
|
+
'parameters' can also be a list of strings and tuples like so:
|
1416
|
+
```
|
1417
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1418
|
+
```
|
1419
|
+
This is equivalent to:
|
1420
|
+
```
|
1421
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1422
|
+
```
|
1423
|
+
|
1424
|
+
|
1425
|
+
Parameters
|
1426
|
+
----------
|
1427
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1428
|
+
Event dependency for this flow.
|
1429
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1430
|
+
Events dependency for this flow.
|
1431
|
+
options : Dict[str, Any], default {}
|
1432
|
+
Backend-specific configuration for tuning eventing behavior.
|
1433
|
+
"""
|
1434
|
+
...
|
1435
|
+
|
1436
|
+
@typing.overload
|
1437
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1438
|
+
...
|
1439
|
+
|
1440
|
+
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] = {}):
|
1441
|
+
"""
|
1442
|
+
Specifies the event(s) that this flow depends on.
|
1443
|
+
|
1444
|
+
```
|
1445
|
+
@trigger(event='foo')
|
1446
|
+
```
|
1447
|
+
or
|
1448
|
+
```
|
1449
|
+
@trigger(events=['foo', 'bar'])
|
1450
|
+
```
|
1451
|
+
|
1452
|
+
Additionally, you can specify the parameter mappings
|
1453
|
+
to map event payload to Metaflow parameters for the flow.
|
1454
|
+
```
|
1455
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1456
|
+
```
|
1457
|
+
or
|
1458
|
+
```
|
1459
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1460
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1461
|
+
```
|
1462
|
+
|
1463
|
+
'parameters' can also be a list of strings and tuples like so:
|
1464
|
+
```
|
1465
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1466
|
+
```
|
1467
|
+
This is equivalent to:
|
1468
|
+
```
|
1469
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1470
|
+
```
|
1471
|
+
|
1472
|
+
|
1473
|
+
Parameters
|
1474
|
+
----------
|
1475
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1476
|
+
Event dependency for this flow.
|
1477
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1478
|
+
Events dependency for this flow.
|
1479
|
+
options : Dict[str, Any], default {}
|
1480
|
+
Backend-specific configuration for tuning eventing behavior.
|
1481
|
+
"""
|
1482
|
+
...
|
1483
|
+
|
1484
|
+
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]]:
|
1485
|
+
"""
|
1486
|
+
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.
|
1487
|
+
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.
|
1488
|
+
|
1489
|
+
|
1490
|
+
Parameters
|
1491
|
+
----------
|
1492
|
+
timeout : int
|
1493
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1494
|
+
poke_interval : int
|
1495
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1496
|
+
mode : str
|
1497
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1498
|
+
exponential_backoff : bool
|
1499
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1500
|
+
pool : str
|
1501
|
+
the slot pool this task should run in,
|
1502
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1503
|
+
soft_fail : bool
|
1504
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1505
|
+
name : str
|
1506
|
+
Name of the sensor on Airflow
|
1507
|
+
description : str
|
1508
|
+
Description of sensor in the Airflow UI
|
1509
|
+
external_dag_id : str
|
1510
|
+
The dag_id that contains the task you want to wait for.
|
1511
|
+
external_task_ids : List[str]
|
1512
|
+
The list of task_ids that you want to wait for.
|
1513
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1514
|
+
allowed_states : List[str]
|
1515
|
+
Iterable of allowed states, (Default: ['success'])
|
1516
|
+
failed_states : List[str]
|
1517
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1518
|
+
execution_delta : datetime.timedelta
|
1519
|
+
time difference with the previous execution to look at,
|
1520
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1521
|
+
check_existence: bool
|
1522
|
+
Set to True to check if the external task exists or check if
|
1523
|
+
the DAG to wait for exists. (Default: True)
|
1524
|
+
"""
|
1525
|
+
...
|
1526
|
+
|
1527
|
+
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]]:
|
1528
|
+
"""
|
1529
|
+
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)
|
1530
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
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.
|
1534
|
+
|
1535
|
+
|
1536
|
+
Parameters
|
1537
|
+
----------
|
1538
|
+
timeout : int
|
1539
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1540
|
+
poke_interval : int
|
1541
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1542
|
+
mode : str
|
1543
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1544
|
+
exponential_backoff : bool
|
1545
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1546
|
+
pool : str
|
1547
|
+
the slot pool this task should run in,
|
1548
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1549
|
+
soft_fail : bool
|
1550
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1551
|
+
name : str
|
1552
|
+
Name of the sensor on Airflow
|
1553
|
+
description : str
|
1554
|
+
Description of sensor in the Airflow UI
|
1555
|
+
bucket_key : Union[str, List[str]]
|
1556
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1557
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1558
|
+
bucket_name : str
|
1559
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1560
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1561
|
+
wildcard_match : bool
|
1562
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1563
|
+
aws_conn_id : str
|
1564
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1565
|
+
verify : bool
|
1566
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1567
|
+
"""
|
1568
|
+
...
|
1569
|
+
|
1556
1570
|
pkg_name: str
|
1557
1571
|
|