ob-metaflow-stubs 6.0.10.19__py2.py3-none-any.whl → 6.0.10.21__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 +912 -911
- 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 +3 -2
- metaflow-stubs/client/core.pyi +40 -8
- metaflow-stubs/client/filecache.pyi +21 -5
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +4 -4
- metaflow-stubs/meta_files.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 +16 -2
- metaflow-stubs/metaflow_current.pyi +50 -50
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +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 +2 -2
- 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 +3 -3
- 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 +4 -4
- 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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +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 +3 -3
- 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/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/cards/hf_hub_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
- 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/apps/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_state_machine.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/spinners.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_cli.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_config.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/capsule.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/click_importer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/code_packager.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/config_utils.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/schema_export.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/typed_configs.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/unified_config.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/deployer.pyi +5 -5
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/experimental/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/perimeters.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/utils.pyi +5 -5
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.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 +3 -3
- 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/mf_extensions/outerbounds/toplevel/s3_proxy.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/ob_internal.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +6 -6
- metaflow-stubs/packaging_sys/backend.pyi +3 -3
- metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
- metaflow-stubs/packaging_sys/tar_backend.pyi +4 -4
- metaflow-stubs/packaging_sys/utils.pyi +2 -5
- metaflow-stubs/packaging_sys/v1.pyi +3 -3
- metaflow-stubs/parameters.pyi +4 -4
- metaflow-stubs/plugins/__init__.pyi +11 -11
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/argo/exit_hooks.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +4 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/json_viewer.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 +6 -4
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_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 +3 -3
- 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/optuna/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/parsers.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.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/plugins/torchtune/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.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 +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +131 -18
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- metaflow-stubs/user_decorators/__init__.pyi +2 -2
- metaflow-stubs/user_decorators/common.pyi +2 -2
- metaflow-stubs/user_decorators/mutable_flow.pyi +5 -5
- metaflow-stubs/user_decorators/mutable_step.pyi +5 -5
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +5 -5
- metaflow-stubs/user_decorators/user_step_decorator.pyi +16 -7
- {ob_metaflow_stubs-6.0.10.19.dist-info → ob_metaflow_stubs-6.0.10.21.dist-info}/METADATA +9 -2
- ob_metaflow_stubs-6.0.10.21.dist-info/RECORD +266 -0
- {ob_metaflow_stubs-6.0.10.19.dist-info → ob_metaflow_stubs-6.0.10.21.dist-info}/WHEEL +1 -1
- ob_metaflow_stubs-6.0.10.19.dist-info/RECORD +0 -266
- {ob_metaflow_stubs-6.0.10.19.dist-info → ob_metaflow_stubs-6.0.10.21.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.
|
|
4
|
-
# Generated on 2025-10-
|
|
3
|
+
# MF version: 2.19.4.1+obcheckpoint(0.2.8);ob(v1) #
|
|
4
|
+
# Generated on 2025-10-29T20:50:15.983723 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import typing
|
|
10
10
|
if typing.TYPE_CHECKING:
|
|
11
|
-
import datetime
|
|
12
11
|
import typing
|
|
12
|
+
import datetime
|
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
|
15
15
|
|
|
@@ -39,19 +39,19 @@ from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDe
|
|
|
39
39
|
from .user_decorators.user_step_decorator import StepMutator as StepMutator
|
|
40
40
|
from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
|
|
41
41
|
from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
|
|
42
|
+
from . import tuple_util as tuple_util
|
|
43
|
+
from . import cards as cards
|
|
42
44
|
from . import events as events
|
|
43
45
|
from . import metaflow_git as metaflow_git
|
|
44
|
-
from . import cards as cards
|
|
45
|
-
from . import tuple_util as tuple_util
|
|
46
46
|
from . import runner as runner
|
|
47
47
|
from . import plugins as plugins
|
|
48
48
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
|
49
49
|
from . import includefile as includefile
|
|
50
50
|
from .includefile import IncludeFile as IncludeFile
|
|
51
|
-
from .plugins.pypi.parsers import
|
|
51
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
52
52
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
53
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
53
54
|
from .plugins.parsers import yaml_parser as yaml_parser
|
|
54
|
-
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
55
55
|
from . import client as client
|
|
56
56
|
from .client.core import namespace as namespace
|
|
57
57
|
from .client.core import get_namespace as get_namespace
|
|
@@ -59,6 +59,7 @@ from .client.core import default_namespace as default_namespace
|
|
|
59
59
|
from .client.core import metadata as metadata
|
|
60
60
|
from .client.core import get_metadata as get_metadata
|
|
61
61
|
from .client.core import default_metadata as default_metadata
|
|
62
|
+
from .client.core import inspect_spin as inspect_spin
|
|
62
63
|
from .client.core import Metaflow as Metaflow
|
|
63
64
|
from .client.core import Flow as Flow
|
|
64
65
|
from .client.core import Run as Run
|
|
@@ -85,8 +86,8 @@ from .mf_extensions.outerbounds.plugins.checkpoint_datastores.nebius import nebi
|
|
|
85
86
|
from .mf_extensions.outerbounds.plugins.checkpoint_datastores.coreweave import coreweave_checkpoints as coreweave_checkpoints
|
|
86
87
|
from .mf_extensions.outerbounds.plugins.aws.assume_role_decorator import assume_role as assume_role
|
|
87
88
|
from .mf_extensions.outerbounds.plugins.apps.core.deployer import AppDeployer as AppDeployer
|
|
88
|
-
from . import system as system
|
|
89
89
|
from . import cli_components as cli_components
|
|
90
|
+
from . import system as system
|
|
90
91
|
from . import pylint_wrapper as pylint_wrapper
|
|
91
92
|
from . import cli as cli
|
|
92
93
|
from . import profilers as profilers
|
|
@@ -170,519 +171,593 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
170
171
|
...
|
|
171
172
|
|
|
172
173
|
@typing.overload
|
|
173
|
-
def
|
|
174
|
+
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]]]:
|
|
174
175
|
"""
|
|
175
|
-
|
|
176
|
+
Enables checkpointing for a step.
|
|
176
177
|
|
|
177
|
-
|
|
178
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
178
|
+
> Examples
|
|
179
179
|
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
python
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
- Saving Checkpoints
|
|
181
|
+
|
|
182
|
+
```python
|
|
183
|
+
@checkpoint
|
|
184
|
+
@step
|
|
185
|
+
def train(self):
|
|
186
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
|
187
|
+
for i in range(self.epochs):
|
|
188
|
+
# some training logic
|
|
189
|
+
loss = model.train(self.dataset)
|
|
190
|
+
if i % 10 == 0:
|
|
191
|
+
model.save(
|
|
192
|
+
current.checkpoint.directory,
|
|
193
|
+
)
|
|
194
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
195
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
196
|
+
self.latest_checkpoint = current.checkpoint.save(
|
|
197
|
+
name="epoch_checkpoint",
|
|
198
|
+
metadata={
|
|
199
|
+
"epoch": i,
|
|
200
|
+
"loss": loss,
|
|
201
|
+
}
|
|
202
|
+
)
|
|
185
203
|
```
|
|
186
|
-
|
|
204
|
+
|
|
205
|
+
- Using Loaded Checkpoints
|
|
206
|
+
|
|
207
|
+
```python
|
|
208
|
+
@retry(times=3)
|
|
209
|
+
@checkpoint
|
|
210
|
+
@step
|
|
211
|
+
def train(self):
|
|
212
|
+
# Assume that the task has restarted and the previous attempt of the task
|
|
213
|
+
# saved a checkpoint
|
|
214
|
+
checkpoint_path = None
|
|
215
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
216
|
+
print("Loaded checkpoint from the previous attempt")
|
|
217
|
+
checkpoint_path = current.checkpoint.directory
|
|
218
|
+
|
|
219
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
220
|
+
for i in range(self.epochs):
|
|
221
|
+
...
|
|
187
222
|
```
|
|
188
|
-
which executes the flow on the desired system using the
|
|
189
|
-
requirements specified in `@resources`.
|
|
190
223
|
|
|
191
224
|
|
|
192
225
|
Parameters
|
|
193
226
|
----------
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
227
|
+
load_policy : str, default: "fresh"
|
|
228
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
229
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
230
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
231
|
+
will be loaded at the start of the task.
|
|
232
|
+
- "none": Do not load any checkpoint
|
|
233
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
234
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
235
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
236
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
237
|
+
|
|
238
|
+
temp_dir_root : str, default: None
|
|
239
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
205
240
|
"""
|
|
206
241
|
...
|
|
207
242
|
|
|
208
243
|
@typing.overload
|
|
209
|
-
def
|
|
244
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
210
245
|
...
|
|
211
246
|
|
|
212
247
|
@typing.overload
|
|
213
|
-
def
|
|
248
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
214
249
|
...
|
|
215
250
|
|
|
216
|
-
def
|
|
251
|
+
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):
|
|
217
252
|
"""
|
|
218
|
-
|
|
253
|
+
Enables checkpointing for a step.
|
|
219
254
|
|
|
220
|
-
|
|
221
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
255
|
+
> Examples
|
|
222
256
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
python
|
|
226
|
-
|
|
227
|
-
|
|
257
|
+
- Saving Checkpoints
|
|
258
|
+
|
|
259
|
+
```python
|
|
260
|
+
@checkpoint
|
|
261
|
+
@step
|
|
262
|
+
def train(self):
|
|
263
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
|
264
|
+
for i in range(self.epochs):
|
|
265
|
+
# some training logic
|
|
266
|
+
loss = model.train(self.dataset)
|
|
267
|
+
if i % 10 == 0:
|
|
268
|
+
model.save(
|
|
269
|
+
current.checkpoint.directory,
|
|
270
|
+
)
|
|
271
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
272
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
273
|
+
self.latest_checkpoint = current.checkpoint.save(
|
|
274
|
+
name="epoch_checkpoint",
|
|
275
|
+
metadata={
|
|
276
|
+
"epoch": i,
|
|
277
|
+
"loss": loss,
|
|
278
|
+
}
|
|
279
|
+
)
|
|
228
280
|
```
|
|
229
|
-
|
|
281
|
+
|
|
282
|
+
- Using Loaded Checkpoints
|
|
283
|
+
|
|
284
|
+
```python
|
|
285
|
+
@retry(times=3)
|
|
286
|
+
@checkpoint
|
|
287
|
+
@step
|
|
288
|
+
def train(self):
|
|
289
|
+
# Assume that the task has restarted and the previous attempt of the task
|
|
290
|
+
# saved a checkpoint
|
|
291
|
+
checkpoint_path = None
|
|
292
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
293
|
+
print("Loaded checkpoint from the previous attempt")
|
|
294
|
+
checkpoint_path = current.checkpoint.directory
|
|
295
|
+
|
|
296
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
297
|
+
for i in range(self.epochs):
|
|
298
|
+
...
|
|
230
299
|
```
|
|
231
|
-
which executes the flow on the desired system using the
|
|
232
|
-
requirements specified in `@resources`.
|
|
233
300
|
|
|
234
301
|
|
|
235
302
|
Parameters
|
|
236
303
|
----------
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
304
|
+
load_policy : str, default: "fresh"
|
|
305
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
306
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
307
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
308
|
+
will be loaded at the start of the task.
|
|
309
|
+
- "none": Do not load any checkpoint
|
|
310
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
311
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
312
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
313
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
314
|
+
|
|
315
|
+
temp_dir_root : str, default: None
|
|
316
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
248
317
|
"""
|
|
249
318
|
...
|
|
250
319
|
|
|
251
320
|
@typing.overload
|
|
252
|
-
def
|
|
321
|
+
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
253
322
|
"""
|
|
254
|
-
Specifies
|
|
323
|
+
Specifies a timeout for your step.
|
|
324
|
+
|
|
325
|
+
This decorator is useful if this step may hang indefinitely.
|
|
326
|
+
|
|
327
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
328
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
329
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
330
|
+
|
|
331
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
332
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
255
333
|
|
|
256
334
|
|
|
257
335
|
Parameters
|
|
258
336
|
----------
|
|
259
|
-
|
|
260
|
-
|
|
337
|
+
seconds : int, default 0
|
|
338
|
+
Number of seconds to wait prior to timing out.
|
|
339
|
+
minutes : int, default 0
|
|
340
|
+
Number of minutes to wait prior to timing out.
|
|
341
|
+
hours : int, default 0
|
|
342
|
+
Number of hours to wait prior to timing out.
|
|
261
343
|
"""
|
|
262
344
|
...
|
|
263
345
|
|
|
264
346
|
@typing.overload
|
|
265
|
-
def
|
|
347
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
266
348
|
...
|
|
267
349
|
|
|
268
350
|
@typing.overload
|
|
269
|
-
def
|
|
351
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
270
352
|
...
|
|
271
353
|
|
|
272
|
-
def
|
|
354
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
|
273
355
|
"""
|
|
274
|
-
Specifies
|
|
356
|
+
Specifies a timeout for your step.
|
|
357
|
+
|
|
358
|
+
This decorator is useful if this step may hang indefinitely.
|
|
359
|
+
|
|
360
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
361
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
362
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
363
|
+
|
|
364
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
365
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
275
366
|
|
|
276
367
|
|
|
277
368
|
Parameters
|
|
278
369
|
----------
|
|
279
|
-
|
|
280
|
-
|
|
370
|
+
seconds : int, default 0
|
|
371
|
+
Number of seconds to wait prior to timing out.
|
|
372
|
+
minutes : int, default 0
|
|
373
|
+
Number of minutes to wait prior to timing out.
|
|
374
|
+
hours : int, default 0
|
|
375
|
+
Number of hours to wait prior to timing out.
|
|
281
376
|
"""
|
|
282
377
|
...
|
|
283
378
|
|
|
284
379
|
@typing.overload
|
|
285
|
-
def
|
|
380
|
+
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]]]:
|
|
286
381
|
"""
|
|
287
|
-
|
|
288
|
-
|
|
382
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
383
|
+
|
|
384
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
Parameters
|
|
388
|
+
----------
|
|
389
|
+
type : str, default 'default'
|
|
390
|
+
Card type.
|
|
391
|
+
id : str, optional, default None
|
|
392
|
+
If multiple cards are present, use this id to identify this card.
|
|
393
|
+
options : Dict[str, Any], default {}
|
|
394
|
+
Options passed to the card. The contents depend on the card type.
|
|
395
|
+
timeout : int, default 45
|
|
396
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
289
397
|
"""
|
|
290
398
|
...
|
|
291
399
|
|
|
292
400
|
@typing.overload
|
|
293
|
-
def
|
|
401
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
294
402
|
...
|
|
295
403
|
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
A simple decorator that demonstrates using CardDecoratorInjector
|
|
299
|
-
to inject a card and render simple markdown content.
|
|
300
|
-
"""
|
|
404
|
+
@typing.overload
|
|
405
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
301
406
|
...
|
|
302
407
|
|
|
303
|
-
|
|
304
|
-
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
408
|
+
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):
|
|
305
409
|
"""
|
|
306
|
-
|
|
410
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
307
411
|
|
|
308
|
-
|
|
309
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
310
|
-
you can use `@conda_base` to set packages required by all
|
|
311
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
412
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
312
413
|
|
|
313
414
|
|
|
314
415
|
Parameters
|
|
315
416
|
----------
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
disabled : bool, default False
|
|
325
|
-
If set to True, disables @conda.
|
|
417
|
+
type : str, default 'default'
|
|
418
|
+
Card type.
|
|
419
|
+
id : str, optional, default None
|
|
420
|
+
If multiple cards are present, use this id to identify this card.
|
|
421
|
+
options : Dict[str, Any], default {}
|
|
422
|
+
Options passed to the card. The contents depend on the card type.
|
|
423
|
+
timeout : int, default 45
|
|
424
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
326
425
|
"""
|
|
327
426
|
...
|
|
328
427
|
|
|
329
|
-
|
|
330
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
331
|
-
...
|
|
332
|
-
|
|
333
|
-
@typing.overload
|
|
334
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
335
|
-
...
|
|
336
|
-
|
|
337
|
-
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
428
|
+
def s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typing.Optional[str] = None, debug: typing.Optional[bool] = 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]]]:
|
|
338
429
|
"""
|
|
339
|
-
|
|
430
|
+
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
431
|
+
for S3 read and write requests.
|
|
340
432
|
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
433
|
+
This decorator requires an integration in the Outerbounds platform that
|
|
434
|
+
points to an external bucket. It affects S3 operations performed via
|
|
435
|
+
Metaflow's `get_aws_client` and `S3` within a `@step`.
|
|
345
436
|
|
|
437
|
+
Read operations
|
|
438
|
+
---------------
|
|
439
|
+
All read operations pass through the proxy. If an object does not already
|
|
440
|
+
exist in the external bucket, it is cached there. For example, if code reads
|
|
441
|
+
from buckets `FOO` and `BAR` using the `S3` interface, objects from both
|
|
442
|
+
buckets are cached in the external bucket.
|
|
346
443
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
356
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
357
|
-
disabled : bool, default False
|
|
358
|
-
If set to True, disables @conda.
|
|
359
|
-
"""
|
|
360
|
-
...
|
|
361
|
-
|
|
362
|
-
@typing.overload
|
|
363
|
-
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]]]:
|
|
364
|
-
"""
|
|
365
|
-
Specifies the number of times the task corresponding
|
|
366
|
-
to a step needs to be retried.
|
|
444
|
+
During task execution, all S3‑related read requests are routed through the
|
|
445
|
+
proxy:
|
|
446
|
+
- If the object is present in the external object store, the proxy
|
|
447
|
+
streams it directly from there without accessing the requested origin
|
|
448
|
+
bucket.
|
|
449
|
+
- If the object is not present in the external storage, the proxy
|
|
450
|
+
fetches it from the requested bucket, caches it in the external
|
|
451
|
+
storage, and streams the response from the origin bucket.
|
|
367
452
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
453
|
+
Warning
|
|
454
|
+
-------
|
|
455
|
+
All READ operations (e.g., GetObject, HeadObject) pass through the external
|
|
456
|
+
bucket regardless of the bucket specified in user code. Even
|
|
457
|
+
`S3(run=self)` and `S3(s3root="mybucketfoo")` requests go through the
|
|
458
|
+
external bucket cache.
|
|
371
459
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
460
|
+
Write operations
|
|
461
|
+
----------------
|
|
462
|
+
Write behavior is controlled by the `write_mode` parameter, which determines
|
|
463
|
+
whether writes also persist objects in the cache.
|
|
464
|
+
|
|
465
|
+
`write_mode` values:
|
|
466
|
+
- `origin-and-cache`: objects are written both to the cache and to their
|
|
467
|
+
intended origin bucket.
|
|
468
|
+
- `origin`: objects are written only to their intended origin bucket.
|
|
375
469
|
|
|
376
470
|
|
|
377
471
|
Parameters
|
|
378
472
|
----------
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
473
|
+
integration_name : str, optional
|
|
474
|
+
[Outerbounds integration name](https://docs.outerbounds.com/outerbounds/configuring-secrets/#integrations-view)
|
|
475
|
+
that holds the configuration for the external, S3‑compatible object
|
|
476
|
+
storage bucket. If not specified, the only available S3 proxy
|
|
477
|
+
integration in the namespace is used (fails if multiple exist).
|
|
478
|
+
write_mode : str, optional
|
|
479
|
+
Controls whether writes also go to the external bucket.
|
|
480
|
+
- `origin` (default)
|
|
481
|
+
- `origin-and-cache`
|
|
482
|
+
debug : bool, optional
|
|
483
|
+
Enables debug logging for proxy operations.
|
|
383
484
|
"""
|
|
384
485
|
...
|
|
385
486
|
|
|
386
|
-
|
|
387
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
388
|
-
...
|
|
389
|
-
|
|
390
|
-
@typing.overload
|
|
391
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
392
|
-
...
|
|
393
|
-
|
|
394
|
-
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):
|
|
487
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, cache_scope: 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]]]:
|
|
395
488
|
"""
|
|
396
|
-
|
|
397
|
-
to a step needs to be retried.
|
|
489
|
+
Decorator that helps cache, version, and store models/datasets from the Hugging Face Hub.
|
|
398
490
|
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
491
|
+
Examples
|
|
492
|
+
--------
|
|
402
493
|
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
494
|
+
```python
|
|
495
|
+
# **Usage: creating references to models from the Hugging Face Hub that may be loaded in downstream steps**
|
|
496
|
+
@huggingface_hub
|
|
497
|
+
@step
|
|
498
|
+
def pull_model_from_huggingface(self):
|
|
499
|
+
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
|
500
|
+
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
|
501
|
+
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
|
502
|
+
# value of the function is a reference to the model in the backend storage.
|
|
503
|
+
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
|
406
504
|
|
|
505
|
+
self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
|
|
506
|
+
self.llama_model = current.huggingface_hub.snapshot_download(
|
|
507
|
+
repo_id=self.model_id,
|
|
508
|
+
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
|
509
|
+
)
|
|
510
|
+
self.next(self.train)
|
|
407
511
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
421
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
422
|
-
"""
|
|
423
|
-
...
|
|
424
|
-
|
|
425
|
-
@typing.overload
|
|
426
|
-
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
427
|
-
...
|
|
428
|
-
|
|
429
|
-
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
430
|
-
"""
|
|
431
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
432
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
433
|
-
"""
|
|
434
|
-
...
|
|
435
|
-
|
|
436
|
-
@typing.overload
|
|
437
|
-
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]]]:
|
|
438
|
-
"""
|
|
439
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
512
|
+
# **Usage: explicitly loading models at runtime from the Hugging Face Hub or from cache (from Metaflow's datastore)**
|
|
513
|
+
@huggingface_hub
|
|
514
|
+
@step
|
|
515
|
+
def run_training(self):
|
|
516
|
+
# Temporary directory (auto-cleaned on exit)
|
|
517
|
+
with current.huggingface_hub.load(
|
|
518
|
+
repo_id="google-bert/bert-base-uncased",
|
|
519
|
+
allow_patterns=["*.bin"],
|
|
520
|
+
) as local_path:
|
|
521
|
+
# Use files under local_path
|
|
522
|
+
train_model(local_path)
|
|
523
|
+
...
|
|
440
524
|
|
|
441
|
-
|
|
525
|
+
# **Usage: loading models directly from the Hugging Face Hub or from cache (from Metaflow's datastore)**
|
|
526
|
+
|
|
527
|
+
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
|
528
|
+
@step
|
|
529
|
+
def pull_model_from_huggingface(self):
|
|
530
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
531
|
+
|
|
532
|
+
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora", "/my-lora-directory")])
|
|
533
|
+
@step
|
|
534
|
+
def finetune_model(self):
|
|
535
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
536
|
+
# path_to_model will be /my-directory
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
# Takes all the arguments passed to `snapshot_download`
|
|
540
|
+
# except for `local_dir`
|
|
541
|
+
@huggingface_hub(load=[
|
|
542
|
+
{
|
|
543
|
+
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
|
544
|
+
},
|
|
545
|
+
{
|
|
546
|
+
"repo_id": "myorg/mistral-lora",
|
|
547
|
+
"repo_type": "model",
|
|
548
|
+
},
|
|
549
|
+
])
|
|
550
|
+
@step
|
|
551
|
+
def finetune_model(self):
|
|
552
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
553
|
+
# path_to_model will be /my-directory
|
|
554
|
+
```
|
|
442
555
|
|
|
443
556
|
|
|
444
557
|
Parameters
|
|
445
558
|
----------
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
559
|
+
temp_dir_root : str, optional
|
|
560
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
|
561
|
+
|
|
562
|
+
cache_scope : str, optional
|
|
563
|
+
The scope of the cache. Can be `checkpoint` / `flow` / `global`.
|
|
564
|
+
- `checkpoint` (default): All repos are stored like objects saved by `@checkpoint`.
|
|
565
|
+
i.e., the cached path is derived from the namespace, flow, step, and Metaflow foreach iteration.
|
|
566
|
+
Any repo downloaded under this scope will only be retrieved from the cache when the step runs under the same namespace in the same flow (at the same foreach index).
|
|
567
|
+
|
|
568
|
+
- `flow`: All repos are cached under the flow, regardless of namespace.
|
|
569
|
+
i.e., the cached path is derived solely from the flow name.
|
|
570
|
+
When to use this mode: (1) Multiple users are executing the same flow and want shared access to the repos cached by the decorator. (2) Multiple versions of a flow are deployed, all needing access to the same repos cached by the decorator.
|
|
571
|
+
|
|
572
|
+
- `global`: All repos are cached under a globally static path.
|
|
573
|
+
i.e., the base path of the cache is static and all repos are stored under it.
|
|
574
|
+
When to use this mode:
|
|
575
|
+
- All repos from the Hugging Face Hub need to be shared by users across all flow executions.
|
|
576
|
+
- Each caching scope comes with its own trade-offs:
|
|
577
|
+
- `checkpoint`:
|
|
578
|
+
- Has explicit control over when caches are populated (controlled by the same flow that has the `@huggingface_hub` decorator) but ends up hitting the Hugging Face Hub more often if there are many users/namespaces/steps.
|
|
579
|
+
- Since objects are written on a `namespace/flow/step` basis, the blast radius of a bad checkpoint is limited to a particular flow in a namespace.
|
|
580
|
+
- `flow`:
|
|
581
|
+
- Has less control over when caches are populated (can be written by any execution instance of a flow from any namespace) but results in more cache hits.
|
|
582
|
+
- The blast radius of a bad checkpoint is limited to all runs of a particular flow.
|
|
583
|
+
- It doesn't promote cache reuse across flows.
|
|
584
|
+
- `global`:
|
|
585
|
+
- Has no control over when caches are populated (can be written by any flow execution) but has the highest cache hit rate.
|
|
586
|
+
- It promotes cache reuse across flows.
|
|
587
|
+
- The blast radius of a bad checkpoint spans every flow that could be using a particular repo.
|
|
588
|
+
|
|
589
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
|
590
|
+
The list of repos (models/datasets) to load.
|
|
591
|
+
|
|
592
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
|
593
|
+
|
|
594
|
+
- If repo (model/dataset) is not found in the datastore:
|
|
595
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
|
596
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
|
597
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
|
598
|
+
|
|
599
|
+
- If repo is found in the datastore:
|
|
600
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
|
454
601
|
"""
|
|
455
602
|
...
|
|
456
603
|
|
|
457
|
-
|
|
458
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
459
|
-
...
|
|
460
|
-
|
|
461
|
-
@typing.overload
|
|
462
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
463
|
-
...
|
|
464
|
-
|
|
465
|
-
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):
|
|
604
|
+
def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
466
605
|
"""
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
606
|
+
Specifies that this step should execute on DGX cloud.
|
|
470
607
|
|
|
471
608
|
|
|
472
609
|
Parameters
|
|
473
610
|
----------
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
options : Dict[str, Any], default {}
|
|
479
|
-
Options passed to the card. The contents depend on the card type.
|
|
480
|
-
timeout : int, default 45
|
|
481
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
611
|
+
gpu : int
|
|
612
|
+
Number of GPUs to use.
|
|
613
|
+
gpu_type : str
|
|
614
|
+
Type of Nvidia GPU to use.
|
|
482
615
|
"""
|
|
483
616
|
...
|
|
484
617
|
|
|
485
|
-
def
|
|
618
|
+
def vllm(*, model: str, backend: str, openai_api_server: bool, debug: bool, card_refresh_interval: int, max_retries: int, retry_alert_frequency: int, engine_args: dict) -> 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]]]:
|
|
486
619
|
"""
|
|
487
|
-
This decorator is used to run
|
|
620
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
|
488
621
|
|
|
489
622
|
User code call
|
|
490
623
|
--------------
|
|
491
|
-
@
|
|
492
|
-
|
|
624
|
+
@vllm(
|
|
625
|
+
model="...",
|
|
493
626
|
...
|
|
494
627
|
)
|
|
495
628
|
|
|
496
629
|
Valid backend options
|
|
497
630
|
---------------------
|
|
498
631
|
- 'local': Run as a separate process on the local task machine.
|
|
499
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
500
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
501
632
|
|
|
502
633
|
Valid model options
|
|
503
634
|
-------------------
|
|
504
|
-
Any model
|
|
635
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
|
636
|
+
|
|
637
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
|
638
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
|
505
639
|
|
|
506
640
|
|
|
507
641
|
Parameters
|
|
508
642
|
----------
|
|
509
|
-
|
|
510
|
-
|
|
643
|
+
model: str
|
|
644
|
+
HuggingFace model identifier to be served by vLLM.
|
|
511
645
|
backend: str
|
|
512
|
-
Determines where and how to run the
|
|
513
|
-
|
|
514
|
-
Whether to
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
force_cache_update: bool
|
|
518
|
-
Simple override for "force" cache update policy.
|
|
646
|
+
Determines where and how to run the vLLM process.
|
|
647
|
+
openai_api_server: bool
|
|
648
|
+
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
|
649
|
+
Default is False (uses native engine).
|
|
650
|
+
Set to True for backward compatibility with existing code.
|
|
519
651
|
debug: bool
|
|
520
652
|
Whether to turn on verbose debugging logs.
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
653
|
+
card_refresh_interval: int
|
|
654
|
+
Interval in seconds for refreshing the vLLM status card.
|
|
655
|
+
Only used when openai_api_server=True.
|
|
656
|
+
max_retries: int
|
|
657
|
+
Maximum number of retries checking for vLLM server startup.
|
|
658
|
+
Only used when openai_api_server=True.
|
|
659
|
+
retry_alert_frequency: int
|
|
660
|
+
Frequency of alert logs for vLLM server startup retries.
|
|
661
|
+
Only used when openai_api_server=True.
|
|
662
|
+
engine_args : dict
|
|
663
|
+
Additional keyword arguments to pass to the vLLM engine.
|
|
664
|
+
For example, `tensor_parallel_size=2`.
|
|
525
665
|
"""
|
|
526
666
|
...
|
|
527
667
|
|
|
528
668
|
@typing.overload
|
|
529
|
-
def
|
|
669
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
530
670
|
"""
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
671
|
+
Internal decorator to support Fast bakery
|
|
672
|
+
"""
|
|
673
|
+
...
|
|
674
|
+
|
|
675
|
+
@typing.overload
|
|
676
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
677
|
+
...
|
|
678
|
+
|
|
679
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
680
|
+
"""
|
|
681
|
+
Internal decorator to support Fast bakery
|
|
682
|
+
"""
|
|
683
|
+
...
|
|
684
|
+
|
|
685
|
+
@typing.overload
|
|
686
|
+
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]]]:
|
|
687
|
+
"""
|
|
688
|
+
Specifies the resources needed when executing this step.
|
|
534
689
|
|
|
535
|
-
|
|
690
|
+
Use `@resources` to specify the resource requirements
|
|
691
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
536
692
|
|
|
537
|
-
|
|
538
|
-
@checkpoint
|
|
539
|
-
@step
|
|
540
|
-
def train(self):
|
|
541
|
-
model = create_model(self.parameters, checkpoint_path = None)
|
|
542
|
-
for i in range(self.epochs):
|
|
543
|
-
# some training logic
|
|
544
|
-
loss = model.train(self.dataset)
|
|
545
|
-
if i % 10 == 0:
|
|
546
|
-
model.save(
|
|
547
|
-
current.checkpoint.directory,
|
|
548
|
-
)
|
|
549
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
550
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
551
|
-
self.latest_checkpoint = current.checkpoint.save(
|
|
552
|
-
name="epoch_checkpoint",
|
|
553
|
-
metadata={
|
|
554
|
-
"epoch": i,
|
|
555
|
-
"loss": loss,
|
|
556
|
-
}
|
|
557
|
-
)
|
|
693
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
558
694
|
```
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
```
|
|
563
|
-
|
|
564
|
-
@checkpoint
|
|
565
|
-
@step
|
|
566
|
-
def train(self):
|
|
567
|
-
# Assume that the task has restarted and the previous attempt of the task
|
|
568
|
-
# saved a checkpoint
|
|
569
|
-
checkpoint_path = None
|
|
570
|
-
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
571
|
-
print("Loaded checkpoint from the previous attempt")
|
|
572
|
-
checkpoint_path = current.checkpoint.directory
|
|
573
|
-
|
|
574
|
-
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
575
|
-
for i in range(self.epochs):
|
|
576
|
-
...
|
|
695
|
+
python myflow.py run --with batch
|
|
696
|
+
```
|
|
697
|
+
or
|
|
698
|
+
```
|
|
699
|
+
python myflow.py run --with kubernetes
|
|
577
700
|
```
|
|
701
|
+
which executes the flow on the desired system using the
|
|
702
|
+
requirements specified in `@resources`.
|
|
578
703
|
|
|
579
704
|
|
|
580
705
|
Parameters
|
|
581
706
|
----------
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
temp_dir_root : str, default: None
|
|
594
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
707
|
+
cpu : int, default 1
|
|
708
|
+
Number of CPUs required for this step.
|
|
709
|
+
gpu : int, optional, default None
|
|
710
|
+
Number of GPUs required for this step.
|
|
711
|
+
disk : int, optional, default None
|
|
712
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
713
|
+
memory : int, default 4096
|
|
714
|
+
Memory size (in MB) required for this step.
|
|
715
|
+
shared_memory : int, optional, default None
|
|
716
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
717
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
595
718
|
"""
|
|
596
719
|
...
|
|
597
720
|
|
|
598
721
|
@typing.overload
|
|
599
|
-
def
|
|
722
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
600
723
|
...
|
|
601
724
|
|
|
602
725
|
@typing.overload
|
|
603
|
-
def
|
|
726
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
604
727
|
...
|
|
605
728
|
|
|
606
|
-
def
|
|
729
|
+
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):
|
|
607
730
|
"""
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
> Examples
|
|
731
|
+
Specifies the resources needed when executing this step.
|
|
611
732
|
|
|
612
|
-
|
|
733
|
+
Use `@resources` to specify the resource requirements
|
|
734
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
613
735
|
|
|
614
|
-
|
|
615
|
-
@checkpoint
|
|
616
|
-
@step
|
|
617
|
-
def train(self):
|
|
618
|
-
model = create_model(self.parameters, checkpoint_path = None)
|
|
619
|
-
for i in range(self.epochs):
|
|
620
|
-
# some training logic
|
|
621
|
-
loss = model.train(self.dataset)
|
|
622
|
-
if i % 10 == 0:
|
|
623
|
-
model.save(
|
|
624
|
-
current.checkpoint.directory,
|
|
625
|
-
)
|
|
626
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
627
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
628
|
-
self.latest_checkpoint = current.checkpoint.save(
|
|
629
|
-
name="epoch_checkpoint",
|
|
630
|
-
metadata={
|
|
631
|
-
"epoch": i,
|
|
632
|
-
"loss": loss,
|
|
633
|
-
}
|
|
634
|
-
)
|
|
736
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
635
737
|
```
|
|
636
|
-
|
|
637
|
-
- Using Loaded Checkpoints
|
|
638
|
-
|
|
639
|
-
```python
|
|
640
|
-
@retry(times=3)
|
|
641
|
-
@checkpoint
|
|
642
|
-
@step
|
|
643
|
-
def train(self):
|
|
644
|
-
# Assume that the task has restarted and the previous attempt of the task
|
|
645
|
-
# saved a checkpoint
|
|
646
|
-
checkpoint_path = None
|
|
647
|
-
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
648
|
-
print("Loaded checkpoint from the previous attempt")
|
|
649
|
-
checkpoint_path = current.checkpoint.directory
|
|
650
|
-
|
|
651
|
-
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
652
|
-
for i in range(self.epochs):
|
|
653
|
-
...
|
|
738
|
+
python myflow.py run --with batch
|
|
654
739
|
```
|
|
740
|
+
or
|
|
741
|
+
```
|
|
742
|
+
python myflow.py run --with kubernetes
|
|
743
|
+
```
|
|
744
|
+
which executes the flow on the desired system using the
|
|
745
|
+
requirements specified in `@resources`.
|
|
655
746
|
|
|
656
747
|
|
|
657
748
|
Parameters
|
|
658
749
|
----------
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
temp_dir_root : str, default: None
|
|
671
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
672
|
-
"""
|
|
673
|
-
...
|
|
674
|
-
|
|
675
|
-
def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
676
|
-
"""
|
|
677
|
-
Specifies that this step should execute on DGX cloud.
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
Parameters
|
|
681
|
-
----------
|
|
682
|
-
gpu : int
|
|
683
|
-
Number of GPUs to use.
|
|
684
|
-
gpu_type : str
|
|
685
|
-
Type of Nvidia GPU to use.
|
|
750
|
+
cpu : int, default 1
|
|
751
|
+
Number of CPUs required for this step.
|
|
752
|
+
gpu : int, optional, default None
|
|
753
|
+
Number of GPUs required for this step.
|
|
754
|
+
disk : int, optional, default None
|
|
755
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
756
|
+
memory : int, default 4096
|
|
757
|
+
Memory size (in MB) required for this step.
|
|
758
|
+
shared_memory : int, optional, default None
|
|
759
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
760
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
686
761
|
"""
|
|
687
762
|
...
|
|
688
763
|
|
|
@@ -775,179 +850,112 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
|
775
850
|
"""
|
|
776
851
|
...
|
|
777
852
|
|
|
778
|
-
|
|
853
|
+
@typing.overload
|
|
854
|
+
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]]]:
|
|
779
855
|
"""
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
This decorator requires an integration in the Outerbounds platform that
|
|
784
|
-
points to an external bucket. It affects S3 operations performed via
|
|
785
|
-
Metaflow's `get_aws_client` and `S3` within a `@step`.
|
|
786
|
-
|
|
787
|
-
Read operations
|
|
788
|
-
---------------
|
|
789
|
-
All read operations pass through the proxy. If an object does not already
|
|
790
|
-
exist in the external bucket, it is cached there. For example, if code reads
|
|
791
|
-
from buckets `FOO` and `BAR` using the `S3` interface, objects from both
|
|
792
|
-
buckets are cached in the external bucket.
|
|
793
|
-
|
|
794
|
-
During task execution, all S3‑related read requests are routed through the
|
|
795
|
-
proxy:
|
|
796
|
-
- If the object is present in the external object store, the proxy
|
|
797
|
-
streams it directly from there without accessing the requested origin
|
|
798
|
-
bucket.
|
|
799
|
-
- If the object is not present in the external storage, the proxy
|
|
800
|
-
fetches it from the requested bucket, caches it in the external
|
|
801
|
-
storage, and streams the response from the origin bucket.
|
|
802
|
-
|
|
803
|
-
Warning
|
|
804
|
-
-------
|
|
805
|
-
All READ operations (e.g., GetObject, HeadObject) pass through the external
|
|
806
|
-
bucket regardless of the bucket specified in user code. Even
|
|
807
|
-
`S3(run=self)` and `S3(s3root="mybucketfoo")` requests go through the
|
|
808
|
-
external bucket cache.
|
|
856
|
+
Specifies the number of times the task corresponding
|
|
857
|
+
to a step needs to be retried.
|
|
809
858
|
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
whether writes also persist objects in the cache.
|
|
859
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
860
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
861
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
814
862
|
|
|
815
|
-
`
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
- `origin`: objects are written only to their intended origin bucket.
|
|
863
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
864
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
865
|
+
ensuring that the flow execution can continue.
|
|
819
866
|
|
|
820
867
|
|
|
821
868
|
Parameters
|
|
822
869
|
----------
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
integration in the namespace is used (fails if multiple exist).
|
|
828
|
-
write_mode : str, optional
|
|
829
|
-
Controls whether writes also go to the external bucket.
|
|
830
|
-
- `origin` (default)
|
|
831
|
-
- `origin-and-cache`
|
|
832
|
-
debug : bool, optional
|
|
833
|
-
Enables debug logging for proxy operations.
|
|
870
|
+
times : int, default 3
|
|
871
|
+
Number of times to retry this task.
|
|
872
|
+
minutes_between_retries : int, default 2
|
|
873
|
+
Number of minutes between retries.
|
|
834
874
|
"""
|
|
835
875
|
...
|
|
836
876
|
|
|
837
|
-
|
|
877
|
+
@typing.overload
|
|
878
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
879
|
+
...
|
|
880
|
+
|
|
881
|
+
@typing.overload
|
|
882
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
883
|
+
...
|
|
884
|
+
|
|
885
|
+
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):
|
|
838
886
|
"""
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
Examples
|
|
842
|
-
--------
|
|
843
|
-
|
|
844
|
-
```python
|
|
845
|
-
# **Usage: creating references to models from the Hugging Face Hub that may be loaded in downstream steps**
|
|
846
|
-
@huggingface_hub
|
|
847
|
-
@step
|
|
848
|
-
def pull_model_from_huggingface(self):
|
|
849
|
-
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
|
850
|
-
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
|
851
|
-
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
|
852
|
-
# value of the function is a reference to the model in the backend storage.
|
|
853
|
-
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
|
854
|
-
|
|
855
|
-
self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
|
|
856
|
-
self.llama_model = current.huggingface_hub.snapshot_download(
|
|
857
|
-
repo_id=self.model_id,
|
|
858
|
-
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
|
859
|
-
)
|
|
860
|
-
self.next(self.train)
|
|
861
|
-
|
|
862
|
-
# **Usage: explicitly loading models at runtime from the Hugging Face Hub or from cache (from Metaflow's datastore)**
|
|
863
|
-
@huggingface_hub
|
|
864
|
-
@step
|
|
865
|
-
def run_training(self):
|
|
866
|
-
# Temporary directory (auto-cleaned on exit)
|
|
867
|
-
with current.huggingface_hub.load(
|
|
868
|
-
repo_id="google-bert/bert-base-uncased",
|
|
869
|
-
allow_patterns=["*.bin"],
|
|
870
|
-
) as local_path:
|
|
871
|
-
# Use files under local_path
|
|
872
|
-
train_model(local_path)
|
|
873
|
-
...
|
|
874
|
-
|
|
875
|
-
# **Usage: loading models directly from the Hugging Face Hub or from cache (from Metaflow's datastore)**
|
|
876
|
-
|
|
877
|
-
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
|
878
|
-
@step
|
|
879
|
-
def pull_model_from_huggingface(self):
|
|
880
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
881
|
-
|
|
882
|
-
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora", "/my-lora-directory")])
|
|
883
|
-
@step
|
|
884
|
-
def finetune_model(self):
|
|
885
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
886
|
-
# path_to_model will be /my-directory
|
|
887
|
+
Specifies the number of times the task corresponding
|
|
888
|
+
to a step needs to be retried.
|
|
887
889
|
|
|
890
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
891
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
892
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
888
893
|
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
{
|
|
893
|
-
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
|
894
|
-
},
|
|
895
|
-
{
|
|
896
|
-
"repo_id": "myorg/mistral-lora",
|
|
897
|
-
"repo_type": "model",
|
|
898
|
-
},
|
|
899
|
-
])
|
|
900
|
-
@step
|
|
901
|
-
def finetune_model(self):
|
|
902
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
903
|
-
# path_to_model will be /my-directory
|
|
904
|
-
```
|
|
894
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
895
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
896
|
+
ensuring that the flow execution can continue.
|
|
905
897
|
|
|
906
898
|
|
|
907
899
|
Parameters
|
|
908
900
|
----------
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
901
|
+
times : int, default 3
|
|
902
|
+
Number of times to retry this task.
|
|
903
|
+
minutes_between_retries : int, default 2
|
|
904
|
+
Number of minutes between retries.
|
|
905
|
+
"""
|
|
906
|
+
...
|
|
907
|
+
|
|
908
|
+
@typing.overload
|
|
909
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
910
|
+
"""
|
|
911
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
912
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
913
|
+
"""
|
|
914
|
+
...
|
|
915
|
+
|
|
916
|
+
@typing.overload
|
|
917
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
918
|
+
...
|
|
919
|
+
|
|
920
|
+
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
921
|
+
"""
|
|
922
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
923
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
924
|
+
"""
|
|
925
|
+
...
|
|
926
|
+
|
|
927
|
+
@typing.overload
|
|
928
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
929
|
+
"""
|
|
930
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
931
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
932
|
+
"""
|
|
933
|
+
...
|
|
934
|
+
|
|
935
|
+
@typing.overload
|
|
936
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
937
|
+
...
|
|
938
|
+
|
|
939
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
940
|
+
"""
|
|
941
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
942
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
943
|
+
"""
|
|
944
|
+
...
|
|
945
|
+
|
|
946
|
+
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]]]:
|
|
947
|
+
"""
|
|
948
|
+
Specifies that this step should execute on DGX cloud.
|
|
943
949
|
|
|
944
|
-
- If repo (model/dataset) is not found in the datastore:
|
|
945
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
|
946
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
|
947
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
|
948
950
|
|
|
949
|
-
|
|
950
|
-
|
|
951
|
+
Parameters
|
|
952
|
+
----------
|
|
953
|
+
gpu : int
|
|
954
|
+
Number of GPUs to use.
|
|
955
|
+
gpu_type : str
|
|
956
|
+
Type of Nvidia GPU to use.
|
|
957
|
+
queue_timeout : int
|
|
958
|
+
Time to keep the job in NVCF's queue.
|
|
951
959
|
"""
|
|
952
960
|
...
|
|
953
961
|
|
|
@@ -1080,27 +1088,50 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
1080
1088
|
"""
|
|
1081
1089
|
...
|
|
1082
1090
|
|
|
1083
|
-
|
|
1091
|
+
@typing.overload
|
|
1092
|
+
def secrets(*, sources: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], role: 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]]]:
|
|
1093
|
+
"""
|
|
1094
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
1095
|
+
the execution of a step.
|
|
1096
|
+
|
|
1097
|
+
|
|
1098
|
+
Parameters
|
|
1099
|
+
----------
|
|
1100
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
1101
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
1102
|
+
role : str, optional, default: None
|
|
1103
|
+
Role to use for fetching secrets
|
|
1104
|
+
"""
|
|
1105
|
+
...
|
|
1106
|
+
|
|
1107
|
+
@typing.overload
|
|
1108
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1109
|
+
...
|
|
1110
|
+
|
|
1111
|
+
@typing.overload
|
|
1112
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1113
|
+
...
|
|
1114
|
+
|
|
1115
|
+
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]]] = [], role: typing.Optional[str] = None):
|
|
1084
1116
|
"""
|
|
1085
|
-
Specifies
|
|
1117
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
1118
|
+
the execution of a step.
|
|
1086
1119
|
|
|
1087
1120
|
|
|
1088
1121
|
Parameters
|
|
1089
1122
|
----------
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
queue_timeout : int
|
|
1095
|
-
Time to keep the job in NVCF's queue.
|
|
1123
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
1124
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
1125
|
+
role : str, optional, default: None
|
|
1126
|
+
Role to use for fetching secrets
|
|
1096
1127
|
"""
|
|
1097
1128
|
...
|
|
1098
1129
|
|
|
1099
|
-
def
|
|
1130
|
+
def nebius_s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typing.Optional[str] = None, debug: typing.Optional[bool] = 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]]]:
|
|
1100
1131
|
"""
|
|
1101
|
-
`@
|
|
1132
|
+
`@nebius_s3_proxy` is a Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
1102
1133
|
It exists to make it easier for users to know that this decorator should only be used with
|
|
1103
|
-
a Neo Cloud like
|
|
1134
|
+
a Neo Cloud like Nebius. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
|
|
1104
1135
|
|
|
1105
1136
|
|
|
1106
1137
|
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
@@ -1161,245 +1192,207 @@ def coreweave_s3_proxy(*, integration_name: typing.Optional[str] = None, write_m
|
|
|
1161
1192
|
...
|
|
1162
1193
|
|
|
1163
1194
|
@typing.overload
|
|
1164
|
-
def
|
|
1195
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1165
1196
|
"""
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
This decorator is useful if this step may hang indefinitely.
|
|
1169
|
-
|
|
1170
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
1171
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
1172
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
1173
|
-
|
|
1174
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
1175
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
Parameters
|
|
1179
|
-
----------
|
|
1180
|
-
seconds : int, default 0
|
|
1181
|
-
Number of seconds to wait prior to timing out.
|
|
1182
|
-
minutes : int, default 0
|
|
1183
|
-
Number of minutes to wait prior to timing out.
|
|
1184
|
-
hours : int, default 0
|
|
1185
|
-
Number of hours to wait prior to timing out.
|
|
1197
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
1198
|
+
to inject a card and render simple markdown content.
|
|
1186
1199
|
"""
|
|
1187
1200
|
...
|
|
1188
1201
|
|
|
1189
1202
|
@typing.overload
|
|
1190
|
-
def
|
|
1191
|
-
...
|
|
1192
|
-
|
|
1193
|
-
@typing.overload
|
|
1194
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1203
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1195
1204
|
...
|
|
1196
1205
|
|
|
1197
|
-
def
|
|
1206
|
+
def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
1198
1207
|
"""
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
This decorator is useful if this step may hang indefinitely.
|
|
1202
|
-
|
|
1203
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
1204
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
1205
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
1206
|
-
|
|
1207
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
1208
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
Parameters
|
|
1212
|
-
----------
|
|
1213
|
-
seconds : int, default 0
|
|
1214
|
-
Number of seconds to wait prior to timing out.
|
|
1215
|
-
minutes : int, default 0
|
|
1216
|
-
Number of minutes to wait prior to timing out.
|
|
1217
|
-
hours : int, default 0
|
|
1218
|
-
Number of hours to wait prior to timing out.
|
|
1208
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
1209
|
+
to inject a card and render simple markdown content.
|
|
1219
1210
|
"""
|
|
1220
1211
|
...
|
|
1221
1212
|
|
|
1222
|
-
|
|
1213
|
+
@typing.overload
|
|
1214
|
+
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
1223
1215
|
"""
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
User code call
|
|
1227
|
-
--------------
|
|
1228
|
-
@vllm(
|
|
1229
|
-
model="...",
|
|
1230
|
-
...
|
|
1231
|
-
)
|
|
1232
|
-
|
|
1233
|
-
Valid backend options
|
|
1234
|
-
---------------------
|
|
1235
|
-
- 'local': Run as a separate process on the local task machine.
|
|
1236
|
-
|
|
1237
|
-
Valid model options
|
|
1238
|
-
-------------------
|
|
1239
|
-
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
|
1216
|
+
Specifies that the step will success under all circumstances.
|
|
1240
1217
|
|
|
1241
|
-
|
|
1242
|
-
|
|
1218
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
1219
|
+
contains the exception raised. You can use it to detect the presence
|
|
1220
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
1221
|
+
are missing.
|
|
1243
1222
|
|
|
1244
1223
|
|
|
1245
1224
|
Parameters
|
|
1246
1225
|
----------
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
Default is False (uses native engine).
|
|
1254
|
-
Set to True for backward compatibility with existing code.
|
|
1255
|
-
debug: bool
|
|
1256
|
-
Whether to turn on verbose debugging logs.
|
|
1257
|
-
card_refresh_interval: int
|
|
1258
|
-
Interval in seconds for refreshing the vLLM status card.
|
|
1259
|
-
Only used when openai_api_server=True.
|
|
1260
|
-
max_retries: int
|
|
1261
|
-
Maximum number of retries checking for vLLM server startup.
|
|
1262
|
-
Only used when openai_api_server=True.
|
|
1263
|
-
retry_alert_frequency: int
|
|
1264
|
-
Frequency of alert logs for vLLM server startup retries.
|
|
1265
|
-
Only used when openai_api_server=True.
|
|
1266
|
-
engine_args : dict
|
|
1267
|
-
Additional keyword arguments to pass to the vLLM engine.
|
|
1268
|
-
For example, `tensor_parallel_size=2`.
|
|
1226
|
+
var : str, optional, default None
|
|
1227
|
+
Name of the artifact in which to store the caught exception.
|
|
1228
|
+
If not specified, the exception is not stored.
|
|
1229
|
+
print_exception : bool, default True
|
|
1230
|
+
Determines whether or not the exception is printed to
|
|
1231
|
+
stdout when caught.
|
|
1269
1232
|
"""
|
|
1270
1233
|
...
|
|
1271
1234
|
|
|
1272
1235
|
@typing.overload
|
|
1273
|
-
def
|
|
1274
|
-
"""
|
|
1275
|
-
Internal decorator to support Fast bakery
|
|
1276
|
-
"""
|
|
1236
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1277
1237
|
...
|
|
1278
1238
|
|
|
1279
1239
|
@typing.overload
|
|
1280
|
-
def
|
|
1240
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1281
1241
|
...
|
|
1282
1242
|
|
|
1283
|
-
def
|
|
1243
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
|
1284
1244
|
"""
|
|
1285
|
-
|
|
1245
|
+
Specifies that the step will success under all circumstances.
|
|
1246
|
+
|
|
1247
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
1248
|
+
contains the exception raised. You can use it to detect the presence
|
|
1249
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
1250
|
+
are missing.
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
Parameters
|
|
1254
|
+
----------
|
|
1255
|
+
var : str, optional, default None
|
|
1256
|
+
Name of the artifact in which to store the caught exception.
|
|
1257
|
+
If not specified, the exception is not stored.
|
|
1258
|
+
print_exception : bool, default True
|
|
1259
|
+
Determines whether or not the exception is printed to
|
|
1260
|
+
stdout when caught.
|
|
1286
1261
|
"""
|
|
1287
1262
|
...
|
|
1288
1263
|
|
|
1289
1264
|
@typing.overload
|
|
1290
|
-
def
|
|
1265
|
+
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]]]:
|
|
1291
1266
|
"""
|
|
1292
|
-
Specifies
|
|
1293
|
-
the execution of a step.
|
|
1267
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
1294
1268
|
|
|
1295
1269
|
|
|
1296
1270
|
Parameters
|
|
1297
1271
|
----------
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
role : str, optional, default: None
|
|
1301
|
-
Role to use for fetching secrets
|
|
1272
|
+
vars : Dict[str, str], default {}
|
|
1273
|
+
Dictionary of environment variables to set.
|
|
1302
1274
|
"""
|
|
1303
1275
|
...
|
|
1304
1276
|
|
|
1305
1277
|
@typing.overload
|
|
1306
|
-
def
|
|
1278
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1307
1279
|
...
|
|
1308
1280
|
|
|
1309
1281
|
@typing.overload
|
|
1310
|
-
def
|
|
1282
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1311
1283
|
...
|
|
1312
1284
|
|
|
1313
|
-
def
|
|
1285
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
1314
1286
|
"""
|
|
1315
|
-
Specifies
|
|
1316
|
-
the execution of a step.
|
|
1287
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
1317
1288
|
|
|
1318
1289
|
|
|
1319
1290
|
Parameters
|
|
1320
1291
|
----------
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
role : str, optional, default: None
|
|
1324
|
-
Role to use for fetching secrets
|
|
1292
|
+
vars : Dict[str, str], default {}
|
|
1293
|
+
Dictionary of environment variables to set.
|
|
1325
1294
|
"""
|
|
1326
1295
|
...
|
|
1327
1296
|
|
|
1328
1297
|
@typing.overload
|
|
1329
|
-
def
|
|
1298
|
+
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]]]:
|
|
1330
1299
|
"""
|
|
1331
|
-
Specifies
|
|
1300
|
+
Specifies the PyPI packages for the step.
|
|
1332
1301
|
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1302
|
+
Information in this decorator will augment any
|
|
1303
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
1304
|
+
you can use `@pypi_base` to set packages required by all
|
|
1305
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1337
1306
|
|
|
1338
1307
|
|
|
1339
1308
|
Parameters
|
|
1340
1309
|
----------
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1310
|
+
packages : Dict[str, str], default: {}
|
|
1311
|
+
Packages to use for this step. The key is the name of the package
|
|
1312
|
+
and the value is the version to use.
|
|
1313
|
+
python : str, optional, default: None
|
|
1314
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1315
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1347
1316
|
"""
|
|
1348
1317
|
...
|
|
1349
1318
|
|
|
1350
1319
|
@typing.overload
|
|
1351
|
-
def
|
|
1320
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1352
1321
|
...
|
|
1353
1322
|
|
|
1354
1323
|
@typing.overload
|
|
1355
|
-
def
|
|
1324
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1356
1325
|
...
|
|
1357
1326
|
|
|
1358
|
-
def
|
|
1327
|
+
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):
|
|
1359
1328
|
"""
|
|
1360
|
-
Specifies
|
|
1329
|
+
Specifies the PyPI packages for the step.
|
|
1330
|
+
|
|
1331
|
+
Information in this decorator will augment any
|
|
1332
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
1333
|
+
you can use `@pypi_base` to set packages required by all
|
|
1334
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1335
|
+
|
|
1336
|
+
|
|
1337
|
+
Parameters
|
|
1338
|
+
----------
|
|
1339
|
+
packages : Dict[str, str], default: {}
|
|
1340
|
+
Packages to use for this step. The key is the name of the package
|
|
1341
|
+
and the value is the version to use.
|
|
1342
|
+
python : str, optional, default: None
|
|
1343
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1344
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1345
|
+
"""
|
|
1346
|
+
...
|
|
1347
|
+
|
|
1348
|
+
def ollama(*, models: list, backend: str, force_pull: bool, cache_update_policy: str, force_cache_update: bool, debug: bool, circuit_breaker_config: dict, timeout_config: dict) -> 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]]]:
|
|
1349
|
+
"""
|
|
1350
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
|
1351
|
+
|
|
1352
|
+
User code call
|
|
1353
|
+
--------------
|
|
1354
|
+
@ollama(
|
|
1355
|
+
models=[...],
|
|
1356
|
+
...
|
|
1357
|
+
)
|
|
1358
|
+
|
|
1359
|
+
Valid backend options
|
|
1360
|
+
---------------------
|
|
1361
|
+
- 'local': Run as a separate process on the local task machine.
|
|
1362
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
1363
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
1361
1364
|
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
are missing.
|
|
1365
|
+
Valid model options
|
|
1366
|
+
-------------------
|
|
1367
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
1366
1368
|
|
|
1367
1369
|
|
|
1368
1370
|
Parameters
|
|
1369
1371
|
----------
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
@typing.overload
|
|
1388
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1389
|
-
...
|
|
1390
|
-
|
|
1391
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
1392
|
-
"""
|
|
1393
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
1394
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
1372
|
+
models: list[str]
|
|
1373
|
+
List of Ollama containers running models in sidecars.
|
|
1374
|
+
backend: str
|
|
1375
|
+
Determines where and how to run the Ollama process.
|
|
1376
|
+
force_pull: bool
|
|
1377
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
1378
|
+
cache_update_policy: str
|
|
1379
|
+
Cache update policy: "auto", "force", or "never".
|
|
1380
|
+
force_cache_update: bool
|
|
1381
|
+
Simple override for "force" cache update policy.
|
|
1382
|
+
debug: bool
|
|
1383
|
+
Whether to turn on verbose debugging logs.
|
|
1384
|
+
circuit_breaker_config: dict
|
|
1385
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
1386
|
+
timeout_config: dict
|
|
1387
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
1395
1388
|
"""
|
|
1396
1389
|
...
|
|
1397
1390
|
|
|
1398
|
-
def
|
|
1391
|
+
def coreweave_s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typing.Optional[str] = None, debug: typing.Optional[bool] = 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]]]:
|
|
1399
1392
|
"""
|
|
1400
|
-
`@
|
|
1393
|
+
`@coreweave_s3_proxy` is a CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
1401
1394
|
It exists to make it easier for users to know that this decorator should only be used with
|
|
1402
|
-
a Neo Cloud like
|
|
1395
|
+
a Neo Cloud like CoreWeave. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
|
|
1403
1396
|
|
|
1404
1397
|
|
|
1405
1398
|
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
@@ -1460,53 +1453,61 @@ def nebius_s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode
|
|
|
1460
1453
|
...
|
|
1461
1454
|
|
|
1462
1455
|
@typing.overload
|
|
1463
|
-
def
|
|
1456
|
+
def conda(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
1464
1457
|
"""
|
|
1465
|
-
Specifies the
|
|
1458
|
+
Specifies the Conda environment for the step.
|
|
1466
1459
|
|
|
1467
1460
|
Information in this decorator will augment any
|
|
1468
|
-
attributes set in the `@
|
|
1469
|
-
you can use `@
|
|
1470
|
-
steps and use `@
|
|
1461
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
1462
|
+
you can use `@conda_base` to set packages required by all
|
|
1463
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
1471
1464
|
|
|
1472
1465
|
|
|
1473
1466
|
Parameters
|
|
1474
1467
|
----------
|
|
1475
|
-
packages : Dict[str, str], default
|
|
1468
|
+
packages : Dict[str, str], default {}
|
|
1476
1469
|
Packages to use for this step. The key is the name of the package
|
|
1477
1470
|
and the value is the version to use.
|
|
1478
|
-
|
|
1471
|
+
libraries : Dict[str, str], default {}
|
|
1472
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1473
|
+
python : str, optional, default None
|
|
1479
1474
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1480
1475
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1476
|
+
disabled : bool, default False
|
|
1477
|
+
If set to True, disables @conda.
|
|
1481
1478
|
"""
|
|
1482
1479
|
...
|
|
1483
1480
|
|
|
1484
1481
|
@typing.overload
|
|
1485
|
-
def
|
|
1482
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1486
1483
|
...
|
|
1487
1484
|
|
|
1488
1485
|
@typing.overload
|
|
1489
|
-
def
|
|
1486
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1490
1487
|
...
|
|
1491
1488
|
|
|
1492
|
-
def
|
|
1489
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
1493
1490
|
"""
|
|
1494
|
-
Specifies the
|
|
1491
|
+
Specifies the Conda environment for the step.
|
|
1495
1492
|
|
|
1496
1493
|
Information in this decorator will augment any
|
|
1497
|
-
attributes set in the `@
|
|
1498
|
-
you can use `@
|
|
1499
|
-
steps and use `@
|
|
1494
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
1495
|
+
you can use `@conda_base` to set packages required by all
|
|
1496
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
1500
1497
|
|
|
1501
1498
|
|
|
1502
1499
|
Parameters
|
|
1503
1500
|
----------
|
|
1504
|
-
packages : Dict[str, str], default
|
|
1501
|
+
packages : Dict[str, str], default {}
|
|
1505
1502
|
Packages to use for this step. The key is the name of the package
|
|
1506
1503
|
and the value is the version to use.
|
|
1507
|
-
|
|
1504
|
+
libraries : Dict[str, str], default {}
|
|
1505
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1506
|
+
python : str, optional, default None
|
|
1508
1507
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1509
1508
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1509
|
+
disabled : bool, default False
|
|
1510
|
+
If set to True, disables @conda.
|
|
1510
1511
|
"""
|
|
1511
1512
|
...
|
|
1512
1513
|
|
|
@@ -1561,49 +1562,6 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
|
1561
1562
|
"""
|
|
1562
1563
|
...
|
|
1563
1564
|
|
|
1564
|
-
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]]:
|
|
1565
|
-
"""
|
|
1566
|
-
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)
|
|
1567
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1568
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1569
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1570
|
-
starts only after all sensors finish.
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
Parameters
|
|
1574
|
-
----------
|
|
1575
|
-
timeout : int
|
|
1576
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1577
|
-
poke_interval : int
|
|
1578
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1579
|
-
mode : str
|
|
1580
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1581
|
-
exponential_backoff : bool
|
|
1582
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1583
|
-
pool : str
|
|
1584
|
-
the slot pool this task should run in,
|
|
1585
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1586
|
-
soft_fail : bool
|
|
1587
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1588
|
-
name : str
|
|
1589
|
-
Name of the sensor on Airflow
|
|
1590
|
-
description : str
|
|
1591
|
-
Description of sensor in the Airflow UI
|
|
1592
|
-
bucket_key : Union[str, List[str]]
|
|
1593
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1594
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1595
|
-
bucket_name : str
|
|
1596
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1597
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1598
|
-
wildcard_match : bool
|
|
1599
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1600
|
-
aws_conn_id : str
|
|
1601
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1602
|
-
verify : bool
|
|
1603
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1604
|
-
"""
|
|
1605
|
-
...
|
|
1606
|
-
|
|
1607
1565
|
@typing.overload
|
|
1608
1566
|
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]]:
|
|
1609
1567
|
"""
|
|
@@ -1655,84 +1613,6 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
|
1655
1613
|
"""
|
|
1656
1614
|
...
|
|
1657
1615
|
|
|
1658
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1659
|
-
"""
|
|
1660
|
-
Specifies what flows belong to the same project.
|
|
1661
|
-
|
|
1662
|
-
A project-specific namespace is created for all flows that
|
|
1663
|
-
use the same `@project(name)`.
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
Parameters
|
|
1667
|
-
----------
|
|
1668
|
-
name : str
|
|
1669
|
-
Project name. Make sure that the name is unique amongst all
|
|
1670
|
-
projects that use the same production scheduler. The name may
|
|
1671
|
-
contain only lowercase alphanumeric characters and underscores.
|
|
1672
|
-
|
|
1673
|
-
branch : Optional[str], default None
|
|
1674
|
-
The branch to use. If not specified, the branch is set to
|
|
1675
|
-
`user.<username>` unless `production` is set to `True`. This can
|
|
1676
|
-
also be set on the command line using `--branch` as a top-level option.
|
|
1677
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
|
1678
|
-
|
|
1679
|
-
production : bool, default False
|
|
1680
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
1681
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
1682
|
-
`production` in the decorator and on the command line.
|
|
1683
|
-
The project branch name will be:
|
|
1684
|
-
- if `branch` is specified:
|
|
1685
|
-
- if `production` is True: `prod.<branch>`
|
|
1686
|
-
- if `production` is False: `test.<branch>`
|
|
1687
|
-
- if `branch` is not specified:
|
|
1688
|
-
- if `production` is True: `prod`
|
|
1689
|
-
- if `production` is False: `user.<username>`
|
|
1690
|
-
"""
|
|
1691
|
-
...
|
|
1692
|
-
|
|
1693
|
-
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]]:
|
|
1694
|
-
"""
|
|
1695
|
-
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.
|
|
1696
|
-
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.
|
|
1697
|
-
|
|
1698
|
-
|
|
1699
|
-
Parameters
|
|
1700
|
-
----------
|
|
1701
|
-
timeout : int
|
|
1702
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1703
|
-
poke_interval : int
|
|
1704
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1705
|
-
mode : str
|
|
1706
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1707
|
-
exponential_backoff : bool
|
|
1708
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1709
|
-
pool : str
|
|
1710
|
-
the slot pool this task should run in,
|
|
1711
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1712
|
-
soft_fail : bool
|
|
1713
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1714
|
-
name : str
|
|
1715
|
-
Name of the sensor on Airflow
|
|
1716
|
-
description : str
|
|
1717
|
-
Description of sensor in the Airflow UI
|
|
1718
|
-
external_dag_id : str
|
|
1719
|
-
The dag_id that contains the task you want to wait for.
|
|
1720
|
-
external_task_ids : List[str]
|
|
1721
|
-
The list of task_ids that you want to wait for.
|
|
1722
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1723
|
-
allowed_states : List[str]
|
|
1724
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1725
|
-
failed_states : List[str]
|
|
1726
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1727
|
-
execution_delta : datetime.timedelta
|
|
1728
|
-
time difference with the previous execution to look at,
|
|
1729
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1730
|
-
check_existence: bool
|
|
1731
|
-
Set to True to check if the external task exists or check if
|
|
1732
|
-
the DAG to wait for exists. (Default: True)
|
|
1733
|
-
"""
|
|
1734
|
-
...
|
|
1735
|
-
|
|
1736
1616
|
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
|
1737
1617
|
"""
|
|
1738
1618
|
Allows setting external datastores to save data for the
|
|
@@ -1847,102 +1727,137 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
|
1847
1727
|
"""
|
|
1848
1728
|
...
|
|
1849
1729
|
|
|
1730
|
+
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]]:
|
|
1731
|
+
"""
|
|
1732
|
+
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.
|
|
1733
|
+
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.
|
|
1734
|
+
|
|
1735
|
+
|
|
1736
|
+
Parameters
|
|
1737
|
+
----------
|
|
1738
|
+
timeout : int
|
|
1739
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1740
|
+
poke_interval : int
|
|
1741
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1742
|
+
mode : str
|
|
1743
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1744
|
+
exponential_backoff : bool
|
|
1745
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1746
|
+
pool : str
|
|
1747
|
+
the slot pool this task should run in,
|
|
1748
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1749
|
+
soft_fail : bool
|
|
1750
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1751
|
+
name : str
|
|
1752
|
+
Name of the sensor on Airflow
|
|
1753
|
+
description : str
|
|
1754
|
+
Description of sensor in the Airflow UI
|
|
1755
|
+
external_dag_id : str
|
|
1756
|
+
The dag_id that contains the task you want to wait for.
|
|
1757
|
+
external_task_ids : List[str]
|
|
1758
|
+
The list of task_ids that you want to wait for.
|
|
1759
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1760
|
+
allowed_states : List[str]
|
|
1761
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1762
|
+
failed_states : List[str]
|
|
1763
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1764
|
+
execution_delta : datetime.timedelta
|
|
1765
|
+
time difference with the previous execution to look at,
|
|
1766
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1767
|
+
check_existence: bool
|
|
1768
|
+
Set to True to check if the external task exists or check if
|
|
1769
|
+
the DAG to wait for exists. (Default: True)
|
|
1770
|
+
"""
|
|
1771
|
+
...
|
|
1772
|
+
|
|
1850
1773
|
@typing.overload
|
|
1851
|
-
def
|
|
1774
|
+
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]]:
|
|
1852
1775
|
"""
|
|
1853
|
-
Specifies the
|
|
1776
|
+
Specifies the event(s) that this flow depends on.
|
|
1854
1777
|
|
|
1855
1778
|
```
|
|
1856
|
-
@
|
|
1779
|
+
@trigger(event='foo')
|
|
1857
1780
|
```
|
|
1858
1781
|
or
|
|
1859
1782
|
```
|
|
1860
|
-
@
|
|
1783
|
+
@trigger(events=['foo', 'bar'])
|
|
1861
1784
|
```
|
|
1862
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1863
|
-
when upstream runs within the same namespace complete successfully
|
|
1864
1785
|
|
|
1865
|
-
Additionally, you can specify
|
|
1866
|
-
|
|
1786
|
+
Additionally, you can specify the parameter mappings
|
|
1787
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1867
1788
|
```
|
|
1868
|
-
@
|
|
1789
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1869
1790
|
```
|
|
1870
1791
|
or
|
|
1871
1792
|
```
|
|
1872
|
-
@
|
|
1793
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1794
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1873
1795
|
```
|
|
1874
1796
|
|
|
1875
|
-
|
|
1876
|
-
inferred from the current project or project branch):
|
|
1797
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1877
1798
|
```
|
|
1878
|
-
@
|
|
1799
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1800
|
+
```
|
|
1801
|
+
This is equivalent to:
|
|
1802
|
+
```
|
|
1803
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1879
1804
|
```
|
|
1880
|
-
|
|
1881
|
-
Note that `branch` is typically one of:
|
|
1882
|
-
- `prod`
|
|
1883
|
-
- `user.bob`
|
|
1884
|
-
- `test.my_experiment`
|
|
1885
|
-
- `prod.staging`
|
|
1886
1805
|
|
|
1887
1806
|
|
|
1888
1807
|
Parameters
|
|
1889
1808
|
----------
|
|
1890
|
-
|
|
1891
|
-
|
|
1892
|
-
|
|
1893
|
-
|
|
1809
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1810
|
+
Event dependency for this flow.
|
|
1811
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1812
|
+
Events dependency for this flow.
|
|
1894
1813
|
options : Dict[str, Any], default {}
|
|
1895
1814
|
Backend-specific configuration for tuning eventing behavior.
|
|
1896
1815
|
"""
|
|
1897
1816
|
...
|
|
1898
1817
|
|
|
1899
1818
|
@typing.overload
|
|
1900
|
-
def
|
|
1819
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1901
1820
|
...
|
|
1902
1821
|
|
|
1903
|
-
def
|
|
1822
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
1904
1823
|
"""
|
|
1905
|
-
Specifies the
|
|
1824
|
+
Specifies the event(s) that this flow depends on.
|
|
1906
1825
|
|
|
1907
1826
|
```
|
|
1908
|
-
@
|
|
1827
|
+
@trigger(event='foo')
|
|
1909
1828
|
```
|
|
1910
1829
|
or
|
|
1911
1830
|
```
|
|
1912
|
-
@
|
|
1831
|
+
@trigger(events=['foo', 'bar'])
|
|
1913
1832
|
```
|
|
1914
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1915
|
-
when upstream runs within the same namespace complete successfully
|
|
1916
1833
|
|
|
1917
|
-
Additionally, you can specify
|
|
1918
|
-
|
|
1834
|
+
Additionally, you can specify the parameter mappings
|
|
1835
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1919
1836
|
```
|
|
1920
|
-
@
|
|
1837
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1921
1838
|
```
|
|
1922
1839
|
or
|
|
1923
1840
|
```
|
|
1924
|
-
@
|
|
1841
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1842
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1925
1843
|
```
|
|
1926
1844
|
|
|
1927
|
-
|
|
1928
|
-
inferred from the current project or project branch):
|
|
1845
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1929
1846
|
```
|
|
1930
|
-
@
|
|
1847
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1848
|
+
```
|
|
1849
|
+
This is equivalent to:
|
|
1850
|
+
```
|
|
1851
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1931
1852
|
```
|
|
1932
|
-
|
|
1933
|
-
Note that `branch` is typically one of:
|
|
1934
|
-
- `prod`
|
|
1935
|
-
- `user.bob`
|
|
1936
|
-
- `test.my_experiment`
|
|
1937
|
-
- `prod.staging`
|
|
1938
1853
|
|
|
1939
1854
|
|
|
1940
1855
|
Parameters
|
|
1941
1856
|
----------
|
|
1942
|
-
|
|
1943
|
-
|
|
1944
|
-
|
|
1945
|
-
|
|
1857
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1858
|
+
Event dependency for this flow.
|
|
1859
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1860
|
+
Events dependency for this flow.
|
|
1946
1861
|
options : Dict[str, Any], default {}
|
|
1947
1862
|
Backend-specific configuration for tuning eventing behavior.
|
|
1948
1863
|
"""
|
|
@@ -1989,98 +1904,184 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
|
1989
1904
|
"""
|
|
1990
1905
|
...
|
|
1991
1906
|
|
|
1907
|
+
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]]:
|
|
1908
|
+
"""
|
|
1909
|
+
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)
|
|
1910
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1911
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1912
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1913
|
+
starts only after all sensors finish.
|
|
1914
|
+
|
|
1915
|
+
|
|
1916
|
+
Parameters
|
|
1917
|
+
----------
|
|
1918
|
+
timeout : int
|
|
1919
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1920
|
+
poke_interval : int
|
|
1921
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1922
|
+
mode : str
|
|
1923
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1924
|
+
exponential_backoff : bool
|
|
1925
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1926
|
+
pool : str
|
|
1927
|
+
the slot pool this task should run in,
|
|
1928
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1929
|
+
soft_fail : bool
|
|
1930
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1931
|
+
name : str
|
|
1932
|
+
Name of the sensor on Airflow
|
|
1933
|
+
description : str
|
|
1934
|
+
Description of sensor in the Airflow UI
|
|
1935
|
+
bucket_key : Union[str, List[str]]
|
|
1936
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1937
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1938
|
+
bucket_name : str
|
|
1939
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1940
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1941
|
+
wildcard_match : bool
|
|
1942
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1943
|
+
aws_conn_id : str
|
|
1944
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1945
|
+
verify : bool
|
|
1946
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1947
|
+
"""
|
|
1948
|
+
...
|
|
1949
|
+
|
|
1992
1950
|
@typing.overload
|
|
1993
|
-
def
|
|
1951
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1994
1952
|
"""
|
|
1995
|
-
Specifies the
|
|
1953
|
+
Specifies the flow(s) that this flow depends on.
|
|
1996
1954
|
|
|
1997
1955
|
```
|
|
1998
|
-
@
|
|
1956
|
+
@trigger_on_finish(flow='FooFlow')
|
|
1999
1957
|
```
|
|
2000
1958
|
or
|
|
2001
1959
|
```
|
|
2002
|
-
@
|
|
1960
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
2003
1961
|
```
|
|
1962
|
+
This decorator respects the @project decorator and triggers the flow
|
|
1963
|
+
when upstream runs within the same namespace complete successfully
|
|
2004
1964
|
|
|
2005
|
-
Additionally, you can specify
|
|
2006
|
-
|
|
1965
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
1966
|
+
by specifying the fully qualified project_flow_name.
|
|
2007
1967
|
```
|
|
2008
|
-
@
|
|
1968
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
2009
1969
|
```
|
|
2010
1970
|
or
|
|
2011
1971
|
```
|
|
2012
|
-
@
|
|
2013
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1972
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
2014
1973
|
```
|
|
2015
1974
|
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
2019
|
-
```
|
|
2020
|
-
This is equivalent to:
|
|
1975
|
+
You can also specify just the project or project branch (other values will be
|
|
1976
|
+
inferred from the current project or project branch):
|
|
2021
1977
|
```
|
|
2022
|
-
@
|
|
1978
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
2023
1979
|
```
|
|
2024
1980
|
|
|
1981
|
+
Note that `branch` is typically one of:
|
|
1982
|
+
- `prod`
|
|
1983
|
+
- `user.bob`
|
|
1984
|
+
- `test.my_experiment`
|
|
1985
|
+
- `prod.staging`
|
|
1986
|
+
|
|
2025
1987
|
|
|
2026
1988
|
Parameters
|
|
2027
1989
|
----------
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
2031
|
-
|
|
1990
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1991
|
+
Upstream flow dependency for this flow.
|
|
1992
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1993
|
+
Upstream flow dependencies for this flow.
|
|
2032
1994
|
options : Dict[str, Any], default {}
|
|
2033
1995
|
Backend-specific configuration for tuning eventing behavior.
|
|
2034
1996
|
"""
|
|
2035
1997
|
...
|
|
2036
1998
|
|
|
2037
1999
|
@typing.overload
|
|
2038
|
-
def
|
|
2000
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
2039
2001
|
...
|
|
2040
2002
|
|
|
2041
|
-
def
|
|
2003
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
2042
2004
|
"""
|
|
2043
|
-
Specifies the
|
|
2005
|
+
Specifies the flow(s) that this flow depends on.
|
|
2044
2006
|
|
|
2045
2007
|
```
|
|
2046
|
-
@
|
|
2008
|
+
@trigger_on_finish(flow='FooFlow')
|
|
2047
2009
|
```
|
|
2048
2010
|
or
|
|
2049
2011
|
```
|
|
2050
|
-
@
|
|
2012
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
2051
2013
|
```
|
|
2014
|
+
This decorator respects the @project decorator and triggers the flow
|
|
2015
|
+
when upstream runs within the same namespace complete successfully
|
|
2052
2016
|
|
|
2053
|
-
Additionally, you can specify
|
|
2054
|
-
|
|
2017
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
2018
|
+
by specifying the fully qualified project_flow_name.
|
|
2055
2019
|
```
|
|
2056
|
-
@
|
|
2020
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
2057
2021
|
```
|
|
2058
2022
|
or
|
|
2059
2023
|
```
|
|
2060
|
-
@
|
|
2061
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
2024
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
2062
2025
|
```
|
|
2063
2026
|
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
2067
|
-
```
|
|
2068
|
-
This is equivalent to:
|
|
2027
|
+
You can also specify just the project or project branch (other values will be
|
|
2028
|
+
inferred from the current project or project branch):
|
|
2069
2029
|
```
|
|
2070
|
-
@
|
|
2030
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
2071
2031
|
```
|
|
2072
2032
|
|
|
2033
|
+
Note that `branch` is typically one of:
|
|
2034
|
+
- `prod`
|
|
2035
|
+
- `user.bob`
|
|
2036
|
+
- `test.my_experiment`
|
|
2037
|
+
- `prod.staging`
|
|
2038
|
+
|
|
2073
2039
|
|
|
2074
2040
|
Parameters
|
|
2075
2041
|
----------
|
|
2076
|
-
|
|
2077
|
-
|
|
2078
|
-
|
|
2079
|
-
|
|
2042
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
2043
|
+
Upstream flow dependency for this flow.
|
|
2044
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
2045
|
+
Upstream flow dependencies for this flow.
|
|
2080
2046
|
options : Dict[str, Any], default {}
|
|
2081
2047
|
Backend-specific configuration for tuning eventing behavior.
|
|
2082
2048
|
"""
|
|
2083
2049
|
...
|
|
2084
2050
|
|
|
2051
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
2052
|
+
"""
|
|
2053
|
+
Specifies what flows belong to the same project.
|
|
2054
|
+
|
|
2055
|
+
A project-specific namespace is created for all flows that
|
|
2056
|
+
use the same `@project(name)`.
|
|
2057
|
+
|
|
2058
|
+
|
|
2059
|
+
Parameters
|
|
2060
|
+
----------
|
|
2061
|
+
name : str
|
|
2062
|
+
Project name. Make sure that the name is unique amongst all
|
|
2063
|
+
projects that use the same production scheduler. The name may
|
|
2064
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
2065
|
+
|
|
2066
|
+
branch : Optional[str], default None
|
|
2067
|
+
The branch to use. If not specified, the branch is set to
|
|
2068
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
2069
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
2070
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
2071
|
+
|
|
2072
|
+
production : bool, default False
|
|
2073
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
2074
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
2075
|
+
`production` in the decorator and on the command line.
|
|
2076
|
+
The project branch name will be:
|
|
2077
|
+
- if `branch` is specified:
|
|
2078
|
+
- if `production` is True: `prod.<branch>`
|
|
2079
|
+
- if `production` is False: `test.<branch>`
|
|
2080
|
+
- if `branch` is not specified:
|
|
2081
|
+
- if `production` is True: `prod`
|
|
2082
|
+
- if `production` is False: `user.<username>`
|
|
2083
|
+
"""
|
|
2084
|
+
...
|
|
2085
|
+
|
|
2085
2086
|
pkg_name: str
|
|
2086
2087
|
|