ob-metaflow-stubs 6.0.10.8__py2.py3-none-any.whl → 6.0.10.9__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ob-metaflow-stubs might be problematic. Click here for more details.
- metaflow-stubs/__init__.pyi +1012 -1022
- 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 +2 -2
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +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 +57 -60
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +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 +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +110 -97
- 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 +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_state_machine.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/spinners.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_cli.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_config.pyi +2 -2
- 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 +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/config_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/schema_export.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/typed_configs.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/unified_config.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +2 -2
- 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 +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/s3_proxy.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/ob_internal.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +5 -5
- metaflow-stubs/packaging_sys/backend.pyi +3 -3
- metaflow-stubs/packaging_sys/distribution_support.pyi +3 -3
- metaflow-stubs/packaging_sys/tar_backend.pyi +5 -5
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +13 -13
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/argo/exit_hooks.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +2 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +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 +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +3 -3
- metaflow-stubs/plugins/optuna/__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 +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +32 -32
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +2 -2
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +4 -4
- metaflow-stubs/user_decorators/__init__.pyi +2 -2
- metaflow-stubs/user_decorators/common.pyi +2 -2
- metaflow-stubs/user_decorators/mutable_flow.pyi +5 -5
- metaflow-stubs/user_decorators/mutable_step.pyi +5 -5
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +4 -4
- metaflow-stubs/user_decorators/user_step_decorator.pyi +5 -5
- {ob_metaflow_stubs-6.0.10.8.dist-info → ob_metaflow_stubs-6.0.10.9.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.10.9.dist-info/RECORD +262 -0
- ob_metaflow_stubs-6.0.10.8.dist-info/RECORD +0 -262
- {ob_metaflow_stubs-6.0.10.8.dist-info → ob_metaflow_stubs-6.0.10.9.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.10.8.dist-info → ob_metaflow_stubs-6.0.10.9.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
######################################################################################################
|
|
2
2
|
# Auto-generated Metaflow stub file #
|
|
3
|
-
# MF version: 2.18.7.5+obcheckpoint(0.2.
|
|
4
|
-
# Generated on 2025-09-
|
|
3
|
+
# MF version: 2.18.7.5+obcheckpoint(0.2.7);ob(v1) #
|
|
4
|
+
# Generated on 2025-09-23T00:18:02.202668 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
@@ -39,10 +39,10 @@ from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDe
|
|
|
39
39
|
from .user_decorators.user_step_decorator import StepMutator as StepMutator
|
|
40
40
|
from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
|
|
41
41
|
from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
|
|
42
|
-
from . import metaflow_git as metaflow_git
|
|
43
|
-
from . import tuple_util as tuple_util
|
|
44
42
|
from . import cards as cards
|
|
45
43
|
from . import events as events
|
|
44
|
+
from . import metaflow_git as metaflow_git
|
|
45
|
+
from . import tuple_util as tuple_util
|
|
46
46
|
from . import runner as runner
|
|
47
47
|
from . import plugins as plugins
|
|
48
48
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
|
@@ -168,80 +168,154 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
168
168
|
...
|
|
169
169
|
|
|
170
170
|
@typing.overload
|
|
171
|
-
def
|
|
171
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
172
172
|
"""
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
174
|
+
to inject a card and render simple markdown content.
|
|
175
175
|
"""
|
|
176
176
|
...
|
|
177
177
|
|
|
178
178
|
@typing.overload
|
|
179
|
-
def
|
|
179
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
180
180
|
...
|
|
181
181
|
|
|
182
|
-
def
|
|
182
|
+
def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
183
183
|
"""
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
185
|
+
to inject a card and render simple markdown content.
|
|
186
186
|
"""
|
|
187
187
|
...
|
|
188
188
|
|
|
189
|
-
|
|
190
|
-
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
189
|
+
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]]]:
|
|
191
190
|
"""
|
|
192
|
-
|
|
191
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
|
193
192
|
|
|
194
|
-
|
|
193
|
+
User code call
|
|
194
|
+
--------------
|
|
195
|
+
@ollama(
|
|
196
|
+
models=[...],
|
|
197
|
+
...
|
|
198
|
+
)
|
|
195
199
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
200
|
+
Valid backend options
|
|
201
|
+
---------------------
|
|
202
|
+
- 'local': Run as a separate process on the local task machine.
|
|
203
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
204
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
199
205
|
|
|
200
|
-
|
|
201
|
-
|
|
206
|
+
Valid model options
|
|
207
|
+
-------------------
|
|
208
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
202
209
|
|
|
203
210
|
|
|
204
211
|
Parameters
|
|
205
212
|
----------
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
213
|
+
models: list[str]
|
|
214
|
+
List of Ollama containers running models in sidecars.
|
|
215
|
+
backend: str
|
|
216
|
+
Determines where and how to run the Ollama process.
|
|
217
|
+
force_pull: bool
|
|
218
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
219
|
+
cache_update_policy: str
|
|
220
|
+
Cache update policy: "auto", "force", or "never".
|
|
221
|
+
force_cache_update: bool
|
|
222
|
+
Simple override for "force" cache update policy.
|
|
223
|
+
debug: bool
|
|
224
|
+
Whether to turn on verbose debugging logs.
|
|
225
|
+
circuit_breaker_config: dict
|
|
226
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
227
|
+
timeout_config: dict
|
|
228
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
212
229
|
"""
|
|
213
230
|
...
|
|
214
231
|
|
|
215
|
-
|
|
216
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
217
|
-
...
|
|
218
|
-
|
|
219
|
-
@typing.overload
|
|
220
|
-
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
221
|
-
...
|
|
222
|
-
|
|
223
|
-
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
|
232
|
+
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]]]:
|
|
224
233
|
"""
|
|
225
|
-
|
|
234
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
|
226
235
|
|
|
227
|
-
|
|
236
|
+
User code call
|
|
237
|
+
--------------
|
|
238
|
+
@vllm(
|
|
239
|
+
model="...",
|
|
240
|
+
...
|
|
241
|
+
)
|
|
228
242
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
243
|
+
Valid backend options
|
|
244
|
+
---------------------
|
|
245
|
+
- 'local': Run as a separate process on the local task machine.
|
|
232
246
|
|
|
233
|
-
|
|
234
|
-
|
|
247
|
+
Valid model options
|
|
248
|
+
-------------------
|
|
249
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
|
250
|
+
|
|
251
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
|
252
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
|
235
253
|
|
|
236
254
|
|
|
237
255
|
Parameters
|
|
238
256
|
----------
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
257
|
+
model: str
|
|
258
|
+
HuggingFace model identifier to be served by vLLM.
|
|
259
|
+
backend: str
|
|
260
|
+
Determines where and how to run the vLLM process.
|
|
261
|
+
openai_api_server: bool
|
|
262
|
+
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
|
263
|
+
Default is False (uses native engine).
|
|
264
|
+
Set to True for backward compatibility with existing code.
|
|
265
|
+
debug: bool
|
|
266
|
+
Whether to turn on verbose debugging logs.
|
|
267
|
+
card_refresh_interval: int
|
|
268
|
+
Interval in seconds for refreshing the vLLM status card.
|
|
269
|
+
Only used when openai_api_server=True.
|
|
270
|
+
max_retries: int
|
|
271
|
+
Maximum number of retries checking for vLLM server startup.
|
|
272
|
+
Only used when openai_api_server=True.
|
|
273
|
+
retry_alert_frequency: int
|
|
274
|
+
Frequency of alert logs for vLLM server startup retries.
|
|
275
|
+
Only used when openai_api_server=True.
|
|
276
|
+
engine_args : dict
|
|
277
|
+
Additional keyword arguments to pass to the vLLM engine.
|
|
278
|
+
For example, `tensor_parallel_size=2`.
|
|
279
|
+
"""
|
|
280
|
+
...
|
|
281
|
+
|
|
282
|
+
@typing.overload
|
|
283
|
+
def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
284
|
+
"""
|
|
285
|
+
CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
286
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
|
287
|
+
a Neo Cloud like CoreWeave.
|
|
288
|
+
"""
|
|
289
|
+
...
|
|
290
|
+
|
|
291
|
+
@typing.overload
|
|
292
|
+
def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
293
|
+
...
|
|
294
|
+
|
|
295
|
+
def coreweave_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
296
|
+
"""
|
|
297
|
+
CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
298
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
|
299
|
+
a Neo Cloud like CoreWeave.
|
|
300
|
+
"""
|
|
301
|
+
...
|
|
302
|
+
|
|
303
|
+
@typing.overload
|
|
304
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
305
|
+
"""
|
|
306
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
307
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
308
|
+
"""
|
|
309
|
+
...
|
|
310
|
+
|
|
311
|
+
@typing.overload
|
|
312
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
313
|
+
...
|
|
314
|
+
|
|
315
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
316
|
+
"""
|
|
317
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
318
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
245
319
|
"""
|
|
246
320
|
...
|
|
247
321
|
|
|
@@ -260,269 +334,237 @@ def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Cal
|
|
|
260
334
|
...
|
|
261
335
|
|
|
262
336
|
@typing.overload
|
|
263
|
-
def
|
|
337
|
+
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]]]:
|
|
264
338
|
"""
|
|
265
|
-
|
|
339
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
266
340
|
|
|
267
|
-
|
|
268
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
269
|
-
you can use `@conda_base` to set packages required by all
|
|
270
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
341
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
271
342
|
|
|
272
343
|
|
|
273
344
|
Parameters
|
|
274
345
|
----------
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
disabled : bool, default False
|
|
284
|
-
If set to True, disables @conda.
|
|
346
|
+
type : str, default 'default'
|
|
347
|
+
Card type.
|
|
348
|
+
id : str, optional, default None
|
|
349
|
+
If multiple cards are present, use this id to identify this card.
|
|
350
|
+
options : Dict[str, Any], default {}
|
|
351
|
+
Options passed to the card. The contents depend on the card type.
|
|
352
|
+
timeout : int, default 45
|
|
353
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
285
354
|
"""
|
|
286
355
|
...
|
|
287
356
|
|
|
288
357
|
@typing.overload
|
|
289
|
-
def
|
|
358
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
290
359
|
...
|
|
291
360
|
|
|
292
361
|
@typing.overload
|
|
293
|
-
def
|
|
362
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
294
363
|
...
|
|
295
364
|
|
|
296
|
-
def
|
|
365
|
+
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):
|
|
297
366
|
"""
|
|
298
|
-
|
|
367
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
299
368
|
|
|
300
|
-
|
|
301
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
302
|
-
you can use `@conda_base` to set packages required by all
|
|
303
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
369
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
304
370
|
|
|
305
371
|
|
|
306
372
|
Parameters
|
|
307
373
|
----------
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
disabled : bool, default False
|
|
317
|
-
If set to True, disables @conda.
|
|
374
|
+
type : str, default 'default'
|
|
375
|
+
Card type.
|
|
376
|
+
id : str, optional, default None
|
|
377
|
+
If multiple cards are present, use this id to identify this card.
|
|
378
|
+
options : Dict[str, Any], default {}
|
|
379
|
+
Options passed to the card. The contents depend on the card type.
|
|
380
|
+
timeout : int, default 45
|
|
381
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
318
382
|
"""
|
|
319
383
|
...
|
|
320
384
|
|
|
321
385
|
@typing.overload
|
|
322
|
-
def
|
|
386
|
+
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]]]:
|
|
323
387
|
"""
|
|
324
|
-
Specifies
|
|
325
|
-
|
|
326
|
-
Use `@resources` to specify the resource requirements
|
|
327
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
328
|
-
|
|
329
|
-
You can choose the compute layer on the command line by executing e.g.
|
|
330
|
-
```
|
|
331
|
-
python myflow.py run --with batch
|
|
332
|
-
```
|
|
333
|
-
or
|
|
334
|
-
```
|
|
335
|
-
python myflow.py run --with kubernetes
|
|
336
|
-
```
|
|
337
|
-
which executes the flow on the desired system using the
|
|
338
|
-
requirements specified in `@resources`.
|
|
388
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
339
389
|
|
|
340
390
|
|
|
341
391
|
Parameters
|
|
342
392
|
----------
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
gpu : int, optional, default None
|
|
346
|
-
Number of GPUs required for this step.
|
|
347
|
-
disk : int, optional, default None
|
|
348
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
349
|
-
memory : int, default 4096
|
|
350
|
-
Memory size (in MB) required for this step.
|
|
351
|
-
shared_memory : int, optional, default None
|
|
352
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
353
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
393
|
+
vars : Dict[str, str], default {}
|
|
394
|
+
Dictionary of environment variables to set.
|
|
354
395
|
"""
|
|
355
396
|
...
|
|
356
397
|
|
|
357
398
|
@typing.overload
|
|
358
|
-
def
|
|
399
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
359
400
|
...
|
|
360
401
|
|
|
361
402
|
@typing.overload
|
|
362
|
-
def
|
|
403
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
363
404
|
...
|
|
364
405
|
|
|
365
|
-
def
|
|
406
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
366
407
|
"""
|
|
367
|
-
Specifies
|
|
408
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
368
409
|
|
|
369
|
-
Use `@resources` to specify the resource requirements
|
|
370
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
371
410
|
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
411
|
+
Parameters
|
|
412
|
+
----------
|
|
413
|
+
vars : Dict[str, str], default {}
|
|
414
|
+
Dictionary of environment variables to set.
|
|
415
|
+
"""
|
|
416
|
+
...
|
|
417
|
+
|
|
418
|
+
@typing.overload
|
|
419
|
+
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]]]:
|
|
420
|
+
"""
|
|
421
|
+
Specifies the number of times the task corresponding
|
|
422
|
+
to a step needs to be retried.
|
|
423
|
+
|
|
424
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
425
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
426
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
427
|
+
|
|
428
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
429
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
430
|
+
ensuring that the flow execution can continue.
|
|
382
431
|
|
|
383
432
|
|
|
384
433
|
Parameters
|
|
385
434
|
----------
|
|
386
|
-
|
|
387
|
-
Number of
|
|
388
|
-
|
|
389
|
-
Number of
|
|
390
|
-
disk : int, optional, default None
|
|
391
|
-
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
392
|
-
memory : int, default 4096
|
|
393
|
-
Memory size (in MB) required for this step.
|
|
394
|
-
shared_memory : int, optional, default None
|
|
395
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
396
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
435
|
+
times : int, default 3
|
|
436
|
+
Number of times to retry this task.
|
|
437
|
+
minutes_between_retries : int, default 2
|
|
438
|
+
Number of minutes between retries.
|
|
397
439
|
"""
|
|
398
440
|
...
|
|
399
441
|
|
|
400
442
|
@typing.overload
|
|
401
|
-
def
|
|
443
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
444
|
+
...
|
|
445
|
+
|
|
446
|
+
@typing.overload
|
|
447
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
448
|
+
...
|
|
449
|
+
|
|
450
|
+
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):
|
|
402
451
|
"""
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
> Examples
|
|
406
|
-
- Saving Models
|
|
407
|
-
```python
|
|
408
|
-
@model
|
|
409
|
-
@step
|
|
410
|
-
def train(self):
|
|
411
|
-
# current.model.save returns a dictionary reference to the model saved
|
|
412
|
-
self.my_model = current.model.save(
|
|
413
|
-
path_to_my_model,
|
|
414
|
-
label="my_model",
|
|
415
|
-
metadata={
|
|
416
|
-
"epochs": 10,
|
|
417
|
-
"batch-size": 32,
|
|
418
|
-
"learning-rate": 0.001,
|
|
419
|
-
}
|
|
420
|
-
)
|
|
421
|
-
self.next(self.test)
|
|
452
|
+
Specifies the number of times the task corresponding
|
|
453
|
+
to a step needs to be retried.
|
|
422
454
|
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
# `current.model.loaded` returns a dictionary of the loaded models
|
|
427
|
-
# where the key is the name of the artifact and the value is the path to the model
|
|
428
|
-
print(os.listdir(current.model.loaded["my_model"]))
|
|
429
|
-
self.next(self.end)
|
|
430
|
-
```
|
|
455
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
456
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
457
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
431
458
|
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
def train(self):
|
|
436
|
-
# current.model.load returns the path to the model loaded
|
|
437
|
-
checkpoint_path = current.model.load(
|
|
438
|
-
self.checkpoint_key,
|
|
439
|
-
)
|
|
440
|
-
model_path = current.model.load(
|
|
441
|
-
self.model,
|
|
442
|
-
)
|
|
443
|
-
self.next(self.test)
|
|
444
|
-
```
|
|
459
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
460
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
461
|
+
ensuring that the flow execution can continue.
|
|
445
462
|
|
|
446
463
|
|
|
447
464
|
Parameters
|
|
448
465
|
----------
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
466
|
+
times : int, default 3
|
|
467
|
+
Number of times to retry this task.
|
|
468
|
+
minutes_between_retries : int, default 2
|
|
469
|
+
Number of minutes between retries.
|
|
470
|
+
"""
|
|
471
|
+
...
|
|
472
|
+
|
|
473
|
+
@typing.overload
|
|
474
|
+
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]]]:
|
|
475
|
+
"""
|
|
476
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
477
|
+
the execution of a step.
|
|
455
478
|
|
|
456
|
-
|
|
457
|
-
|
|
479
|
+
|
|
480
|
+
Parameters
|
|
481
|
+
----------
|
|
482
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
483
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
484
|
+
role : str, optional, default: None
|
|
485
|
+
Role to use for fetching secrets
|
|
458
486
|
"""
|
|
459
487
|
...
|
|
460
488
|
|
|
461
489
|
@typing.overload
|
|
462
|
-
def
|
|
490
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
463
491
|
...
|
|
464
492
|
|
|
465
493
|
@typing.overload
|
|
466
|
-
def
|
|
494
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
467
495
|
...
|
|
468
496
|
|
|
469
|
-
def
|
|
497
|
+
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):
|
|
470
498
|
"""
|
|
471
|
-
|
|
499
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
500
|
+
the execution of a step.
|
|
472
501
|
|
|
473
|
-
> Examples
|
|
474
|
-
- Saving Models
|
|
475
|
-
```python
|
|
476
|
-
@model
|
|
477
|
-
@step
|
|
478
|
-
def train(self):
|
|
479
|
-
# current.model.save returns a dictionary reference to the model saved
|
|
480
|
-
self.my_model = current.model.save(
|
|
481
|
-
path_to_my_model,
|
|
482
|
-
label="my_model",
|
|
483
|
-
metadata={
|
|
484
|
-
"epochs": 10,
|
|
485
|
-
"batch-size": 32,
|
|
486
|
-
"learning-rate": 0.001,
|
|
487
|
-
}
|
|
488
|
-
)
|
|
489
|
-
self.next(self.test)
|
|
490
502
|
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
503
|
+
Parameters
|
|
504
|
+
----------
|
|
505
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
506
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
507
|
+
role : str, optional, default: None
|
|
508
|
+
Role to use for fetching secrets
|
|
509
|
+
"""
|
|
510
|
+
...
|
|
511
|
+
|
|
512
|
+
@typing.overload
|
|
513
|
+
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]]]:
|
|
514
|
+
"""
|
|
515
|
+
Specifies the Conda environment for the step.
|
|
499
516
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
# current.model.load returns the path to the model loaded
|
|
505
|
-
checkpoint_path = current.model.load(
|
|
506
|
-
self.checkpoint_key,
|
|
507
|
-
)
|
|
508
|
-
model_path = current.model.load(
|
|
509
|
-
self.model,
|
|
510
|
-
)
|
|
511
|
-
self.next(self.test)
|
|
512
|
-
```
|
|
517
|
+
Information in this decorator will augment any
|
|
518
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
519
|
+
you can use `@conda_base` to set packages required by all
|
|
520
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
513
521
|
|
|
514
522
|
|
|
515
523
|
Parameters
|
|
516
524
|
----------
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
525
|
+
packages : Dict[str, str], default {}
|
|
526
|
+
Packages to use for this step. The key is the name of the package
|
|
527
|
+
and the value is the version to use.
|
|
528
|
+
libraries : Dict[str, str], default {}
|
|
529
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
530
|
+
python : str, optional, default None
|
|
531
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
532
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
533
|
+
disabled : bool, default False
|
|
534
|
+
If set to True, disables @conda.
|
|
535
|
+
"""
|
|
536
|
+
...
|
|
537
|
+
|
|
538
|
+
@typing.overload
|
|
539
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
540
|
+
...
|
|
541
|
+
|
|
542
|
+
@typing.overload
|
|
543
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
544
|
+
...
|
|
545
|
+
|
|
546
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
547
|
+
"""
|
|
548
|
+
Specifies the Conda environment for the step.
|
|
523
549
|
|
|
524
|
-
|
|
525
|
-
|
|
550
|
+
Information in this decorator will augment any
|
|
551
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
552
|
+
you can use `@conda_base` to set packages required by all
|
|
553
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
554
|
+
|
|
555
|
+
|
|
556
|
+
Parameters
|
|
557
|
+
----------
|
|
558
|
+
packages : Dict[str, str], default {}
|
|
559
|
+
Packages to use for this step. The key is the name of the package
|
|
560
|
+
and the value is the version to use.
|
|
561
|
+
libraries : Dict[str, str], default {}
|
|
562
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
563
|
+
python : str, optional, default None
|
|
564
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
565
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
566
|
+
disabled : bool, default False
|
|
567
|
+
If set to True, disables @conda.
|
|
526
568
|
"""
|
|
527
569
|
...
|
|
528
570
|
|
|
@@ -578,28 +620,7 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
578
620
|
...
|
|
579
621
|
|
|
580
622
|
@typing.overload
|
|
581
|
-
def
|
|
582
|
-
"""
|
|
583
|
-
CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
584
|
-
It exists to make it easier for users to know that this decorator should only be used with
|
|
585
|
-
a Neo Cloud like CoreWeave.
|
|
586
|
-
"""
|
|
587
|
-
...
|
|
588
|
-
|
|
589
|
-
@typing.overload
|
|
590
|
-
def coreweave_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
591
|
-
...
|
|
592
|
-
|
|
593
|
-
def coreweave_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
594
|
-
"""
|
|
595
|
-
CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
596
|
-
It exists to make it easier for users to know that this decorator should only be used with
|
|
597
|
-
a Neo Cloud like CoreWeave.
|
|
598
|
-
"""
|
|
599
|
-
...
|
|
600
|
-
|
|
601
|
-
@typing.overload
|
|
602
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
623
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
603
624
|
"""
|
|
604
625
|
Decorator prototype for all step decorators. This function gets specialized
|
|
605
626
|
and imported for all decorators types by _import_plugin_decorators().
|
|
@@ -607,479 +628,214 @@ def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Ca
|
|
|
607
628
|
...
|
|
608
629
|
|
|
609
630
|
@typing.overload
|
|
610
|
-
def
|
|
631
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
611
632
|
...
|
|
612
633
|
|
|
613
|
-
def
|
|
634
|
+
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
614
635
|
"""
|
|
615
636
|
Decorator prototype for all step decorators. This function gets specialized
|
|
616
637
|
and imported for all decorators types by _import_plugin_decorators().
|
|
617
638
|
"""
|
|
618
639
|
...
|
|
619
640
|
|
|
620
|
-
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]]]:
|
|
621
|
-
"""
|
|
622
|
-
S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
Parameters
|
|
626
|
-
----------
|
|
627
|
-
integration_name : str, optional
|
|
628
|
-
Name of the S3 proxy integration. If not specified, will use the only
|
|
629
|
-
available S3 proxy integration in the namespace (fails if multiple exist).
|
|
630
|
-
write_mode : str, optional
|
|
631
|
-
The desired behavior during write operations to target (origin) S3 bucket.
|
|
632
|
-
allowed options are:
|
|
633
|
-
"origin-and-cache" -> write to both the target S3 bucket and local object
|
|
634
|
-
storage
|
|
635
|
-
"origin" -> only write to the target S3 bucket
|
|
636
|
-
"cache" -> only write to the object storage service used for caching
|
|
637
|
-
debug : bool, optional
|
|
638
|
-
Enable debug logging for proxy operations.
|
|
639
|
-
"""
|
|
640
|
-
...
|
|
641
|
-
|
|
642
641
|
@typing.overload
|
|
643
|
-
def
|
|
642
|
+
def pypi(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
644
643
|
"""
|
|
645
|
-
Specifies
|
|
644
|
+
Specifies the PyPI packages for the step.
|
|
645
|
+
|
|
646
|
+
Information in this decorator will augment any
|
|
647
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
648
|
+
you can use `@pypi_base` to set packages required by all
|
|
649
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
646
650
|
|
|
647
651
|
|
|
648
652
|
Parameters
|
|
649
653
|
----------
|
|
650
|
-
|
|
651
|
-
|
|
654
|
+
packages : Dict[str, str], default: {}
|
|
655
|
+
Packages to use for this step. The key is the name of the package
|
|
656
|
+
and the value is the version to use.
|
|
657
|
+
python : str, optional, default: None
|
|
658
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
659
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
652
660
|
"""
|
|
653
661
|
...
|
|
654
662
|
|
|
655
663
|
@typing.overload
|
|
656
|
-
def
|
|
664
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
657
665
|
...
|
|
658
666
|
|
|
659
667
|
@typing.overload
|
|
660
|
-
def
|
|
668
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
661
669
|
...
|
|
662
670
|
|
|
663
|
-
def
|
|
671
|
+
def pypi(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
664
672
|
"""
|
|
665
|
-
Specifies
|
|
673
|
+
Specifies the PyPI packages for the step.
|
|
674
|
+
|
|
675
|
+
Information in this decorator will augment any
|
|
676
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
677
|
+
you can use `@pypi_base` to set packages required by all
|
|
678
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
666
679
|
|
|
667
680
|
|
|
668
681
|
Parameters
|
|
669
682
|
----------
|
|
670
|
-
|
|
671
|
-
|
|
683
|
+
packages : Dict[str, str], default: {}
|
|
684
|
+
Packages to use for this step. The key is the name of the package
|
|
685
|
+
and the value is the version to use.
|
|
686
|
+
python : str, optional, default: None
|
|
687
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
688
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
672
689
|
"""
|
|
673
690
|
...
|
|
674
691
|
|
|
675
692
|
@typing.overload
|
|
676
|
-
def
|
|
693
|
+
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
677
694
|
"""
|
|
678
|
-
Enables
|
|
695
|
+
Enables loading / saving of models within a step.
|
|
679
696
|
|
|
680
697
|
> Examples
|
|
681
|
-
|
|
682
|
-
- Saving Checkpoints
|
|
683
|
-
|
|
698
|
+
- Saving Models
|
|
684
699
|
```python
|
|
685
|
-
@
|
|
700
|
+
@model
|
|
686
701
|
@step
|
|
687
702
|
def train(self):
|
|
688
|
-
model
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
name="epoch_checkpoint",
|
|
700
|
-
metadata={
|
|
701
|
-
"epoch": i,
|
|
702
|
-
"loss": loss,
|
|
703
|
-
}
|
|
704
|
-
)
|
|
705
|
-
```
|
|
703
|
+
# current.model.save returns a dictionary reference to the model saved
|
|
704
|
+
self.my_model = current.model.save(
|
|
705
|
+
path_to_my_model,
|
|
706
|
+
label="my_model",
|
|
707
|
+
metadata={
|
|
708
|
+
"epochs": 10,
|
|
709
|
+
"batch-size": 32,
|
|
710
|
+
"learning-rate": 0.001,
|
|
711
|
+
}
|
|
712
|
+
)
|
|
713
|
+
self.next(self.test)
|
|
706
714
|
|
|
707
|
-
|
|
715
|
+
@model(load="my_model")
|
|
716
|
+
@step
|
|
717
|
+
def test(self):
|
|
718
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
|
719
|
+
# where the key is the name of the artifact and the value is the path to the model
|
|
720
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
|
721
|
+
self.next(self.end)
|
|
722
|
+
```
|
|
708
723
|
|
|
724
|
+
- Loading models
|
|
709
725
|
```python
|
|
710
|
-
@retry(times=3)
|
|
711
|
-
@checkpoint
|
|
712
726
|
@step
|
|
713
727
|
def train(self):
|
|
714
|
-
#
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
for i in range(self.epochs):
|
|
723
|
-
...
|
|
728
|
+
# current.model.load returns the path to the model loaded
|
|
729
|
+
checkpoint_path = current.model.load(
|
|
730
|
+
self.checkpoint_key,
|
|
731
|
+
)
|
|
732
|
+
model_path = current.model.load(
|
|
733
|
+
self.model,
|
|
734
|
+
)
|
|
735
|
+
self.next(self.test)
|
|
724
736
|
```
|
|
725
737
|
|
|
726
738
|
|
|
727
739
|
Parameters
|
|
728
740
|
----------
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
736
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
737
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
738
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
741
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
742
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
743
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
|
|
744
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
|
745
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
746
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
739
747
|
|
|
740
748
|
temp_dir_root : str, default: None
|
|
741
|
-
The root directory under which `current.
|
|
749
|
+
The root directory under which `current.model.loaded` will store loaded models
|
|
742
750
|
"""
|
|
743
751
|
...
|
|
744
752
|
|
|
745
753
|
@typing.overload
|
|
746
|
-
def
|
|
754
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
747
755
|
...
|
|
748
756
|
|
|
749
757
|
@typing.overload
|
|
750
|
-
def
|
|
758
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
751
759
|
...
|
|
752
760
|
|
|
753
|
-
def
|
|
761
|
+
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
|
754
762
|
"""
|
|
755
|
-
Enables
|
|
763
|
+
Enables loading / saving of models within a step.
|
|
756
764
|
|
|
757
765
|
> Examples
|
|
758
|
-
|
|
759
|
-
- Saving Checkpoints
|
|
760
|
-
|
|
766
|
+
- Saving Models
|
|
761
767
|
```python
|
|
762
|
-
@
|
|
768
|
+
@model
|
|
763
769
|
@step
|
|
764
770
|
def train(self):
|
|
765
|
-
model
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
name="epoch_checkpoint",
|
|
777
|
-
metadata={
|
|
778
|
-
"epoch": i,
|
|
779
|
-
"loss": loss,
|
|
780
|
-
}
|
|
781
|
-
)
|
|
782
|
-
```
|
|
771
|
+
# current.model.save returns a dictionary reference to the model saved
|
|
772
|
+
self.my_model = current.model.save(
|
|
773
|
+
path_to_my_model,
|
|
774
|
+
label="my_model",
|
|
775
|
+
metadata={
|
|
776
|
+
"epochs": 10,
|
|
777
|
+
"batch-size": 32,
|
|
778
|
+
"learning-rate": 0.001,
|
|
779
|
+
}
|
|
780
|
+
)
|
|
781
|
+
self.next(self.test)
|
|
783
782
|
|
|
784
|
-
|
|
783
|
+
@model(load="my_model")
|
|
784
|
+
@step
|
|
785
|
+
def test(self):
|
|
786
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
|
787
|
+
# where the key is the name of the artifact and the value is the path to the model
|
|
788
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
|
789
|
+
self.next(self.end)
|
|
790
|
+
```
|
|
785
791
|
|
|
792
|
+
- Loading models
|
|
786
793
|
```python
|
|
787
|
-
@retry(times=3)
|
|
788
|
-
@checkpoint
|
|
789
794
|
@step
|
|
790
795
|
def train(self):
|
|
791
|
-
#
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
for i in range(self.epochs):
|
|
800
|
-
...
|
|
796
|
+
# current.model.load returns the path to the model loaded
|
|
797
|
+
checkpoint_path = current.model.load(
|
|
798
|
+
self.checkpoint_key,
|
|
799
|
+
)
|
|
800
|
+
model_path = current.model.load(
|
|
801
|
+
self.model,
|
|
802
|
+
)
|
|
803
|
+
self.next(self.test)
|
|
801
804
|
```
|
|
802
805
|
|
|
803
806
|
|
|
804
807
|
Parameters
|
|
805
808
|
----------
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
813
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
814
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
815
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
816
|
-
|
|
817
|
-
temp_dir_root : str, default: None
|
|
818
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
819
|
-
"""
|
|
820
|
-
...
|
|
821
|
-
|
|
822
|
-
@typing.overload
|
|
823
|
-
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]]]:
|
|
824
|
-
"""
|
|
825
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
826
|
-
the execution of a step.
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
Parameters
|
|
830
|
-
----------
|
|
831
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
832
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
833
|
-
role : str, optional, default: None
|
|
834
|
-
Role to use for fetching secrets
|
|
835
|
-
"""
|
|
836
|
-
...
|
|
837
|
-
|
|
838
|
-
@typing.overload
|
|
839
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
840
|
-
...
|
|
841
|
-
|
|
842
|
-
@typing.overload
|
|
843
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
844
|
-
...
|
|
845
|
-
|
|
846
|
-
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):
|
|
847
|
-
"""
|
|
848
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
849
|
-
the execution of a step.
|
|
850
|
-
|
|
809
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
810
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
811
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
|
|
812
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
|
813
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
814
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
851
815
|
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
855
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
856
|
-
role : str, optional, default: None
|
|
857
|
-
Role to use for fetching secrets
|
|
816
|
+
temp_dir_root : str, default: None
|
|
817
|
+
The root directory under which `current.model.loaded` will store loaded models
|
|
858
818
|
"""
|
|
859
819
|
...
|
|
860
820
|
|
|
861
821
|
@typing.overload
|
|
862
|
-
def
|
|
822
|
+
def nebius_s3_proxy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
863
823
|
"""
|
|
864
|
-
|
|
865
|
-
to
|
|
866
|
-
|
|
867
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
868
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
869
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
870
|
-
|
|
871
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
872
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
873
|
-
ensuring that the flow execution can continue.
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
Parameters
|
|
877
|
-
----------
|
|
878
|
-
times : int, default 3
|
|
879
|
-
Number of times to retry this task.
|
|
880
|
-
minutes_between_retries : int, default 2
|
|
881
|
-
Number of minutes between retries.
|
|
824
|
+
Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
825
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
|
826
|
+
a Neo Cloud like Nebius.
|
|
882
827
|
"""
|
|
883
828
|
...
|
|
884
829
|
|
|
885
830
|
@typing.overload
|
|
886
|
-
def
|
|
887
|
-
...
|
|
888
|
-
|
|
889
|
-
@typing.overload
|
|
890
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
891
|
-
...
|
|
892
|
-
|
|
893
|
-
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):
|
|
894
|
-
"""
|
|
895
|
-
Specifies the number of times the task corresponding
|
|
896
|
-
to a step needs to be retried.
|
|
897
|
-
|
|
898
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
899
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
900
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
901
|
-
|
|
902
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
903
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
904
|
-
ensuring that the flow execution can continue.
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
Parameters
|
|
908
|
-
----------
|
|
909
|
-
times : int, default 3
|
|
910
|
-
Number of times to retry this task.
|
|
911
|
-
minutes_between_retries : int, default 2
|
|
912
|
-
Number of minutes between retries.
|
|
913
|
-
"""
|
|
914
|
-
...
|
|
915
|
-
|
|
916
|
-
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, cache_scope: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
917
|
-
"""
|
|
918
|
-
Decorator that helps cache, version, and store models/datasets from the Hugging Face Hub.
|
|
919
|
-
|
|
920
|
-
> Examples
|
|
921
|
-
|
|
922
|
-
**Usage: creating references to models from the Hugging Face Hub that may be loaded in downstream steps**
|
|
923
|
-
```python
|
|
924
|
-
@huggingface_hub
|
|
925
|
-
@step
|
|
926
|
-
def pull_model_from_huggingface(self):
|
|
927
|
-
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
|
928
|
-
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
|
929
|
-
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
|
930
|
-
# value of the function is a reference to the model in the backend storage.
|
|
931
|
-
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
|
932
|
-
|
|
933
|
-
self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
|
|
934
|
-
self.llama_model = current.huggingface_hub.snapshot_download(
|
|
935
|
-
repo_id=self.model_id,
|
|
936
|
-
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
|
937
|
-
)
|
|
938
|
-
self.next(self.train)
|
|
939
|
-
```
|
|
940
|
-
|
|
941
|
-
**Usage: explicitly loading models at runtime from the Hugging Face Hub or from cache (from Metaflow's datastore)**
|
|
942
|
-
```python
|
|
943
|
-
@huggingface_hub
|
|
944
|
-
@step
|
|
945
|
-
def run_training(self):
|
|
946
|
-
# Temporary directory (auto-cleaned on exit)
|
|
947
|
-
with current.huggingface_hub.load(
|
|
948
|
-
repo_id="google-bert/bert-base-uncased",
|
|
949
|
-
allow_patterns=["*.bin"],
|
|
950
|
-
) as local_path:
|
|
951
|
-
# Use files under local_path
|
|
952
|
-
train_model(local_path)
|
|
953
|
-
...
|
|
954
|
-
|
|
955
|
-
```
|
|
956
|
-
|
|
957
|
-
**Usage: loading models directly from the Hugging Face Hub or from cache (from Metaflow's datastore)**
|
|
958
|
-
```python
|
|
959
|
-
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
|
960
|
-
@step
|
|
961
|
-
def pull_model_from_huggingface(self):
|
|
962
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
963
|
-
```
|
|
964
|
-
|
|
965
|
-
```python
|
|
966
|
-
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora", "/my-lora-directory")])
|
|
967
|
-
@step
|
|
968
|
-
def finetune_model(self):
|
|
969
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
970
|
-
# path_to_model will be /my-directory
|
|
971
|
-
```
|
|
972
|
-
|
|
973
|
-
```python
|
|
974
|
-
# Takes all the arguments passed to `snapshot_download`
|
|
975
|
-
# except for `local_dir`
|
|
976
|
-
@huggingface_hub(load=[
|
|
977
|
-
{
|
|
978
|
-
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
|
979
|
-
},
|
|
980
|
-
{
|
|
981
|
-
"repo_id": "myorg/mistral-lora",
|
|
982
|
-
"repo_type": "model",
|
|
983
|
-
},
|
|
984
|
-
])
|
|
985
|
-
@step
|
|
986
|
-
def finetune_model(self):
|
|
987
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
988
|
-
# path_to_model will be /my-directory
|
|
989
|
-
```
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
Parameters
|
|
993
|
-
----------
|
|
994
|
-
temp_dir_root : str, optional
|
|
995
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
|
996
|
-
|
|
997
|
-
cache_scope : str, optional
|
|
998
|
-
The scope of the cache. Can be `checkpoint` / `flow` / `global`.
|
|
999
|
-
|
|
1000
|
-
- `checkpoint` (default): All repos are stored like objects saved by `@checkpoint`.
|
|
1001
|
-
i.e., the cached path is derived from the namespace, flow, step, and Metaflow foreach iteration.
|
|
1002
|
-
Any repo downloaded under this scope will only be retrieved from the cache when the step runs under the same namespace in the same flow (at the same foreach index).
|
|
1003
|
-
|
|
1004
|
-
- `flow`: All repos are cached under the flow, regardless of namespace.
|
|
1005
|
-
i.e., the cached path is derived solely from the flow name.
|
|
1006
|
-
When to use this mode:
|
|
1007
|
-
- Multiple users are executing the same flow and want shared access to the repos cached by the decorator.
|
|
1008
|
-
- Multiple versions of a flow are deployed, all needing access to the same repos cached by the decorator.
|
|
1009
|
-
|
|
1010
|
-
- `global`: All repos are cached under a globally static path.
|
|
1011
|
-
i.e., the base path of the cache is static and all repos are stored under it.
|
|
1012
|
-
When to use this mode:
|
|
1013
|
-
- All repos from the Hugging Face Hub need to be shared by users across all flow executions.
|
|
1014
|
-
|
|
1015
|
-
Each caching scope comes with its own trade-offs:
|
|
1016
|
-
- `checkpoint`:
|
|
1017
|
-
- Has explicit control over when caches are populated (controlled by the same flow that has the `@huggingface_hub` decorator) but ends up hitting the Hugging Face Hub more often if there are many users/namespaces/steps.
|
|
1018
|
-
- Since objects are written on a `namespace/flow/step` basis, the blast radius of a bad checkpoint is limited to a particular flow in a namespace.
|
|
1019
|
-
- `flow`:
|
|
1020
|
-
- Has less control over when caches are populated (can be written by any execution instance of a flow from any namespace) but results in more cache hits.
|
|
1021
|
-
- The blast radius of a bad checkpoint is limited to all runs of a particular flow.
|
|
1022
|
-
- It doesn't promote cache reuse across flows.
|
|
1023
|
-
- `global`:
|
|
1024
|
-
- Has no control over when caches are populated (can be written by any flow execution) but has the highest cache hit rate.
|
|
1025
|
-
- It promotes cache reuse across flows.
|
|
1026
|
-
- The blast radius of a bad checkpoint spans every flow that could be using a particular repo.
|
|
1027
|
-
|
|
1028
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
|
1029
|
-
The list of repos (models/datasets) to load.
|
|
1030
|
-
|
|
1031
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
|
1032
|
-
|
|
1033
|
-
- If repo (model/dataset) is not found in the datastore:
|
|
1034
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
|
1035
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
|
1036
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
|
1037
|
-
|
|
1038
|
-
- If repo is found in the datastore:
|
|
1039
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
|
1040
|
-
"""
|
|
831
|
+
def nebius_s3_proxy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1041
832
|
...
|
|
1042
833
|
|
|
1043
|
-
def
|
|
834
|
+
def nebius_s3_proxy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
1044
835
|
"""
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
--------------
|
|
1049
|
-
@ollama(
|
|
1050
|
-
models=[...],
|
|
1051
|
-
...
|
|
1052
|
-
)
|
|
1053
|
-
|
|
1054
|
-
Valid backend options
|
|
1055
|
-
---------------------
|
|
1056
|
-
- 'local': Run as a separate process on the local task machine.
|
|
1057
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
1058
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
1059
|
-
|
|
1060
|
-
Valid model options
|
|
1061
|
-
-------------------
|
|
1062
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
Parameters
|
|
1066
|
-
----------
|
|
1067
|
-
models: list[str]
|
|
1068
|
-
List of Ollama containers running models in sidecars.
|
|
1069
|
-
backend: str
|
|
1070
|
-
Determines where and how to run the Ollama process.
|
|
1071
|
-
force_pull: bool
|
|
1072
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
1073
|
-
cache_update_policy: str
|
|
1074
|
-
Cache update policy: "auto", "force", or "never".
|
|
1075
|
-
force_cache_update: bool
|
|
1076
|
-
Simple override for "force" cache update policy.
|
|
1077
|
-
debug: bool
|
|
1078
|
-
Whether to turn on verbose debugging logs.
|
|
1079
|
-
circuit_breaker_config: dict
|
|
1080
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
1081
|
-
timeout_config: dict
|
|
1082
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
836
|
+
Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
837
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
|
838
|
+
a Neo Cloud like Nebius.
|
|
1083
839
|
"""
|
|
1084
840
|
...
|
|
1085
841
|
|
|
@@ -1100,55 +856,6 @@ def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepF
|
|
|
1100
856
|
"""
|
|
1101
857
|
...
|
|
1102
858
|
|
|
1103
|
-
@typing.overload
|
|
1104
|
-
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]]]:
|
|
1105
|
-
"""
|
|
1106
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
1107
|
-
|
|
1108
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
Parameters
|
|
1112
|
-
----------
|
|
1113
|
-
type : str, default 'default'
|
|
1114
|
-
Card type.
|
|
1115
|
-
id : str, optional, default None
|
|
1116
|
-
If multiple cards are present, use this id to identify this card.
|
|
1117
|
-
options : Dict[str, Any], default {}
|
|
1118
|
-
Options passed to the card. The contents depend on the card type.
|
|
1119
|
-
timeout : int, default 45
|
|
1120
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
1121
|
-
"""
|
|
1122
|
-
...
|
|
1123
|
-
|
|
1124
|
-
@typing.overload
|
|
1125
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1126
|
-
...
|
|
1127
|
-
|
|
1128
|
-
@typing.overload
|
|
1129
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1130
|
-
...
|
|
1131
|
-
|
|
1132
|
-
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):
|
|
1133
|
-
"""
|
|
1134
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
1135
|
-
|
|
1136
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
Parameters
|
|
1140
|
-
----------
|
|
1141
|
-
type : str, default 'default'
|
|
1142
|
-
Card type.
|
|
1143
|
-
id : str, optional, default None
|
|
1144
|
-
If multiple cards are present, use this id to identify this card.
|
|
1145
|
-
options : Dict[str, Any], default {}
|
|
1146
|
-
Options passed to the card. The contents depend on the card type.
|
|
1147
|
-
timeout : int, default 45
|
|
1148
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
1149
|
-
"""
|
|
1150
|
-
...
|
|
1151
|
-
|
|
1152
859
|
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[typing.Dict[str, str]] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
1153
860
|
"""
|
|
1154
861
|
Specifies that this step should execute on Kubernetes.
|
|
@@ -1239,202 +946,442 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
|
1239
946
|
...
|
|
1240
947
|
|
|
1241
948
|
@typing.overload
|
|
1242
|
-
def
|
|
1243
|
-
"""
|
|
1244
|
-
A simple decorator that demonstrates using CardDecoratorInjector
|
|
1245
|
-
to inject a card and render simple markdown content.
|
|
1246
|
-
"""
|
|
1247
|
-
...
|
|
1248
|
-
|
|
1249
|
-
@typing.overload
|
|
1250
|
-
def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1251
|
-
...
|
|
1252
|
-
|
|
1253
|
-
def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
1254
|
-
"""
|
|
1255
|
-
A simple decorator that demonstrates using CardDecoratorInjector
|
|
1256
|
-
to inject a card and render simple markdown content.
|
|
949
|
+
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]]]:
|
|
1257
950
|
"""
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
951
|
+
Specifies the resources needed when executing this step.
|
|
952
|
+
|
|
953
|
+
Use `@resources` to specify the resource requirements
|
|
954
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
955
|
+
|
|
956
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
957
|
+
```
|
|
958
|
+
python myflow.py run --with batch
|
|
959
|
+
```
|
|
960
|
+
or
|
|
961
|
+
```
|
|
962
|
+
python myflow.py run --with kubernetes
|
|
963
|
+
```
|
|
964
|
+
which executes the flow on the desired system using the
|
|
965
|
+
requirements specified in `@resources`.
|
|
1263
966
|
|
|
1264
967
|
|
|
1265
968
|
Parameters
|
|
1266
969
|
----------
|
|
1267
|
-
|
|
1268
|
-
Number of
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
970
|
+
cpu : int, default 1
|
|
971
|
+
Number of CPUs required for this step.
|
|
972
|
+
gpu : int, optional, default None
|
|
973
|
+
Number of GPUs required for this step.
|
|
974
|
+
disk : int, optional, default None
|
|
975
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
976
|
+
memory : int, default 4096
|
|
977
|
+
Memory size (in MB) required for this step.
|
|
978
|
+
shared_memory : int, optional, default None
|
|
979
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
980
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
1273
981
|
"""
|
|
1274
982
|
...
|
|
1275
983
|
|
|
1276
984
|
@typing.overload
|
|
1277
|
-
def
|
|
1278
|
-
"""
|
|
1279
|
-
Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
1280
|
-
It exists to make it easier for users to know that this decorator should only be used with
|
|
1281
|
-
a Neo Cloud like Nebius.
|
|
1282
|
-
"""
|
|
985
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1283
986
|
...
|
|
1284
987
|
|
|
1285
988
|
@typing.overload
|
|
1286
|
-
def
|
|
989
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1287
990
|
...
|
|
1288
991
|
|
|
1289
|
-
def
|
|
992
|
+
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):
|
|
1290
993
|
"""
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
994
|
+
Specifies the resources needed when executing this step.
|
|
995
|
+
|
|
996
|
+
Use `@resources` to specify the resource requirements
|
|
997
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
998
|
+
|
|
999
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
1000
|
+
```
|
|
1001
|
+
python myflow.py run --with batch
|
|
1002
|
+
```
|
|
1003
|
+
or
|
|
1004
|
+
```
|
|
1005
|
+
python myflow.py run --with kubernetes
|
|
1006
|
+
```
|
|
1007
|
+
which executes the flow on the desired system using the
|
|
1008
|
+
requirements specified in `@resources`.
|
|
1009
|
+
|
|
1010
|
+
|
|
1011
|
+
Parameters
|
|
1012
|
+
----------
|
|
1013
|
+
cpu : int, default 1
|
|
1014
|
+
Number of CPUs required for this step.
|
|
1015
|
+
gpu : int, optional, default None
|
|
1016
|
+
Number of GPUs required for this step.
|
|
1017
|
+
disk : int, optional, default None
|
|
1018
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
1019
|
+
memory : int, default 4096
|
|
1020
|
+
Memory size (in MB) required for this step.
|
|
1021
|
+
shared_memory : int, optional, default None
|
|
1022
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
1023
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
1024
|
+
"""
|
|
1025
|
+
...
|
|
1026
|
+
|
|
1027
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, cache_scope: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
1028
|
+
"""
|
|
1029
|
+
Decorator that helps cache, version, and store models/datasets from the Hugging Face Hub.
|
|
1030
|
+
|
|
1031
|
+
Examples
|
|
1032
|
+
--------
|
|
1033
|
+
|
|
1034
|
+
```python
|
|
1035
|
+
# **Usage: creating references to models from the Hugging Face Hub that may be loaded in downstream steps**
|
|
1036
|
+
@huggingface_hub
|
|
1037
|
+
@step
|
|
1038
|
+
def pull_model_from_huggingface(self):
|
|
1039
|
+
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
|
1040
|
+
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
|
1041
|
+
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
|
1042
|
+
# value of the function is a reference to the model in the backend storage.
|
|
1043
|
+
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
|
1044
|
+
|
|
1045
|
+
self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
|
|
1046
|
+
self.llama_model = current.huggingface_hub.snapshot_download(
|
|
1047
|
+
repo_id=self.model_id,
|
|
1048
|
+
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
|
1049
|
+
)
|
|
1050
|
+
self.next(self.train)
|
|
1051
|
+
|
|
1052
|
+
# **Usage: explicitly loading models at runtime from the Hugging Face Hub or from cache (from Metaflow's datastore)**
|
|
1053
|
+
@huggingface_hub
|
|
1054
|
+
@step
|
|
1055
|
+
def run_training(self):
|
|
1056
|
+
# Temporary directory (auto-cleaned on exit)
|
|
1057
|
+
with current.huggingface_hub.load(
|
|
1058
|
+
repo_id="google-bert/bert-base-uncased",
|
|
1059
|
+
allow_patterns=["*.bin"],
|
|
1060
|
+
) as local_path:
|
|
1061
|
+
# Use files under local_path
|
|
1062
|
+
train_model(local_path)
|
|
1063
|
+
...
|
|
1064
|
+
|
|
1065
|
+
# **Usage: loading models directly from the Hugging Face Hub or from cache (from Metaflow's datastore)**
|
|
1066
|
+
|
|
1067
|
+
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
|
1068
|
+
@step
|
|
1069
|
+
def pull_model_from_huggingface(self):
|
|
1070
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
1071
|
+
|
|
1072
|
+
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora", "/my-lora-directory")])
|
|
1073
|
+
@step
|
|
1074
|
+
def finetune_model(self):
|
|
1075
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
1076
|
+
# path_to_model will be /my-directory
|
|
1077
|
+
|
|
1078
|
+
|
|
1079
|
+
# Takes all the arguments passed to `snapshot_download`
|
|
1080
|
+
# except for `local_dir`
|
|
1081
|
+
@huggingface_hub(load=[
|
|
1082
|
+
{
|
|
1083
|
+
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
"repo_id": "myorg/mistral-lora",
|
|
1087
|
+
"repo_type": "model",
|
|
1088
|
+
},
|
|
1089
|
+
])
|
|
1090
|
+
@step
|
|
1091
|
+
def finetune_model(self):
|
|
1092
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
1093
|
+
# path_to_model will be /my-directory
|
|
1094
|
+
```
|
|
1095
|
+
|
|
1096
|
+
|
|
1097
|
+
Parameters
|
|
1098
|
+
----------
|
|
1099
|
+
temp_dir_root : str, optional
|
|
1100
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
|
1101
|
+
|
|
1102
|
+
cache_scope : str, optional
|
|
1103
|
+
The scope of the cache. Can be `checkpoint` / `flow` / `global`.
|
|
1104
|
+
- `checkpoint` (default): All repos are stored like objects saved by `@checkpoint`.
|
|
1105
|
+
i.e., the cached path is derived from the namespace, flow, step, and Metaflow foreach iteration.
|
|
1106
|
+
Any repo downloaded under this scope will only be retrieved from the cache when the step runs under the same namespace in the same flow (at the same foreach index).
|
|
1107
|
+
|
|
1108
|
+
- `flow`: All repos are cached under the flow, regardless of namespace.
|
|
1109
|
+
i.e., the cached path is derived solely from the flow name.
|
|
1110
|
+
When to use this mode: (1) Multiple users are executing the same flow and want shared access to the repos cached by the decorator. (2) Multiple versions of a flow are deployed, all needing access to the same repos cached by the decorator.
|
|
1111
|
+
|
|
1112
|
+
- `global`: All repos are cached under a globally static path.
|
|
1113
|
+
i.e., the base path of the cache is static and all repos are stored under it.
|
|
1114
|
+
When to use this mode:
|
|
1115
|
+
- All repos from the Hugging Face Hub need to be shared by users across all flow executions.
|
|
1116
|
+
- Each caching scope comes with its own trade-offs:
|
|
1117
|
+
- `checkpoint`:
|
|
1118
|
+
- Has explicit control over when caches are populated (controlled by the same flow that has the `@huggingface_hub` decorator) but ends up hitting the Hugging Face Hub more often if there are many users/namespaces/steps.
|
|
1119
|
+
- Since objects are written on a `namespace/flow/step` basis, the blast radius of a bad checkpoint is limited to a particular flow in a namespace.
|
|
1120
|
+
- `flow`:
|
|
1121
|
+
- Has less control over when caches are populated (can be written by any execution instance of a flow from any namespace) but results in more cache hits.
|
|
1122
|
+
- The blast radius of a bad checkpoint is limited to all runs of a particular flow.
|
|
1123
|
+
- It doesn't promote cache reuse across flows.
|
|
1124
|
+
- `global`:
|
|
1125
|
+
- Has no control over when caches are populated (can be written by any flow execution) but has the highest cache hit rate.
|
|
1126
|
+
- It promotes cache reuse across flows.
|
|
1127
|
+
- The blast radius of a bad checkpoint spans every flow that could be using a particular repo.
|
|
1128
|
+
|
|
1129
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
|
1130
|
+
The list of repos (models/datasets) to load.
|
|
1131
|
+
|
|
1132
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
|
1133
|
+
|
|
1134
|
+
- If repo (model/dataset) is not found in the datastore:
|
|
1135
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
|
1136
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
|
1137
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
|
1138
|
+
|
|
1139
|
+
- If repo is found in the datastore:
|
|
1140
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
|
1294
1141
|
"""
|
|
1295
1142
|
...
|
|
1296
1143
|
|
|
1297
1144
|
@typing.overload
|
|
1298
|
-
def
|
|
1145
|
+
def timeout(*, seconds: int = 0, minutes: int = 0, hours: int = 0) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
1299
1146
|
"""
|
|
1300
|
-
Specifies
|
|
1147
|
+
Specifies a timeout for your step.
|
|
1301
1148
|
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1149
|
+
This decorator is useful if this step may hang indefinitely.
|
|
1150
|
+
|
|
1151
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
1152
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
1153
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
1154
|
+
|
|
1155
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
1156
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
1306
1157
|
|
|
1307
1158
|
|
|
1308
1159
|
Parameters
|
|
1309
1160
|
----------
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1315
|
-
|
|
1161
|
+
seconds : int, default 0
|
|
1162
|
+
Number of seconds to wait prior to timing out.
|
|
1163
|
+
minutes : int, default 0
|
|
1164
|
+
Number of minutes to wait prior to timing out.
|
|
1165
|
+
hours : int, default 0
|
|
1166
|
+
Number of hours to wait prior to timing out.
|
|
1316
1167
|
"""
|
|
1317
1168
|
...
|
|
1318
1169
|
|
|
1319
1170
|
@typing.overload
|
|
1320
|
-
def
|
|
1171
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1321
1172
|
...
|
|
1322
1173
|
|
|
1323
1174
|
@typing.overload
|
|
1324
|
-
def
|
|
1175
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1325
1176
|
...
|
|
1326
1177
|
|
|
1327
|
-
def
|
|
1178
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
|
1328
1179
|
"""
|
|
1329
|
-
Specifies
|
|
1180
|
+
Specifies a timeout for your step.
|
|
1330
1181
|
|
|
1331
|
-
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1182
|
+
This decorator is useful if this step may hang indefinitely.
|
|
1183
|
+
|
|
1184
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
1185
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
1186
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
1187
|
+
|
|
1188
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
1189
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
1335
1190
|
|
|
1336
1191
|
|
|
1337
1192
|
Parameters
|
|
1338
1193
|
----------
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
|
|
1344
|
-
|
|
1194
|
+
seconds : int, default 0
|
|
1195
|
+
Number of seconds to wait prior to timing out.
|
|
1196
|
+
minutes : int, default 0
|
|
1197
|
+
Number of minutes to wait prior to timing out.
|
|
1198
|
+
hours : int, default 0
|
|
1199
|
+
Number of hours to wait prior to timing out.
|
|
1345
1200
|
"""
|
|
1346
1201
|
...
|
|
1347
1202
|
|
|
1348
|
-
|
|
1203
|
+
@typing.overload
|
|
1204
|
+
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]]]:
|
|
1349
1205
|
"""
|
|
1350
|
-
|
|
1206
|
+
Enables checkpointing for a step.
|
|
1351
1207
|
|
|
1352
|
-
|
|
1353
|
-
--------------
|
|
1354
|
-
@vllm(
|
|
1355
|
-
model="...",
|
|
1356
|
-
...
|
|
1357
|
-
)
|
|
1208
|
+
> Examples
|
|
1358
1209
|
|
|
1359
|
-
|
|
1360
|
-
---------------------
|
|
1361
|
-
- 'local': Run as a separate process on the local task machine.
|
|
1210
|
+
- Saving Checkpoints
|
|
1362
1211
|
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1212
|
+
```python
|
|
1213
|
+
@checkpoint
|
|
1214
|
+
@step
|
|
1215
|
+
def train(self):
|
|
1216
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
|
1217
|
+
for i in range(self.epochs):
|
|
1218
|
+
# some training logic
|
|
1219
|
+
loss = model.train(self.dataset)
|
|
1220
|
+
if i % 10 == 0:
|
|
1221
|
+
model.save(
|
|
1222
|
+
current.checkpoint.directory,
|
|
1223
|
+
)
|
|
1224
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
1225
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
1226
|
+
self.latest_checkpoint = current.checkpoint.save(
|
|
1227
|
+
name="epoch_checkpoint",
|
|
1228
|
+
metadata={
|
|
1229
|
+
"epoch": i,
|
|
1230
|
+
"loss": loss,
|
|
1231
|
+
}
|
|
1232
|
+
)
|
|
1233
|
+
```
|
|
1366
1234
|
|
|
1367
|
-
|
|
1368
|
-
|
|
1235
|
+
- Using Loaded Checkpoints
|
|
1236
|
+
|
|
1237
|
+
```python
|
|
1238
|
+
@retry(times=3)
|
|
1239
|
+
@checkpoint
|
|
1240
|
+
@step
|
|
1241
|
+
def train(self):
|
|
1242
|
+
# Assume that the task has restarted and the previous attempt of the task
|
|
1243
|
+
# saved a checkpoint
|
|
1244
|
+
checkpoint_path = None
|
|
1245
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
1246
|
+
print("Loaded checkpoint from the previous attempt")
|
|
1247
|
+
checkpoint_path = current.checkpoint.directory
|
|
1248
|
+
|
|
1249
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
1250
|
+
for i in range(self.epochs):
|
|
1251
|
+
...
|
|
1252
|
+
```
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
Parameters
|
|
1256
|
+
----------
|
|
1257
|
+
load_policy : str, default: "fresh"
|
|
1258
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
1259
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
1260
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
1261
|
+
will be loaded at the start of the task.
|
|
1262
|
+
- "none": Do not load any checkpoint
|
|
1263
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
1264
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
1265
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
1266
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
1267
|
+
|
|
1268
|
+
temp_dir_root : str, default: None
|
|
1269
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
1270
|
+
"""
|
|
1271
|
+
...
|
|
1272
|
+
|
|
1273
|
+
@typing.overload
|
|
1274
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1275
|
+
...
|
|
1276
|
+
|
|
1277
|
+
@typing.overload
|
|
1278
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1279
|
+
...
|
|
1280
|
+
|
|
1281
|
+
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):
|
|
1282
|
+
"""
|
|
1283
|
+
Enables checkpointing for a step.
|
|
1284
|
+
|
|
1285
|
+
> Examples
|
|
1286
|
+
|
|
1287
|
+
- Saving Checkpoints
|
|
1288
|
+
|
|
1289
|
+
```python
|
|
1290
|
+
@checkpoint
|
|
1291
|
+
@step
|
|
1292
|
+
def train(self):
|
|
1293
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
|
1294
|
+
for i in range(self.epochs):
|
|
1295
|
+
# some training logic
|
|
1296
|
+
loss = model.train(self.dataset)
|
|
1297
|
+
if i % 10 == 0:
|
|
1298
|
+
model.save(
|
|
1299
|
+
current.checkpoint.directory,
|
|
1300
|
+
)
|
|
1301
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
1302
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
1303
|
+
self.latest_checkpoint = current.checkpoint.save(
|
|
1304
|
+
name="epoch_checkpoint",
|
|
1305
|
+
metadata={
|
|
1306
|
+
"epoch": i,
|
|
1307
|
+
"loss": loss,
|
|
1308
|
+
}
|
|
1309
|
+
)
|
|
1310
|
+
```
|
|
1311
|
+
|
|
1312
|
+
- Using Loaded Checkpoints
|
|
1313
|
+
|
|
1314
|
+
```python
|
|
1315
|
+
@retry(times=3)
|
|
1316
|
+
@checkpoint
|
|
1317
|
+
@step
|
|
1318
|
+
def train(self):
|
|
1319
|
+
# Assume that the task has restarted and the previous attempt of the task
|
|
1320
|
+
# saved a checkpoint
|
|
1321
|
+
checkpoint_path = None
|
|
1322
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
1323
|
+
print("Loaded checkpoint from the previous attempt")
|
|
1324
|
+
checkpoint_path = current.checkpoint.directory
|
|
1325
|
+
|
|
1326
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
1327
|
+
for i in range(self.epochs):
|
|
1328
|
+
...
|
|
1329
|
+
```
|
|
1330
|
+
|
|
1331
|
+
|
|
1332
|
+
Parameters
|
|
1333
|
+
----------
|
|
1334
|
+
load_policy : str, default: "fresh"
|
|
1335
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
1336
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
1337
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
1338
|
+
will be loaded at the start of the task.
|
|
1339
|
+
- "none": Do not load any checkpoint
|
|
1340
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
1341
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
1342
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
1343
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
1344
|
+
|
|
1345
|
+
temp_dir_root : str, default: None
|
|
1346
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
1347
|
+
"""
|
|
1348
|
+
...
|
|
1349
|
+
|
|
1350
|
+
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]]]:
|
|
1351
|
+
"""
|
|
1352
|
+
Specifies that this step should execute on DGX cloud.
|
|
1369
1353
|
|
|
1370
1354
|
|
|
1371
1355
|
Parameters
|
|
1372
1356
|
----------
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
Default is False (uses native engine).
|
|
1380
|
-
Set to True for backward compatibility with existing code.
|
|
1381
|
-
debug: bool
|
|
1382
|
-
Whether to turn on verbose debugging logs.
|
|
1383
|
-
card_refresh_interval: int
|
|
1384
|
-
Interval in seconds for refreshing the vLLM status card.
|
|
1385
|
-
Only used when openai_api_server=True.
|
|
1386
|
-
max_retries: int
|
|
1387
|
-
Maximum number of retries checking for vLLM server startup.
|
|
1388
|
-
Only used when openai_api_server=True.
|
|
1389
|
-
retry_alert_frequency: int
|
|
1390
|
-
Frequency of alert logs for vLLM server startup retries.
|
|
1391
|
-
Only used when openai_api_server=True.
|
|
1392
|
-
engine_args : dict
|
|
1393
|
-
Additional keyword arguments to pass to the vLLM engine.
|
|
1394
|
-
For example, `tensor_parallel_size=2`.
|
|
1357
|
+
gpu : int
|
|
1358
|
+
Number of GPUs to use.
|
|
1359
|
+
gpu_type : str
|
|
1360
|
+
Type of Nvidia GPU to use.
|
|
1361
|
+
queue_timeout : int
|
|
1362
|
+
Time to keep the job in NVCF's queue.
|
|
1395
1363
|
"""
|
|
1396
1364
|
...
|
|
1397
1365
|
|
|
1398
|
-
def
|
|
1366
|
+
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]]]:
|
|
1399
1367
|
"""
|
|
1400
|
-
|
|
1401
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1402
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1403
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1404
|
-
starts only after all sensors finish.
|
|
1368
|
+
S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
1405
1369
|
|
|
1406
1370
|
|
|
1407
1371
|
Parameters
|
|
1408
1372
|
----------
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1422
|
-
name : str
|
|
1423
|
-
Name of the sensor on Airflow
|
|
1424
|
-
description : str
|
|
1425
|
-
Description of sensor in the Airflow UI
|
|
1426
|
-
bucket_key : Union[str, List[str]]
|
|
1427
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1428
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1429
|
-
bucket_name : str
|
|
1430
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1431
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1432
|
-
wildcard_match : bool
|
|
1433
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1434
|
-
aws_conn_id : str
|
|
1435
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1436
|
-
verify : bool
|
|
1437
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1373
|
+
integration_name : str, optional
|
|
1374
|
+
Name of the S3 proxy integration. If not specified, will use the only
|
|
1375
|
+
available S3 proxy integration in the namespace (fails if multiple exist).
|
|
1376
|
+
write_mode : str, optional
|
|
1377
|
+
The desired behavior during write operations to target (origin) S3 bucket.
|
|
1378
|
+
allowed options are:
|
|
1379
|
+
"origin-and-cache" -> write to both the target S3 bucket and local object
|
|
1380
|
+
storage
|
|
1381
|
+
"origin" -> only write to the target S3 bucket
|
|
1382
|
+
"cache" -> only write to the object storage service used for caching
|
|
1383
|
+
debug : bool, optional
|
|
1384
|
+
Enable debug logging for proxy operations.
|
|
1438
1385
|
"""
|
|
1439
1386
|
...
|
|
1440
1387
|
|
|
@@ -1489,152 +1436,13 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
|
1489
1436
|
"""
|
|
1490
1437
|
...
|
|
1491
1438
|
|
|
1492
|
-
|
|
1493
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1494
|
-
"""
|
|
1495
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
1496
|
-
|
|
1497
|
-
Use `@pypi_base` to set common packages required by all
|
|
1498
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1499
|
-
|
|
1500
|
-
Parameters
|
|
1501
|
-
----------
|
|
1502
|
-
packages : Dict[str, str], default: {}
|
|
1503
|
-
Packages to use for this flow. The key is the name of the package
|
|
1504
|
-
and the value is the version to use.
|
|
1505
|
-
python : str, optional, default: None
|
|
1506
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1507
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1508
|
-
"""
|
|
1509
|
-
...
|
|
1510
|
-
|
|
1511
|
-
@typing.overload
|
|
1512
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1513
|
-
...
|
|
1514
|
-
|
|
1515
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1516
|
-
"""
|
|
1517
|
-
Specifies the PyPI packages for all steps of the flow.
|
|
1518
|
-
|
|
1519
|
-
Use `@pypi_base` to set common packages required by all
|
|
1520
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1521
|
-
|
|
1522
|
-
Parameters
|
|
1523
|
-
----------
|
|
1524
|
-
packages : Dict[str, str], default: {}
|
|
1525
|
-
Packages to use for this flow. The key is the name of the package
|
|
1526
|
-
and the value is the version to use.
|
|
1527
|
-
python : str, optional, default: None
|
|
1528
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1529
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1530
|
-
"""
|
|
1531
|
-
...
|
|
1532
|
-
|
|
1533
|
-
@typing.overload
|
|
1534
|
-
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1535
|
-
"""
|
|
1536
|
-
Specifies the flow(s) that this flow depends on.
|
|
1537
|
-
|
|
1538
|
-
```
|
|
1539
|
-
@trigger_on_finish(flow='FooFlow')
|
|
1540
|
-
```
|
|
1541
|
-
or
|
|
1542
|
-
```
|
|
1543
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1544
|
-
```
|
|
1545
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1546
|
-
when upstream runs within the same namespace complete successfully
|
|
1547
|
-
|
|
1548
|
-
Additionally, you can specify project aware upstream flow dependencies
|
|
1549
|
-
by specifying the fully qualified project_flow_name.
|
|
1550
|
-
```
|
|
1551
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1552
|
-
```
|
|
1553
|
-
or
|
|
1554
|
-
```
|
|
1555
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1556
|
-
```
|
|
1557
|
-
|
|
1558
|
-
You can also specify just the project or project branch (other values will be
|
|
1559
|
-
inferred from the current project or project branch):
|
|
1560
|
-
```
|
|
1561
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1562
|
-
```
|
|
1563
|
-
|
|
1564
|
-
Note that `branch` is typically one of:
|
|
1565
|
-
- `prod`
|
|
1566
|
-
- `user.bob`
|
|
1567
|
-
- `test.my_experiment`
|
|
1568
|
-
- `prod.staging`
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
Parameters
|
|
1572
|
-
----------
|
|
1573
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
|
1574
|
-
Upstream flow dependency for this flow.
|
|
1575
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
|
1576
|
-
Upstream flow dependencies for this flow.
|
|
1577
|
-
options : Dict[str, Any], default {}
|
|
1578
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
1579
|
-
"""
|
|
1580
|
-
...
|
|
1581
|
-
|
|
1582
|
-
@typing.overload
|
|
1583
|
-
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1584
|
-
...
|
|
1585
|
-
|
|
1586
|
-
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
1587
|
-
"""
|
|
1588
|
-
Specifies the flow(s) that this flow depends on.
|
|
1589
|
-
|
|
1590
|
-
```
|
|
1591
|
-
@trigger_on_finish(flow='FooFlow')
|
|
1592
|
-
```
|
|
1593
|
-
or
|
|
1594
|
-
```
|
|
1595
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1596
|
-
```
|
|
1597
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1598
|
-
when upstream runs within the same namespace complete successfully
|
|
1599
|
-
|
|
1600
|
-
Additionally, you can specify project aware upstream flow dependencies
|
|
1601
|
-
by specifying the fully qualified project_flow_name.
|
|
1602
|
-
```
|
|
1603
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1604
|
-
```
|
|
1605
|
-
or
|
|
1606
|
-
```
|
|
1607
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1608
|
-
```
|
|
1609
|
-
|
|
1610
|
-
You can also specify just the project or project branch (other values will be
|
|
1611
|
-
inferred from the current project or project branch):
|
|
1612
|
-
```
|
|
1613
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1614
|
-
```
|
|
1615
|
-
|
|
1616
|
-
Note that `branch` is typically one of:
|
|
1617
|
-
- `prod`
|
|
1618
|
-
- `user.bob`
|
|
1619
|
-
- `test.my_experiment`
|
|
1620
|
-
- `prod.staging`
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
Parameters
|
|
1624
|
-
----------
|
|
1625
|
-
flow : Union[str, Dict[str, str]], optional, default None
|
|
1626
|
-
Upstream flow dependency for this flow.
|
|
1627
|
-
flows : List[Union[str, Dict[str, str]]], default []
|
|
1628
|
-
Upstream flow dependencies for this flow.
|
|
1629
|
-
options : Dict[str, Any], default {}
|
|
1630
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
1631
|
-
"""
|
|
1632
|
-
...
|
|
1633
|
-
|
|
1634
|
-
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]]:
|
|
1439
|
+
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]]:
|
|
1635
1440
|
"""
|
|
1636
|
-
The `@
|
|
1637
|
-
This decorator only works when a flow is scheduled on Airflow
|
|
1441
|
+
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)
|
|
1442
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1443
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1444
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1445
|
+
starts only after all sensors finish.
|
|
1638
1446
|
|
|
1639
1447
|
|
|
1640
1448
|
Parameters
|
|
@@ -1656,21 +1464,18 @@ def airflow_external_task_sensor(*, timeout: int, poke_interval: int, mode: str,
|
|
|
1656
1464
|
Name of the sensor on Airflow
|
|
1657
1465
|
description : str
|
|
1658
1466
|
Description of sensor in the Airflow UI
|
|
1659
|
-
|
|
1660
|
-
The
|
|
1661
|
-
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
check_existence: bool
|
|
1672
|
-
Set to True to check if the external task exists or check if
|
|
1673
|
-
the DAG to wait for exists. (Default: True)
|
|
1467
|
+
bucket_key : Union[str, List[str]]
|
|
1468
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1469
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1470
|
+
bucket_name : str
|
|
1471
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1472
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1473
|
+
wildcard_match : bool
|
|
1474
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1475
|
+
aws_conn_id : str
|
|
1476
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1477
|
+
verify : bool
|
|
1478
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1674
1479
|
"""
|
|
1675
1480
|
...
|
|
1676
1481
|
|
|
@@ -1788,41 +1593,6 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
|
1788
1593
|
"""
|
|
1789
1594
|
...
|
|
1790
1595
|
|
|
1791
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1792
|
-
"""
|
|
1793
|
-
Specifies what flows belong to the same project.
|
|
1794
|
-
|
|
1795
|
-
A project-specific namespace is created for all flows that
|
|
1796
|
-
use the same `@project(name)`.
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
Parameters
|
|
1800
|
-
----------
|
|
1801
|
-
name : str
|
|
1802
|
-
Project name. Make sure that the name is unique amongst all
|
|
1803
|
-
projects that use the same production scheduler. The name may
|
|
1804
|
-
contain only lowercase alphanumeric characters and underscores.
|
|
1805
|
-
|
|
1806
|
-
branch : Optional[str], default None
|
|
1807
|
-
The branch to use. If not specified, the branch is set to
|
|
1808
|
-
`user.<username>` unless `production` is set to `True`. This can
|
|
1809
|
-
also be set on the command line using `--branch` as a top-level option.
|
|
1810
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
|
1811
|
-
|
|
1812
|
-
production : bool, default False
|
|
1813
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
1814
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
1815
|
-
`production` in the decorator and on the command line.
|
|
1816
|
-
The project branch name will be:
|
|
1817
|
-
- if `branch` is specified:
|
|
1818
|
-
- if `production` is True: `prod.<branch>`
|
|
1819
|
-
- if `production` is False: `test.<branch>`
|
|
1820
|
-
- if `branch` is not specified:
|
|
1821
|
-
- if `production` is True: `prod`
|
|
1822
|
-
- if `production` is False: `user.<username>`
|
|
1823
|
-
"""
|
|
1824
|
-
...
|
|
1825
|
-
|
|
1826
1596
|
@typing.overload
|
|
1827
1597
|
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]]:
|
|
1828
1598
|
"""
|
|
@@ -1874,6 +1644,148 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
|
1874
1644
|
"""
|
|
1875
1645
|
...
|
|
1876
1646
|
|
|
1647
|
+
@typing.overload
|
|
1648
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1649
|
+
"""
|
|
1650
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1651
|
+
|
|
1652
|
+
Use `@pypi_base` to set common packages required by all
|
|
1653
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1654
|
+
|
|
1655
|
+
Parameters
|
|
1656
|
+
----------
|
|
1657
|
+
packages : Dict[str, str], default: {}
|
|
1658
|
+
Packages to use for this flow. The key is the name of the package
|
|
1659
|
+
and the value is the version to use.
|
|
1660
|
+
python : str, optional, default: None
|
|
1661
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1662
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1663
|
+
"""
|
|
1664
|
+
...
|
|
1665
|
+
|
|
1666
|
+
@typing.overload
|
|
1667
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1668
|
+
...
|
|
1669
|
+
|
|
1670
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1671
|
+
"""
|
|
1672
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1673
|
+
|
|
1674
|
+
Use `@pypi_base` to set common packages required by all
|
|
1675
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1676
|
+
|
|
1677
|
+
Parameters
|
|
1678
|
+
----------
|
|
1679
|
+
packages : Dict[str, str], default: {}
|
|
1680
|
+
Packages to use for this flow. The key is the name of the package
|
|
1681
|
+
and the value is the version to use.
|
|
1682
|
+
python : str, optional, default: None
|
|
1683
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1684
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1685
|
+
"""
|
|
1686
|
+
...
|
|
1687
|
+
|
|
1688
|
+
@typing.overload
|
|
1689
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1690
|
+
"""
|
|
1691
|
+
Specifies the flow(s) that this flow depends on.
|
|
1692
|
+
|
|
1693
|
+
```
|
|
1694
|
+
@trigger_on_finish(flow='FooFlow')
|
|
1695
|
+
```
|
|
1696
|
+
or
|
|
1697
|
+
```
|
|
1698
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1699
|
+
```
|
|
1700
|
+
This decorator respects the @project decorator and triggers the flow
|
|
1701
|
+
when upstream runs within the same namespace complete successfully
|
|
1702
|
+
|
|
1703
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
1704
|
+
by specifying the fully qualified project_flow_name.
|
|
1705
|
+
```
|
|
1706
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1707
|
+
```
|
|
1708
|
+
or
|
|
1709
|
+
```
|
|
1710
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1711
|
+
```
|
|
1712
|
+
|
|
1713
|
+
You can also specify just the project or project branch (other values will be
|
|
1714
|
+
inferred from the current project or project branch):
|
|
1715
|
+
```
|
|
1716
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1717
|
+
```
|
|
1718
|
+
|
|
1719
|
+
Note that `branch` is typically one of:
|
|
1720
|
+
- `prod`
|
|
1721
|
+
- `user.bob`
|
|
1722
|
+
- `test.my_experiment`
|
|
1723
|
+
- `prod.staging`
|
|
1724
|
+
|
|
1725
|
+
|
|
1726
|
+
Parameters
|
|
1727
|
+
----------
|
|
1728
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1729
|
+
Upstream flow dependency for this flow.
|
|
1730
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1731
|
+
Upstream flow dependencies for this flow.
|
|
1732
|
+
options : Dict[str, Any], default {}
|
|
1733
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1734
|
+
"""
|
|
1735
|
+
...
|
|
1736
|
+
|
|
1737
|
+
@typing.overload
|
|
1738
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1739
|
+
...
|
|
1740
|
+
|
|
1741
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
1742
|
+
"""
|
|
1743
|
+
Specifies the flow(s) that this flow depends on.
|
|
1744
|
+
|
|
1745
|
+
```
|
|
1746
|
+
@trigger_on_finish(flow='FooFlow')
|
|
1747
|
+
```
|
|
1748
|
+
or
|
|
1749
|
+
```
|
|
1750
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1751
|
+
```
|
|
1752
|
+
This decorator respects the @project decorator and triggers the flow
|
|
1753
|
+
when upstream runs within the same namespace complete successfully
|
|
1754
|
+
|
|
1755
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
1756
|
+
by specifying the fully qualified project_flow_name.
|
|
1757
|
+
```
|
|
1758
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1759
|
+
```
|
|
1760
|
+
or
|
|
1761
|
+
```
|
|
1762
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1763
|
+
```
|
|
1764
|
+
|
|
1765
|
+
You can also specify just the project or project branch (other values will be
|
|
1766
|
+
inferred from the current project or project branch):
|
|
1767
|
+
```
|
|
1768
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1769
|
+
```
|
|
1770
|
+
|
|
1771
|
+
Note that `branch` is typically one of:
|
|
1772
|
+
- `prod`
|
|
1773
|
+
- `user.bob`
|
|
1774
|
+
- `test.my_experiment`
|
|
1775
|
+
- `prod.staging`
|
|
1776
|
+
|
|
1777
|
+
|
|
1778
|
+
Parameters
|
|
1779
|
+
----------
|
|
1780
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1781
|
+
Upstream flow dependency for this flow.
|
|
1782
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1783
|
+
Upstream flow dependencies for this flow.
|
|
1784
|
+
options : Dict[str, Any], default {}
|
|
1785
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1786
|
+
"""
|
|
1787
|
+
...
|
|
1788
|
+
|
|
1877
1789
|
@typing.overload
|
|
1878
1790
|
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]]:
|
|
1879
1791
|
"""
|
|
@@ -1967,5 +1879,83 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
|
1967
1879
|
"""
|
|
1968
1880
|
...
|
|
1969
1881
|
|
|
1882
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1883
|
+
"""
|
|
1884
|
+
Specifies what flows belong to the same project.
|
|
1885
|
+
|
|
1886
|
+
A project-specific namespace is created for all flows that
|
|
1887
|
+
use the same `@project(name)`.
|
|
1888
|
+
|
|
1889
|
+
|
|
1890
|
+
Parameters
|
|
1891
|
+
----------
|
|
1892
|
+
name : str
|
|
1893
|
+
Project name. Make sure that the name is unique amongst all
|
|
1894
|
+
projects that use the same production scheduler. The name may
|
|
1895
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1896
|
+
|
|
1897
|
+
branch : Optional[str], default None
|
|
1898
|
+
The branch to use. If not specified, the branch is set to
|
|
1899
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1900
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1901
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1902
|
+
|
|
1903
|
+
production : bool, default False
|
|
1904
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1905
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1906
|
+
`production` in the decorator and on the command line.
|
|
1907
|
+
The project branch name will be:
|
|
1908
|
+
- if `branch` is specified:
|
|
1909
|
+
- if `production` is True: `prod.<branch>`
|
|
1910
|
+
- if `production` is False: `test.<branch>`
|
|
1911
|
+
- if `branch` is not specified:
|
|
1912
|
+
- if `production` is True: `prod`
|
|
1913
|
+
- if `production` is False: `user.<username>`
|
|
1914
|
+
"""
|
|
1915
|
+
...
|
|
1916
|
+
|
|
1917
|
+
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]]:
|
|
1918
|
+
"""
|
|
1919
|
+
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.
|
|
1920
|
+
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.
|
|
1921
|
+
|
|
1922
|
+
|
|
1923
|
+
Parameters
|
|
1924
|
+
----------
|
|
1925
|
+
timeout : int
|
|
1926
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1927
|
+
poke_interval : int
|
|
1928
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1929
|
+
mode : str
|
|
1930
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1931
|
+
exponential_backoff : bool
|
|
1932
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1933
|
+
pool : str
|
|
1934
|
+
the slot pool this task should run in,
|
|
1935
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1936
|
+
soft_fail : bool
|
|
1937
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1938
|
+
name : str
|
|
1939
|
+
Name of the sensor on Airflow
|
|
1940
|
+
description : str
|
|
1941
|
+
Description of sensor in the Airflow UI
|
|
1942
|
+
external_dag_id : str
|
|
1943
|
+
The dag_id that contains the task you want to wait for.
|
|
1944
|
+
external_task_ids : List[str]
|
|
1945
|
+
The list of task_ids that you want to wait for.
|
|
1946
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1947
|
+
allowed_states : List[str]
|
|
1948
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1949
|
+
failed_states : List[str]
|
|
1950
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1951
|
+
execution_delta : datetime.timedelta
|
|
1952
|
+
time difference with the previous execution to look at,
|
|
1953
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1954
|
+
check_existence: bool
|
|
1955
|
+
Set to True to check if the external task exists or check if
|
|
1956
|
+
the DAG to wait for exists. (Default: True)
|
|
1957
|
+
"""
|
|
1958
|
+
...
|
|
1959
|
+
|
|
1970
1960
|
pkg_name: str
|
|
1971
1961
|
|