ob-metaflow-stubs 6.0.3.173__py2.py3-none-any.whl → 6.0.3.174__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 +671 -671
- 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 +3 -3
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +1 -1
- metaflow-stubs/exception.pyi +1 -1
- metaflow-stubs/flowspec.pyi +3 -3
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +2 -2
- metaflow-stubs/info_file.pyi +1 -1
- metaflow-stubs/metadata_provider/__init__.pyi +1 -1
- metaflow-stubs/metadata_provider/heartbeat.pyi +1 -1
- metaflow-stubs/metadata_provider/metadata.pyi +1 -1
- metaflow-stubs/metadata_provider/util.pyi +1 -1
- metaflow-stubs/metaflow_config.pyi +1 -1
- metaflow-stubs/metaflow_current.pyi +45 -45
- metaflow-stubs/metaflow_git.pyi +1 -1
- metaflow-stubs/mf_extensions/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +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 +2 -2
- 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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +1 -1
- 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 +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +1 -1
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +1 -1
- metaflow-stubs/mf_extensions/outerbounds/plugins/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 +1 -1
- metaflow-stubs/multicore_utils.pyi +1 -1
- 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 +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +1 -1
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +1 -1
- 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 +1 -1
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +1 -1
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +1 -1
- metaflow-stubs/plugins/azure/__init__.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_credential.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +1 -1
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +1 -1
- 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 +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +1 -1
- metaflow-stubs/plugins/cards/card_modules/components.pyi +2 -2
- 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 +1 -1
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +1 -1
- metaflow-stubs/plugins/gcp/gs_utils.pyi +1 -1
- metaflow-stubs/plugins/gcp/includefile_support.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/__init__.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +1 -1
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +1 -1
- metaflow-stubs/plugins/ollama/__init__.pyi +1 -1
- metaflow-stubs/plugins/parallel_decorator.pyi +1 -1
- metaflow-stubs/plugins/perimeters.pyi +1 -1
- metaflow-stubs/plugins/project_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/__init__.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/conda_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/parsers.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +1 -1
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +1 -1
- metaflow-stubs/plugins/pypi/utils.pyi +1 -1
- metaflow-stubs/plugins/resources_decorator.pyi +1 -1
- metaflow-stubs/plugins/retry_decorator.pyi +1 -1
- metaflow-stubs/plugins/secrets/__init__.pyi +1 -1
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +1 -1
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +1 -1
- metaflow-stubs/plugins/snowflake/__init__.pyi +1 -1
- metaflow-stubs/plugins/storage_executor.pyi +1 -1
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +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 +27 -27
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +1 -1
- metaflow-stubs/runner/nbrun.pyi +1 -1
- metaflow-stubs/runner/subprocess_manager.pyi +1 -1
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +1 -1
- metaflow-stubs/system/system_logger.pyi +1 -1
- metaflow-stubs/system/system_monitor.pyi +1 -1
- metaflow-stubs/tagging_util.pyi +1 -1
- metaflow-stubs/tuple_util.pyi +1 -1
- metaflow-stubs/user_configs/__init__.pyi +1 -1
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.173.dist-info → ob_metaflow_stubs-6.0.3.174.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.174.dist-info/RECORD +211 -0
- ob_metaflow_stubs-6.0.3.173.dist-info/RECORD +0 -211
- {ob_metaflow_stubs-6.0.3.173.dist-info → ob_metaflow_stubs-6.0.3.174.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.173.dist-info → ob_metaflow_stubs-6.0.3.174.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-29T18:56:59.040642 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -37,16 +37,16 @@ from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDec
|
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
38
|
from . import tuple_util as tuple_util
|
39
39
|
from . import cards as cards
|
40
|
-
from . import events as events
|
41
40
|
from . import metaflow_git as metaflow_git
|
41
|
+
from . import events as events
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
47
48
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
48
49
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
49
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -153,124 +153,178 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
153
153
|
"""
|
154
154
|
...
|
155
155
|
|
156
|
-
|
156
|
+
@typing.overload
|
157
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
157
158
|
"""
|
158
|
-
Specifies
|
159
|
+
Specifies the resources needed when executing this step.
|
160
|
+
|
161
|
+
Use `@resources` to specify the resource requirements
|
162
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
163
|
+
|
164
|
+
You can choose the compute layer on the command line by executing e.g.
|
165
|
+
```
|
166
|
+
python myflow.py run --with batch
|
167
|
+
```
|
168
|
+
or
|
169
|
+
```
|
170
|
+
python myflow.py run --with kubernetes
|
171
|
+
```
|
172
|
+
which executes the flow on the desired system using the
|
173
|
+
requirements specified in `@resources`.
|
159
174
|
|
160
175
|
|
161
176
|
Parameters
|
162
177
|
----------
|
163
178
|
cpu : int, default 1
|
164
|
-
Number of CPUs required for this step.
|
165
|
-
also present, the maximum value from all decorators is used.
|
166
|
-
memory : int, default 4096
|
167
|
-
Memory size (in MB) required for this step. If
|
168
|
-
`@resources` is also present, the maximum value from all decorators is
|
169
|
-
used.
|
170
|
-
disk : int, default 10240
|
171
|
-
Disk size (in MB) required for this step. If
|
172
|
-
`@resources` is also present, the maximum value from all decorators is
|
173
|
-
used.
|
174
|
-
image : str, optional, default None
|
175
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
176
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
177
|
-
not, a default Docker image mapping to the current version of Python is used.
|
178
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
179
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
180
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
181
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
182
|
-
secrets : List[str], optional, default None
|
183
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
184
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
185
|
-
in Metaflow configuration.
|
186
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
187
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
188
|
-
Can be passed in as a comma separated string of values e.g.
|
189
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
190
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
191
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
192
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
179
|
+
Number of CPUs required for this step.
|
193
180
|
gpu : int, optional, default None
|
194
|
-
Number of GPUs required for this step.
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
203
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
204
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
205
|
-
use_tmpfs : bool, default False
|
206
|
-
This enables an explicit tmpfs mount for this step.
|
207
|
-
tmpfs_tempdir : bool, default True
|
208
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
209
|
-
tmpfs_size : int, optional, default: None
|
210
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
211
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
212
|
-
memory allocated for this step.
|
213
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
214
|
-
Path to tmpfs mount for this step.
|
215
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
216
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
217
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
218
|
-
shared_memory: int, optional
|
219
|
-
Shared memory size (in MiB) required for this step
|
220
|
-
port: int, optional
|
221
|
-
Port number to specify in the Kubernetes job object
|
222
|
-
compute_pool : str, optional, default None
|
223
|
-
Compute pool to be used for for this step.
|
224
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
225
|
-
hostname_resolution_timeout: int, default 10 * 60
|
226
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
227
|
-
Only applicable when @parallel is used.
|
228
|
-
qos: str, default: Burstable
|
229
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
230
|
-
|
231
|
-
security_context: Dict[str, Any], optional, default None
|
232
|
-
Container security context. Applies to the task container. Allows the following keys:
|
233
|
-
- privileged: bool, optional, default None
|
234
|
-
- allow_privilege_escalation: bool, optional, default None
|
235
|
-
- run_as_user: int, optional, default None
|
236
|
-
- run_as_group: int, optional, default None
|
237
|
-
- run_as_non_root: bool, optional, default None
|
181
|
+
Number of GPUs required for this step.
|
182
|
+
disk : int, optional, default None
|
183
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
184
|
+
memory : int, default 4096
|
185
|
+
Memory size (in MB) required for this step.
|
186
|
+
shared_memory : int, optional, default None
|
187
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
188
|
+
This parameter maps to the `--shm-size` option in Docker.
|
238
189
|
"""
|
239
190
|
...
|
240
191
|
|
241
192
|
@typing.overload
|
242
|
-
def
|
243
|
-
"""
|
244
|
-
Internal decorator to support Fast bakery
|
245
|
-
"""
|
193
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
246
194
|
...
|
247
195
|
|
248
196
|
@typing.overload
|
249
|
-
def
|
197
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
250
198
|
...
|
251
199
|
|
252
|
-
def
|
200
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
253
201
|
"""
|
254
|
-
|
202
|
+
Specifies the resources needed when executing this step.
|
203
|
+
|
204
|
+
Use `@resources` to specify the resource requirements
|
205
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
206
|
+
|
207
|
+
You can choose the compute layer on the command line by executing e.g.
|
208
|
+
```
|
209
|
+
python myflow.py run --with batch
|
210
|
+
```
|
211
|
+
or
|
212
|
+
```
|
213
|
+
python myflow.py run --with kubernetes
|
214
|
+
```
|
215
|
+
which executes the flow on the desired system using the
|
216
|
+
requirements specified in `@resources`.
|
217
|
+
|
218
|
+
|
219
|
+
Parameters
|
220
|
+
----------
|
221
|
+
cpu : int, default 1
|
222
|
+
Number of CPUs required for this step.
|
223
|
+
gpu : int, optional, default None
|
224
|
+
Number of GPUs required for this step.
|
225
|
+
disk : int, optional, default None
|
226
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
227
|
+
memory : int, default 4096
|
228
|
+
Memory size (in MB) required for this step.
|
229
|
+
shared_memory : int, optional, default None
|
230
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
231
|
+
This parameter maps to the `--shm-size` option in Docker.
|
255
232
|
"""
|
256
233
|
...
|
257
234
|
|
258
235
|
@typing.overload
|
259
|
-
def
|
236
|
+
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]]]:
|
260
237
|
"""
|
261
|
-
|
262
|
-
|
238
|
+
Specifies a timeout for your step.
|
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.
|
245
|
+
|
246
|
+
Note that all the values specified in parameters are added together so if you specify
|
247
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
248
|
+
|
249
|
+
|
250
|
+
Parameters
|
251
|
+
----------
|
252
|
+
seconds : int, default 0
|
253
|
+
Number of seconds to wait prior to timing out.
|
254
|
+
minutes : int, default 0
|
255
|
+
Number of minutes to wait prior to timing out.
|
256
|
+
hours : int, default 0
|
257
|
+
Number of hours to wait prior to timing out.
|
263
258
|
"""
|
264
259
|
...
|
265
260
|
|
266
261
|
@typing.overload
|
267
|
-
def
|
262
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
268
263
|
...
|
269
264
|
|
270
|
-
|
265
|
+
@typing.overload
|
266
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
267
|
+
...
|
268
|
+
|
269
|
+
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):
|
271
270
|
"""
|
272
|
-
|
273
|
-
|
271
|
+
Specifies a timeout for your step.
|
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.
|
278
|
+
|
279
|
+
Note that all the values specified in parameters are added together so if you specify
|
280
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
281
|
+
|
282
|
+
|
283
|
+
Parameters
|
284
|
+
----------
|
285
|
+
seconds : int, default 0
|
286
|
+
Number of seconds to wait prior to timing out.
|
287
|
+
minutes : int, default 0
|
288
|
+
Number of minutes to wait prior to timing out.
|
289
|
+
hours : int, default 0
|
290
|
+
Number of hours to wait prior to timing out.
|
291
|
+
"""
|
292
|
+
...
|
293
|
+
|
294
|
+
def ollama(*, models: list, backend: str, force_pull: bool, skip_push_check: bool, debug: bool) -> 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]]]:
|
295
|
+
"""
|
296
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
297
|
+
|
298
|
+
User code call
|
299
|
+
--------------
|
300
|
+
@ollama(
|
301
|
+
models=[...],
|
302
|
+
...
|
303
|
+
)
|
304
|
+
|
305
|
+
Valid backend options
|
306
|
+
---------------------
|
307
|
+
- 'local': Run as a separate process on the local task machine.
|
308
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
309
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
310
|
+
|
311
|
+
Valid model options
|
312
|
+
-------------------
|
313
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
314
|
+
|
315
|
+
|
316
|
+
Parameters
|
317
|
+
----------
|
318
|
+
models: list[str]
|
319
|
+
List of Ollama containers running models in sidecars.
|
320
|
+
backend: str
|
321
|
+
Determines where and how to run the Ollama process.
|
322
|
+
force_pull: bool
|
323
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
324
|
+
skip_push_check: bool
|
325
|
+
Whether to skip the check that populates/overwrites remote cache on terminating an ollama model.
|
326
|
+
debug: bool
|
327
|
+
Whether to turn on verbose debugging logs.
|
274
328
|
"""
|
275
329
|
...
|
276
330
|
|
@@ -300,85 +354,105 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
|
|
300
354
|
...
|
301
355
|
|
302
356
|
@typing.overload
|
303
|
-
def
|
357
|
+
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]]]:
|
304
358
|
"""
|
305
|
-
Specifies
|
359
|
+
Specifies the number of times the task corresponding
|
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)`.
|
365
|
+
|
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.
|
306
369
|
|
307
370
|
|
308
371
|
Parameters
|
309
372
|
----------
|
310
|
-
|
311
|
-
|
373
|
+
times : int, default 3
|
374
|
+
Number of times to retry this task.
|
375
|
+
minutes_between_retries : int, default 2
|
376
|
+
Number of minutes between retries.
|
312
377
|
"""
|
313
378
|
...
|
314
379
|
|
315
380
|
@typing.overload
|
316
|
-
def
|
381
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
317
382
|
...
|
318
383
|
|
319
384
|
@typing.overload
|
320
|
-
def
|
385
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
321
386
|
...
|
322
387
|
|
323
|
-
def
|
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):
|
324
389
|
"""
|
325
|
-
Specifies
|
390
|
+
Specifies the number of times the task corresponding
|
391
|
+
to a step needs to be retried.
|
326
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)`.
|
327
396
|
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
Dictionary of environment variables to set.
|
332
|
-
"""
|
333
|
-
...
|
334
|
-
|
335
|
-
def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
336
|
-
"""
|
337
|
-
Specifies that this step is used to deploy an instance of the app.
|
338
|
-
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
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.
|
339
400
|
|
340
401
|
|
341
402
|
Parameters
|
342
403
|
----------
|
343
|
-
|
344
|
-
Number of
|
345
|
-
|
346
|
-
|
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.
|
347
408
|
"""
|
348
409
|
...
|
349
410
|
|
350
411
|
@typing.overload
|
351
|
-
def
|
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]]]:
|
352
413
|
"""
|
353
|
-
Specifies
|
354
|
-
the execution of a step.
|
414
|
+
Specifies environment variables to be set prior to the execution of a step.
|
355
415
|
|
356
416
|
|
357
417
|
Parameters
|
358
418
|
----------
|
359
|
-
|
360
|
-
|
419
|
+
vars : Dict[str, str], default {}
|
420
|
+
Dictionary of environment variables to set.
|
361
421
|
"""
|
362
422
|
...
|
363
423
|
|
364
424
|
@typing.overload
|
365
|
-
def
|
425
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
366
426
|
...
|
367
427
|
|
368
428
|
@typing.overload
|
369
|
-
def
|
429
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
370
430
|
...
|
371
431
|
|
372
|
-
def
|
432
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
373
433
|
"""
|
374
|
-
Specifies
|
375
|
-
the execution of a step.
|
434
|
+
Specifies environment variables to be set prior to the execution of a step.
|
376
435
|
|
377
436
|
|
378
437
|
Parameters
|
379
438
|
----------
|
380
|
-
|
381
|
-
|
439
|
+
vars : Dict[str, str], default {}
|
440
|
+
Dictionary of environment variables to set.
|
441
|
+
"""
|
442
|
+
...
|
443
|
+
|
444
|
+
def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
445
|
+
"""
|
446
|
+
Specifies that this step is used to deploy an instance of the app.
|
447
|
+
Requires that self.app_name, self.app_port, self.entrypoint and self.deployDir is set.
|
448
|
+
|
449
|
+
|
450
|
+
Parameters
|
451
|
+
----------
|
452
|
+
app_port : int
|
453
|
+
Number of GPUs to use.
|
454
|
+
app_name : str
|
455
|
+
Name of the app to deploy.
|
382
456
|
"""
|
383
457
|
...
|
384
458
|
|
@@ -396,6 +470,25 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
|
|
396
470
|
"""
|
397
471
|
...
|
398
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
|
+
|
399
492
|
@typing.overload
|
400
493
|
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]]]:
|
401
494
|
"""
|
@@ -446,136 +539,94 @@ def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
446
539
|
...
|
447
540
|
|
448
541
|
@typing.overload
|
449
|
-
def
|
542
|
+
def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
450
543
|
"""
|
451
|
-
|
452
|
-
to a step needs to be retried.
|
453
|
-
|
454
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
455
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
456
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
544
|
+
Enables checkpointing for a step.
|
457
545
|
|
458
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
459
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
460
|
-
ensuring that the flow execution can continue.
|
461
546
|
|
462
547
|
|
463
548
|
Parameters
|
464
549
|
----------
|
465
|
-
|
466
|
-
|
467
|
-
|
468
|
-
|
550
|
+
load_policy : str, default: "fresh"
|
551
|
+
The policy for loading the checkpoint. The following policies are supported:
|
552
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
553
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
554
|
+
will be loaded at the start of the task.
|
555
|
+
- "none": Do not load any checkpoint
|
556
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
557
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
558
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
559
|
+
created within the task will be loaded when the task is retries execution on failure.
|
560
|
+
|
561
|
+
temp_dir_root : str, default: None
|
562
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
469
563
|
"""
|
470
564
|
...
|
471
565
|
|
472
566
|
@typing.overload
|
473
|
-
def
|
567
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
474
568
|
...
|
475
569
|
|
476
570
|
@typing.overload
|
477
|
-
def
|
571
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
478
572
|
...
|
479
573
|
|
480
|
-
def
|
574
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
481
575
|
"""
|
482
|
-
|
483
|
-
to a step needs to be retried.
|
484
|
-
|
485
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
486
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
487
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
576
|
+
Enables checkpointing for a step.
|
488
577
|
|
489
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
490
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
491
|
-
ensuring that the flow execution can continue.
|
492
578
|
|
493
579
|
|
494
580
|
Parameters
|
495
581
|
----------
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
582
|
+
load_policy : str, default: "fresh"
|
583
|
+
The policy for loading the checkpoint. The following policies are supported:
|
584
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
585
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
586
|
+
will be loaded at the start of the task.
|
587
|
+
- "none": Do not load any checkpoint
|
588
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
589
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
590
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
591
|
+
created within the task will be loaded when the task is retries execution on failure.
|
592
|
+
|
593
|
+
temp_dir_root : str, default: None
|
594
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
500
595
|
"""
|
501
596
|
...
|
502
597
|
|
503
598
|
@typing.overload
|
504
|
-
def
|
599
|
+
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]]]:
|
505
600
|
"""
|
506
|
-
Specifies
|
507
|
-
|
508
|
-
Use `@resources` to specify the resource requirements
|
509
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
510
|
-
|
511
|
-
You can choose the compute layer on the command line by executing e.g.
|
512
|
-
```
|
513
|
-
python myflow.py run --with batch
|
514
|
-
```
|
515
|
-
or
|
516
|
-
```
|
517
|
-
python myflow.py run --with kubernetes
|
518
|
-
```
|
519
|
-
which executes the flow on the desired system using the
|
520
|
-
requirements specified in `@resources`.
|
601
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
602
|
+
the execution of a step.
|
521
603
|
|
522
604
|
|
523
605
|
Parameters
|
524
606
|
----------
|
525
|
-
|
526
|
-
|
527
|
-
gpu : int, optional, default None
|
528
|
-
Number of GPUs required for this step.
|
529
|
-
disk : int, optional, default None
|
530
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
531
|
-
memory : int, default 4096
|
532
|
-
Memory size (in MB) required for this step.
|
533
|
-
shared_memory : int, optional, default None
|
534
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
535
|
-
This parameter maps to the `--shm-size` option in Docker.
|
607
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
608
|
+
List of secret specs, defining how the secrets are to be retrieved
|
536
609
|
"""
|
537
610
|
...
|
538
611
|
|
539
612
|
@typing.overload
|
540
|
-
def
|
613
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
541
614
|
...
|
542
615
|
|
543
616
|
@typing.overload
|
544
|
-
def
|
617
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
545
618
|
...
|
546
619
|
|
547
|
-
def
|
620
|
+
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]]] = []):
|
548
621
|
"""
|
549
|
-
Specifies
|
550
|
-
|
551
|
-
Use `@resources` to specify the resource requirements
|
552
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
553
|
-
|
554
|
-
You can choose the compute layer on the command line by executing e.g.
|
555
|
-
```
|
556
|
-
python myflow.py run --with batch
|
557
|
-
```
|
558
|
-
or
|
559
|
-
```
|
560
|
-
python myflow.py run --with kubernetes
|
561
|
-
```
|
562
|
-
which executes the flow on the desired system using the
|
563
|
-
requirements specified in `@resources`.
|
622
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
623
|
+
the execution of a step.
|
564
624
|
|
565
625
|
|
566
626
|
Parameters
|
567
627
|
----------
|
568
|
-
|
569
|
-
|
570
|
-
gpu : int, optional, default None
|
571
|
-
Number of GPUs required for this step.
|
572
|
-
disk : int, optional, default None
|
573
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
574
|
-
memory : int, default 4096
|
575
|
-
Memory size (in MB) required for this step.
|
576
|
-
shared_memory : int, optional, default None
|
577
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
578
|
-
This parameter maps to the `--shm-size` option in Docker.
|
628
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
629
|
+
List of secret specs, defining how the secrets are to be retrieved
|
579
630
|
"""
|
580
631
|
...
|
581
632
|
|
@@ -631,155 +682,195 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
631
682
|
...
|
632
683
|
|
633
684
|
@typing.overload
|
634
|
-
def
|
685
|
+
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]]]:
|
635
686
|
"""
|
636
|
-
Specifies the
|
687
|
+
Specifies that the step will success under all circumstances.
|
637
688
|
|
638
|
-
|
639
|
-
|
640
|
-
|
641
|
-
|
689
|
+
The decorator will create an optional artifact, specified by `var`, which
|
690
|
+
contains the exception raised. You can use it to detect the presence
|
691
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
692
|
+
are missing.
|
642
693
|
|
643
694
|
|
644
695
|
Parameters
|
645
696
|
----------
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
653
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
654
|
-
disabled : bool, default False
|
655
|
-
If set to True, disables @conda.
|
697
|
+
var : str, optional, default None
|
698
|
+
Name of the artifact in which to store the caught exception.
|
699
|
+
If not specified, the exception is not stored.
|
700
|
+
print_exception : bool, default True
|
701
|
+
Determines whether or not the exception is printed to
|
702
|
+
stdout when caught.
|
656
703
|
"""
|
657
704
|
...
|
658
705
|
|
659
706
|
@typing.overload
|
660
|
-
def
|
707
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
661
708
|
...
|
662
709
|
|
663
710
|
@typing.overload
|
664
|
-
def
|
711
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
665
712
|
...
|
666
713
|
|
667
|
-
def
|
714
|
+
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):
|
668
715
|
"""
|
669
|
-
Specifies the
|
716
|
+
Specifies that the step will success under all circumstances.
|
670
717
|
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
718
|
+
The decorator will create an optional artifact, specified by `var`, which
|
719
|
+
contains the exception raised. You can use it to detect the presence
|
720
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
721
|
+
are missing.
|
675
722
|
|
676
723
|
|
677
724
|
Parameters
|
678
725
|
----------
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
686
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
687
|
-
disabled : bool, default False
|
688
|
-
If set to True, disables @conda.
|
726
|
+
var : str, optional, default None
|
727
|
+
Name of the artifact in which to store the caught exception.
|
728
|
+
If not specified, the exception is not stored.
|
729
|
+
print_exception : bool, default True
|
730
|
+
Determines whether or not the exception is printed to
|
731
|
+
stdout when caught.
|
689
732
|
"""
|
690
733
|
...
|
691
734
|
|
692
735
|
@typing.overload
|
693
|
-
def
|
736
|
+
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]]]:
|
694
737
|
"""
|
695
|
-
Enables
|
738
|
+
Enables loading / saving of models within a step.
|
696
739
|
|
697
740
|
|
698
741
|
|
699
742
|
Parameters
|
700
743
|
----------
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
|
709
|
-
|
710
|
-
|
744
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
745
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
746
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
747
|
+
- `current.checkpoint`
|
748
|
+
- `current.model`
|
749
|
+
- `current.huggingface_hub`
|
750
|
+
|
751
|
+
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
|
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.
|
711
754
|
|
712
755
|
temp_dir_root : str, default: None
|
713
|
-
The root directory under which `current.
|
756
|
+
The root directory under which `current.model.loaded` will store loaded models
|
714
757
|
"""
|
715
758
|
...
|
716
759
|
|
717
760
|
@typing.overload
|
718
|
-
def
|
761
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
719
762
|
...
|
720
763
|
|
721
764
|
@typing.overload
|
722
|
-
def
|
765
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
723
766
|
...
|
724
767
|
|
725
|
-
def
|
768
|
+
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):
|
726
769
|
"""
|
727
|
-
Enables
|
770
|
+
Enables loading / saving of models within a step.
|
728
771
|
|
729
772
|
|
730
773
|
|
731
774
|
Parameters
|
732
775
|
----------
|
733
|
-
|
734
|
-
|
735
|
-
|
736
|
-
|
737
|
-
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
776
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
777
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
778
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
779
|
+
- `current.checkpoint`
|
780
|
+
- `current.model`
|
781
|
+
- `current.huggingface_hub`
|
782
|
+
|
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.
|
743
786
|
|
744
787
|
temp_dir_root : str, default: None
|
745
|
-
The root directory under which `current.
|
788
|
+
The root directory under which `current.model.loaded` will store loaded models
|
746
789
|
"""
|
747
790
|
...
|
748
791
|
|
749
|
-
def
|
792
|
+
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]]]:
|
750
793
|
"""
|
751
|
-
|
752
|
-
|
753
|
-
User code call
|
754
|
-
--------------
|
755
|
-
@ollama(
|
756
|
-
models=[...],
|
757
|
-
...
|
758
|
-
)
|
759
|
-
|
760
|
-
Valid backend options
|
761
|
-
---------------------
|
762
|
-
- 'local': Run as a separate process on the local task machine.
|
763
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
764
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
765
|
-
|
766
|
-
Valid model options
|
767
|
-
-------------------
|
768
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
794
|
+
Specifies that this step should execute on Kubernetes.
|
769
795
|
|
770
796
|
|
771
797
|
Parameters
|
772
798
|
----------
|
773
|
-
|
774
|
-
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
799
|
+
cpu : int, default 1
|
800
|
+
Number of CPUs required for this step. If `@resources` is
|
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
|
783
874
|
"""
|
784
875
|
...
|
785
876
|
|
@@ -800,220 +891,255 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
|
|
800
891
|
...
|
801
892
|
|
802
893
|
@typing.overload
|
803
|
-
def
|
894
|
+
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]]]:
|
804
895
|
"""
|
805
|
-
Specifies
|
896
|
+
Specifies the Conda environment for the step.
|
806
897
|
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
898
|
+
Information in this decorator will augment any
|
899
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
900
|
+
you can use `@conda_base` to set packages required by all
|
901
|
+
steps and use `@conda` to specify step-specific overrides.
|
811
902
|
|
812
903
|
|
813
904
|
Parameters
|
814
905
|
----------
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
|
906
|
+
packages : Dict[str, str], default {}
|
907
|
+
Packages to use for this step. The key is the name of the package
|
908
|
+
and the value is the version to use.
|
909
|
+
libraries : Dict[str, str], default {}
|
910
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
911
|
+
python : str, optional, default None
|
912
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
913
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
914
|
+
disabled : bool, default False
|
915
|
+
If set to True, disables @conda.
|
821
916
|
"""
|
822
917
|
...
|
823
918
|
|
824
919
|
@typing.overload
|
825
|
-
def
|
920
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
826
921
|
...
|
827
922
|
|
828
923
|
@typing.overload
|
829
|
-
def
|
924
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
830
925
|
...
|
831
926
|
|
832
|
-
def
|
927
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
833
928
|
"""
|
834
|
-
Specifies
|
929
|
+
Specifies the Conda environment for the step.
|
835
930
|
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
931
|
+
Information in this decorator will augment any
|
932
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
933
|
+
you can use `@conda_base` to set packages required by all
|
934
|
+
steps and use `@conda` to specify step-specific overrides.
|
840
935
|
|
841
936
|
|
842
937
|
Parameters
|
843
938
|
----------
|
844
|
-
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
939
|
+
packages : Dict[str, str], default {}
|
940
|
+
Packages to use for this step. The key is the name of the package
|
941
|
+
and the value is the version to use.
|
942
|
+
libraries : Dict[str, str], default {}
|
943
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
944
|
+
python : str, optional, default None
|
945
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
946
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
947
|
+
disabled : bool, default False
|
948
|
+
If set to True, disables @conda.
|
850
949
|
"""
|
851
950
|
...
|
852
951
|
|
853
952
|
@typing.overload
|
854
|
-
def
|
953
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
855
954
|
"""
|
856
|
-
|
955
|
+
Internal decorator to support Fast bakery
|
956
|
+
"""
|
957
|
+
...
|
958
|
+
|
959
|
+
@typing.overload
|
960
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
961
|
+
...
|
962
|
+
|
963
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
964
|
+
"""
|
965
|
+
Internal decorator to support Fast bakery
|
966
|
+
"""
|
967
|
+
...
|
968
|
+
|
969
|
+
@typing.overload
|
970
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
971
|
+
"""
|
972
|
+
Specifies the flow(s) that this flow depends on.
|
857
973
|
|
858
|
-
|
974
|
+
```
|
975
|
+
@trigger_on_finish(flow='FooFlow')
|
976
|
+
```
|
977
|
+
or
|
978
|
+
```
|
979
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
980
|
+
```
|
981
|
+
This decorator respects the @project decorator and triggers the flow
|
982
|
+
when upstream runs within the same namespace complete successfully
|
859
983
|
|
860
|
-
|
861
|
-
|
862
|
-
|
984
|
+
Additionally, you can specify project aware upstream flow dependencies
|
985
|
+
by specifying the fully qualified project_flow_name.
|
986
|
+
```
|
987
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
988
|
+
```
|
989
|
+
or
|
990
|
+
```
|
991
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
992
|
+
```
|
863
993
|
|
864
|
-
|
865
|
-
|
994
|
+
You can also specify just the project or project branch (other values will be
|
995
|
+
inferred from the current project or project branch):
|
996
|
+
```
|
997
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
998
|
+
```
|
999
|
+
|
1000
|
+
Note that `branch` is typically one of:
|
1001
|
+
- `prod`
|
1002
|
+
- `user.bob`
|
1003
|
+
- `test.my_experiment`
|
1004
|
+
- `prod.staging`
|
866
1005
|
|
867
1006
|
|
868
1007
|
Parameters
|
869
1008
|
----------
|
870
|
-
|
871
|
-
|
872
|
-
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
"""
|
877
|
-
...
|
878
|
-
|
879
|
-
@typing.overload
|
880
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1009
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1010
|
+
Upstream flow dependency for this flow.
|
1011
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1012
|
+
Upstream flow dependencies for this flow.
|
1013
|
+
options : Dict[str, Any], default {}
|
1014
|
+
Backend-specific configuration for tuning eventing behavior.
|
1015
|
+
"""
|
881
1016
|
...
|
882
1017
|
|
883
1018
|
@typing.overload
|
884
|
-
def
|
1019
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
885
1020
|
...
|
886
1021
|
|
887
|
-
def
|
1022
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
888
1023
|
"""
|
889
|
-
Specifies
|
1024
|
+
Specifies the flow(s) that this flow depends on.
|
890
1025
|
|
891
|
-
|
1026
|
+
```
|
1027
|
+
@trigger_on_finish(flow='FooFlow')
|
1028
|
+
```
|
1029
|
+
or
|
1030
|
+
```
|
1031
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1032
|
+
```
|
1033
|
+
This decorator respects the @project decorator and triggers the flow
|
1034
|
+
when upstream runs within the same namespace complete successfully
|
892
1035
|
|
893
|
-
|
894
|
-
|
895
|
-
|
1036
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1037
|
+
by specifying the fully qualified project_flow_name.
|
1038
|
+
```
|
1039
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1040
|
+
```
|
1041
|
+
or
|
1042
|
+
```
|
1043
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1044
|
+
```
|
896
1045
|
|
897
|
-
|
898
|
-
|
1046
|
+
You can also specify just the project or project branch (other values will be
|
1047
|
+
inferred from the current project or project branch):
|
1048
|
+
```
|
1049
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1050
|
+
```
|
1051
|
+
|
1052
|
+
Note that `branch` is typically one of:
|
1053
|
+
- `prod`
|
1054
|
+
- `user.bob`
|
1055
|
+
- `test.my_experiment`
|
1056
|
+
- `prod.staging`
|
899
1057
|
|
900
1058
|
|
901
1059
|
Parameters
|
902
1060
|
----------
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
1061
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1062
|
+
Upstream flow dependency for this flow.
|
1063
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1064
|
+
Upstream flow dependencies for this flow.
|
1065
|
+
options : Dict[str, Any], default {}
|
1066
|
+
Backend-specific configuration for tuning eventing behavior.
|
909
1067
|
"""
|
910
1068
|
...
|
911
1069
|
|
912
1070
|
@typing.overload
|
913
|
-
def
|
1071
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
914
1072
|
"""
|
915
|
-
|
916
|
-
|
1073
|
+
Specifies the PyPI packages for all steps of the flow.
|
917
1074
|
|
1075
|
+
Use `@pypi_base` to set common packages required by all
|
1076
|
+
steps and use `@pypi` to specify step-specific overrides.
|
918
1077
|
|
919
1078
|
Parameters
|
920
1079
|
----------
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
926
|
-
|
927
|
-
|
928
|
-
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
|
929
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
930
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
931
|
-
|
932
|
-
temp_dir_root : str, default: None
|
933
|
-
The root directory under which `current.model.loaded` will store loaded models
|
1080
|
+
packages : Dict[str, str], default: {}
|
1081
|
+
Packages to use for this flow. The key is the name of the package
|
1082
|
+
and the value is the version to use.
|
1083
|
+
python : str, optional, default: None
|
1084
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1085
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
934
1086
|
"""
|
935
1087
|
...
|
936
1088
|
|
937
1089
|
@typing.overload
|
938
|
-
def
|
939
|
-
...
|
940
|
-
|
941
|
-
@typing.overload
|
942
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1090
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
943
1091
|
...
|
944
1092
|
|
945
|
-
def
|
1093
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
946
1094
|
"""
|
947
|
-
|
948
|
-
|
1095
|
+
Specifies the PyPI packages for all steps of the flow.
|
949
1096
|
|
1097
|
+
Use `@pypi_base` to set common packages required by all
|
1098
|
+
steps and use `@pypi` to specify step-specific overrides.
|
950
1099
|
|
951
1100
|
Parameters
|
952
1101
|
----------
|
953
|
-
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
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
|
961
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
962
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
963
|
-
|
964
|
-
temp_dir_root : str, default: None
|
965
|
-
The root directory under which `current.model.loaded` will store loaded models
|
1102
|
+
packages : Dict[str, str], default: {}
|
1103
|
+
Packages to use for this flow. The key is the name of the package
|
1104
|
+
and the value is the version to use.
|
1105
|
+
python : str, optional, default: None
|
1106
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1107
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
966
1108
|
"""
|
967
1109
|
...
|
968
1110
|
|
969
|
-
|
970
|
-
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]]:
|
1111
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
971
1112
|
"""
|
972
|
-
Specifies
|
973
|
-
|
1113
|
+
Specifies what flows belong to the same project.
|
1114
|
+
|
1115
|
+
A project-specific namespace is created for all flows that
|
1116
|
+
use the same `@project(name)`.
|
974
1117
|
|
975
1118
|
|
976
1119
|
Parameters
|
977
1120
|
----------
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
weekly : bool, default False
|
983
|
-
Run the workflow weekly.
|
984
|
-
cron : str, optional, default None
|
985
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
986
|
-
specified by this expression.
|
987
|
-
timezone : str, optional, default None
|
988
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
989
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
990
|
-
"""
|
991
|
-
...
|
992
|
-
|
993
|
-
@typing.overload
|
994
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
995
|
-
...
|
996
|
-
|
997
|
-
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):
|
998
|
-
"""
|
999
|
-
Specifies the times when the flow should be run when running on a
|
1000
|
-
production scheduler.
|
1121
|
+
name : str
|
1122
|
+
Project name. Make sure that the name is unique amongst all
|
1123
|
+
projects that use the same production scheduler. The name may
|
1124
|
+
contain only lowercase alphanumeric characters and underscores.
|
1001
1125
|
|
1126
|
+
branch : Optional[str], default None
|
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.
|
1002
1131
|
|
1003
|
-
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1014
|
-
timezone : str, optional, default None
|
1015
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1016
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
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>`
|
1017
1143
|
"""
|
1018
1144
|
...
|
1019
1145
|
|
@@ -1131,81 +1257,54 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1131
1257
|
"""
|
1132
1258
|
...
|
1133
1259
|
|
1134
|
-
|
1260
|
+
@typing.overload
|
1261
|
+
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1135
1262
|
"""
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
starts only after all sensors finish.
|
1263
|
+
Specifies the Conda environment for all steps of the flow.
|
1264
|
+
|
1265
|
+
Use `@conda_base` to set common libraries required by all
|
1266
|
+
steps and use `@conda` to specify step-specific additions.
|
1141
1267
|
|
1142
1268
|
|
1143
1269
|
Parameters
|
1144
1270
|
----------
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
1148
|
-
|
1149
|
-
|
1150
|
-
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
1154
|
-
|
1155
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1156
|
-
soft_fail : bool
|
1157
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1158
|
-
name : str
|
1159
|
-
Name of the sensor on Airflow
|
1160
|
-
description : str
|
1161
|
-
Description of sensor in the Airflow UI
|
1162
|
-
bucket_key : Union[str, List[str]]
|
1163
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1164
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1165
|
-
bucket_name : str
|
1166
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1167
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1168
|
-
wildcard_match : bool
|
1169
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1170
|
-
aws_conn_id : str
|
1171
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1172
|
-
verify : bool
|
1173
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1271
|
+
packages : Dict[str, str], default {}
|
1272
|
+
Packages to use for this flow. The key is the name of the package
|
1273
|
+
and the value is the version to use.
|
1274
|
+
libraries : Dict[str, str], default {}
|
1275
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1276
|
+
python : str, optional, default None
|
1277
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1278
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1279
|
+
disabled : bool, default False
|
1280
|
+
If set to True, disables Conda.
|
1174
1281
|
"""
|
1175
1282
|
...
|
1176
1283
|
|
1177
|
-
|
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):
|
1178
1289
|
"""
|
1179
|
-
Specifies
|
1180
|
-
|
1181
|
-
A project-specific namespace is created for all flows that
|
1182
|
-
use the same `@project(name)`.
|
1183
|
-
|
1184
|
-
|
1185
|
-
Parameters
|
1186
|
-
----------
|
1187
|
-
name : str
|
1188
|
-
Project name. Make sure that the name is unique amongst all
|
1189
|
-
projects that use the same production scheduler. The name may
|
1190
|
-
contain only lowercase alphanumeric characters and underscores.
|
1290
|
+
Specifies the Conda environment for all steps of the flow.
|
1191
1291
|
|
1192
|
-
|
1193
|
-
|
1194
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1195
|
-
also be set on the command line using `--branch` as a top-level option.
|
1196
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1292
|
+
Use `@conda_base` to set common libraries required by all
|
1293
|
+
steps and use `@conda` to specify step-specific additions.
|
1197
1294
|
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
The
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
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.
|
1209
1308
|
"""
|
1210
1309
|
...
|
1211
1310
|
|
@@ -1302,47 +1401,6 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1302
1401
|
"""
|
1303
1402
|
...
|
1304
1403
|
|
1305
|
-
@typing.overload
|
1306
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1307
|
-
"""
|
1308
|
-
Specifies the PyPI packages for all steps of the flow.
|
1309
|
-
|
1310
|
-
Use `@pypi_base` to set common packages required by all
|
1311
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1312
|
-
|
1313
|
-
Parameters
|
1314
|
-
----------
|
1315
|
-
packages : Dict[str, str], default: {}
|
1316
|
-
Packages to use for this flow. The key is the name of the package
|
1317
|
-
and the value is the version to use.
|
1318
|
-
python : str, optional, default: None
|
1319
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1320
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1321
|
-
"""
|
1322
|
-
...
|
1323
|
-
|
1324
|
-
@typing.overload
|
1325
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1326
|
-
...
|
1327
|
-
|
1328
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1329
|
-
"""
|
1330
|
-
Specifies the PyPI packages for all steps of the flow.
|
1331
|
-
|
1332
|
-
Use `@pypi_base` to set common packages required by all
|
1333
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1334
|
-
|
1335
|
-
Parameters
|
1336
|
-
----------
|
1337
|
-
packages : Dict[str, str], default: {}
|
1338
|
-
Packages to use for this flow. The key is the name of the package
|
1339
|
-
and the value is the version to use.
|
1340
|
-
python : str, optional, default: None
|
1341
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1342
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1343
|
-
"""
|
1344
|
-
...
|
1345
|
-
|
1346
1404
|
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]]:
|
1347
1405
|
"""
|
1348
1406
|
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.
|
@@ -1386,155 +1444,97 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1386
1444
|
"""
|
1387
1445
|
...
|
1388
1446
|
|
1389
|
-
|
1390
|
-
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1391
|
-
"""
|
1392
|
-
Specifies the Conda environment for all steps of the flow.
|
1393
|
-
|
1394
|
-
Use `@conda_base` to set common libraries required by all
|
1395
|
-
steps and use `@conda` to specify step-specific additions.
|
1396
|
-
|
1397
|
-
|
1398
|
-
Parameters
|
1399
|
-
----------
|
1400
|
-
packages : Dict[str, str], default {}
|
1401
|
-
Packages to use for this flow. The key is the name of the package
|
1402
|
-
and the value is the version to use.
|
1403
|
-
libraries : Dict[str, str], default {}
|
1404
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1405
|
-
python : str, optional, default None
|
1406
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1407
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1408
|
-
disabled : bool, default False
|
1409
|
-
If set to True, disables Conda.
|
1410
|
-
"""
|
1411
|
-
...
|
1412
|
-
|
1413
|
-
@typing.overload
|
1414
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1415
|
-
...
|
1416
|
-
|
1417
|
-
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):
|
1447
|
+
def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, bucket_key: typing.Union[str, typing.List[str]], bucket_name: str, wildcard_match: bool, aws_conn_id: str, verify: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1418
1448
|
"""
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1449
|
+
The `@airflow_s3_key_sensor` decorator attaches a Airflow [S3KeySensor](https://airflow.apache.org/docs/apache-airflow-providers-amazon/stable/_api/airflow/providers/amazon/aws/sensors/s3/index.html#airflow.providers.amazon.aws.sensors.s3.S3KeySensor)
|
1450
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1451
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1452
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1453
|
+
starts only after all sensors finish.
|
1423
1454
|
|
1424
1455
|
|
1425
1456
|
Parameters
|
1426
1457
|
----------
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
|
1431
|
-
|
1432
|
-
|
1433
|
-
|
1434
|
-
|
1435
|
-
|
1436
|
-
|
1458
|
+
timeout : int
|
1459
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1460
|
+
poke_interval : int
|
1461
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1462
|
+
mode : str
|
1463
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1464
|
+
exponential_backoff : bool
|
1465
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1466
|
+
pool : str
|
1467
|
+
the slot pool this task should run in,
|
1468
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1469
|
+
soft_fail : bool
|
1470
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1471
|
+
name : str
|
1472
|
+
Name of the sensor on Airflow
|
1473
|
+
description : str
|
1474
|
+
Description of sensor in the Airflow UI
|
1475
|
+
bucket_key : Union[str, List[str]]
|
1476
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1477
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1478
|
+
bucket_name : str
|
1479
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1480
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1481
|
+
wildcard_match : bool
|
1482
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1483
|
+
aws_conn_id : str
|
1484
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1485
|
+
verify : bool
|
1486
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1437
1487
|
"""
|
1438
1488
|
...
|
1439
1489
|
|
1440
1490
|
@typing.overload
|
1441
|
-
def
|
1491
|
+
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]]:
|
1442
1492
|
"""
|
1443
|
-
Specifies the
|
1444
|
-
|
1445
|
-
```
|
1446
|
-
@trigger_on_finish(flow='FooFlow')
|
1447
|
-
```
|
1448
|
-
or
|
1449
|
-
```
|
1450
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1451
|
-
```
|
1452
|
-
This decorator respects the @project decorator and triggers the flow
|
1453
|
-
when upstream runs within the same namespace complete successfully
|
1454
|
-
|
1455
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1456
|
-
by specifying the fully qualified project_flow_name.
|
1457
|
-
```
|
1458
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1459
|
-
```
|
1460
|
-
or
|
1461
|
-
```
|
1462
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1463
|
-
```
|
1464
|
-
|
1465
|
-
You can also specify just the project or project branch (other values will be
|
1466
|
-
inferred from the current project or project branch):
|
1467
|
-
```
|
1468
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1469
|
-
```
|
1470
|
-
|
1471
|
-
Note that `branch` is typically one of:
|
1472
|
-
- `prod`
|
1473
|
-
- `user.bob`
|
1474
|
-
- `test.my_experiment`
|
1475
|
-
- `prod.staging`
|
1493
|
+
Specifies the times when the flow should be run when running on a
|
1494
|
+
production scheduler.
|
1476
1495
|
|
1477
1496
|
|
1478
1497
|
Parameters
|
1479
1498
|
----------
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1499
|
+
hourly : bool, default False
|
1500
|
+
Run the workflow hourly.
|
1501
|
+
daily : bool, default True
|
1502
|
+
Run the workflow daily.
|
1503
|
+
weekly : bool, default False
|
1504
|
+
Run the workflow weekly.
|
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).
|
1486
1511
|
"""
|
1487
1512
|
...
|
1488
1513
|
|
1489
1514
|
@typing.overload
|
1490
|
-
def
|
1515
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1491
1516
|
...
|
1492
1517
|
|
1493
|
-
def
|
1518
|
+
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):
|
1494
1519
|
"""
|
1495
|
-
Specifies the
|
1496
|
-
|
1497
|
-
```
|
1498
|
-
@trigger_on_finish(flow='FooFlow')
|
1499
|
-
```
|
1500
|
-
or
|
1501
|
-
```
|
1502
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1503
|
-
```
|
1504
|
-
This decorator respects the @project decorator and triggers the flow
|
1505
|
-
when upstream runs within the same namespace complete successfully
|
1506
|
-
|
1507
|
-
Additionally, you can specify project aware upstream flow dependencies
|
1508
|
-
by specifying the fully qualified project_flow_name.
|
1509
|
-
```
|
1510
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1511
|
-
```
|
1512
|
-
or
|
1513
|
-
```
|
1514
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1515
|
-
```
|
1516
|
-
|
1517
|
-
You can also specify just the project or project branch (other values will be
|
1518
|
-
inferred from the current project or project branch):
|
1519
|
-
```
|
1520
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1521
|
-
```
|
1522
|
-
|
1523
|
-
Note that `branch` is typically one of:
|
1524
|
-
- `prod`
|
1525
|
-
- `user.bob`
|
1526
|
-
- `test.my_experiment`
|
1527
|
-
- `prod.staging`
|
1520
|
+
Specifies the times when the flow should be run when running on a
|
1521
|
+
production scheduler.
|
1528
1522
|
|
1529
1523
|
|
1530
1524
|
Parameters
|
1531
1525
|
----------
|
1532
|
-
|
1533
|
-
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
1526
|
+
hourly : bool, default False
|
1527
|
+
Run the workflow hourly.
|
1528
|
+
daily : bool, default True
|
1529
|
+
Run the workflow daily.
|
1530
|
+
weekly : bool, default False
|
1531
|
+
Run the workflow weekly.
|
1532
|
+
cron : str, optional, default None
|
1533
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1534
|
+
specified by this expression.
|
1535
|
+
timezone : str, optional, default None
|
1536
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1537
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1538
1538
|
"""
|
1539
1539
|
...
|
1540
1540
|
|