ob-metaflow-stubs 6.0.4.1rc1__py2.py3-none-any.whl → 6.0.4.3__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +931 -931
- 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 +3 -3
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +5 -5
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- 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 +63 -63
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +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 +2 -2
- 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 +5 -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 +7 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/click_importer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/code_packager.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/config_utils.pyi +3 -3
- 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 +5 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/deployer.pyi +64 -5
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/experimental/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/perimeters.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/utils.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/ob_internal.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +6 -6
- metaflow-stubs/packaging_sys/backend.pyi +2 -2
- metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
- metaflow-stubs/packaging_sys/tar_backend.pyi +4 -4
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +3 -3
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +12 -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 +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +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 +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +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 +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +4 -4
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +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 +2 -2
- 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 +30 -30
- 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 +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- metaflow-stubs/user_decorators/__init__.pyi +2 -2
- metaflow-stubs/user_decorators/common.pyi +2 -2
- metaflow-stubs/user_decorators/mutable_flow.pyi +5 -5
- metaflow-stubs/user_decorators/mutable_step.pyi +5 -5
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +4 -4
- metaflow-stubs/user_decorators/user_step_decorator.pyi +5 -5
- {ob_metaflow_stubs-6.0.4.1rc1.dist-info → ob_metaflow_stubs-6.0.4.3.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.4.3.dist-info/RECORD +260 -0
- ob_metaflow_stubs-6.0.4.1rc1.dist-info/RECORD +0 -260
- {ob_metaflow_stubs-6.0.4.1rc1.dist-info → ob_metaflow_stubs-6.0.4.3.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.4.1rc1.dist-info → ob_metaflow_stubs-6.0.4.3.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.16.
|
4
|
-
# Generated on 2025-07-
|
3
|
+
# MF version: 2.16.1.1+obcheckpoint(0.2.4);ob(v1) #
|
4
|
+
# Generated on 2025-07-15T20:32:21.659179 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
@@ -48,8 +48,8 @@ from . import plugins as plugins
|
|
48
48
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
49
49
|
from . import includefile as includefile
|
50
50
|
from .includefile import IncludeFile as IncludeFile
|
51
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
52
51
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
52
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
53
53
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
54
54
|
from . import client as client
|
55
55
|
from .client.core import namespace as namespace
|
@@ -162,304 +162,318 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
162
162
|
"""
|
163
163
|
...
|
164
164
|
|
165
|
-
|
165
|
+
@typing.overload
|
166
|
+
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]]]:
|
166
167
|
"""
|
167
|
-
|
168
|
-
|
169
|
-
> Examples
|
170
|
-
|
171
|
-
**Usage: creating references of models from huggingface that may be loaded in downstream steps**
|
172
|
-
```python
|
173
|
-
@huggingface_hub
|
174
|
-
@step
|
175
|
-
def pull_model_from_huggingface(self):
|
176
|
-
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
177
|
-
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
178
|
-
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
179
|
-
# value of the function is a reference to the model in the backend storage.
|
180
|
-
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
181
|
-
|
182
|
-
self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
|
183
|
-
self.llama_model = current.huggingface_hub.snapshot_download(
|
184
|
-
repo_id=self.model_id,
|
185
|
-
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
186
|
-
)
|
187
|
-
self.next(self.train)
|
188
|
-
```
|
189
|
-
|
190
|
-
**Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
|
191
|
-
```python
|
192
|
-
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
193
|
-
@step
|
194
|
-
def pull_model_from_huggingface(self):
|
195
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
196
|
-
```
|
197
|
-
|
198
|
-
```python
|
199
|
-
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
|
200
|
-
@step
|
201
|
-
def finetune_model(self):
|
202
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
203
|
-
# path_to_model will be /my-directory
|
204
|
-
```
|
168
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
205
169
|
|
206
|
-
|
207
|
-
# Takes all the arguments passed to `snapshot_download`
|
208
|
-
# except for `local_dir`
|
209
|
-
@huggingface_hub(load=[
|
210
|
-
{
|
211
|
-
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
212
|
-
},
|
213
|
-
{
|
214
|
-
"repo_id": "myorg/mistral-lora",
|
215
|
-
"repo_type": "model",
|
216
|
-
},
|
217
|
-
])
|
218
|
-
@step
|
219
|
-
def finetune_model(self):
|
220
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
221
|
-
# path_to_model will be /my-directory
|
222
|
-
```
|
170
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
223
171
|
|
224
172
|
|
225
173
|
Parameters
|
226
174
|
----------
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
- If repo (model/dataset) is not found in the datastore:
|
236
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
237
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
238
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
239
|
-
|
240
|
-
- If repo is found in the datastore:
|
241
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
175
|
+
type : str, default 'default'
|
176
|
+
Card type.
|
177
|
+
id : str, optional, default None
|
178
|
+
If multiple cards are present, use this id to identify this card.
|
179
|
+
options : Dict[str, Any], default {}
|
180
|
+
Options passed to the card. The contents depend on the card type.
|
181
|
+
timeout : int, default 45
|
182
|
+
Interrupt reporting if it takes more than this many seconds.
|
242
183
|
"""
|
243
184
|
...
|
244
185
|
|
245
186
|
@typing.overload
|
246
|
-
def
|
187
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
188
|
+
...
|
189
|
+
|
190
|
+
@typing.overload
|
191
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
192
|
+
...
|
193
|
+
|
194
|
+
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):
|
247
195
|
"""
|
248
|
-
|
196
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
197
|
+
|
198
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
249
199
|
|
250
200
|
|
251
201
|
Parameters
|
252
202
|
----------
|
253
|
-
|
254
|
-
|
203
|
+
type : str, default 'default'
|
204
|
+
Card type.
|
205
|
+
id : str, optional, default None
|
206
|
+
If multiple cards are present, use this id to identify this card.
|
207
|
+
options : Dict[str, Any], default {}
|
208
|
+
Options passed to the card. The contents depend on the card type.
|
209
|
+
timeout : int, default 45
|
210
|
+
Interrupt reporting if it takes more than this many seconds.
|
255
211
|
"""
|
256
212
|
...
|
257
213
|
|
258
214
|
@typing.overload
|
259
|
-
def
|
215
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
216
|
+
"""
|
217
|
+
Decorator prototype for all step decorators. This function gets specialized
|
218
|
+
and imported for all decorators types by _import_plugin_decorators().
|
219
|
+
"""
|
260
220
|
...
|
261
221
|
|
262
222
|
@typing.overload
|
263
|
-
def
|
223
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
264
224
|
...
|
265
225
|
|
266
|
-
def
|
226
|
+
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
267
227
|
"""
|
268
|
-
|
228
|
+
Decorator prototype for all step decorators. This function gets specialized
|
229
|
+
and imported for all decorators types by _import_plugin_decorators().
|
230
|
+
"""
|
231
|
+
...
|
232
|
+
|
233
|
+
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]]]:
|
234
|
+
"""
|
235
|
+
Specifies that this step should execute on DGX cloud.
|
269
236
|
|
270
237
|
|
271
238
|
Parameters
|
272
239
|
----------
|
273
|
-
|
274
|
-
|
240
|
+
gpu : int
|
241
|
+
Number of GPUs to use.
|
242
|
+
gpu_type : str
|
243
|
+
Type of Nvidia GPU to use.
|
244
|
+
queue_timeout : int
|
245
|
+
Time to keep the job in NVCF's queue.
|
275
246
|
"""
|
276
247
|
...
|
277
248
|
|
278
249
|
@typing.overload
|
279
|
-
def
|
250
|
+
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]]]:
|
280
251
|
"""
|
281
|
-
Specifies
|
282
|
-
|
283
|
-
Information in this decorator will augment any
|
284
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
285
|
-
you can use `@conda_base` to set packages required by all
|
286
|
-
steps and use `@conda` to specify step-specific overrides.
|
252
|
+
Specifies environment variables to be set prior to the execution of a step.
|
287
253
|
|
288
254
|
|
289
255
|
Parameters
|
290
256
|
----------
|
291
|
-
|
292
|
-
|
293
|
-
and the value is the version to use.
|
294
|
-
libraries : Dict[str, str], default {}
|
295
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
296
|
-
python : str, optional, default None
|
297
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
298
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
299
|
-
disabled : bool, default False
|
300
|
-
If set to True, disables @conda.
|
257
|
+
vars : Dict[str, str], default {}
|
258
|
+
Dictionary of environment variables to set.
|
301
259
|
"""
|
302
260
|
...
|
303
261
|
|
304
262
|
@typing.overload
|
305
|
-
def
|
263
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
306
264
|
...
|
307
265
|
|
308
266
|
@typing.overload
|
309
|
-
def
|
267
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
310
268
|
...
|
311
269
|
|
312
|
-
def
|
270
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
313
271
|
"""
|
314
|
-
Specifies
|
315
|
-
|
316
|
-
Information in this decorator will augment any
|
317
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
318
|
-
you can use `@conda_base` to set packages required by all
|
319
|
-
steps and use `@conda` to specify step-specific overrides.
|
272
|
+
Specifies environment variables to be set prior to the execution of a step.
|
320
273
|
|
321
274
|
|
322
275
|
Parameters
|
323
276
|
----------
|
324
|
-
|
325
|
-
|
326
|
-
and the value is the version to use.
|
327
|
-
libraries : Dict[str, str], default {}
|
328
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
329
|
-
python : str, optional, default None
|
330
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
331
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
332
|
-
disabled : bool, default False
|
333
|
-
If set to True, disables @conda.
|
277
|
+
vars : Dict[str, str], default {}
|
278
|
+
Dictionary of environment variables to set.
|
334
279
|
"""
|
335
280
|
...
|
336
281
|
|
337
282
|
@typing.overload
|
338
|
-
def
|
283
|
+
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]]]:
|
339
284
|
"""
|
340
|
-
Enables
|
285
|
+
Enables checkpointing for a step.
|
341
286
|
|
342
287
|
> Examples
|
343
|
-
|
288
|
+
|
289
|
+
- Saving Checkpoints
|
290
|
+
|
344
291
|
```python
|
345
|
-
@
|
292
|
+
@checkpoint
|
346
293
|
@step
|
347
294
|
def train(self):
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
print(os.listdir(current.model.loaded["my_model"]))
|
366
|
-
self.next(self.end)
|
295
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
296
|
+
for i in range(self.epochs):
|
297
|
+
# some training logic
|
298
|
+
loss = model.train(self.dataset)
|
299
|
+
if i % 10 == 0:
|
300
|
+
model.save(
|
301
|
+
current.checkpoint.directory,
|
302
|
+
)
|
303
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
304
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
305
|
+
self.latest_checkpoint = current.checkpoint.save(
|
306
|
+
name="epoch_checkpoint",
|
307
|
+
metadata={
|
308
|
+
"epoch": i,
|
309
|
+
"loss": loss,
|
310
|
+
}
|
311
|
+
)
|
367
312
|
```
|
368
313
|
|
369
|
-
-
|
314
|
+
- Using Loaded Checkpoints
|
315
|
+
|
370
316
|
```python
|
317
|
+
@retry(times=3)
|
318
|
+
@checkpoint
|
371
319
|
@step
|
372
320
|
def train(self):
|
373
|
-
#
|
374
|
-
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
321
|
+
# Assume that the task has restarted and the previous attempt of the task
|
322
|
+
# saved a checkpoint
|
323
|
+
checkpoint_path = None
|
324
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
325
|
+
print("Loaded checkpoint from the previous attempt")
|
326
|
+
checkpoint_path = current.checkpoint.directory
|
327
|
+
|
328
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
329
|
+
for i in range(self.epochs):
|
330
|
+
...
|
381
331
|
```
|
382
332
|
|
383
333
|
|
384
334
|
Parameters
|
385
335
|
----------
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
336
|
+
load_policy : str, default: "fresh"
|
337
|
+
The policy for loading the checkpoint. The following policies are supported:
|
338
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
339
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
340
|
+
will be loaded at the start of the task.
|
341
|
+
- "none": Do not load any checkpoint
|
342
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
343
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
344
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
345
|
+
created within the task will be loaded when the task is retries execution on failure.
|
392
346
|
|
393
347
|
temp_dir_root : str, default: None
|
394
|
-
The root directory under which `current.
|
348
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
395
349
|
"""
|
396
350
|
...
|
397
351
|
|
398
352
|
@typing.overload
|
399
|
-
def
|
353
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
400
354
|
...
|
401
355
|
|
402
356
|
@typing.overload
|
403
|
-
def
|
357
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
404
358
|
...
|
405
359
|
|
406
|
-
def
|
360
|
+
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):
|
407
361
|
"""
|
408
|
-
Enables
|
362
|
+
Enables checkpointing for a step.
|
409
363
|
|
410
364
|
> Examples
|
411
|
-
|
365
|
+
|
366
|
+
- Saving Checkpoints
|
367
|
+
|
412
368
|
```python
|
413
|
-
@
|
369
|
+
@checkpoint
|
414
370
|
@step
|
415
371
|
def train(self):
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
|
433
|
-
print(os.listdir(current.model.loaded["my_model"]))
|
434
|
-
self.next(self.end)
|
372
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
373
|
+
for i in range(self.epochs):
|
374
|
+
# some training logic
|
375
|
+
loss = model.train(self.dataset)
|
376
|
+
if i % 10 == 0:
|
377
|
+
model.save(
|
378
|
+
current.checkpoint.directory,
|
379
|
+
)
|
380
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
381
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
382
|
+
self.latest_checkpoint = current.checkpoint.save(
|
383
|
+
name="epoch_checkpoint",
|
384
|
+
metadata={
|
385
|
+
"epoch": i,
|
386
|
+
"loss": loss,
|
387
|
+
}
|
388
|
+
)
|
435
389
|
```
|
436
390
|
|
437
|
-
-
|
391
|
+
- Using Loaded Checkpoints
|
392
|
+
|
438
393
|
```python
|
394
|
+
@retry(times=3)
|
395
|
+
@checkpoint
|
439
396
|
@step
|
440
397
|
def train(self):
|
441
|
-
#
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
398
|
+
# Assume that the task has restarted and the previous attempt of the task
|
399
|
+
# saved a checkpoint
|
400
|
+
checkpoint_path = None
|
401
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
402
|
+
print("Loaded checkpoint from the previous attempt")
|
403
|
+
checkpoint_path = current.checkpoint.directory
|
404
|
+
|
405
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
406
|
+
for i in range(self.epochs):
|
407
|
+
...
|
449
408
|
```
|
450
409
|
|
451
410
|
|
452
411
|
Parameters
|
453
412
|
----------
|
454
|
-
|
455
|
-
|
456
|
-
|
457
|
-
|
458
|
-
|
459
|
-
|
413
|
+
load_policy : str, default: "fresh"
|
414
|
+
The policy for loading the checkpoint. The following policies are supported:
|
415
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
416
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
417
|
+
will be loaded at the start of the task.
|
418
|
+
- "none": Do not load any checkpoint
|
419
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
420
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
421
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
422
|
+
created within the task will be loaded when the task is retries execution on failure.
|
460
423
|
|
461
424
|
temp_dir_root : str, default: None
|
462
|
-
The root directory under which `current.
|
425
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
426
|
+
"""
|
427
|
+
...
|
428
|
+
|
429
|
+
@typing.overload
|
430
|
+
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
431
|
+
"""
|
432
|
+
Specifies that the step will success under all circumstances.
|
433
|
+
|
434
|
+
The decorator will create an optional artifact, specified by `var`, which
|
435
|
+
contains the exception raised. You can use it to detect the presence
|
436
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
437
|
+
are missing.
|
438
|
+
|
439
|
+
|
440
|
+
Parameters
|
441
|
+
----------
|
442
|
+
var : str, optional, default None
|
443
|
+
Name of the artifact in which to store the caught exception.
|
444
|
+
If not specified, the exception is not stored.
|
445
|
+
print_exception : bool, default True
|
446
|
+
Determines whether or not the exception is printed to
|
447
|
+
stdout when caught.
|
448
|
+
"""
|
449
|
+
...
|
450
|
+
|
451
|
+
@typing.overload
|
452
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
453
|
+
...
|
454
|
+
|
455
|
+
@typing.overload
|
456
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
457
|
+
...
|
458
|
+
|
459
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
460
|
+
"""
|
461
|
+
Specifies that the step will success under all circumstances.
|
462
|
+
|
463
|
+
The decorator will create an optional artifact, specified by `var`, which
|
464
|
+
contains the exception raised. You can use it to detect the presence
|
465
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
466
|
+
are missing.
|
467
|
+
|
468
|
+
|
469
|
+
Parameters
|
470
|
+
----------
|
471
|
+
var : str, optional, default None
|
472
|
+
Name of the artifact in which to store the caught exception.
|
473
|
+
If not specified, the exception is not stored.
|
474
|
+
print_exception : bool, default True
|
475
|
+
Determines whether or not the exception is printed to
|
476
|
+
stdout when caught.
|
463
477
|
"""
|
464
478
|
...
|
465
479
|
|
@@ -552,149 +566,285 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
552
566
|
"""
|
553
567
|
...
|
554
568
|
|
555
|
-
|
569
|
+
@typing.overload
|
570
|
+
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]]]:
|
556
571
|
"""
|
557
|
-
|
572
|
+
Enables loading / saving of models within a step.
|
558
573
|
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
)
|
574
|
+
> Examples
|
575
|
+
- Saving Models
|
576
|
+
```python
|
577
|
+
@model
|
578
|
+
@step
|
579
|
+
def train(self):
|
580
|
+
# current.model.save returns a dictionary reference to the model saved
|
581
|
+
self.my_model = current.model.save(
|
582
|
+
path_to_my_model,
|
583
|
+
label="my_model",
|
584
|
+
metadata={
|
585
|
+
"epochs": 10,
|
586
|
+
"batch-size": 32,
|
587
|
+
"learning-rate": 0.001,
|
588
|
+
}
|
589
|
+
)
|
590
|
+
self.next(self.test)
|
565
591
|
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
|
570
|
-
|
592
|
+
@model(load="my_model")
|
593
|
+
@step
|
594
|
+
def test(self):
|
595
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
596
|
+
# where the key is the name of the artifact and the value is the path to the model
|
597
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
598
|
+
self.next(self.end)
|
599
|
+
```
|
571
600
|
|
572
|
-
|
573
|
-
|
574
|
-
|
601
|
+
- Loading models
|
602
|
+
```python
|
603
|
+
@step
|
604
|
+
def train(self):
|
605
|
+
# current.model.load returns the path to the model loaded
|
606
|
+
checkpoint_path = current.model.load(
|
607
|
+
self.checkpoint_key,
|
608
|
+
)
|
609
|
+
model_path = current.model.load(
|
610
|
+
self.model,
|
611
|
+
)
|
612
|
+
self.next(self.test)
|
613
|
+
```
|
575
614
|
|
576
615
|
|
577
616
|
Parameters
|
578
617
|
----------
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
cache_update_policy: str
|
586
|
-
Cache update policy: "auto", "force", or "never".
|
587
|
-
force_cache_update: bool
|
588
|
-
Simple override for "force" cache update policy.
|
589
|
-
debug: bool
|
590
|
-
Whether to turn on verbose debugging logs.
|
591
|
-
circuit_breaker_config: dict
|
592
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
593
|
-
timeout_config: dict
|
594
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
595
|
-
"""
|
596
|
-
...
|
597
|
-
|
598
|
-
@typing.overload
|
599
|
-
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]]]:
|
600
|
-
"""
|
601
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
602
|
-
the execution of a step.
|
603
|
-
|
618
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
619
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
620
|
+
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`.
|
621
|
+
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
|
622
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
623
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
604
624
|
|
605
|
-
|
606
|
-
|
607
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
608
|
-
List of secret specs, defining how the secrets are to be retrieved
|
609
|
-
role : str, optional, default: None
|
610
|
-
Role to use for fetching secrets
|
625
|
+
temp_dir_root : str, default: None
|
626
|
+
The root directory under which `current.model.loaded` will store loaded models
|
611
627
|
"""
|
612
628
|
...
|
613
629
|
|
614
630
|
@typing.overload
|
615
|
-
def
|
631
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
616
632
|
...
|
617
633
|
|
618
634
|
@typing.overload
|
619
|
-
def
|
635
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
620
636
|
...
|
621
637
|
|
622
|
-
def
|
638
|
+
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):
|
623
639
|
"""
|
624
|
-
|
625
|
-
|
640
|
+
Enables loading / saving of models within a step.
|
641
|
+
|
642
|
+
> Examples
|
643
|
+
- Saving Models
|
644
|
+
```python
|
645
|
+
@model
|
646
|
+
@step
|
647
|
+
def train(self):
|
648
|
+
# current.model.save returns a dictionary reference to the model saved
|
649
|
+
self.my_model = current.model.save(
|
650
|
+
path_to_my_model,
|
651
|
+
label="my_model",
|
652
|
+
metadata={
|
653
|
+
"epochs": 10,
|
654
|
+
"batch-size": 32,
|
655
|
+
"learning-rate": 0.001,
|
656
|
+
}
|
657
|
+
)
|
658
|
+
self.next(self.test)
|
659
|
+
|
660
|
+
@model(load="my_model")
|
661
|
+
@step
|
662
|
+
def test(self):
|
663
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
664
|
+
# where the key is the name of the artifact and the value is the path to the model
|
665
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
666
|
+
self.next(self.end)
|
667
|
+
```
|
668
|
+
|
669
|
+
- Loading models
|
670
|
+
```python
|
671
|
+
@step
|
672
|
+
def train(self):
|
673
|
+
# current.model.load returns the path to the model loaded
|
674
|
+
checkpoint_path = current.model.load(
|
675
|
+
self.checkpoint_key,
|
676
|
+
)
|
677
|
+
model_path = current.model.load(
|
678
|
+
self.model,
|
679
|
+
)
|
680
|
+
self.next(self.test)
|
681
|
+
```
|
626
682
|
|
627
683
|
|
628
684
|
Parameters
|
629
685
|
----------
|
630
|
-
|
631
|
-
|
632
|
-
|
633
|
-
|
686
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
687
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
688
|
+
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`.
|
689
|
+
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
|
690
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
691
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
692
|
+
|
693
|
+
temp_dir_root : str, default: None
|
694
|
+
The root directory under which `current.model.loaded` will store loaded models
|
634
695
|
"""
|
635
696
|
...
|
636
697
|
|
637
698
|
@typing.overload
|
638
|
-
def
|
699
|
+
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]]]:
|
639
700
|
"""
|
640
|
-
Specifies
|
641
|
-
|
642
|
-
This decorator is useful if this step may hang indefinitely.
|
643
|
-
|
644
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
645
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
646
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
701
|
+
Specifies the PyPI packages for the step.
|
647
702
|
|
648
|
-
|
649
|
-
|
703
|
+
Information in this decorator will augment any
|
704
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
705
|
+
you can use `@pypi_base` to set packages required by all
|
706
|
+
steps and use `@pypi` to specify step-specific overrides.
|
650
707
|
|
651
708
|
|
652
709
|
Parameters
|
653
710
|
----------
|
654
|
-
|
655
|
-
|
656
|
-
|
657
|
-
|
658
|
-
|
659
|
-
|
711
|
+
packages : Dict[str, str], default: {}
|
712
|
+
Packages to use for this step. The key is the name of the package
|
713
|
+
and the value is the version to use.
|
714
|
+
python : str, optional, default: None
|
715
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
716
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
660
717
|
"""
|
661
718
|
...
|
662
719
|
|
663
720
|
@typing.overload
|
664
|
-
def
|
721
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
665
722
|
...
|
666
723
|
|
667
724
|
@typing.overload
|
668
|
-
def
|
725
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
669
726
|
...
|
670
727
|
|
671
|
-
def
|
728
|
+
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):
|
672
729
|
"""
|
673
|
-
Specifies
|
730
|
+
Specifies the PyPI packages for the step.
|
674
731
|
|
675
|
-
|
732
|
+
Information in this decorator will augment any
|
733
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
734
|
+
you can use `@pypi_base` to set packages required by all
|
735
|
+
steps and use `@pypi` to specify step-specific overrides.
|
676
736
|
|
677
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
678
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
679
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
680
737
|
|
681
|
-
|
682
|
-
|
738
|
+
Parameters
|
739
|
+
----------
|
740
|
+
packages : Dict[str, str], default: {}
|
741
|
+
Packages to use for this step. The key is the name of the package
|
742
|
+
and the value is the version to use.
|
743
|
+
python : str, optional, default: None
|
744
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
745
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
746
|
+
"""
|
747
|
+
...
|
748
|
+
|
749
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
750
|
+
"""
|
751
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
752
|
+
|
753
|
+
> Examples
|
754
|
+
|
755
|
+
**Usage: creating references of models from huggingface that may be loaded in downstream steps**
|
756
|
+
```python
|
757
|
+
@huggingface_hub
|
758
|
+
@step
|
759
|
+
def pull_model_from_huggingface(self):
|
760
|
+
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
761
|
+
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
762
|
+
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
763
|
+
# value of the function is a reference to the model in the backend storage.
|
764
|
+
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
765
|
+
|
766
|
+
self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
|
767
|
+
self.llama_model = current.huggingface_hub.snapshot_download(
|
768
|
+
repo_id=self.model_id,
|
769
|
+
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
770
|
+
)
|
771
|
+
self.next(self.train)
|
772
|
+
```
|
773
|
+
|
774
|
+
**Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
|
775
|
+
```python
|
776
|
+
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
777
|
+
@step
|
778
|
+
def pull_model_from_huggingface(self):
|
779
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
780
|
+
```
|
781
|
+
|
782
|
+
```python
|
783
|
+
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
|
784
|
+
@step
|
785
|
+
def finetune_model(self):
|
786
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
787
|
+
# path_to_model will be /my-directory
|
788
|
+
```
|
789
|
+
|
790
|
+
```python
|
791
|
+
# Takes all the arguments passed to `snapshot_download`
|
792
|
+
# except for `local_dir`
|
793
|
+
@huggingface_hub(load=[
|
794
|
+
{
|
795
|
+
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
796
|
+
},
|
797
|
+
{
|
798
|
+
"repo_id": "myorg/mistral-lora",
|
799
|
+
"repo_type": "model",
|
800
|
+
},
|
801
|
+
])
|
802
|
+
@step
|
803
|
+
def finetune_model(self):
|
804
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
805
|
+
# path_to_model will be /my-directory
|
806
|
+
```
|
683
807
|
|
684
808
|
|
685
809
|
Parameters
|
686
810
|
----------
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
811
|
+
temp_dir_root : str, optional
|
812
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
813
|
+
|
814
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
815
|
+
The list of repos (models/datasets) to load.
|
816
|
+
|
817
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
818
|
+
|
819
|
+
- If repo (model/dataset) is not found in the datastore:
|
820
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
821
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
822
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
823
|
+
|
824
|
+
- If repo is found in the datastore:
|
825
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
693
826
|
"""
|
694
827
|
...
|
695
828
|
|
696
829
|
@typing.overload
|
697
|
-
def
|
830
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
831
|
+
"""
|
832
|
+
Internal decorator to support Fast bakery
|
833
|
+
"""
|
834
|
+
...
|
835
|
+
|
836
|
+
@typing.overload
|
837
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
838
|
+
...
|
839
|
+
|
840
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
841
|
+
"""
|
842
|
+
Internal decorator to support Fast bakery
|
843
|
+
"""
|
844
|
+
...
|
845
|
+
|
846
|
+
@typing.overload
|
847
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
698
848
|
"""
|
699
849
|
Decorator prototype for all step decorators. This function gets specialized
|
700
850
|
and imported for all decorators types by _import_plugin_decorators().
|
@@ -702,116 +852,135 @@ def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.
|
|
702
852
|
...
|
703
853
|
|
704
854
|
@typing.overload
|
705
|
-
def
|
855
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
706
856
|
...
|
707
857
|
|
708
|
-
def
|
858
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
709
859
|
"""
|
710
860
|
Decorator prototype for all step decorators. This function gets specialized
|
711
861
|
and imported for all decorators types by _import_plugin_decorators().
|
712
862
|
"""
|
713
863
|
...
|
714
864
|
|
715
|
-
|
865
|
+
@typing.overload
|
866
|
+
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]]]:
|
716
867
|
"""
|
717
|
-
|
718
|
-
|
719
|
-
User code call
|
720
|
-
--------------
|
721
|
-
@vllm(
|
722
|
-
model="...",
|
723
|
-
...
|
724
|
-
)
|
725
|
-
|
726
|
-
Valid backend options
|
727
|
-
---------------------
|
728
|
-
- 'local': Run as a separate process on the local task machine.
|
729
|
-
|
730
|
-
Valid model options
|
731
|
-
-------------------
|
732
|
-
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
868
|
+
Specifies the Conda environment for the step.
|
733
869
|
|
734
|
-
|
735
|
-
|
870
|
+
Information in this decorator will augment any
|
871
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
872
|
+
you can use `@conda_base` to set packages required by all
|
873
|
+
steps and use `@conda` to specify step-specific overrides.
|
736
874
|
|
737
875
|
|
738
876
|
Parameters
|
739
877
|
----------
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
|
749
|
-
|
750
|
-
card_refresh_interval: int
|
751
|
-
Interval in seconds for refreshing the vLLM status card.
|
752
|
-
Only used when openai_api_server=True.
|
753
|
-
max_retries: int
|
754
|
-
Maximum number of retries checking for vLLM server startup.
|
755
|
-
Only used when openai_api_server=True.
|
756
|
-
retry_alert_frequency: int
|
757
|
-
Frequency of alert logs for vLLM server startup retries.
|
758
|
-
Only used when openai_api_server=True.
|
759
|
-
engine_args : dict
|
760
|
-
Additional keyword arguments to pass to the vLLM engine.
|
761
|
-
For example, `tensor_parallel_size=2`.
|
878
|
+
packages : Dict[str, str], default {}
|
879
|
+
Packages to use for this step. The key is the name of the package
|
880
|
+
and the value is the version to use.
|
881
|
+
libraries : Dict[str, str], default {}
|
882
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
883
|
+
python : str, optional, default None
|
884
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
885
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
886
|
+
disabled : bool, default False
|
887
|
+
If set to True, disables @conda.
|
762
888
|
"""
|
763
889
|
...
|
764
890
|
|
765
891
|
@typing.overload
|
766
|
-
def
|
892
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
893
|
+
...
|
894
|
+
|
895
|
+
@typing.overload
|
896
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
897
|
+
...
|
898
|
+
|
899
|
+
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):
|
767
900
|
"""
|
768
|
-
|
901
|
+
Specifies the Conda environment for the step.
|
769
902
|
|
770
|
-
|
903
|
+
Information in this decorator will augment any
|
904
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
905
|
+
you can use `@conda_base` to set packages required by all
|
906
|
+
steps and use `@conda` to specify step-specific overrides.
|
771
907
|
|
772
908
|
|
773
909
|
Parameters
|
774
910
|
----------
|
775
|
-
|
776
|
-
|
777
|
-
|
778
|
-
|
779
|
-
|
780
|
-
|
781
|
-
|
782
|
-
|
911
|
+
packages : Dict[str, str], default {}
|
912
|
+
Packages to use for this step. The key is the name of the package
|
913
|
+
and the value is the version to use.
|
914
|
+
libraries : Dict[str, str], default {}
|
915
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
916
|
+
python : str, optional, default None
|
917
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
918
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
919
|
+
disabled : bool, default False
|
920
|
+
If set to True, disables @conda.
|
783
921
|
"""
|
784
922
|
...
|
785
923
|
|
786
924
|
@typing.overload
|
787
|
-
def
|
925
|
+
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]]]:
|
926
|
+
"""
|
927
|
+
Specifies a timeout for your step.
|
928
|
+
|
929
|
+
This decorator is useful if this step may hang indefinitely.
|
930
|
+
|
931
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
932
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
933
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
934
|
+
|
935
|
+
Note that all the values specified in parameters are added together so if you specify
|
936
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
937
|
+
|
938
|
+
|
939
|
+
Parameters
|
940
|
+
----------
|
941
|
+
seconds : int, default 0
|
942
|
+
Number of seconds to wait prior to timing out.
|
943
|
+
minutes : int, default 0
|
944
|
+
Number of minutes to wait prior to timing out.
|
945
|
+
hours : int, default 0
|
946
|
+
Number of hours to wait prior to timing out.
|
947
|
+
"""
|
788
948
|
...
|
789
949
|
|
790
950
|
@typing.overload
|
791
|
-
def
|
951
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
792
952
|
...
|
793
953
|
|
794
|
-
|
954
|
+
@typing.overload
|
955
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
956
|
+
...
|
957
|
+
|
958
|
+
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):
|
795
959
|
"""
|
796
|
-
|
960
|
+
Specifies a timeout for your step.
|
797
961
|
|
798
|
-
|
962
|
+
This decorator is useful if this step may hang indefinitely.
|
963
|
+
|
964
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
965
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
966
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
967
|
+
|
968
|
+
Note that all the values specified in parameters are added together so if you specify
|
969
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
799
970
|
|
800
971
|
|
801
972
|
Parameters
|
802
973
|
----------
|
803
|
-
|
804
|
-
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
timeout : int, default 45
|
810
|
-
Interrupt reporting if it takes more than this many seconds.
|
974
|
+
seconds : int, default 0
|
975
|
+
Number of seconds to wait prior to timing out.
|
976
|
+
minutes : int, default 0
|
977
|
+
Number of minutes to wait prior to timing out.
|
978
|
+
hours : int, default 0
|
979
|
+
Number of hours to wait prior to timing out.
|
811
980
|
"""
|
812
981
|
...
|
813
982
|
|
814
|
-
def
|
983
|
+
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]]]:
|
815
984
|
"""
|
816
985
|
Specifies that this step should execute on DGX cloud.
|
817
986
|
|
@@ -822,8 +991,56 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
|
|
822
991
|
Number of GPUs to use.
|
823
992
|
gpu_type : str
|
824
993
|
Type of Nvidia GPU to use.
|
825
|
-
|
826
|
-
|
994
|
+
"""
|
995
|
+
...
|
996
|
+
|
997
|
+
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]]]:
|
998
|
+
"""
|
999
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
1000
|
+
|
1001
|
+
User code call
|
1002
|
+
--------------
|
1003
|
+
@vllm(
|
1004
|
+
model="...",
|
1005
|
+
...
|
1006
|
+
)
|
1007
|
+
|
1008
|
+
Valid backend options
|
1009
|
+
---------------------
|
1010
|
+
- 'local': Run as a separate process on the local task machine.
|
1011
|
+
|
1012
|
+
Valid model options
|
1013
|
+
-------------------
|
1014
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
1015
|
+
|
1016
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
1017
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
1018
|
+
|
1019
|
+
|
1020
|
+
Parameters
|
1021
|
+
----------
|
1022
|
+
model: str
|
1023
|
+
HuggingFace model identifier to be served by vLLM.
|
1024
|
+
backend: str
|
1025
|
+
Determines where and how to run the vLLM process.
|
1026
|
+
openai_api_server: bool
|
1027
|
+
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
1028
|
+
Default is False (uses native engine).
|
1029
|
+
Set to True for backward compatibility with existing code.
|
1030
|
+
debug: bool
|
1031
|
+
Whether to turn on verbose debugging logs.
|
1032
|
+
card_refresh_interval: int
|
1033
|
+
Interval in seconds for refreshing the vLLM status card.
|
1034
|
+
Only used when openai_api_server=True.
|
1035
|
+
max_retries: int
|
1036
|
+
Maximum number of retries checking for vLLM server startup.
|
1037
|
+
Only used when openai_api_server=True.
|
1038
|
+
retry_alert_frequency: int
|
1039
|
+
Frequency of alert logs for vLLM server startup retries.
|
1040
|
+
Only used when openai_api_server=True.
|
1041
|
+
engine_args : dict
|
1042
|
+
Additional keyword arguments to pass to the vLLM engine.
|
1043
|
+
For example, `tensor_parallel_size=2`.
|
827
1044
|
"""
|
828
1045
|
...
|
829
1046
|
|
@@ -883,524 +1100,163 @@ def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
883
1100
|
...
|
884
1101
|
|
885
1102
|
@typing.overload
|
886
|
-
def
|
887
|
-
"""
|
888
|
-
Decorator prototype for all step decorators. This function gets specialized
|
889
|
-
and imported for all decorators types by _import_plugin_decorators().
|
890
|
-
"""
|
891
|
-
...
|
892
|
-
|
893
|
-
@typing.overload
|
894
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
895
|
-
...
|
896
|
-
|
897
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
898
|
-
"""
|
899
|
-
Decorator prototype for all step decorators. This function gets specialized
|
900
|
-
and imported for all decorators types by _import_plugin_decorators().
|
901
|
-
"""
|
902
|
-
...
|
903
|
-
|
904
|
-
@typing.overload
|
905
|
-
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1103
|
+
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]]]:
|
906
1104
|
"""
|
907
|
-
Specifies
|
908
|
-
|
909
|
-
Use `@resources` to specify the resource requirements
|
910
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
911
|
-
|
912
|
-
You can choose the compute layer on the command line by executing e.g.
|
913
|
-
```
|
914
|
-
python myflow.py run --with batch
|
915
|
-
```
|
916
|
-
or
|
917
|
-
```
|
918
|
-
python myflow.py run --with kubernetes
|
919
|
-
```
|
920
|
-
which executes the flow on the desired system using the
|
921
|
-
requirements specified in `@resources`.
|
1105
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1106
|
+
the execution of a step.
|
922
1107
|
|
923
1108
|
|
924
1109
|
Parameters
|
925
1110
|
----------
|
926
|
-
|
927
|
-
|
928
|
-
|
929
|
-
|
930
|
-
disk : int, optional, default None
|
931
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
932
|
-
memory : int, default 4096
|
933
|
-
Memory size (in MB) required for this step.
|
934
|
-
shared_memory : int, optional, default None
|
935
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
936
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1111
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1112
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1113
|
+
role : str, optional, default: None
|
1114
|
+
Role to use for fetching secrets
|
937
1115
|
"""
|
938
1116
|
...
|
939
1117
|
|
940
1118
|
@typing.overload
|
941
|
-
def
|
1119
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
942
1120
|
...
|
943
1121
|
|
944
1122
|
@typing.overload
|
945
|
-
def
|
1123
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
946
1124
|
...
|
947
1125
|
|
948
|
-
def
|
1126
|
+
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):
|
949
1127
|
"""
|
950
|
-
Specifies
|
951
|
-
|
952
|
-
Use `@resources` to specify the resource requirements
|
953
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
954
|
-
|
955
|
-
You can choose the compute layer on the command line by executing e.g.
|
956
|
-
```
|
957
|
-
python myflow.py run --with batch
|
958
|
-
```
|
959
|
-
or
|
960
|
-
```
|
961
|
-
python myflow.py run --with kubernetes
|
962
|
-
```
|
963
|
-
which executes the flow on the desired system using the
|
964
|
-
requirements specified in `@resources`.
|
1128
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
1129
|
+
the execution of a step.
|
965
1130
|
|
966
1131
|
|
967
1132
|
Parameters
|
968
1133
|
----------
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
disk : int, optional, default None
|
974
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
975
|
-
memory : int, default 4096
|
976
|
-
Memory size (in MB) required for this step.
|
977
|
-
shared_memory : int, optional, default None
|
978
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
979
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1134
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
1135
|
+
List of secret specs, defining how the secrets are to be retrieved
|
1136
|
+
role : str, optional, default: None
|
1137
|
+
Role to use for fetching secrets
|
980
1138
|
"""
|
981
1139
|
...
|
982
1140
|
|
983
1141
|
@typing.overload
|
984
|
-
def
|
985
|
-
"""
|
986
|
-
Specifies that the step will success under all circumstances.
|
987
|
-
|
988
|
-
The decorator will create an optional artifact, specified by `var`, which
|
989
|
-
contains the exception raised. You can use it to detect the presence
|
990
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
991
|
-
are missing.
|
992
|
-
|
993
|
-
|
994
|
-
Parameters
|
995
|
-
----------
|
996
|
-
var : str, optional, default None
|
997
|
-
Name of the artifact in which to store the caught exception.
|
998
|
-
If not specified, the exception is not stored.
|
999
|
-
print_exception : bool, default True
|
1000
|
-
Determines whether or not the exception is printed to
|
1001
|
-
stdout when caught.
|
1002
|
-
"""
|
1003
|
-
...
|
1004
|
-
|
1005
|
-
@typing.overload
|
1006
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1007
|
-
...
|
1008
|
-
|
1009
|
-
@typing.overload
|
1010
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1011
|
-
...
|
1012
|
-
|
1013
|
-
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
1014
|
-
"""
|
1015
|
-
Specifies that the step will success under all circumstances.
|
1016
|
-
|
1017
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1018
|
-
contains the exception raised. You can use it to detect the presence
|
1019
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1020
|
-
are missing.
|
1021
|
-
|
1022
|
-
|
1023
|
-
Parameters
|
1024
|
-
----------
|
1025
|
-
var : str, optional, default None
|
1026
|
-
Name of the artifact in which to store the caught exception.
|
1027
|
-
If not specified, the exception is not stored.
|
1028
|
-
print_exception : bool, default True
|
1029
|
-
Determines whether or not the exception is printed to
|
1030
|
-
stdout when caught.
|
1031
|
-
"""
|
1032
|
-
...
|
1033
|
-
|
1034
|
-
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]]]:
|
1035
|
-
"""
|
1036
|
-
Specifies that this step should execute on DGX cloud.
|
1037
|
-
|
1038
|
-
|
1039
|
-
Parameters
|
1040
|
-
----------
|
1041
|
-
gpu : int
|
1042
|
-
Number of GPUs to use.
|
1043
|
-
gpu_type : str
|
1044
|
-
Type of Nvidia GPU to use.
|
1045
|
-
"""
|
1046
|
-
...
|
1047
|
-
|
1048
|
-
@typing.overload
|
1049
|
-
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]]]:
|
1050
|
-
"""
|
1051
|
-
Specifies the PyPI packages for the step.
|
1052
|
-
|
1053
|
-
Information in this decorator will augment any
|
1054
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1055
|
-
you can use `@pypi_base` to set packages required by all
|
1056
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1057
|
-
|
1058
|
-
|
1059
|
-
Parameters
|
1060
|
-
----------
|
1061
|
-
packages : Dict[str, str], default: {}
|
1062
|
-
Packages to use for this step. The key is the name of the package
|
1063
|
-
and the value is the version to use.
|
1064
|
-
python : str, optional, default: None
|
1065
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1066
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1067
|
-
"""
|
1068
|
-
...
|
1069
|
-
|
1070
|
-
@typing.overload
|
1071
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1072
|
-
...
|
1073
|
-
|
1074
|
-
@typing.overload
|
1075
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1076
|
-
...
|
1077
|
-
|
1078
|
-
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):
|
1079
|
-
"""
|
1080
|
-
Specifies the PyPI packages for the step.
|
1081
|
-
|
1082
|
-
Information in this decorator will augment any
|
1083
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
1084
|
-
you can use `@pypi_base` to set packages required by all
|
1085
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1086
|
-
|
1087
|
-
|
1088
|
-
Parameters
|
1089
|
-
----------
|
1090
|
-
packages : Dict[str, str], default: {}
|
1091
|
-
Packages to use for this step. The key is the name of the package
|
1092
|
-
and the value is the version to use.
|
1093
|
-
python : str, optional, default: None
|
1094
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1095
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1096
|
-
"""
|
1097
|
-
...
|
1098
|
-
|
1099
|
-
@typing.overload
|
1100
|
-
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]]]:
|
1101
|
-
"""
|
1102
|
-
Enables checkpointing for a step.
|
1103
|
-
|
1104
|
-
> Examples
|
1105
|
-
|
1106
|
-
- Saving Checkpoints
|
1107
|
-
|
1108
|
-
```python
|
1109
|
-
@checkpoint
|
1110
|
-
@step
|
1111
|
-
def train(self):
|
1112
|
-
model = create_model(self.parameters, checkpoint_path = None)
|
1113
|
-
for i in range(self.epochs):
|
1114
|
-
# some training logic
|
1115
|
-
loss = model.train(self.dataset)
|
1116
|
-
if i % 10 == 0:
|
1117
|
-
model.save(
|
1118
|
-
current.checkpoint.directory,
|
1119
|
-
)
|
1120
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
1121
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
1122
|
-
self.latest_checkpoint = current.checkpoint.save(
|
1123
|
-
name="epoch_checkpoint",
|
1124
|
-
metadata={
|
1125
|
-
"epoch": i,
|
1126
|
-
"loss": loss,
|
1127
|
-
}
|
1128
|
-
)
|
1129
|
-
```
|
1130
|
-
|
1131
|
-
- Using Loaded Checkpoints
|
1132
|
-
|
1133
|
-
```python
|
1134
|
-
@retry(times=3)
|
1135
|
-
@checkpoint
|
1136
|
-
@step
|
1137
|
-
def train(self):
|
1138
|
-
# Assume that the task has restarted and the previous attempt of the task
|
1139
|
-
# saved a checkpoint
|
1140
|
-
checkpoint_path = None
|
1141
|
-
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
1142
|
-
print("Loaded checkpoint from the previous attempt")
|
1143
|
-
checkpoint_path = current.checkpoint.directory
|
1144
|
-
|
1145
|
-
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
1146
|
-
for i in range(self.epochs):
|
1147
|
-
...
|
1148
|
-
```
|
1149
|
-
|
1150
|
-
|
1151
|
-
Parameters
|
1152
|
-
----------
|
1153
|
-
load_policy : str, default: "fresh"
|
1154
|
-
The policy for loading the checkpoint. The following policies are supported:
|
1155
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
1156
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
1157
|
-
will be loaded at the start of the task.
|
1158
|
-
- "none": Do not load any checkpoint
|
1159
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
1160
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
1161
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
1162
|
-
created within the task will be loaded when the task is retries execution on failure.
|
1163
|
-
|
1164
|
-
temp_dir_root : str, default: None
|
1165
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
1166
|
-
"""
|
1167
|
-
...
|
1168
|
-
|
1169
|
-
@typing.overload
|
1170
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1171
|
-
...
|
1172
|
-
|
1173
|
-
@typing.overload
|
1174
|
-
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1175
|
-
...
|
1176
|
-
|
1177
|
-
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):
|
1178
|
-
"""
|
1179
|
-
Enables checkpointing for a step.
|
1180
|
-
|
1181
|
-
> Examples
|
1182
|
-
|
1183
|
-
- Saving Checkpoints
|
1184
|
-
|
1185
|
-
```python
|
1186
|
-
@checkpoint
|
1187
|
-
@step
|
1188
|
-
def train(self):
|
1189
|
-
model = create_model(self.parameters, checkpoint_path = None)
|
1190
|
-
for i in range(self.epochs):
|
1191
|
-
# some training logic
|
1192
|
-
loss = model.train(self.dataset)
|
1193
|
-
if i % 10 == 0:
|
1194
|
-
model.save(
|
1195
|
-
current.checkpoint.directory,
|
1196
|
-
)
|
1197
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
1198
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
1199
|
-
self.latest_checkpoint = current.checkpoint.save(
|
1200
|
-
name="epoch_checkpoint",
|
1201
|
-
metadata={
|
1202
|
-
"epoch": i,
|
1203
|
-
"loss": loss,
|
1204
|
-
}
|
1205
|
-
)
|
1206
|
-
```
|
1207
|
-
|
1208
|
-
- Using Loaded Checkpoints
|
1209
|
-
|
1210
|
-
```python
|
1211
|
-
@retry(times=3)
|
1212
|
-
@checkpoint
|
1213
|
-
@step
|
1214
|
-
def train(self):
|
1215
|
-
# Assume that the task has restarted and the previous attempt of the task
|
1216
|
-
# saved a checkpoint
|
1217
|
-
checkpoint_path = None
|
1218
|
-
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
1219
|
-
print("Loaded checkpoint from the previous attempt")
|
1220
|
-
checkpoint_path = current.checkpoint.directory
|
1221
|
-
|
1222
|
-
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
1223
|
-
for i in range(self.epochs):
|
1224
|
-
...
|
1225
|
-
```
|
1226
|
-
|
1227
|
-
|
1228
|
-
Parameters
|
1229
|
-
----------
|
1230
|
-
load_policy : str, default: "fresh"
|
1231
|
-
The policy for loading the checkpoint. The following policies are supported:
|
1232
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
1233
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
1234
|
-
will be loaded at the start of the task.
|
1235
|
-
- "none": Do not load any checkpoint
|
1236
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
1237
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
1238
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
1239
|
-
created within the task will be loaded when the task is retries execution on failure.
|
1240
|
-
|
1241
|
-
temp_dir_root : str, default: None
|
1242
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
1243
|
-
"""
|
1244
|
-
...
|
1245
|
-
|
1246
|
-
@typing.overload
|
1247
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1248
|
-
"""
|
1249
|
-
Internal decorator to support Fast bakery
|
1250
|
-
"""
|
1251
|
-
...
|
1252
|
-
|
1253
|
-
@typing.overload
|
1254
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1255
|
-
...
|
1256
|
-
|
1257
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1258
|
-
"""
|
1259
|
-
Internal decorator to support Fast bakery
|
1260
|
-
"""
|
1261
|
-
...
|
1262
|
-
|
1263
|
-
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]]:
|
1264
|
-
"""
|
1265
|
-
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)
|
1266
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1267
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1268
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1269
|
-
starts only after all sensors finish.
|
1270
|
-
|
1271
|
-
|
1272
|
-
Parameters
|
1273
|
-
----------
|
1274
|
-
timeout : int
|
1275
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1276
|
-
poke_interval : int
|
1277
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1278
|
-
mode : str
|
1279
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1280
|
-
exponential_backoff : bool
|
1281
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1282
|
-
pool : str
|
1283
|
-
the slot pool this task should run in,
|
1284
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1285
|
-
soft_fail : bool
|
1286
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1287
|
-
name : str
|
1288
|
-
Name of the sensor on Airflow
|
1289
|
-
description : str
|
1290
|
-
Description of sensor in the Airflow UI
|
1291
|
-
bucket_key : Union[str, List[str]]
|
1292
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1293
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1294
|
-
bucket_name : str
|
1295
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1296
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1297
|
-
wildcard_match : bool
|
1298
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1299
|
-
aws_conn_id : str
|
1300
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1301
|
-
verify : bool
|
1302
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1303
|
-
"""
|
1304
|
-
...
|
1305
|
-
|
1306
|
-
@typing.overload
|
1307
|
-
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]]:
|
1142
|
+
def resources(*, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1308
1143
|
"""
|
1309
|
-
Specifies the
|
1144
|
+
Specifies the resources needed when executing this step.
|
1310
1145
|
|
1311
|
-
|
1312
|
-
|
1313
|
-
```
|
1314
|
-
or
|
1315
|
-
```
|
1316
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1317
|
-
```
|
1318
|
-
This decorator respects the @project decorator and triggers the flow
|
1319
|
-
when upstream runs within the same namespace complete successfully
|
1146
|
+
Use `@resources` to specify the resource requirements
|
1147
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1320
1148
|
|
1321
|
-
|
1322
|
-
by specifying the fully qualified project_flow_name.
|
1149
|
+
You can choose the compute layer on the command line by executing e.g.
|
1323
1150
|
```
|
1324
|
-
|
1151
|
+
python myflow.py run --with batch
|
1325
1152
|
```
|
1326
1153
|
or
|
1327
1154
|
```
|
1328
|
-
|
1329
|
-
```
|
1330
|
-
|
1331
|
-
You can also specify just the project or project branch (other values will be
|
1332
|
-
inferred from the current project or project branch):
|
1333
|
-
```
|
1334
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1155
|
+
python myflow.py run --with kubernetes
|
1335
1156
|
```
|
1336
|
-
|
1337
|
-
|
1338
|
-
- `prod`
|
1339
|
-
- `user.bob`
|
1340
|
-
- `test.my_experiment`
|
1341
|
-
- `prod.staging`
|
1157
|
+
which executes the flow on the desired system using the
|
1158
|
+
requirements specified in `@resources`.
|
1342
1159
|
|
1343
1160
|
|
1344
1161
|
Parameters
|
1345
1162
|
----------
|
1346
|
-
|
1347
|
-
|
1348
|
-
|
1349
|
-
|
1350
|
-
|
1351
|
-
|
1163
|
+
cpu : int, default 1
|
1164
|
+
Number of CPUs required for this step.
|
1165
|
+
gpu : int, optional, default None
|
1166
|
+
Number of GPUs required for this step.
|
1167
|
+
disk : int, optional, default None
|
1168
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1169
|
+
memory : int, default 4096
|
1170
|
+
Memory size (in MB) required for this step.
|
1171
|
+
shared_memory : int, optional, default None
|
1172
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1173
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1352
1174
|
"""
|
1353
1175
|
...
|
1354
1176
|
|
1355
1177
|
@typing.overload
|
1356
|
-
def
|
1178
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1357
1179
|
...
|
1358
1180
|
|
1359
|
-
|
1181
|
+
@typing.overload
|
1182
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1183
|
+
...
|
1184
|
+
|
1185
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
1360
1186
|
"""
|
1361
|
-
Specifies the
|
1187
|
+
Specifies the resources needed when executing this step.
|
1362
1188
|
|
1363
|
-
|
1364
|
-
|
1365
|
-
```
|
1366
|
-
or
|
1367
|
-
```
|
1368
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1369
|
-
```
|
1370
|
-
This decorator respects the @project decorator and triggers the flow
|
1371
|
-
when upstream runs within the same namespace complete successfully
|
1189
|
+
Use `@resources` to specify the resource requirements
|
1190
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1372
1191
|
|
1373
|
-
|
1374
|
-
by specifying the fully qualified project_flow_name.
|
1192
|
+
You can choose the compute layer on the command line by executing e.g.
|
1375
1193
|
```
|
1376
|
-
|
1194
|
+
python myflow.py run --with batch
|
1377
1195
|
```
|
1378
1196
|
or
|
1379
1197
|
```
|
1380
|
-
|
1198
|
+
python myflow.py run --with kubernetes
|
1381
1199
|
```
|
1200
|
+
which executes the flow on the desired system using the
|
1201
|
+
requirements specified in `@resources`.
|
1382
1202
|
|
1383
|
-
You can also specify just the project or project branch (other values will be
|
1384
|
-
inferred from the current project or project branch):
|
1385
|
-
```
|
1386
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1387
|
-
```
|
1388
1203
|
|
1389
|
-
|
1390
|
-
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1204
|
+
Parameters
|
1205
|
+
----------
|
1206
|
+
cpu : int, default 1
|
1207
|
+
Number of CPUs required for this step.
|
1208
|
+
gpu : int, optional, default None
|
1209
|
+
Number of GPUs required for this step.
|
1210
|
+
disk : int, optional, default None
|
1211
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1212
|
+
memory : int, default 4096
|
1213
|
+
Memory size (in MB) required for this step.
|
1214
|
+
shared_memory : int, optional, default None
|
1215
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1216
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1217
|
+
"""
|
1218
|
+
...
|
1219
|
+
|
1220
|
+
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]]]:
|
1221
|
+
"""
|
1222
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
1223
|
+
|
1224
|
+
User code call
|
1225
|
+
--------------
|
1226
|
+
@ollama(
|
1227
|
+
models=[...],
|
1228
|
+
...
|
1229
|
+
)
|
1230
|
+
|
1231
|
+
Valid backend options
|
1232
|
+
---------------------
|
1233
|
+
- 'local': Run as a separate process on the local task machine.
|
1234
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
1235
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
1236
|
+
|
1237
|
+
Valid model options
|
1238
|
+
-------------------
|
1239
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
1394
1240
|
|
1395
1241
|
|
1396
1242
|
Parameters
|
1397
1243
|
----------
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
1403
|
-
|
1244
|
+
models: list[str]
|
1245
|
+
List of Ollama containers running models in sidecars.
|
1246
|
+
backend: str
|
1247
|
+
Determines where and how to run the Ollama process.
|
1248
|
+
force_pull: bool
|
1249
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
1250
|
+
cache_update_policy: str
|
1251
|
+
Cache update policy: "auto", "force", or "never".
|
1252
|
+
force_cache_update: bool
|
1253
|
+
Simple override for "force" cache update policy.
|
1254
|
+
debug: bool
|
1255
|
+
Whether to turn on verbose debugging logs.
|
1256
|
+
circuit_breaker_config: dict
|
1257
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
1258
|
+
timeout_config: dict
|
1259
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
1404
1260
|
"""
|
1405
1261
|
...
|
1406
1262
|
|
@@ -1554,18 +1410,145 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1554
1410
|
Parameters:
|
1555
1411
|
----------
|
1556
1412
|
|
1557
|
-
type: str
|
1558
|
-
The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
|
1413
|
+
type: str
|
1414
|
+
The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
|
1415
|
+
|
1416
|
+
config: dict or Callable
|
1417
|
+
Dictionary of configuration options for the datastore. The following keys are required:
|
1418
|
+
- root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
|
1419
|
+
- example: 's3://bucket-name/path/to/root'
|
1420
|
+
- example: 'gs://bucket-name/path/to/root'
|
1421
|
+
- example: 'https://myblockacc.blob.core.windows.net/metaflow/'
|
1422
|
+
- role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
|
1423
|
+
- session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
|
1424
|
+
- client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
|
1425
|
+
"""
|
1426
|
+
...
|
1427
|
+
|
1428
|
+
@typing.overload
|
1429
|
+
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]]:
|
1430
|
+
"""
|
1431
|
+
Specifies the times when the flow should be run when running on a
|
1432
|
+
production scheduler.
|
1433
|
+
|
1434
|
+
|
1435
|
+
Parameters
|
1436
|
+
----------
|
1437
|
+
hourly : bool, default False
|
1438
|
+
Run the workflow hourly.
|
1439
|
+
daily : bool, default True
|
1440
|
+
Run the workflow daily.
|
1441
|
+
weekly : bool, default False
|
1442
|
+
Run the workflow weekly.
|
1443
|
+
cron : str, optional, default None
|
1444
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1445
|
+
specified by this expression.
|
1446
|
+
timezone : str, optional, default None
|
1447
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1448
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1449
|
+
"""
|
1450
|
+
...
|
1451
|
+
|
1452
|
+
@typing.overload
|
1453
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1454
|
+
...
|
1455
|
+
|
1456
|
+
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):
|
1457
|
+
"""
|
1458
|
+
Specifies the times when the flow should be run when running on a
|
1459
|
+
production scheduler.
|
1460
|
+
|
1461
|
+
|
1462
|
+
Parameters
|
1463
|
+
----------
|
1464
|
+
hourly : bool, default False
|
1465
|
+
Run the workflow hourly.
|
1466
|
+
daily : bool, default True
|
1467
|
+
Run the workflow daily.
|
1468
|
+
weekly : bool, default False
|
1469
|
+
Run the workflow weekly.
|
1470
|
+
cron : str, optional, default None
|
1471
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1472
|
+
specified by this expression.
|
1473
|
+
timezone : str, optional, default None
|
1474
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1475
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1476
|
+
"""
|
1477
|
+
...
|
1478
|
+
|
1479
|
+
@typing.overload
|
1480
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1481
|
+
"""
|
1482
|
+
Specifies the PyPI packages for all steps of the flow.
|
1483
|
+
|
1484
|
+
Use `@pypi_base` to set common packages required by all
|
1485
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1486
|
+
|
1487
|
+
Parameters
|
1488
|
+
----------
|
1489
|
+
packages : Dict[str, str], default: {}
|
1490
|
+
Packages to use for this flow. The key is the name of the package
|
1491
|
+
and the value is the version to use.
|
1492
|
+
python : str, optional, default: None
|
1493
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1494
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1495
|
+
"""
|
1496
|
+
...
|
1497
|
+
|
1498
|
+
@typing.overload
|
1499
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1500
|
+
...
|
1501
|
+
|
1502
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1503
|
+
"""
|
1504
|
+
Specifies the PyPI packages for all steps of the flow.
|
1505
|
+
|
1506
|
+
Use `@pypi_base` to set common packages required by all
|
1507
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1508
|
+
|
1509
|
+
Parameters
|
1510
|
+
----------
|
1511
|
+
packages : Dict[str, str], default: {}
|
1512
|
+
Packages to use for this flow. The key is the name of the package
|
1513
|
+
and the value is the version to use.
|
1514
|
+
python : str, optional, default: None
|
1515
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1516
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1517
|
+
"""
|
1518
|
+
...
|
1519
|
+
|
1520
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1521
|
+
"""
|
1522
|
+
Specifies what flows belong to the same project.
|
1523
|
+
|
1524
|
+
A project-specific namespace is created for all flows that
|
1525
|
+
use the same `@project(name)`.
|
1526
|
+
|
1527
|
+
|
1528
|
+
Parameters
|
1529
|
+
----------
|
1530
|
+
name : str
|
1531
|
+
Project name. Make sure that the name is unique amongst all
|
1532
|
+
projects that use the same production scheduler. The name may
|
1533
|
+
contain only lowercase alphanumeric characters and underscores.
|
1534
|
+
|
1535
|
+
branch : Optional[str], default None
|
1536
|
+
The branch to use. If not specified, the branch is set to
|
1537
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1538
|
+
also be set on the command line using `--branch` as a top-level option.
|
1539
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1559
1540
|
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
1566
|
-
|
1567
|
-
|
1568
|
-
|
1541
|
+
production : bool, default False
|
1542
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1543
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1544
|
+
`production` in the decorator and on the command line.
|
1545
|
+
The project branch name will be:
|
1546
|
+
- if `branch` is specified:
|
1547
|
+
- if `production` is True: `prod.<branch>`
|
1548
|
+
- if `production` is False: `test.<branch>`
|
1549
|
+
- if `branch` is not specified:
|
1550
|
+
- if `production` is True: `prod`
|
1551
|
+
- if `production` is False: `user.<username>`
|
1569
1552
|
"""
|
1570
1553
|
...
|
1571
1554
|
|
@@ -1663,53 +1646,103 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1663
1646
|
...
|
1664
1647
|
|
1665
1648
|
@typing.overload
|
1666
|
-
def
|
1649
|
+
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]]:
|
1667
1650
|
"""
|
1668
|
-
Specifies the
|
1669
|
-
|
1651
|
+
Specifies the flow(s) that this flow depends on.
|
1652
|
+
|
1653
|
+
```
|
1654
|
+
@trigger_on_finish(flow='FooFlow')
|
1655
|
+
```
|
1656
|
+
or
|
1657
|
+
```
|
1658
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1659
|
+
```
|
1660
|
+
This decorator respects the @project decorator and triggers the flow
|
1661
|
+
when upstream runs within the same namespace complete successfully
|
1662
|
+
|
1663
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1664
|
+
by specifying the fully qualified project_flow_name.
|
1665
|
+
```
|
1666
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1667
|
+
```
|
1668
|
+
or
|
1669
|
+
```
|
1670
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1671
|
+
```
|
1672
|
+
|
1673
|
+
You can also specify just the project or project branch (other values will be
|
1674
|
+
inferred from the current project or project branch):
|
1675
|
+
```
|
1676
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1677
|
+
```
|
1678
|
+
|
1679
|
+
Note that `branch` is typically one of:
|
1680
|
+
- `prod`
|
1681
|
+
- `user.bob`
|
1682
|
+
- `test.my_experiment`
|
1683
|
+
- `prod.staging`
|
1670
1684
|
|
1671
1685
|
|
1672
1686
|
Parameters
|
1673
1687
|
----------
|
1674
|
-
|
1675
|
-
|
1676
|
-
|
1677
|
-
|
1678
|
-
|
1679
|
-
|
1680
|
-
cron : str, optional, default None
|
1681
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1682
|
-
specified by this expression.
|
1683
|
-
timezone : str, optional, default None
|
1684
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1685
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1688
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1689
|
+
Upstream flow dependency for this flow.
|
1690
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1691
|
+
Upstream flow dependencies for this flow.
|
1692
|
+
options : Dict[str, Any], default {}
|
1693
|
+
Backend-specific configuration for tuning eventing behavior.
|
1686
1694
|
"""
|
1687
1695
|
...
|
1688
1696
|
|
1689
1697
|
@typing.overload
|
1690
|
-
def
|
1698
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1691
1699
|
...
|
1692
1700
|
|
1693
|
-
def
|
1701
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1694
1702
|
"""
|
1695
|
-
Specifies the
|
1696
|
-
|
1703
|
+
Specifies the flow(s) that this flow depends on.
|
1704
|
+
|
1705
|
+
```
|
1706
|
+
@trigger_on_finish(flow='FooFlow')
|
1707
|
+
```
|
1708
|
+
or
|
1709
|
+
```
|
1710
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
1711
|
+
```
|
1712
|
+
This decorator respects the @project decorator and triggers the flow
|
1713
|
+
when upstream runs within the same namespace complete successfully
|
1714
|
+
|
1715
|
+
Additionally, you can specify project aware upstream flow dependencies
|
1716
|
+
by specifying the fully qualified project_flow_name.
|
1717
|
+
```
|
1718
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
1719
|
+
```
|
1720
|
+
or
|
1721
|
+
```
|
1722
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
1723
|
+
```
|
1724
|
+
|
1725
|
+
You can also specify just the project or project branch (other values will be
|
1726
|
+
inferred from the current project or project branch):
|
1727
|
+
```
|
1728
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
1729
|
+
```
|
1730
|
+
|
1731
|
+
Note that `branch` is typically one of:
|
1732
|
+
- `prod`
|
1733
|
+
- `user.bob`
|
1734
|
+
- `test.my_experiment`
|
1735
|
+
- `prod.staging`
|
1697
1736
|
|
1698
1737
|
|
1699
1738
|
Parameters
|
1700
1739
|
----------
|
1701
|
-
|
1702
|
-
|
1703
|
-
|
1704
|
-
|
1705
|
-
|
1706
|
-
|
1707
|
-
cron : str, optional, default None
|
1708
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1709
|
-
specified by this expression.
|
1710
|
-
timezone : str, optional, default None
|
1711
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1712
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1740
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
1741
|
+
Upstream flow dependency for this flow.
|
1742
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
1743
|
+
Upstream flow dependencies for this flow.
|
1744
|
+
options : Dict[str, Any], default {}
|
1745
|
+
Backend-specific configuration for tuning eventing behavior.
|
1713
1746
|
"""
|
1714
1747
|
...
|
1715
1748
|
|
@@ -1756,79 +1789,46 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
1756
1789
|
"""
|
1757
1790
|
...
|
1758
1791
|
|
1759
|
-
def
|
1792
|
+
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]]:
|
1760
1793
|
"""
|
1761
|
-
|
1762
|
-
|
1763
|
-
|
1764
|
-
|
1794
|
+
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)
|
1795
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1796
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1797
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1798
|
+
starts only after all sensors finish.
|
1765
1799
|
|
1766
1800
|
|
1767
1801
|
Parameters
|
1768
1802
|
----------
|
1803
|
+
timeout : int
|
1804
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1805
|
+
poke_interval : int
|
1806
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1807
|
+
mode : str
|
1808
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1809
|
+
exponential_backoff : bool
|
1810
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1811
|
+
pool : str
|
1812
|
+
the slot pool this task should run in,
|
1813
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1814
|
+
soft_fail : bool
|
1815
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1769
1816
|
name : str
|
1770
|
-
|
1771
|
-
|
1772
|
-
|
1773
|
-
|
1774
|
-
|
1775
|
-
|
1776
|
-
|
1777
|
-
|
1778
|
-
|
1779
|
-
|
1780
|
-
|
1781
|
-
|
1782
|
-
|
1783
|
-
|
1784
|
-
|
1785
|
-
- if `branch` is specified:
|
1786
|
-
- if `production` is True: `prod.<branch>`
|
1787
|
-
- if `production` is False: `test.<branch>`
|
1788
|
-
- if `branch` is not specified:
|
1789
|
-
- if `production` is True: `prod`
|
1790
|
-
- if `production` is False: `user.<username>`
|
1791
|
-
"""
|
1792
|
-
...
|
1793
|
-
|
1794
|
-
@typing.overload
|
1795
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1796
|
-
"""
|
1797
|
-
Specifies the PyPI packages for all steps of the flow.
|
1798
|
-
|
1799
|
-
Use `@pypi_base` to set common packages required by all
|
1800
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1801
|
-
|
1802
|
-
Parameters
|
1803
|
-
----------
|
1804
|
-
packages : Dict[str, str], default: {}
|
1805
|
-
Packages to use for this flow. The key is the name of the package
|
1806
|
-
and the value is the version to use.
|
1807
|
-
python : str, optional, default: None
|
1808
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1809
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1810
|
-
"""
|
1811
|
-
...
|
1812
|
-
|
1813
|
-
@typing.overload
|
1814
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1815
|
-
...
|
1816
|
-
|
1817
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1818
|
-
"""
|
1819
|
-
Specifies the PyPI packages for all steps of the flow.
|
1820
|
-
|
1821
|
-
Use `@pypi_base` to set common packages required by all
|
1822
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1823
|
-
|
1824
|
-
Parameters
|
1825
|
-
----------
|
1826
|
-
packages : Dict[str, str], default: {}
|
1827
|
-
Packages to use for this flow. The key is the name of the package
|
1828
|
-
and the value is the version to use.
|
1829
|
-
python : str, optional, default: None
|
1830
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1831
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1817
|
+
Name of the sensor on Airflow
|
1818
|
+
description : str
|
1819
|
+
Description of sensor in the Airflow UI
|
1820
|
+
bucket_key : Union[str, List[str]]
|
1821
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1822
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1823
|
+
bucket_name : str
|
1824
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1825
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1826
|
+
wildcard_match : bool
|
1827
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1828
|
+
aws_conn_id : str
|
1829
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1830
|
+
verify : bool
|
1831
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1832
1832
|
"""
|
1833
1833
|
...
|
1834
1834
|
|