ob-metaflow-stubs 6.0.3.168__py2.py3-none-any.whl → 6.0.3.169__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 +660 -693
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +4 -2
- metaflow-stubs/metaflow_current.pyi +95 -95
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +12 -12
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +6 -6
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.168.dist-info → ob_metaflow_stubs-6.0.3.169.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.169.dist-info/RECORD +206 -0
- ob_metaflow_stubs-6.0.3.168.dist-info/RECORD +0 -206
- {ob_metaflow_stubs-6.0.3.168.dist-info → ob_metaflow_stubs-6.0.3.169.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.168.dist-info → ob_metaflow_stubs-6.0.3.169.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
|
-
# MF version: 2.15.
|
4
|
-
# Generated on 2025-05-
|
3
|
+
# MF version: 2.15.14.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
+
# Generated on 2025-05-21T14:02:14.742508 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -35,18 +35,18 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import events as events
|
39
|
-
from . import metaflow_git as metaflow_git
|
40
38
|
from . import tuple_util as tuple_util
|
41
39
|
from . import cards as cards
|
40
|
+
from . import metaflow_git as metaflow_git
|
41
|
+
from . import events as events
|
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
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
47
48
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
48
49
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
49
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -153,205 +153,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
153
153
|
"""
|
154
154
|
...
|
155
155
|
|
156
|
-
@typing.overload
|
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
|
-
"""
|
159
|
-
Specifies the resources needed when executing this step.
|
160
|
-
|
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`.
|
174
|
-
|
175
|
-
|
176
|
-
Parameters
|
177
|
-
----------
|
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.
|
189
|
-
"""
|
190
|
-
...
|
191
|
-
|
192
|
-
@typing.overload
|
193
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
194
|
-
...
|
195
|
-
|
196
|
-
@typing.overload
|
197
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
198
|
-
...
|
199
|
-
|
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):
|
201
|
-
"""
|
202
|
-
Specifies the resources needed when executing this step.
|
203
|
-
|
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`.
|
217
|
-
|
218
|
-
|
219
|
-
Parameters
|
220
|
-
----------
|
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.
|
232
|
-
"""
|
233
|
-
...
|
234
|
-
|
235
|
-
@typing.overload
|
236
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
237
|
-
"""
|
238
|
-
Decorator prototype for all step decorators. This function gets specialized
|
239
|
-
and imported for all decorators types by _import_plugin_decorators().
|
240
|
-
"""
|
241
|
-
...
|
242
|
-
|
243
|
-
@typing.overload
|
244
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
245
|
-
...
|
246
|
-
|
247
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
248
|
-
"""
|
249
|
-
Decorator prototype for all step decorators. This function gets specialized
|
250
|
-
and imported for all decorators types by _import_plugin_decorators().
|
251
|
-
"""
|
252
|
-
...
|
253
|
-
|
254
|
-
@typing.overload
|
255
|
-
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
256
|
-
"""
|
257
|
-
Specifies the Conda environment for the step.
|
258
|
-
|
259
|
-
Information in this decorator will augment any
|
260
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
261
|
-
you can use `@conda_base` to set packages required by all
|
262
|
-
steps and use `@conda` to specify step-specific overrides.
|
263
|
-
|
264
|
-
|
265
|
-
Parameters
|
266
|
-
----------
|
267
|
-
packages : Dict[str, str], default {}
|
268
|
-
Packages to use for this step. The key is the name of the package
|
269
|
-
and the value is the version to use.
|
270
|
-
libraries : Dict[str, str], default {}
|
271
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
272
|
-
python : str, optional, default None
|
273
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
274
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
275
|
-
disabled : bool, default False
|
276
|
-
If set to True, disables @conda.
|
277
|
-
"""
|
278
|
-
...
|
279
|
-
|
280
|
-
@typing.overload
|
281
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
282
|
-
...
|
283
|
-
|
284
|
-
@typing.overload
|
285
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
286
|
-
...
|
287
|
-
|
288
|
-
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
289
|
-
"""
|
290
|
-
Specifies the Conda environment for the step.
|
291
|
-
|
292
|
-
Information in this decorator will augment any
|
293
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
294
|
-
you can use `@conda_base` to set packages required by all
|
295
|
-
steps and use `@conda` to specify step-specific overrides.
|
296
|
-
|
297
|
-
|
298
|
-
Parameters
|
299
|
-
----------
|
300
|
-
packages : Dict[str, str], default {}
|
301
|
-
Packages to use for this step. The key is the name of the package
|
302
|
-
and the value is the version to use.
|
303
|
-
libraries : Dict[str, str], default {}
|
304
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
305
|
-
python : str, optional, default None
|
306
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
307
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
308
|
-
disabled : bool, default False
|
309
|
-
If set to True, disables @conda.
|
310
|
-
"""
|
311
|
-
...
|
312
|
-
|
313
|
-
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
314
|
-
"""
|
315
|
-
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
316
|
-
|
317
|
-
|
318
|
-
Parameters
|
319
|
-
----------
|
320
|
-
temp_dir_root : str, optional
|
321
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
322
|
-
|
323
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
324
|
-
The list of repos (models/datasets) to load.
|
325
|
-
|
326
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
327
|
-
|
328
|
-
- If repo (model/dataset) is not found in the datastore:
|
329
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
330
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
331
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
332
|
-
|
333
|
-
- If repo is found in the datastore:
|
334
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
335
|
-
"""
|
336
|
-
...
|
337
|
-
|
338
|
-
@typing.overload
|
339
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
340
|
-
"""
|
341
|
-
Internal decorator to support Fast bakery
|
342
|
-
"""
|
343
|
-
...
|
344
|
-
|
345
|
-
@typing.overload
|
346
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
347
|
-
...
|
348
|
-
|
349
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
350
|
-
"""
|
351
|
-
Internal decorator to support Fast bakery
|
352
|
-
"""
|
353
|
-
...
|
354
|
-
|
355
156
|
@typing.overload
|
356
157
|
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]]]:
|
357
158
|
"""
|
@@ -404,61 +205,59 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
404
205
|
...
|
405
206
|
|
406
207
|
@typing.overload
|
407
|
-
def
|
208
|
+
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]]]:
|
408
209
|
"""
|
409
|
-
|
410
|
-
|
411
|
-
This decorator is useful if this step may hang indefinitely.
|
412
|
-
|
413
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
414
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
415
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
210
|
+
Enables loading / saving of models within a step.
|
416
211
|
|
417
|
-
Note that all the values specified in parameters are added together so if you specify
|
418
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
419
212
|
|
420
213
|
|
421
214
|
Parameters
|
422
215
|
----------
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
216
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
217
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
218
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
219
|
+
- `current.checkpoint`
|
220
|
+
- `current.model`
|
221
|
+
- `current.huggingface_hub`
|
222
|
+
|
223
|
+
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
|
224
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
225
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
226
|
+
|
227
|
+
temp_dir_root : str, default: None
|
228
|
+
The root directory under which `current.model.loaded` will store loaded models
|
429
229
|
"""
|
430
230
|
...
|
431
231
|
|
432
232
|
@typing.overload
|
433
|
-
def
|
233
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
434
234
|
...
|
435
235
|
|
436
236
|
@typing.overload
|
437
|
-
def
|
237
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
438
238
|
...
|
439
239
|
|
440
|
-
def
|
240
|
+
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):
|
441
241
|
"""
|
442
|
-
|
443
|
-
|
444
|
-
This decorator is useful if this step may hang indefinitely.
|
445
|
-
|
446
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
447
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
448
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
242
|
+
Enables loading / saving of models within a step.
|
449
243
|
|
450
|
-
Note that all the values specified in parameters are added together so if you specify
|
451
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
452
244
|
|
453
245
|
|
454
246
|
Parameters
|
455
247
|
----------
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
|
248
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
249
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
250
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
251
|
+
- `current.checkpoint`
|
252
|
+
- `current.model`
|
253
|
+
- `current.huggingface_hub`
|
254
|
+
|
255
|
+
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
|
256
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
257
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
258
|
+
|
259
|
+
temp_dir_root : str, default: None
|
260
|
+
The root directory under which `current.model.loaded` will store loaded models
|
462
261
|
"""
|
463
262
|
...
|
464
263
|
|
@@ -548,207 +347,372 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
548
347
|
...
|
549
348
|
|
550
349
|
@typing.overload
|
551
|
-
def
|
350
|
+
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]]]:
|
552
351
|
"""
|
553
|
-
Specifies
|
554
|
-
to a step needs to be retried.
|
352
|
+
Specifies a timeout for your step.
|
555
353
|
|
556
|
-
This decorator is useful
|
557
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
558
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
354
|
+
This decorator is useful if this step may hang indefinitely.
|
559
355
|
|
560
|
-
This can be used in conjunction with the `@
|
561
|
-
|
562
|
-
|
356
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
357
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
358
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
359
|
+
|
360
|
+
Note that all the values specified in parameters are added together so if you specify
|
361
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
563
362
|
|
564
363
|
|
565
364
|
Parameters
|
566
365
|
----------
|
567
|
-
|
568
|
-
Number of
|
569
|
-
|
570
|
-
Number of minutes
|
366
|
+
seconds : int, default 0
|
367
|
+
Number of seconds to wait prior to timing out.
|
368
|
+
minutes : int, default 0
|
369
|
+
Number of minutes to wait prior to timing out.
|
370
|
+
hours : int, default 0
|
371
|
+
Number of hours to wait prior to timing out.
|
571
372
|
"""
|
572
373
|
...
|
573
374
|
|
574
375
|
@typing.overload
|
575
|
-
def
|
376
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
576
377
|
...
|
577
378
|
|
578
379
|
@typing.overload
|
579
|
-
def
|
380
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
580
381
|
...
|
581
382
|
|
582
|
-
def
|
383
|
+
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):
|
583
384
|
"""
|
584
|
-
Specifies
|
585
|
-
to a step needs to be retried.
|
385
|
+
Specifies a timeout for your step.
|
586
386
|
|
587
|
-
This decorator is useful
|
588
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
589
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
387
|
+
This decorator is useful if this step may hang indefinitely.
|
590
388
|
|
591
|
-
This can be used in conjunction with the `@
|
592
|
-
|
593
|
-
|
389
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
390
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
391
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
392
|
+
|
393
|
+
Note that all the values specified in parameters are added together so if you specify
|
394
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
594
395
|
|
595
396
|
|
596
397
|
Parameters
|
597
398
|
----------
|
598
|
-
|
599
|
-
Number of
|
600
|
-
|
601
|
-
Number of minutes
|
399
|
+
seconds : int, default 0
|
400
|
+
Number of seconds to wait prior to timing out.
|
401
|
+
minutes : int, default 0
|
402
|
+
Number of minutes to wait prior to timing out.
|
403
|
+
hours : int, default 0
|
404
|
+
Number of hours to wait prior to timing out.
|
602
405
|
"""
|
603
406
|
...
|
604
407
|
|
605
|
-
def
|
408
|
+
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]]]:
|
606
409
|
"""
|
607
|
-
|
608
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
410
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
609
411
|
|
610
412
|
|
611
413
|
Parameters
|
612
414
|
----------
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
415
|
+
temp_dir_root : str, optional
|
416
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
417
|
+
|
418
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
419
|
+
The list of repos (models/datasets) to load.
|
420
|
+
|
421
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
422
|
+
|
423
|
+
- If repo (model/dataset) is not found in the datastore:
|
424
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
425
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
426
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
427
|
+
|
428
|
+
- If repo is found in the datastore:
|
429
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
617
430
|
"""
|
618
431
|
...
|
619
432
|
|
620
|
-
|
621
|
-
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = []) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
433
|
+
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]]]:
|
622
434
|
"""
|
623
|
-
Specifies
|
624
|
-
the execution of a step.
|
435
|
+
Specifies that this step should execute on DGX cloud.
|
625
436
|
|
626
437
|
|
627
438
|
Parameters
|
628
439
|
----------
|
629
|
-
|
630
|
-
|
440
|
+
gpu : int
|
441
|
+
Number of GPUs to use.
|
442
|
+
gpu_type : str
|
443
|
+
Type of Nvidia GPU to use.
|
631
444
|
"""
|
632
445
|
...
|
633
446
|
|
634
447
|
@typing.overload
|
635
|
-
def
|
448
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
449
|
+
"""
|
450
|
+
Internal decorator to support Fast bakery
|
451
|
+
"""
|
636
452
|
...
|
637
453
|
|
638
454
|
@typing.overload
|
639
|
-
def
|
455
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
640
456
|
...
|
641
457
|
|
642
|
-
def
|
458
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
643
459
|
"""
|
644
|
-
|
645
|
-
the execution of a step.
|
646
|
-
|
647
|
-
|
648
|
-
Parameters
|
649
|
-
----------
|
650
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
651
|
-
List of secret specs, defining how the secrets are to be retrieved
|
460
|
+
Internal decorator to support Fast bakery
|
652
461
|
"""
|
653
462
|
...
|
654
463
|
|
655
464
|
@typing.overload
|
656
|
-
def
|
465
|
+
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]]]:
|
657
466
|
"""
|
658
|
-
Specifies the
|
467
|
+
Specifies the resources needed when executing this step.
|
659
468
|
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
469
|
+
Use `@resources` to specify the resource requirements
|
470
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
471
|
+
|
472
|
+
You can choose the compute layer on the command line by executing e.g.
|
473
|
+
```
|
474
|
+
python myflow.py run --with batch
|
475
|
+
```
|
476
|
+
or
|
477
|
+
```
|
478
|
+
python myflow.py run --with kubernetes
|
479
|
+
```
|
480
|
+
which executes the flow on the desired system using the
|
481
|
+
requirements specified in `@resources`.
|
664
482
|
|
665
483
|
|
666
484
|
Parameters
|
667
485
|
----------
|
668
|
-
|
669
|
-
|
670
|
-
|
671
|
-
|
672
|
-
|
673
|
-
|
486
|
+
cpu : int, default 1
|
487
|
+
Number of CPUs required for this step.
|
488
|
+
gpu : int, optional, default None
|
489
|
+
Number of GPUs required for this step.
|
490
|
+
disk : int, optional, default None
|
491
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
492
|
+
memory : int, default 4096
|
493
|
+
Memory size (in MB) required for this step.
|
494
|
+
shared_memory : int, optional, default None
|
495
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
496
|
+
This parameter maps to the `--shm-size` option in Docker.
|
674
497
|
"""
|
675
498
|
...
|
676
499
|
|
677
500
|
@typing.overload
|
678
|
-
def
|
501
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
679
502
|
...
|
680
503
|
|
681
504
|
@typing.overload
|
682
|
-
def
|
505
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
683
506
|
...
|
684
507
|
|
685
|
-
def
|
508
|
+
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):
|
686
509
|
"""
|
687
|
-
Specifies the
|
510
|
+
Specifies the resources needed when executing this step.
|
688
511
|
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
512
|
+
Use `@resources` to specify the resource requirements
|
513
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
514
|
+
|
515
|
+
You can choose the compute layer on the command line by executing e.g.
|
516
|
+
```
|
517
|
+
python myflow.py run --with batch
|
518
|
+
```
|
519
|
+
or
|
520
|
+
```
|
521
|
+
python myflow.py run --with kubernetes
|
522
|
+
```
|
523
|
+
which executes the flow on the desired system using the
|
524
|
+
requirements specified in `@resources`.
|
693
525
|
|
694
526
|
|
695
527
|
Parameters
|
696
528
|
----------
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
529
|
+
cpu : int, default 1
|
530
|
+
Number of CPUs required for this step.
|
531
|
+
gpu : int, optional, default None
|
532
|
+
Number of GPUs required for this step.
|
533
|
+
disk : int, optional, default None
|
534
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
535
|
+
memory : int, default 4096
|
536
|
+
Memory size (in MB) required for this step.
|
537
|
+
shared_memory : int, optional, default None
|
538
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
539
|
+
This parameter maps to the `--shm-size` option in Docker.
|
703
540
|
"""
|
704
541
|
...
|
705
542
|
|
706
|
-
|
707
|
-
def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
543
|
+
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]]]:
|
708
544
|
"""
|
709
|
-
|
545
|
+
Specifies that this step should execute on DGX cloud.
|
710
546
|
|
711
|
-
|
547
|
+
|
548
|
+
Parameters
|
549
|
+
----------
|
550
|
+
gpu : int
|
551
|
+
Number of GPUs to use.
|
552
|
+
gpu_type : str
|
553
|
+
Type of Nvidia GPU to use.
|
554
|
+
queue_timeout : int
|
555
|
+
Time to keep the job in NVCF's queue.
|
556
|
+
"""
|
557
|
+
...
|
558
|
+
|
559
|
+
@typing.overload
|
560
|
+
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]]]:
|
561
|
+
"""
|
562
|
+
Specifies environment variables to be set prior to the execution of a step.
|
712
563
|
|
713
564
|
|
714
565
|
Parameters
|
715
566
|
----------
|
716
|
-
|
717
|
-
|
718
|
-
id : str, optional, default None
|
719
|
-
If multiple cards are present, use this id to identify this card.
|
720
|
-
options : Dict[str, Any], default {}
|
721
|
-
Options passed to the card. The contents depend on the card type.
|
722
|
-
timeout : int, default 45
|
723
|
-
Interrupt reporting if it takes more than this many seconds.
|
567
|
+
vars : Dict[str, str], default {}
|
568
|
+
Dictionary of environment variables to set.
|
724
569
|
"""
|
725
570
|
...
|
726
571
|
|
727
572
|
@typing.overload
|
728
|
-
def
|
573
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
729
574
|
...
|
730
575
|
|
731
576
|
@typing.overload
|
732
|
-
def
|
577
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
733
578
|
...
|
734
579
|
|
735
|
-
def
|
580
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
736
581
|
"""
|
737
|
-
|
738
|
-
|
739
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
582
|
+
Specifies environment variables to be set prior to the execution of a step.
|
740
583
|
|
741
584
|
|
742
585
|
Parameters
|
743
586
|
----------
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
587
|
+
vars : Dict[str, str], default {}
|
588
|
+
Dictionary of environment variables to set.
|
589
|
+
"""
|
590
|
+
...
|
591
|
+
|
592
|
+
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]]]:
|
593
|
+
"""
|
594
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
595
|
+
|
596
|
+
User code call
|
597
|
+
-----------
|
598
|
+
@ollama(
|
599
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
600
|
+
backend='local'
|
601
|
+
)
|
602
|
+
|
603
|
+
Valid backend options
|
604
|
+
---------------------
|
605
|
+
- 'local': Run as a separate process on the local task machine.
|
606
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
607
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
608
|
+
|
609
|
+
Valid model options
|
610
|
+
----------------
|
611
|
+
- 'llama3.2'
|
612
|
+
- 'llama3.3'
|
613
|
+
- any model here https://ollama.com/search
|
614
|
+
|
615
|
+
|
616
|
+
Parameters
|
617
|
+
----------
|
618
|
+
models: list[Ollama]
|
619
|
+
List of Ollama containers running models in sidecars.
|
620
|
+
backend: str
|
621
|
+
Determines where and how to run the Ollama process.
|
622
|
+
"""
|
623
|
+
...
|
624
|
+
|
625
|
+
@typing.overload
|
626
|
+
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]]]:
|
627
|
+
"""
|
628
|
+
Specifies the Conda environment for the step.
|
629
|
+
|
630
|
+
Information in this decorator will augment any
|
631
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
632
|
+
you can use `@conda_base` to set packages required by all
|
633
|
+
steps and use `@conda` to specify step-specific overrides.
|
634
|
+
|
635
|
+
|
636
|
+
Parameters
|
637
|
+
----------
|
638
|
+
packages : Dict[str, str], default {}
|
639
|
+
Packages to use for this step. The key is the name of the package
|
640
|
+
and the value is the version to use.
|
641
|
+
libraries : Dict[str, str], default {}
|
642
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
643
|
+
python : str, optional, default None
|
644
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
645
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
646
|
+
disabled : bool, default False
|
647
|
+
If set to True, disables @conda.
|
648
|
+
"""
|
649
|
+
...
|
650
|
+
|
651
|
+
@typing.overload
|
652
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
653
|
+
...
|
654
|
+
|
655
|
+
@typing.overload
|
656
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
657
|
+
...
|
658
|
+
|
659
|
+
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):
|
660
|
+
"""
|
661
|
+
Specifies the Conda environment for the step.
|
662
|
+
|
663
|
+
Information in this decorator will augment any
|
664
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
665
|
+
you can use `@conda_base` to set packages required by all
|
666
|
+
steps and use `@conda` to specify step-specific overrides.
|
667
|
+
|
668
|
+
|
669
|
+
Parameters
|
670
|
+
----------
|
671
|
+
packages : Dict[str, str], default {}
|
672
|
+
Packages to use for this step. The key is the name of the package
|
673
|
+
and the value is the version to use.
|
674
|
+
libraries : Dict[str, str], default {}
|
675
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
676
|
+
python : str, optional, default None
|
677
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
678
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
679
|
+
disabled : bool, default False
|
680
|
+
If set to True, disables @conda.
|
681
|
+
"""
|
682
|
+
...
|
683
|
+
|
684
|
+
@typing.overload
|
685
|
+
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]]]:
|
686
|
+
"""
|
687
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
688
|
+
the execution of a step.
|
689
|
+
|
690
|
+
|
691
|
+
Parameters
|
692
|
+
----------
|
693
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
694
|
+
List of secret specs, defining how the secrets are to be retrieved
|
695
|
+
"""
|
696
|
+
...
|
697
|
+
|
698
|
+
@typing.overload
|
699
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
700
|
+
...
|
701
|
+
|
702
|
+
@typing.overload
|
703
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
704
|
+
...
|
705
|
+
|
706
|
+
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]]] = []):
|
707
|
+
"""
|
708
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
709
|
+
the execution of a step.
|
710
|
+
|
711
|
+
|
712
|
+
Parameters
|
713
|
+
----------
|
714
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
715
|
+
List of secret specs, defining how the secrets are to be retrieved
|
752
716
|
"""
|
753
717
|
...
|
754
718
|
|
@@ -809,189 +773,192 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
809
773
|
"""
|
810
774
|
...
|
811
775
|
|
812
|
-
|
776
|
+
@typing.overload
|
777
|
+
def card(*, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
813
778
|
"""
|
814
|
-
|
815
|
-
|
816
|
-
User code call
|
817
|
-
-----------
|
818
|
-
@nim(
|
819
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
820
|
-
backend='managed'
|
821
|
-
)
|
822
|
-
|
823
|
-
Valid backend options
|
824
|
-
---------------------
|
825
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
779
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
826
780
|
|
827
|
-
|
828
|
-
----------------
|
829
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
830
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
831
|
-
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
781
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
832
782
|
|
833
783
|
|
834
784
|
Parameters
|
835
785
|
----------
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
|
841
|
-
|
786
|
+
type : str, default 'default'
|
787
|
+
Card type.
|
788
|
+
id : str, optional, default None
|
789
|
+
If multiple cards are present, use this id to identify this card.
|
790
|
+
options : Dict[str, Any], default {}
|
791
|
+
Options passed to the card. The contents depend on the card type.
|
792
|
+
timeout : int, default 45
|
793
|
+
Interrupt reporting if it takes more than this many seconds.
|
842
794
|
"""
|
843
795
|
...
|
844
796
|
|
845
|
-
|
797
|
+
@typing.overload
|
798
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
799
|
+
...
|
800
|
+
|
801
|
+
@typing.overload
|
802
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
803
|
+
...
|
804
|
+
|
805
|
+
def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
|
846
806
|
"""
|
847
|
-
|
807
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
808
|
+
|
809
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
848
810
|
|
849
811
|
|
850
812
|
Parameters
|
851
813
|
----------
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
814
|
+
type : str, default 'default'
|
815
|
+
Card type.
|
816
|
+
id : str, optional, default None
|
817
|
+
If multiple cards are present, use this id to identify this card.
|
818
|
+
options : Dict[str, Any], default {}
|
819
|
+
Options passed to the card. The contents depend on the card type.
|
820
|
+
timeout : int, default 45
|
821
|
+
Interrupt reporting if it takes more than this many seconds.
|
858
822
|
"""
|
859
823
|
...
|
860
824
|
|
861
825
|
@typing.overload
|
862
|
-
def
|
826
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
863
827
|
"""
|
864
|
-
|
828
|
+
Specifies the number of times the task corresponding
|
829
|
+
to a step needs to be retried.
|
830
|
+
|
831
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
832
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
833
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
865
834
|
|
835
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
836
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
837
|
+
ensuring that the flow execution can continue.
|
866
838
|
|
867
839
|
|
868
840
|
Parameters
|
869
841
|
----------
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
- `current.model`
|
875
|
-
- `current.huggingface_hub`
|
876
|
-
|
877
|
-
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
878
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
879
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
880
|
-
|
881
|
-
temp_dir_root : str, default: None
|
882
|
-
The root directory under which `current.model.loaded` will store loaded models
|
842
|
+
times : int, default 3
|
843
|
+
Number of times to retry this task.
|
844
|
+
minutes_between_retries : int, default 2
|
845
|
+
Number of minutes between retries.
|
883
846
|
"""
|
884
847
|
...
|
885
848
|
|
886
849
|
@typing.overload
|
887
|
-
def
|
850
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
888
851
|
...
|
889
852
|
|
890
853
|
@typing.overload
|
891
|
-
def
|
854
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
892
855
|
...
|
893
856
|
|
894
|
-
def
|
857
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
895
858
|
"""
|
896
|
-
|
859
|
+
Specifies the number of times the task corresponding
|
860
|
+
to a step needs to be retried.
|
897
861
|
|
862
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
863
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
864
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
865
|
+
|
866
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
867
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
868
|
+
ensuring that the flow execution can continue.
|
898
869
|
|
899
870
|
|
900
871
|
Parameters
|
901
872
|
----------
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
- `current.model`
|
907
|
-
- `current.huggingface_hub`
|
908
|
-
|
909
|
-
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
910
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
911
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
912
|
-
|
913
|
-
temp_dir_root : str, default: None
|
914
|
-
The root directory under which `current.model.loaded` will store loaded models
|
873
|
+
times : int, default 3
|
874
|
+
Number of times to retry this task.
|
875
|
+
minutes_between_retries : int, default 2
|
876
|
+
Number of minutes between retries.
|
915
877
|
"""
|
916
878
|
...
|
917
879
|
|
918
|
-
|
880
|
+
@typing.overload
|
881
|
+
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
919
882
|
"""
|
920
|
-
|
921
|
-
|
922
|
-
User code call
|
923
|
-
-----------
|
924
|
-
@ollama(
|
925
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
926
|
-
backend='local'
|
927
|
-
)
|
928
|
-
|
929
|
-
Valid backend options
|
930
|
-
---------------------
|
931
|
-
- 'local': Run as a separate process on the local task machine.
|
932
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
933
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
883
|
+
Specifies the PyPI packages for the step.
|
934
884
|
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
939
|
-
- any model here https://ollama.com/search
|
885
|
+
Information in this decorator will augment any
|
886
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
887
|
+
you can use `@pypi_base` to set packages required by all
|
888
|
+
steps and use `@pypi` to specify step-specific overrides.
|
940
889
|
|
941
890
|
|
942
891
|
Parameters
|
943
892
|
----------
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
893
|
+
packages : Dict[str, str], default: {}
|
894
|
+
Packages to use for this step. The key is the name of the package
|
895
|
+
and the value is the version to use.
|
896
|
+
python : str, optional, default: None
|
897
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
898
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
948
899
|
"""
|
949
900
|
...
|
950
901
|
|
951
902
|
@typing.overload
|
952
|
-
def
|
903
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
904
|
+
...
|
905
|
+
|
906
|
+
@typing.overload
|
907
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
908
|
+
...
|
909
|
+
|
910
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
953
911
|
"""
|
954
|
-
Specifies
|
912
|
+
Specifies the PyPI packages for the step.
|
913
|
+
|
914
|
+
Information in this decorator will augment any
|
915
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
916
|
+
you can use `@pypi_base` to set packages required by all
|
917
|
+
steps and use `@pypi` to specify step-specific overrides.
|
955
918
|
|
956
919
|
|
957
920
|
Parameters
|
958
921
|
----------
|
959
|
-
|
960
|
-
|
922
|
+
packages : Dict[str, str], default: {}
|
923
|
+
Packages to use for this step. The key is the name of the package
|
924
|
+
and the value is the version to use.
|
925
|
+
python : str, optional, default: None
|
926
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
927
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
961
928
|
"""
|
962
929
|
...
|
963
930
|
|
964
931
|
@typing.overload
|
965
|
-
def
|
932
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
933
|
+
"""
|
934
|
+
Decorator prototype for all step decorators. This function gets specialized
|
935
|
+
and imported for all decorators types by _import_plugin_decorators().
|
936
|
+
"""
|
966
937
|
...
|
967
938
|
|
968
939
|
@typing.overload
|
969
|
-
def
|
940
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
970
941
|
...
|
971
942
|
|
972
|
-
def
|
943
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
973
944
|
"""
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
Parameters
|
978
|
-
----------
|
979
|
-
vars : Dict[str, str], default {}
|
980
|
-
Dictionary of environment variables to set.
|
945
|
+
Decorator prototype for all step decorators. This function gets specialized
|
946
|
+
and imported for all decorators types by _import_plugin_decorators().
|
981
947
|
"""
|
982
948
|
...
|
983
949
|
|
984
|
-
def
|
950
|
+
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]]]:
|
985
951
|
"""
|
986
|
-
Specifies that this step
|
952
|
+
Specifies that this step is used to deploy an instance of the app.
|
953
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
987
954
|
|
988
955
|
|
989
956
|
Parameters
|
990
957
|
----------
|
991
|
-
|
958
|
+
app_port : int
|
992
959
|
Number of GPUs to use.
|
993
|
-
|
994
|
-
|
960
|
+
app_name : str
|
961
|
+
Name of the app to deploy.
|
995
962
|
"""
|
996
963
|
...
|
997
964
|
|
@@ -1088,6 +1055,219 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1088
1055
|
"""
|
1089
1056
|
...
|
1090
1057
|
|
1058
|
+
@typing.overload
|
1059
|
+
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]]:
|
1060
|
+
"""
|
1061
|
+
Specifies the Conda environment for all steps of the flow.
|
1062
|
+
|
1063
|
+
Use `@conda_base` to set common libraries required by all
|
1064
|
+
steps and use `@conda` to specify step-specific additions.
|
1065
|
+
|
1066
|
+
|
1067
|
+
Parameters
|
1068
|
+
----------
|
1069
|
+
packages : Dict[str, str], default {}
|
1070
|
+
Packages to use for this flow. The key is the name of the package
|
1071
|
+
and the value is the version to use.
|
1072
|
+
libraries : Dict[str, str], default {}
|
1073
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1074
|
+
python : str, optional, default None
|
1075
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1076
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1077
|
+
disabled : bool, default False
|
1078
|
+
If set to True, disables Conda.
|
1079
|
+
"""
|
1080
|
+
...
|
1081
|
+
|
1082
|
+
@typing.overload
|
1083
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1084
|
+
...
|
1085
|
+
|
1086
|
+
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):
|
1087
|
+
"""
|
1088
|
+
Specifies the Conda environment for all steps of the flow.
|
1089
|
+
|
1090
|
+
Use `@conda_base` to set common libraries required by all
|
1091
|
+
steps and use `@conda` to specify step-specific additions.
|
1092
|
+
|
1093
|
+
|
1094
|
+
Parameters
|
1095
|
+
----------
|
1096
|
+
packages : Dict[str, str], default {}
|
1097
|
+
Packages to use for this flow. The key is the name of the package
|
1098
|
+
and the value is the version to use.
|
1099
|
+
libraries : Dict[str, str], default {}
|
1100
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1101
|
+
python : str, optional, default None
|
1102
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1103
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1104
|
+
disabled : bool, default False
|
1105
|
+
If set to True, disables Conda.
|
1106
|
+
"""
|
1107
|
+
...
|
1108
|
+
|
1109
|
+
@typing.overload
|
1110
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1111
|
+
"""
|
1112
|
+
Specifies the PyPI packages for all steps of the flow.
|
1113
|
+
|
1114
|
+
Use `@pypi_base` to set common packages required by all
|
1115
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1116
|
+
|
1117
|
+
Parameters
|
1118
|
+
----------
|
1119
|
+
packages : Dict[str, str], default: {}
|
1120
|
+
Packages to use for this flow. The key is the name of the package
|
1121
|
+
and the value is the version to use.
|
1122
|
+
python : str, optional, default: None
|
1123
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1124
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1125
|
+
"""
|
1126
|
+
...
|
1127
|
+
|
1128
|
+
@typing.overload
|
1129
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1130
|
+
...
|
1131
|
+
|
1132
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1133
|
+
"""
|
1134
|
+
Specifies the PyPI packages for all steps of the flow.
|
1135
|
+
|
1136
|
+
Use `@pypi_base` to set common packages required by all
|
1137
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1138
|
+
|
1139
|
+
Parameters
|
1140
|
+
----------
|
1141
|
+
packages : Dict[str, str], default: {}
|
1142
|
+
Packages to use for this flow. The key is the name of the package
|
1143
|
+
and the value is the version to use.
|
1144
|
+
python : str, optional, default: None
|
1145
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1146
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1147
|
+
"""
|
1148
|
+
...
|
1149
|
+
|
1150
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1151
|
+
"""
|
1152
|
+
Specifies what flows belong to the same project.
|
1153
|
+
|
1154
|
+
A project-specific namespace is created for all flows that
|
1155
|
+
use the same `@project(name)`.
|
1156
|
+
|
1157
|
+
|
1158
|
+
Parameters
|
1159
|
+
----------
|
1160
|
+
name : str
|
1161
|
+
Project name. Make sure that the name is unique amongst all
|
1162
|
+
projects that use the same production scheduler. The name may
|
1163
|
+
contain only lowercase alphanumeric characters and underscores.
|
1164
|
+
|
1165
|
+
branch : Optional[str], default None
|
1166
|
+
The branch to use. If not specified, the branch is set to
|
1167
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1168
|
+
also be set on the command line using `--branch` as a top-level option.
|
1169
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1170
|
+
|
1171
|
+
production : bool, default False
|
1172
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1173
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1174
|
+
`production` in the decorator and on the command line.
|
1175
|
+
The project branch name will be:
|
1176
|
+
- if `branch` is specified:
|
1177
|
+
- if `production` is True: `prod.<branch>`
|
1178
|
+
- if `production` is False: `test.<branch>`
|
1179
|
+
- if `branch` is not specified:
|
1180
|
+
- if `production` is True: `prod`
|
1181
|
+
- if `production` is False: `user.<username>`
|
1182
|
+
"""
|
1183
|
+
...
|
1184
|
+
|
1185
|
+
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]]:
|
1186
|
+
"""
|
1187
|
+
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)
|
1188
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1189
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1190
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1191
|
+
starts only after all sensors finish.
|
1192
|
+
|
1193
|
+
|
1194
|
+
Parameters
|
1195
|
+
----------
|
1196
|
+
timeout : int
|
1197
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1198
|
+
poke_interval : int
|
1199
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1200
|
+
mode : str
|
1201
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1202
|
+
exponential_backoff : bool
|
1203
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1204
|
+
pool : str
|
1205
|
+
the slot pool this task should run in,
|
1206
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1207
|
+
soft_fail : bool
|
1208
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1209
|
+
name : str
|
1210
|
+
Name of the sensor on Airflow
|
1211
|
+
description : str
|
1212
|
+
Description of sensor in the Airflow UI
|
1213
|
+
bucket_key : Union[str, List[str]]
|
1214
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1215
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1216
|
+
bucket_name : str
|
1217
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1218
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1219
|
+
wildcard_match : bool
|
1220
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1221
|
+
aws_conn_id : str
|
1222
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1223
|
+
verify : bool
|
1224
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1225
|
+
"""
|
1226
|
+
...
|
1227
|
+
|
1228
|
+
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]]:
|
1229
|
+
"""
|
1230
|
+
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.
|
1231
|
+
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.
|
1232
|
+
|
1233
|
+
|
1234
|
+
Parameters
|
1235
|
+
----------
|
1236
|
+
timeout : int
|
1237
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1238
|
+
poke_interval : int
|
1239
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1240
|
+
mode : str
|
1241
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1242
|
+
exponential_backoff : bool
|
1243
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1244
|
+
pool : str
|
1245
|
+
the slot pool this task should run in,
|
1246
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1247
|
+
soft_fail : bool
|
1248
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1249
|
+
name : str
|
1250
|
+
Name of the sensor on Airflow
|
1251
|
+
description : str
|
1252
|
+
Description of sensor in the Airflow UI
|
1253
|
+
external_dag_id : str
|
1254
|
+
The dag_id that contains the task you want to wait for.
|
1255
|
+
external_task_ids : List[str]
|
1256
|
+
The list of task_ids that you want to wait for.
|
1257
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1258
|
+
allowed_states : List[str]
|
1259
|
+
Iterable of allowed states, (Default: ['success'])
|
1260
|
+
failed_states : List[str]
|
1261
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1262
|
+
execution_delta : datetime.timedelta
|
1263
|
+
time difference with the previous execution to look at,
|
1264
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1265
|
+
check_existence: bool
|
1266
|
+
Set to True to check if the external task exists or check if
|
1267
|
+
the DAG to wait for exists. (Default: True)
|
1268
|
+
"""
|
1269
|
+
...
|
1270
|
+
|
1091
1271
|
@typing.overload
|
1092
1272
|
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1093
1273
|
"""
|
@@ -1190,43 +1370,53 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1190
1370
|
...
|
1191
1371
|
|
1192
1372
|
@typing.overload
|
1193
|
-
def
|
1373
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1194
1374
|
"""
|
1195
|
-
Specifies the
|
1375
|
+
Specifies the times when the flow should be run when running on a
|
1376
|
+
production scheduler.
|
1196
1377
|
|
1197
|
-
Use `@pypi_base` to set common packages required by all
|
1198
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1199
1378
|
|
1200
1379
|
Parameters
|
1201
1380
|
----------
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1381
|
+
hourly : bool, default False
|
1382
|
+
Run the workflow hourly.
|
1383
|
+
daily : bool, default True
|
1384
|
+
Run the workflow daily.
|
1385
|
+
weekly : bool, default False
|
1386
|
+
Run the workflow weekly.
|
1387
|
+
cron : str, optional, default None
|
1388
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1389
|
+
specified by this expression.
|
1390
|
+
timezone : str, optional, default None
|
1391
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1392
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1208
1393
|
"""
|
1209
1394
|
...
|
1210
1395
|
|
1211
1396
|
@typing.overload
|
1212
|
-
def
|
1397
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1213
1398
|
...
|
1214
1399
|
|
1215
|
-
def
|
1400
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1216
1401
|
"""
|
1217
|
-
Specifies the
|
1402
|
+
Specifies the times when the flow should be run when running on a
|
1403
|
+
production scheduler.
|
1218
1404
|
|
1219
|
-
Use `@pypi_base` to set common packages required by all
|
1220
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1221
1405
|
|
1222
1406
|
Parameters
|
1223
1407
|
----------
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1408
|
+
hourly : bool, default False
|
1409
|
+
Run the workflow hourly.
|
1410
|
+
daily : bool, default True
|
1411
|
+
Run the workflow daily.
|
1412
|
+
weekly : bool, default False
|
1413
|
+
Run the workflow weekly.
|
1414
|
+
cron : str, optional, default None
|
1415
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1416
|
+
specified by this expression.
|
1417
|
+
timezone : str, optional, default None
|
1418
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1419
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1230
1420
|
"""
|
1231
1421
|
...
|
1232
1422
|
|
@@ -1344,228 +1534,5 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1344
1534
|
"""
|
1345
1535
|
...
|
1346
1536
|
|
1347
|
-
@typing.overload
|
1348
|
-
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1349
|
-
"""
|
1350
|
-
Specifies the times when the flow should be run when running on a
|
1351
|
-
production scheduler.
|
1352
|
-
|
1353
|
-
|
1354
|
-
Parameters
|
1355
|
-
----------
|
1356
|
-
hourly : bool, default False
|
1357
|
-
Run the workflow hourly.
|
1358
|
-
daily : bool, default True
|
1359
|
-
Run the workflow daily.
|
1360
|
-
weekly : bool, default False
|
1361
|
-
Run the workflow weekly.
|
1362
|
-
cron : str, optional, default None
|
1363
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1364
|
-
specified by this expression.
|
1365
|
-
timezone : str, optional, default None
|
1366
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1367
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1368
|
-
"""
|
1369
|
-
...
|
1370
|
-
|
1371
|
-
@typing.overload
|
1372
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1373
|
-
...
|
1374
|
-
|
1375
|
-
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1376
|
-
"""
|
1377
|
-
Specifies the times when the flow should be run when running on a
|
1378
|
-
production scheduler.
|
1379
|
-
|
1380
|
-
|
1381
|
-
Parameters
|
1382
|
-
----------
|
1383
|
-
hourly : bool, default False
|
1384
|
-
Run the workflow hourly.
|
1385
|
-
daily : bool, default True
|
1386
|
-
Run the workflow daily.
|
1387
|
-
weekly : bool, default False
|
1388
|
-
Run the workflow weekly.
|
1389
|
-
cron : str, optional, default None
|
1390
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1391
|
-
specified by this expression.
|
1392
|
-
timezone : str, optional, default None
|
1393
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1394
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1395
|
-
"""
|
1396
|
-
...
|
1397
|
-
|
1398
|
-
@typing.overload
|
1399
|
-
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]]:
|
1400
|
-
"""
|
1401
|
-
Specifies the Conda environment for all steps of the flow.
|
1402
|
-
|
1403
|
-
Use `@conda_base` to set common libraries required by all
|
1404
|
-
steps and use `@conda` to specify step-specific additions.
|
1405
|
-
|
1406
|
-
|
1407
|
-
Parameters
|
1408
|
-
----------
|
1409
|
-
packages : Dict[str, str], default {}
|
1410
|
-
Packages to use for this flow. The key is the name of the package
|
1411
|
-
and the value is the version to use.
|
1412
|
-
libraries : Dict[str, str], default {}
|
1413
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1414
|
-
python : str, optional, default None
|
1415
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1416
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1417
|
-
disabled : bool, default False
|
1418
|
-
If set to True, disables Conda.
|
1419
|
-
"""
|
1420
|
-
...
|
1421
|
-
|
1422
|
-
@typing.overload
|
1423
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1424
|
-
...
|
1425
|
-
|
1426
|
-
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):
|
1427
|
-
"""
|
1428
|
-
Specifies the Conda environment for all steps of the flow.
|
1429
|
-
|
1430
|
-
Use `@conda_base` to set common libraries required by all
|
1431
|
-
steps and use `@conda` to specify step-specific additions.
|
1432
|
-
|
1433
|
-
|
1434
|
-
Parameters
|
1435
|
-
----------
|
1436
|
-
packages : Dict[str, str], default {}
|
1437
|
-
Packages to use for this flow. The key is the name of the package
|
1438
|
-
and the value is the version to use.
|
1439
|
-
libraries : Dict[str, str], default {}
|
1440
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1441
|
-
python : str, optional, default None
|
1442
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1443
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1444
|
-
disabled : bool, default False
|
1445
|
-
If set to True, disables Conda.
|
1446
|
-
"""
|
1447
|
-
...
|
1448
|
-
|
1449
|
-
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1450
|
-
"""
|
1451
|
-
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1452
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1453
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1454
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1455
|
-
starts only after all sensors finish.
|
1456
|
-
|
1457
|
-
|
1458
|
-
Parameters
|
1459
|
-
----------
|
1460
|
-
timeout : int
|
1461
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1462
|
-
poke_interval : int
|
1463
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1464
|
-
mode : str
|
1465
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1466
|
-
exponential_backoff : bool
|
1467
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1468
|
-
pool : str
|
1469
|
-
the slot pool this task should run in,
|
1470
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1471
|
-
soft_fail : bool
|
1472
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1473
|
-
name : str
|
1474
|
-
Name of the sensor on Airflow
|
1475
|
-
description : str
|
1476
|
-
Description of sensor in the Airflow UI
|
1477
|
-
bucket_key : Union[str, List[str]]
|
1478
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1479
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1480
|
-
bucket_name : str
|
1481
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1482
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1483
|
-
wildcard_match : bool
|
1484
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1485
|
-
aws_conn_id : str
|
1486
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1487
|
-
verify : bool
|
1488
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1489
|
-
"""
|
1490
|
-
...
|
1491
|
-
|
1492
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1493
|
-
"""
|
1494
|
-
Specifies what flows belong to the same project.
|
1495
|
-
|
1496
|
-
A project-specific namespace is created for all flows that
|
1497
|
-
use the same `@project(name)`.
|
1498
|
-
|
1499
|
-
|
1500
|
-
Parameters
|
1501
|
-
----------
|
1502
|
-
name : str
|
1503
|
-
Project name. Make sure that the name is unique amongst all
|
1504
|
-
projects that use the same production scheduler. The name may
|
1505
|
-
contain only lowercase alphanumeric characters and underscores.
|
1506
|
-
|
1507
|
-
branch : Optional[str], default None
|
1508
|
-
The branch to use. If not specified, the branch is set to
|
1509
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1510
|
-
also be set on the command line using `--branch` as a top-level option.
|
1511
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1512
|
-
|
1513
|
-
production : bool, default False
|
1514
|
-
Whether or not the branch is the production branch. This can also be set on the
|
1515
|
-
command line using `--production` as a top-level option. It is an error to specify
|
1516
|
-
`production` in the decorator and on the command line.
|
1517
|
-
The project branch name will be:
|
1518
|
-
- if `branch` is specified:
|
1519
|
-
- if `production` is True: `prod.<branch>`
|
1520
|
-
- if `production` is False: `test.<branch>`
|
1521
|
-
- if `branch` is not specified:
|
1522
|
-
- if `production` is True: `prod`
|
1523
|
-
- if `production` is False: `user.<username>`
|
1524
|
-
"""
|
1525
|
-
...
|
1526
|
-
|
1527
|
-
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1528
|
-
"""
|
1529
|
-
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1530
|
-
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1531
|
-
|
1532
|
-
|
1533
|
-
Parameters
|
1534
|
-
----------
|
1535
|
-
timeout : int
|
1536
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1537
|
-
poke_interval : int
|
1538
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1539
|
-
mode : str
|
1540
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1541
|
-
exponential_backoff : bool
|
1542
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1543
|
-
pool : str
|
1544
|
-
the slot pool this task should run in,
|
1545
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1546
|
-
soft_fail : bool
|
1547
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1548
|
-
name : str
|
1549
|
-
Name of the sensor on Airflow
|
1550
|
-
description : str
|
1551
|
-
Description of sensor in the Airflow UI
|
1552
|
-
external_dag_id : str
|
1553
|
-
The dag_id that contains the task you want to wait for.
|
1554
|
-
external_task_ids : List[str]
|
1555
|
-
The list of task_ids that you want to wait for.
|
1556
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1557
|
-
allowed_states : List[str]
|
1558
|
-
Iterable of allowed states, (Default: ['success'])
|
1559
|
-
failed_states : List[str]
|
1560
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1561
|
-
execution_delta : datetime.timedelta
|
1562
|
-
time difference with the previous execution to look at,
|
1563
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1564
|
-
check_existence: bool
|
1565
|
-
Set to True to check if the external task exists or check if
|
1566
|
-
the DAG to wait for exists. (Default: True)
|
1567
|
-
"""
|
1568
|
-
...
|
1569
|
-
|
1570
1537
|
pkg_name: str
|
1571
1538
|
|