ob-metaflow-stubs 6.0.3.164__py2.py3-none-any.whl → 6.0.3.166__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 +730 -730
- 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 +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- 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 +6 -6
- 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 +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +4 -4
- 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 +3 -3
- 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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +3 -3
- 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 +3 -3
- 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 +3 -3
- 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 +5 -5
- 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 +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +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 +4 -4
- 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 +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +5 -5
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +4 -4
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.3.164.dist-info → ob_metaflow_stubs-6.0.3.166.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.166.dist-info/RECORD +206 -0
- ob_metaflow_stubs-6.0.3.164.dist-info/RECORD +0 -206
- {ob_metaflow_stubs-6.0.3.164.dist-info → ob_metaflow_stubs-6.0.3.166.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.164.dist-info → ob_metaflow_stubs-6.0.3.166.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.11.
|
4
|
-
# Generated on 2025-05-
|
3
|
+
# MF version: 2.15.11.2+obcheckpoint(0.2.1);ob(v1) #
|
4
|
+
# Generated on 2025-05-09T17:10:54.121807 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -35,8 +35,8 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import tuple_util as tuple_util
|
39
38
|
from . import cards as cards
|
39
|
+
from . import tuple_util as tuple_util
|
40
40
|
from . import metaflow_git as metaflow_git
|
41
41
|
from . import events as events
|
42
42
|
from . import runner as runner
|
@@ -44,9 +44,9 @@ from . import plugins as plugins
|
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
47
48
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
48
49
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
49
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -153,6 +153,72 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
153
153
|
"""
|
154
154
|
...
|
155
155
|
|
156
|
+
@typing.overload
|
157
|
+
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]]]:
|
158
|
+
"""
|
159
|
+
Specifies environment variables to be set prior to the execution of a step.
|
160
|
+
|
161
|
+
|
162
|
+
Parameters
|
163
|
+
----------
|
164
|
+
vars : Dict[str, str], default {}
|
165
|
+
Dictionary of environment variables to set.
|
166
|
+
"""
|
167
|
+
...
|
168
|
+
|
169
|
+
@typing.overload
|
170
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
171
|
+
...
|
172
|
+
|
173
|
+
@typing.overload
|
174
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
175
|
+
...
|
176
|
+
|
177
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
178
|
+
"""
|
179
|
+
Specifies environment variables to be set prior to the execution of a step.
|
180
|
+
|
181
|
+
|
182
|
+
Parameters
|
183
|
+
----------
|
184
|
+
vars : Dict[str, str], default {}
|
185
|
+
Dictionary of environment variables to set.
|
186
|
+
"""
|
187
|
+
...
|
188
|
+
|
189
|
+
def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
190
|
+
"""
|
191
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
192
|
+
|
193
|
+
User code call
|
194
|
+
-----------
|
195
|
+
@nim(
|
196
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
197
|
+
backend='managed'
|
198
|
+
)
|
199
|
+
|
200
|
+
Valid backend options
|
201
|
+
---------------------
|
202
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
203
|
+
|
204
|
+
Valid model options
|
205
|
+
----------------
|
206
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
207
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
208
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
209
|
+
|
210
|
+
|
211
|
+
Parameters
|
212
|
+
----------
|
213
|
+
models: list[NIM]
|
214
|
+
List of NIM containers running models in sidecars.
|
215
|
+
backend: str
|
216
|
+
Compute provider to run the NIM container.
|
217
|
+
queue_timeout : int
|
218
|
+
Time to keep the job in NVCF's queue.
|
219
|
+
"""
|
220
|
+
...
|
221
|
+
|
156
222
|
@typing.overload
|
157
223
|
def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
158
224
|
"""
|
@@ -210,199 +276,160 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
210
276
|
"""
|
211
277
|
...
|
212
278
|
|
213
|
-
|
214
|
-
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]]]:
|
279
|
+
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]]]:
|
215
280
|
"""
|
216
|
-
|
281
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
217
282
|
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
283
|
+
User code call
|
284
|
+
-----------
|
285
|
+
@ollama(
|
286
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
287
|
+
backend='local'
|
288
|
+
)
|
289
|
+
|
290
|
+
Valid backend options
|
291
|
+
---------------------
|
292
|
+
- 'local': Run as a separate process on the local task machine.
|
293
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
294
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
295
|
+
|
296
|
+
Valid model options
|
297
|
+
----------------
|
298
|
+
- 'llama3.2'
|
299
|
+
- 'llama3.3'
|
300
|
+
- any model here https://ollama.com/search
|
222
301
|
|
223
302
|
|
224
303
|
Parameters
|
225
304
|
----------
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
231
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
305
|
+
models: list[Ollama]
|
306
|
+
List of Ollama containers running models in sidecars.
|
307
|
+
backend: str
|
308
|
+
Determines where and how to run the Ollama process.
|
232
309
|
"""
|
233
310
|
...
|
234
311
|
|
235
|
-
|
236
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
237
|
-
...
|
238
|
-
|
239
|
-
@typing.overload
|
240
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
241
|
-
...
|
242
|
-
|
243
|
-
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):
|
312
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[str] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
244
313
|
"""
|
245
|
-
Specifies
|
246
|
-
|
247
|
-
Information in this decorator will augment any
|
248
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
249
|
-
you can use `@pypi_base` to set packages required by all
|
250
|
-
steps and use `@pypi` to specify step-specific overrides.
|
314
|
+
Specifies that this step should execute on Kubernetes.
|
251
315
|
|
252
316
|
|
253
317
|
Parameters
|
254
318
|
----------
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
319
|
+
cpu : int, default 1
|
320
|
+
Number of CPUs required for this step. If `@resources` is
|
321
|
+
also present, the maximum value from all decorators is used.
|
322
|
+
memory : int, default 4096
|
323
|
+
Memory size (in MB) required for this step. If
|
324
|
+
`@resources` is also present, the maximum value from all decorators is
|
325
|
+
used.
|
326
|
+
disk : int, default 10240
|
327
|
+
Disk size (in MB) required for this step. If
|
328
|
+
`@resources` is also present, the maximum value from all decorators is
|
329
|
+
used.
|
330
|
+
image : str, optional, default None
|
331
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
332
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
333
|
+
not, a default Docker image mapping to the current version of Python is used.
|
334
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
335
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
336
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
337
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
338
|
+
secrets : List[str], optional, default None
|
339
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
340
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
341
|
+
in Metaflow configuration.
|
342
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
343
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
344
|
+
Can be passed in as a comma separated string of values e.g.
|
345
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
346
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
347
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
348
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
349
|
+
gpu : int, optional, default None
|
350
|
+
Number of GPUs required for this step. A value of zero implies that
|
351
|
+
the scheduled node should not have GPUs.
|
352
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
353
|
+
The vendor of the GPUs to be used for this step.
|
354
|
+
tolerations : List[str], default []
|
355
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
356
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
357
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
358
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
359
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
360
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
361
|
+
use_tmpfs : bool, default False
|
362
|
+
This enables an explicit tmpfs mount for this step.
|
363
|
+
tmpfs_tempdir : bool, default True
|
364
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
365
|
+
tmpfs_size : int, optional, default: None
|
366
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
367
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
368
|
+
memory allocated for this step.
|
369
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
370
|
+
Path to tmpfs mount for this step.
|
371
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
372
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
373
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
374
|
+
shared_memory: int, optional
|
375
|
+
Shared memory size (in MiB) required for this step
|
376
|
+
port: int, optional
|
377
|
+
Port number to specify in the Kubernetes job object
|
378
|
+
compute_pool : str, optional, default None
|
379
|
+
Compute pool to be used for for this step.
|
380
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
381
|
+
hostname_resolution_timeout: int, default 10 * 60
|
382
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
383
|
+
Only applicable when @parallel is used.
|
384
|
+
qos: str, default: Burstable
|
385
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
386
|
+
|
387
|
+
security_context: Dict[str, Any], optional, default None
|
388
|
+
Container security context. Applies to the task container. Allows the following keys:
|
389
|
+
- privileged: bool, optional, default None
|
390
|
+
- allow_privilege_escalation: bool, optional, default None
|
391
|
+
- run_as_user: int, optional, default None
|
392
|
+
- run_as_group: int, optional, default None
|
393
|
+
- run_as_non_root: bool, optional, default None
|
261
394
|
"""
|
262
395
|
...
|
263
396
|
|
264
397
|
@typing.overload
|
265
|
-
def
|
398
|
+
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]]]:
|
266
399
|
"""
|
267
|
-
|
268
|
-
|
269
|
-
Use `@resources` to specify the resource requirements
|
270
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
400
|
+
Enables loading / saving of models within a step.
|
271
401
|
|
272
|
-
You can choose the compute layer on the command line by executing e.g.
|
273
|
-
```
|
274
|
-
python myflow.py run --with batch
|
275
|
-
```
|
276
|
-
or
|
277
|
-
```
|
278
|
-
python myflow.py run --with kubernetes
|
279
|
-
```
|
280
|
-
which executes the flow on the desired system using the
|
281
|
-
requirements specified in `@resources`.
|
282
402
|
|
283
403
|
|
284
404
|
Parameters
|
285
405
|
----------
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
406
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
407
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
408
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
409
|
+
- `current.checkpoint`
|
410
|
+
- `current.model`
|
411
|
+
- `current.huggingface_hub`
|
412
|
+
|
413
|
+
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
|
414
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
415
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
416
|
+
|
417
|
+
temp_dir_root : str, default: None
|
418
|
+
The root directory under which `current.model.loaded` will store loaded models
|
297
419
|
"""
|
298
420
|
...
|
299
421
|
|
300
422
|
@typing.overload
|
301
|
-
def
|
423
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
302
424
|
...
|
303
425
|
|
304
426
|
@typing.overload
|
305
|
-
def
|
427
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
306
428
|
...
|
307
429
|
|
308
|
-
def
|
430
|
+
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):
|
309
431
|
"""
|
310
|
-
|
311
|
-
|
312
|
-
Use `@resources` to specify the resource requirements
|
313
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
314
|
-
|
315
|
-
You can choose the compute layer on the command line by executing e.g.
|
316
|
-
```
|
317
|
-
python myflow.py run --with batch
|
318
|
-
```
|
319
|
-
or
|
320
|
-
```
|
321
|
-
python myflow.py run --with kubernetes
|
322
|
-
```
|
323
|
-
which executes the flow on the desired system using the
|
324
|
-
requirements specified in `@resources`.
|
325
|
-
|
326
|
-
|
327
|
-
Parameters
|
328
|
-
----------
|
329
|
-
cpu : int, default 1
|
330
|
-
Number of CPUs required for this step.
|
331
|
-
gpu : int, optional, default None
|
332
|
-
Number of GPUs required for this step.
|
333
|
-
disk : int, optional, default None
|
334
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
335
|
-
memory : int, default 4096
|
336
|
-
Memory size (in MB) required for this step.
|
337
|
-
shared_memory : int, optional, default None
|
338
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
339
|
-
This parameter maps to the `--shm-size` option in Docker.
|
340
|
-
"""
|
341
|
-
...
|
342
|
-
|
343
|
-
@typing.overload
|
344
|
-
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]]]:
|
345
|
-
"""
|
346
|
-
Specifies a timeout for your step.
|
347
|
-
|
348
|
-
This decorator is useful if this step may hang indefinitely.
|
349
|
-
|
350
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
351
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
352
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
353
|
-
|
354
|
-
Note that all the values specified in parameters are added together so if you specify
|
355
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
356
|
-
|
357
|
-
|
358
|
-
Parameters
|
359
|
-
----------
|
360
|
-
seconds : int, default 0
|
361
|
-
Number of seconds to wait prior to timing out.
|
362
|
-
minutes : int, default 0
|
363
|
-
Number of minutes to wait prior to timing out.
|
364
|
-
hours : int, default 0
|
365
|
-
Number of hours to wait prior to timing out.
|
366
|
-
"""
|
367
|
-
...
|
368
|
-
|
369
|
-
@typing.overload
|
370
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
371
|
-
...
|
372
|
-
|
373
|
-
@typing.overload
|
374
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
375
|
-
...
|
376
|
-
|
377
|
-
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):
|
378
|
-
"""
|
379
|
-
Specifies a timeout for your step.
|
380
|
-
|
381
|
-
This decorator is useful if this step may hang indefinitely.
|
382
|
-
|
383
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
384
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
385
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
386
|
-
|
387
|
-
Note that all the values specified in parameters are added together so if you specify
|
388
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
389
|
-
|
390
|
-
|
391
|
-
Parameters
|
392
|
-
----------
|
393
|
-
seconds : int, default 0
|
394
|
-
Number of seconds to wait prior to timing out.
|
395
|
-
minutes : int, default 0
|
396
|
-
Number of minutes to wait prior to timing out.
|
397
|
-
hours : int, default 0
|
398
|
-
Number of hours to wait prior to timing out.
|
399
|
-
"""
|
400
|
-
...
|
401
|
-
|
402
|
-
@typing.overload
|
403
|
-
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]]]:
|
404
|
-
"""
|
405
|
-
Enables loading / saving of models within a step.
|
432
|
+
Enables loading / saving of models within a step.
|
406
433
|
|
407
434
|
|
408
435
|
|
@@ -424,83 +451,112 @@ def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[
|
|
424
451
|
"""
|
425
452
|
...
|
426
453
|
|
427
|
-
|
428
|
-
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
429
|
-
...
|
430
|
-
|
431
|
-
@typing.overload
|
432
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
433
|
-
...
|
434
|
-
|
435
|
-
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):
|
454
|
+
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]]]:
|
436
455
|
"""
|
437
|
-
|
438
|
-
|
456
|
+
Specifies that this step should execute on DGX cloud.
|
439
457
|
|
440
458
|
|
441
459
|
Parameters
|
442
460
|
----------
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
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
|
451
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
452
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
453
|
-
|
454
|
-
temp_dir_root : str, default: None
|
455
|
-
The root directory under which `current.model.loaded` will store loaded models
|
461
|
+
gpu : int
|
462
|
+
Number of GPUs to use.
|
463
|
+
gpu_type : str
|
464
|
+
Type of Nvidia GPU to use.
|
465
|
+
queue_timeout : int
|
466
|
+
Time to keep the job in NVCF's queue.
|
456
467
|
"""
|
457
468
|
...
|
458
469
|
|
459
|
-
def
|
470
|
+
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]]]:
|
460
471
|
"""
|
461
|
-
Specifies that this step
|
462
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
472
|
+
Specifies that this step should execute on DGX cloud.
|
463
473
|
|
464
474
|
|
465
475
|
Parameters
|
466
476
|
----------
|
467
|
-
|
477
|
+
gpu : int
|
468
478
|
Number of GPUs to use.
|
469
|
-
|
470
|
-
|
479
|
+
gpu_type : str
|
480
|
+
Type of Nvidia GPU to use.
|
471
481
|
"""
|
472
482
|
...
|
473
483
|
|
474
484
|
@typing.overload
|
475
|
-
def
|
485
|
+
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]]]:
|
476
486
|
"""
|
477
|
-
Specifies
|
487
|
+
Specifies the resources needed when executing this step.
|
488
|
+
|
489
|
+
Use `@resources` to specify the resource requirements
|
490
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
491
|
+
|
492
|
+
You can choose the compute layer on the command line by executing e.g.
|
493
|
+
```
|
494
|
+
python myflow.py run --with batch
|
495
|
+
```
|
496
|
+
or
|
497
|
+
```
|
498
|
+
python myflow.py run --with kubernetes
|
499
|
+
```
|
500
|
+
which executes the flow on the desired system using the
|
501
|
+
requirements specified in `@resources`.
|
478
502
|
|
479
503
|
|
480
504
|
Parameters
|
481
505
|
----------
|
482
|
-
|
483
|
-
|
506
|
+
cpu : int, default 1
|
507
|
+
Number of CPUs required for this step.
|
508
|
+
gpu : int, optional, default None
|
509
|
+
Number of GPUs required for this step.
|
510
|
+
disk : int, optional, default None
|
511
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
512
|
+
memory : int, default 4096
|
513
|
+
Memory size (in MB) required for this step.
|
514
|
+
shared_memory : int, optional, default None
|
515
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
516
|
+
This parameter maps to the `--shm-size` option in Docker.
|
484
517
|
"""
|
485
518
|
...
|
486
519
|
|
487
520
|
@typing.overload
|
488
|
-
def
|
521
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
489
522
|
...
|
490
523
|
|
491
524
|
@typing.overload
|
492
|
-
def
|
525
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
493
526
|
...
|
494
527
|
|
495
|
-
def
|
528
|
+
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):
|
496
529
|
"""
|
497
|
-
Specifies
|
530
|
+
Specifies the resources needed when executing this step.
|
531
|
+
|
532
|
+
Use `@resources` to specify the resource requirements
|
533
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
534
|
+
|
535
|
+
You can choose the compute layer on the command line by executing e.g.
|
536
|
+
```
|
537
|
+
python myflow.py run --with batch
|
538
|
+
```
|
539
|
+
or
|
540
|
+
```
|
541
|
+
python myflow.py run --with kubernetes
|
542
|
+
```
|
543
|
+
which executes the flow on the desired system using the
|
544
|
+
requirements specified in `@resources`.
|
498
545
|
|
499
546
|
|
500
547
|
Parameters
|
501
548
|
----------
|
502
|
-
|
503
|
-
|
549
|
+
cpu : int, default 1
|
550
|
+
Number of CPUs required for this step.
|
551
|
+
gpu : int, optional, default None
|
552
|
+
Number of GPUs required for this step.
|
553
|
+
disk : int, optional, default None
|
554
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
555
|
+
memory : int, default 4096
|
556
|
+
Memory size (in MB) required for this step.
|
557
|
+
shared_memory : int, optional, default None
|
558
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
559
|
+
This parameter maps to the `--shm-size` option in Docker.
|
504
560
|
"""
|
505
561
|
...
|
506
562
|
|
@@ -524,176 +580,159 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
524
580
|
...
|
525
581
|
|
526
582
|
@typing.overload
|
527
|
-
def
|
583
|
+
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]]]:
|
528
584
|
"""
|
529
|
-
Specifies the
|
585
|
+
Specifies the number of times the task corresponding
|
586
|
+
to a step needs to be retried.
|
530
587
|
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
588
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
589
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
590
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
591
|
+
|
592
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
593
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
594
|
+
ensuring that the flow execution can continue.
|
535
595
|
|
536
596
|
|
537
597
|
Parameters
|
538
598
|
----------
|
539
|
-
|
540
|
-
|
541
|
-
|
542
|
-
|
543
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
544
|
-
python : str, optional, default None
|
545
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
546
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
547
|
-
disabled : bool, default False
|
548
|
-
If set to True, disables @conda.
|
599
|
+
times : int, default 3
|
600
|
+
Number of times to retry this task.
|
601
|
+
minutes_between_retries : int, default 2
|
602
|
+
Number of minutes between retries.
|
549
603
|
"""
|
550
604
|
...
|
551
605
|
|
552
606
|
@typing.overload
|
553
|
-
def
|
607
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
554
608
|
...
|
555
609
|
|
556
610
|
@typing.overload
|
557
|
-
def
|
611
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
558
612
|
...
|
559
613
|
|
560
|
-
def
|
614
|
+
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):
|
561
615
|
"""
|
562
|
-
Specifies the
|
616
|
+
Specifies the number of times the task corresponding
|
617
|
+
to a step needs to be retried.
|
563
618
|
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
619
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
620
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
621
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
622
|
+
|
623
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
624
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
625
|
+
ensuring that the flow execution can continue.
|
568
626
|
|
569
627
|
|
570
628
|
Parameters
|
571
629
|
----------
|
572
|
-
|
573
|
-
|
574
|
-
|
575
|
-
|
576
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
577
|
-
python : str, optional, default None
|
578
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
579
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
580
|
-
disabled : bool, default False
|
581
|
-
If set to True, disables @conda.
|
630
|
+
times : int, default 3
|
631
|
+
Number of times to retry this task.
|
632
|
+
minutes_between_retries : int, default 2
|
633
|
+
Number of minutes between retries.
|
582
634
|
"""
|
583
635
|
...
|
584
636
|
|
585
637
|
@typing.overload
|
586
|
-
def
|
638
|
+
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]]]:
|
587
639
|
"""
|
588
|
-
Specifies
|
589
|
-
|
640
|
+
Specifies the PyPI packages for the step.
|
641
|
+
|
642
|
+
Information in this decorator will augment any
|
643
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
644
|
+
you can use `@pypi_base` to set packages required by all
|
645
|
+
steps and use `@pypi` to specify step-specific overrides.
|
590
646
|
|
591
647
|
|
592
648
|
Parameters
|
593
649
|
----------
|
594
|
-
|
595
|
-
|
650
|
+
packages : Dict[str, str], default: {}
|
651
|
+
Packages to use for this step. The key is the name of the package
|
652
|
+
and the value is the version to use.
|
653
|
+
python : str, optional, default: None
|
654
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
655
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
596
656
|
"""
|
597
657
|
...
|
598
658
|
|
599
659
|
@typing.overload
|
600
|
-
def
|
660
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
601
661
|
...
|
602
662
|
|
603
663
|
@typing.overload
|
604
|
-
def
|
605
|
-
...
|
606
|
-
|
607
|
-
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]]] = []):
|
608
|
-
"""
|
609
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
610
|
-
the execution of a step.
|
611
|
-
|
612
|
-
|
613
|
-
Parameters
|
614
|
-
----------
|
615
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
616
|
-
List of secret specs, defining how the secrets are to be retrieved
|
617
|
-
"""
|
664
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
618
665
|
...
|
619
666
|
|
620
|
-
def
|
667
|
+
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):
|
621
668
|
"""
|
622
|
-
|
623
|
-
|
624
|
-
User code call
|
625
|
-
-----------
|
626
|
-
@ollama(
|
627
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
628
|
-
backend='local'
|
629
|
-
)
|
630
|
-
|
631
|
-
Valid backend options
|
632
|
-
---------------------
|
633
|
-
- 'local': Run as a separate process on the local task machine.
|
634
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
635
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
669
|
+
Specifies the PyPI packages for the step.
|
636
670
|
|
637
|
-
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
- any model here https://ollama.com/search
|
671
|
+
Information in this decorator will augment any
|
672
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
673
|
+
you can use `@pypi_base` to set packages required by all
|
674
|
+
steps and use `@pypi` to specify step-specific overrides.
|
642
675
|
|
643
676
|
|
644
677
|
Parameters
|
645
678
|
----------
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
679
|
+
packages : Dict[str, str], default: {}
|
680
|
+
Packages to use for this step. The key is the name of the package
|
681
|
+
and the value is the version to use.
|
682
|
+
python : str, optional, default: None
|
683
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
684
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
650
685
|
"""
|
651
686
|
...
|
652
687
|
|
653
|
-
|
688
|
+
@typing.overload
|
689
|
+
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]]]:
|
654
690
|
"""
|
655
|
-
Specifies that
|
691
|
+
Specifies that the step will success under all circumstances.
|
692
|
+
|
693
|
+
The decorator will create an optional artifact, specified by `var`, which
|
694
|
+
contains the exception raised. You can use it to detect the presence
|
695
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
696
|
+
are missing.
|
656
697
|
|
657
698
|
|
658
699
|
Parameters
|
659
700
|
----------
|
660
|
-
|
661
|
-
|
662
|
-
|
663
|
-
|
701
|
+
var : str, optional, default None
|
702
|
+
Name of the artifact in which to store the caught exception.
|
703
|
+
If not specified, the exception is not stored.
|
704
|
+
print_exception : bool, default True
|
705
|
+
Determines whether or not the exception is printed to
|
706
|
+
stdout when caught.
|
664
707
|
"""
|
665
708
|
...
|
666
709
|
|
667
710
|
@typing.overload
|
668
|
-
def
|
669
|
-
"""
|
670
|
-
Internal decorator to support Fast bakery
|
671
|
-
"""
|
711
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
672
712
|
...
|
673
713
|
|
674
714
|
@typing.overload
|
675
|
-
def
|
676
|
-
...
|
677
|
-
|
678
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
679
|
-
"""
|
680
|
-
Internal decorator to support Fast bakery
|
681
|
-
"""
|
715
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
682
716
|
...
|
683
717
|
|
684
|
-
def
|
718
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
685
719
|
"""
|
686
|
-
Specifies that
|
720
|
+
Specifies that the step will success under all circumstances.
|
721
|
+
|
722
|
+
The decorator will create an optional artifact, specified by `var`, which
|
723
|
+
contains the exception raised. You can use it to detect the presence
|
724
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
725
|
+
are missing.
|
687
726
|
|
688
727
|
|
689
728
|
Parameters
|
690
729
|
----------
|
691
|
-
|
692
|
-
|
693
|
-
|
694
|
-
|
695
|
-
|
696
|
-
|
730
|
+
var : str, optional, default None
|
731
|
+
Name of the artifact in which to store the caught exception.
|
732
|
+
If not specified, the exception is not stored.
|
733
|
+
print_exception : bool, default True
|
734
|
+
Determines whether or not the exception is printed to
|
735
|
+
stdout when caught.
|
697
736
|
"""
|
698
737
|
...
|
699
738
|
|
@@ -723,534 +762,328 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
|
|
723
762
|
...
|
724
763
|
|
725
764
|
@typing.overload
|
726
|
-
def
|
765
|
+
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]]]:
|
727
766
|
"""
|
728
|
-
|
767
|
+
Specifies a timeout for your step.
|
729
768
|
|
730
|
-
|
769
|
+
This decorator is useful if this step may hang indefinitely.
|
770
|
+
|
771
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
772
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
773
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
774
|
+
|
775
|
+
Note that all the values specified in parameters are added together so if you specify
|
776
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
731
777
|
|
732
778
|
|
733
779
|
Parameters
|
734
780
|
----------
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
timeout : int, default 45
|
742
|
-
Interrupt reporting if it takes more than this many seconds.
|
781
|
+
seconds : int, default 0
|
782
|
+
Number of seconds to wait prior to timing out.
|
783
|
+
minutes : int, default 0
|
784
|
+
Number of minutes to wait prior to timing out.
|
785
|
+
hours : int, default 0
|
786
|
+
Number of hours to wait prior to timing out.
|
743
787
|
"""
|
744
788
|
...
|
745
789
|
|
746
790
|
@typing.overload
|
747
|
-
def
|
791
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
748
792
|
...
|
749
793
|
|
750
794
|
@typing.overload
|
751
|
-
def
|
795
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
752
796
|
...
|
753
797
|
|
754
|
-
def
|
798
|
+
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):
|
755
799
|
"""
|
756
|
-
|
800
|
+
Specifies a timeout for your step.
|
757
801
|
|
758
|
-
|
802
|
+
This decorator is useful if this step may hang indefinitely.
|
803
|
+
|
804
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
805
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
806
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
807
|
+
|
808
|
+
Note that all the values specified in parameters are added together so if you specify
|
809
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
759
810
|
|
760
811
|
|
761
812
|
Parameters
|
762
813
|
----------
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
timeout : int, default 45
|
770
|
-
Interrupt reporting if it takes more than this many seconds.
|
814
|
+
seconds : int, default 0
|
815
|
+
Number of seconds to wait prior to timing out.
|
816
|
+
minutes : int, default 0
|
817
|
+
Number of minutes to wait prior to timing out.
|
818
|
+
hours : int, default 0
|
819
|
+
Number of hours to wait prior to timing out.
|
771
820
|
"""
|
772
821
|
...
|
773
822
|
|
774
|
-
def
|
823
|
+
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]]]:
|
775
824
|
"""
|
776
|
-
|
777
|
-
|
778
|
-
User code call
|
779
|
-
-----------
|
780
|
-
@nim(
|
781
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
782
|
-
backend='managed'
|
783
|
-
)
|
784
|
-
|
785
|
-
Valid backend options
|
786
|
-
---------------------
|
787
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
788
|
-
|
789
|
-
Valid model options
|
790
|
-
----------------
|
791
|
-
- 'meta/llama3-8b-instruct': 8B parameter model
|
792
|
-
- 'meta/llama3-70b-instruct': 70B parameter model
|
793
|
-
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
825
|
+
Specifies that this step is used to deploy an instance of the app.
|
826
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
794
827
|
|
795
828
|
|
796
829
|
Parameters
|
797
830
|
----------
|
798
|
-
|
799
|
-
|
800
|
-
|
801
|
-
|
802
|
-
queue_timeout : int
|
803
|
-
Time to keep the job in NVCF's queue.
|
831
|
+
app_port : int
|
832
|
+
Number of GPUs to use.
|
833
|
+
app_name : str
|
834
|
+
Name of the app to deploy.
|
804
835
|
"""
|
805
836
|
...
|
806
837
|
|
807
838
|
@typing.overload
|
808
|
-
def
|
839
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
809
840
|
"""
|
810
|
-
|
811
|
-
|
812
|
-
The decorator will create an optional artifact, specified by `var`, which
|
813
|
-
contains the exception raised. You can use it to detect the presence
|
814
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
815
|
-
are missing.
|
816
|
-
|
817
|
-
|
818
|
-
Parameters
|
819
|
-
----------
|
820
|
-
var : str, optional, default None
|
821
|
-
Name of the artifact in which to store the caught exception.
|
822
|
-
If not specified, the exception is not stored.
|
823
|
-
print_exception : bool, default True
|
824
|
-
Determines whether or not the exception is printed to
|
825
|
-
stdout when caught.
|
841
|
+
Internal decorator to support Fast bakery
|
826
842
|
"""
|
827
843
|
...
|
828
844
|
|
829
845
|
@typing.overload
|
830
|
-
def
|
846
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
831
847
|
...
|
832
848
|
|
833
|
-
|
834
|
-
|
849
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
850
|
+
"""
|
851
|
+
Internal decorator to support Fast bakery
|
852
|
+
"""
|
835
853
|
...
|
836
854
|
|
837
|
-
|
855
|
+
@typing.overload
|
856
|
+
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]]]:
|
838
857
|
"""
|
839
|
-
Specifies
|
840
|
-
|
841
|
-
The decorator will create an optional artifact, specified by `var`, which
|
842
|
-
contains the exception raised. You can use it to detect the presence
|
843
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
844
|
-
are missing.
|
858
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
859
|
+
the execution of a step.
|
845
860
|
|
846
861
|
|
847
862
|
Parameters
|
848
863
|
----------
|
849
|
-
|
850
|
-
|
851
|
-
If not specified, the exception is not stored.
|
852
|
-
print_exception : bool, default True
|
853
|
-
Determines whether or not the exception is printed to
|
854
|
-
stdout when caught.
|
864
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
865
|
+
List of secret specs, defining how the secrets are to be retrieved
|
855
866
|
"""
|
856
867
|
...
|
857
868
|
|
858
869
|
@typing.overload
|
859
|
-
def
|
870
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
871
|
+
...
|
872
|
+
|
873
|
+
@typing.overload
|
874
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
875
|
+
...
|
876
|
+
|
877
|
+
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]]] = []):
|
860
878
|
"""
|
861
|
-
Specifies
|
862
|
-
|
879
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
880
|
+
the execution of a step.
|
863
881
|
|
864
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
865
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
866
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
867
882
|
|
868
|
-
|
869
|
-
|
870
|
-
|
883
|
+
Parameters
|
884
|
+
----------
|
885
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
886
|
+
List of secret specs, defining how the secrets are to be retrieved
|
887
|
+
"""
|
888
|
+
...
|
889
|
+
|
890
|
+
@typing.overload
|
891
|
+
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]]]:
|
892
|
+
"""
|
893
|
+
Specifies the Conda environment for the step.
|
894
|
+
|
895
|
+
Information in this decorator will augment any
|
896
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
897
|
+
you can use `@conda_base` to set packages required by all
|
898
|
+
steps and use `@conda` to specify step-specific overrides.
|
871
899
|
|
872
900
|
|
873
901
|
Parameters
|
874
902
|
----------
|
875
|
-
|
876
|
-
|
877
|
-
|
878
|
-
|
903
|
+
packages : Dict[str, str], default {}
|
904
|
+
Packages to use for this step. The key is the name of the package
|
905
|
+
and the value is the version to use.
|
906
|
+
libraries : Dict[str, str], default {}
|
907
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
908
|
+
python : str, optional, default None
|
909
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
910
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
911
|
+
disabled : bool, default False
|
912
|
+
If set to True, disables @conda.
|
879
913
|
"""
|
880
914
|
...
|
881
915
|
|
882
916
|
@typing.overload
|
883
|
-
def
|
917
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
884
918
|
...
|
885
919
|
|
886
920
|
@typing.overload
|
887
|
-
def
|
921
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
888
922
|
...
|
889
923
|
|
890
|
-
def
|
924
|
+
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):
|
891
925
|
"""
|
892
|
-
Specifies the
|
893
|
-
to a step needs to be retried.
|
894
|
-
|
895
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
896
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
897
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
926
|
+
Specifies the Conda environment for the step.
|
898
927
|
|
899
|
-
|
900
|
-
|
901
|
-
|
928
|
+
Information in this decorator will augment any
|
929
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
930
|
+
you can use `@conda_base` to set packages required by all
|
931
|
+
steps and use `@conda` to specify step-specific overrides.
|
902
932
|
|
903
933
|
|
904
934
|
Parameters
|
905
935
|
----------
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
936
|
+
packages : Dict[str, str], default {}
|
937
|
+
Packages to use for this step. The key is the name of the package
|
938
|
+
and the value is the version to use.
|
939
|
+
libraries : Dict[str, str], default {}
|
940
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
941
|
+
python : str, optional, default None
|
942
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
943
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
944
|
+
disabled : bool, default False
|
945
|
+
If set to True, disables @conda.
|
910
946
|
"""
|
911
947
|
...
|
912
948
|
|
913
|
-
|
949
|
+
@typing.overload
|
950
|
+
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]]]:
|
914
951
|
"""
|
915
|
-
|
952
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
953
|
+
|
954
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
916
955
|
|
917
956
|
|
918
957
|
Parameters
|
919
958
|
----------
|
920
|
-
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
Disk size (in MB) required for this step. If
|
929
|
-
`@resources` is also present, the maximum value from all decorators is
|
930
|
-
used.
|
931
|
-
image : str, optional, default None
|
932
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
933
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
934
|
-
not, a default Docker image mapping to the current version of Python is used.
|
935
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
936
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
937
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
938
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
939
|
-
secrets : List[str], optional, default None
|
940
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
941
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
942
|
-
in Metaflow configuration.
|
943
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
944
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
945
|
-
Can be passed in as a comma separated string of values e.g.
|
946
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
947
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
948
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
949
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
950
|
-
gpu : int, optional, default None
|
951
|
-
Number of GPUs required for this step. A value of zero implies that
|
952
|
-
the scheduled node should not have GPUs.
|
953
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
954
|
-
The vendor of the GPUs to be used for this step.
|
955
|
-
tolerations : List[str], default []
|
956
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
957
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
958
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
959
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
960
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
961
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
962
|
-
use_tmpfs : bool, default False
|
963
|
-
This enables an explicit tmpfs mount for this step.
|
964
|
-
tmpfs_tempdir : bool, default True
|
965
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
966
|
-
tmpfs_size : int, optional, default: None
|
967
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
968
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
969
|
-
memory allocated for this step.
|
970
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
971
|
-
Path to tmpfs mount for this step.
|
972
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
973
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
974
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
975
|
-
shared_memory: int, optional
|
976
|
-
Shared memory size (in MiB) required for this step
|
977
|
-
port: int, optional
|
978
|
-
Port number to specify in the Kubernetes job object
|
979
|
-
compute_pool : str, optional, default None
|
980
|
-
Compute pool to be used for for this step.
|
981
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
982
|
-
hostname_resolution_timeout: int, default 10 * 60
|
983
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
984
|
-
Only applicable when @parallel is used.
|
985
|
-
qos: str, default: Burstable
|
986
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
987
|
-
|
988
|
-
security_context: Dict[str, Any], optional, default None
|
989
|
-
Container security context. Applies to the task container. Allows the following keys:
|
990
|
-
- privileged: bool, optional, default None
|
991
|
-
- allow_privilege_escalation: bool, optional, default None
|
992
|
-
- run_as_user: int, optional, default None
|
993
|
-
- run_as_group: int, optional, default None
|
994
|
-
- run_as_non_root: bool, optional, default None
|
959
|
+
type : str, default 'default'
|
960
|
+
Card type.
|
961
|
+
id : str, optional, default None
|
962
|
+
If multiple cards are present, use this id to identify this card.
|
963
|
+
options : Dict[str, Any], default {}
|
964
|
+
Options passed to the card. The contents depend on the card type.
|
965
|
+
timeout : int, default 45
|
966
|
+
Interrupt reporting if it takes more than this many seconds.
|
995
967
|
"""
|
996
968
|
...
|
997
969
|
|
998
970
|
@typing.overload
|
999
|
-
def
|
1000
|
-
"""
|
1001
|
-
Specifies the times when the flow should be run when running on a
|
1002
|
-
production scheduler.
|
1003
|
-
|
1004
|
-
|
1005
|
-
Parameters
|
1006
|
-
----------
|
1007
|
-
hourly : bool, default False
|
1008
|
-
Run the workflow hourly.
|
1009
|
-
daily : bool, default True
|
1010
|
-
Run the workflow daily.
|
1011
|
-
weekly : bool, default False
|
1012
|
-
Run the workflow weekly.
|
1013
|
-
cron : str, optional, default None
|
1014
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1015
|
-
specified by this expression.
|
1016
|
-
timezone : str, optional, default None
|
1017
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1018
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1019
|
-
"""
|
971
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1020
972
|
...
|
1021
973
|
|
1022
974
|
@typing.overload
|
1023
|
-
def
|
975
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1024
976
|
...
|
1025
977
|
|
1026
|
-
def
|
978
|
+
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):
|
1027
979
|
"""
|
1028
|
-
|
1029
|
-
|
980
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
981
|
+
|
982
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1030
983
|
|
1031
984
|
|
1032
985
|
Parameters
|
1033
986
|
----------
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
specified by this expression.
|
1043
|
-
timezone : str, optional, default None
|
1044
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1045
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
987
|
+
type : str, default 'default'
|
988
|
+
Card type.
|
989
|
+
id : str, optional, default None
|
990
|
+
If multiple cards are present, use this id to identify this card.
|
991
|
+
options : Dict[str, Any], default {}
|
992
|
+
Options passed to the card. The contents depend on the card type.
|
993
|
+
timeout : int, default 45
|
994
|
+
Interrupt reporting if it takes more than this many seconds.
|
1046
995
|
"""
|
1047
996
|
...
|
1048
997
|
|
1049
998
|
@typing.overload
|
1050
|
-
def
|
999
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1051
1000
|
"""
|
1052
|
-
Specifies the
|
1053
|
-
|
1054
|
-
Use `@conda_base` to set common libraries required by all
|
1055
|
-
steps and use `@conda` to specify step-specific additions.
|
1001
|
+
Specifies the PyPI packages for all steps of the flow.
|
1056
1002
|
|
1003
|
+
Use `@pypi_base` to set common packages required by all
|
1004
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1057
1005
|
|
1058
1006
|
Parameters
|
1059
1007
|
----------
|
1060
|
-
packages : Dict[str, str], default {}
|
1008
|
+
packages : Dict[str, str], default: {}
|
1061
1009
|
Packages to use for this flow. The key is the name of the package
|
1062
1010
|
and the value is the version to use.
|
1063
|
-
|
1064
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1065
|
-
python : str, optional, default None
|
1011
|
+
python : str, optional, default: None
|
1066
1012
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1067
1013
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1068
|
-
disabled : bool, default False
|
1069
|
-
If set to True, disables Conda.
|
1070
1014
|
"""
|
1071
1015
|
...
|
1072
1016
|
|
1073
1017
|
@typing.overload
|
1074
|
-
def
|
1018
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1075
1019
|
...
|
1076
1020
|
|
1077
|
-
def
|
1021
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1078
1022
|
"""
|
1079
|
-
Specifies the
|
1080
|
-
|
1081
|
-
Use `@conda_base` to set common libraries required by all
|
1082
|
-
steps and use `@conda` to specify step-specific additions.
|
1023
|
+
Specifies the PyPI packages for all steps of the flow.
|
1083
1024
|
|
1025
|
+
Use `@pypi_base` to set common packages required by all
|
1026
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1084
1027
|
|
1085
1028
|
Parameters
|
1086
1029
|
----------
|
1087
|
-
packages : Dict[str, str], default {}
|
1030
|
+
packages : Dict[str, str], default: {}
|
1088
1031
|
Packages to use for this flow. The key is the name of the package
|
1089
1032
|
and the value is the version to use.
|
1090
|
-
|
1091
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1092
|
-
python : str, optional, default None
|
1033
|
+
python : str, optional, default: None
|
1093
1034
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1094
1035
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1095
|
-
disabled : bool, default False
|
1096
|
-
If set to True, disables Conda.
|
1097
1036
|
"""
|
1098
1037
|
...
|
1099
1038
|
|
1100
|
-
|
1039
|
+
@typing.overload
|
1040
|
+
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]]:
|
1101
1041
|
"""
|
1102
|
-
|
1103
|
-
|
1042
|
+
Specifies the times when the flow should be run when running on a
|
1043
|
+
production scheduler.
|
1104
1044
|
|
1105
1045
|
|
1106
1046
|
Parameters
|
1107
1047
|
----------
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1121
|
-
name : str
|
1122
|
-
Name of the sensor on Airflow
|
1123
|
-
description : str
|
1124
|
-
Description of sensor in the Airflow UI
|
1125
|
-
external_dag_id : str
|
1126
|
-
The dag_id that contains the task you want to wait for.
|
1127
|
-
external_task_ids : List[str]
|
1128
|
-
The list of task_ids that you want to wait for.
|
1129
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1130
|
-
allowed_states : List[str]
|
1131
|
-
Iterable of allowed states, (Default: ['success'])
|
1132
|
-
failed_states : List[str]
|
1133
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1134
|
-
execution_delta : datetime.timedelta
|
1135
|
-
time difference with the previous execution to look at,
|
1136
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1137
|
-
check_existence: bool
|
1138
|
-
Set to True to check if the external task exists or check if
|
1139
|
-
the DAG to wait for exists. (Default: True)
|
1048
|
+
hourly : bool, default False
|
1049
|
+
Run the workflow hourly.
|
1050
|
+
daily : bool, default True
|
1051
|
+
Run the workflow daily.
|
1052
|
+
weekly : bool, default False
|
1053
|
+
Run the workflow weekly.
|
1054
|
+
cron : str, optional, default None
|
1055
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1056
|
+
specified by this expression.
|
1057
|
+
timezone : str, optional, default None
|
1058
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1059
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1140
1060
|
"""
|
1141
1061
|
...
|
1142
1062
|
|
1143
|
-
|
1063
|
+
@typing.overload
|
1064
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1065
|
+
...
|
1066
|
+
|
1067
|
+
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):
|
1144
1068
|
"""
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
This decorator is useful when users wish to save data to a different datastore
|
1149
|
-
than what is configured in Metaflow. This can be for variety of reasons:
|
1150
|
-
|
1151
|
-
1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
|
1152
|
-
2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
|
1153
|
-
- Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
|
1154
|
-
3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
|
1155
|
-
- Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
|
1156
|
-
|
1157
|
-
Usage:
|
1158
|
-
----------
|
1159
|
-
|
1160
|
-
- Using a custom IAM role to access the datastore.
|
1161
|
-
|
1162
|
-
```python
|
1163
|
-
@with_artifact_store(
|
1164
|
-
type="s3",
|
1165
|
-
config=lambda: {
|
1166
|
-
"root": "s3://my-bucket-foo/path/to/root",
|
1167
|
-
"role_arn": ROLE,
|
1168
|
-
},
|
1169
|
-
)
|
1170
|
-
class MyFlow(FlowSpec):
|
1171
|
-
|
1172
|
-
@checkpoint
|
1173
|
-
@step
|
1174
|
-
def start(self):
|
1175
|
-
with open("my_file.txt", "w") as f:
|
1176
|
-
f.write("Hello, World!")
|
1177
|
-
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1178
|
-
self.next(self.end)
|
1179
|
-
|
1180
|
-
```
|
1181
|
-
|
1182
|
-
- Using credentials to access the s3-compatible datastore.
|
1183
|
-
|
1184
|
-
```python
|
1185
|
-
@with_artifact_store(
|
1186
|
-
type="s3",
|
1187
|
-
config=lambda: {
|
1188
|
-
"root": "s3://my-bucket-foo/path/to/root",
|
1189
|
-
"client_params": {
|
1190
|
-
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1191
|
-
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1192
|
-
},
|
1193
|
-
},
|
1194
|
-
)
|
1195
|
-
class MyFlow(FlowSpec):
|
1196
|
-
|
1197
|
-
@checkpoint
|
1198
|
-
@step
|
1199
|
-
def start(self):
|
1200
|
-
with open("my_file.txt", "w") as f:
|
1201
|
-
f.write("Hello, World!")
|
1202
|
-
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1203
|
-
self.next(self.end)
|
1204
|
-
|
1205
|
-
```
|
1206
|
-
|
1207
|
-
- Accessing objects stored in external datastores after task execution.
|
1208
|
-
|
1209
|
-
```python
|
1210
|
-
run = Run("CheckpointsTestsFlow/8992")
|
1211
|
-
with artifact_store_from(run=run, config={
|
1212
|
-
"client_params": {
|
1213
|
-
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1214
|
-
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1215
|
-
},
|
1216
|
-
}):
|
1217
|
-
with Checkpoint() as cp:
|
1218
|
-
latest = cp.list(
|
1219
|
-
task=run["start"].task
|
1220
|
-
)[0]
|
1221
|
-
print(latest)
|
1222
|
-
cp.load(
|
1223
|
-
latest,
|
1224
|
-
"test-checkpoints"
|
1225
|
-
)
|
1226
|
-
|
1227
|
-
task = Task("TorchTuneFlow/8484/train/53673")
|
1228
|
-
with artifact_store_from(run=run, config={
|
1229
|
-
"client_params": {
|
1230
|
-
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1231
|
-
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1232
|
-
},
|
1233
|
-
}):
|
1234
|
-
load_model(
|
1235
|
-
task.data.model_ref,
|
1236
|
-
"test-models"
|
1237
|
-
)
|
1238
|
-
```
|
1239
|
-
Parameters:
|
1240
|
-
----------
|
1069
|
+
Specifies the times when the flow should be run when running on a
|
1070
|
+
production scheduler.
|
1241
1071
|
|
1242
|
-
type: str
|
1243
|
-
The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
|
1244
1072
|
|
1245
|
-
|
1246
|
-
|
1247
|
-
|
1248
|
-
|
1249
|
-
|
1250
|
-
|
1251
|
-
|
1252
|
-
|
1253
|
-
|
1073
|
+
Parameters
|
1074
|
+
----------
|
1075
|
+
hourly : bool, default False
|
1076
|
+
Run the workflow hourly.
|
1077
|
+
daily : bool, default True
|
1078
|
+
Run the workflow daily.
|
1079
|
+
weekly : bool, default False
|
1080
|
+
Run the workflow weekly.
|
1081
|
+
cron : str, optional, default None
|
1082
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1083
|
+
specified by this expression.
|
1084
|
+
timezone : str, optional, default None
|
1085
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1086
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1254
1087
|
"""
|
1255
1088
|
...
|
1256
1089
|
|
@@ -1289,6 +1122,57 @@ def project(*, name: str, branch: typing.Optional[str] = None, production: bool
|
|
1289
1122
|
"""
|
1290
1123
|
...
|
1291
1124
|
|
1125
|
+
@typing.overload
|
1126
|
+
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]]:
|
1127
|
+
"""
|
1128
|
+
Specifies the Conda environment for all steps of the flow.
|
1129
|
+
|
1130
|
+
Use `@conda_base` to set common libraries required by all
|
1131
|
+
steps and use `@conda` to specify step-specific additions.
|
1132
|
+
|
1133
|
+
|
1134
|
+
Parameters
|
1135
|
+
----------
|
1136
|
+
packages : Dict[str, str], default {}
|
1137
|
+
Packages to use for this flow. The key is the name of the package
|
1138
|
+
and the value is the version to use.
|
1139
|
+
libraries : Dict[str, str], default {}
|
1140
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1141
|
+
python : str, optional, default None
|
1142
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1143
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1144
|
+
disabled : bool, default False
|
1145
|
+
If set to True, disables Conda.
|
1146
|
+
"""
|
1147
|
+
...
|
1148
|
+
|
1149
|
+
@typing.overload
|
1150
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1151
|
+
...
|
1152
|
+
|
1153
|
+
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):
|
1154
|
+
"""
|
1155
|
+
Specifies the Conda environment for all steps of the flow.
|
1156
|
+
|
1157
|
+
Use `@conda_base` to set common libraries required by all
|
1158
|
+
steps and use `@conda` to specify step-specific additions.
|
1159
|
+
|
1160
|
+
|
1161
|
+
Parameters
|
1162
|
+
----------
|
1163
|
+
packages : Dict[str, str], default {}
|
1164
|
+
Packages to use for this flow. The key is the name of the package
|
1165
|
+
and the value is the version to use.
|
1166
|
+
libraries : Dict[str, str], default {}
|
1167
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1168
|
+
python : str, optional, default None
|
1169
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1170
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1171
|
+
disabled : bool, default False
|
1172
|
+
If set to True, disables Conda.
|
1173
|
+
"""
|
1174
|
+
...
|
1175
|
+
|
1292
1176
|
@typing.overload
|
1293
1177
|
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]]:
|
1294
1178
|
"""
|
@@ -1483,6 +1367,120 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1483
1367
|
"""
|
1484
1368
|
...
|
1485
1369
|
|
1370
|
+
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
1371
|
+
"""
|
1372
|
+
Allows setting external datastores to save data for the
|
1373
|
+
`@checkpoint`/`@model`/`@huggingface_hub` decorators.
|
1374
|
+
|
1375
|
+
This decorator is useful when users wish to save data to a different datastore
|
1376
|
+
than what is configured in Metaflow. This can be for variety of reasons:
|
1377
|
+
|
1378
|
+
1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
|
1379
|
+
2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
|
1380
|
+
- Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
|
1381
|
+
3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
|
1382
|
+
- Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
|
1383
|
+
|
1384
|
+
Usage:
|
1385
|
+
----------
|
1386
|
+
|
1387
|
+
- Using a custom IAM role to access the datastore.
|
1388
|
+
|
1389
|
+
```python
|
1390
|
+
@with_artifact_store(
|
1391
|
+
type="s3",
|
1392
|
+
config=lambda: {
|
1393
|
+
"root": "s3://my-bucket-foo/path/to/root",
|
1394
|
+
"role_arn": ROLE,
|
1395
|
+
},
|
1396
|
+
)
|
1397
|
+
class MyFlow(FlowSpec):
|
1398
|
+
|
1399
|
+
@checkpoint
|
1400
|
+
@step
|
1401
|
+
def start(self):
|
1402
|
+
with open("my_file.txt", "w") as f:
|
1403
|
+
f.write("Hello, World!")
|
1404
|
+
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1405
|
+
self.next(self.end)
|
1406
|
+
|
1407
|
+
```
|
1408
|
+
|
1409
|
+
- Using credentials to access the s3-compatible datastore.
|
1410
|
+
|
1411
|
+
```python
|
1412
|
+
@with_artifact_store(
|
1413
|
+
type="s3",
|
1414
|
+
config=lambda: {
|
1415
|
+
"root": "s3://my-bucket-foo/path/to/root",
|
1416
|
+
"client_params": {
|
1417
|
+
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1418
|
+
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1419
|
+
},
|
1420
|
+
},
|
1421
|
+
)
|
1422
|
+
class MyFlow(FlowSpec):
|
1423
|
+
|
1424
|
+
@checkpoint
|
1425
|
+
@step
|
1426
|
+
def start(self):
|
1427
|
+
with open("my_file.txt", "w") as f:
|
1428
|
+
f.write("Hello, World!")
|
1429
|
+
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1430
|
+
self.next(self.end)
|
1431
|
+
|
1432
|
+
```
|
1433
|
+
|
1434
|
+
- Accessing objects stored in external datastores after task execution.
|
1435
|
+
|
1436
|
+
```python
|
1437
|
+
run = Run("CheckpointsTestsFlow/8992")
|
1438
|
+
with artifact_store_from(run=run, config={
|
1439
|
+
"client_params": {
|
1440
|
+
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1441
|
+
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1442
|
+
},
|
1443
|
+
}):
|
1444
|
+
with Checkpoint() as cp:
|
1445
|
+
latest = cp.list(
|
1446
|
+
task=run["start"].task
|
1447
|
+
)[0]
|
1448
|
+
print(latest)
|
1449
|
+
cp.load(
|
1450
|
+
latest,
|
1451
|
+
"test-checkpoints"
|
1452
|
+
)
|
1453
|
+
|
1454
|
+
task = Task("TorchTuneFlow/8484/train/53673")
|
1455
|
+
with artifact_store_from(run=run, config={
|
1456
|
+
"client_params": {
|
1457
|
+
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1458
|
+
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1459
|
+
},
|
1460
|
+
}):
|
1461
|
+
load_model(
|
1462
|
+
task.data.model_ref,
|
1463
|
+
"test-models"
|
1464
|
+
)
|
1465
|
+
```
|
1466
|
+
Parameters:
|
1467
|
+
----------
|
1468
|
+
|
1469
|
+
type: str
|
1470
|
+
The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
|
1471
|
+
|
1472
|
+
config: dict or Callable
|
1473
|
+
Dictionary of configuration options for the datastore. The following keys are required:
|
1474
|
+
- root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
|
1475
|
+
- example: 's3://bucket-name/path/to/root'
|
1476
|
+
- example: 'gs://bucket-name/path/to/root'
|
1477
|
+
- example: 'https://myblockacc.blob.core.windows.net/metaflow/'
|
1478
|
+
- role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
|
1479
|
+
- session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
|
1480
|
+
- client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
|
1481
|
+
"""
|
1482
|
+
...
|
1483
|
+
|
1486
1484
|
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]]:
|
1487
1485
|
"""
|
1488
1486
|
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)
|
@@ -1526,44 +1524,46 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1526
1524
|
"""
|
1527
1525
|
...
|
1528
1526
|
|
1529
|
-
|
1530
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1531
|
-
"""
|
1532
|
-
Specifies the PyPI packages for all steps of the flow.
|
1533
|
-
|
1534
|
-
Use `@pypi_base` to set common packages required by all
|
1535
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1536
|
-
|
1537
|
-
Parameters
|
1538
|
-
----------
|
1539
|
-
packages : Dict[str, str], default: {}
|
1540
|
-
Packages to use for this flow. The key is the name of the package
|
1541
|
-
and the value is the version to use.
|
1542
|
-
python : str, optional, default: None
|
1543
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1544
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1545
|
-
"""
|
1546
|
-
...
|
1547
|
-
|
1548
|
-
@typing.overload
|
1549
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1550
|
-
...
|
1551
|
-
|
1552
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
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]]:
|
1553
1528
|
"""
|
1554
|
-
|
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.
|
1555
1531
|
|
1556
|
-
Use `@pypi_base` to set common packages required by all
|
1557
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1558
1532
|
|
1559
1533
|
Parameters
|
1560
1534
|
----------
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
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
1567
|
"""
|
1568
1568
|
...
|
1569
1569
|
|