ob-metaflow-stubs 6.0.6.1__py2.py3-none-any.whl → 6.0.7.0__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 +894 -894
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +3 -3
- 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 +56 -56
- 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 +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
- 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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +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 +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/spinners.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_cli.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_config.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/capsule.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/click_importer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/code_packager.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/config_utils.pyi +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 +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/deployer.pyi +5 -5
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/experimental/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/perimeters.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/utils.pyi +5 -5
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +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/mf_extensions/outerbounds/toplevel/s3_proxy.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/ob_internal.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +6 -6
- metaflow-stubs/packaging_sys/backend.pyi +4 -4
- metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
- metaflow-stubs/packaging_sys/tar_backend.pyi +5 -5
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +3 -3
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +9 -9
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +2 -2
- 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 +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +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 +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +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 +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +3 -3
- 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 +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +6 -6
- metaflow-stubs/runner/deployer_impl.pyi +11 -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 +4 -4
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- 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 +2 -2
- metaflow-stubs/user_decorators/user_step_decorator.pyi +4 -4
- {ob_metaflow_stubs-6.0.6.1.dist-info → ob_metaflow_stubs-6.0.7.0.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.7.0.dist-info/RECORD +261 -0
- ob_metaflow_stubs-6.0.6.1.dist-info/RECORD +0 -261
- {ob_metaflow_stubs-6.0.6.1.dist-info → ob_metaflow_stubs-6.0.7.0.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.6.1.dist-info → ob_metaflow_stubs-6.0.7.0.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.17.0
|
4
|
-
# Generated on 2025-08-
|
3
|
+
# MF version: 2.17.1.0+obcheckpoint(0.2.4);ob(v1) #
|
4
|
+
# Generated on 2025-08-18T05:26:58.140419 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import typing
|
12
11
|
import datetime
|
12
|
+
import typing
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -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 requirements_txt_parser as requirements_txt_parser
|
52
51
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
52
|
+
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
53
53
|
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
54
54
|
from . import client as client
|
55
55
|
from .client.core import namespace as namespace
|
@@ -296,6 +296,146 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
296
296
|
"""
|
297
297
|
...
|
298
298
|
|
299
|
+
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]]]:
|
300
|
+
"""
|
301
|
+
Specifies that this step should execute on DGX cloud.
|
302
|
+
|
303
|
+
|
304
|
+
Parameters
|
305
|
+
----------
|
306
|
+
gpu : int
|
307
|
+
Number of GPUs to use.
|
308
|
+
gpu_type : str
|
309
|
+
Type of Nvidia GPU to use.
|
310
|
+
queue_timeout : int
|
311
|
+
Time to keep the job in NVCF's queue.
|
312
|
+
"""
|
313
|
+
...
|
314
|
+
|
315
|
+
@typing.overload
|
316
|
+
def retry(*, times: int = 3, minutes_between_retries: int = 2) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
317
|
+
"""
|
318
|
+
Specifies the number of times the task corresponding
|
319
|
+
to a step needs to be retried.
|
320
|
+
|
321
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
322
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
323
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
324
|
+
|
325
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
326
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
327
|
+
ensuring that the flow execution can continue.
|
328
|
+
|
329
|
+
|
330
|
+
Parameters
|
331
|
+
----------
|
332
|
+
times : int, default 3
|
333
|
+
Number of times to retry this task.
|
334
|
+
minutes_between_retries : int, default 2
|
335
|
+
Number of minutes between retries.
|
336
|
+
"""
|
337
|
+
...
|
338
|
+
|
339
|
+
@typing.overload
|
340
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
341
|
+
...
|
342
|
+
|
343
|
+
@typing.overload
|
344
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
345
|
+
...
|
346
|
+
|
347
|
+
def retry(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, times: int = 3, minutes_between_retries: int = 2):
|
348
|
+
"""
|
349
|
+
Specifies the number of times the task corresponding
|
350
|
+
to a step needs to be retried.
|
351
|
+
|
352
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
353
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
354
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
355
|
+
|
356
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
357
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
358
|
+
ensuring that the flow execution can continue.
|
359
|
+
|
360
|
+
|
361
|
+
Parameters
|
362
|
+
----------
|
363
|
+
times : int, default 3
|
364
|
+
Number of times to retry this task.
|
365
|
+
minutes_between_retries : int, default 2
|
366
|
+
Number of minutes between retries.
|
367
|
+
"""
|
368
|
+
...
|
369
|
+
|
370
|
+
@typing.overload
|
371
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
372
|
+
"""
|
373
|
+
Decorator prototype for all step decorators. This function gets specialized
|
374
|
+
and imported for all decorators types by _import_plugin_decorators().
|
375
|
+
"""
|
376
|
+
...
|
377
|
+
|
378
|
+
@typing.overload
|
379
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
380
|
+
...
|
381
|
+
|
382
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
383
|
+
"""
|
384
|
+
Decorator prototype for all step decorators. This function gets specialized
|
385
|
+
and imported for all decorators types by _import_plugin_decorators().
|
386
|
+
"""
|
387
|
+
...
|
388
|
+
|
389
|
+
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]]]:
|
390
|
+
"""
|
391
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
392
|
+
|
393
|
+
User code call
|
394
|
+
--------------
|
395
|
+
@vllm(
|
396
|
+
model="...",
|
397
|
+
...
|
398
|
+
)
|
399
|
+
|
400
|
+
Valid backend options
|
401
|
+
---------------------
|
402
|
+
- 'local': Run as a separate process on the local task machine.
|
403
|
+
|
404
|
+
Valid model options
|
405
|
+
-------------------
|
406
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
407
|
+
|
408
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
409
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
410
|
+
|
411
|
+
|
412
|
+
Parameters
|
413
|
+
----------
|
414
|
+
model: str
|
415
|
+
HuggingFace model identifier to be served by vLLM.
|
416
|
+
backend: str
|
417
|
+
Determines where and how to run the vLLM process.
|
418
|
+
openai_api_server: bool
|
419
|
+
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
420
|
+
Default is False (uses native engine).
|
421
|
+
Set to True for backward compatibility with existing code.
|
422
|
+
debug: bool
|
423
|
+
Whether to turn on verbose debugging logs.
|
424
|
+
card_refresh_interval: int
|
425
|
+
Interval in seconds for refreshing the vLLM status card.
|
426
|
+
Only used when openai_api_server=True.
|
427
|
+
max_retries: int
|
428
|
+
Maximum number of retries checking for vLLM server startup.
|
429
|
+
Only used when openai_api_server=True.
|
430
|
+
retry_alert_frequency: int
|
431
|
+
Frequency of alert logs for vLLM server startup retries.
|
432
|
+
Only used when openai_api_server=True.
|
433
|
+
engine_args : dict
|
434
|
+
Additional keyword arguments to pass to the vLLM engine.
|
435
|
+
For example, `tensor_parallel_size=2`.
|
436
|
+
"""
|
437
|
+
...
|
438
|
+
|
299
439
|
@typing.overload
|
300
440
|
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]]]:
|
301
441
|
"""
|
@@ -355,50 +495,52 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
355
495
|
"""
|
356
496
|
...
|
357
497
|
|
358
|
-
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]]]:
|
359
|
-
"""
|
360
|
-
Specifies that this step should execute on DGX cloud.
|
361
|
-
|
362
|
-
|
363
|
-
Parameters
|
364
|
-
----------
|
365
|
-
gpu : int
|
366
|
-
Number of GPUs to use.
|
367
|
-
gpu_type : str
|
368
|
-
Type of Nvidia GPU to use.
|
369
|
-
"""
|
370
|
-
...
|
371
|
-
|
372
498
|
@typing.overload
|
373
|
-
def
|
499
|
+
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]]]:
|
374
500
|
"""
|
375
|
-
|
501
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
502
|
+
|
503
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
376
504
|
|
377
505
|
|
378
506
|
Parameters
|
379
507
|
----------
|
380
|
-
|
381
|
-
|
508
|
+
type : str, default 'default'
|
509
|
+
Card type.
|
510
|
+
id : str, optional, default None
|
511
|
+
If multiple cards are present, use this id to identify this card.
|
512
|
+
options : Dict[str, Any], default {}
|
513
|
+
Options passed to the card. The contents depend on the card type.
|
514
|
+
timeout : int, default 45
|
515
|
+
Interrupt reporting if it takes more than this many seconds.
|
382
516
|
"""
|
383
517
|
...
|
384
518
|
|
385
519
|
@typing.overload
|
386
|
-
def
|
520
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
387
521
|
...
|
388
522
|
|
389
523
|
@typing.overload
|
390
|
-
def
|
524
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
391
525
|
...
|
392
526
|
|
393
|
-
def
|
527
|
+
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):
|
394
528
|
"""
|
395
|
-
|
529
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
530
|
+
|
531
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
396
532
|
|
397
533
|
|
398
534
|
Parameters
|
399
535
|
----------
|
400
|
-
|
401
|
-
|
536
|
+
type : str, default 'default'
|
537
|
+
Card type.
|
538
|
+
id : str, optional, default None
|
539
|
+
If multiple cards are present, use this id to identify this card.
|
540
|
+
options : Dict[str, Any], default {}
|
541
|
+
Options passed to the card. The contents depend on the card type.
|
542
|
+
timeout : int, default 45
|
543
|
+
Interrupt reporting if it takes more than this many seconds.
|
402
544
|
"""
|
403
545
|
...
|
404
546
|
|
@@ -453,190 +595,135 @@ def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typ
|
|
453
595
|
"""
|
454
596
|
...
|
455
597
|
|
456
|
-
|
457
|
-
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]]]:
|
598
|
+
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]]]:
|
458
599
|
"""
|
459
|
-
|
460
|
-
|
461
|
-
> Examples
|
462
|
-
|
463
|
-
- Saving Checkpoints
|
464
|
-
|
465
|
-
```python
|
466
|
-
@checkpoint
|
467
|
-
@step
|
468
|
-
def train(self):
|
469
|
-
model = create_model(self.parameters, checkpoint_path = None)
|
470
|
-
for i in range(self.epochs):
|
471
|
-
# some training logic
|
472
|
-
loss = model.train(self.dataset)
|
473
|
-
if i % 10 == 0:
|
474
|
-
model.save(
|
475
|
-
current.checkpoint.directory,
|
476
|
-
)
|
477
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
478
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
479
|
-
self.latest_checkpoint = current.checkpoint.save(
|
480
|
-
name="epoch_checkpoint",
|
481
|
-
metadata={
|
482
|
-
"epoch": i,
|
483
|
-
"loss": loss,
|
484
|
-
}
|
485
|
-
)
|
486
|
-
```
|
600
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
487
601
|
|
488
|
-
|
602
|
+
User code call
|
603
|
+
--------------
|
604
|
+
@ollama(
|
605
|
+
models=[...],
|
606
|
+
...
|
607
|
+
)
|
489
608
|
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
# Assume that the task has restarted and the previous attempt of the task
|
496
|
-
# saved a checkpoint
|
497
|
-
checkpoint_path = None
|
498
|
-
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
499
|
-
print("Loaded checkpoint from the previous attempt")
|
500
|
-
checkpoint_path = current.checkpoint.directory
|
609
|
+
Valid backend options
|
610
|
+
---------------------
|
611
|
+
- 'local': Run as a separate process on the local task machine.
|
612
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
613
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
501
614
|
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
```
|
615
|
+
Valid model options
|
616
|
+
-------------------
|
617
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
506
618
|
|
507
619
|
|
508
620
|
Parameters
|
509
621
|
----------
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
622
|
+
models: list[str]
|
623
|
+
List of Ollama containers running models in sidecars.
|
624
|
+
backend: str
|
625
|
+
Determines where and how to run the Ollama process.
|
626
|
+
force_pull: bool
|
627
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
628
|
+
cache_update_policy: str
|
629
|
+
Cache update policy: "auto", "force", or "never".
|
630
|
+
force_cache_update: bool
|
631
|
+
Simple override for "force" cache update policy.
|
632
|
+
debug: bool
|
633
|
+
Whether to turn on verbose debugging logs.
|
634
|
+
circuit_breaker_config: dict
|
635
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
636
|
+
timeout_config: dict
|
637
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
638
|
+
"""
|
639
|
+
...
|
640
|
+
|
641
|
+
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]]]:
|
642
|
+
"""
|
643
|
+
Specifies that this step should execute on DGX cloud.
|
520
644
|
|
521
|
-
|
522
|
-
|
645
|
+
|
646
|
+
Parameters
|
647
|
+
----------
|
648
|
+
gpu : int
|
649
|
+
Number of GPUs to use.
|
650
|
+
gpu_type : str
|
651
|
+
Type of Nvidia GPU to use.
|
523
652
|
"""
|
524
653
|
...
|
525
654
|
|
526
655
|
@typing.overload
|
527
|
-
def
|
656
|
+
def nebius_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
657
|
+
"""
|
658
|
+
Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
659
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
660
|
+
a Neo Cloud like Nebius.
|
661
|
+
"""
|
528
662
|
...
|
529
663
|
|
530
664
|
@typing.overload
|
531
|
-
def
|
665
|
+
def nebius_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
532
666
|
...
|
533
667
|
|
534
|
-
def
|
668
|
+
def nebius_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
535
669
|
"""
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
- Saving Checkpoints
|
541
|
-
|
542
|
-
```python
|
543
|
-
@checkpoint
|
544
|
-
@step
|
545
|
-
def train(self):
|
546
|
-
model = create_model(self.parameters, checkpoint_path = None)
|
547
|
-
for i in range(self.epochs):
|
548
|
-
# some training logic
|
549
|
-
loss = model.train(self.dataset)
|
550
|
-
if i % 10 == 0:
|
551
|
-
model.save(
|
552
|
-
current.checkpoint.directory,
|
553
|
-
)
|
554
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
555
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
556
|
-
self.latest_checkpoint = current.checkpoint.save(
|
557
|
-
name="epoch_checkpoint",
|
558
|
-
metadata={
|
559
|
-
"epoch": i,
|
560
|
-
"loss": loss,
|
561
|
-
}
|
562
|
-
)
|
563
|
-
```
|
564
|
-
|
565
|
-
- Using Loaded Checkpoints
|
566
|
-
|
567
|
-
```python
|
568
|
-
@retry(times=3)
|
569
|
-
@checkpoint
|
570
|
-
@step
|
571
|
-
def train(self):
|
572
|
-
# Assume that the task has restarted and the previous attempt of the task
|
573
|
-
# saved a checkpoint
|
574
|
-
checkpoint_path = None
|
575
|
-
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
576
|
-
print("Loaded checkpoint from the previous attempt")
|
577
|
-
checkpoint_path = current.checkpoint.directory
|
578
|
-
|
579
|
-
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
580
|
-
for i in range(self.epochs):
|
581
|
-
...
|
582
|
-
```
|
583
|
-
|
584
|
-
|
585
|
-
Parameters
|
586
|
-
----------
|
587
|
-
load_policy : str, default: "fresh"
|
588
|
-
The policy for loading the checkpoint. The following policies are supported:
|
589
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
590
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
591
|
-
will be loaded at the start of the task.
|
592
|
-
- "none": Do not load any checkpoint
|
593
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
594
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
595
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
596
|
-
created within the task will be loaded when the task is retries execution on failure.
|
597
|
-
|
598
|
-
temp_dir_root : str, default: None
|
599
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
670
|
+
Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
671
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
672
|
+
a Neo Cloud like Nebius.
|
600
673
|
"""
|
601
674
|
...
|
602
675
|
|
603
676
|
@typing.overload
|
604
|
-
def
|
677
|
+
def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
605
678
|
"""
|
606
|
-
|
607
|
-
to
|
679
|
+
CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
680
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
681
|
+
a Neo Cloud like CoreWeave.
|
608
682
|
"""
|
609
683
|
...
|
610
684
|
|
611
685
|
@typing.overload
|
612
|
-
def
|
686
|
+
def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
613
687
|
...
|
614
688
|
|
615
|
-
def
|
689
|
+
def coreweave_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
616
690
|
"""
|
617
|
-
|
618
|
-
to
|
691
|
+
CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
692
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
693
|
+
a Neo Cloud like CoreWeave.
|
619
694
|
"""
|
620
695
|
...
|
621
696
|
|
622
697
|
@typing.overload
|
623
|
-
def
|
698
|
+
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]]]:
|
624
699
|
"""
|
625
|
-
|
626
|
-
|
627
|
-
|
700
|
+
Specifies environment variables to be set prior to the execution of a step.
|
701
|
+
|
702
|
+
|
703
|
+
Parameters
|
704
|
+
----------
|
705
|
+
vars : Dict[str, str], default {}
|
706
|
+
Dictionary of environment variables to set.
|
628
707
|
"""
|
629
708
|
...
|
630
709
|
|
631
710
|
@typing.overload
|
632
|
-
def
|
711
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
633
712
|
...
|
634
713
|
|
635
|
-
|
714
|
+
@typing.overload
|
715
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
716
|
+
...
|
717
|
+
|
718
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
636
719
|
"""
|
637
|
-
|
638
|
-
|
639
|
-
|
720
|
+
Specifies environment variables to be set prior to the execution of a step.
|
721
|
+
|
722
|
+
|
723
|
+
Parameters
|
724
|
+
----------
|
725
|
+
vars : Dict[str, str], default {}
|
726
|
+
Dictionary of environment variables to set.
|
640
727
|
"""
|
641
728
|
...
|
642
729
|
|
@@ -699,104 +786,72 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
699
786
|
"""
|
700
787
|
...
|
701
788
|
|
702
|
-
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]]]:
|
703
|
-
"""
|
704
|
-
Specifies that this step should execute on DGX cloud.
|
705
|
-
|
706
|
-
|
707
|
-
Parameters
|
708
|
-
----------
|
709
|
-
gpu : int
|
710
|
-
Number of GPUs to use.
|
711
|
-
gpu_type : str
|
712
|
-
Type of Nvidia GPU to use.
|
713
|
-
queue_timeout : int
|
714
|
-
Time to keep the job in NVCF's queue.
|
715
|
-
"""
|
716
|
-
...
|
717
|
-
|
718
789
|
@typing.overload
|
719
|
-
def
|
790
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
720
791
|
"""
|
721
|
-
|
722
|
-
|
723
|
-
|
724
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
725
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
726
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
727
|
-
|
728
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
729
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
730
|
-
ensuring that the flow execution can continue.
|
731
|
-
|
732
|
-
|
733
|
-
Parameters
|
734
|
-
----------
|
735
|
-
times : int, default 3
|
736
|
-
Number of times to retry this task.
|
737
|
-
minutes_between_retries : int, default 2
|
738
|
-
Number of minutes between retries.
|
792
|
+
Decorator prototype for all step decorators. This function gets specialized
|
793
|
+
and imported for all decorators types by _import_plugin_decorators().
|
739
794
|
"""
|
740
795
|
...
|
741
796
|
|
742
797
|
@typing.overload
|
743
|
-
def
|
798
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
744
799
|
...
|
745
800
|
|
746
|
-
|
747
|
-
|
801
|
+
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
802
|
+
"""
|
803
|
+
Decorator prototype for all step decorators. This function gets specialized
|
804
|
+
and imported for all decorators types by _import_plugin_decorators().
|
805
|
+
"""
|
748
806
|
...
|
749
807
|
|
750
|
-
|
808
|
+
@typing.overload
|
809
|
+
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]]]:
|
751
810
|
"""
|
752
|
-
Specifies
|
753
|
-
|
754
|
-
|
755
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
756
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
757
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
758
|
-
|
759
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
760
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
761
|
-
ensuring that the flow execution can continue.
|
811
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
812
|
+
the execution of a step.
|
762
813
|
|
763
814
|
|
764
815
|
Parameters
|
765
816
|
----------
|
766
|
-
|
767
|
-
|
768
|
-
|
769
|
-
|
817
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
818
|
+
List of secret specs, defining how the secrets are to be retrieved
|
819
|
+
role : str, optional, default: None
|
820
|
+
Role to use for fetching secrets
|
770
821
|
"""
|
771
822
|
...
|
772
823
|
|
773
824
|
@typing.overload
|
774
|
-
def
|
775
|
-
"""
|
776
|
-
Decorator prototype for all step decorators. This function gets specialized
|
777
|
-
and imported for all decorators types by _import_plugin_decorators().
|
778
|
-
"""
|
825
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
779
826
|
...
|
780
827
|
|
781
828
|
@typing.overload
|
782
|
-
def
|
783
|
-
...
|
784
|
-
|
785
|
-
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
786
|
-
"""
|
787
|
-
Decorator prototype for all step decorators. This function gets specialized
|
788
|
-
and imported for all decorators types by _import_plugin_decorators().
|
789
|
-
"""
|
829
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
790
830
|
...
|
791
831
|
|
792
|
-
def
|
832
|
+
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):
|
793
833
|
"""
|
794
|
-
|
834
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
835
|
+
the execution of a step.
|
795
836
|
|
796
837
|
|
797
838
|
Parameters
|
798
839
|
----------
|
799
|
-
|
840
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
841
|
+
List of secret specs, defining how the secrets are to be retrieved
|
842
|
+
role : str, optional, default: None
|
843
|
+
Role to use for fetching secrets
|
844
|
+
"""
|
845
|
+
...
|
846
|
+
|
847
|
+
def s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typing.Optional[str] = None, debug: typing.Optional[bool] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
848
|
+
"""
|
849
|
+
S3 Proxy decorator for routing S3 requests through a local proxy service.
|
850
|
+
|
851
|
+
|
852
|
+
Parameters
|
853
|
+
----------
|
854
|
+
integration_name : str, optional
|
800
855
|
Name of the S3 proxy integration. If not specified, will use the only
|
801
856
|
available S3 proxy integration in the namespace (fails if multiple exist).
|
802
857
|
write_mode : str, optional
|
@@ -812,51 +867,38 @@ def s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typin
|
|
812
867
|
...
|
813
868
|
|
814
869
|
@typing.overload
|
815
|
-
def
|
870
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
816
871
|
"""
|
817
|
-
|
818
|
-
|
819
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
820
|
-
|
821
|
-
|
822
|
-
Parameters
|
823
|
-
----------
|
824
|
-
type : str, default 'default'
|
825
|
-
Card type.
|
826
|
-
id : str, optional, default None
|
827
|
-
If multiple cards are present, use this id to identify this card.
|
828
|
-
options : Dict[str, Any], default {}
|
829
|
-
Options passed to the card. The contents depend on the card type.
|
830
|
-
timeout : int, default 45
|
831
|
-
Interrupt reporting if it takes more than this many seconds.
|
872
|
+
Internal decorator to support Fast bakery
|
832
873
|
"""
|
833
874
|
...
|
834
875
|
|
835
876
|
@typing.overload
|
836
|
-
def
|
877
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
878
|
+
...
|
879
|
+
|
880
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
881
|
+
"""
|
882
|
+
Internal decorator to support Fast bakery
|
883
|
+
"""
|
837
884
|
...
|
838
885
|
|
839
886
|
@typing.overload
|
840
|
-
def
|
887
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
888
|
+
"""
|
889
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
890
|
+
to inject a card and render simple markdown content.
|
891
|
+
"""
|
841
892
|
...
|
842
893
|
|
843
|
-
|
894
|
+
@typing.overload
|
895
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
896
|
+
...
|
897
|
+
|
898
|
+
def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
844
899
|
"""
|
845
|
-
|
846
|
-
|
847
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
848
|
-
|
849
|
-
|
850
|
-
Parameters
|
851
|
-
----------
|
852
|
-
type : str, default 'default'
|
853
|
-
Card type.
|
854
|
-
id : str, optional, default None
|
855
|
-
If multiple cards are present, use this id to identify this card.
|
856
|
-
options : Dict[str, Any], default {}
|
857
|
-
Options passed to the card. The contents depend on the card type.
|
858
|
-
timeout : int, default 45
|
859
|
-
Interrupt reporting if it takes more than this many seconds.
|
900
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
901
|
+
to inject a card and render simple markdown content.
|
860
902
|
"""
|
861
903
|
...
|
862
904
|
|
@@ -940,53 +982,133 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.
|
|
940
982
|
"""
|
941
983
|
...
|
942
984
|
|
943
|
-
|
985
|
+
@typing.overload
|
986
|
+
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]]]:
|
944
987
|
"""
|
945
|
-
|
988
|
+
Specifies the resources needed when executing this step.
|
946
989
|
|
947
|
-
|
948
|
-
|
949
|
-
@vllm(
|
950
|
-
model="...",
|
951
|
-
...
|
952
|
-
)
|
990
|
+
Use `@resources` to specify the resource requirements
|
991
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
953
992
|
|
954
|
-
|
955
|
-
|
956
|
-
|
993
|
+
You can choose the compute layer on the command line by executing e.g.
|
994
|
+
```
|
995
|
+
python myflow.py run --with batch
|
996
|
+
```
|
997
|
+
or
|
998
|
+
```
|
999
|
+
python myflow.py run --with kubernetes
|
1000
|
+
```
|
1001
|
+
which executes the flow on the desired system using the
|
1002
|
+
requirements specified in `@resources`.
|
957
1003
|
|
958
|
-
Valid model options
|
959
|
-
-------------------
|
960
|
-
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
961
1004
|
|
962
|
-
|
963
|
-
|
1005
|
+
Parameters
|
1006
|
+
----------
|
1007
|
+
cpu : int, default 1
|
1008
|
+
Number of CPUs required for this step.
|
1009
|
+
gpu : int, optional, default None
|
1010
|
+
Number of GPUs required for this step.
|
1011
|
+
disk : int, optional, default None
|
1012
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1013
|
+
memory : int, default 4096
|
1014
|
+
Memory size (in MB) required for this step.
|
1015
|
+
shared_memory : int, optional, default None
|
1016
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1017
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1018
|
+
"""
|
1019
|
+
...
|
1020
|
+
|
1021
|
+
@typing.overload
|
1022
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1023
|
+
...
|
1024
|
+
|
1025
|
+
@typing.overload
|
1026
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1027
|
+
...
|
1028
|
+
|
1029
|
+
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):
|
1030
|
+
"""
|
1031
|
+
Specifies the resources needed when executing this step.
|
1032
|
+
|
1033
|
+
Use `@resources` to specify the resource requirements
|
1034
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1035
|
+
|
1036
|
+
You can choose the compute layer on the command line by executing e.g.
|
1037
|
+
```
|
1038
|
+
python myflow.py run --with batch
|
1039
|
+
```
|
1040
|
+
or
|
1041
|
+
```
|
1042
|
+
python myflow.py run --with kubernetes
|
1043
|
+
```
|
1044
|
+
which executes the flow on the desired system using the
|
1045
|
+
requirements specified in `@resources`.
|
964
1046
|
|
965
1047
|
|
966
1048
|
Parameters
|
967
1049
|
----------
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
977
|
-
|
978
|
-
|
979
|
-
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
989
|
-
|
1050
|
+
cpu : int, default 1
|
1051
|
+
Number of CPUs required for this step.
|
1052
|
+
gpu : int, optional, default None
|
1053
|
+
Number of GPUs required for this step.
|
1054
|
+
disk : int, optional, default None
|
1055
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1056
|
+
memory : int, default 4096
|
1057
|
+
Memory size (in MB) required for this step.
|
1058
|
+
shared_memory : int, optional, default None
|
1059
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1060
|
+
This parameter maps to the `--shm-size` option in Docker.
|
1061
|
+
"""
|
1062
|
+
...
|
1063
|
+
|
1064
|
+
@typing.overload
|
1065
|
+
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]]]:
|
1066
|
+
"""
|
1067
|
+
Specifies that the step will success under all circumstances.
|
1068
|
+
|
1069
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1070
|
+
contains the exception raised. You can use it to detect the presence
|
1071
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1072
|
+
are missing.
|
1073
|
+
|
1074
|
+
|
1075
|
+
Parameters
|
1076
|
+
----------
|
1077
|
+
var : str, optional, default None
|
1078
|
+
Name of the artifact in which to store the caught exception.
|
1079
|
+
If not specified, the exception is not stored.
|
1080
|
+
print_exception : bool, default True
|
1081
|
+
Determines whether or not the exception is printed to
|
1082
|
+
stdout when caught.
|
1083
|
+
"""
|
1084
|
+
...
|
1085
|
+
|
1086
|
+
@typing.overload
|
1087
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1088
|
+
...
|
1089
|
+
|
1090
|
+
@typing.overload
|
1091
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1092
|
+
...
|
1093
|
+
|
1094
|
+
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):
|
1095
|
+
"""
|
1096
|
+
Specifies that the step will success under all circumstances.
|
1097
|
+
|
1098
|
+
The decorator will create an optional artifact, specified by `var`, which
|
1099
|
+
contains the exception raised. You can use it to detect the presence
|
1100
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
1101
|
+
are missing.
|
1102
|
+
|
1103
|
+
|
1104
|
+
Parameters
|
1105
|
+
----------
|
1106
|
+
var : str, optional, default None
|
1107
|
+
Name of the artifact in which to store the caught exception.
|
1108
|
+
If not specified, the exception is not stored.
|
1109
|
+
print_exception : bool, default True
|
1110
|
+
Determines whether or not the exception is printed to
|
1111
|
+
stdout when caught.
|
990
1112
|
"""
|
991
1113
|
...
|
992
1114
|
|
@@ -1080,512 +1202,243 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
1080
1202
|
...
|
1081
1203
|
|
1082
1204
|
@typing.overload
|
1083
|
-
def
|
1084
|
-
"""
|
1085
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1086
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1087
|
-
"""
|
1088
|
-
...
|
1089
|
-
|
1090
|
-
@typing.overload
|
1091
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1092
|
-
...
|
1093
|
-
|
1094
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1095
|
-
"""
|
1096
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1097
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1098
|
-
"""
|
1099
|
-
...
|
1100
|
-
|
1101
|
-
@typing.overload
|
1102
|
-
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]]]:
|
1205
|
+
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]]]:
|
1103
1206
|
"""
|
1104
|
-
|
1105
|
-
the execution of a step.
|
1207
|
+
Enables checkpointing for a step.
|
1106
1208
|
|
1209
|
+
> Examples
|
1107
1210
|
|
1108
|
-
|
1109
|
-
----------
|
1110
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
1111
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1112
|
-
role : str, optional, default: None
|
1113
|
-
Role to use for fetching secrets
|
1114
|
-
"""
|
1115
|
-
...
|
1116
|
-
|
1117
|
-
@typing.overload
|
1118
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1119
|
-
...
|
1120
|
-
|
1121
|
-
@typing.overload
|
1122
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1123
|
-
...
|
1124
|
-
|
1125
|
-
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):
|
1126
|
-
"""
|
1127
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
1128
|
-
the execution of a step.
|
1129
|
-
|
1130
|
-
|
1131
|
-
Parameters
|
1132
|
-
----------
|
1133
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
1134
|
-
List of secret specs, defining how the secrets are to be retrieved
|
1135
|
-
role : str, optional, default: None
|
1136
|
-
Role to use for fetching secrets
|
1137
|
-
"""
|
1138
|
-
...
|
1139
|
-
|
1140
|
-
@typing.overload
|
1141
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1142
|
-
"""
|
1143
|
-
Internal decorator to support Fast bakery
|
1144
|
-
"""
|
1145
|
-
...
|
1146
|
-
|
1147
|
-
@typing.overload
|
1148
|
-
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1149
|
-
...
|
1150
|
-
|
1151
|
-
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1152
|
-
"""
|
1153
|
-
Internal decorator to support Fast bakery
|
1154
|
-
"""
|
1155
|
-
...
|
1156
|
-
|
1157
|
-
@typing.overload
|
1158
|
-
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]]]:
|
1159
|
-
"""
|
1160
|
-
Specifies the resources needed when executing this step.
|
1161
|
-
|
1162
|
-
Use `@resources` to specify the resource requirements
|
1163
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1211
|
+
- Saving Checkpoints
|
1164
1212
|
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1213
|
+
```python
|
1214
|
+
@checkpoint
|
1215
|
+
@step
|
1216
|
+
def train(self):
|
1217
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
1218
|
+
for i in range(self.epochs):
|
1219
|
+
# some training logic
|
1220
|
+
loss = model.train(self.dataset)
|
1221
|
+
if i % 10 == 0:
|
1222
|
+
model.save(
|
1223
|
+
current.checkpoint.directory,
|
1224
|
+
)
|
1225
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
1226
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
1227
|
+
self.latest_checkpoint = current.checkpoint.save(
|
1228
|
+
name="epoch_checkpoint",
|
1229
|
+
metadata={
|
1230
|
+
"epoch": i,
|
1231
|
+
"loss": loss,
|
1232
|
+
}
|
1233
|
+
)
|
1172
1234
|
```
|
1173
|
-
which executes the flow on the desired system using the
|
1174
|
-
requirements specified in `@resources`.
|
1175
|
-
|
1176
1235
|
|
1177
|
-
|
1178
|
-
----------
|
1179
|
-
cpu : int, default 1
|
1180
|
-
Number of CPUs required for this step.
|
1181
|
-
gpu : int, optional, default None
|
1182
|
-
Number of GPUs required for this step.
|
1183
|
-
disk : int, optional, default None
|
1184
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
1185
|
-
memory : int, default 4096
|
1186
|
-
Memory size (in MB) required for this step.
|
1187
|
-
shared_memory : int, optional, default None
|
1188
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1189
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1190
|
-
"""
|
1191
|
-
...
|
1192
|
-
|
1193
|
-
@typing.overload
|
1194
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1195
|
-
...
|
1196
|
-
|
1197
|
-
@typing.overload
|
1198
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1199
|
-
...
|
1200
|
-
|
1201
|
-
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):
|
1202
|
-
"""
|
1203
|
-
Specifies the resources needed when executing this step.
|
1236
|
+
- Using Loaded Checkpoints
|
1204
1237
|
|
1205
|
-
|
1206
|
-
|
1238
|
+
```python
|
1239
|
+
@retry(times=3)
|
1240
|
+
@checkpoint
|
1241
|
+
@step
|
1242
|
+
def train(self):
|
1243
|
+
# Assume that the task has restarted and the previous attempt of the task
|
1244
|
+
# saved a checkpoint
|
1245
|
+
checkpoint_path = None
|
1246
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
1247
|
+
print("Loaded checkpoint from the previous attempt")
|
1248
|
+
checkpoint_path = current.checkpoint.directory
|
1207
1249
|
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
```
|
1212
|
-
or
|
1213
|
-
```
|
1214
|
-
python myflow.py run --with kubernetes
|
1250
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
1251
|
+
for i in range(self.epochs):
|
1252
|
+
...
|
1215
1253
|
```
|
1216
|
-
which executes the flow on the desired system using the
|
1217
|
-
requirements specified in `@resources`.
|
1218
1254
|
|
1219
1255
|
|
1220
1256
|
Parameters
|
1221
1257
|
----------
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1233
|
-
"""
|
1234
|
-
...
|
1235
|
-
|
1236
|
-
@typing.overload
|
1237
|
-
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]]]:
|
1238
|
-
"""
|
1239
|
-
Specifies that the step will success under all circumstances.
|
1240
|
-
|
1241
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1242
|
-
contains the exception raised. You can use it to detect the presence
|
1243
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1244
|
-
are missing.
|
1245
|
-
|
1246
|
-
|
1247
|
-
Parameters
|
1248
|
-
----------
|
1249
|
-
var : str, optional, default None
|
1250
|
-
Name of the artifact in which to store the caught exception.
|
1251
|
-
If not specified, the exception is not stored.
|
1252
|
-
print_exception : bool, default True
|
1253
|
-
Determines whether or not the exception is printed to
|
1254
|
-
stdout when caught.
|
1255
|
-
"""
|
1256
|
-
...
|
1257
|
-
|
1258
|
-
@typing.overload
|
1259
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1260
|
-
...
|
1261
|
-
|
1262
|
-
@typing.overload
|
1263
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1264
|
-
...
|
1265
|
-
|
1266
|
-
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):
|
1267
|
-
"""
|
1268
|
-
Specifies that the step will success under all circumstances.
|
1269
|
-
|
1270
|
-
The decorator will create an optional artifact, specified by `var`, which
|
1271
|
-
contains the exception raised. You can use it to detect the presence
|
1272
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
1273
|
-
are missing.
|
1274
|
-
|
1258
|
+
load_policy : str, default: "fresh"
|
1259
|
+
The policy for loading the checkpoint. The following policies are supported:
|
1260
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
1261
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
1262
|
+
will be loaded at the start of the task.
|
1263
|
+
- "none": Do not load any checkpoint
|
1264
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
1265
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
1266
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
1267
|
+
created within the task will be loaded when the task is retries execution on failure.
|
1275
1268
|
|
1276
|
-
|
1277
|
-
|
1278
|
-
var : str, optional, default None
|
1279
|
-
Name of the artifact in which to store the caught exception.
|
1280
|
-
If not specified, the exception is not stored.
|
1281
|
-
print_exception : bool, default True
|
1282
|
-
Determines whether or not the exception is printed to
|
1283
|
-
stdout when caught.
|
1269
|
+
temp_dir_root : str, default: None
|
1270
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
1284
1271
|
"""
|
1285
1272
|
...
|
1286
1273
|
|
1287
1274
|
@typing.overload
|
1288
|
-
def
|
1289
|
-
"""
|
1290
|
-
CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
1291
|
-
It exists to make it easier for users to know that this decorator should only be used with
|
1292
|
-
a Neo Cloud like CoreWeave.
|
1293
|
-
"""
|
1275
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1294
1276
|
...
|
1295
1277
|
|
1296
1278
|
@typing.overload
|
1297
|
-
def
|
1298
|
-
...
|
1299
|
-
|
1300
|
-
def coreweave_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1301
|
-
"""
|
1302
|
-
CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
1303
|
-
It exists to make it easier for users to know that this decorator should only be used with
|
1304
|
-
a Neo Cloud like CoreWeave.
|
1305
|
-
"""
|
1279
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1306
1280
|
...
|
1307
1281
|
|
1308
|
-
def
|
1282
|
+
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):
|
1309
1283
|
"""
|
1310
|
-
|
1311
|
-
|
1312
|
-
User code call
|
1313
|
-
--------------
|
1314
|
-
@ollama(
|
1315
|
-
models=[...],
|
1316
|
-
...
|
1317
|
-
)
|
1284
|
+
Enables checkpointing for a step.
|
1318
1285
|
|
1319
|
-
|
1320
|
-
---------------------
|
1321
|
-
- 'local': Run as a separate process on the local task machine.
|
1322
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
1323
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
1286
|
+
> Examples
|
1324
1287
|
|
1325
|
-
|
1326
|
-
-------------------
|
1327
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
1288
|
+
- Saving Checkpoints
|
1328
1289
|
|
1290
|
+
```python
|
1291
|
+
@checkpoint
|
1292
|
+
@step
|
1293
|
+
def train(self):
|
1294
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
1295
|
+
for i in range(self.epochs):
|
1296
|
+
# some training logic
|
1297
|
+
loss = model.train(self.dataset)
|
1298
|
+
if i % 10 == 0:
|
1299
|
+
model.save(
|
1300
|
+
current.checkpoint.directory,
|
1301
|
+
)
|
1302
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
1303
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
1304
|
+
self.latest_checkpoint = current.checkpoint.save(
|
1305
|
+
name="epoch_checkpoint",
|
1306
|
+
metadata={
|
1307
|
+
"epoch": i,
|
1308
|
+
"loss": loss,
|
1309
|
+
}
|
1310
|
+
)
|
1311
|
+
```
|
1329
1312
|
|
1330
|
-
|
1331
|
-
----------
|
1332
|
-
models: list[str]
|
1333
|
-
List of Ollama containers running models in sidecars.
|
1334
|
-
backend: str
|
1335
|
-
Determines where and how to run the Ollama process.
|
1336
|
-
force_pull: bool
|
1337
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
1338
|
-
cache_update_policy: str
|
1339
|
-
Cache update policy: "auto", "force", or "never".
|
1340
|
-
force_cache_update: bool
|
1341
|
-
Simple override for "force" cache update policy.
|
1342
|
-
debug: bool
|
1343
|
-
Whether to turn on verbose debugging logs.
|
1344
|
-
circuit_breaker_config: dict
|
1345
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
1346
|
-
timeout_config: dict
|
1347
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
1348
|
-
"""
|
1349
|
-
...
|
1350
|
-
|
1351
|
-
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]]:
|
1352
|
-
"""
|
1353
|
-
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)
|
1354
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1355
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1356
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1357
|
-
starts only after all sensors finish.
|
1313
|
+
- Using Loaded Checkpoints
|
1358
1314
|
|
1315
|
+
```python
|
1316
|
+
@retry(times=3)
|
1317
|
+
@checkpoint
|
1318
|
+
@step
|
1319
|
+
def train(self):
|
1320
|
+
# Assume that the task has restarted and the previous attempt of the task
|
1321
|
+
# saved a checkpoint
|
1322
|
+
checkpoint_path = None
|
1323
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
1324
|
+
print("Loaded checkpoint from the previous attempt")
|
1325
|
+
checkpoint_path = current.checkpoint.directory
|
1359
1326
|
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
poke_interval : int
|
1365
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1366
|
-
mode : str
|
1367
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1368
|
-
exponential_backoff : bool
|
1369
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1370
|
-
pool : str
|
1371
|
-
the slot pool this task should run in,
|
1372
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1373
|
-
soft_fail : bool
|
1374
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1375
|
-
name : str
|
1376
|
-
Name of the sensor on Airflow
|
1377
|
-
description : str
|
1378
|
-
Description of sensor in the Airflow UI
|
1379
|
-
bucket_key : Union[str, List[str]]
|
1380
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1381
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1382
|
-
bucket_name : str
|
1383
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1384
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1385
|
-
wildcard_match : bool
|
1386
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1387
|
-
aws_conn_id : str
|
1388
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
1389
|
-
verify : bool
|
1390
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1391
|
-
"""
|
1392
|
-
...
|
1393
|
-
|
1394
|
-
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1395
|
-
"""
|
1396
|
-
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1397
|
-
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1327
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
1328
|
+
for i in range(self.epochs):
|
1329
|
+
...
|
1330
|
+
```
|
1398
1331
|
|
1399
1332
|
|
1400
1333
|
Parameters
|
1401
1334
|
----------
|
1402
|
-
|
1403
|
-
|
1404
|
-
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
1408
|
-
|
1409
|
-
|
1410
|
-
|
1411
|
-
|
1412
|
-
|
1413
|
-
|
1414
|
-
|
1415
|
-
name : str
|
1416
|
-
Name of the sensor on Airflow
|
1417
|
-
description : str
|
1418
|
-
Description of sensor in the Airflow UI
|
1419
|
-
external_dag_id : str
|
1420
|
-
The dag_id that contains the task you want to wait for.
|
1421
|
-
external_task_ids : List[str]
|
1422
|
-
The list of task_ids that you want to wait for.
|
1423
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1424
|
-
allowed_states : List[str]
|
1425
|
-
Iterable of allowed states, (Default: ['success'])
|
1426
|
-
failed_states : List[str]
|
1427
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1428
|
-
execution_delta : datetime.timedelta
|
1429
|
-
time difference with the previous execution to look at,
|
1430
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1431
|
-
check_existence: bool
|
1432
|
-
Set to True to check if the external task exists or check if
|
1433
|
-
the DAG to wait for exists. (Default: True)
|
1434
|
-
"""
|
1435
|
-
...
|
1436
|
-
|
1437
|
-
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
1438
|
-
"""
|
1439
|
-
Allows setting external datastores to save data for the
|
1440
|
-
`@checkpoint`/`@model`/`@huggingface_hub` decorators.
|
1441
|
-
|
1442
|
-
This decorator is useful when users wish to save data to a different datastore
|
1443
|
-
than what is configured in Metaflow. This can be for variety of reasons:
|
1444
|
-
|
1445
|
-
1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
|
1446
|
-
2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
|
1447
|
-
- Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
|
1448
|
-
3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
|
1449
|
-
- Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
|
1450
|
-
|
1451
|
-
Usage:
|
1452
|
-
----------
|
1453
|
-
|
1454
|
-
- Using a custom IAM role to access the datastore.
|
1455
|
-
|
1456
|
-
```python
|
1457
|
-
@with_artifact_store(
|
1458
|
-
type="s3",
|
1459
|
-
config=lambda: {
|
1460
|
-
"root": "s3://my-bucket-foo/path/to/root",
|
1461
|
-
"role_arn": ROLE,
|
1462
|
-
},
|
1463
|
-
)
|
1464
|
-
class MyFlow(FlowSpec):
|
1465
|
-
|
1466
|
-
@checkpoint
|
1467
|
-
@step
|
1468
|
-
def start(self):
|
1469
|
-
with open("my_file.txt", "w") as f:
|
1470
|
-
f.write("Hello, World!")
|
1471
|
-
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1472
|
-
self.next(self.end)
|
1473
|
-
|
1474
|
-
```
|
1475
|
-
|
1476
|
-
- Using credentials to access the s3-compatible datastore.
|
1477
|
-
|
1478
|
-
```python
|
1479
|
-
@with_artifact_store(
|
1480
|
-
type="s3",
|
1481
|
-
config=lambda: {
|
1482
|
-
"root": "s3://my-bucket-foo/path/to/root",
|
1483
|
-
"client_params": {
|
1484
|
-
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1485
|
-
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1486
|
-
},
|
1487
|
-
},
|
1488
|
-
)
|
1489
|
-
class MyFlow(FlowSpec):
|
1490
|
-
|
1491
|
-
@checkpoint
|
1492
|
-
@step
|
1493
|
-
def start(self):
|
1494
|
-
with open("my_file.txt", "w") as f:
|
1495
|
-
f.write("Hello, World!")
|
1496
|
-
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1497
|
-
self.next(self.end)
|
1498
|
-
|
1499
|
-
```
|
1500
|
-
|
1501
|
-
- Accessing objects stored in external datastores after task execution.
|
1502
|
-
|
1503
|
-
```python
|
1504
|
-
run = Run("CheckpointsTestsFlow/8992")
|
1505
|
-
with artifact_store_from(run=run, config={
|
1506
|
-
"client_params": {
|
1507
|
-
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1508
|
-
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1509
|
-
},
|
1510
|
-
}):
|
1511
|
-
with Checkpoint() as cp:
|
1512
|
-
latest = cp.list(
|
1513
|
-
task=run["start"].task
|
1514
|
-
)[0]
|
1515
|
-
print(latest)
|
1516
|
-
cp.load(
|
1517
|
-
latest,
|
1518
|
-
"test-checkpoints"
|
1519
|
-
)
|
1520
|
-
|
1521
|
-
task = Task("TorchTuneFlow/8484/train/53673")
|
1522
|
-
with artifact_store_from(run=run, config={
|
1523
|
-
"client_params": {
|
1524
|
-
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1525
|
-
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1526
|
-
},
|
1527
|
-
}):
|
1528
|
-
load_model(
|
1529
|
-
task.data.model_ref,
|
1530
|
-
"test-models"
|
1531
|
-
)
|
1532
|
-
```
|
1533
|
-
Parameters:
|
1534
|
-
----------
|
1535
|
-
|
1536
|
-
type: str
|
1537
|
-
The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
|
1538
|
-
|
1539
|
-
config: dict or Callable
|
1540
|
-
Dictionary of configuration options for the datastore. The following keys are required:
|
1541
|
-
- root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
|
1542
|
-
- example: 's3://bucket-name/path/to/root'
|
1543
|
-
- example: 'gs://bucket-name/path/to/root'
|
1544
|
-
- example: 'https://myblockacc.blob.core.windows.net/metaflow/'
|
1545
|
-
- role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
|
1546
|
-
- session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
|
1547
|
-
- client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
|
1335
|
+
load_policy : str, default: "fresh"
|
1336
|
+
The policy for loading the checkpoint. The following policies are supported:
|
1337
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
1338
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
1339
|
+
will be loaded at the start of the task.
|
1340
|
+
- "none": Do not load any checkpoint
|
1341
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
1342
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
1343
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
1344
|
+
created within the task will be loaded when the task is retries execution on failure.
|
1345
|
+
|
1346
|
+
temp_dir_root : str, default: None
|
1347
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
1548
1348
|
"""
|
1549
1349
|
...
|
1550
1350
|
|
1551
1351
|
@typing.overload
|
1552
|
-
def
|
1352
|
+
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1553
1353
|
"""
|
1554
|
-
Specifies the
|
1354
|
+
Specifies the Conda environment for all steps of the flow.
|
1355
|
+
|
1356
|
+
Use `@conda_base` to set common libraries required by all
|
1357
|
+
steps and use `@conda` to specify step-specific additions.
|
1555
1358
|
|
1556
|
-
Use `@pypi_base` to set common packages required by all
|
1557
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1558
1359
|
|
1559
1360
|
Parameters
|
1560
1361
|
----------
|
1561
|
-
packages : Dict[str, str], default
|
1362
|
+
packages : Dict[str, str], default {}
|
1562
1363
|
Packages to use for this flow. The key is the name of the package
|
1563
1364
|
and the value is the version to use.
|
1564
|
-
|
1365
|
+
libraries : Dict[str, str], default {}
|
1366
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1367
|
+
python : str, optional, default None
|
1565
1368
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1566
1369
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1370
|
+
disabled : bool, default False
|
1371
|
+
If set to True, disables Conda.
|
1567
1372
|
"""
|
1568
1373
|
...
|
1569
1374
|
|
1570
1375
|
@typing.overload
|
1571
|
-
def
|
1376
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1572
1377
|
...
|
1573
1378
|
|
1574
|
-
def
|
1379
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1575
1380
|
"""
|
1576
|
-
Specifies the
|
1381
|
+
Specifies the Conda environment for all steps of the flow.
|
1382
|
+
|
1383
|
+
Use `@conda_base` to set common libraries required by all
|
1384
|
+
steps and use `@conda` to specify step-specific additions.
|
1577
1385
|
|
1578
|
-
Use `@pypi_base` to set common packages required by all
|
1579
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1580
1386
|
|
1581
1387
|
Parameters
|
1582
1388
|
----------
|
1583
|
-
packages : Dict[str, str], default
|
1389
|
+
packages : Dict[str, str], default {}
|
1584
1390
|
Packages to use for this flow. The key is the name of the package
|
1585
1391
|
and the value is the version to use.
|
1586
|
-
|
1392
|
+
libraries : Dict[str, str], default {}
|
1393
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1394
|
+
python : str, optional, default None
|
1587
1395
|
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1588
1396
|
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1397
|
+
disabled : bool, default False
|
1398
|
+
If set to True, disables Conda.
|
1399
|
+
"""
|
1400
|
+
...
|
1401
|
+
|
1402
|
+
def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str, exponential_backoff: bool, pool: str, soft_fail: bool, name: str, description: str, external_dag_id: str, external_task_ids: typing.List[str], allowed_states: typing.List[str], failed_states: typing.List[str], execution_delta: "datetime.timedelta", check_existence: bool) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1403
|
+
"""
|
1404
|
+
The `@airflow_external_task_sensor` decorator attaches a Airflow [ExternalTaskSensor](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/sensors/external_task/index.html#airflow.sensors.external_task.ExternalTaskSensor) before the start step of the flow.
|
1405
|
+
This decorator only works when a flow is scheduled on Airflow and is compiled using `airflow create`. More than one `@airflow_external_task_sensor` can be added as a flow decorators. Adding more than one decorator will ensure that `start` step starts only after all sensors finish.
|
1406
|
+
|
1407
|
+
|
1408
|
+
Parameters
|
1409
|
+
----------
|
1410
|
+
timeout : int
|
1411
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1412
|
+
poke_interval : int
|
1413
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1414
|
+
mode : str
|
1415
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1416
|
+
exponential_backoff : bool
|
1417
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1418
|
+
pool : str
|
1419
|
+
the slot pool this task should run in,
|
1420
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1421
|
+
soft_fail : bool
|
1422
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1423
|
+
name : str
|
1424
|
+
Name of the sensor on Airflow
|
1425
|
+
description : str
|
1426
|
+
Description of sensor in the Airflow UI
|
1427
|
+
external_dag_id : str
|
1428
|
+
The dag_id that contains the task you want to wait for.
|
1429
|
+
external_task_ids : List[str]
|
1430
|
+
The list of task_ids that you want to wait for.
|
1431
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1432
|
+
allowed_states : List[str]
|
1433
|
+
Iterable of allowed states, (Default: ['success'])
|
1434
|
+
failed_states : List[str]
|
1435
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1436
|
+
execution_delta : datetime.timedelta
|
1437
|
+
time difference with the previous execution to look at,
|
1438
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1439
|
+
check_existence: bool
|
1440
|
+
Set to True to check if the external task exists or check if
|
1441
|
+
the DAG to wait for exists. (Default: True)
|
1589
1442
|
"""
|
1590
1443
|
...
|
1591
1444
|
|
@@ -1640,38 +1493,180 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
1640
1493
|
"""
|
1641
1494
|
...
|
1642
1495
|
|
1643
|
-
def
|
1496
|
+
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]]:
|
1644
1497
|
"""
|
1645
|
-
|
1646
|
-
|
1647
|
-
|
1648
|
-
|
1498
|
+
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)
|
1499
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1500
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1501
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1502
|
+
starts only after all sensors finish.
|
1649
1503
|
|
1650
1504
|
|
1651
1505
|
Parameters
|
1652
1506
|
----------
|
1507
|
+
timeout : int
|
1508
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1509
|
+
poke_interval : int
|
1510
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1511
|
+
mode : str
|
1512
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1513
|
+
exponential_backoff : bool
|
1514
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1515
|
+
pool : str
|
1516
|
+
the slot pool this task should run in,
|
1517
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1518
|
+
soft_fail : bool
|
1519
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1653
1520
|
name : str
|
1654
|
-
|
1655
|
-
|
1656
|
-
|
1521
|
+
Name of the sensor on Airflow
|
1522
|
+
description : str
|
1523
|
+
Description of sensor in the Airflow UI
|
1524
|
+
bucket_key : Union[str, List[str]]
|
1525
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1526
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1527
|
+
bucket_name : str
|
1528
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1529
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1530
|
+
wildcard_match : bool
|
1531
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1532
|
+
aws_conn_id : str
|
1533
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1534
|
+
verify : bool
|
1535
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1536
|
+
"""
|
1537
|
+
...
|
1538
|
+
|
1539
|
+
@typing.overload
|
1540
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1541
|
+
"""
|
1542
|
+
Specifies the PyPI packages for all steps of the flow.
|
1543
|
+
|
1544
|
+
Use `@pypi_base` to set common packages required by all
|
1545
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1546
|
+
|
1547
|
+
Parameters
|
1548
|
+
----------
|
1549
|
+
packages : Dict[str, str], default: {}
|
1550
|
+
Packages to use for this flow. The key is the name of the package
|
1551
|
+
and the value is the version to use.
|
1552
|
+
python : str, optional, default: None
|
1553
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1554
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1555
|
+
"""
|
1556
|
+
...
|
1557
|
+
|
1558
|
+
@typing.overload
|
1559
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1560
|
+
...
|
1561
|
+
|
1562
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1563
|
+
"""
|
1564
|
+
Specifies the PyPI packages for all steps of the flow.
|
1565
|
+
|
1566
|
+
Use `@pypi_base` to set common packages required by all
|
1567
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1568
|
+
|
1569
|
+
Parameters
|
1570
|
+
----------
|
1571
|
+
packages : Dict[str, str], default: {}
|
1572
|
+
Packages to use for this flow. The key is the name of the package
|
1573
|
+
and the value is the version to use.
|
1574
|
+
python : str, optional, default: None
|
1575
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1576
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1577
|
+
"""
|
1578
|
+
...
|
1579
|
+
|
1580
|
+
@typing.overload
|
1581
|
+
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1582
|
+
"""
|
1583
|
+
Specifies the event(s) that this flow depends on.
|
1584
|
+
|
1585
|
+
```
|
1586
|
+
@trigger(event='foo')
|
1587
|
+
```
|
1588
|
+
or
|
1589
|
+
```
|
1590
|
+
@trigger(events=['foo', 'bar'])
|
1591
|
+
```
|
1592
|
+
|
1593
|
+
Additionally, you can specify the parameter mappings
|
1594
|
+
to map event payload to Metaflow parameters for the flow.
|
1595
|
+
```
|
1596
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1597
|
+
```
|
1598
|
+
or
|
1599
|
+
```
|
1600
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1601
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1602
|
+
```
|
1603
|
+
|
1604
|
+
'parameters' can also be a list of strings and tuples like so:
|
1605
|
+
```
|
1606
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1607
|
+
```
|
1608
|
+
This is equivalent to:
|
1609
|
+
```
|
1610
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1611
|
+
```
|
1612
|
+
|
1613
|
+
|
1614
|
+
Parameters
|
1615
|
+
----------
|
1616
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1617
|
+
Event dependency for this flow.
|
1618
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1619
|
+
Events dependency for this flow.
|
1620
|
+
options : Dict[str, Any], default {}
|
1621
|
+
Backend-specific configuration for tuning eventing behavior.
|
1622
|
+
"""
|
1623
|
+
...
|
1624
|
+
|
1625
|
+
@typing.overload
|
1626
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1627
|
+
...
|
1628
|
+
|
1629
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1630
|
+
"""
|
1631
|
+
Specifies the event(s) that this flow depends on.
|
1632
|
+
|
1633
|
+
```
|
1634
|
+
@trigger(event='foo')
|
1635
|
+
```
|
1636
|
+
or
|
1637
|
+
```
|
1638
|
+
@trigger(events=['foo', 'bar'])
|
1639
|
+
```
|
1640
|
+
|
1641
|
+
Additionally, you can specify the parameter mappings
|
1642
|
+
to map event payload to Metaflow parameters for the flow.
|
1643
|
+
```
|
1644
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
1645
|
+
```
|
1646
|
+
or
|
1647
|
+
```
|
1648
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1649
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1650
|
+
```
|
1651
|
+
|
1652
|
+
'parameters' can also be a list of strings and tuples like so:
|
1653
|
+
```
|
1654
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1655
|
+
```
|
1656
|
+
This is equivalent to:
|
1657
|
+
```
|
1658
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1659
|
+
```
|
1657
1660
|
|
1658
|
-
branch : Optional[str], default None
|
1659
|
-
The branch to use. If not specified, the branch is set to
|
1660
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1661
|
-
also be set on the command line using `--branch` as a top-level option.
|
1662
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1663
1661
|
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
1667
|
-
|
1668
|
-
|
1669
|
-
|
1670
|
-
|
1671
|
-
|
1672
|
-
- if `branch` is not specified:
|
1673
|
-
- if `production` is True: `prod`
|
1674
|
-
- if `production` is False: `user.<username>`
|
1662
|
+
Parameters
|
1663
|
+
----------
|
1664
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
1665
|
+
Event dependency for this flow.
|
1666
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
1667
|
+
Events dependency for this flow.
|
1668
|
+
options : Dict[str, Any], default {}
|
1669
|
+
Backend-specific configuration for tuning eventing behavior.
|
1675
1670
|
"""
|
1676
1671
|
...
|
1677
1672
|
|
@@ -1776,147 +1771,152 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1776
1771
|
"""
|
1777
1772
|
...
|
1778
1773
|
|
1779
|
-
|
1780
|
-
def conda_base(*, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1774
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1781
1775
|
"""
|
1782
|
-
Specifies
|
1776
|
+
Specifies what flows belong to the same project.
|
1783
1777
|
|
1784
|
-
|
1785
|
-
|
1778
|
+
A project-specific namespace is created for all flows that
|
1779
|
+
use the same `@project(name)`.
|
1786
1780
|
|
1787
1781
|
|
1788
1782
|
Parameters
|
1789
1783
|
----------
|
1790
|
-
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
1794
|
-
|
1795
|
-
|
1796
|
-
|
1797
|
-
|
1798
|
-
|
1799
|
-
|
1784
|
+
name : str
|
1785
|
+
Project name. Make sure that the name is unique amongst all
|
1786
|
+
projects that use the same production scheduler. The name may
|
1787
|
+
contain only lowercase alphanumeric characters and underscores.
|
1788
|
+
|
1789
|
+
branch : Optional[str], default None
|
1790
|
+
The branch to use. If not specified, the branch is set to
|
1791
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1792
|
+
also be set on the command line using `--branch` as a top-level option.
|
1793
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1794
|
+
|
1795
|
+
production : bool, default False
|
1796
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1797
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1798
|
+
`production` in the decorator and on the command line.
|
1799
|
+
The project branch name will be:
|
1800
|
+
- if `branch` is specified:
|
1801
|
+
- if `production` is True: `prod.<branch>`
|
1802
|
+
- if `production` is False: `test.<branch>`
|
1803
|
+
- if `branch` is not specified:
|
1804
|
+
- if `production` is True: `prod`
|
1805
|
+
- if `production` is False: `user.<username>`
|
1800
1806
|
"""
|
1801
1807
|
...
|
1802
1808
|
|
1803
|
-
|
1804
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1805
|
-
...
|
1806
|
-
|
1807
|
-
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
1809
|
+
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
1808
1810
|
"""
|
1809
|
-
|
1811
|
+
Allows setting external datastores to save data for the
|
1812
|
+
`@checkpoint`/`@model`/`@huggingface_hub` decorators.
|
1810
1813
|
|
1811
|
-
|
1812
|
-
|
1814
|
+
This decorator is useful when users wish to save data to a different datastore
|
1815
|
+
than what is configured in Metaflow. This can be for variety of reasons:
|
1813
1816
|
|
1817
|
+
1. Data security: The objects needs to be stored in a bucket (object storage) that is not accessible by other flows.
|
1818
|
+
2. Data Locality: The location where the task is executing is not located in the same region as the datastore.
|
1819
|
+
- Example: Metaflow datastore lives in US East, but the task is executing in Finland datacenters.
|
1820
|
+
3. Data Lifecycle Policies: The objects need to be archived / managed separately from the Metaflow managed objects.
|
1821
|
+
- Example: Flow is training very large models that need to be stored separately and will be deleted more aggressively than the Metaflow managed objects.
|
1814
1822
|
|
1815
|
-
|
1823
|
+
Usage:
|
1816
1824
|
----------
|
1817
|
-
packages : Dict[str, str], default {}
|
1818
|
-
Packages to use for this flow. The key is the name of the package
|
1819
|
-
and the value is the version to use.
|
1820
|
-
libraries : Dict[str, str], default {}
|
1821
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
1822
|
-
python : str, optional, default None
|
1823
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1824
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1825
|
-
disabled : bool, default False
|
1826
|
-
If set to True, disables Conda.
|
1827
|
-
"""
|
1828
|
-
...
|
1829
|
-
|
1830
|
-
@typing.overload
|
1831
|
-
def trigger(*, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1832
|
-
"""
|
1833
|
-
Specifies the event(s) that this flow depends on.
|
1834
1825
|
|
1835
|
-
|
1836
|
-
@trigger(event='foo')
|
1837
|
-
```
|
1838
|
-
or
|
1839
|
-
```
|
1840
|
-
@trigger(events=['foo', 'bar'])
|
1841
|
-
```
|
1826
|
+
- Using a custom IAM role to access the datastore.
|
1842
1827
|
|
1843
|
-
|
1844
|
-
|
1845
|
-
|
1846
|
-
|
1847
|
-
|
1848
|
-
|
1849
|
-
|
1850
|
-
|
1851
|
-
|
1852
|
-
```
|
1828
|
+
```python
|
1829
|
+
@with_artifact_store(
|
1830
|
+
type="s3",
|
1831
|
+
config=lambda: {
|
1832
|
+
"root": "s3://my-bucket-foo/path/to/root",
|
1833
|
+
"role_arn": ROLE,
|
1834
|
+
},
|
1835
|
+
)
|
1836
|
+
class MyFlow(FlowSpec):
|
1853
1837
|
|
1854
|
-
|
1855
|
-
|
1856
|
-
|
1857
|
-
|
1858
|
-
|
1859
|
-
|
1860
|
-
|
1861
|
-
```
|
1838
|
+
@checkpoint
|
1839
|
+
@step
|
1840
|
+
def start(self):
|
1841
|
+
with open("my_file.txt", "w") as f:
|
1842
|
+
f.write("Hello, World!")
|
1843
|
+
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1844
|
+
self.next(self.end)
|
1862
1845
|
|
1846
|
+
```
|
1863
1847
|
|
1864
|
-
|
1865
|
-
----------
|
1866
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
1867
|
-
Event dependency for this flow.
|
1868
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
1869
|
-
Events dependency for this flow.
|
1870
|
-
options : Dict[str, Any], default {}
|
1871
|
-
Backend-specific configuration for tuning eventing behavior.
|
1872
|
-
"""
|
1873
|
-
...
|
1874
|
-
|
1875
|
-
@typing.overload
|
1876
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1877
|
-
...
|
1878
|
-
|
1879
|
-
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
1880
|
-
"""
|
1881
|
-
Specifies the event(s) that this flow depends on.
|
1848
|
+
- Using credentials to access the s3-compatible datastore.
|
1882
1849
|
|
1883
|
-
|
1884
|
-
|
1885
|
-
|
1886
|
-
|
1887
|
-
|
1888
|
-
|
1889
|
-
|
1850
|
+
```python
|
1851
|
+
@with_artifact_store(
|
1852
|
+
type="s3",
|
1853
|
+
config=lambda: {
|
1854
|
+
"root": "s3://my-bucket-foo/path/to/root",
|
1855
|
+
"client_params": {
|
1856
|
+
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1857
|
+
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1858
|
+
},
|
1859
|
+
},
|
1860
|
+
)
|
1861
|
+
class MyFlow(FlowSpec):
|
1890
1862
|
|
1891
|
-
|
1892
|
-
|
1893
|
-
|
1894
|
-
|
1895
|
-
|
1896
|
-
|
1897
|
-
|
1898
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
1899
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
1900
|
-
```
|
1863
|
+
@checkpoint
|
1864
|
+
@step
|
1865
|
+
def start(self):
|
1866
|
+
with open("my_file.txt", "w") as f:
|
1867
|
+
f.write("Hello, World!")
|
1868
|
+
self.external_bucket_checkpoint = current.checkpoint.save("my_file.txt")
|
1869
|
+
self.next(self.end)
|
1901
1870
|
|
1902
|
-
|
1903
|
-
```
|
1904
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
1905
|
-
```
|
1906
|
-
This is equivalent to:
|
1907
|
-
```
|
1908
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
1909
|
-
```
|
1871
|
+
```
|
1910
1872
|
|
1873
|
+
- Accessing objects stored in external datastores after task execution.
|
1911
1874
|
|
1912
|
-
|
1875
|
+
```python
|
1876
|
+
run = Run("CheckpointsTestsFlow/8992")
|
1877
|
+
with artifact_store_from(run=run, config={
|
1878
|
+
"client_params": {
|
1879
|
+
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1880
|
+
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1881
|
+
},
|
1882
|
+
}):
|
1883
|
+
with Checkpoint() as cp:
|
1884
|
+
latest = cp.list(
|
1885
|
+
task=run["start"].task
|
1886
|
+
)[0]
|
1887
|
+
print(latest)
|
1888
|
+
cp.load(
|
1889
|
+
latest,
|
1890
|
+
"test-checkpoints"
|
1891
|
+
)
|
1892
|
+
|
1893
|
+
task = Task("TorchTuneFlow/8484/train/53673")
|
1894
|
+
with artifact_store_from(run=run, config={
|
1895
|
+
"client_params": {
|
1896
|
+
"aws_access_key_id": os.environ.get("MY_CUSTOM_ACCESS_KEY"),
|
1897
|
+
"aws_secret_access_key": os.environ.get("MY_CUSTOM_SECRET_KEY"),
|
1898
|
+
},
|
1899
|
+
}):
|
1900
|
+
load_model(
|
1901
|
+
task.data.model_ref,
|
1902
|
+
"test-models"
|
1903
|
+
)
|
1904
|
+
```
|
1905
|
+
Parameters:
|
1913
1906
|
----------
|
1914
|
-
|
1915
|
-
|
1916
|
-
|
1917
|
-
|
1918
|
-
|
1919
|
-
|
1907
|
+
|
1908
|
+
type: str
|
1909
|
+
The type of the datastore. Can be one of 's3', 'gcs', 'azure' or any other supported metaflow Datastore.
|
1910
|
+
|
1911
|
+
config: dict or Callable
|
1912
|
+
Dictionary of configuration options for the datastore. The following keys are required:
|
1913
|
+
- root: The root path in the datastore where the data will be saved. (needs to be in the format expected by the datastore)
|
1914
|
+
- example: 's3://bucket-name/path/to/root'
|
1915
|
+
- example: 'gs://bucket-name/path/to/root'
|
1916
|
+
- example: 'https://myblockacc.blob.core.windows.net/metaflow/'
|
1917
|
+
- role_arn (optional): AWS IAM role to access s3 bucket (only when `type` is 's3')
|
1918
|
+
- session_vars (optional): AWS session variables to access s3 bucket (only when `type` is 's3')
|
1919
|
+
- client_params (optional): AWS client parameters to access s3 bucket (only when `type` is 's3')
|
1920
1920
|
"""
|
1921
1921
|
...
|
1922
1922
|
|