ob-metaflow-stubs 6.0.3.166__py2.py3-none-any.whl → 6.0.3.168rc0__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 +634 -634
- metaflow-stubs/cards.pyi +1 -1
- metaflow-stubs/cli.pyi +1 -1
- metaflow-stubs/cli_components/__init__.pyi +1 -1
- metaflow-stubs/cli_components/utils.pyi +1 -1
- metaflow-stubs/client/__init__.pyi +1 -1
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +3 -3
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +1 -1
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +99 -99
- metaflow-stubs/metaflow_git.pyi +1 -1
- metaflow-stubs/mf_extensions/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +8 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +12 -12
- metaflow-stubs/plugins/airflow/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +1 -1
- metaflow-stubs/plugins/airflow/exception.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +1 -1
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +1 -1
- metaflow-stubs/plugins/argo/__init__.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_client.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_events.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_client.pyi +1 -1
- metaflow-stubs/plugins/aws/aws_utils.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +1 -1
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +1 -1
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_client.pyi +1 -1
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +1 -1
- metaflow-stubs/plugins/datatools/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/local.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +1 -1
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +1 -1
- metaflow-stubs/plugins/debug_logger.pyi +1 -1
- metaflow-stubs/plugins/debug_monitor.pyi +1 -1
- metaflow-stubs/plugins/environment_decorator.pyi +1 -1
- metaflow-stubs/plugins/events_decorator.pyi +1 -1
- metaflow-stubs/plugins/frameworks/__init__.pyi +1 -1
- metaflow-stubs/plugins/frameworks/pytorch.pyi +1 -1
- metaflow-stubs/plugins/gcp/__init__.pyi +1 -1
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +3 -3
- metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +1 -1
- metaflow-stubs/plugins/uv/__init__.pyi +1 -1
- metaflow-stubs/plugins/uv/uv_environment.pyi +1 -1
- metaflow-stubs/profilers/__init__.pyi +1 -1
- metaflow-stubs/pylint_wrapper.pyi +1 -1
- metaflow-stubs/runner/__init__.pyi +1 -1
- metaflow-stubs/runner/deployer.pyi +4 -4
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +4 -4
- {ob_metaflow_stubs-6.0.3.166.dist-info → ob_metaflow_stubs-6.0.3.168rc0.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.168rc0.dist-info/RECORD +206 -0
- ob_metaflow_stubs-6.0.3.166.dist-info/RECORD +0 -206
- {ob_metaflow_stubs-6.0.3.166.dist-info → ob_metaflow_stubs-6.0.3.168rc0.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.166.dist-info → ob_metaflow_stubs-6.0.3.168rc0.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.15.11.2+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-05-
|
4
|
+
# Generated on 2025-05-19T23:34:02.941331 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import datetime
|
12
11
|
import typing
|
12
|
+
import datetime
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -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 cards as cards
|
39
38
|
from . import tuple_util as tuple_util
|
39
|
+
from . import cards as cards
|
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
|
48
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
47
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
48
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -153,72 +153,6 @@ 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
|
-
|
222
156
|
@typing.overload
|
223
157
|
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]]]:
|
224
158
|
"""
|
@@ -276,6 +210,22 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
276
210
|
"""
|
277
211
|
...
|
278
212
|
|
213
|
+
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]]]:
|
214
|
+
"""
|
215
|
+
Specifies that this step should execute on DGX cloud.
|
216
|
+
|
217
|
+
|
218
|
+
Parameters
|
219
|
+
----------
|
220
|
+
gpu : int
|
221
|
+
Number of GPUs to use.
|
222
|
+
gpu_type : str
|
223
|
+
Type of Nvidia GPU to use.
|
224
|
+
queue_timeout : int
|
225
|
+
Time to keep the job in NVCF's queue.
|
226
|
+
"""
|
227
|
+
...
|
228
|
+
|
279
229
|
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]]]:
|
280
230
|
"""
|
281
231
|
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
@@ -309,175 +259,246 @@ def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.U
|
|
309
259
|
"""
|
310
260
|
...
|
311
261
|
|
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]]]:
|
313
|
-
"""
|
314
|
-
Specifies that this step should execute on Kubernetes.
|
315
|
-
|
316
|
-
|
317
|
-
Parameters
|
318
|
-
----------
|
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
|
394
|
-
"""
|
395
|
-
...
|
396
|
-
|
397
262
|
@typing.overload
|
398
|
-
def
|
263
|
+
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]]]:
|
399
264
|
"""
|
400
|
-
|
265
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
401
266
|
|
267
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
402
268
|
|
403
269
|
|
404
270
|
Parameters
|
405
271
|
----------
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
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
|
272
|
+
type : str, default 'default'
|
273
|
+
Card type.
|
274
|
+
id : str, optional, default None
|
275
|
+
If multiple cards are present, use this id to identify this card.
|
276
|
+
options : Dict[str, Any], default {}
|
277
|
+
Options passed to the card. The contents depend on the card type.
|
278
|
+
timeout : int, default 45
|
279
|
+
Interrupt reporting if it takes more than this many seconds.
|
419
280
|
"""
|
420
281
|
...
|
421
282
|
|
422
283
|
@typing.overload
|
423
|
-
def
|
284
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
424
285
|
...
|
425
286
|
|
426
287
|
@typing.overload
|
427
|
-
def
|
288
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
428
289
|
...
|
429
290
|
|
430
|
-
def
|
291
|
+
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):
|
431
292
|
"""
|
432
|
-
|
293
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
433
294
|
|
295
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
434
296
|
|
435
297
|
|
436
298
|
Parameters
|
437
299
|
----------
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
447
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
448
|
-
|
449
|
-
temp_dir_root : str, default: None
|
450
|
-
The root directory under which `current.model.loaded` will store loaded models
|
300
|
+
type : str, default 'default'
|
301
|
+
Card type.
|
302
|
+
id : str, optional, default None
|
303
|
+
If multiple cards are present, use this id to identify this card.
|
304
|
+
options : Dict[str, Any], default {}
|
305
|
+
Options passed to the card. The contents depend on the card type.
|
306
|
+
timeout : int, default 45
|
307
|
+
Interrupt reporting if it takes more than this many seconds.
|
451
308
|
"""
|
452
309
|
...
|
453
310
|
|
454
|
-
|
311
|
+
@typing.overload
|
312
|
+
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]]]:
|
455
313
|
"""
|
456
|
-
Specifies that
|
314
|
+
Specifies that the step will success under all circumstances.
|
315
|
+
|
316
|
+
The decorator will create an optional artifact, specified by `var`, which
|
317
|
+
contains the exception raised. You can use it to detect the presence
|
318
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
319
|
+
are missing.
|
457
320
|
|
458
321
|
|
459
322
|
Parameters
|
460
323
|
----------
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
324
|
+
var : str, optional, default None
|
325
|
+
Name of the artifact in which to store the caught exception.
|
326
|
+
If not specified, the exception is not stored.
|
327
|
+
print_exception : bool, default True
|
328
|
+
Determines whether or not the exception is printed to
|
329
|
+
stdout when caught.
|
467
330
|
"""
|
468
331
|
...
|
469
332
|
|
470
|
-
|
471
|
-
|
472
|
-
|
333
|
+
@typing.overload
|
334
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
335
|
+
...
|
336
|
+
|
337
|
+
@typing.overload
|
338
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
339
|
+
...
|
340
|
+
|
341
|
+
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):
|
342
|
+
"""
|
343
|
+
Specifies that the step will success under all circumstances.
|
344
|
+
|
345
|
+
The decorator will create an optional artifact, specified by `var`, which
|
346
|
+
contains the exception raised. You can use it to detect the presence
|
347
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
348
|
+
are missing.
|
473
349
|
|
474
350
|
|
475
351
|
Parameters
|
476
352
|
----------
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
353
|
+
var : str, optional, default None
|
354
|
+
Name of the artifact in which to store the caught exception.
|
355
|
+
If not specified, the exception is not stored.
|
356
|
+
print_exception : bool, default True
|
357
|
+
Determines whether or not the exception is printed to
|
358
|
+
stdout when caught.
|
359
|
+
"""
|
360
|
+
...
|
361
|
+
|
362
|
+
@typing.overload
|
363
|
+
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]]]:
|
364
|
+
"""
|
365
|
+
Specifies a timeout for your step.
|
366
|
+
|
367
|
+
This decorator is useful if this step may hang indefinitely.
|
368
|
+
|
369
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
370
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
371
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
372
|
+
|
373
|
+
Note that all the values specified in parameters are added together so if you specify
|
374
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
375
|
+
|
376
|
+
|
377
|
+
Parameters
|
378
|
+
----------
|
379
|
+
seconds : int, default 0
|
380
|
+
Number of seconds to wait prior to timing out.
|
381
|
+
minutes : int, default 0
|
382
|
+
Number of minutes to wait prior to timing out.
|
383
|
+
hours : int, default 0
|
384
|
+
Number of hours to wait prior to timing out.
|
385
|
+
"""
|
386
|
+
...
|
387
|
+
|
388
|
+
@typing.overload
|
389
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
390
|
+
...
|
391
|
+
|
392
|
+
@typing.overload
|
393
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
394
|
+
...
|
395
|
+
|
396
|
+
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):
|
397
|
+
"""
|
398
|
+
Specifies a timeout for your step.
|
399
|
+
|
400
|
+
This decorator is useful if this step may hang indefinitely.
|
401
|
+
|
402
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
403
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
404
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
405
|
+
|
406
|
+
Note that all the values specified in parameters are added together so if you specify
|
407
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
408
|
+
|
409
|
+
|
410
|
+
Parameters
|
411
|
+
----------
|
412
|
+
seconds : int, default 0
|
413
|
+
Number of seconds to wait prior to timing out.
|
414
|
+
minutes : int, default 0
|
415
|
+
Number of minutes to wait prior to timing out.
|
416
|
+
hours : int, default 0
|
417
|
+
Number of hours to wait prior to timing out.
|
418
|
+
"""
|
419
|
+
...
|
420
|
+
|
421
|
+
@typing.overload
|
422
|
+
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]]]:
|
423
|
+
"""
|
424
|
+
Specifies the PyPI packages for the step.
|
425
|
+
|
426
|
+
Information in this decorator will augment any
|
427
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
428
|
+
you can use `@pypi_base` to set packages required by all
|
429
|
+
steps and use `@pypi` to specify step-specific overrides.
|
430
|
+
|
431
|
+
|
432
|
+
Parameters
|
433
|
+
----------
|
434
|
+
packages : Dict[str, str], default: {}
|
435
|
+
Packages to use for this step. The key is the name of the package
|
436
|
+
and the value is the version to use.
|
437
|
+
python : str, optional, default: None
|
438
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
439
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
440
|
+
"""
|
441
|
+
...
|
442
|
+
|
443
|
+
@typing.overload
|
444
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
445
|
+
...
|
446
|
+
|
447
|
+
@typing.overload
|
448
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
449
|
+
...
|
450
|
+
|
451
|
+
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):
|
452
|
+
"""
|
453
|
+
Specifies the PyPI packages for the step.
|
454
|
+
|
455
|
+
Information in this decorator will augment any
|
456
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
457
|
+
you can use `@pypi_base` to set packages required by all
|
458
|
+
steps and use `@pypi` to specify step-specific overrides.
|
459
|
+
|
460
|
+
|
461
|
+
Parameters
|
462
|
+
----------
|
463
|
+
packages : Dict[str, str], default: {}
|
464
|
+
Packages to use for this step. The key is the name of the package
|
465
|
+
and the value is the version to use.
|
466
|
+
python : str, optional, default: None
|
467
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
468
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
469
|
+
"""
|
470
|
+
...
|
471
|
+
|
472
|
+
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]]]:
|
473
|
+
"""
|
474
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
475
|
+
|
476
|
+
User code call
|
477
|
+
-----------
|
478
|
+
@nim(
|
479
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
480
|
+
backend='managed'
|
481
|
+
)
|
482
|
+
|
483
|
+
Valid backend options
|
484
|
+
---------------------
|
485
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
486
|
+
|
487
|
+
Valid model options
|
488
|
+
----------------
|
489
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
490
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
491
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
492
|
+
|
493
|
+
|
494
|
+
Parameters
|
495
|
+
----------
|
496
|
+
models: list[NIM]
|
497
|
+
List of NIM containers running models in sidecars.
|
498
|
+
backend: str
|
499
|
+
Compute provider to run the NIM container.
|
500
|
+
queue_timeout : int
|
501
|
+
Time to keep the job in NVCF's queue.
|
481
502
|
"""
|
482
503
|
...
|
483
504
|
|
@@ -561,178 +582,81 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
561
582
|
...
|
562
583
|
|
563
584
|
@typing.overload
|
564
|
-
def
|
565
|
-
"""
|
566
|
-
Decorator prototype for all step decorators. This function gets specialized
|
567
|
-
and imported for all decorators types by _import_plugin_decorators().
|
568
|
-
"""
|
569
|
-
...
|
570
|
-
|
571
|
-
@typing.overload
|
572
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
573
|
-
...
|
574
|
-
|
575
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
576
|
-
"""
|
577
|
-
Decorator prototype for all step decorators. This function gets specialized
|
578
|
-
and imported for all decorators types by _import_plugin_decorators().
|
579
|
-
"""
|
580
|
-
...
|
581
|
-
|
582
|
-
@typing.overload
|
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]]]:
|
585
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
584
586
|
"""
|
585
|
-
|
586
|
-
to a step needs to be retried.
|
587
|
-
|
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.
|
595
|
-
|
596
|
-
|
597
|
-
Parameters
|
598
|
-
----------
|
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.
|
587
|
+
Internal decorator to support Fast bakery
|
603
588
|
"""
|
604
589
|
...
|
605
590
|
|
606
591
|
@typing.overload
|
607
|
-
def
|
608
|
-
...
|
609
|
-
|
610
|
-
@typing.overload
|
611
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
592
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
612
593
|
...
|
613
594
|
|
614
|
-
def
|
595
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
615
596
|
"""
|
616
|
-
|
617
|
-
to a step needs to be retried.
|
618
|
-
|
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.
|
626
|
-
|
627
|
-
|
628
|
-
Parameters
|
629
|
-
----------
|
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.
|
597
|
+
Internal decorator to support Fast bakery
|
634
598
|
"""
|
635
599
|
...
|
636
600
|
|
637
601
|
@typing.overload
|
638
|
-
def
|
602
|
+
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]]]:
|
639
603
|
"""
|
640
|
-
Specifies
|
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.
|
604
|
+
Specifies environment variables to be set prior to the execution of a step.
|
646
605
|
|
647
606
|
|
648
607
|
Parameters
|
649
608
|
----------
|
650
|
-
|
651
|
-
|
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.
|
609
|
+
vars : Dict[str, str], default {}
|
610
|
+
Dictionary of environment variables to set.
|
656
611
|
"""
|
657
612
|
...
|
658
613
|
|
659
614
|
@typing.overload
|
660
|
-
def
|
615
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
661
616
|
...
|
662
617
|
|
663
618
|
@typing.overload
|
664
|
-
def
|
619
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
665
620
|
...
|
666
621
|
|
667
|
-
def
|
622
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
668
623
|
"""
|
669
|
-
Specifies
|
670
|
-
|
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.
|
624
|
+
Specifies environment variables to be set prior to the execution of a step.
|
675
625
|
|
676
626
|
|
677
627
|
Parameters
|
678
628
|
----------
|
679
|
-
|
680
|
-
|
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.
|
629
|
+
vars : Dict[str, str], default {}
|
630
|
+
Dictionary of environment variables to set.
|
685
631
|
"""
|
686
632
|
...
|
687
633
|
|
688
|
-
|
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]]]:
|
634
|
+
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]]]:
|
690
635
|
"""
|
691
|
-
Specifies that
|
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.
|
636
|
+
Specifies that this step is used to deploy an instance of the app.
|
637
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
697
638
|
|
698
639
|
|
699
640
|
Parameters
|
700
641
|
----------
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
Determines whether or not the exception is printed to
|
706
|
-
stdout when caught.
|
642
|
+
app_port : int
|
643
|
+
Number of GPUs to use.
|
644
|
+
app_name : str
|
645
|
+
Name of the app to deploy.
|
707
646
|
"""
|
708
647
|
...
|
709
648
|
|
710
|
-
|
711
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
712
|
-
...
|
713
|
-
|
714
|
-
@typing.overload
|
715
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
716
|
-
...
|
717
|
-
|
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):
|
649
|
+
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]]]:
|
719
650
|
"""
|
720
|
-
Specifies that
|
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.
|
651
|
+
Specifies that this step should execute on DGX cloud.
|
726
652
|
|
727
653
|
|
728
654
|
Parameters
|
729
655
|
----------
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
Determines whether or not the exception is printed to
|
735
|
-
stdout when caught.
|
656
|
+
gpu : int
|
657
|
+
Number of GPUs to use.
|
658
|
+
gpu_type : str
|
659
|
+
Type of Nvidia GPU to use.
|
736
660
|
"""
|
737
661
|
...
|
738
662
|
|
@@ -762,128 +686,253 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
|
|
762
686
|
...
|
763
687
|
|
764
688
|
@typing.overload
|
765
|
-
def
|
689
|
+
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]]]:
|
766
690
|
"""
|
767
|
-
|
768
|
-
|
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.
|
691
|
+
Enables loading / saving of models within a step.
|
774
692
|
|
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.
|
777
693
|
|
778
694
|
|
779
695
|
Parameters
|
780
696
|
----------
|
781
|
-
|
782
|
-
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
697
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
698
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
699
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
700
|
+
- `current.checkpoint`
|
701
|
+
- `current.model`
|
702
|
+
- `current.huggingface_hub`
|
703
|
+
|
704
|
+
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
|
705
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
706
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
707
|
+
|
708
|
+
temp_dir_root : str, default: None
|
709
|
+
The root directory under which `current.model.loaded` will store loaded models
|
787
710
|
"""
|
788
711
|
...
|
789
712
|
|
790
713
|
@typing.overload
|
791
|
-
def
|
714
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
792
715
|
...
|
793
716
|
|
794
717
|
@typing.overload
|
795
|
-
def
|
718
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
796
719
|
...
|
797
720
|
|
798
|
-
def
|
721
|
+
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):
|
799
722
|
"""
|
800
|
-
|
723
|
+
Enables loading / saving of models within a step.
|
801
724
|
|
802
|
-
This decorator is useful if this step may hang indefinitely.
|
803
725
|
|
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
726
|
|
808
|
-
|
809
|
-
|
727
|
+
Parameters
|
728
|
+
----------
|
729
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
730
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
731
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
732
|
+
- `current.checkpoint`
|
733
|
+
- `current.model`
|
734
|
+
- `current.huggingface_hub`
|
735
|
+
|
736
|
+
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
|
737
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
738
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
739
|
+
|
740
|
+
temp_dir_root : str, default: None
|
741
|
+
The root directory under which `current.model.loaded` will store loaded models
|
742
|
+
"""
|
743
|
+
...
|
744
|
+
|
745
|
+
@typing.overload
|
746
|
+
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]]]:
|
747
|
+
"""
|
748
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
749
|
+
the execution of a step.
|
810
750
|
|
811
751
|
|
812
752
|
Parameters
|
813
753
|
----------
|
814
|
-
|
815
|
-
|
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.
|
754
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
755
|
+
List of secret specs, defining how the secrets are to be retrieved
|
820
756
|
"""
|
821
757
|
...
|
822
758
|
|
823
|
-
|
759
|
+
@typing.overload
|
760
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
761
|
+
...
|
762
|
+
|
763
|
+
@typing.overload
|
764
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
765
|
+
...
|
766
|
+
|
767
|
+
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]]] = []):
|
824
768
|
"""
|
825
|
-
Specifies
|
826
|
-
|
769
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
770
|
+
the execution of a step.
|
827
771
|
|
828
772
|
|
829
773
|
Parameters
|
830
774
|
----------
|
831
|
-
|
832
|
-
|
833
|
-
|
834
|
-
|
775
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
776
|
+
List of secret specs, defining how the secrets are to be retrieved
|
777
|
+
"""
|
778
|
+
...
|
779
|
+
|
780
|
+
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]]]:
|
781
|
+
"""
|
782
|
+
Specifies that this step should execute on Kubernetes.
|
783
|
+
|
784
|
+
|
785
|
+
Parameters
|
786
|
+
----------
|
787
|
+
cpu : int, default 1
|
788
|
+
Number of CPUs required for this step. If `@resources` is
|
789
|
+
also present, the maximum value from all decorators is used.
|
790
|
+
memory : int, default 4096
|
791
|
+
Memory size (in MB) required for this step. If
|
792
|
+
`@resources` is also present, the maximum value from all decorators is
|
793
|
+
used.
|
794
|
+
disk : int, default 10240
|
795
|
+
Disk size (in MB) required for this step. If
|
796
|
+
`@resources` is also present, the maximum value from all decorators is
|
797
|
+
used.
|
798
|
+
image : str, optional, default None
|
799
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
800
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
801
|
+
not, a default Docker image mapping to the current version of Python is used.
|
802
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
803
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
804
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
805
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
806
|
+
secrets : List[str], optional, default None
|
807
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
808
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
809
|
+
in Metaflow configuration.
|
810
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
811
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
812
|
+
Can be passed in as a comma separated string of values e.g.
|
813
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
814
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
815
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
816
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
817
|
+
gpu : int, optional, default None
|
818
|
+
Number of GPUs required for this step. A value of zero implies that
|
819
|
+
the scheduled node should not have GPUs.
|
820
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
821
|
+
The vendor of the GPUs to be used for this step.
|
822
|
+
tolerations : List[str], default []
|
823
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
824
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
825
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
826
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
827
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
828
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
829
|
+
use_tmpfs : bool, default False
|
830
|
+
This enables an explicit tmpfs mount for this step.
|
831
|
+
tmpfs_tempdir : bool, default True
|
832
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
833
|
+
tmpfs_size : int, optional, default: None
|
834
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
835
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
836
|
+
memory allocated for this step.
|
837
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
838
|
+
Path to tmpfs mount for this step.
|
839
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
840
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
841
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
842
|
+
shared_memory: int, optional
|
843
|
+
Shared memory size (in MiB) required for this step
|
844
|
+
port: int, optional
|
845
|
+
Port number to specify in the Kubernetes job object
|
846
|
+
compute_pool : str, optional, default None
|
847
|
+
Compute pool to be used for for this step.
|
848
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
849
|
+
hostname_resolution_timeout: int, default 10 * 60
|
850
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
851
|
+
Only applicable when @parallel is used.
|
852
|
+
qos: str, default: Burstable
|
853
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
854
|
+
|
855
|
+
security_context: Dict[str, Any], optional, default None
|
856
|
+
Container security context. Applies to the task container. Allows the following keys:
|
857
|
+
- privileged: bool, optional, default None
|
858
|
+
- allow_privilege_escalation: bool, optional, default None
|
859
|
+
- run_as_user: int, optional, default None
|
860
|
+
- run_as_group: int, optional, default None
|
861
|
+
- run_as_non_root: bool, optional, default None
|
835
862
|
"""
|
836
863
|
...
|
837
864
|
|
838
865
|
@typing.overload
|
839
|
-
def
|
866
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
840
867
|
"""
|
841
|
-
|
868
|
+
Decorator prototype for all step decorators. This function gets specialized
|
869
|
+
and imported for all decorators types by _import_plugin_decorators().
|
842
870
|
"""
|
843
871
|
...
|
844
872
|
|
845
873
|
@typing.overload
|
846
|
-
def
|
874
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
847
875
|
...
|
848
876
|
|
849
|
-
def
|
877
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
850
878
|
"""
|
851
|
-
|
879
|
+
Decorator prototype for all step decorators. This function gets specialized
|
880
|
+
and imported for all decorators types by _import_plugin_decorators().
|
852
881
|
"""
|
853
882
|
...
|
854
883
|
|
855
884
|
@typing.overload
|
856
|
-
def
|
885
|
+
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]]]:
|
857
886
|
"""
|
858
|
-
Specifies
|
859
|
-
|
887
|
+
Specifies the number of times the task corresponding
|
888
|
+
to a step needs to be retried.
|
889
|
+
|
890
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
891
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
892
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
893
|
+
|
894
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
895
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
896
|
+
ensuring that the flow execution can continue.
|
860
897
|
|
861
898
|
|
862
899
|
Parameters
|
863
900
|
----------
|
864
|
-
|
865
|
-
|
901
|
+
times : int, default 3
|
902
|
+
Number of times to retry this task.
|
903
|
+
minutes_between_retries : int, default 2
|
904
|
+
Number of minutes between retries.
|
866
905
|
"""
|
867
906
|
...
|
868
907
|
|
869
908
|
@typing.overload
|
870
|
-
def
|
909
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
871
910
|
...
|
872
911
|
|
873
912
|
@typing.overload
|
874
|
-
def
|
913
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
875
914
|
...
|
876
915
|
|
877
|
-
def
|
916
|
+
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):
|
878
917
|
"""
|
879
|
-
Specifies
|
880
|
-
|
918
|
+
Specifies the number of times the task corresponding
|
919
|
+
to a step needs to be retried.
|
920
|
+
|
921
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
922
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
923
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
924
|
+
|
925
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
926
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
927
|
+
ensuring that the flow execution can continue.
|
881
928
|
|
882
929
|
|
883
930
|
Parameters
|
884
931
|
----------
|
885
|
-
|
886
|
-
|
932
|
+
times : int, default 3
|
933
|
+
Number of times to retry this task.
|
934
|
+
minutes_between_retries : int, default 2
|
935
|
+
Number of minutes between retries.
|
887
936
|
"""
|
888
937
|
...
|
889
938
|
|
@@ -947,92 +996,138 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
947
996
|
...
|
948
997
|
|
949
998
|
@typing.overload
|
950
|
-
def
|
999
|
+
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
951
1000
|
"""
|
952
|
-
|
1001
|
+
Specifies the event(s) that this flow depends on.
|
953
1002
|
|
954
|
-
|
1003
|
+
```
|
1004
|
+
@trigger(event='foo')
|
1005
|
+
```
|
1006
|
+
or
|
1007
|
+
```
|
1008
|
+
@trigger(events=['foo', 'bar'])
|
1009
|
+
```
|
1010
|
+
|
1011
|
+
Additionally, you can specify the parameter mappings
|
1012
|
+
to map event payload to Metaflow parameters for the flow.
|
1013
|
+
```
|
1014
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1015
|
+
```
|
1016
|
+
or
|
1017
|
+
```
|
1018
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1019
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1020
|
+
```
|
1021
|
+
|
1022
|
+
'parameters' can also be a list of strings and tuples like so:
|
1023
|
+
```
|
1024
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1025
|
+
```
|
1026
|
+
This is equivalent to:
|
1027
|
+
```
|
1028
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1029
|
+
```
|
955
1030
|
|
956
1031
|
|
957
1032
|
Parameters
|
958
1033
|
----------
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
1034
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1035
|
+
Event dependency for this flow.
|
1036
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1037
|
+
Events dependency for this flow.
|
963
1038
|
options : Dict[str, Any], default {}
|
964
|
-
|
965
|
-
timeout : int, default 45
|
966
|
-
Interrupt reporting if it takes more than this many seconds.
|
1039
|
+
Backend-specific configuration for tuning eventing behavior.
|
967
1040
|
"""
|
968
1041
|
...
|
969
1042
|
|
970
1043
|
@typing.overload
|
971
|
-
def
|
972
|
-
...
|
973
|
-
|
974
|
-
@typing.overload
|
975
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1044
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
976
1045
|
...
|
977
1046
|
|
978
|
-
def
|
1047
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
979
1048
|
"""
|
980
|
-
|
1049
|
+
Specifies the event(s) that this flow depends on.
|
981
1050
|
|
982
|
-
|
1051
|
+
```
|
1052
|
+
@trigger(event='foo')
|
1053
|
+
```
|
1054
|
+
or
|
1055
|
+
```
|
1056
|
+
@trigger(events=['foo', 'bar'])
|
1057
|
+
```
|
983
1058
|
|
1059
|
+
Additionally, you can specify the parameter mappings
|
1060
|
+
to map event payload to Metaflow parameters for the flow.
|
1061
|
+
```
|
1062
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1063
|
+
```
|
1064
|
+
or
|
1065
|
+
```
|
1066
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1067
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1068
|
+
```
|
984
1069
|
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
timeout : int, default 45
|
994
|
-
Interrupt reporting if it takes more than this many seconds.
|
995
|
-
"""
|
996
|
-
...
|
997
|
-
|
998
|
-
@typing.overload
|
999
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1000
|
-
"""
|
1001
|
-
Specifies the PyPI packages for all steps of the flow.
|
1070
|
+
'parameters' can also be a list of strings and tuples like so:
|
1071
|
+
```
|
1072
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1073
|
+
```
|
1074
|
+
This is equivalent to:
|
1075
|
+
```
|
1076
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1077
|
+
```
|
1002
1078
|
|
1003
|
-
Use `@pypi_base` to set common packages required by all
|
1004
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1005
1079
|
|
1006
1080
|
Parameters
|
1007
1081
|
----------
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1082
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1083
|
+
Event dependency for this flow.
|
1084
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1085
|
+
Events dependency for this flow.
|
1086
|
+
options : Dict[str, Any], default {}
|
1087
|
+
Backend-specific configuration for tuning eventing behavior.
|
1014
1088
|
"""
|
1015
1089
|
...
|
1016
1090
|
|
1017
|
-
|
1018
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1019
|
-
...
|
1020
|
-
|
1021
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1091
|
+
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]]:
|
1022
1092
|
"""
|
1023
|
-
|
1093
|
+
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.
|
1094
|
+
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.
|
1024
1095
|
|
1025
|
-
Use `@pypi_base` to set common packages required by all
|
1026
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1027
1096
|
|
1028
1097
|
Parameters
|
1029
1098
|
----------
|
1030
|
-
|
1031
|
-
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
1035
|
-
|
1099
|
+
timeout : int
|
1100
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1101
|
+
poke_interval : int
|
1102
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1103
|
+
mode : str
|
1104
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1105
|
+
exponential_backoff : bool
|
1106
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1107
|
+
pool : str
|
1108
|
+
the slot pool this task should run in,
|
1109
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1110
|
+
soft_fail : bool
|
1111
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1112
|
+
name : str
|
1113
|
+
Name of the sensor on Airflow
|
1114
|
+
description : str
|
1115
|
+
Description of sensor in the Airflow UI
|
1116
|
+
external_dag_id : str
|
1117
|
+
The dag_id that contains the task you want to wait for.
|
1118
|
+
external_task_ids : List[str]
|
1119
|
+
The list of task_ids that you want to wait for.
|
1120
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1121
|
+
allowed_states : List[str]
|
1122
|
+
Iterable of allowed states, (Default: ['success'])
|
1123
|
+
failed_states : List[str]
|
1124
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1125
|
+
execution_delta : datetime.timedelta
|
1126
|
+
time difference with the previous execution to look at,
|
1127
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1128
|
+
check_existence: bool
|
1129
|
+
Set to True to check if the external task exists or check if
|
1130
|
+
the DAG to wait for exists. (Default: True)
|
1036
1131
|
"""
|
1037
1132
|
...
|
1038
1133
|
|
@@ -1087,38 +1182,46 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1087
1182
|
"""
|
1088
1183
|
...
|
1089
1184
|
|
1090
|
-
def
|
1185
|
+
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1091
1186
|
"""
|
1092
|
-
|
1093
|
-
|
1094
|
-
|
1095
|
-
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1187
|
+
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1188
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1189
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1190
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1191
|
+
starts only after all sensors finish.
|
1192
|
+
|
1193
|
+
|
1194
|
+
Parameters
|
1195
|
+
----------
|
1196
|
+
timeout : int
|
1197
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1198
|
+
poke_interval : int
|
1199
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1200
|
+
mode : str
|
1201
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1202
|
+
exponential_backoff : bool
|
1203
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1204
|
+
pool : str
|
1205
|
+
the slot pool this task should run in,
|
1206
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1207
|
+
soft_fail : bool
|
1208
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1209
|
+
name : str
|
1210
|
+
Name of the sensor on Airflow
|
1211
|
+
description : str
|
1212
|
+
Description of sensor in the Airflow UI
|
1213
|
+
bucket_key : Union[str, List[str]]
|
1214
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1215
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1216
|
+
bucket_name : str
|
1217
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1218
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1219
|
+
wildcard_match : bool
|
1220
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1221
|
+
aws_conn_id : str
|
1222
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1223
|
+
verify : bool
|
1224
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1122
1225
|
"""
|
1123
1226
|
...
|
1124
1227
|
|
@@ -1274,99 +1377,6 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1274
1377
|
"""
|
1275
1378
|
...
|
1276
1379
|
|
1277
|
-
@typing.overload
|
1278
|
-
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1279
|
-
"""
|
1280
|
-
Specifies the event(s) that this flow depends on.
|
1281
|
-
|
1282
|
-
```
|
1283
|
-
@trigger(event='foo')
|
1284
|
-
```
|
1285
|
-
or
|
1286
|
-
```
|
1287
|
-
@trigger(events=['foo', 'bar'])
|
1288
|
-
```
|
1289
|
-
|
1290
|
-
Additionally, you can specify the parameter mappings
|
1291
|
-
to map event payload to Metaflow parameters for the flow.
|
1292
|
-
```
|
1293
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1294
|
-
```
|
1295
|
-
or
|
1296
|
-
```
|
1297
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1298
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1299
|
-
```
|
1300
|
-
|
1301
|
-
'parameters' can also be a list of strings and tuples like so:
|
1302
|
-
```
|
1303
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1304
|
-
```
|
1305
|
-
This is equivalent to:
|
1306
|
-
```
|
1307
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1308
|
-
```
|
1309
|
-
|
1310
|
-
|
1311
|
-
Parameters
|
1312
|
-
----------
|
1313
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1314
|
-
Event dependency for this flow.
|
1315
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1316
|
-
Events dependency for this flow.
|
1317
|
-
options : Dict[str, Any], default {}
|
1318
|
-
Backend-specific configuration for tuning eventing behavior.
|
1319
|
-
"""
|
1320
|
-
...
|
1321
|
-
|
1322
|
-
@typing.overload
|
1323
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1324
|
-
...
|
1325
|
-
|
1326
|
-
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1327
|
-
"""
|
1328
|
-
Specifies the event(s) that this flow depends on.
|
1329
|
-
|
1330
|
-
```
|
1331
|
-
@trigger(event='foo')
|
1332
|
-
```
|
1333
|
-
or
|
1334
|
-
```
|
1335
|
-
@trigger(events=['foo', 'bar'])
|
1336
|
-
```
|
1337
|
-
|
1338
|
-
Additionally, you can specify the parameter mappings
|
1339
|
-
to map event payload to Metaflow parameters for the flow.
|
1340
|
-
```
|
1341
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1342
|
-
```
|
1343
|
-
or
|
1344
|
-
```
|
1345
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1346
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1347
|
-
```
|
1348
|
-
|
1349
|
-
'parameters' can also be a list of strings and tuples like so:
|
1350
|
-
```
|
1351
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1352
|
-
```
|
1353
|
-
This is equivalent to:
|
1354
|
-
```
|
1355
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1356
|
-
```
|
1357
|
-
|
1358
|
-
|
1359
|
-
Parameters
|
1360
|
-
----------
|
1361
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1362
|
-
Event dependency for this flow.
|
1363
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1364
|
-
Events dependency for this flow.
|
1365
|
-
options : Dict[str, Any], default {}
|
1366
|
-
Backend-specific configuration for tuning eventing behavior.
|
1367
|
-
"""
|
1368
|
-
...
|
1369
|
-
|
1370
1380
|
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
1371
1381
|
"""
|
1372
1382
|
Allows setting external datastores to save data for the
|
@@ -1481,89 +1491,79 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1481
1491
|
"""
|
1482
1492
|
...
|
1483
1493
|
|
1484
|
-
|
1494
|
+
@typing.overload
|
1495
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1485
1496
|
"""
|
1486
|
-
|
1487
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1488
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1489
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1490
|
-
starts only after all sensors finish.
|
1497
|
+
Specifies the PyPI packages for all steps of the flow.
|
1491
1498
|
|
1499
|
+
Use `@pypi_base` to set common packages required by all
|
1500
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1492
1501
|
|
1493
1502
|
Parameters
|
1494
1503
|
----------
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
exponential_backoff : bool
|
1502
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1503
|
-
pool : str
|
1504
|
-
the slot pool this task should run in,
|
1505
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1506
|
-
soft_fail : bool
|
1507
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1508
|
-
name : str
|
1509
|
-
Name of the sensor on Airflow
|
1510
|
-
description : str
|
1511
|
-
Description of sensor in the Airflow UI
|
1512
|
-
bucket_key : Union[str, List[str]]
|
1513
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1514
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1515
|
-
bucket_name : str
|
1516
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1517
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1518
|
-
wildcard_match : bool
|
1519
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1520
|
-
aws_conn_id : str
|
1521
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1522
|
-
verify : bool
|
1523
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1504
|
+
packages : Dict[str, str], default: {}
|
1505
|
+
Packages to use for this flow. The key is the name of the package
|
1506
|
+
and the value is the version to use.
|
1507
|
+
python : str, optional, default: None
|
1508
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1509
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1524
1510
|
"""
|
1525
1511
|
...
|
1526
1512
|
|
1527
|
-
|
1513
|
+
@typing.overload
|
1514
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1515
|
+
...
|
1516
|
+
|
1517
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1528
1518
|
"""
|
1529
|
-
|
1530
|
-
|
1519
|
+
Specifies the PyPI packages for all steps of the flow.
|
1520
|
+
|
1521
|
+
Use `@pypi_base` to set common packages required by all
|
1522
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1523
|
+
|
1524
|
+
Parameters
|
1525
|
+
----------
|
1526
|
+
packages : Dict[str, str], default: {}
|
1527
|
+
Packages to use for this flow. The key is the name of the package
|
1528
|
+
and the value is the version to use.
|
1529
|
+
python : str, optional, default: None
|
1530
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1531
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1532
|
+
"""
|
1533
|
+
...
|
1534
|
+
|
1535
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1536
|
+
"""
|
1537
|
+
Specifies what flows belong to the same project.
|
1538
|
+
|
1539
|
+
A project-specific namespace is created for all flows that
|
1540
|
+
use the same `@project(name)`.
|
1531
1541
|
|
1532
1542
|
|
1533
1543
|
Parameters
|
1534
1544
|
----------
|
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
1545
|
name : str
|
1549
|
-
|
1550
|
-
|
1551
|
-
|
1552
|
-
|
1553
|
-
|
1554
|
-
|
1555
|
-
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1546
|
+
Project name. Make sure that the name is unique amongst all
|
1547
|
+
projects that use the same production scheduler. The name may
|
1548
|
+
contain only lowercase alphanumeric characters and underscores.
|
1549
|
+
|
1550
|
+
branch : Optional[str], default None
|
1551
|
+
The branch to use. If not specified, the branch is set to
|
1552
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1553
|
+
also be set on the command line using `--branch` as a top-level option.
|
1554
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1555
|
+
|
1556
|
+
production : bool, default False
|
1557
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1558
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1559
|
+
`production` in the decorator and on the command line.
|
1560
|
+
The project branch name will be:
|
1561
|
+
- if `branch` is specified:
|
1562
|
+
- if `production` is True: `prod.<branch>`
|
1563
|
+
- if `production` is False: `test.<branch>`
|
1564
|
+
- if `branch` is not specified:
|
1565
|
+
- if `production` is True: `prod`
|
1566
|
+
- if `production` is False: `user.<username>`
|
1567
1567
|
"""
|
1568
1568
|
...
|
1569
1569
|
|