ob-metaflow-stubs 6.0.3.174__py2.py3-none-any.whl → 6.0.3.175rc0__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 +641 -640
- 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 +1 -1
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +2 -2
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +144 -144
- 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 +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- 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 +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +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 +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +51 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +65 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +74 -0
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- metaflow-stubs/ob_internal.pyi +11 -0
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +9 -9
- 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 +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +1 -1
- 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 +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +1 -1
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +1 -1
- metaflow-stubs/plugins/azure/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/cards/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_datastore.pyi +1 -1
- metaflow-stubs/plugins/cards/card_decorator.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +1 -1
- metaflow-stubs/plugins/cards/card_resolver.pyi +1 -1
- metaflow-stubs/plugins/cards/component_serializer.pyi +1 -1
- metaflow-stubs/plugins/cards/exception.pyi +1 -1
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- 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 +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- 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 +1 -1
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/torchtune/__init__.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 +30 -30
- metaflow-stubs/runner/deployer_impl.pyi +1 -1
- 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 +3 -3
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +4 -4
- {ob_metaflow_stubs-6.0.3.174.dist-info → ob_metaflow_stubs-6.0.3.175rc0.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.175rc0.dist-info/RECORD +216 -0
- ob_metaflow_stubs-6.0.3.174.dist-info/RECORD +0 -211
- {ob_metaflow_stubs-6.0.3.174.dist-info → ob_metaflow_stubs-6.0.3.175rc0.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.174.dist-info → ob_metaflow_stubs-6.0.3.175rc0.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
3
|
# MF version: 2.15.14.1+obcheckpoint(0.2.1);ob(v1) #
|
4
|
-
# Generated on 2025-05-
|
4
|
+
# Generated on 2025-05-30T00:54:07.424022 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -35,18 +35,18 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
|
-
from . import tuple_util as tuple_util
|
39
38
|
from . import cards as cards
|
40
39
|
from . import metaflow_git as metaflow_git
|
40
|
+
from . import tuple_util as tuple_util
|
41
41
|
from . import events as events
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
-
from .plugins.pypi.parsers import 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
|
@@ -77,6 +77,7 @@ from . import system as system
|
|
77
77
|
from . import pylint_wrapper as pylint_wrapper
|
78
78
|
from . import cli as cli
|
79
79
|
from . import profilers as profilers
|
80
|
+
from . import ob_internal as ob_internal
|
80
81
|
|
81
82
|
EXT_PKG: str
|
82
83
|
|
@@ -154,140 +155,104 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
154
155
|
...
|
155
156
|
|
156
157
|
@typing.overload
|
157
|
-
def
|
158
|
+
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]]]:
|
158
159
|
"""
|
159
|
-
Specifies the
|
160
|
-
|
161
|
-
Use `@resources` to specify the resource requirements
|
162
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
160
|
+
Specifies the PyPI packages for the step.
|
163
161
|
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
or
|
169
|
-
```
|
170
|
-
python myflow.py run --with kubernetes
|
171
|
-
```
|
172
|
-
which executes the flow on the desired system using the
|
173
|
-
requirements specified in `@resources`.
|
162
|
+
Information in this decorator will augment any
|
163
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
164
|
+
you can use `@pypi_base` to set packages required by all
|
165
|
+
steps and use `@pypi` to specify step-specific overrides.
|
174
166
|
|
175
167
|
|
176
168
|
Parameters
|
177
169
|
----------
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
memory : int, default 4096
|
185
|
-
Memory size (in MB) required for this step.
|
186
|
-
shared_memory : int, optional, default None
|
187
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
188
|
-
This parameter maps to the `--shm-size` option in Docker.
|
170
|
+
packages : Dict[str, str], default: {}
|
171
|
+
Packages to use for this step. The key is the name of the package
|
172
|
+
and the value is the version to use.
|
173
|
+
python : str, optional, default: None
|
174
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
175
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
189
176
|
"""
|
190
177
|
...
|
191
178
|
|
192
179
|
@typing.overload
|
193
|
-
def
|
180
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
194
181
|
...
|
195
182
|
|
196
183
|
@typing.overload
|
197
|
-
def
|
184
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
198
185
|
...
|
199
186
|
|
200
|
-
def
|
187
|
+
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):
|
201
188
|
"""
|
202
|
-
Specifies the
|
203
|
-
|
204
|
-
Use `@resources` to specify the resource requirements
|
205
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
189
|
+
Specifies the PyPI packages for the step.
|
206
190
|
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
or
|
212
|
-
```
|
213
|
-
python myflow.py run --with kubernetes
|
214
|
-
```
|
215
|
-
which executes the flow on the desired system using the
|
216
|
-
requirements specified in `@resources`.
|
191
|
+
Information in this decorator will augment any
|
192
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
193
|
+
you can use `@pypi_base` to set packages required by all
|
194
|
+
steps and use `@pypi` to specify step-specific overrides.
|
217
195
|
|
218
196
|
|
219
197
|
Parameters
|
220
198
|
----------
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
memory : int, default 4096
|
228
|
-
Memory size (in MB) required for this step.
|
229
|
-
shared_memory : int, optional, default None
|
230
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
231
|
-
This parameter maps to the `--shm-size` option in Docker.
|
199
|
+
packages : Dict[str, str], default: {}
|
200
|
+
Packages to use for this step. The key is the name of the package
|
201
|
+
and the value is the version to use.
|
202
|
+
python : str, optional, default: None
|
203
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
204
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
232
205
|
"""
|
233
206
|
...
|
234
207
|
|
235
208
|
@typing.overload
|
236
|
-
def
|
209
|
+
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]]]:
|
237
210
|
"""
|
238
|
-
Specifies
|
239
|
-
|
240
|
-
This decorator is useful if this step may hang indefinitely.
|
241
|
-
|
242
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
243
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
244
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
211
|
+
Specifies that the step will success under all circumstances.
|
245
212
|
|
246
|
-
|
247
|
-
|
213
|
+
The decorator will create an optional artifact, specified by `var`, which
|
214
|
+
contains the exception raised. You can use it to detect the presence
|
215
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
216
|
+
are missing.
|
248
217
|
|
249
218
|
|
250
219
|
Parameters
|
251
220
|
----------
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
221
|
+
var : str, optional, default None
|
222
|
+
Name of the artifact in which to store the caught exception.
|
223
|
+
If not specified, the exception is not stored.
|
224
|
+
print_exception : bool, default True
|
225
|
+
Determines whether or not the exception is printed to
|
226
|
+
stdout when caught.
|
258
227
|
"""
|
259
228
|
...
|
260
229
|
|
261
230
|
@typing.overload
|
262
|
-
def
|
231
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
263
232
|
...
|
264
233
|
|
265
234
|
@typing.overload
|
266
|
-
def
|
235
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
267
236
|
...
|
268
237
|
|
269
|
-
def
|
238
|
+
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):
|
270
239
|
"""
|
271
|
-
Specifies
|
272
|
-
|
273
|
-
This decorator is useful if this step may hang indefinitely.
|
274
|
-
|
275
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
276
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
277
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
240
|
+
Specifies that the step will success under all circumstances.
|
278
241
|
|
279
|
-
|
280
|
-
|
242
|
+
The decorator will create an optional artifact, specified by `var`, which
|
243
|
+
contains the exception raised. You can use it to detect the presence
|
244
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
245
|
+
are missing.
|
281
246
|
|
282
247
|
|
283
248
|
Parameters
|
284
249
|
----------
|
285
|
-
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
250
|
+
var : str, optional, default None
|
251
|
+
Name of the artifact in which to store the caught exception.
|
252
|
+
If not specified, the exception is not stored.
|
253
|
+
print_exception : bool, default True
|
254
|
+
Determines whether or not the exception is printed to
|
255
|
+
stdout when caught.
|
291
256
|
"""
|
292
257
|
...
|
293
258
|
|
@@ -328,116 +293,145 @@ def ollama(*, models: list, backend: str, force_pull: bool, skip_push_check: boo
|
|
328
293
|
"""
|
329
294
|
...
|
330
295
|
|
331
|
-
def
|
296
|
+
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]]]:
|
332
297
|
"""
|
333
|
-
|
298
|
+
Specifies that this step should execute on Kubernetes.
|
334
299
|
|
335
300
|
|
336
301
|
Parameters
|
337
302
|
----------
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
303
|
+
cpu : int, default 1
|
304
|
+
Number of CPUs required for this step. If `@resources` is
|
305
|
+
also present, the maximum value from all decorators is used.
|
306
|
+
memory : int, default 4096
|
307
|
+
Memory size (in MB) required for this step. If
|
308
|
+
`@resources` is also present, the maximum value from all decorators is
|
309
|
+
used.
|
310
|
+
disk : int, default 10240
|
311
|
+
Disk size (in MB) required for this step. If
|
312
|
+
`@resources` is also present, the maximum value from all decorators is
|
313
|
+
used.
|
314
|
+
image : str, optional, default None
|
315
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
316
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
317
|
+
not, a default Docker image mapping to the current version of Python is used.
|
318
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
319
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
320
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
321
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
322
|
+
secrets : List[str], optional, default None
|
323
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
324
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
325
|
+
in Metaflow configuration.
|
326
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
327
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
328
|
+
Can be passed in as a comma separated string of values e.g.
|
329
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
330
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
331
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
332
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
333
|
+
gpu : int, optional, default None
|
334
|
+
Number of GPUs required for this step. A value of zero implies that
|
335
|
+
the scheduled node should not have GPUs.
|
336
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
337
|
+
The vendor of the GPUs to be used for this step.
|
338
|
+
tolerations : List[str], default []
|
339
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
340
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
341
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
342
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
343
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
344
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
345
|
+
use_tmpfs : bool, default False
|
346
|
+
This enables an explicit tmpfs mount for this step.
|
347
|
+
tmpfs_tempdir : bool, default True
|
348
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
349
|
+
tmpfs_size : int, optional, default: None
|
350
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
351
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
352
|
+
memory allocated for this step.
|
353
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
354
|
+
Path to tmpfs mount for this step.
|
355
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
356
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
357
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
358
|
+
shared_memory: int, optional
|
359
|
+
Shared memory size (in MiB) required for this step
|
360
|
+
port: int, optional
|
361
|
+
Port number to specify in the Kubernetes job object
|
362
|
+
compute_pool : str, optional, default None
|
363
|
+
Compute pool to be used for for this step.
|
364
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
365
|
+
hostname_resolution_timeout: int, default 10 * 60
|
366
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
367
|
+
Only applicable when @parallel is used.
|
368
|
+
qos: str, default: Burstable
|
369
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
350
370
|
|
351
|
-
|
352
|
-
|
371
|
+
security_context: Dict[str, Any], optional, default None
|
372
|
+
Container security context. Applies to the task container. Allows the following keys:
|
373
|
+
- privileged: bool, optional, default None
|
374
|
+
- allow_privilege_escalation: bool, optional, default None
|
375
|
+
- run_as_user: int, optional, default None
|
376
|
+
- run_as_group: int, optional, default None
|
377
|
+
- run_as_non_root: bool, optional, default None
|
353
378
|
"""
|
354
379
|
...
|
355
380
|
|
356
381
|
@typing.overload
|
357
|
-
def
|
382
|
+
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]]]:
|
358
383
|
"""
|
359
|
-
|
360
|
-
to a step needs to be retried.
|
361
|
-
|
362
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
363
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
364
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
384
|
+
Enables loading / saving of models within a step.
|
365
385
|
|
366
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
367
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
368
|
-
ensuring that the flow execution can continue.
|
369
386
|
|
370
387
|
|
371
388
|
Parameters
|
372
389
|
----------
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
@typing.overload
|
381
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
382
|
-
...
|
383
|
-
|
384
|
-
@typing.overload
|
385
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
386
|
-
...
|
387
|
-
|
388
|
-
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):
|
389
|
-
"""
|
390
|
-
Specifies the number of times the task corresponding
|
391
|
-
to a step needs to be retried.
|
392
|
-
|
393
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
394
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
395
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
396
|
-
|
397
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
398
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
399
|
-
ensuring that the flow execution can continue.
|
400
|
-
|
401
|
-
|
402
|
-
Parameters
|
403
|
-
----------
|
404
|
-
times : int, default 3
|
405
|
-
Number of times to retry this task.
|
406
|
-
minutes_between_retries : int, default 2
|
407
|
-
Number of minutes between retries.
|
408
|
-
"""
|
409
|
-
...
|
410
|
-
|
411
|
-
@typing.overload
|
412
|
-
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]]]:
|
413
|
-
"""
|
414
|
-
Specifies environment variables to be set prior to the execution of a step.
|
390
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
391
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
392
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
393
|
+
- `current.checkpoint`
|
394
|
+
- `current.model`
|
395
|
+
- `current.huggingface_hub`
|
415
396
|
|
397
|
+
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
|
398
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
399
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
416
400
|
|
417
|
-
|
418
|
-
|
419
|
-
vars : Dict[str, str], default {}
|
420
|
-
Dictionary of environment variables to set.
|
401
|
+
temp_dir_root : str, default: None
|
402
|
+
The root directory under which `current.model.loaded` will store loaded models
|
421
403
|
"""
|
422
404
|
...
|
423
405
|
|
424
406
|
@typing.overload
|
425
|
-
def
|
407
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
426
408
|
...
|
427
409
|
|
428
410
|
@typing.overload
|
429
|
-
def
|
411
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
430
412
|
...
|
431
413
|
|
432
|
-
def
|
414
|
+
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):
|
433
415
|
"""
|
434
|
-
|
416
|
+
Enables loading / saving of models within a step.
|
417
|
+
|
435
418
|
|
436
419
|
|
437
420
|
Parameters
|
438
421
|
----------
|
439
|
-
|
440
|
-
|
422
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
423
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
424
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
425
|
+
- `current.checkpoint`
|
426
|
+
- `current.model`
|
427
|
+
- `current.huggingface_hub`
|
428
|
+
|
429
|
+
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
|
430
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
431
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
432
|
+
|
433
|
+
temp_dir_root : str, default: None
|
434
|
+
The root directory under which `current.model.loaded` will store loaded models
|
441
435
|
"""
|
442
436
|
...
|
443
437
|
|
@@ -456,85 +450,58 @@ def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union
|
|
456
450
|
"""
|
457
451
|
...
|
458
452
|
|
459
|
-
def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
460
|
-
"""
|
461
|
-
Specifies that this step should execute on DGX cloud.
|
462
|
-
|
463
|
-
|
464
|
-
Parameters
|
465
|
-
----------
|
466
|
-
gpu : int
|
467
|
-
Number of GPUs to use.
|
468
|
-
gpu_type : str
|
469
|
-
Type of Nvidia GPU to use.
|
470
|
-
"""
|
471
|
-
...
|
472
|
-
|
473
|
-
@typing.overload
|
474
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
475
|
-
"""
|
476
|
-
Decorator prototype for all step decorators. This function gets specialized
|
477
|
-
and imported for all decorators types by _import_plugin_decorators().
|
478
|
-
"""
|
479
|
-
...
|
480
|
-
|
481
|
-
@typing.overload
|
482
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
483
|
-
...
|
484
|
-
|
485
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
486
|
-
"""
|
487
|
-
Decorator prototype for all step decorators. This function gets specialized
|
488
|
-
and imported for all decorators types by _import_plugin_decorators().
|
489
|
-
"""
|
490
|
-
...
|
491
|
-
|
492
453
|
@typing.overload
|
493
|
-
def
|
454
|
+
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]]]:
|
494
455
|
"""
|
495
|
-
|
456
|
+
Specifies the number of times the task corresponding
|
457
|
+
to a step needs to be retried.
|
496
458
|
|
497
|
-
|
459
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
460
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
461
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
462
|
+
|
463
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
464
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
465
|
+
ensuring that the flow execution can continue.
|
498
466
|
|
499
467
|
|
500
468
|
Parameters
|
501
469
|
----------
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
options : Dict[str, Any], default {}
|
507
|
-
Options passed to the card. The contents depend on the card type.
|
508
|
-
timeout : int, default 45
|
509
|
-
Interrupt reporting if it takes more than this many seconds.
|
470
|
+
times : int, default 3
|
471
|
+
Number of times to retry this task.
|
472
|
+
minutes_between_retries : int, default 2
|
473
|
+
Number of minutes between retries.
|
510
474
|
"""
|
511
475
|
...
|
512
476
|
|
513
477
|
@typing.overload
|
514
|
-
def
|
478
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
515
479
|
...
|
516
480
|
|
517
481
|
@typing.overload
|
518
|
-
def
|
482
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
519
483
|
...
|
520
484
|
|
521
|
-
def
|
485
|
+
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):
|
522
486
|
"""
|
523
|
-
|
487
|
+
Specifies the number of times the task corresponding
|
488
|
+
to a step needs to be retried.
|
524
489
|
|
525
|
-
|
490
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
491
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
492
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
493
|
+
|
494
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
495
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
496
|
+
ensuring that the flow execution can continue.
|
526
497
|
|
527
498
|
|
528
499
|
Parameters
|
529
500
|
----------
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
options : Dict[str, Any], default {}
|
535
|
-
Options passed to the card. The contents depend on the card type.
|
536
|
-
timeout : int, default 45
|
537
|
-
Interrupt reporting if it takes more than this many seconds.
|
501
|
+
times : int, default 3
|
502
|
+
Number of times to retry this task.
|
503
|
+
minutes_between_retries : int, default 2
|
504
|
+
Number of minutes between retries.
|
538
505
|
"""
|
539
506
|
...
|
540
507
|
|
@@ -596,281 +563,264 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
596
563
|
...
|
597
564
|
|
598
565
|
@typing.overload
|
599
|
-
def
|
566
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
600
567
|
"""
|
601
|
-
|
602
|
-
the execution of a step.
|
603
|
-
|
604
|
-
|
605
|
-
Parameters
|
606
|
-
----------
|
607
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
608
|
-
List of secret specs, defining how the secrets are to be retrieved
|
568
|
+
Internal decorator to support Fast bakery
|
609
569
|
"""
|
610
570
|
...
|
611
571
|
|
612
572
|
@typing.overload
|
613
|
-
def
|
614
|
-
...
|
615
|
-
|
616
|
-
@typing.overload
|
617
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
573
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
618
574
|
...
|
619
575
|
|
620
|
-
def
|
576
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
621
577
|
"""
|
622
|
-
|
623
|
-
the execution of a step.
|
624
|
-
|
625
|
-
|
626
|
-
Parameters
|
627
|
-
----------
|
628
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
629
|
-
List of secret specs, defining how the secrets are to be retrieved
|
578
|
+
Internal decorator to support Fast bakery
|
630
579
|
"""
|
631
580
|
...
|
632
581
|
|
633
582
|
@typing.overload
|
634
|
-
def
|
583
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
635
584
|
"""
|
636
|
-
Specifies the
|
585
|
+
Specifies the resources needed when executing this step.
|
637
586
|
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
587
|
+
Use `@resources` to specify the resource requirements
|
588
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
589
|
+
|
590
|
+
You can choose the compute layer on the command line by executing e.g.
|
591
|
+
```
|
592
|
+
python myflow.py run --with batch
|
593
|
+
```
|
594
|
+
or
|
595
|
+
```
|
596
|
+
python myflow.py run --with kubernetes
|
597
|
+
```
|
598
|
+
which executes the flow on the desired system using the
|
599
|
+
requirements specified in `@resources`.
|
642
600
|
|
643
601
|
|
644
602
|
Parameters
|
645
603
|
----------
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
604
|
+
cpu : int, default 1
|
605
|
+
Number of CPUs required for this step.
|
606
|
+
gpu : int, optional, default None
|
607
|
+
Number of GPUs required for this step.
|
608
|
+
disk : int, optional, default None
|
609
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
610
|
+
memory : int, default 4096
|
611
|
+
Memory size (in MB) required for this step.
|
612
|
+
shared_memory : int, optional, default None
|
613
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
614
|
+
This parameter maps to the `--shm-size` option in Docker.
|
652
615
|
"""
|
653
616
|
...
|
654
617
|
|
655
618
|
@typing.overload
|
656
|
-
def
|
619
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
657
620
|
...
|
658
621
|
|
659
622
|
@typing.overload
|
660
|
-
def
|
623
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
661
624
|
...
|
662
625
|
|
663
|
-
def
|
626
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
664
627
|
"""
|
665
|
-
Specifies the
|
628
|
+
Specifies the resources needed when executing this step.
|
666
629
|
|
667
|
-
|
668
|
-
|
669
|
-
|
670
|
-
|
630
|
+
Use `@resources` to specify the resource requirements
|
631
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
632
|
+
|
633
|
+
You can choose the compute layer on the command line by executing e.g.
|
634
|
+
```
|
635
|
+
python myflow.py run --with batch
|
636
|
+
```
|
637
|
+
or
|
638
|
+
```
|
639
|
+
python myflow.py run --with kubernetes
|
640
|
+
```
|
641
|
+
which executes the flow on the desired system using the
|
642
|
+
requirements specified in `@resources`.
|
671
643
|
|
672
644
|
|
673
645
|
Parameters
|
674
646
|
----------
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
647
|
+
cpu : int, default 1
|
648
|
+
Number of CPUs required for this step.
|
649
|
+
gpu : int, optional, default None
|
650
|
+
Number of GPUs required for this step.
|
651
|
+
disk : int, optional, default None
|
652
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
653
|
+
memory : int, default 4096
|
654
|
+
Memory size (in MB) required for this step.
|
655
|
+
shared_memory : int, optional, default None
|
656
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
657
|
+
This parameter maps to the `--shm-size` option in Docker.
|
658
|
+
"""
|
659
|
+
...
|
660
|
+
|
661
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
662
|
+
"""
|
663
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
664
|
+
|
665
|
+
|
666
|
+
Parameters
|
667
|
+
----------
|
668
|
+
temp_dir_root : str, optional
|
669
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
670
|
+
|
671
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
672
|
+
The list of repos (models/datasets) to load.
|
673
|
+
|
674
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
675
|
+
|
676
|
+
- If repo (model/dataset) is not found in the datastore:
|
677
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
678
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
679
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
680
|
+
|
681
|
+
- If repo is found in the datastore:
|
682
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
681
683
|
"""
|
682
684
|
...
|
683
685
|
|
684
686
|
@typing.overload
|
685
|
-
def
|
687
|
+
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]]]:
|
686
688
|
"""
|
687
|
-
Specifies
|
689
|
+
Specifies a timeout for your step.
|
688
690
|
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
691
|
+
This decorator is useful if this step may hang indefinitely.
|
692
|
+
|
693
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
694
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
695
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
696
|
+
|
697
|
+
Note that all the values specified in parameters are added together so if you specify
|
698
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
693
699
|
|
694
700
|
|
695
701
|
Parameters
|
696
702
|
----------
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
+
seconds : int, default 0
|
704
|
+
Number of seconds to wait prior to timing out.
|
705
|
+
minutes : int, default 0
|
706
|
+
Number of minutes to wait prior to timing out.
|
707
|
+
hours : int, default 0
|
708
|
+
Number of hours to wait prior to timing out.
|
703
709
|
"""
|
704
710
|
...
|
705
711
|
|
706
712
|
@typing.overload
|
707
|
-
def
|
713
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
708
714
|
...
|
709
715
|
|
710
716
|
@typing.overload
|
711
|
-
def
|
717
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
712
718
|
...
|
713
719
|
|
714
|
-
def
|
720
|
+
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):
|
715
721
|
"""
|
716
|
-
Specifies
|
722
|
+
Specifies a timeout for your step.
|
717
723
|
|
718
|
-
|
719
|
-
|
720
|
-
|
721
|
-
|
724
|
+
This decorator is useful if this step may hang indefinitely.
|
725
|
+
|
726
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
727
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
728
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
729
|
+
|
730
|
+
Note that all the values specified in parameters are added together so if you specify
|
731
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
722
732
|
|
723
733
|
|
724
734
|
Parameters
|
725
735
|
----------
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
736
|
+
seconds : int, default 0
|
737
|
+
Number of seconds to wait prior to timing out.
|
738
|
+
minutes : int, default 0
|
739
|
+
Number of minutes to wait prior to timing out.
|
740
|
+
hours : int, default 0
|
741
|
+
Number of hours to wait prior to timing out.
|
732
742
|
"""
|
733
743
|
...
|
734
744
|
|
735
745
|
@typing.overload
|
736
|
-
def
|
746
|
+
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]]]:
|
737
747
|
"""
|
738
|
-
|
748
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
739
749
|
|
750
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
740
751
|
|
741
752
|
|
742
753
|
Parameters
|
743
754
|
----------
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
753
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
754
|
-
|
755
|
-
temp_dir_root : str, default: None
|
756
|
-
The root directory under which `current.model.loaded` will store loaded models
|
755
|
+
type : str, default 'default'
|
756
|
+
Card type.
|
757
|
+
id : str, optional, default None
|
758
|
+
If multiple cards are present, use this id to identify this card.
|
759
|
+
options : Dict[str, Any], default {}
|
760
|
+
Options passed to the card. The contents depend on the card type.
|
761
|
+
timeout : int, default 45
|
762
|
+
Interrupt reporting if it takes more than this many seconds.
|
757
763
|
"""
|
758
764
|
...
|
759
765
|
|
760
766
|
@typing.overload
|
761
|
-
def
|
767
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
762
768
|
...
|
763
769
|
|
764
770
|
@typing.overload
|
765
|
-
def
|
771
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
766
772
|
...
|
767
773
|
|
768
|
-
def
|
774
|
+
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):
|
769
775
|
"""
|
770
|
-
|
776
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
771
777
|
|
778
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
772
779
|
|
773
780
|
|
774
781
|
Parameters
|
775
782
|
----------
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
783
|
+
type : str, default 'default'
|
784
|
+
Card type.
|
785
|
+
id : str, optional, default None
|
786
|
+
If multiple cards are present, use this id to identify this card.
|
787
|
+
options : Dict[str, Any], default {}
|
788
|
+
Options passed to the card. The contents depend on the card type.
|
789
|
+
timeout : int, default 45
|
790
|
+
Interrupt reporting if it takes more than this many seconds.
|
791
|
+
"""
|
792
|
+
...
|
793
|
+
|
794
|
+
@typing.overload
|
795
|
+
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]]]:
|
796
|
+
"""
|
797
|
+
Specifies environment variables to be set prior to the execution of a step.
|
782
798
|
|
783
|
-
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
|
784
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
785
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
786
799
|
|
787
|
-
|
788
|
-
|
800
|
+
Parameters
|
801
|
+
----------
|
802
|
+
vars : Dict[str, str], default {}
|
803
|
+
Dictionary of environment variables to set.
|
789
804
|
"""
|
790
805
|
...
|
791
806
|
|
792
|
-
|
807
|
+
@typing.overload
|
808
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
809
|
+
...
|
810
|
+
|
811
|
+
@typing.overload
|
812
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
813
|
+
...
|
814
|
+
|
815
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
793
816
|
"""
|
794
|
-
Specifies
|
817
|
+
Specifies environment variables to be set prior to the execution of a step.
|
795
818
|
|
796
819
|
|
797
820
|
Parameters
|
798
821
|
----------
|
799
|
-
|
800
|
-
|
801
|
-
also present, the maximum value from all decorators is used.
|
802
|
-
memory : int, default 4096
|
803
|
-
Memory size (in MB) required for this step. If
|
804
|
-
`@resources` is also present, the maximum value from all decorators is
|
805
|
-
used.
|
806
|
-
disk : int, default 10240
|
807
|
-
Disk size (in MB) required for this step. If
|
808
|
-
`@resources` is also present, the maximum value from all decorators is
|
809
|
-
used.
|
810
|
-
image : str, optional, default None
|
811
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
812
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
813
|
-
not, a default Docker image mapping to the current version of Python is used.
|
814
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
815
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
816
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
817
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
818
|
-
secrets : List[str], optional, default None
|
819
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
820
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
821
|
-
in Metaflow configuration.
|
822
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
823
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
824
|
-
Can be passed in as a comma separated string of values e.g.
|
825
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
826
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
827
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
828
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
829
|
-
gpu : int, optional, default None
|
830
|
-
Number of GPUs required for this step. A value of zero implies that
|
831
|
-
the scheduled node should not have GPUs.
|
832
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
833
|
-
The vendor of the GPUs to be used for this step.
|
834
|
-
tolerations : List[str], default []
|
835
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
836
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
837
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
838
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
839
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
840
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
841
|
-
use_tmpfs : bool, default False
|
842
|
-
This enables an explicit tmpfs mount for this step.
|
843
|
-
tmpfs_tempdir : bool, default True
|
844
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
845
|
-
tmpfs_size : int, optional, default: None
|
846
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
847
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
848
|
-
memory allocated for this step.
|
849
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
850
|
-
Path to tmpfs mount for this step.
|
851
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
852
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
853
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
854
|
-
shared_memory: int, optional
|
855
|
-
Shared memory size (in MiB) required for this step
|
856
|
-
port: int, optional
|
857
|
-
Port number to specify in the Kubernetes job object
|
858
|
-
compute_pool : str, optional, default None
|
859
|
-
Compute pool to be used for for this step.
|
860
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
861
|
-
hostname_resolution_timeout: int, default 10 * 60
|
862
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
863
|
-
Only applicable when @parallel is used.
|
864
|
-
qos: str, default: Burstable
|
865
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
866
|
-
|
867
|
-
security_context: Dict[str, Any], optional, default None
|
868
|
-
Container security context. Applies to the task container. Allows the following keys:
|
869
|
-
- privileged: bool, optional, default None
|
870
|
-
- allow_privilege_escalation: bool, optional, default None
|
871
|
-
- run_as_user: int, optional, default None
|
872
|
-
- run_as_group: int, optional, default None
|
873
|
-
- run_as_non_root: bool, optional, default None
|
822
|
+
vars : Dict[str, str], default {}
|
823
|
+
Dictionary of environment variables to set.
|
874
824
|
"""
|
875
825
|
...
|
876
826
|
|
@@ -890,6 +840,55 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
|
|
890
840
|
"""
|
891
841
|
...
|
892
842
|
|
843
|
+
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]]]:
|
844
|
+
"""
|
845
|
+
Specifies that this step should execute on DGX cloud.
|
846
|
+
|
847
|
+
|
848
|
+
Parameters
|
849
|
+
----------
|
850
|
+
gpu : int
|
851
|
+
Number of GPUs to use.
|
852
|
+
gpu_type : str
|
853
|
+
Type of Nvidia GPU to use.
|
854
|
+
"""
|
855
|
+
...
|
856
|
+
|
857
|
+
@typing.overload
|
858
|
+
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]]]:
|
859
|
+
"""
|
860
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
861
|
+
the execution of a step.
|
862
|
+
|
863
|
+
|
864
|
+
Parameters
|
865
|
+
----------
|
866
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
867
|
+
List of secret specs, defining how the secrets are to be retrieved
|
868
|
+
"""
|
869
|
+
...
|
870
|
+
|
871
|
+
@typing.overload
|
872
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
873
|
+
...
|
874
|
+
|
875
|
+
@typing.overload
|
876
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
877
|
+
...
|
878
|
+
|
879
|
+
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]]] = []):
|
880
|
+
"""
|
881
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
882
|
+
the execution of a step.
|
883
|
+
|
884
|
+
|
885
|
+
Parameters
|
886
|
+
----------
|
887
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
888
|
+
List of secret specs, defining how the secrets are to be retrieved
|
889
|
+
"""
|
890
|
+
...
|
891
|
+
|
893
892
|
@typing.overload
|
894
893
|
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
895
894
|
"""
|
@@ -950,19 +949,21 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
950
949
|
...
|
951
950
|
|
952
951
|
@typing.overload
|
953
|
-
def
|
952
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
954
953
|
"""
|
955
|
-
|
954
|
+
Decorator prototype for all step decorators. This function gets specialized
|
955
|
+
and imported for all decorators types by _import_plugin_decorators().
|
956
956
|
"""
|
957
957
|
...
|
958
958
|
|
959
959
|
@typing.overload
|
960
|
-
def
|
960
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
961
961
|
...
|
962
962
|
|
963
|
-
def
|
963
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
964
964
|
"""
|
965
|
-
|
965
|
+
Decorator prototype for all step decorators. This function gets specialized
|
966
|
+
and imported for all decorators types by _import_plugin_decorators().
|
966
967
|
"""
|
967
968
|
...
|
968
969
|
|
@@ -1068,78 +1069,95 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1068
1069
|
...
|
1069
1070
|
|
1070
1071
|
@typing.overload
|
1071
|
-
def
|
1072
|
+
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]]:
|
1072
1073
|
"""
|
1073
|
-
Specifies the
|
1074
|
+
Specifies the event(s) that this flow depends on.
|
1075
|
+
|
1076
|
+
```
|
1077
|
+
@trigger(event='foo')
|
1078
|
+
```
|
1079
|
+
or
|
1080
|
+
```
|
1081
|
+
@trigger(events=['foo', 'bar'])
|
1082
|
+
```
|
1083
|
+
|
1084
|
+
Additionally, you can specify the parameter mappings
|
1085
|
+
to map event payload to Metaflow parameters for the flow.
|
1086
|
+
```
|
1087
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1088
|
+
```
|
1089
|
+
or
|
1090
|
+
```
|
1091
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1092
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1093
|
+
```
|
1094
|
+
|
1095
|
+
'parameters' can also be a list of strings and tuples like so:
|
1096
|
+
```
|
1097
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1098
|
+
```
|
1099
|
+
This is equivalent to:
|
1100
|
+
```
|
1101
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1102
|
+
```
|
1074
1103
|
|
1075
|
-
Use `@pypi_base` to set common packages required by all
|
1076
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1077
1104
|
|
1078
1105
|
Parameters
|
1079
1106
|
----------
|
1080
|
-
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1107
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1108
|
+
Event dependency for this flow.
|
1109
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1110
|
+
Events dependency for this flow.
|
1111
|
+
options : Dict[str, Any], default {}
|
1112
|
+
Backend-specific configuration for tuning eventing behavior.
|
1086
1113
|
"""
|
1087
1114
|
...
|
1088
1115
|
|
1089
1116
|
@typing.overload
|
1090
|
-
def
|
1117
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1091
1118
|
...
|
1092
1119
|
|
1093
|
-
def
|
1120
|
+
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] = {}):
|
1094
1121
|
"""
|
1095
|
-
Specifies the
|
1122
|
+
Specifies the event(s) that this flow depends on.
|
1096
1123
|
|
1097
|
-
|
1098
|
-
|
1124
|
+
```
|
1125
|
+
@trigger(event='foo')
|
1126
|
+
```
|
1127
|
+
or
|
1128
|
+
```
|
1129
|
+
@trigger(events=['foo', 'bar'])
|
1130
|
+
```
|
1099
1131
|
|
1100
|
-
|
1101
|
-
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1110
|
-
|
1111
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1112
|
-
"""
|
1113
|
-
Specifies what flows belong to the same project.
|
1132
|
+
Additionally, you can specify the parameter mappings
|
1133
|
+
to map event payload to Metaflow parameters for the flow.
|
1134
|
+
```
|
1135
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1136
|
+
```
|
1137
|
+
or
|
1138
|
+
```
|
1139
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1140
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1141
|
+
```
|
1114
1142
|
|
1115
|
-
|
1116
|
-
|
1143
|
+
'parameters' can also be a list of strings and tuples like so:
|
1144
|
+
```
|
1145
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1146
|
+
```
|
1147
|
+
This is equivalent to:
|
1148
|
+
```
|
1149
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1150
|
+
```
|
1117
1151
|
|
1118
1152
|
|
1119
1153
|
Parameters
|
1120
1154
|
----------
|
1121
|
-
|
1122
|
-
|
1123
|
-
|
1124
|
-
|
1125
|
-
|
1126
|
-
|
1127
|
-
The branch to use. If not specified, the branch is set to
|
1128
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1129
|
-
also be set on the command line using `--branch` as a top-level option.
|
1130
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1131
|
-
|
1132
|
-
production : bool, default False
|
1133
|
-
Whether or not the branch is the production branch. This can also be set on the
|
1134
|
-
command line using `--production` as a top-level option. It is an error to specify
|
1135
|
-
`production` in the decorator and on the command line.
|
1136
|
-
The project branch name will be:
|
1137
|
-
- if `branch` is specified:
|
1138
|
-
- if `production` is True: `prod.<branch>`
|
1139
|
-
- if `production` is False: `test.<branch>`
|
1140
|
-
- if `branch` is not specified:
|
1141
|
-
- if `production` is True: `prod`
|
1142
|
-
- if `production` is False: `user.<username>`
|
1155
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1156
|
+
Event dependency for this flow.
|
1157
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1158
|
+
Events dependency for this flow.
|
1159
|
+
options : Dict[str, Any], default {}
|
1160
|
+
Backend-specific configuration for tuning eventing behavior.
|
1143
1161
|
"""
|
1144
1162
|
...
|
1145
1163
|
|
@@ -1277,170 +1295,85 @@ def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[s
|
|
1277
1295
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1278
1296
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1279
1297
|
disabled : bool, default False
|
1280
|
-
If set to True, disables Conda.
|
1281
|
-
"""
|
1282
|
-
...
|
1283
|
-
|
1284
|
-
@typing.overload
|
1285
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1286
|
-
...
|
1287
|
-
|
1288
|
-
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1289
|
-
"""
|
1290
|
-
Specifies the Conda environment for all steps of the flow.
|
1291
|
-
|
1292
|
-
Use `@conda_base` to set common libraries required by all
|
1293
|
-
steps and use `@conda` to specify step-specific additions.
|
1294
|
-
|
1295
|
-
|
1296
|
-
Parameters
|
1297
|
-
----------
|
1298
|
-
packages : Dict[str, str], default {}
|
1299
|
-
Packages to use for this flow. The key is the name of the package
|
1300
|
-
and the value is the version to use.
|
1301
|
-
libraries : Dict[str, str], default {}
|
1302
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1303
|
-
python : str, optional, default None
|
1304
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1305
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1306
|
-
disabled : bool, default False
|
1307
|
-
If set to True, disables Conda.
|
1308
|
-
"""
|
1309
|
-
...
|
1310
|
-
|
1311
|
-
@typing.overload
|
1312
|
-
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]]:
|
1313
|
-
"""
|
1314
|
-
Specifies the event(s) that this flow depends on.
|
1315
|
-
|
1316
|
-
```
|
1317
|
-
@trigger(event='foo')
|
1318
|
-
```
|
1319
|
-
or
|
1320
|
-
```
|
1321
|
-
@trigger(events=['foo', 'bar'])
|
1322
|
-
```
|
1323
|
-
|
1324
|
-
Additionally, you can specify the parameter mappings
|
1325
|
-
to map event payload to Metaflow parameters for the flow.
|
1326
|
-
```
|
1327
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1328
|
-
```
|
1329
|
-
or
|
1330
|
-
```
|
1331
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1332
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1333
|
-
```
|
1334
|
-
|
1335
|
-
'parameters' can also be a list of strings and tuples like so:
|
1336
|
-
```
|
1337
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1338
|
-
```
|
1339
|
-
This is equivalent to:
|
1340
|
-
```
|
1341
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1342
|
-
```
|
1343
|
-
|
1344
|
-
|
1345
|
-
Parameters
|
1346
|
-
----------
|
1347
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1348
|
-
Event dependency for this flow.
|
1349
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1350
|
-
Events dependency for this flow.
|
1351
|
-
options : Dict[str, Any], default {}
|
1352
|
-
Backend-specific configuration for tuning eventing behavior.
|
1298
|
+
If set to True, disables Conda.
|
1353
1299
|
"""
|
1354
1300
|
...
|
1355
1301
|
|
1356
1302
|
@typing.overload
|
1357
|
-
def
|
1303
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1358
1304
|
...
|
1359
1305
|
|
1360
|
-
def
|
1306
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1361
1307
|
"""
|
1362
|
-
Specifies the
|
1308
|
+
Specifies the Conda environment for all steps of the flow.
|
1363
1309
|
|
1364
|
-
|
1365
|
-
|
1366
|
-
```
|
1367
|
-
or
|
1368
|
-
```
|
1369
|
-
@trigger(events=['foo', 'bar'])
|
1370
|
-
```
|
1310
|
+
Use `@conda_base` to set common libraries required by all
|
1311
|
+
steps and use `@conda` to specify step-specific additions.
|
1371
1312
|
|
1372
|
-
Additionally, you can specify the parameter mappings
|
1373
|
-
to map event payload to Metaflow parameters for the flow.
|
1374
|
-
```
|
1375
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1376
|
-
```
|
1377
|
-
or
|
1378
|
-
```
|
1379
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1380
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1381
|
-
```
|
1382
1313
|
|
1383
|
-
|
1384
|
-
|
1385
|
-
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
|
1314
|
+
Parameters
|
1315
|
+
----------
|
1316
|
+
packages : Dict[str, str], default {}
|
1317
|
+
Packages to use for this flow. The key is the name of the package
|
1318
|
+
and the value is the version to use.
|
1319
|
+
libraries : Dict[str, str], default {}
|
1320
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1321
|
+
python : str, optional, default None
|
1322
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1323
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1324
|
+
disabled : bool, default False
|
1325
|
+
If set to True, disables Conda.
|
1326
|
+
"""
|
1327
|
+
...
|
1328
|
+
|
1329
|
+
@typing.overload
|
1330
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1331
|
+
"""
|
1332
|
+
Specifies the times when the flow should be run when running on a
|
1333
|
+
production scheduler.
|
1391
1334
|
|
1392
1335
|
|
1393
1336
|
Parameters
|
1394
1337
|
----------
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1338
|
+
hourly : bool, default False
|
1339
|
+
Run the workflow hourly.
|
1340
|
+
daily : bool, default True
|
1341
|
+
Run the workflow daily.
|
1342
|
+
weekly : bool, default False
|
1343
|
+
Run the workflow weekly.
|
1344
|
+
cron : str, optional, default None
|
1345
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1346
|
+
specified by this expression.
|
1347
|
+
timezone : str, optional, default None
|
1348
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1349
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1401
1350
|
"""
|
1402
1351
|
...
|
1403
1352
|
|
1404
|
-
|
1353
|
+
@typing.overload
|
1354
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1355
|
+
...
|
1356
|
+
|
1357
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1405
1358
|
"""
|
1406
|
-
|
1407
|
-
|
1359
|
+
Specifies the times when the flow should be run when running on a
|
1360
|
+
production scheduler.
|
1408
1361
|
|
1409
1362
|
|
1410
1363
|
Parameters
|
1411
1364
|
----------
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1425
|
-
name : str
|
1426
|
-
Name of the sensor on Airflow
|
1427
|
-
description : str
|
1428
|
-
Description of sensor in the Airflow UI
|
1429
|
-
external_dag_id : str
|
1430
|
-
The dag_id that contains the task you want to wait for.
|
1431
|
-
external_task_ids : List[str]
|
1432
|
-
The list of task_ids that you want to wait for.
|
1433
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1434
|
-
allowed_states : List[str]
|
1435
|
-
Iterable of allowed states, (Default: ['success'])
|
1436
|
-
failed_states : List[str]
|
1437
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1438
|
-
execution_delta : datetime.timedelta
|
1439
|
-
time difference with the previous execution to look at,
|
1440
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1441
|
-
check_existence: bool
|
1442
|
-
Set to True to check if the external task exists or check if
|
1443
|
-
the DAG to wait for exists. (Default: True)
|
1365
|
+
hourly : bool, default False
|
1366
|
+
Run the workflow hourly.
|
1367
|
+
daily : bool, default True
|
1368
|
+
Run the workflow daily.
|
1369
|
+
weekly : bool, default False
|
1370
|
+
Run the workflow weekly.
|
1371
|
+
cron : str, optional, default None
|
1372
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1373
|
+
specified by this expression.
|
1374
|
+
timezone : str, optional, default None
|
1375
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1376
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1444
1377
|
"""
|
1445
1378
|
...
|
1446
1379
|
|
@@ -1487,54 +1420,122 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1487
1420
|
"""
|
1488
1421
|
...
|
1489
1422
|
|
1423
|
+
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]]:
|
1424
|
+
"""
|
1425
|
+
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.
|
1426
|
+
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.
|
1427
|
+
|
1428
|
+
|
1429
|
+
Parameters
|
1430
|
+
----------
|
1431
|
+
timeout : int
|
1432
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1433
|
+
poke_interval : int
|
1434
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1435
|
+
mode : str
|
1436
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1437
|
+
exponential_backoff : bool
|
1438
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1439
|
+
pool : str
|
1440
|
+
the slot pool this task should run in,
|
1441
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1442
|
+
soft_fail : bool
|
1443
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1444
|
+
name : str
|
1445
|
+
Name of the sensor on Airflow
|
1446
|
+
description : str
|
1447
|
+
Description of sensor in the Airflow UI
|
1448
|
+
external_dag_id : str
|
1449
|
+
The dag_id that contains the task you want to wait for.
|
1450
|
+
external_task_ids : List[str]
|
1451
|
+
The list of task_ids that you want to wait for.
|
1452
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1453
|
+
allowed_states : List[str]
|
1454
|
+
Iterable of allowed states, (Default: ['success'])
|
1455
|
+
failed_states : List[str]
|
1456
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1457
|
+
execution_delta : datetime.timedelta
|
1458
|
+
time difference with the previous execution to look at,
|
1459
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1460
|
+
check_existence: bool
|
1461
|
+
Set to True to check if the external task exists or check if
|
1462
|
+
the DAG to wait for exists. (Default: True)
|
1463
|
+
"""
|
1464
|
+
...
|
1465
|
+
|
1490
1466
|
@typing.overload
|
1491
|
-
def
|
1467
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1492
1468
|
"""
|
1493
|
-
Specifies the
|
1494
|
-
production scheduler.
|
1469
|
+
Specifies the PyPI packages for all steps of the flow.
|
1495
1470
|
|
1471
|
+
Use `@pypi_base` to set common packages required by all
|
1472
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1496
1473
|
|
1497
1474
|
Parameters
|
1498
1475
|
----------
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
cron : str, optional, default None
|
1506
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1507
|
-
specified by this expression.
|
1508
|
-
timezone : str, optional, default None
|
1509
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1510
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1476
|
+
packages : Dict[str, str], default: {}
|
1477
|
+
Packages to use for this flow. The key is the name of the package
|
1478
|
+
and the value is the version to use.
|
1479
|
+
python : str, optional, default: None
|
1480
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1481
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1511
1482
|
"""
|
1512
1483
|
...
|
1513
1484
|
|
1514
1485
|
@typing.overload
|
1515
|
-
def
|
1486
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1516
1487
|
...
|
1517
1488
|
|
1518
|
-
def
|
1489
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1519
1490
|
"""
|
1520
|
-
Specifies the
|
1521
|
-
production scheduler.
|
1491
|
+
Specifies the PyPI packages for all steps of the flow.
|
1522
1492
|
|
1493
|
+
Use `@pypi_base` to set common packages required by all
|
1494
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1523
1495
|
|
1524
1496
|
Parameters
|
1525
1497
|
----------
|
1526
|
-
|
1527
|
-
|
1528
|
-
|
1529
|
-
|
1530
|
-
|
1531
|
-
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1498
|
+
packages : Dict[str, str], default: {}
|
1499
|
+
Packages to use for this flow. The key is the name of the package
|
1500
|
+
and the value is the version to use.
|
1501
|
+
python : str, optional, default: None
|
1502
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1503
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1504
|
+
"""
|
1505
|
+
...
|
1506
|
+
|
1507
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1508
|
+
"""
|
1509
|
+
Specifies what flows belong to the same project.
|
1510
|
+
|
1511
|
+
A project-specific namespace is created for all flows that
|
1512
|
+
use the same `@project(name)`.
|
1513
|
+
|
1514
|
+
|
1515
|
+
Parameters
|
1516
|
+
----------
|
1517
|
+
name : str
|
1518
|
+
Project name. Make sure that the name is unique amongst all
|
1519
|
+
projects that use the same production scheduler. The name may
|
1520
|
+
contain only lowercase alphanumeric characters and underscores.
|
1521
|
+
|
1522
|
+
branch : Optional[str], default None
|
1523
|
+
The branch to use. If not specified, the branch is set to
|
1524
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1525
|
+
also be set on the command line using `--branch` as a top-level option.
|
1526
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1527
|
+
|
1528
|
+
production : bool, default False
|
1529
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1530
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1531
|
+
`production` in the decorator and on the command line.
|
1532
|
+
The project branch name will be:
|
1533
|
+
- if `branch` is specified:
|
1534
|
+
- if `production` is True: `prod.<branch>`
|
1535
|
+
- if `production` is False: `test.<branch>`
|
1536
|
+
- if `branch` is not specified:
|
1537
|
+
- if `production` is True: `prod`
|
1538
|
+
- if `production` is False: `user.<username>`
|
1538
1539
|
"""
|
1539
1540
|
...
|
1540
1541
|
|