ob-metaflow-stubs 6.0.10.11__py2.py3-none-any.whl → 6.0.10.12__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.
Potentially problematic release.
This version of ob-metaflow-stubs might be problematic. Click here for more details.
- metaflow-stubs/__init__.pyi +968 -967
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +12 -5
- 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 +2 -2
- metaflow-stubs/metaflow_current.pyi +39 -39
- 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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/cards/__init__.pyi +6 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/cards/hf_hub_card.pyi +93 -0
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +5 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +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 +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_config.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/capsule.pyi +2 -2
- 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 +2 -2
- 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 +2 -2
- 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 +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/deployer.pyi +3 -3
- 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 +4 -4
- 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 +3 -3
- 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 +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +3 -3
- 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 +4 -4
- metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
- metaflow-stubs/packaging_sys/tar_backend.pyi +5 -5
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +3 -3
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +13 -12
- 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 +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/argo/exit_hooks.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
- 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 +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +6 -6
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +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/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 +2 -2
- 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 +3 -3
- 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 +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/optuna/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/parsers.pyi +25 -0
- 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 +6 -6
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/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 +2 -2
- 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 +33 -33
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- 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 +2 -2
- 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 +8 -8
- metaflow-stubs/user_decorators/__init__.pyi +2 -2
- metaflow-stubs/user_decorators/common.pyi +2 -2
- metaflow-stubs/user_decorators/mutable_flow.pyi +6 -6
- metaflow-stubs/user_decorators/mutable_step.pyi +5 -5
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +3 -3
- metaflow-stubs/user_decorators/user_step_decorator.pyi +5 -5
- {ob_metaflow_stubs-6.0.10.11.dist-info → ob_metaflow_stubs-6.0.10.12.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.10.12.dist-info/RECORD +265 -0
- ob_metaflow_stubs-6.0.10.11.dist-info/RECORD +0 -262
- {ob_metaflow_stubs-6.0.10.11.dist-info → ob_metaflow_stubs-6.0.10.12.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.10.11.dist-info → ob_metaflow_stubs-6.0.10.12.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.18.
|
|
4
|
-
# Generated on 2025-09-
|
|
3
|
+
# MF version: 2.18.9.1+obcheckpoint(0.2.8);ob(v1) #
|
|
4
|
+
# Generated on 2025-09-30T17:31:30.391243 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import typing
|
|
10
10
|
if typing.TYPE_CHECKING:
|
|
11
|
-
import typing
|
|
12
11
|
import datetime
|
|
12
|
+
import typing
|
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
|
15
15
|
|
|
@@ -39,17 +39,18 @@ 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 events as events
|
|
42
43
|
from . import cards as cards
|
|
43
|
-
from . import metaflow_git as metaflow_git
|
|
44
44
|
from . import tuple_util as tuple_util
|
|
45
|
-
from . import
|
|
45
|
+
from . import metaflow_git as metaflow_git
|
|
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.
|
|
51
|
+
from .plugins.parsers import yaml_parser as yaml_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.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
54
55
|
from . import client as client
|
|
55
56
|
from .client.core import namespace as namespace
|
|
@@ -169,528 +170,282 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
169
170
|
...
|
|
170
171
|
|
|
171
172
|
@typing.overload
|
|
172
|
-
def
|
|
173
|
+
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]]]:
|
|
173
174
|
"""
|
|
174
|
-
|
|
175
|
-
to a step needs to be retried.
|
|
175
|
+
Enables checkpointing for a step.
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
179
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
177
|
+
> Examples
|
|
180
178
|
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
179
|
+
- Saving Checkpoints
|
|
180
|
+
|
|
181
|
+
```python
|
|
182
|
+
@checkpoint
|
|
183
|
+
@step
|
|
184
|
+
def train(self):
|
|
185
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
|
186
|
+
for i in range(self.epochs):
|
|
187
|
+
# some training logic
|
|
188
|
+
loss = model.train(self.dataset)
|
|
189
|
+
if i % 10 == 0:
|
|
190
|
+
model.save(
|
|
191
|
+
current.checkpoint.directory,
|
|
192
|
+
)
|
|
193
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
194
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
195
|
+
self.latest_checkpoint = current.checkpoint.save(
|
|
196
|
+
name="epoch_checkpoint",
|
|
197
|
+
metadata={
|
|
198
|
+
"epoch": i,
|
|
199
|
+
"loss": loss,
|
|
200
|
+
}
|
|
201
|
+
)
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
- Using Loaded Checkpoints
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
@retry(times=3)
|
|
208
|
+
@checkpoint
|
|
209
|
+
@step
|
|
210
|
+
def train(self):
|
|
211
|
+
# Assume that the task has restarted and the previous attempt of the task
|
|
212
|
+
# saved a checkpoint
|
|
213
|
+
checkpoint_path = None
|
|
214
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
215
|
+
print("Loaded checkpoint from the previous attempt")
|
|
216
|
+
checkpoint_path = current.checkpoint.directory
|
|
217
|
+
|
|
218
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
219
|
+
for i in range(self.epochs):
|
|
220
|
+
...
|
|
221
|
+
```
|
|
184
222
|
|
|
185
223
|
|
|
186
224
|
Parameters
|
|
187
225
|
----------
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
226
|
+
load_policy : str, default: "fresh"
|
|
227
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
228
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
229
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
230
|
+
will be loaded at the start of the task.
|
|
231
|
+
- "none": Do not load any checkpoint
|
|
232
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
233
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
234
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
235
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
236
|
+
|
|
237
|
+
temp_dir_root : str, default: None
|
|
238
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
192
239
|
"""
|
|
193
240
|
...
|
|
194
241
|
|
|
195
242
|
@typing.overload
|
|
196
|
-
def
|
|
243
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
197
244
|
...
|
|
198
245
|
|
|
199
246
|
@typing.overload
|
|
200
|
-
def
|
|
247
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
201
248
|
...
|
|
202
249
|
|
|
203
|
-
def
|
|
250
|
+
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):
|
|
204
251
|
"""
|
|
205
|
-
|
|
206
|
-
to a step needs to be retried.
|
|
252
|
+
Enables checkpointing for a step.
|
|
207
253
|
|
|
208
|
-
|
|
209
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
210
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
254
|
+
> Examples
|
|
211
255
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
256
|
+
- Saving Checkpoints
|
|
257
|
+
|
|
258
|
+
```python
|
|
259
|
+
@checkpoint
|
|
260
|
+
@step
|
|
261
|
+
def train(self):
|
|
262
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
|
263
|
+
for i in range(self.epochs):
|
|
264
|
+
# some training logic
|
|
265
|
+
loss = model.train(self.dataset)
|
|
266
|
+
if i % 10 == 0:
|
|
267
|
+
model.save(
|
|
268
|
+
current.checkpoint.directory,
|
|
269
|
+
)
|
|
270
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
271
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
272
|
+
self.latest_checkpoint = current.checkpoint.save(
|
|
273
|
+
name="epoch_checkpoint",
|
|
274
|
+
metadata={
|
|
275
|
+
"epoch": i,
|
|
276
|
+
"loss": loss,
|
|
277
|
+
}
|
|
278
|
+
)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
- Using Loaded Checkpoints
|
|
282
|
+
|
|
283
|
+
```python
|
|
284
|
+
@retry(times=3)
|
|
285
|
+
@checkpoint
|
|
286
|
+
@step
|
|
287
|
+
def train(self):
|
|
288
|
+
# Assume that the task has restarted and the previous attempt of the task
|
|
289
|
+
# saved a checkpoint
|
|
290
|
+
checkpoint_path = None
|
|
291
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
292
|
+
print("Loaded checkpoint from the previous attempt")
|
|
293
|
+
checkpoint_path = current.checkpoint.directory
|
|
294
|
+
|
|
295
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
296
|
+
for i in range(self.epochs):
|
|
297
|
+
...
|
|
298
|
+
```
|
|
215
299
|
|
|
216
300
|
|
|
217
301
|
Parameters
|
|
218
302
|
----------
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
...
|
|
233
|
-
|
|
234
|
-
@typing.overload
|
|
235
|
-
def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
236
|
-
...
|
|
237
|
-
|
|
238
|
-
def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
239
|
-
"""
|
|
240
|
-
A simple decorator that demonstrates using CardDecoratorInjector
|
|
241
|
-
to inject a card and render simple markdown content.
|
|
303
|
+
load_policy : str, default: "fresh"
|
|
304
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
305
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
306
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
307
|
+
will be loaded at the start of the task.
|
|
308
|
+
- "none": Do not load any checkpoint
|
|
309
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
310
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
311
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
312
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
313
|
+
|
|
314
|
+
temp_dir_root : str, default: None
|
|
315
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
242
316
|
"""
|
|
243
317
|
...
|
|
244
318
|
|
|
245
319
|
@typing.overload
|
|
246
|
-
def
|
|
320
|
+
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
247
321
|
"""
|
|
248
|
-
|
|
322
|
+
Enables loading / saving of models within a step.
|
|
249
323
|
|
|
250
|
-
|
|
324
|
+
> Examples
|
|
325
|
+
- Saving Models
|
|
326
|
+
```python
|
|
327
|
+
@model
|
|
328
|
+
@step
|
|
329
|
+
def train(self):
|
|
330
|
+
# current.model.save returns a dictionary reference to the model saved
|
|
331
|
+
self.my_model = current.model.save(
|
|
332
|
+
path_to_my_model,
|
|
333
|
+
label="my_model",
|
|
334
|
+
metadata={
|
|
335
|
+
"epochs": 10,
|
|
336
|
+
"batch-size": 32,
|
|
337
|
+
"learning-rate": 0.001,
|
|
338
|
+
}
|
|
339
|
+
)
|
|
340
|
+
self.next(self.test)
|
|
341
|
+
|
|
342
|
+
@model(load="my_model")
|
|
343
|
+
@step
|
|
344
|
+
def test(self):
|
|
345
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
|
346
|
+
# where the key is the name of the artifact and the value is the path to the model
|
|
347
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
|
348
|
+
self.next(self.end)
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
- Loading models
|
|
352
|
+
```python
|
|
353
|
+
@step
|
|
354
|
+
def train(self):
|
|
355
|
+
# current.model.load returns the path to the model loaded
|
|
356
|
+
checkpoint_path = current.model.load(
|
|
357
|
+
self.checkpoint_key,
|
|
358
|
+
)
|
|
359
|
+
model_path = current.model.load(
|
|
360
|
+
self.model,
|
|
361
|
+
)
|
|
362
|
+
self.next(self.test)
|
|
363
|
+
```
|
|
251
364
|
|
|
252
365
|
|
|
253
366
|
Parameters
|
|
254
367
|
----------
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
If
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
368
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
369
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
370
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
|
|
371
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
|
372
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
373
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
374
|
+
|
|
375
|
+
temp_dir_root : str, default: None
|
|
376
|
+
The root directory under which `current.model.loaded` will store loaded models
|
|
263
377
|
"""
|
|
264
378
|
...
|
|
265
379
|
|
|
266
380
|
@typing.overload
|
|
267
|
-
def
|
|
381
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
268
382
|
...
|
|
269
383
|
|
|
270
384
|
@typing.overload
|
|
271
|
-
def
|
|
385
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
272
386
|
...
|
|
273
387
|
|
|
274
|
-
def
|
|
388
|
+
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
|
275
389
|
"""
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
Parameters
|
|
282
|
-
----------
|
|
283
|
-
type : str, default 'default'
|
|
284
|
-
Card type.
|
|
285
|
-
id : str, optional, default None
|
|
286
|
-
If multiple cards are present, use this id to identify this card.
|
|
287
|
-
options : Dict[str, Any], default {}
|
|
288
|
-
Options passed to the card. The contents depend on the card type.
|
|
289
|
-
timeout : int, default 45
|
|
290
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
291
|
-
"""
|
|
292
|
-
...
|
|
293
|
-
|
|
294
|
-
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]]]:
|
|
295
|
-
"""
|
|
296
|
-
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
|
297
|
-
|
|
298
|
-
User code call
|
|
299
|
-
--------------
|
|
300
|
-
@vllm(
|
|
301
|
-
model="...",
|
|
302
|
-
...
|
|
303
|
-
)
|
|
304
|
-
|
|
305
|
-
Valid backend options
|
|
306
|
-
---------------------
|
|
307
|
-
- 'local': Run as a separate process on the local task machine.
|
|
308
|
-
|
|
309
|
-
Valid model options
|
|
310
|
-
-------------------
|
|
311
|
-
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
|
312
|
-
|
|
313
|
-
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
|
314
|
-
If you need multiple models, you must create multiple @vllm decorators.
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
Parameters
|
|
318
|
-
----------
|
|
319
|
-
model: str
|
|
320
|
-
HuggingFace model identifier to be served by vLLM.
|
|
321
|
-
backend: str
|
|
322
|
-
Determines where and how to run the vLLM process.
|
|
323
|
-
openai_api_server: bool
|
|
324
|
-
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
|
325
|
-
Default is False (uses native engine).
|
|
326
|
-
Set to True for backward compatibility with existing code.
|
|
327
|
-
debug: bool
|
|
328
|
-
Whether to turn on verbose debugging logs.
|
|
329
|
-
card_refresh_interval: int
|
|
330
|
-
Interval in seconds for refreshing the vLLM status card.
|
|
331
|
-
Only used when openai_api_server=True.
|
|
332
|
-
max_retries: int
|
|
333
|
-
Maximum number of retries checking for vLLM server startup.
|
|
334
|
-
Only used when openai_api_server=True.
|
|
335
|
-
retry_alert_frequency: int
|
|
336
|
-
Frequency of alert logs for vLLM server startup retries.
|
|
337
|
-
Only used when openai_api_server=True.
|
|
338
|
-
engine_args : dict
|
|
339
|
-
Additional keyword arguments to pass to the vLLM engine.
|
|
340
|
-
For example, `tensor_parallel_size=2`.
|
|
341
|
-
"""
|
|
342
|
-
...
|
|
343
|
-
|
|
344
|
-
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]]]:
|
|
345
|
-
"""
|
|
346
|
-
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
|
347
|
-
|
|
348
|
-
User code call
|
|
349
|
-
--------------
|
|
350
|
-
@ollama(
|
|
351
|
-
models=[...],
|
|
352
|
-
...
|
|
353
|
-
)
|
|
354
|
-
|
|
355
|
-
Valid backend options
|
|
356
|
-
---------------------
|
|
357
|
-
- 'local': Run as a separate process on the local task machine.
|
|
358
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
359
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
360
|
-
|
|
361
|
-
Valid model options
|
|
362
|
-
-------------------
|
|
363
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
Parameters
|
|
367
|
-
----------
|
|
368
|
-
models: list[str]
|
|
369
|
-
List of Ollama containers running models in sidecars.
|
|
370
|
-
backend: str
|
|
371
|
-
Determines where and how to run the Ollama process.
|
|
372
|
-
force_pull: bool
|
|
373
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
374
|
-
cache_update_policy: str
|
|
375
|
-
Cache update policy: "auto", "force", or "never".
|
|
376
|
-
force_cache_update: bool
|
|
377
|
-
Simple override for "force" cache update policy.
|
|
378
|
-
debug: bool
|
|
379
|
-
Whether to turn on verbose debugging logs.
|
|
380
|
-
circuit_breaker_config: dict
|
|
381
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
382
|
-
timeout_config: dict
|
|
383
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
384
|
-
"""
|
|
385
|
-
...
|
|
386
|
-
|
|
387
|
-
@typing.overload
|
|
388
|
-
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]]]:
|
|
389
|
-
"""
|
|
390
|
-
Specifies the PyPI packages for the step.
|
|
391
|
-
|
|
392
|
-
Information in this decorator will augment any
|
|
393
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
394
|
-
you can use `@pypi_base` to set packages required by all
|
|
395
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
Parameters
|
|
399
|
-
----------
|
|
400
|
-
packages : Dict[str, str], default: {}
|
|
401
|
-
Packages to use for this step. The key is the name of the package
|
|
402
|
-
and the value is the version to use.
|
|
403
|
-
python : str, optional, default: None
|
|
404
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
405
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
406
|
-
"""
|
|
407
|
-
...
|
|
408
|
-
|
|
409
|
-
@typing.overload
|
|
410
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
411
|
-
...
|
|
412
|
-
|
|
413
|
-
@typing.overload
|
|
414
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
415
|
-
...
|
|
416
|
-
|
|
417
|
-
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):
|
|
418
|
-
"""
|
|
419
|
-
Specifies the PyPI packages for the step.
|
|
420
|
-
|
|
421
|
-
Information in this decorator will augment any
|
|
422
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
423
|
-
you can use `@pypi_base` to set packages required by all
|
|
424
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
Parameters
|
|
428
|
-
----------
|
|
429
|
-
packages : Dict[str, str], default: {}
|
|
430
|
-
Packages to use for this step. The key is the name of the package
|
|
431
|
-
and the value is the version to use.
|
|
432
|
-
python : str, optional, default: None
|
|
433
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
434
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
435
|
-
"""
|
|
436
|
-
...
|
|
437
|
-
|
|
438
|
-
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[typing.Dict[str, str]] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
439
|
-
"""
|
|
440
|
-
Specifies that this step should execute on Kubernetes.
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
Parameters
|
|
444
|
-
----------
|
|
445
|
-
cpu : int, default 1
|
|
446
|
-
Number of CPUs required for this step. If `@resources` is
|
|
447
|
-
also present, the maximum value from all decorators is used.
|
|
448
|
-
memory : int, default 4096
|
|
449
|
-
Memory size (in MB) required for this step. If
|
|
450
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
451
|
-
used.
|
|
452
|
-
disk : int, default 10240
|
|
453
|
-
Disk size (in MB) required for this step. If
|
|
454
|
-
`@resources` is also present, the maximum value from all decorators is
|
|
455
|
-
used.
|
|
456
|
-
image : str, optional, default None
|
|
457
|
-
Docker image to use when launching on Kubernetes. If not specified, and
|
|
458
|
-
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
459
|
-
not, a default Docker image mapping to the current version of Python is used.
|
|
460
|
-
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
461
|
-
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
462
|
-
image_pull_secrets: List[str], default []
|
|
463
|
-
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
464
|
-
Kubernetes image pull secrets to use when pulling container images
|
|
465
|
-
in Kubernetes.
|
|
466
|
-
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
467
|
-
Kubernetes service account to use when launching pod in Kubernetes.
|
|
468
|
-
secrets : List[str], optional, default None
|
|
469
|
-
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
470
|
-
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
471
|
-
in Metaflow configuration.
|
|
472
|
-
node_selector: Union[Dict[str,str], str], optional, default None
|
|
473
|
-
Kubernetes node selector(s) to apply to the pod running the task.
|
|
474
|
-
Can be passed in as a comma separated string of values e.g.
|
|
475
|
-
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
476
|
-
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
477
|
-
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
478
|
-
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
479
|
-
gpu : int, optional, default None
|
|
480
|
-
Number of GPUs required for this step. A value of zero implies that
|
|
481
|
-
the scheduled node should not have GPUs.
|
|
482
|
-
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
483
|
-
The vendor of the GPUs to be used for this step.
|
|
484
|
-
tolerations : List[Dict[str,str]], default []
|
|
485
|
-
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
486
|
-
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
487
|
-
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
488
|
-
Kubernetes labels to use when launching pod in Kubernetes.
|
|
489
|
-
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
490
|
-
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
491
|
-
use_tmpfs : bool, default False
|
|
492
|
-
This enables an explicit tmpfs mount for this step.
|
|
493
|
-
tmpfs_tempdir : bool, default True
|
|
494
|
-
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
495
|
-
tmpfs_size : int, optional, default: None
|
|
496
|
-
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
497
|
-
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
498
|
-
memory allocated for this step.
|
|
499
|
-
tmpfs_path : str, optional, default /metaflow_temp
|
|
500
|
-
Path to tmpfs mount for this step.
|
|
501
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
|
502
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
503
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
504
|
-
shared_memory: int, optional
|
|
505
|
-
Shared memory size (in MiB) required for this step
|
|
506
|
-
port: int, optional
|
|
507
|
-
Port number to specify in the Kubernetes job object
|
|
508
|
-
compute_pool : str, optional, default None
|
|
509
|
-
Compute pool to be used for for this step.
|
|
510
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
|
511
|
-
hostname_resolution_timeout: int, default 10 * 60
|
|
512
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
513
|
-
Only applicable when @parallel is used.
|
|
514
|
-
qos: str, default: Burstable
|
|
515
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
516
|
-
|
|
517
|
-
security_context: Dict[str, Any], optional, default None
|
|
518
|
-
Container security context. Applies to the task container. Allows the following keys:
|
|
519
|
-
- privileged: bool, optional, default None
|
|
520
|
-
- allow_privilege_escalation: bool, optional, default None
|
|
521
|
-
- run_as_user: int, optional, default None
|
|
522
|
-
- run_as_group: int, optional, default None
|
|
523
|
-
- run_as_non_root: bool, optional, default None
|
|
524
|
-
"""
|
|
525
|
-
...
|
|
526
|
-
|
|
527
|
-
@typing.overload
|
|
528
|
-
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
529
|
-
"""
|
|
530
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
531
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
532
|
-
"""
|
|
533
|
-
...
|
|
534
|
-
|
|
535
|
-
@typing.overload
|
|
536
|
-
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
537
|
-
...
|
|
538
|
-
|
|
539
|
-
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
540
|
-
"""
|
|
541
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
542
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
543
|
-
"""
|
|
544
|
-
...
|
|
545
|
-
|
|
546
|
-
@typing.overload
|
|
547
|
-
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]]]:
|
|
548
|
-
"""
|
|
549
|
-
Enables checkpointing for a step.
|
|
390
|
+
Enables loading / saving of models within a step.
|
|
550
391
|
|
|
551
392
|
> Examples
|
|
552
|
-
|
|
553
|
-
- Saving Checkpoints
|
|
554
|
-
|
|
555
|
-
```python
|
|
556
|
-
@checkpoint
|
|
557
|
-
@step
|
|
558
|
-
def train(self):
|
|
559
|
-
model = create_model(self.parameters, checkpoint_path = None)
|
|
560
|
-
for i in range(self.epochs):
|
|
561
|
-
# some training logic
|
|
562
|
-
loss = model.train(self.dataset)
|
|
563
|
-
if i % 10 == 0:
|
|
564
|
-
model.save(
|
|
565
|
-
current.checkpoint.directory,
|
|
566
|
-
)
|
|
567
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
568
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
569
|
-
self.latest_checkpoint = current.checkpoint.save(
|
|
570
|
-
name="epoch_checkpoint",
|
|
571
|
-
metadata={
|
|
572
|
-
"epoch": i,
|
|
573
|
-
"loss": loss,
|
|
574
|
-
}
|
|
575
|
-
)
|
|
576
|
-
```
|
|
577
|
-
|
|
578
|
-
- Using Loaded Checkpoints
|
|
579
|
-
|
|
393
|
+
- Saving Models
|
|
580
394
|
```python
|
|
581
|
-
@
|
|
582
|
-
@checkpoint
|
|
395
|
+
@model
|
|
583
396
|
@step
|
|
584
397
|
def train(self):
|
|
585
|
-
#
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
Parameters
|
|
599
|
-
----------
|
|
600
|
-
load_policy : str, default: "fresh"
|
|
601
|
-
The policy for loading the checkpoint. The following policies are supported:
|
|
602
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
603
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
604
|
-
will be loaded at the start of the task.
|
|
605
|
-
- "none": Do not load any checkpoint
|
|
606
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
607
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
608
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
609
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
610
|
-
|
|
611
|
-
temp_dir_root : str, default: None
|
|
612
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
613
|
-
"""
|
|
614
|
-
...
|
|
615
|
-
|
|
616
|
-
@typing.overload
|
|
617
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
618
|
-
...
|
|
619
|
-
|
|
620
|
-
@typing.overload
|
|
621
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
622
|
-
...
|
|
623
|
-
|
|
624
|
-
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):
|
|
625
|
-
"""
|
|
626
|
-
Enables checkpointing for a step.
|
|
627
|
-
|
|
628
|
-
> Examples
|
|
629
|
-
|
|
630
|
-
- Saving Checkpoints
|
|
398
|
+
# current.model.save returns a dictionary reference to the model saved
|
|
399
|
+
self.my_model = current.model.save(
|
|
400
|
+
path_to_my_model,
|
|
401
|
+
label="my_model",
|
|
402
|
+
metadata={
|
|
403
|
+
"epochs": 10,
|
|
404
|
+
"batch-size": 32,
|
|
405
|
+
"learning-rate": 0.001,
|
|
406
|
+
}
|
|
407
|
+
)
|
|
408
|
+
self.next(self.test)
|
|
631
409
|
|
|
632
|
-
|
|
633
|
-
@checkpoint
|
|
410
|
+
@model(load="my_model")
|
|
634
411
|
@step
|
|
635
|
-
def
|
|
636
|
-
model
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
if i % 10 == 0:
|
|
641
|
-
model.save(
|
|
642
|
-
current.checkpoint.directory,
|
|
643
|
-
)
|
|
644
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
645
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
646
|
-
self.latest_checkpoint = current.checkpoint.save(
|
|
647
|
-
name="epoch_checkpoint",
|
|
648
|
-
metadata={
|
|
649
|
-
"epoch": i,
|
|
650
|
-
"loss": loss,
|
|
651
|
-
}
|
|
652
|
-
)
|
|
412
|
+
def test(self):
|
|
413
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
|
414
|
+
# where the key is the name of the artifact and the value is the path to the model
|
|
415
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
|
416
|
+
self.next(self.end)
|
|
653
417
|
```
|
|
654
418
|
|
|
655
|
-
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
checkpoint_path = current.checkpoint.directory
|
|
668
|
-
|
|
669
|
-
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
670
|
-
for i in range(self.epochs):
|
|
671
|
-
...
|
|
419
|
+
- Loading models
|
|
420
|
+
```python
|
|
421
|
+
@step
|
|
422
|
+
def train(self):
|
|
423
|
+
# current.model.load returns the path to the model loaded
|
|
424
|
+
checkpoint_path = current.model.load(
|
|
425
|
+
self.checkpoint_key,
|
|
426
|
+
)
|
|
427
|
+
model_path = current.model.load(
|
|
428
|
+
self.model,
|
|
429
|
+
)
|
|
430
|
+
self.next(self.test)
|
|
672
431
|
```
|
|
673
432
|
|
|
674
433
|
|
|
675
434
|
Parameters
|
|
676
435
|
----------
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
684
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
685
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
686
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
436
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
437
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
438
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
|
|
439
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
|
440
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
441
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
687
442
|
|
|
688
443
|
temp_dir_root : str, default: None
|
|
689
|
-
The root directory under which `current.
|
|
444
|
+
The root directory under which `current.model.loaded` will store loaded models
|
|
690
445
|
"""
|
|
691
446
|
...
|
|
692
447
|
|
|
693
|
-
def
|
|
448
|
+
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]]]:
|
|
694
449
|
"""
|
|
695
450
|
Specifies that this step should execute on DGX cloud.
|
|
696
451
|
|
|
@@ -701,6 +456,8 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
|
|
|
701
456
|
Number of GPUs to use.
|
|
702
457
|
gpu_type : str
|
|
703
458
|
Type of Nvidia GPU to use.
|
|
459
|
+
queue_timeout : int
|
|
460
|
+
Time to keep the job in NVCF's queue.
|
|
704
461
|
"""
|
|
705
462
|
...
|
|
706
463
|
|
|
@@ -756,100 +513,271 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
756
513
|
...
|
|
757
514
|
|
|
758
515
|
@typing.overload
|
|
759
|
-
def
|
|
516
|
+
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]]]:
|
|
760
517
|
"""
|
|
761
|
-
Specifies
|
|
518
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
519
|
+
the execution of a step.
|
|
762
520
|
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
521
|
+
|
|
522
|
+
Parameters
|
|
523
|
+
----------
|
|
524
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
525
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
526
|
+
role : str, optional, default: None
|
|
527
|
+
Role to use for fetching secrets
|
|
528
|
+
"""
|
|
529
|
+
...
|
|
530
|
+
|
|
531
|
+
@typing.overload
|
|
532
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
533
|
+
...
|
|
534
|
+
|
|
535
|
+
@typing.overload
|
|
536
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
537
|
+
...
|
|
538
|
+
|
|
539
|
+
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):
|
|
540
|
+
"""
|
|
541
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
542
|
+
the execution of a step.
|
|
767
543
|
|
|
768
544
|
|
|
769
545
|
Parameters
|
|
770
546
|
----------
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
547
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
548
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
549
|
+
role : str, optional, default: None
|
|
550
|
+
Role to use for fetching secrets
|
|
551
|
+
"""
|
|
552
|
+
...
|
|
553
|
+
|
|
554
|
+
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]]]:
|
|
555
|
+
"""
|
|
556
|
+
`@nebius_s3_proxy` is a Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
557
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
|
558
|
+
a Neo Cloud like Nebius. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
562
|
+
for S3 read and write requests.
|
|
563
|
+
|
|
564
|
+
This decorator requires an integration in the Outerbounds platform that
|
|
565
|
+
points to an external bucket. It affects S3 operations performed via
|
|
566
|
+
Metaflow's `get_aws_client` and `S3` within a `@step`.
|
|
567
|
+
|
|
568
|
+
Read operations
|
|
569
|
+
---------------
|
|
570
|
+
All read operations pass through the proxy. If an object does not already
|
|
571
|
+
exist in the external bucket, it is cached there. For example, if code reads
|
|
572
|
+
from buckets `FOO` and `BAR` using the `S3` interface, objects from both
|
|
573
|
+
buckets are cached in the external bucket.
|
|
574
|
+
|
|
575
|
+
During task execution, all S3‑related read requests are routed through the
|
|
576
|
+
proxy:
|
|
577
|
+
- If the object is present in the external object store, the proxy
|
|
578
|
+
streams it directly from there without accessing the requested origin
|
|
579
|
+
bucket.
|
|
580
|
+
- If the object is not present in the external storage, the proxy
|
|
581
|
+
fetches it from the requested bucket, caches it in the external
|
|
582
|
+
storage, and streams the response from the origin bucket.
|
|
583
|
+
|
|
584
|
+
Warning
|
|
585
|
+
-------
|
|
586
|
+
All READ operations (e.g., GetObject, HeadObject) pass through the external
|
|
587
|
+
bucket regardless of the bucket specified in user code. Even
|
|
588
|
+
`S3(run=self)` and `S3(s3root="mybucketfoo")` requests go through the
|
|
589
|
+
external bucket cache.
|
|
590
|
+
|
|
591
|
+
Write operations
|
|
592
|
+
----------------
|
|
593
|
+
Write behavior is controlled by the `write_mode` parameter, which determines
|
|
594
|
+
whether writes also persist objects in the cache.
|
|
595
|
+
|
|
596
|
+
`write_mode` values:
|
|
597
|
+
- `origin-and-cache`: objects are written both to the cache and to their
|
|
598
|
+
intended origin bucket.
|
|
599
|
+
- `origin`: objects are written only to their intended origin bucket.
|
|
600
|
+
|
|
601
|
+
|
|
602
|
+
Parameters
|
|
603
|
+
----------
|
|
604
|
+
integration_name : str, optional
|
|
605
|
+
[Outerbounds integration name](https://docs.outerbounds.com/outerbounds/configuring-secrets/#integrations-view)
|
|
606
|
+
that holds the configuration for the external, S3‑compatible object
|
|
607
|
+
storage bucket. If not specified, the only available S3 proxy
|
|
608
|
+
integration in the namespace is used (fails if multiple exist).
|
|
609
|
+
write_mode : str, optional
|
|
610
|
+
Controls whether writes also go to the external bucket.
|
|
611
|
+
- `origin` (default)
|
|
612
|
+
- `origin-and-cache`
|
|
613
|
+
debug : bool, optional
|
|
614
|
+
Enables debug logging for proxy operations.
|
|
781
615
|
"""
|
|
782
616
|
...
|
|
783
617
|
|
|
784
618
|
@typing.overload
|
|
785
|
-
def
|
|
619
|
+
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]]]:
|
|
620
|
+
"""
|
|
621
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
Parameters
|
|
625
|
+
----------
|
|
626
|
+
vars : Dict[str, str], default {}
|
|
627
|
+
Dictionary of environment variables to set.
|
|
628
|
+
"""
|
|
786
629
|
...
|
|
787
630
|
|
|
788
631
|
@typing.overload
|
|
789
|
-
def
|
|
632
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
790
633
|
...
|
|
791
634
|
|
|
792
|
-
|
|
635
|
+
@typing.overload
|
|
636
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
637
|
+
...
|
|
638
|
+
|
|
639
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
793
640
|
"""
|
|
794
|
-
Specifies
|
|
641
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
795
642
|
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
643
|
+
|
|
644
|
+
Parameters
|
|
645
|
+
----------
|
|
646
|
+
vars : Dict[str, str], default {}
|
|
647
|
+
Dictionary of environment variables to set.
|
|
648
|
+
"""
|
|
649
|
+
...
|
|
650
|
+
|
|
651
|
+
@typing.overload
|
|
652
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
653
|
+
"""
|
|
654
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
655
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
656
|
+
"""
|
|
657
|
+
...
|
|
658
|
+
|
|
659
|
+
@typing.overload
|
|
660
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
661
|
+
...
|
|
662
|
+
|
|
663
|
+
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
664
|
+
"""
|
|
665
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
666
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
667
|
+
"""
|
|
668
|
+
...
|
|
669
|
+
|
|
670
|
+
@typing.overload
|
|
671
|
+
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]]]:
|
|
672
|
+
"""
|
|
673
|
+
Specifies the number of times the task corresponding
|
|
674
|
+
to a step needs to be retried.
|
|
675
|
+
|
|
676
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
677
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
678
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
679
|
+
|
|
680
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
681
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
682
|
+
ensuring that the flow execution can continue.
|
|
800
683
|
|
|
801
684
|
|
|
802
685
|
Parameters
|
|
803
686
|
----------
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
809
|
-
python : str, optional, default None
|
|
810
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
811
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
812
|
-
disabled : bool, default False
|
|
813
|
-
If set to True, disables @conda.
|
|
687
|
+
times : int, default 3
|
|
688
|
+
Number of times to retry this task.
|
|
689
|
+
minutes_between_retries : int, default 2
|
|
690
|
+
Number of minutes between retries.
|
|
814
691
|
"""
|
|
815
692
|
...
|
|
816
693
|
|
|
817
694
|
@typing.overload
|
|
818
|
-
def
|
|
695
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
696
|
+
...
|
|
697
|
+
|
|
698
|
+
@typing.overload
|
|
699
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
700
|
+
...
|
|
701
|
+
|
|
702
|
+
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):
|
|
819
703
|
"""
|
|
820
|
-
Specifies
|
|
821
|
-
|
|
704
|
+
Specifies the number of times the task corresponding
|
|
705
|
+
to a step needs to be retried.
|
|
706
|
+
|
|
707
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
708
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
709
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
710
|
+
|
|
711
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
712
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
713
|
+
ensuring that the flow execution can continue.
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
Parameters
|
|
717
|
+
----------
|
|
718
|
+
times : int, default 3
|
|
719
|
+
Number of times to retry this task.
|
|
720
|
+
minutes_between_retries : int, default 2
|
|
721
|
+
Number of minutes between retries.
|
|
722
|
+
"""
|
|
723
|
+
...
|
|
724
|
+
|
|
725
|
+
@typing.overload
|
|
726
|
+
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]]]:
|
|
727
|
+
"""
|
|
728
|
+
Specifies a timeout for your step.
|
|
729
|
+
|
|
730
|
+
This decorator is useful if this step may hang indefinitely.
|
|
731
|
+
|
|
732
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
733
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
734
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
735
|
+
|
|
736
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
737
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
822
738
|
|
|
823
739
|
|
|
824
740
|
Parameters
|
|
825
741
|
----------
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
742
|
+
seconds : int, default 0
|
|
743
|
+
Number of seconds to wait prior to timing out.
|
|
744
|
+
minutes : int, default 0
|
|
745
|
+
Number of minutes to wait prior to timing out.
|
|
746
|
+
hours : int, default 0
|
|
747
|
+
Number of hours to wait prior to timing out.
|
|
830
748
|
"""
|
|
831
749
|
...
|
|
832
750
|
|
|
833
751
|
@typing.overload
|
|
834
|
-
def
|
|
752
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
835
753
|
...
|
|
836
754
|
|
|
837
755
|
@typing.overload
|
|
838
|
-
def
|
|
756
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
839
757
|
...
|
|
840
758
|
|
|
841
|
-
def
|
|
759
|
+
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):
|
|
842
760
|
"""
|
|
843
|
-
Specifies
|
|
844
|
-
|
|
761
|
+
Specifies a timeout for your step.
|
|
762
|
+
|
|
763
|
+
This decorator is useful if this step may hang indefinitely.
|
|
764
|
+
|
|
765
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
766
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
767
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
768
|
+
|
|
769
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
770
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
845
771
|
|
|
846
772
|
|
|
847
773
|
Parameters
|
|
848
774
|
----------
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
775
|
+
seconds : int, default 0
|
|
776
|
+
Number of seconds to wait prior to timing out.
|
|
777
|
+
minutes : int, default 0
|
|
778
|
+
Number of minutes to wait prior to timing out.
|
|
779
|
+
hours : int, default 0
|
|
780
|
+
Number of hours to wait prior to timing out.
|
|
853
781
|
"""
|
|
854
782
|
...
|
|
855
783
|
|
|
@@ -872,6 +800,87 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
|
872
800
|
"""
|
|
873
801
|
...
|
|
874
802
|
|
|
803
|
+
@typing.overload
|
|
804
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
805
|
+
"""
|
|
806
|
+
Internal decorator to support Fast bakery
|
|
807
|
+
"""
|
|
808
|
+
...
|
|
809
|
+
|
|
810
|
+
@typing.overload
|
|
811
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
812
|
+
...
|
|
813
|
+
|
|
814
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
815
|
+
"""
|
|
816
|
+
Internal decorator to support Fast bakery
|
|
817
|
+
"""
|
|
818
|
+
...
|
|
819
|
+
|
|
820
|
+
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]]]:
|
|
821
|
+
"""
|
|
822
|
+
Specifies that this step should execute on DGX cloud.
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
Parameters
|
|
826
|
+
----------
|
|
827
|
+
gpu : int
|
|
828
|
+
Number of GPUs to use.
|
|
829
|
+
gpu_type : str
|
|
830
|
+
Type of Nvidia GPU to use.
|
|
831
|
+
"""
|
|
832
|
+
...
|
|
833
|
+
|
|
834
|
+
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]]]:
|
|
835
|
+
"""
|
|
836
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
|
837
|
+
|
|
838
|
+
User code call
|
|
839
|
+
--------------
|
|
840
|
+
@vllm(
|
|
841
|
+
model="...",
|
|
842
|
+
...
|
|
843
|
+
)
|
|
844
|
+
|
|
845
|
+
Valid backend options
|
|
846
|
+
---------------------
|
|
847
|
+
- 'local': Run as a separate process on the local task machine.
|
|
848
|
+
|
|
849
|
+
Valid model options
|
|
850
|
+
-------------------
|
|
851
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
|
852
|
+
|
|
853
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
|
854
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
Parameters
|
|
858
|
+
----------
|
|
859
|
+
model: str
|
|
860
|
+
HuggingFace model identifier to be served by vLLM.
|
|
861
|
+
backend: str
|
|
862
|
+
Determines where and how to run the vLLM process.
|
|
863
|
+
openai_api_server: bool
|
|
864
|
+
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
|
865
|
+
Default is False (uses native engine).
|
|
866
|
+
Set to True for backward compatibility with existing code.
|
|
867
|
+
debug: bool
|
|
868
|
+
Whether to turn on verbose debugging logs.
|
|
869
|
+
card_refresh_interval: int
|
|
870
|
+
Interval in seconds for refreshing the vLLM status card.
|
|
871
|
+
Only used when openai_api_server=True.
|
|
872
|
+
max_retries: int
|
|
873
|
+
Maximum number of retries checking for vLLM server startup.
|
|
874
|
+
Only used when openai_api_server=True.
|
|
875
|
+
retry_alert_frequency: int
|
|
876
|
+
Frequency of alert logs for vLLM server startup retries.
|
|
877
|
+
Only used when openai_api_server=True.
|
|
878
|
+
engine_args : dict
|
|
879
|
+
Additional keyword arguments to pass to the vLLM engine.
|
|
880
|
+
For example, `tensor_parallel_size=2`.
|
|
881
|
+
"""
|
|
882
|
+
...
|
|
883
|
+
|
|
875
884
|
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]]]:
|
|
876
885
|
"""
|
|
877
886
|
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
@@ -1011,287 +1020,261 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
|
1011
1020
|
...
|
|
1012
1021
|
|
|
1013
1022
|
@typing.overload
|
|
1014
|
-
def
|
|
1015
|
-
"""
|
|
1016
|
-
Enables loading / saving of models within a step.
|
|
1017
|
-
|
|
1018
|
-
> Examples
|
|
1019
|
-
- Saving Models
|
|
1020
|
-
```python
|
|
1021
|
-
@model
|
|
1022
|
-
@step
|
|
1023
|
-
def train(self):
|
|
1024
|
-
# current.model.save returns a dictionary reference to the model saved
|
|
1025
|
-
self.my_model = current.model.save(
|
|
1026
|
-
path_to_my_model,
|
|
1027
|
-
label="my_model",
|
|
1028
|
-
metadata={
|
|
1029
|
-
"epochs": 10,
|
|
1030
|
-
"batch-size": 32,
|
|
1031
|
-
"learning-rate": 0.001,
|
|
1032
|
-
}
|
|
1033
|
-
)
|
|
1034
|
-
self.next(self.test)
|
|
1035
|
-
|
|
1036
|
-
@model(load="my_model")
|
|
1037
|
-
@step
|
|
1038
|
-
def test(self):
|
|
1039
|
-
# `current.model.loaded` returns a dictionary of the loaded models
|
|
1040
|
-
# where the key is the name of the artifact and the value is the path to the model
|
|
1041
|
-
print(os.listdir(current.model.loaded["my_model"]))
|
|
1042
|
-
self.next(self.end)
|
|
1043
|
-
```
|
|
1044
|
-
|
|
1045
|
-
- Loading models
|
|
1046
|
-
```python
|
|
1047
|
-
@step
|
|
1048
|
-
def train(self):
|
|
1049
|
-
# current.model.load returns the path to the model loaded
|
|
1050
|
-
checkpoint_path = current.model.load(
|
|
1051
|
-
self.checkpoint_key,
|
|
1052
|
-
)
|
|
1053
|
-
model_path = current.model.load(
|
|
1054
|
-
self.model,
|
|
1055
|
-
)
|
|
1056
|
-
self.next(self.test)
|
|
1057
|
-
```
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
Parameters
|
|
1061
|
-
----------
|
|
1062
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
1063
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
1064
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
|
|
1065
|
-
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
|
1066
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
1067
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
1068
|
-
|
|
1069
|
-
temp_dir_root : str, default: None
|
|
1070
|
-
The root directory under which `current.model.loaded` will store loaded models
|
|
1023
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1071
1024
|
"""
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
@typing.overload
|
|
1075
|
-
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1076
|
-
...
|
|
1077
|
-
|
|
1078
|
-
@typing.overload
|
|
1079
|
-
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1080
|
-
...
|
|
1081
|
-
|
|
1082
|
-
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
|
1025
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
1026
|
+
to inject a card and render simple markdown content.
|
|
1083
1027
|
"""
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
path_to_my_model,
|
|
1095
|
-
label="my_model",
|
|
1096
|
-
metadata={
|
|
1097
|
-
"epochs": 10,
|
|
1098
|
-
"batch-size": 32,
|
|
1099
|
-
"learning-rate": 0.001,
|
|
1100
|
-
}
|
|
1101
|
-
)
|
|
1102
|
-
self.next(self.test)
|
|
1103
|
-
|
|
1104
|
-
@model(load="my_model")
|
|
1105
|
-
@step
|
|
1106
|
-
def test(self):
|
|
1107
|
-
# `current.model.loaded` returns a dictionary of the loaded models
|
|
1108
|
-
# where the key is the name of the artifact and the value is the path to the model
|
|
1109
|
-
print(os.listdir(current.model.loaded["my_model"]))
|
|
1110
|
-
self.next(self.end)
|
|
1111
|
-
```
|
|
1112
|
-
|
|
1113
|
-
- Loading models
|
|
1114
|
-
```python
|
|
1115
|
-
@step
|
|
1116
|
-
def train(self):
|
|
1117
|
-
# current.model.load returns the path to the model loaded
|
|
1118
|
-
checkpoint_path = current.model.load(
|
|
1119
|
-
self.checkpoint_key,
|
|
1120
|
-
)
|
|
1121
|
-
model_path = current.model.load(
|
|
1122
|
-
self.model,
|
|
1123
|
-
)
|
|
1124
|
-
self.next(self.test)
|
|
1125
|
-
```
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
Parameters
|
|
1129
|
-
----------
|
|
1130
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
1131
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
1132
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
|
|
1133
|
-
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
|
1134
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
1135
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
1136
|
-
|
|
1137
|
-
temp_dir_root : str, default: None
|
|
1138
|
-
The root directory under which `current.model.loaded` will store loaded models
|
|
1028
|
+
...
|
|
1029
|
+
|
|
1030
|
+
@typing.overload
|
|
1031
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1032
|
+
...
|
|
1033
|
+
|
|
1034
|
+
def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
1035
|
+
"""
|
|
1036
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
1037
|
+
to inject a card and render simple markdown content.
|
|
1139
1038
|
"""
|
|
1140
1039
|
...
|
|
1141
1040
|
|
|
1142
1041
|
@typing.overload
|
|
1143
|
-
def
|
|
1042
|
+
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]]]:
|
|
1144
1043
|
"""
|
|
1145
|
-
Specifies
|
|
1044
|
+
Specifies the Conda environment for the step.
|
|
1045
|
+
|
|
1046
|
+
Information in this decorator will augment any
|
|
1047
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
1048
|
+
you can use `@conda_base` to set packages required by all
|
|
1049
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
1146
1050
|
|
|
1147
1051
|
|
|
1148
1052
|
Parameters
|
|
1149
1053
|
----------
|
|
1150
|
-
|
|
1151
|
-
|
|
1054
|
+
packages : Dict[str, str], default {}
|
|
1055
|
+
Packages to use for this step. The key is the name of the package
|
|
1056
|
+
and the value is the version to use.
|
|
1057
|
+
libraries : Dict[str, str], default {}
|
|
1058
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1059
|
+
python : str, optional, default None
|
|
1060
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1061
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1062
|
+
disabled : bool, default False
|
|
1063
|
+
If set to True, disables @conda.
|
|
1152
1064
|
"""
|
|
1153
1065
|
...
|
|
1154
1066
|
|
|
1155
1067
|
@typing.overload
|
|
1156
|
-
def
|
|
1068
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1157
1069
|
...
|
|
1158
1070
|
|
|
1159
1071
|
@typing.overload
|
|
1160
|
-
def
|
|
1072
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1161
1073
|
...
|
|
1162
1074
|
|
|
1163
|
-
def
|
|
1075
|
+
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):
|
|
1164
1076
|
"""
|
|
1165
|
-
Specifies
|
|
1077
|
+
Specifies the Conda environment for the step.
|
|
1078
|
+
|
|
1079
|
+
Information in this decorator will augment any
|
|
1080
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
1081
|
+
you can use `@conda_base` to set packages required by all
|
|
1082
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
1166
1083
|
|
|
1167
1084
|
|
|
1168
1085
|
Parameters
|
|
1169
1086
|
----------
|
|
1170
|
-
|
|
1171
|
-
|
|
1087
|
+
packages : Dict[str, str], default {}
|
|
1088
|
+
Packages to use for this step. The key is the name of the package
|
|
1089
|
+
and the value is the version to use.
|
|
1090
|
+
libraries : Dict[str, str], default {}
|
|
1091
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1092
|
+
python : str, optional, default None
|
|
1093
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1094
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1095
|
+
disabled : bool, default False
|
|
1096
|
+
If set to True, disables @conda.
|
|
1172
1097
|
"""
|
|
1173
1098
|
...
|
|
1174
1099
|
|
|
1175
|
-
|
|
1100
|
+
@typing.overload
|
|
1101
|
+
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]]]:
|
|
1176
1102
|
"""
|
|
1177
|
-
|
|
1178
|
-
It exists to make it easier for users to know that this decorator should only be used with
|
|
1179
|
-
a Neo Cloud like CoreWeave. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
1183
|
-
for S3 read and write requests.
|
|
1184
|
-
|
|
1185
|
-
This decorator requires an integration in the Outerbounds platform that
|
|
1186
|
-
points to an external bucket. It affects S3 operations performed via
|
|
1187
|
-
Metaflow's `get_aws_client` and `S3` within a `@step`.
|
|
1188
|
-
|
|
1189
|
-
Read operations
|
|
1190
|
-
---------------
|
|
1191
|
-
All read operations pass through the proxy. If an object does not already
|
|
1192
|
-
exist in the external bucket, it is cached there. For example, if code reads
|
|
1193
|
-
from buckets `FOO` and `BAR` using the `S3` interface, objects from both
|
|
1194
|
-
buckets are cached in the external bucket.
|
|
1195
|
-
|
|
1196
|
-
During task execution, all S3‑related read requests are routed through the
|
|
1197
|
-
proxy:
|
|
1198
|
-
- If the object is present in the external object store, the proxy
|
|
1199
|
-
streams it directly from there without accessing the requested origin
|
|
1200
|
-
bucket.
|
|
1201
|
-
- If the object is not present in the external storage, the proxy
|
|
1202
|
-
fetches it from the requested bucket, caches it in the external
|
|
1203
|
-
storage, and streams the response from the origin bucket.
|
|
1204
|
-
|
|
1205
|
-
Warning
|
|
1206
|
-
-------
|
|
1207
|
-
All READ operations (e.g., GetObject, HeadObject) pass through the external
|
|
1208
|
-
bucket regardless of the bucket specified in user code. Even
|
|
1209
|
-
`S3(run=self)` and `S3(s3root="mybucketfoo")` requests go through the
|
|
1210
|
-
external bucket cache.
|
|
1211
|
-
|
|
1212
|
-
Write operations
|
|
1213
|
-
----------------
|
|
1214
|
-
Write behavior is controlled by the `write_mode` parameter, which determines
|
|
1215
|
-
whether writes also persist objects in the cache.
|
|
1103
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
1216
1104
|
|
|
1217
|
-
`
|
|
1218
|
-
- `origin-and-cache`: objects are written both to the cache and to their
|
|
1219
|
-
intended origin bucket.
|
|
1220
|
-
- `origin`: objects are written only to their intended origin bucket.
|
|
1105
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
1221
1106
|
|
|
1222
1107
|
|
|
1223
1108
|
Parameters
|
|
1224
1109
|
----------
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
- `origin-and-cache`
|
|
1234
|
-
debug : bool, optional
|
|
1235
|
-
Enables debug logging for proxy operations.
|
|
1110
|
+
type : str, default 'default'
|
|
1111
|
+
Card type.
|
|
1112
|
+
id : str, optional, default None
|
|
1113
|
+
If multiple cards are present, use this id to identify this card.
|
|
1114
|
+
options : Dict[str, Any], default {}
|
|
1115
|
+
Options passed to the card. The contents depend on the card type.
|
|
1116
|
+
timeout : int, default 45
|
|
1117
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
1236
1118
|
"""
|
|
1237
1119
|
...
|
|
1238
1120
|
|
|
1239
1121
|
@typing.overload
|
|
1240
|
-
def
|
|
1122
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1123
|
+
...
|
|
1124
|
+
|
|
1125
|
+
@typing.overload
|
|
1126
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1127
|
+
...
|
|
1128
|
+
|
|
1129
|
+
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):
|
|
1241
1130
|
"""
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
This decorator is useful if this step may hang indefinitely.
|
|
1245
|
-
|
|
1246
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
1247
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
1248
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
1131
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
1249
1132
|
|
|
1250
|
-
Note that
|
|
1251
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
1133
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
1252
1134
|
|
|
1253
1135
|
|
|
1254
1136
|
Parameters
|
|
1255
1137
|
----------
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1138
|
+
type : str, default 'default'
|
|
1139
|
+
Card type.
|
|
1140
|
+
id : str, optional, default None
|
|
1141
|
+
If multiple cards are present, use this id to identify this card.
|
|
1142
|
+
options : Dict[str, Any], default {}
|
|
1143
|
+
Options passed to the card. The contents depend on the card type.
|
|
1144
|
+
timeout : int, default 45
|
|
1145
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
1262
1146
|
"""
|
|
1263
1147
|
...
|
|
1264
1148
|
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1149
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[typing.Dict[str, str]] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
1150
|
+
"""
|
|
1151
|
+
Specifies that this step should execute on Kubernetes.
|
|
1152
|
+
|
|
1153
|
+
|
|
1154
|
+
Parameters
|
|
1155
|
+
----------
|
|
1156
|
+
cpu : int, default 1
|
|
1157
|
+
Number of CPUs required for this step. If `@resources` is
|
|
1158
|
+
also present, the maximum value from all decorators is used.
|
|
1159
|
+
memory : int, default 4096
|
|
1160
|
+
Memory size (in MB) required for this step. If
|
|
1161
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
1162
|
+
used.
|
|
1163
|
+
disk : int, default 10240
|
|
1164
|
+
Disk size (in MB) required for this step. If
|
|
1165
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
1166
|
+
used.
|
|
1167
|
+
image : str, optional, default None
|
|
1168
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
|
1169
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
1170
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
1171
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
1172
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
1173
|
+
image_pull_secrets: List[str], default []
|
|
1174
|
+
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
1175
|
+
Kubernetes image pull secrets to use when pulling container images
|
|
1176
|
+
in Kubernetes.
|
|
1177
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
1178
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
|
1179
|
+
secrets : List[str], optional, default None
|
|
1180
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
1181
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
1182
|
+
in Metaflow configuration.
|
|
1183
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
|
1184
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
|
1185
|
+
Can be passed in as a comma separated string of values e.g.
|
|
1186
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
1187
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
1188
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
1189
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
1190
|
+
gpu : int, optional, default None
|
|
1191
|
+
Number of GPUs required for this step. A value of zero implies that
|
|
1192
|
+
the scheduled node should not have GPUs.
|
|
1193
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
1194
|
+
The vendor of the GPUs to be used for this step.
|
|
1195
|
+
tolerations : List[Dict[str,str]], default []
|
|
1196
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
1197
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
1198
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
1199
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
|
1200
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
1201
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
1202
|
+
use_tmpfs : bool, default False
|
|
1203
|
+
This enables an explicit tmpfs mount for this step.
|
|
1204
|
+
tmpfs_tempdir : bool, default True
|
|
1205
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
1206
|
+
tmpfs_size : int, optional, default: None
|
|
1207
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
1208
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
1209
|
+
memory allocated for this step.
|
|
1210
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
|
1211
|
+
Path to tmpfs mount for this step.
|
|
1212
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
|
1213
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
1214
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
1215
|
+
shared_memory: int, optional
|
|
1216
|
+
Shared memory size (in MiB) required for this step
|
|
1217
|
+
port: int, optional
|
|
1218
|
+
Port number to specify in the Kubernetes job object
|
|
1219
|
+
compute_pool : str, optional, default None
|
|
1220
|
+
Compute pool to be used for for this step.
|
|
1221
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
|
1222
|
+
hostname_resolution_timeout: int, default 10 * 60
|
|
1223
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
1224
|
+
Only applicable when @parallel is used.
|
|
1225
|
+
qos: str, default: Burstable
|
|
1226
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
1227
|
+
|
|
1228
|
+
security_context: Dict[str, Any], optional, default None
|
|
1229
|
+
Container security context. Applies to the task container. Allows the following keys:
|
|
1230
|
+
- privileged: bool, optional, default None
|
|
1231
|
+
- allow_privilege_escalation: bool, optional, default None
|
|
1232
|
+
- run_as_user: int, optional, default None
|
|
1233
|
+
- run_as_group: int, optional, default None
|
|
1234
|
+
- run_as_non_root: bool, optional, default None
|
|
1235
|
+
"""
|
|
1271
1236
|
...
|
|
1272
1237
|
|
|
1273
|
-
def
|
|
1238
|
+
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]]]:
|
|
1274
1239
|
"""
|
|
1275
|
-
|
|
1240
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
|
1276
1241
|
|
|
1277
|
-
|
|
1242
|
+
User code call
|
|
1243
|
+
--------------
|
|
1244
|
+
@ollama(
|
|
1245
|
+
models=[...],
|
|
1246
|
+
...
|
|
1247
|
+
)
|
|
1278
1248
|
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1249
|
+
Valid backend options
|
|
1250
|
+
---------------------
|
|
1251
|
+
- 'local': Run as a separate process on the local task machine.
|
|
1252
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
1253
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
1282
1254
|
|
|
1283
|
-
|
|
1284
|
-
|
|
1255
|
+
Valid model options
|
|
1256
|
+
-------------------
|
|
1257
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
1285
1258
|
|
|
1286
1259
|
|
|
1287
1260
|
Parameters
|
|
1288
1261
|
----------
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1262
|
+
models: list[str]
|
|
1263
|
+
List of Ollama containers running models in sidecars.
|
|
1264
|
+
backend: str
|
|
1265
|
+
Determines where and how to run the Ollama process.
|
|
1266
|
+
force_pull: bool
|
|
1267
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
1268
|
+
cache_update_policy: str
|
|
1269
|
+
Cache update policy: "auto", "force", or "never".
|
|
1270
|
+
force_cache_update: bool
|
|
1271
|
+
Simple override for "force" cache update policy.
|
|
1272
|
+
debug: bool
|
|
1273
|
+
Whether to turn on verbose debugging logs.
|
|
1274
|
+
circuit_breaker_config: dict
|
|
1275
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
1276
|
+
timeout_config: dict
|
|
1277
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
1295
1278
|
"""
|
|
1296
1279
|
...
|
|
1297
1280
|
|
|
@@ -1412,44 +1395,11 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, cache_scope:
|
|
|
1412
1395
|
"""
|
|
1413
1396
|
...
|
|
1414
1397
|
|
|
1415
|
-
def
|
|
1416
|
-
"""
|
|
1417
|
-
Specifies that this step should execute on DGX cloud.
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
Parameters
|
|
1421
|
-
----------
|
|
1422
|
-
gpu : int
|
|
1423
|
-
Number of GPUs to use.
|
|
1424
|
-
gpu_type : str
|
|
1425
|
-
Type of Nvidia GPU to use.
|
|
1426
|
-
queue_timeout : int
|
|
1427
|
-
Time to keep the job in NVCF's queue.
|
|
1428
|
-
"""
|
|
1429
|
-
...
|
|
1430
|
-
|
|
1431
|
-
@typing.overload
|
|
1432
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1433
|
-
"""
|
|
1434
|
-
Internal decorator to support Fast bakery
|
|
1435
|
-
"""
|
|
1436
|
-
...
|
|
1437
|
-
|
|
1438
|
-
@typing.overload
|
|
1439
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1440
|
-
...
|
|
1441
|
-
|
|
1442
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
1443
|
-
"""
|
|
1444
|
-
Internal decorator to support Fast bakery
|
|
1445
|
-
"""
|
|
1446
|
-
...
|
|
1447
|
-
|
|
1448
|
-
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]]]:
|
|
1398
|
+
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]]]:
|
|
1449
1399
|
"""
|
|
1450
|
-
`@
|
|
1400
|
+
`@coreweave_s3_proxy` is a CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
1451
1401
|
It exists to make it easier for users to know that this decorator should only be used with
|
|
1452
|
-
a Neo Cloud like
|
|
1402
|
+
a Neo Cloud like CoreWeave. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
|
|
1453
1403
|
|
|
1454
1404
|
|
|
1455
1405
|
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
@@ -1509,6 +1459,57 @@ def nebius_s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode
|
|
|
1509
1459
|
"""
|
|
1510
1460
|
...
|
|
1511
1461
|
|
|
1462
|
+
@typing.overload
|
|
1463
|
+
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]]]:
|
|
1464
|
+
"""
|
|
1465
|
+
Specifies the PyPI packages for the step.
|
|
1466
|
+
|
|
1467
|
+
Information in this decorator will augment any
|
|
1468
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
1469
|
+
you can use `@pypi_base` to set packages required by all
|
|
1470
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1471
|
+
|
|
1472
|
+
|
|
1473
|
+
Parameters
|
|
1474
|
+
----------
|
|
1475
|
+
packages : Dict[str, str], default: {}
|
|
1476
|
+
Packages to use for this step. The key is the name of the package
|
|
1477
|
+
and the value is the version to use.
|
|
1478
|
+
python : str, optional, default: None
|
|
1479
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1480
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1481
|
+
"""
|
|
1482
|
+
...
|
|
1483
|
+
|
|
1484
|
+
@typing.overload
|
|
1485
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1486
|
+
...
|
|
1487
|
+
|
|
1488
|
+
@typing.overload
|
|
1489
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1490
|
+
...
|
|
1491
|
+
|
|
1492
|
+
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):
|
|
1493
|
+
"""
|
|
1494
|
+
Specifies the PyPI packages for the step.
|
|
1495
|
+
|
|
1496
|
+
Information in this decorator will augment any
|
|
1497
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
1498
|
+
you can use `@pypi_base` to set packages required by all
|
|
1499
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1500
|
+
|
|
1501
|
+
|
|
1502
|
+
Parameters
|
|
1503
|
+
----------
|
|
1504
|
+
packages : Dict[str, str], default: {}
|
|
1505
|
+
Packages to use for this step. The key is the name of the package
|
|
1506
|
+
and the value is the version to use.
|
|
1507
|
+
python : str, optional, default: None
|
|
1508
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1509
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1510
|
+
"""
|
|
1511
|
+
...
|
|
1512
|
+
|
|
1512
1513
|
@typing.overload
|
|
1513
1514
|
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1514
1515
|
"""
|
|
@@ -1533,30 +1534,202 @@ def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False,
|
|
|
1533
1534
|
"""
|
|
1534
1535
|
...
|
|
1535
1536
|
|
|
1536
|
-
@typing.overload
|
|
1537
|
-
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1538
|
-
...
|
|
1539
|
-
|
|
1540
|
-
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
|
1537
|
+
@typing.overload
|
|
1538
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1539
|
+
...
|
|
1540
|
+
|
|
1541
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
|
1542
|
+
"""
|
|
1543
|
+
Specifies the times when the flow should be run when running on a
|
|
1544
|
+
production scheduler.
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
Parameters
|
|
1548
|
+
----------
|
|
1549
|
+
hourly : bool, default False
|
|
1550
|
+
Run the workflow hourly.
|
|
1551
|
+
daily : bool, default True
|
|
1552
|
+
Run the workflow daily.
|
|
1553
|
+
weekly : bool, default False
|
|
1554
|
+
Run the workflow weekly.
|
|
1555
|
+
cron : str, optional, default None
|
|
1556
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1557
|
+
specified by this expression.
|
|
1558
|
+
timezone : str, optional, default None
|
|
1559
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1560
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1561
|
+
"""
|
|
1562
|
+
...
|
|
1563
|
+
|
|
1564
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1565
|
+
"""
|
|
1566
|
+
Specifies what flows belong to the same project.
|
|
1567
|
+
|
|
1568
|
+
A project-specific namespace is created for all flows that
|
|
1569
|
+
use the same `@project(name)`.
|
|
1570
|
+
|
|
1571
|
+
|
|
1572
|
+
Parameters
|
|
1573
|
+
----------
|
|
1574
|
+
name : str
|
|
1575
|
+
Project name. Make sure that the name is unique amongst all
|
|
1576
|
+
projects that use the same production scheduler. The name may
|
|
1577
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1578
|
+
|
|
1579
|
+
branch : Optional[str], default None
|
|
1580
|
+
The branch to use. If not specified, the branch is set to
|
|
1581
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1582
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1583
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1584
|
+
|
|
1585
|
+
production : bool, default False
|
|
1586
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1587
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1588
|
+
`production` in the decorator and on the command line.
|
|
1589
|
+
The project branch name will be:
|
|
1590
|
+
- if `branch` is specified:
|
|
1591
|
+
- if `production` is True: `prod.<branch>`
|
|
1592
|
+
- if `production` is False: `test.<branch>`
|
|
1593
|
+
- if `branch` is not specified:
|
|
1594
|
+
- if `production` is True: `prod`
|
|
1595
|
+
- if `production` is False: `user.<username>`
|
|
1596
|
+
"""
|
|
1597
|
+
...
|
|
1598
|
+
|
|
1599
|
+
@typing.overload
|
|
1600
|
+
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]]:
|
|
1601
|
+
"""
|
|
1602
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1603
|
+
|
|
1604
|
+
Use `@conda_base` to set common libraries required by all
|
|
1605
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1606
|
+
|
|
1607
|
+
|
|
1608
|
+
Parameters
|
|
1609
|
+
----------
|
|
1610
|
+
packages : Dict[str, str], default {}
|
|
1611
|
+
Packages to use for this flow. The key is the name of the package
|
|
1612
|
+
and the value is the version to use.
|
|
1613
|
+
libraries : Dict[str, str], default {}
|
|
1614
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1615
|
+
python : str, optional, default None
|
|
1616
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1617
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1618
|
+
disabled : bool, default False
|
|
1619
|
+
If set to True, disables Conda.
|
|
1620
|
+
"""
|
|
1621
|
+
...
|
|
1622
|
+
|
|
1623
|
+
@typing.overload
|
|
1624
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1625
|
+
...
|
|
1626
|
+
|
|
1627
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
1628
|
+
"""
|
|
1629
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1630
|
+
|
|
1631
|
+
Use `@conda_base` to set common libraries required by all
|
|
1632
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1633
|
+
|
|
1634
|
+
|
|
1635
|
+
Parameters
|
|
1636
|
+
----------
|
|
1637
|
+
packages : Dict[str, str], default {}
|
|
1638
|
+
Packages to use for this flow. The key is the name of the package
|
|
1639
|
+
and the value is the version to use.
|
|
1640
|
+
libraries : Dict[str, str], default {}
|
|
1641
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1642
|
+
python : str, optional, default None
|
|
1643
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1644
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1645
|
+
disabled : bool, default False
|
|
1646
|
+
If set to True, disables Conda.
|
|
1647
|
+
"""
|
|
1648
|
+
...
|
|
1649
|
+
|
|
1650
|
+
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]]:
|
|
1651
|
+
"""
|
|
1652
|
+
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.
|
|
1653
|
+
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.
|
|
1654
|
+
|
|
1655
|
+
|
|
1656
|
+
Parameters
|
|
1657
|
+
----------
|
|
1658
|
+
timeout : int
|
|
1659
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1660
|
+
poke_interval : int
|
|
1661
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1662
|
+
mode : str
|
|
1663
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1664
|
+
exponential_backoff : bool
|
|
1665
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1666
|
+
pool : str
|
|
1667
|
+
the slot pool this task should run in,
|
|
1668
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1669
|
+
soft_fail : bool
|
|
1670
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1671
|
+
name : str
|
|
1672
|
+
Name of the sensor on Airflow
|
|
1673
|
+
description : str
|
|
1674
|
+
Description of sensor in the Airflow UI
|
|
1675
|
+
external_dag_id : str
|
|
1676
|
+
The dag_id that contains the task you want to wait for.
|
|
1677
|
+
external_task_ids : List[str]
|
|
1678
|
+
The list of task_ids that you want to wait for.
|
|
1679
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1680
|
+
allowed_states : List[str]
|
|
1681
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1682
|
+
failed_states : List[str]
|
|
1683
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1684
|
+
execution_delta : datetime.timedelta
|
|
1685
|
+
time difference with the previous execution to look at,
|
|
1686
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1687
|
+
check_existence: bool
|
|
1688
|
+
Set to True to check if the external task exists or check if
|
|
1689
|
+
the DAG to wait for exists. (Default: True)
|
|
1690
|
+
"""
|
|
1691
|
+
...
|
|
1692
|
+
|
|
1693
|
+
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]]:
|
|
1541
1694
|
"""
|
|
1542
|
-
|
|
1543
|
-
|
|
1695
|
+
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)
|
|
1696
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1697
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1698
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1699
|
+
starts only after all sensors finish.
|
|
1544
1700
|
|
|
1545
1701
|
|
|
1546
1702
|
Parameters
|
|
1547
1703
|
----------
|
|
1548
|
-
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1704
|
+
timeout : int
|
|
1705
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1706
|
+
poke_interval : int
|
|
1707
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1708
|
+
mode : str
|
|
1709
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1710
|
+
exponential_backoff : bool
|
|
1711
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1712
|
+
pool : str
|
|
1713
|
+
the slot pool this task should run in,
|
|
1714
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1715
|
+
soft_fail : bool
|
|
1716
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1717
|
+
name : str
|
|
1718
|
+
Name of the sensor on Airflow
|
|
1719
|
+
description : str
|
|
1720
|
+
Description of sensor in the Airflow UI
|
|
1721
|
+
bucket_key : Union[str, List[str]]
|
|
1722
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1723
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1724
|
+
bucket_name : str
|
|
1725
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1726
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1727
|
+
wildcard_match : bool
|
|
1728
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1729
|
+
aws_conn_id : str
|
|
1730
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1731
|
+
verify : bool
|
|
1732
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1560
1733
|
"""
|
|
1561
1734
|
...
|
|
1562
1735
|
|
|
@@ -1601,41 +1774,6 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
|
1601
1774
|
"""
|
|
1602
1775
|
...
|
|
1603
1776
|
|
|
1604
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1605
|
-
"""
|
|
1606
|
-
Specifies what flows belong to the same project.
|
|
1607
|
-
|
|
1608
|
-
A project-specific namespace is created for all flows that
|
|
1609
|
-
use the same `@project(name)`.
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
Parameters
|
|
1613
|
-
----------
|
|
1614
|
-
name : str
|
|
1615
|
-
Project name. Make sure that the name is unique amongst all
|
|
1616
|
-
projects that use the same production scheduler. The name may
|
|
1617
|
-
contain only lowercase alphanumeric characters and underscores.
|
|
1618
|
-
|
|
1619
|
-
branch : Optional[str], default None
|
|
1620
|
-
The branch to use. If not specified, the branch is set to
|
|
1621
|
-
`user.<username>` unless `production` is set to `True`. This can
|
|
1622
|
-
also be set on the command line using `--branch` as a top-level option.
|
|
1623
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
|
1624
|
-
|
|
1625
|
-
production : bool, default False
|
|
1626
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
1627
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
1628
|
-
`production` in the decorator and on the command line.
|
|
1629
|
-
The project branch name will be:
|
|
1630
|
-
- if `branch` is specified:
|
|
1631
|
-
- if `production` is True: `prod.<branch>`
|
|
1632
|
-
- if `production` is False: `test.<branch>`
|
|
1633
|
-
- if `branch` is not specified:
|
|
1634
|
-
- if `production` is True: `prod`
|
|
1635
|
-
- if `production` is False: `user.<username>`
|
|
1636
|
-
"""
|
|
1637
|
-
...
|
|
1638
|
-
|
|
1639
1777
|
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
|
1640
1778
|
"""
|
|
1641
1779
|
Allows setting external datastores to save data for the
|
|
@@ -1750,143 +1888,6 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
|
1750
1888
|
"""
|
|
1751
1889
|
...
|
|
1752
1890
|
|
|
1753
|
-
@typing.overload
|
|
1754
|
-
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]]:
|
|
1755
|
-
"""
|
|
1756
|
-
Specifies the Conda environment for all steps of the flow.
|
|
1757
|
-
|
|
1758
|
-
Use `@conda_base` to set common libraries required by all
|
|
1759
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
Parameters
|
|
1763
|
-
----------
|
|
1764
|
-
packages : Dict[str, str], default {}
|
|
1765
|
-
Packages to use for this flow. The key is the name of the package
|
|
1766
|
-
and the value is the version to use.
|
|
1767
|
-
libraries : Dict[str, str], default {}
|
|
1768
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1769
|
-
python : str, optional, default None
|
|
1770
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1771
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1772
|
-
disabled : bool, default False
|
|
1773
|
-
If set to True, disables Conda.
|
|
1774
|
-
"""
|
|
1775
|
-
...
|
|
1776
|
-
|
|
1777
|
-
@typing.overload
|
|
1778
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1779
|
-
...
|
|
1780
|
-
|
|
1781
|
-
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
1782
|
-
"""
|
|
1783
|
-
Specifies the Conda environment for all steps of the flow.
|
|
1784
|
-
|
|
1785
|
-
Use `@conda_base` to set common libraries required by all
|
|
1786
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
Parameters
|
|
1790
|
-
----------
|
|
1791
|
-
packages : Dict[str, str], default {}
|
|
1792
|
-
Packages to use for this flow. The key is the name of the package
|
|
1793
|
-
and the value is the version to use.
|
|
1794
|
-
libraries : Dict[str, str], default {}
|
|
1795
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1796
|
-
python : str, optional, default None
|
|
1797
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1798
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1799
|
-
disabled : bool, default False
|
|
1800
|
-
If set to True, disables Conda.
|
|
1801
|
-
"""
|
|
1802
|
-
...
|
|
1803
|
-
|
|
1804
|
-
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]]:
|
|
1805
|
-
"""
|
|
1806
|
-
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)
|
|
1807
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1808
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1809
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1810
|
-
starts only after all sensors finish.
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
Parameters
|
|
1814
|
-
----------
|
|
1815
|
-
timeout : int
|
|
1816
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1817
|
-
poke_interval : int
|
|
1818
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1819
|
-
mode : str
|
|
1820
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1821
|
-
exponential_backoff : bool
|
|
1822
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1823
|
-
pool : str
|
|
1824
|
-
the slot pool this task should run in,
|
|
1825
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1826
|
-
soft_fail : bool
|
|
1827
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1828
|
-
name : str
|
|
1829
|
-
Name of the sensor on Airflow
|
|
1830
|
-
description : str
|
|
1831
|
-
Description of sensor in the Airflow UI
|
|
1832
|
-
bucket_key : Union[str, List[str]]
|
|
1833
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1834
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1835
|
-
bucket_name : str
|
|
1836
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1837
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1838
|
-
wildcard_match : bool
|
|
1839
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1840
|
-
aws_conn_id : str
|
|
1841
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1842
|
-
verify : bool
|
|
1843
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1844
|
-
"""
|
|
1845
|
-
...
|
|
1846
|
-
|
|
1847
|
-
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]]:
|
|
1848
|
-
"""
|
|
1849
|
-
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.
|
|
1850
|
-
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.
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
Parameters
|
|
1854
|
-
----------
|
|
1855
|
-
timeout : int
|
|
1856
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1857
|
-
poke_interval : int
|
|
1858
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1859
|
-
mode : str
|
|
1860
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1861
|
-
exponential_backoff : bool
|
|
1862
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1863
|
-
pool : str
|
|
1864
|
-
the slot pool this task should run in,
|
|
1865
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1866
|
-
soft_fail : bool
|
|
1867
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1868
|
-
name : str
|
|
1869
|
-
Name of the sensor on Airflow
|
|
1870
|
-
description : str
|
|
1871
|
-
Description of sensor in the Airflow UI
|
|
1872
|
-
external_dag_id : str
|
|
1873
|
-
The dag_id that contains the task you want to wait for.
|
|
1874
|
-
external_task_ids : List[str]
|
|
1875
|
-
The list of task_ids that you want to wait for.
|
|
1876
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1877
|
-
allowed_states : List[str]
|
|
1878
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1879
|
-
failed_states : List[str]
|
|
1880
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1881
|
-
execution_delta : datetime.timedelta
|
|
1882
|
-
time difference with the previous execution to look at,
|
|
1883
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1884
|
-
check_existence: bool
|
|
1885
|
-
Set to True to check if the external task exists or check if
|
|
1886
|
-
the DAG to wait for exists. (Default: True)
|
|
1887
|
-
"""
|
|
1888
|
-
...
|
|
1889
|
-
|
|
1890
1891
|
@typing.overload
|
|
1891
1892
|
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]]:
|
|
1892
1893
|
"""
|