ob-metaflow-stubs 6.0.3.153__py2.py3-none-any.whl → 6.0.3.155__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 +612 -612
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +4 -4
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/info_file.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +2 -2
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +94 -94
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +13 -13
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +11 -5
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +6 -6
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +3 -3
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +5 -5
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +4 -4
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.3.153.dist-info → ob_metaflow_stubs-6.0.3.155.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.3.155.dist-info/RECORD +198 -0
- ob_metaflow_stubs-6.0.3.153.dist-info/RECORD +0 -198
- {ob_metaflow_stubs-6.0.3.153.dist-info → ob_metaflow_stubs-6.0.3.155.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.153.dist-info → ob_metaflow_stubs-6.0.3.155.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.15.7.
|
4
|
-
# Generated on 2025-
|
3
|
+
# MF version: 2.15.7.2+obcheckpoint(0.1.9);ob(v1) #
|
4
|
+
# Generated on 2025-04-16T19:15:34.548479 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import typing
|
12
11
|
import datetime
|
12
|
+
import typing
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -149,279 +149,282 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
149
149
|
"""
|
150
150
|
...
|
151
151
|
|
152
|
-
|
153
|
-
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]]]:
|
152
|
+
def ollama(*, models: "list[Ollama]", backend: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
154
153
|
"""
|
155
|
-
|
154
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
156
155
|
|
157
|
-
|
156
|
+
User code call
|
157
|
+
-----------
|
158
|
+
@ollama(
|
159
|
+
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
160
|
+
backend='local'
|
161
|
+
)
|
162
|
+
|
163
|
+
Valid backend options
|
164
|
+
---------------------
|
165
|
+
- 'local': Run as a separate process on the local task machine.
|
166
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
167
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
168
|
+
|
169
|
+
Valid model options
|
170
|
+
----------------
|
171
|
+
- 'llama3.2'
|
172
|
+
- 'llama3.3'
|
173
|
+
- any model here https://ollama.com/search
|
158
174
|
|
159
175
|
|
160
176
|
Parameters
|
161
177
|
----------
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
options : Dict[str, Any], default {}
|
167
|
-
Options passed to the card. The contents depend on the card type.
|
168
|
-
timeout : int, default 45
|
169
|
-
Interrupt reporting if it takes more than this many seconds.
|
178
|
+
models: list[Ollama]
|
179
|
+
List of Ollama containers running models in sidecars.
|
180
|
+
backend: str
|
181
|
+
Determines where and how to run the Ollama process.
|
170
182
|
"""
|
171
183
|
...
|
172
184
|
|
173
|
-
|
174
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
175
|
-
...
|
176
|
-
|
177
|
-
@typing.overload
|
178
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
179
|
-
...
|
180
|
-
|
181
|
-
def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
|
185
|
+
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') -> 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]]]:
|
182
186
|
"""
|
183
|
-
|
184
|
-
|
185
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
187
|
+
Specifies that this step should execute on Kubernetes.
|
186
188
|
|
187
189
|
|
188
190
|
Parameters
|
189
191
|
----------
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
192
|
+
cpu : int, default 1
|
193
|
+
Number of CPUs required for this step. If `@resources` is
|
194
|
+
also present, the maximum value from all decorators is used.
|
195
|
+
memory : int, default 4096
|
196
|
+
Memory size (in MB) required for this step. If
|
197
|
+
`@resources` is also present, the maximum value from all decorators is
|
198
|
+
used.
|
199
|
+
disk : int, default 10240
|
200
|
+
Disk size (in MB) required for this step. If
|
201
|
+
`@resources` is also present, the maximum value from all decorators is
|
202
|
+
used.
|
203
|
+
image : str, optional, default None
|
204
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
205
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
206
|
+
not, a default Docker image mapping to the current version of Python is used.
|
207
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
208
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
209
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
210
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
211
|
+
secrets : List[str], optional, default None
|
212
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
213
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
214
|
+
in Metaflow configuration.
|
215
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
216
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
217
|
+
Can be passed in as a comma separated string of values e.g.
|
218
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
219
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
220
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
221
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
222
|
+
gpu : int, optional, default None
|
223
|
+
Number of GPUs required for this step. A value of zero implies that
|
224
|
+
the scheduled node should not have GPUs.
|
225
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
226
|
+
The vendor of the GPUs to be used for this step.
|
227
|
+
tolerations : List[str], default []
|
228
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
229
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
230
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
231
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
232
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
233
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
234
|
+
use_tmpfs : bool, default False
|
235
|
+
This enables an explicit tmpfs mount for this step.
|
236
|
+
tmpfs_tempdir : bool, default True
|
237
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
238
|
+
tmpfs_size : int, optional, default: None
|
239
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
240
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
241
|
+
memory allocated for this step.
|
242
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
243
|
+
Path to tmpfs mount for this step.
|
244
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
245
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
246
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
247
|
+
shared_memory: int, optional
|
248
|
+
Shared memory size (in MiB) required for this step
|
249
|
+
port: int, optional
|
250
|
+
Port number to specify in the Kubernetes job object
|
251
|
+
compute_pool : str, optional, default None
|
252
|
+
Compute pool to be used for for this step.
|
253
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
254
|
+
hostname_resolution_timeout: int, default 10 * 60
|
255
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
256
|
+
Only applicable when @parallel is used.
|
257
|
+
qos: str, default: Burstable
|
258
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
198
259
|
"""
|
199
260
|
...
|
200
261
|
|
201
262
|
@typing.overload
|
202
|
-
def
|
263
|
+
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]]]:
|
203
264
|
"""
|
204
|
-
Enables
|
265
|
+
Enables loading / saving of models within a step.
|
205
266
|
|
206
267
|
|
207
268
|
|
208
269
|
Parameters
|
209
270
|
----------
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
271
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
272
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
273
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
274
|
+
- `current.checkpoint`
|
275
|
+
- `current.model`
|
276
|
+
- `current.huggingface_hub`
|
277
|
+
|
278
|
+
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
|
279
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
280
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
220
281
|
|
221
282
|
temp_dir_root : str, default: None
|
222
|
-
The root directory under which `current.
|
283
|
+
The root directory under which `current.model.loaded` will store loaded models
|
223
284
|
"""
|
224
285
|
...
|
225
286
|
|
226
287
|
@typing.overload
|
227
|
-
def
|
288
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
228
289
|
...
|
229
290
|
|
230
291
|
@typing.overload
|
231
|
-
def
|
292
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
232
293
|
...
|
233
294
|
|
234
|
-
def
|
295
|
+
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):
|
235
296
|
"""
|
236
|
-
Enables
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
Parameters
|
241
|
-
----------
|
242
|
-
load_policy : str, default: "fresh"
|
243
|
-
The policy for loading the checkpoint. The following policies are supported:
|
244
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
245
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
246
|
-
will be loaded at the start of the task.
|
247
|
-
- "none": Do not load any checkpoint
|
248
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
249
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
250
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
251
|
-
created within the task will be loaded when the task is retries execution on failure.
|
297
|
+
Enables loading / saving of models within a step.
|
252
298
|
|
253
|
-
temp_dir_root : str, default: None
|
254
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
255
|
-
"""
|
256
|
-
...
|
257
|
-
|
258
|
-
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
259
|
-
"""
|
260
|
-
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
261
299
|
|
262
300
|
|
263
301
|
Parameters
|
264
302
|
----------
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
303
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
304
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
305
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
306
|
+
- `current.checkpoint`
|
307
|
+
- `current.model`
|
308
|
+
- `current.huggingface_hub`
|
272
309
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
310
|
+
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
|
311
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
312
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
277
313
|
|
278
|
-
|
279
|
-
|
314
|
+
temp_dir_root : str, default: None
|
315
|
+
The root directory under which `current.model.loaded` will store loaded models
|
280
316
|
"""
|
281
317
|
...
|
282
318
|
|
283
319
|
@typing.overload
|
284
|
-
def
|
320
|
+
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]]]:
|
285
321
|
"""
|
286
|
-
Specifies
|
287
|
-
to a step needs to be retried.
|
288
|
-
|
289
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
290
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
291
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
292
|
-
|
293
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
294
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
295
|
-
ensuring that the flow execution can continue.
|
322
|
+
Specifies environment variables to be set prior to the execution of a step.
|
296
323
|
|
297
324
|
|
298
325
|
Parameters
|
299
326
|
----------
|
300
|
-
|
301
|
-
|
302
|
-
minutes_between_retries : int, default 2
|
303
|
-
Number of minutes between retries.
|
327
|
+
vars : Dict[str, str], default {}
|
328
|
+
Dictionary of environment variables to set.
|
304
329
|
"""
|
305
330
|
...
|
306
331
|
|
307
332
|
@typing.overload
|
308
|
-
def
|
333
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
309
334
|
...
|
310
335
|
|
311
336
|
@typing.overload
|
312
|
-
def
|
337
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
313
338
|
...
|
314
339
|
|
315
|
-
def
|
340
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
316
341
|
"""
|
317
|
-
Specifies
|
318
|
-
to a step needs to be retried.
|
319
|
-
|
320
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
321
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
322
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
323
|
-
|
324
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
325
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
326
|
-
ensuring that the flow execution can continue.
|
342
|
+
Specifies environment variables to be set prior to the execution of a step.
|
327
343
|
|
328
344
|
|
329
345
|
Parameters
|
330
346
|
----------
|
331
|
-
|
332
|
-
|
333
|
-
minutes_between_retries : int, default 2
|
334
|
-
Number of minutes between retries.
|
347
|
+
vars : Dict[str, str], default {}
|
348
|
+
Dictionary of environment variables to set.
|
335
349
|
"""
|
336
350
|
...
|
337
351
|
|
338
352
|
@typing.overload
|
339
|
-
def
|
353
|
+
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]]]:
|
340
354
|
"""
|
341
|
-
|
355
|
+
Specifies the resources needed when executing this step.
|
342
356
|
|
357
|
+
Use `@resources` to specify the resource requirements
|
358
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
359
|
+
|
360
|
+
You can choose the compute layer on the command line by executing e.g.
|
361
|
+
```
|
362
|
+
python myflow.py run --with batch
|
363
|
+
```
|
364
|
+
or
|
365
|
+
```
|
366
|
+
python myflow.py run --with kubernetes
|
367
|
+
```
|
368
|
+
which executes the flow on the desired system using the
|
369
|
+
requirements specified in `@resources`.
|
343
370
|
|
344
371
|
|
345
372
|
Parameters
|
346
373
|
----------
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
temp_dir_root : str, default: None
|
359
|
-
The root directory under which `current.model.loaded` will store loaded models
|
374
|
+
cpu : int, default 1
|
375
|
+
Number of CPUs required for this step.
|
376
|
+
gpu : int, optional, default None
|
377
|
+
Number of GPUs required for this step.
|
378
|
+
disk : int, optional, default None
|
379
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
380
|
+
memory : int, default 4096
|
381
|
+
Memory size (in MB) required for this step.
|
382
|
+
shared_memory : int, optional, default None
|
383
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
384
|
+
This parameter maps to the `--shm-size` option in Docker.
|
360
385
|
"""
|
361
386
|
...
|
362
387
|
|
363
388
|
@typing.overload
|
364
|
-
def
|
389
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
365
390
|
...
|
366
391
|
|
367
392
|
@typing.overload
|
368
|
-
def
|
369
|
-
...
|
370
|
-
|
371
|
-
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):
|
372
|
-
"""
|
373
|
-
Enables loading / saving of models within a step.
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
Parameters
|
378
|
-
----------
|
379
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
380
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
381
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by:
|
382
|
-
- `current.checkpoint`
|
383
|
-
- `current.model`
|
384
|
-
- `current.huggingface_hub`
|
385
|
-
|
386
|
-
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
|
387
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
388
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
389
|
-
|
390
|
-
temp_dir_root : str, default: None
|
391
|
-
The root directory under which `current.model.loaded` will store loaded models
|
392
|
-
"""
|
393
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
393
394
|
...
|
394
395
|
|
395
|
-
def
|
396
|
+
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):
|
396
397
|
"""
|
397
|
-
|
398
|
-
|
399
|
-
User code call
|
400
|
-
-----------
|
401
|
-
@nim(
|
402
|
-
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
403
|
-
backend='managed'
|
404
|
-
)
|
398
|
+
Specifies the resources needed when executing this step.
|
405
399
|
|
406
|
-
|
407
|
-
|
408
|
-
- 'managed': Outerbounds selects a compute provider based on the model.
|
400
|
+
Use `@resources` to specify the resource requirements
|
401
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
409
402
|
|
410
|
-
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
403
|
+
You can choose the compute layer on the command line by executing e.g.
|
404
|
+
```
|
405
|
+
python myflow.py run --with batch
|
406
|
+
```
|
407
|
+
or
|
408
|
+
```
|
409
|
+
python myflow.py run --with kubernetes
|
410
|
+
```
|
411
|
+
which executes the flow on the desired system using the
|
412
|
+
requirements specified in `@resources`.
|
415
413
|
|
416
414
|
|
417
415
|
Parameters
|
418
416
|
----------
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
417
|
+
cpu : int, default 1
|
418
|
+
Number of CPUs required for this step.
|
419
|
+
gpu : int, optional, default None
|
420
|
+
Number of GPUs required for this step.
|
421
|
+
disk : int, optional, default None
|
422
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
423
|
+
memory : int, default 4096
|
424
|
+
Memory size (in MB) required for this step.
|
425
|
+
shared_memory : int, optional, default None
|
426
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
427
|
+
This parameter maps to the `--shm-size` option in Docker.
|
425
428
|
"""
|
426
429
|
...
|
427
430
|
|
@@ -476,19 +479,52 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
476
479
|
"""
|
477
480
|
...
|
478
481
|
|
479
|
-
|
482
|
+
@typing.overload
|
483
|
+
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]]]:
|
480
484
|
"""
|
481
|
-
|
485
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
486
|
+
|
487
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
482
488
|
|
483
489
|
|
484
490
|
Parameters
|
485
491
|
----------
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
+
type : str, default 'default'
|
493
|
+
Card type.
|
494
|
+
id : str, optional, default None
|
495
|
+
If multiple cards are present, use this id to identify this card.
|
496
|
+
options : Dict[str, Any], default {}
|
497
|
+
Options passed to the card. The contents depend on the card type.
|
498
|
+
timeout : int, default 45
|
499
|
+
Interrupt reporting if it takes more than this many seconds.
|
500
|
+
"""
|
501
|
+
...
|
502
|
+
|
503
|
+
@typing.overload
|
504
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
505
|
+
...
|
506
|
+
|
507
|
+
@typing.overload
|
508
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
509
|
+
...
|
510
|
+
|
511
|
+
def card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, type: str = 'default', id: typing.Optional[str] = None, options: typing.Dict[str, typing.Any] = {}, timeout: int = 45):
|
512
|
+
"""
|
513
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
514
|
+
|
515
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
516
|
+
|
517
|
+
|
518
|
+
Parameters
|
519
|
+
----------
|
520
|
+
type : str, default 'default'
|
521
|
+
Card type.
|
522
|
+
id : str, optional, default None
|
523
|
+
If multiple cards are present, use this id to identify this card.
|
524
|
+
options : Dict[str, Any], default {}
|
525
|
+
Options passed to the card. The contents depend on the card type.
|
526
|
+
timeout : int, default 45
|
527
|
+
Interrupt reporting if it takes more than this many seconds.
|
492
528
|
"""
|
493
529
|
...
|
494
530
|
|
@@ -551,6 +587,42 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
551
587
|
"""
|
552
588
|
...
|
553
589
|
|
590
|
+
@typing.overload
|
591
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
592
|
+
"""
|
593
|
+
Internal decorator to support Fast bakery
|
594
|
+
"""
|
595
|
+
...
|
596
|
+
|
597
|
+
@typing.overload
|
598
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
599
|
+
...
|
600
|
+
|
601
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
602
|
+
"""
|
603
|
+
Internal decorator to support Fast bakery
|
604
|
+
"""
|
605
|
+
...
|
606
|
+
|
607
|
+
@typing.overload
|
608
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
609
|
+
"""
|
610
|
+
Decorator prototype for all step decorators. This function gets specialized
|
611
|
+
and imported for all decorators types by _import_plugin_decorators().
|
612
|
+
"""
|
613
|
+
...
|
614
|
+
|
615
|
+
@typing.overload
|
616
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
617
|
+
...
|
618
|
+
|
619
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
620
|
+
"""
|
621
|
+
Decorator prototype for all step decorators. This function gets specialized
|
622
|
+
and imported for all decorators types by _import_plugin_decorators().
|
623
|
+
"""
|
624
|
+
...
|
625
|
+
|
554
626
|
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]]]:
|
555
627
|
"""
|
556
628
|
Specifies that this step is used to deploy an instance of the app.
|
@@ -567,200 +639,172 @@ def app_deploy(*, app_port: int, app_name: str) -> typing.Callable[[typing.Union
|
|
567
639
|
...
|
568
640
|
|
569
641
|
@typing.overload
|
570
|
-
def
|
642
|
+
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]]]:
|
571
643
|
"""
|
572
|
-
|
573
|
-
|
644
|
+
Enables checkpointing for a step.
|
645
|
+
|
574
646
|
|
575
647
|
|
576
648
|
Parameters
|
577
649
|
----------
|
578
|
-
|
579
|
-
|
650
|
+
load_policy : str, default: "fresh"
|
651
|
+
The policy for loading the checkpoint. The following policies are supported:
|
652
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
653
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
654
|
+
will be loaded at the start of the task.
|
655
|
+
- "none": Do not load any checkpoint
|
656
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
657
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
658
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
659
|
+
created within the task will be loaded when the task is retries execution on failure.
|
660
|
+
|
661
|
+
temp_dir_root : str, default: None
|
662
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
580
663
|
"""
|
581
664
|
...
|
582
665
|
|
583
666
|
@typing.overload
|
584
|
-
def
|
667
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
585
668
|
...
|
586
669
|
|
587
670
|
@typing.overload
|
588
|
-
def
|
671
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
589
672
|
...
|
590
673
|
|
591
|
-
def
|
674
|
+
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):
|
592
675
|
"""
|
593
|
-
|
594
|
-
|
676
|
+
Enables checkpointing for a step.
|
677
|
+
|
595
678
|
|
596
679
|
|
597
680
|
Parameters
|
598
681
|
----------
|
599
|
-
|
600
|
-
|
682
|
+
load_policy : str, default: "fresh"
|
683
|
+
The policy for loading the checkpoint. The following policies are supported:
|
684
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
685
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
686
|
+
will be loaded at the start of the task.
|
687
|
+
- "none": Do not load any checkpoint
|
688
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
689
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
690
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
691
|
+
created within the task will be loaded when the task is retries execution on failure.
|
692
|
+
|
693
|
+
temp_dir_root : str, default: None
|
694
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
601
695
|
"""
|
602
696
|
...
|
603
697
|
|
604
|
-
def
|
698
|
+
def nim(*, models: "list[NIM]", backend: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
605
699
|
"""
|
606
|
-
This decorator is used to run
|
700
|
+
This decorator is used to run NIM containers in Metaflow tasks as sidecars.
|
607
701
|
|
608
702
|
User code call
|
609
703
|
-----------
|
610
|
-
@
|
704
|
+
@nim(
|
611
705
|
models=['meta/llama3-8b-instruct', 'meta/llama3-70b-instruct'],
|
612
|
-
backend='
|
706
|
+
backend='managed'
|
613
707
|
)
|
614
708
|
|
615
709
|
Valid backend options
|
616
710
|
---------------------
|
617
|
-
- '
|
618
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
619
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
711
|
+
- 'managed': Outerbounds selects a compute provider based on the model.
|
620
712
|
|
621
713
|
Valid model options
|
622
714
|
----------------
|
623
|
-
- 'llama3
|
624
|
-
- 'llama3
|
625
|
-
- any model here https://
|
715
|
+
- 'meta/llama3-8b-instruct': 8B parameter model
|
716
|
+
- 'meta/llama3-70b-instruct': 70B parameter model
|
717
|
+
- any model here: https://nvcf.ngc.nvidia.com/functions?filter=nvidia-functions
|
626
718
|
|
627
719
|
|
628
720
|
Parameters
|
629
721
|
----------
|
630
|
-
models: list[
|
631
|
-
List of
|
722
|
+
models: list[NIM]
|
723
|
+
List of NIM containers running models in sidecars.
|
632
724
|
backend: str
|
633
|
-
|
725
|
+
Compute provider to run the NIM container.
|
726
|
+
queue_timeout : int
|
727
|
+
Time to keep the job in NVCF's queue.
|
634
728
|
"""
|
635
729
|
...
|
636
730
|
|
637
|
-
|
638
|
-
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
731
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
639
732
|
"""
|
640
|
-
|
641
|
-
|
642
|
-
Information in this decorator will augment any
|
643
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
644
|
-
you can use `@pypi_base` to set packages required by all
|
645
|
-
steps and use `@pypi` to specify step-specific overrides.
|
733
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
646
734
|
|
647
735
|
|
648
736
|
Parameters
|
649
737
|
----------
|
650
|
-
|
651
|
-
|
652
|
-
and the value is the version to use.
|
653
|
-
python : str, optional, default: None
|
654
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
655
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
656
|
-
"""
|
657
|
-
...
|
658
|
-
|
659
|
-
@typing.overload
|
660
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
661
|
-
...
|
662
|
-
|
663
|
-
@typing.overload
|
664
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
665
|
-
...
|
666
|
-
|
667
|
-
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
668
|
-
"""
|
669
|
-
Specifies the PyPI packages for the step.
|
738
|
+
temp_dir_root : str, optional
|
739
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
670
740
|
|
671
|
-
|
672
|
-
|
673
|
-
you can use `@pypi_base` to set packages required by all
|
674
|
-
steps and use `@pypi` to specify step-specific overrides.
|
741
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
742
|
+
The list of repos (models/datasets) to load.
|
675
743
|
|
744
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
676
745
|
|
677
|
-
|
678
|
-
|
679
|
-
|
680
|
-
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
746
|
+
- If repo (model/dataset) is not found in the datastore:
|
747
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
748
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
749
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
750
|
+
|
751
|
+
- If repo is found in the datastore:
|
752
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
685
753
|
"""
|
686
754
|
...
|
687
755
|
|
688
756
|
@typing.overload
|
689
|
-
def
|
757
|
+
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]]]:
|
690
758
|
"""
|
691
|
-
Specifies the
|
759
|
+
Specifies the number of times the task corresponding
|
760
|
+
to a step needs to be retried.
|
692
761
|
|
693
|
-
|
694
|
-
|
762
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
763
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
764
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
695
765
|
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
```
|
700
|
-
or
|
701
|
-
```
|
702
|
-
python myflow.py run --with kubernetes
|
703
|
-
```
|
704
|
-
which executes the flow on the desired system using the
|
705
|
-
requirements specified in `@resources`.
|
766
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
767
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
768
|
+
ensuring that the flow execution can continue.
|
706
769
|
|
707
770
|
|
708
771
|
Parameters
|
709
772
|
----------
|
710
|
-
|
711
|
-
Number of
|
712
|
-
|
713
|
-
Number of
|
714
|
-
disk : int, optional, default None
|
715
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
716
|
-
memory : int, default 4096
|
717
|
-
Memory size (in MB) required for this step.
|
718
|
-
shared_memory : int, optional, default None
|
719
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
720
|
-
This parameter maps to the `--shm-size` option in Docker.
|
773
|
+
times : int, default 3
|
774
|
+
Number of times to retry this task.
|
775
|
+
minutes_between_retries : int, default 2
|
776
|
+
Number of minutes between retries.
|
721
777
|
"""
|
722
778
|
...
|
723
779
|
|
724
780
|
@typing.overload
|
725
|
-
def
|
781
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
726
782
|
...
|
727
783
|
|
728
784
|
@typing.overload
|
729
|
-
def
|
785
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
730
786
|
...
|
731
787
|
|
732
|
-
def
|
788
|
+
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):
|
733
789
|
"""
|
734
|
-
Specifies the
|
790
|
+
Specifies the number of times the task corresponding
|
791
|
+
to a step needs to be retried.
|
735
792
|
|
736
|
-
|
737
|
-
|
793
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
794
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
795
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
738
796
|
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
```
|
743
|
-
or
|
744
|
-
```
|
745
|
-
python myflow.py run --with kubernetes
|
746
|
-
```
|
747
|
-
which executes the flow on the desired system using the
|
748
|
-
requirements specified in `@resources`.
|
797
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
798
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
799
|
+
ensuring that the flow execution can continue.
|
749
800
|
|
750
801
|
|
751
802
|
Parameters
|
752
803
|
----------
|
753
|
-
|
754
|
-
Number of
|
755
|
-
|
756
|
-
Number of
|
757
|
-
disk : int, optional, default None
|
758
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
759
|
-
memory : int, default 4096
|
760
|
-
Memory size (in MB) required for this step.
|
761
|
-
shared_memory : int, optional, default None
|
762
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
763
|
-
This parameter maps to the `--shm-size` option in Docker.
|
804
|
+
times : int, default 3
|
805
|
+
Number of times to retry this task.
|
806
|
+
minutes_between_retries : int, default 2
|
807
|
+
Number of minutes between retries.
|
764
808
|
"""
|
765
809
|
...
|
766
810
|
|
@@ -824,328 +868,104 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
824
868
|
...
|
825
869
|
|
826
870
|
@typing.overload
|
827
|
-
def
|
828
|
-
"""
|
829
|
-
Internal decorator to support Fast bakery
|
830
|
-
"""
|
831
|
-
...
|
832
|
-
|
833
|
-
@typing.overload
|
834
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
835
|
-
...
|
836
|
-
|
837
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
838
|
-
"""
|
839
|
-
Internal decorator to support Fast bakery
|
840
|
-
"""
|
841
|
-
...
|
842
|
-
|
843
|
-
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') -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
844
|
-
"""
|
845
|
-
Specifies that this step should execute on Kubernetes.
|
846
|
-
|
847
|
-
|
848
|
-
Parameters
|
849
|
-
----------
|
850
|
-
cpu : int, default 1
|
851
|
-
Number of CPUs required for this step. If `@resources` is
|
852
|
-
also present, the maximum value from all decorators is used.
|
853
|
-
memory : int, default 4096
|
854
|
-
Memory size (in MB) required for this step. If
|
855
|
-
`@resources` is also present, the maximum value from all decorators is
|
856
|
-
used.
|
857
|
-
disk : int, default 10240
|
858
|
-
Disk size (in MB) required for this step. If
|
859
|
-
`@resources` is also present, the maximum value from all decorators is
|
860
|
-
used.
|
861
|
-
image : str, optional, default None
|
862
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
863
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
864
|
-
not, a default Docker image mapping to the current version of Python is used.
|
865
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
866
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
867
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
868
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
869
|
-
secrets : List[str], optional, default None
|
870
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
871
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
872
|
-
in Metaflow configuration.
|
873
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
874
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
875
|
-
Can be passed in as a comma separated string of values e.g.
|
876
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
877
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
878
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
879
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
880
|
-
gpu : int, optional, default None
|
881
|
-
Number of GPUs required for this step. A value of zero implies that
|
882
|
-
the scheduled node should not have GPUs.
|
883
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
884
|
-
The vendor of the GPUs to be used for this step.
|
885
|
-
tolerations : List[str], default []
|
886
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
887
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
888
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
889
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
890
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
891
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
892
|
-
use_tmpfs : bool, default False
|
893
|
-
This enables an explicit tmpfs mount for this step.
|
894
|
-
tmpfs_tempdir : bool, default True
|
895
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
896
|
-
tmpfs_size : int, optional, default: None
|
897
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
898
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
899
|
-
memory allocated for this step.
|
900
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
901
|
-
Path to tmpfs mount for this step.
|
902
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
903
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
904
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
905
|
-
shared_memory: int, optional
|
906
|
-
Shared memory size (in MiB) required for this step
|
907
|
-
port: int, optional
|
908
|
-
Port number to specify in the Kubernetes job object
|
909
|
-
compute_pool : str, optional, default None
|
910
|
-
Compute pool to be used for for this step.
|
911
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
912
|
-
hostname_resolution_timeout: int, default 10 * 60
|
913
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
914
|
-
Only applicable when @parallel is used.
|
915
|
-
qos: str, default: Burstable
|
916
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
917
|
-
"""
|
918
|
-
...
|
919
|
-
|
920
|
-
@typing.overload
|
921
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
922
|
-
"""
|
923
|
-
Decorator prototype for all step decorators. This function gets specialized
|
924
|
-
and imported for all decorators types by _import_plugin_decorators().
|
925
|
-
"""
|
926
|
-
...
|
927
|
-
|
928
|
-
@typing.overload
|
929
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
930
|
-
...
|
931
|
-
|
932
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
933
|
-
"""
|
934
|
-
Decorator prototype for all step decorators. This function gets specialized
|
935
|
-
and imported for all decorators types by _import_plugin_decorators().
|
936
|
-
"""
|
937
|
-
...
|
938
|
-
|
939
|
-
@typing.overload
|
940
|
-
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]]]:
|
871
|
+
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]]]:
|
941
872
|
"""
|
942
|
-
Specifies
|
873
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
874
|
+
the execution of a step.
|
943
875
|
|
944
876
|
|
945
877
|
Parameters
|
946
878
|
----------
|
947
|
-
|
948
|
-
|
879
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
880
|
+
List of secret specs, defining how the secrets are to be retrieved
|
949
881
|
"""
|
950
882
|
...
|
951
883
|
|
952
884
|
@typing.overload
|
953
|
-
def
|
885
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
954
886
|
...
|
955
887
|
|
956
888
|
@typing.overload
|
957
|
-
def
|
889
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
958
890
|
...
|
959
891
|
|
960
|
-
def
|
892
|
+
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]]] = []):
|
961
893
|
"""
|
962
|
-
Specifies
|
894
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
895
|
+
the execution of a step.
|
963
896
|
|
964
897
|
|
965
898
|
Parameters
|
966
899
|
----------
|
967
|
-
|
968
|
-
|
900
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
901
|
+
List of secret specs, defining how the secrets are to be retrieved
|
969
902
|
"""
|
970
903
|
...
|
971
904
|
|
972
905
|
@typing.overload
|
973
|
-
def
|
906
|
+
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
974
907
|
"""
|
975
|
-
Specifies the
|
908
|
+
Specifies the PyPI packages for the step.
|
976
909
|
|
977
|
-
|
978
|
-
|
910
|
+
Information in this decorator will augment any
|
911
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
912
|
+
you can use `@pypi_base` to set packages required by all
|
913
|
+
steps and use `@pypi` to specify step-specific overrides.
|
979
914
|
|
980
915
|
|
981
916
|
Parameters
|
982
917
|
----------
|
983
|
-
packages : Dict[str, str], default {}
|
984
|
-
Packages to use for this
|
918
|
+
packages : Dict[str, str], default: {}
|
919
|
+
Packages to use for this step. The key is the name of the package
|
985
920
|
and the value is the version to use.
|
986
|
-
|
987
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
988
|
-
python : str, optional, default None
|
921
|
+
python : str, optional, default: None
|
989
922
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
990
923
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
991
|
-
disabled : bool, default False
|
992
|
-
If set to True, disables Conda.
|
993
924
|
"""
|
994
925
|
...
|
995
926
|
|
996
927
|
@typing.overload
|
997
|
-
def
|
928
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
998
929
|
...
|
999
930
|
|
1000
|
-
|
931
|
+
@typing.overload
|
932
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
933
|
+
...
|
934
|
+
|
935
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1001
936
|
"""
|
1002
|
-
Specifies the
|
937
|
+
Specifies the PyPI packages for the step.
|
1003
938
|
|
1004
|
-
|
1005
|
-
|
939
|
+
Information in this decorator will augment any
|
940
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
941
|
+
you can use `@pypi_base` to set packages required by all
|
942
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1006
943
|
|
1007
944
|
|
1008
945
|
Parameters
|
1009
946
|
----------
|
1010
|
-
packages : Dict[str, str], default {}
|
1011
|
-
Packages to use for this
|
947
|
+
packages : Dict[str, str], default: {}
|
948
|
+
Packages to use for this step. The key is the name of the package
|
1012
949
|
and the value is the version to use.
|
1013
|
-
|
1014
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1015
|
-
python : str, optional, default None
|
950
|
+
python : str, optional, default: None
|
1016
951
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1017
952
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1018
|
-
disabled : bool, default False
|
1019
|
-
If set to True, disables Conda.
|
1020
|
-
"""
|
1021
|
-
...
|
1022
|
-
|
1023
|
-
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]]:
|
1024
|
-
"""
|
1025
|
-
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)
|
1026
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1027
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1028
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1029
|
-
starts only after all sensors finish.
|
1030
|
-
|
1031
|
-
|
1032
|
-
Parameters
|
1033
|
-
----------
|
1034
|
-
timeout : int
|
1035
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1036
|
-
poke_interval : int
|
1037
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1038
|
-
mode : str
|
1039
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1040
|
-
exponential_backoff : bool
|
1041
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1042
|
-
pool : str
|
1043
|
-
the slot pool this task should run in,
|
1044
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1045
|
-
soft_fail : bool
|
1046
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1047
|
-
name : str
|
1048
|
-
Name of the sensor on Airflow
|
1049
|
-
description : str
|
1050
|
-
Description of sensor in the Airflow UI
|
1051
|
-
bucket_key : Union[str, List[str]]
|
1052
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1053
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1054
|
-
bucket_name : str
|
1055
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1056
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1057
|
-
wildcard_match : bool
|
1058
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1059
|
-
aws_conn_id : str
|
1060
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1061
|
-
verify : bool
|
1062
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1063
|
-
"""
|
1064
|
-
...
|
1065
|
-
|
1066
|
-
@typing.overload
|
1067
|
-
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]]:
|
1068
|
-
"""
|
1069
|
-
Specifies the times when the flow should be run when running on a
|
1070
|
-
production scheduler.
|
1071
|
-
|
1072
|
-
|
1073
|
-
Parameters
|
1074
|
-
----------
|
1075
|
-
hourly : bool, default False
|
1076
|
-
Run the workflow hourly.
|
1077
|
-
daily : bool, default True
|
1078
|
-
Run the workflow daily.
|
1079
|
-
weekly : bool, default False
|
1080
|
-
Run the workflow weekly.
|
1081
|
-
cron : str, optional, default None
|
1082
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1083
|
-
specified by this expression.
|
1084
|
-
timezone : str, optional, default None
|
1085
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1086
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1087
953
|
"""
|
1088
954
|
...
|
1089
955
|
|
1090
|
-
|
1091
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1092
|
-
...
|
1093
|
-
|
1094
|
-
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):
|
1095
|
-
"""
|
1096
|
-
Specifies the times when the flow should be run when running on a
|
1097
|
-
production scheduler.
|
1098
|
-
|
1099
|
-
|
1100
|
-
Parameters
|
1101
|
-
----------
|
1102
|
-
hourly : bool, default False
|
1103
|
-
Run the workflow hourly.
|
1104
|
-
daily : bool, default True
|
1105
|
-
Run the workflow daily.
|
1106
|
-
weekly : bool, default False
|
1107
|
-
Run the workflow weekly.
|
1108
|
-
cron : str, optional, default None
|
1109
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1110
|
-
specified by this expression.
|
1111
|
-
timezone : str, optional, default None
|
1112
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1113
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1114
|
-
"""
|
1115
|
-
...
|
1116
|
-
|
1117
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
956
|
+
def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1118
957
|
"""
|
1119
|
-
Specifies
|
1120
|
-
|
1121
|
-
A project-specific namespace is created for all flows that
|
1122
|
-
use the same `@project(name)`.
|
1123
|
-
|
1124
|
-
|
1125
|
-
Parameters
|
1126
|
-
----------
|
1127
|
-
name : str
|
1128
|
-
Project name. Make sure that the name is unique amongst all
|
1129
|
-
projects that use the same production scheduler. The name may
|
1130
|
-
contain only lowercase alphanumeric characters and underscores.
|
958
|
+
Specifies that this step should execute on DGX cloud.
|
1131
959
|
|
1132
|
-
branch : Optional[str], default None
|
1133
|
-
The branch to use. If not specified, the branch is set to
|
1134
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1135
|
-
also be set on the command line using `--branch` as a top-level option.
|
1136
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1137
960
|
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
1141
|
-
|
1142
|
-
|
1143
|
-
|
1144
|
-
|
1145
|
-
|
1146
|
-
- if `branch` is not specified:
|
1147
|
-
- if `production` is True: `prod`
|
1148
|
-
- if `production` is False: `user.<username>`
|
961
|
+
Parameters
|
962
|
+
----------
|
963
|
+
gpu : int
|
964
|
+
Number of GPUs to use.
|
965
|
+
gpu_type : str
|
966
|
+
Type of Nvidia GPU to use.
|
967
|
+
queue_timeout : int
|
968
|
+
Time to keep the job in NVCF's queue.
|
1149
969
|
"""
|
1150
970
|
...
|
1151
971
|
|
@@ -1190,46 +1010,89 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
1190
1010
|
"""
|
1191
1011
|
...
|
1192
1012
|
|
1193
|
-
|
1013
|
+
@typing.overload
|
1014
|
+
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]]:
|
1194
1015
|
"""
|
1195
|
-
|
1196
|
-
|
1016
|
+
Specifies the Conda environment for all steps of the flow.
|
1017
|
+
|
1018
|
+
Use `@conda_base` to set common libraries required by all
|
1019
|
+
steps and use `@conda` to specify step-specific additions.
|
1020
|
+
|
1021
|
+
|
1022
|
+
Parameters
|
1023
|
+
----------
|
1024
|
+
packages : Dict[str, str], default {}
|
1025
|
+
Packages to use for this flow. The key is the name of the package
|
1026
|
+
and the value is the version to use.
|
1027
|
+
libraries : Dict[str, str], default {}
|
1028
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1029
|
+
python : str, optional, default None
|
1030
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1031
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1032
|
+
disabled : bool, default False
|
1033
|
+
If set to True, disables Conda.
|
1034
|
+
"""
|
1035
|
+
...
|
1036
|
+
|
1037
|
+
@typing.overload
|
1038
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1039
|
+
...
|
1040
|
+
|
1041
|
+
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):
|
1042
|
+
"""
|
1043
|
+
Specifies the Conda environment for all steps of the flow.
|
1044
|
+
|
1045
|
+
Use `@conda_base` to set common libraries required by all
|
1046
|
+
steps and use `@conda` to specify step-specific additions.
|
1047
|
+
|
1048
|
+
|
1049
|
+
Parameters
|
1050
|
+
----------
|
1051
|
+
packages : Dict[str, str], default {}
|
1052
|
+
Packages to use for this flow. The key is the name of the package
|
1053
|
+
and the value is the version to use.
|
1054
|
+
libraries : Dict[str, str], default {}
|
1055
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1056
|
+
python : str, optional, default None
|
1057
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1058
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1059
|
+
disabled : bool, default False
|
1060
|
+
If set to True, disables Conda.
|
1061
|
+
"""
|
1062
|
+
...
|
1063
|
+
|
1064
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1065
|
+
"""
|
1066
|
+
Specifies what flows belong to the same project.
|
1067
|
+
|
1068
|
+
A project-specific namespace is created for all flows that
|
1069
|
+
use the same `@project(name)`.
|
1197
1070
|
|
1198
1071
|
|
1199
1072
|
Parameters
|
1200
1073
|
----------
|
1201
|
-
timeout : int
|
1202
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1203
|
-
poke_interval : int
|
1204
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1205
|
-
mode : str
|
1206
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1207
|
-
exponential_backoff : bool
|
1208
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1209
|
-
pool : str
|
1210
|
-
the slot pool this task should run in,
|
1211
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1212
|
-
soft_fail : bool
|
1213
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1214
1074
|
name : str
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1075
|
+
Project name. Make sure that the name is unique amongst all
|
1076
|
+
projects that use the same production scheduler. The name may
|
1077
|
+
contain only lowercase alphanumeric characters and underscores.
|
1078
|
+
|
1079
|
+
branch : Optional[str], default None
|
1080
|
+
The branch to use. If not specified, the branch is set to
|
1081
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1082
|
+
also be set on the command line using `--branch` as a top-level option.
|
1083
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1084
|
+
|
1085
|
+
production : bool, default False
|
1086
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1087
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1088
|
+
`production` in the decorator and on the command line.
|
1089
|
+
The project branch name will be:
|
1090
|
+
- if `branch` is specified:
|
1091
|
+
- if `production` is True: `prod.<branch>`
|
1092
|
+
- if `production` is False: `test.<branch>`
|
1093
|
+
- if `branch` is not specified:
|
1094
|
+
- if `production` is True: `prod`
|
1095
|
+
- if `production` is False: `user.<username>`
|
1233
1096
|
"""
|
1234
1097
|
...
|
1235
1098
|
|
@@ -1334,6 +1197,143 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1334
1197
|
"""
|
1335
1198
|
...
|
1336
1199
|
|
1200
|
+
@typing.overload
|
1201
|
+
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]]:
|
1202
|
+
"""
|
1203
|
+
Specifies the times when the flow should be run when running on a
|
1204
|
+
production scheduler.
|
1205
|
+
|
1206
|
+
|
1207
|
+
Parameters
|
1208
|
+
----------
|
1209
|
+
hourly : bool, default False
|
1210
|
+
Run the workflow hourly.
|
1211
|
+
daily : bool, default True
|
1212
|
+
Run the workflow daily.
|
1213
|
+
weekly : bool, default False
|
1214
|
+
Run the workflow weekly.
|
1215
|
+
cron : str, optional, default None
|
1216
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1217
|
+
specified by this expression.
|
1218
|
+
timezone : str, optional, default None
|
1219
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1220
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1221
|
+
"""
|
1222
|
+
...
|
1223
|
+
|
1224
|
+
@typing.overload
|
1225
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1226
|
+
...
|
1227
|
+
|
1228
|
+
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):
|
1229
|
+
"""
|
1230
|
+
Specifies the times when the flow should be run when running on a
|
1231
|
+
production scheduler.
|
1232
|
+
|
1233
|
+
|
1234
|
+
Parameters
|
1235
|
+
----------
|
1236
|
+
hourly : bool, default False
|
1237
|
+
Run the workflow hourly.
|
1238
|
+
daily : bool, default True
|
1239
|
+
Run the workflow daily.
|
1240
|
+
weekly : bool, default False
|
1241
|
+
Run the workflow weekly.
|
1242
|
+
cron : str, optional, default None
|
1243
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1244
|
+
specified by this expression.
|
1245
|
+
timezone : str, optional, default None
|
1246
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1247
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1248
|
+
"""
|
1249
|
+
...
|
1250
|
+
|
1251
|
+
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]]:
|
1252
|
+
"""
|
1253
|
+
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)
|
1254
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1255
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1256
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1257
|
+
starts only after all sensors finish.
|
1258
|
+
|
1259
|
+
|
1260
|
+
Parameters
|
1261
|
+
----------
|
1262
|
+
timeout : int
|
1263
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1264
|
+
poke_interval : int
|
1265
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1266
|
+
mode : str
|
1267
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1268
|
+
exponential_backoff : bool
|
1269
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1270
|
+
pool : str
|
1271
|
+
the slot pool this task should run in,
|
1272
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1273
|
+
soft_fail : bool
|
1274
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1275
|
+
name : str
|
1276
|
+
Name of the sensor on Airflow
|
1277
|
+
description : str
|
1278
|
+
Description of sensor in the Airflow UI
|
1279
|
+
bucket_key : Union[str, List[str]]
|
1280
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1281
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1282
|
+
bucket_name : str
|
1283
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1284
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1285
|
+
wildcard_match : bool
|
1286
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1287
|
+
aws_conn_id : str
|
1288
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1289
|
+
verify : bool
|
1290
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1291
|
+
"""
|
1292
|
+
...
|
1293
|
+
|
1294
|
+
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]]:
|
1295
|
+
"""
|
1296
|
+
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.
|
1297
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1298
|
+
|
1299
|
+
|
1300
|
+
Parameters
|
1301
|
+
----------
|
1302
|
+
timeout : int
|
1303
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1304
|
+
poke_interval : int
|
1305
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1306
|
+
mode : str
|
1307
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1308
|
+
exponential_backoff : bool
|
1309
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1310
|
+
pool : str
|
1311
|
+
the slot pool this task should run in,
|
1312
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1313
|
+
soft_fail : bool
|
1314
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1315
|
+
name : str
|
1316
|
+
Name of the sensor on Airflow
|
1317
|
+
description : str
|
1318
|
+
Description of sensor in the Airflow UI
|
1319
|
+
external_dag_id : str
|
1320
|
+
The dag_id that contains the task you want to wait for.
|
1321
|
+
external_task_ids : List[str]
|
1322
|
+
The list of task_ids that you want to wait for.
|
1323
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1324
|
+
allowed_states : List[str]
|
1325
|
+
Iterable of allowed states, (Default: ['success'])
|
1326
|
+
failed_states : List[str]
|
1327
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1328
|
+
execution_delta : datetime.timedelta
|
1329
|
+
time difference with the previous execution to look at,
|
1330
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1331
|
+
check_existence: bool
|
1332
|
+
Set to True to check if the external task exists or check if
|
1333
|
+
the DAG to wait for exists. (Default: True)
|
1334
|
+
"""
|
1335
|
+
...
|
1336
|
+
|
1337
1337
|
@typing.overload
|
1338
1338
|
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1339
1339
|
"""
|