ob-metaflow-stubs 6.0.3.188rc3__py2.py3-none-any.whl → 6.0.4.0__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- metaflow-stubs/__init__.pyi +682 -678
- 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 +3 -3
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +6 -6
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/info_file.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 +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +53 -53
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +3 -3
- 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 +41 -32
- 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 +5 -5
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/click_importer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/code_packager.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/config_utils.pyi +12 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/schema_export.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/typed_configs.pyi +32 -28
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/unified_config.pyi +5 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/deployer.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/experimental/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/perimeters.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/utils.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +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 +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/ob_internal.pyi +2 -2
- metaflow-stubs/parameters.pyi +2 -2
- metaflow-stubs/plugins/__init__.pyi +13 -11
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +7 -34
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +3 -3
- metaflow-stubs/plugins/argo/exit_hooks.pyi +45 -0
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +4 -4
- 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 +4 -3
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +14 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +10 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +3 -3
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +4 -4
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/__init__.pyi +11 -0
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +20 -0
- 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 +3 -3
- 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/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +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 +6 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +9 -49
- metaflow-stubs/plugins/secrets/secrets_func.pyi +31 -0
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +42 -0
- metaflow-stubs/plugins/secrets/utils.pyi +28 -0
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +3 -3
- metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +29 -29
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +3 -3
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +5 -5
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +5 -5
- {ob_metaflow_stubs-6.0.3.188rc3.dist-info → ob_metaflow_stubs-6.0.4.0.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.4.0.dist-info/RECORD +249 -0
- ob_metaflow_stubs-6.0.3.188rc3.dist-info/RECORD +0 -243
- {ob_metaflow_stubs-6.0.3.188rc3.dist-info → ob_metaflow_stubs-6.0.4.0.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.3.188rc3.dist-info → ob_metaflow_stubs-6.0.4.0.dist-info}/top_level.txt +0 -0
metaflow-stubs/__init__.pyi
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
######################################################################################################
|
2
2
|
# Auto-generated Metaflow stub file #
|
3
|
-
# MF version: 2.15.
|
4
|
-
# Generated on 2025-07-
|
3
|
+
# MF version: 2.15.21.1+obcheckpoint(0.2.4);ob(v1) #
|
4
|
+
# Generated on 2025-07-11T23:29:18.665907 #
|
5
5
|
######################################################################################################
|
6
6
|
|
7
7
|
from __future__ import annotations
|
8
8
|
|
9
9
|
import typing
|
10
10
|
if typing.TYPE_CHECKING:
|
11
|
-
import datetime
|
12
11
|
import typing
|
12
|
+
import datetime
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
15
15
|
|
@@ -37,16 +37,16 @@ from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDec
|
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
38
38
|
from . import cards as cards
|
39
39
|
from . import tuple_util as tuple_util
|
40
|
-
from . import metaflow_git as metaflow_git
|
41
40
|
from . import events as events
|
41
|
+
from . import metaflow_git as metaflow_git
|
42
42
|
from . import runner as runner
|
43
43
|
from . import plugins as plugins
|
44
44
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
45
45
|
from . import includefile as includefile
|
46
46
|
from .includefile import IncludeFile as IncludeFile
|
47
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
48
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
47
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
48
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
49
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
50
50
|
from . import client as client
|
51
51
|
from .client.core import namespace as namespace
|
52
52
|
from .client.core import get_namespace as get_namespace
|
@@ -157,92 +157,145 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
157
157
|
...
|
158
158
|
|
159
159
|
@typing.overload
|
160
|
-
def
|
160
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
161
161
|
"""
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
166
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
167
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
168
|
-
|
169
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
170
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
171
|
-
ensuring that the flow execution can continue.
|
172
|
-
|
173
|
-
|
174
|
-
Parameters
|
175
|
-
----------
|
176
|
-
times : int, default 3
|
177
|
-
Number of times to retry this task.
|
178
|
-
minutes_between_retries : int, default 2
|
179
|
-
Number of minutes between retries.
|
162
|
+
Decorator prototype for all step decorators. This function gets specialized
|
163
|
+
and imported for all decorators types by _import_plugin_decorators().
|
180
164
|
"""
|
181
165
|
...
|
182
166
|
|
183
167
|
@typing.overload
|
184
|
-
def
|
168
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
185
169
|
...
|
186
170
|
|
187
|
-
|
188
|
-
|
171
|
+
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
172
|
+
"""
|
173
|
+
Decorator prototype for all step decorators. This function gets specialized
|
174
|
+
and imported for all decorators types by _import_plugin_decorators().
|
175
|
+
"""
|
189
176
|
...
|
190
177
|
|
191
|
-
def
|
178
|
+
def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
192
179
|
"""
|
193
|
-
Specifies
|
194
|
-
to a step needs to be retried.
|
195
|
-
|
196
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
197
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
198
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
199
|
-
|
200
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
201
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
202
|
-
ensuring that the flow execution can continue.
|
180
|
+
Specifies that this step should execute on DGX cloud.
|
203
181
|
|
204
182
|
|
205
183
|
Parameters
|
206
184
|
----------
|
207
|
-
|
208
|
-
Number of
|
209
|
-
|
210
|
-
|
185
|
+
gpu : int
|
186
|
+
Number of GPUs to use.
|
187
|
+
gpu_type : str
|
188
|
+
Type of Nvidia GPU to use.
|
211
189
|
"""
|
212
190
|
...
|
213
191
|
|
214
192
|
@typing.overload
|
215
|
-
def
|
193
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
216
194
|
"""
|
217
|
-
|
218
|
-
the execution of a step.
|
219
|
-
|
220
|
-
|
221
|
-
Parameters
|
222
|
-
----------
|
223
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
224
|
-
List of secret specs, defining how the secrets are to be retrieved
|
195
|
+
Internal decorator to support Fast bakery
|
225
196
|
"""
|
226
197
|
...
|
227
198
|
|
228
199
|
@typing.overload
|
229
|
-
def
|
200
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
230
201
|
...
|
231
202
|
|
232
|
-
|
233
|
-
|
203
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
204
|
+
"""
|
205
|
+
Internal decorator to support Fast bakery
|
206
|
+
"""
|
234
207
|
...
|
235
208
|
|
236
|
-
def
|
209
|
+
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]]]:
|
237
210
|
"""
|
238
|
-
|
239
|
-
|
211
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
212
|
+
|
213
|
+
User code call
|
214
|
+
--------------
|
215
|
+
@vllm(
|
216
|
+
model="...",
|
217
|
+
...
|
218
|
+
)
|
219
|
+
|
220
|
+
Valid backend options
|
221
|
+
---------------------
|
222
|
+
- 'local': Run as a separate process on the local task machine.
|
223
|
+
|
224
|
+
Valid model options
|
225
|
+
-------------------
|
226
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
227
|
+
|
228
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
229
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
240
230
|
|
241
231
|
|
242
232
|
Parameters
|
243
233
|
----------
|
244
|
-
|
245
|
-
|
234
|
+
model: str
|
235
|
+
HuggingFace model identifier to be served by vLLM.
|
236
|
+
backend: str
|
237
|
+
Determines where and how to run the vLLM process.
|
238
|
+
openai_api_server: bool
|
239
|
+
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
240
|
+
Default is False (uses native engine).
|
241
|
+
Set to True for backward compatibility with existing code.
|
242
|
+
debug: bool
|
243
|
+
Whether to turn on verbose debugging logs.
|
244
|
+
card_refresh_interval: int
|
245
|
+
Interval in seconds for refreshing the vLLM status card.
|
246
|
+
Only used when openai_api_server=True.
|
247
|
+
max_retries: int
|
248
|
+
Maximum number of retries checking for vLLM server startup.
|
249
|
+
Only used when openai_api_server=True.
|
250
|
+
retry_alert_frequency: int
|
251
|
+
Frequency of alert logs for vLLM server startup retries.
|
252
|
+
Only used when openai_api_server=True.
|
253
|
+
engine_args : dict
|
254
|
+
Additional keyword arguments to pass to the vLLM engine.
|
255
|
+
For example, `tensor_parallel_size=2`.
|
256
|
+
"""
|
257
|
+
...
|
258
|
+
|
259
|
+
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]]]:
|
260
|
+
"""
|
261
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
262
|
+
|
263
|
+
User code call
|
264
|
+
--------------
|
265
|
+
@ollama(
|
266
|
+
models=[...],
|
267
|
+
...
|
268
|
+
)
|
269
|
+
|
270
|
+
Valid backend options
|
271
|
+
---------------------
|
272
|
+
- 'local': Run as a separate process on the local task machine.
|
273
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
274
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
275
|
+
|
276
|
+
Valid model options
|
277
|
+
-------------------
|
278
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
279
|
+
|
280
|
+
|
281
|
+
Parameters
|
282
|
+
----------
|
283
|
+
models: list[str]
|
284
|
+
List of Ollama containers running models in sidecars.
|
285
|
+
backend: str
|
286
|
+
Determines where and how to run the Ollama process.
|
287
|
+
force_pull: bool
|
288
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
289
|
+
cache_update_policy: str
|
290
|
+
Cache update policy: "auto", "force", or "never".
|
291
|
+
force_cache_update: bool
|
292
|
+
Simple override for "force" cache update policy.
|
293
|
+
debug: bool
|
294
|
+
Whether to turn on verbose debugging logs.
|
295
|
+
circuit_breaker_config: dict
|
296
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
297
|
+
timeout_config: dict
|
298
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
246
299
|
"""
|
247
300
|
...
|
248
301
|
|
@@ -394,131 +447,171 @@ def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None
|
|
394
447
|
...
|
395
448
|
|
396
449
|
@typing.overload
|
397
|
-
def
|
450
|
+
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]]]:
|
398
451
|
"""
|
399
|
-
|
452
|
+
Specifies the resources needed when executing this step.
|
400
453
|
|
401
|
-
|
402
|
-
|
403
|
-
```python
|
404
|
-
@model
|
405
|
-
@step
|
406
|
-
def train(self):
|
407
|
-
# current.model.save returns a dictionary reference to the model saved
|
408
|
-
self.my_model = current.model.save(
|
409
|
-
path_to_my_model,
|
410
|
-
label="my_model",
|
411
|
-
metadata={
|
412
|
-
"epochs": 10,
|
413
|
-
"batch-size": 32,
|
414
|
-
"learning-rate": 0.001,
|
415
|
-
}
|
416
|
-
)
|
417
|
-
self.next(self.test)
|
454
|
+
Use `@resources` to specify the resource requirements
|
455
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
418
456
|
|
419
|
-
|
420
|
-
@step
|
421
|
-
def test(self):
|
422
|
-
# `current.model.loaded` returns a dictionary of the loaded models
|
423
|
-
# where the key is the name of the artifact and the value is the path to the model
|
424
|
-
print(os.listdir(current.model.loaded["my_model"]))
|
425
|
-
self.next(self.end)
|
457
|
+
You can choose the compute layer on the command line by executing e.g.
|
426
458
|
```
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
432
|
-
# current.model.load returns the path to the model loaded
|
433
|
-
checkpoint_path = current.model.load(
|
434
|
-
self.checkpoint_key,
|
435
|
-
)
|
436
|
-
model_path = current.model.load(
|
437
|
-
self.model,
|
438
|
-
)
|
439
|
-
self.next(self.test)
|
459
|
+
python myflow.py run --with batch
|
460
|
+
```
|
461
|
+
or
|
462
|
+
```
|
463
|
+
python myflow.py run --with kubernetes
|
440
464
|
```
|
465
|
+
which executes the flow on the desired system using the
|
466
|
+
requirements specified in `@resources`.
|
441
467
|
|
442
468
|
|
443
469
|
Parameters
|
444
470
|
----------
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
471
|
+
cpu : int, default 1
|
472
|
+
Number of CPUs required for this step.
|
473
|
+
gpu : int, optional, default None
|
474
|
+
Number of GPUs required for this step.
|
475
|
+
disk : int, optional, default None
|
476
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
477
|
+
memory : int, default 4096
|
478
|
+
Memory size (in MB) required for this step.
|
479
|
+
shared_memory : int, optional, default None
|
480
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
481
|
+
This parameter maps to the `--shm-size` option in Docker.
|
454
482
|
"""
|
455
483
|
...
|
456
484
|
|
457
485
|
@typing.overload
|
458
|
-
def
|
486
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
459
487
|
...
|
460
488
|
|
461
489
|
@typing.overload
|
462
|
-
def
|
490
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
463
491
|
...
|
464
492
|
|
465
|
-
def
|
493
|
+
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):
|
466
494
|
"""
|
467
|
-
|
495
|
+
Specifies the resources needed when executing this step.
|
468
496
|
|
469
|
-
|
470
|
-
|
471
|
-
```python
|
472
|
-
@model
|
473
|
-
@step
|
474
|
-
def train(self):
|
475
|
-
# current.model.save returns a dictionary reference to the model saved
|
476
|
-
self.my_model = current.model.save(
|
477
|
-
path_to_my_model,
|
478
|
-
label="my_model",
|
479
|
-
metadata={
|
480
|
-
"epochs": 10,
|
481
|
-
"batch-size": 32,
|
482
|
-
"learning-rate": 0.001,
|
483
|
-
}
|
484
|
-
)
|
485
|
-
self.next(self.test)
|
497
|
+
Use `@resources` to specify the resource requirements
|
498
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
486
499
|
|
487
|
-
|
488
|
-
@step
|
489
|
-
def test(self):
|
490
|
-
# `current.model.loaded` returns a dictionary of the loaded models
|
491
|
-
# where the key is the name of the artifact and the value is the path to the model
|
492
|
-
print(os.listdir(current.model.loaded["my_model"]))
|
493
|
-
self.next(self.end)
|
500
|
+
You can choose the compute layer on the command line by executing e.g.
|
494
501
|
```
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
# current.model.load returns the path to the model loaded
|
501
|
-
checkpoint_path = current.model.load(
|
502
|
-
self.checkpoint_key,
|
503
|
-
)
|
504
|
-
model_path = current.model.load(
|
505
|
-
self.model,
|
506
|
-
)
|
507
|
-
self.next(self.test)
|
502
|
+
python myflow.py run --with batch
|
503
|
+
```
|
504
|
+
or
|
505
|
+
```
|
506
|
+
python myflow.py run --with kubernetes
|
508
507
|
```
|
508
|
+
which executes the flow on the desired system using the
|
509
|
+
requirements specified in `@resources`.
|
509
510
|
|
510
511
|
|
511
512
|
Parameters
|
512
513
|
----------
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
514
|
+
cpu : int, default 1
|
515
|
+
Number of CPUs required for this step.
|
516
|
+
gpu : int, optional, default None
|
517
|
+
Number of GPUs required for this step.
|
518
|
+
disk : int, optional, default None
|
519
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
520
|
+
memory : int, default 4096
|
521
|
+
Memory size (in MB) required for this step.
|
522
|
+
shared_memory : int, optional, default None
|
523
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
524
|
+
This parameter maps to the `--shm-size` option in Docker.
|
525
|
+
"""
|
526
|
+
...
|
527
|
+
|
528
|
+
@typing.overload
|
529
|
+
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]]]:
|
530
|
+
"""
|
531
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
532
|
+
the execution of a step.
|
519
533
|
|
520
|
-
|
521
|
-
|
534
|
+
|
535
|
+
Parameters
|
536
|
+
----------
|
537
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
538
|
+
List of secret specs, defining how the secrets are to be retrieved
|
539
|
+
role : str, optional, default: None
|
540
|
+
Role to use for fetching secrets
|
541
|
+
"""
|
542
|
+
...
|
543
|
+
|
544
|
+
@typing.overload
|
545
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
546
|
+
...
|
547
|
+
|
548
|
+
@typing.overload
|
549
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
550
|
+
...
|
551
|
+
|
552
|
+
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):
|
553
|
+
"""
|
554
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
555
|
+
the execution of a step.
|
556
|
+
|
557
|
+
|
558
|
+
Parameters
|
559
|
+
----------
|
560
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
561
|
+
List of secret specs, defining how the secrets are to be retrieved
|
562
|
+
role : str, optional, default: None
|
563
|
+
Role to use for fetching secrets
|
564
|
+
"""
|
565
|
+
...
|
566
|
+
|
567
|
+
@typing.overload
|
568
|
+
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]]]:
|
569
|
+
"""
|
570
|
+
Specifies the PyPI packages for the step.
|
571
|
+
|
572
|
+
Information in this decorator will augment any
|
573
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
574
|
+
you can use `@pypi_base` to set packages required by all
|
575
|
+
steps and use `@pypi` to specify step-specific overrides.
|
576
|
+
|
577
|
+
|
578
|
+
Parameters
|
579
|
+
----------
|
580
|
+
packages : Dict[str, str], default: {}
|
581
|
+
Packages to use for this step. The key is the name of the package
|
582
|
+
and the value is the version to use.
|
583
|
+
python : str, optional, default: None
|
584
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
585
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
586
|
+
"""
|
587
|
+
...
|
588
|
+
|
589
|
+
@typing.overload
|
590
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
591
|
+
...
|
592
|
+
|
593
|
+
@typing.overload
|
594
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
595
|
+
...
|
596
|
+
|
597
|
+
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):
|
598
|
+
"""
|
599
|
+
Specifies the PyPI packages for the step.
|
600
|
+
|
601
|
+
Information in this decorator will augment any
|
602
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
603
|
+
you can use `@pypi_base` to set packages required by all
|
604
|
+
steps and use `@pypi` to specify step-specific overrides.
|
605
|
+
|
606
|
+
|
607
|
+
Parameters
|
608
|
+
----------
|
609
|
+
packages : Dict[str, str], default: {}
|
610
|
+
Packages to use for this step. The key is the name of the package
|
611
|
+
and the value is the version to use.
|
612
|
+
python : str, optional, default: None
|
613
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
614
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
522
615
|
"""
|
523
616
|
...
|
524
617
|
|
@@ -538,6 +631,61 @@ def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[t
|
|
538
631
|
"""
|
539
632
|
...
|
540
633
|
|
634
|
+
@typing.overload
|
635
|
+
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]]]:
|
636
|
+
"""
|
637
|
+
Specifies the number of times the task corresponding
|
638
|
+
to a step needs to be retried.
|
639
|
+
|
640
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
641
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
642
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
643
|
+
|
644
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
645
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
646
|
+
ensuring that the flow execution can continue.
|
647
|
+
|
648
|
+
|
649
|
+
Parameters
|
650
|
+
----------
|
651
|
+
times : int, default 3
|
652
|
+
Number of times to retry this task.
|
653
|
+
minutes_between_retries : int, default 2
|
654
|
+
Number of minutes between retries.
|
655
|
+
"""
|
656
|
+
...
|
657
|
+
|
658
|
+
@typing.overload
|
659
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
660
|
+
...
|
661
|
+
|
662
|
+
@typing.overload
|
663
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
664
|
+
...
|
665
|
+
|
666
|
+
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):
|
667
|
+
"""
|
668
|
+
Specifies the number of times the task corresponding
|
669
|
+
to a step needs to be retried.
|
670
|
+
|
671
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
672
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
673
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
674
|
+
|
675
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
676
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
677
|
+
ensuring that the flow execution can continue.
|
678
|
+
|
679
|
+
|
680
|
+
Parameters
|
681
|
+
----------
|
682
|
+
times : int, default 3
|
683
|
+
Number of times to retry this task.
|
684
|
+
minutes_between_retries : int, default 2
|
685
|
+
Number of minutes between retries.
|
686
|
+
"""
|
687
|
+
...
|
688
|
+
|
541
689
|
@typing.overload
|
542
690
|
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]]]:
|
543
691
|
"""
|
@@ -598,53 +746,51 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
598
746
|
...
|
599
747
|
|
600
748
|
@typing.overload
|
601
|
-
def
|
749
|
+
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]]]:
|
602
750
|
"""
|
603
|
-
|
751
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
604
752
|
|
605
|
-
|
606
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
607
|
-
you can use `@pypi_base` to set packages required by all
|
608
|
-
steps and use `@pypi` to specify step-specific overrides.
|
753
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
609
754
|
|
610
755
|
|
611
756
|
Parameters
|
612
757
|
----------
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
758
|
+
type : str, default 'default'
|
759
|
+
Card type.
|
760
|
+
id : str, optional, default None
|
761
|
+
If multiple cards are present, use this id to identify this card.
|
762
|
+
options : Dict[str, Any], default {}
|
763
|
+
Options passed to the card. The contents depend on the card type.
|
764
|
+
timeout : int, default 45
|
765
|
+
Interrupt reporting if it takes more than this many seconds.
|
619
766
|
"""
|
620
767
|
...
|
621
768
|
|
622
769
|
@typing.overload
|
623
|
-
def
|
770
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
624
771
|
...
|
625
772
|
|
626
773
|
@typing.overload
|
627
|
-
def
|
774
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
628
775
|
...
|
629
776
|
|
630
|
-
def
|
777
|
+
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):
|
631
778
|
"""
|
632
|
-
|
779
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
633
780
|
|
634
|
-
|
635
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
636
|
-
you can use `@pypi_base` to set packages required by all
|
637
|
-
steps and use `@pypi` to specify step-specific overrides.
|
781
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
638
782
|
|
639
783
|
|
640
784
|
Parameters
|
641
785
|
----------
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
|
647
|
-
|
786
|
+
type : str, default 'default'
|
787
|
+
Card type.
|
788
|
+
id : str, optional, default None
|
789
|
+
If multiple cards are present, use this id to identify this card.
|
790
|
+
options : Dict[str, Any], default {}
|
791
|
+
Options passed to the card. The contents depend on the card type.
|
792
|
+
timeout : int, default 45
|
793
|
+
Interrupt reporting if it takes more than this many seconds.
|
648
794
|
"""
|
649
795
|
...
|
650
796
|
|
@@ -699,149 +845,12 @@ def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
699
845
|
"""
|
700
846
|
...
|
701
847
|
|
702
|
-
|
848
|
+
@typing.overload
|
849
|
+
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]]]:
|
703
850
|
"""
|
704
|
-
|
851
|
+
Specifies a timeout for your step.
|
705
852
|
|
706
|
-
|
707
|
-
|
708
|
-
**Usage: creating references of models from huggingface that may be loaded in downstream steps**
|
709
|
-
```python
|
710
|
-
@huggingface_hub
|
711
|
-
@step
|
712
|
-
def pull_model_from_huggingface(self):
|
713
|
-
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
714
|
-
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
715
|
-
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
716
|
-
# value of the function is a reference to the model in the backend storage.
|
717
|
-
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
718
|
-
|
719
|
-
self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
|
720
|
-
self.llama_model = current.huggingface_hub.snapshot_download(
|
721
|
-
repo_id=self.model_id,
|
722
|
-
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
723
|
-
)
|
724
|
-
self.next(self.train)
|
725
|
-
```
|
726
|
-
|
727
|
-
**Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
|
728
|
-
```python
|
729
|
-
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
730
|
-
@step
|
731
|
-
def pull_model_from_huggingface(self):
|
732
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
733
|
-
```
|
734
|
-
|
735
|
-
```python
|
736
|
-
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
|
737
|
-
@step
|
738
|
-
def finetune_model(self):
|
739
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
740
|
-
# path_to_model will be /my-directory
|
741
|
-
```
|
742
|
-
|
743
|
-
```python
|
744
|
-
# Takes all the arguments passed to `snapshot_download`
|
745
|
-
# except for `local_dir`
|
746
|
-
@huggingface_hub(load=[
|
747
|
-
{
|
748
|
-
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
749
|
-
},
|
750
|
-
{
|
751
|
-
"repo_id": "myorg/mistral-lora",
|
752
|
-
"repo_type": "model",
|
753
|
-
},
|
754
|
-
])
|
755
|
-
@step
|
756
|
-
def finetune_model(self):
|
757
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
758
|
-
# path_to_model will be /my-directory
|
759
|
-
```
|
760
|
-
|
761
|
-
|
762
|
-
Parameters
|
763
|
-
----------
|
764
|
-
temp_dir_root : str, optional
|
765
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
766
|
-
|
767
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
768
|
-
The list of repos (models/datasets) to load.
|
769
|
-
|
770
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
771
|
-
|
772
|
-
- If repo (model/dataset) is not found in the datastore:
|
773
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
774
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
775
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
776
|
-
|
777
|
-
- If repo is found in the datastore:
|
778
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
779
|
-
"""
|
780
|
-
...
|
781
|
-
|
782
|
-
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]]]:
|
783
|
-
"""
|
784
|
-
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
785
|
-
|
786
|
-
User code call
|
787
|
-
--------------
|
788
|
-
@ollama(
|
789
|
-
models=[...],
|
790
|
-
...
|
791
|
-
)
|
792
|
-
|
793
|
-
Valid backend options
|
794
|
-
---------------------
|
795
|
-
- 'local': Run as a separate process on the local task machine.
|
796
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
797
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
798
|
-
|
799
|
-
Valid model options
|
800
|
-
-------------------
|
801
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
802
|
-
|
803
|
-
|
804
|
-
Parameters
|
805
|
-
----------
|
806
|
-
models: list[str]
|
807
|
-
List of Ollama containers running models in sidecars.
|
808
|
-
backend: str
|
809
|
-
Determines where and how to run the Ollama process.
|
810
|
-
force_pull: bool
|
811
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
812
|
-
cache_update_policy: str
|
813
|
-
Cache update policy: "auto", "force", or "never".
|
814
|
-
force_cache_update: bool
|
815
|
-
Simple override for "force" cache update policy.
|
816
|
-
debug: bool
|
817
|
-
Whether to turn on verbose debugging logs.
|
818
|
-
circuit_breaker_config: dict
|
819
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
820
|
-
timeout_config: dict
|
821
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
822
|
-
"""
|
823
|
-
...
|
824
|
-
|
825
|
-
def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
826
|
-
"""
|
827
|
-
Specifies that this step should execute on DGX cloud.
|
828
|
-
|
829
|
-
|
830
|
-
Parameters
|
831
|
-
----------
|
832
|
-
gpu : int
|
833
|
-
Number of GPUs to use.
|
834
|
-
gpu_type : str
|
835
|
-
Type of Nvidia GPU to use.
|
836
|
-
"""
|
837
|
-
...
|
838
|
-
|
839
|
-
@typing.overload
|
840
|
-
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]]]:
|
841
|
-
"""
|
842
|
-
Specifies a timeout for your step.
|
843
|
-
|
844
|
-
This decorator is useful if this step may hang indefinitely.
|
853
|
+
This decorator is useful if this step may hang indefinitely.
|
845
854
|
|
846
855
|
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
847
856
|
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
@@ -895,56 +904,6 @@ def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
895
904
|
"""
|
896
905
|
...
|
897
906
|
|
898
|
-
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]]]:
|
899
|
-
"""
|
900
|
-
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
901
|
-
|
902
|
-
User code call
|
903
|
-
--------------
|
904
|
-
@vllm(
|
905
|
-
model="...",
|
906
|
-
...
|
907
|
-
)
|
908
|
-
|
909
|
-
Valid backend options
|
910
|
-
---------------------
|
911
|
-
- 'local': Run as a separate process on the local task machine.
|
912
|
-
|
913
|
-
Valid model options
|
914
|
-
-------------------
|
915
|
-
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
916
|
-
|
917
|
-
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
918
|
-
If you need multiple models, you must create multiple @vllm decorators.
|
919
|
-
|
920
|
-
|
921
|
-
Parameters
|
922
|
-
----------
|
923
|
-
model: str
|
924
|
-
HuggingFace model identifier to be served by vLLM.
|
925
|
-
backend: str
|
926
|
-
Determines where and how to run the vLLM process.
|
927
|
-
openai_api_server: bool
|
928
|
-
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
929
|
-
Default is False (uses native engine).
|
930
|
-
Set to True for backward compatibility with existing code.
|
931
|
-
debug: bool
|
932
|
-
Whether to turn on verbose debugging logs.
|
933
|
-
card_refresh_interval: int
|
934
|
-
Interval in seconds for refreshing the vLLM status card.
|
935
|
-
Only used when openai_api_server=True.
|
936
|
-
max_retries: int
|
937
|
-
Maximum number of retries checking for vLLM server startup.
|
938
|
-
Only used when openai_api_server=True.
|
939
|
-
retry_alert_frequency: int
|
940
|
-
Frequency of alert logs for vLLM server startup retries.
|
941
|
-
Only used when openai_api_server=True.
|
942
|
-
engine_args : dict
|
943
|
-
Additional keyword arguments to pass to the vLLM engine.
|
944
|
-
For example, `tensor_parallel_size=2`.
|
945
|
-
"""
|
946
|
-
...
|
947
|
-
|
948
907
|
@typing.overload
|
949
908
|
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
950
909
|
"""
|
@@ -965,147 +924,131 @@ def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None],
|
|
965
924
|
...
|
966
925
|
|
967
926
|
@typing.overload
|
968
|
-
def
|
969
|
-
"""
|
970
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
971
|
-
|
972
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
973
|
-
|
974
|
-
|
975
|
-
Parameters
|
976
|
-
----------
|
977
|
-
type : str, default 'default'
|
978
|
-
Card type.
|
979
|
-
id : str, optional, default None
|
980
|
-
If multiple cards are present, use this id to identify this card.
|
981
|
-
options : Dict[str, Any], default {}
|
982
|
-
Options passed to the card. The contents depend on the card type.
|
983
|
-
timeout : int, default 45
|
984
|
-
Interrupt reporting if it takes more than this many seconds.
|
985
|
-
"""
|
986
|
-
...
|
987
|
-
|
988
|
-
@typing.overload
|
989
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
990
|
-
...
|
991
|
-
|
992
|
-
@typing.overload
|
993
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
994
|
-
...
|
995
|
-
|
996
|
-
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):
|
997
|
-
"""
|
998
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
999
|
-
|
1000
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
1001
|
-
|
1002
|
-
|
1003
|
-
Parameters
|
1004
|
-
----------
|
1005
|
-
type : str, default 'default'
|
1006
|
-
Card type.
|
1007
|
-
id : str, optional, default None
|
1008
|
-
If multiple cards are present, use this id to identify this card.
|
1009
|
-
options : Dict[str, Any], default {}
|
1010
|
-
Options passed to the card. The contents depend on the card type.
|
1011
|
-
timeout : int, default 45
|
1012
|
-
Interrupt reporting if it takes more than this many seconds.
|
1013
|
-
"""
|
1014
|
-
...
|
1015
|
-
|
1016
|
-
@typing.overload
|
1017
|
-
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]]]:
|
927
|
+
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]]]:
|
1018
928
|
"""
|
1019
|
-
|
929
|
+
Enables loading / saving of models within a step.
|
1020
930
|
|
1021
|
-
|
1022
|
-
|
931
|
+
> Examples
|
932
|
+
- Saving Models
|
933
|
+
```python
|
934
|
+
@model
|
935
|
+
@step
|
936
|
+
def train(self):
|
937
|
+
# current.model.save returns a dictionary reference to the model saved
|
938
|
+
self.my_model = current.model.save(
|
939
|
+
path_to_my_model,
|
940
|
+
label="my_model",
|
941
|
+
metadata={
|
942
|
+
"epochs": 10,
|
943
|
+
"batch-size": 32,
|
944
|
+
"learning-rate": 0.001,
|
945
|
+
}
|
946
|
+
)
|
947
|
+
self.next(self.test)
|
1023
948
|
|
1024
|
-
|
1025
|
-
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
949
|
+
@model(load="my_model")
|
950
|
+
@step
|
951
|
+
def test(self):
|
952
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
953
|
+
# where the key is the name of the artifact and the value is the path to the model
|
954
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
955
|
+
self.next(self.end)
|
1031
956
|
```
|
1032
|
-
which executes the flow on the desired system using the
|
1033
|
-
requirements specified in `@resources`.
|
1034
|
-
|
1035
957
|
|
1036
|
-
|
1037
|
-
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1045
|
-
|
1046
|
-
|
1047
|
-
|
1048
|
-
This parameter maps to the `--shm-size` option in Docker.
|
1049
|
-
"""
|
1050
|
-
...
|
1051
|
-
|
1052
|
-
@typing.overload
|
1053
|
-
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1054
|
-
...
|
1055
|
-
|
1056
|
-
@typing.overload
|
1057
|
-
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1058
|
-
...
|
1059
|
-
|
1060
|
-
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):
|
1061
|
-
"""
|
1062
|
-
Specifies the resources needed when executing this step.
|
1063
|
-
|
1064
|
-
Use `@resources` to specify the resource requirements
|
1065
|
-
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
1066
|
-
|
1067
|
-
You can choose the compute layer on the command line by executing e.g.
|
1068
|
-
```
|
1069
|
-
python myflow.py run --with batch
|
1070
|
-
```
|
1071
|
-
or
|
1072
|
-
```
|
1073
|
-
python myflow.py run --with kubernetes
|
958
|
+
- Loading models
|
959
|
+
```python
|
960
|
+
@step
|
961
|
+
def train(self):
|
962
|
+
# current.model.load returns the path to the model loaded
|
963
|
+
checkpoint_path = current.model.load(
|
964
|
+
self.checkpoint_key,
|
965
|
+
)
|
966
|
+
model_path = current.model.load(
|
967
|
+
self.model,
|
968
|
+
)
|
969
|
+
self.next(self.test)
|
1074
970
|
```
|
1075
|
-
which executes the flow on the desired system using the
|
1076
|
-
requirements specified in `@resources`.
|
1077
971
|
|
1078
972
|
|
1079
973
|
Parameters
|
1080
974
|
----------
|
1081
|
-
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
|
1089
|
-
|
1090
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
1091
|
-
This parameter maps to the `--shm-size` option in Docker.
|
975
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
976
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
977
|
+
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`.
|
978
|
+
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
|
979
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
980
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
981
|
+
|
982
|
+
temp_dir_root : str, default: None
|
983
|
+
The root directory under which `current.model.loaded` will store loaded models
|
1092
984
|
"""
|
1093
985
|
...
|
1094
986
|
|
1095
987
|
@typing.overload
|
1096
|
-
def
|
1097
|
-
"""
|
1098
|
-
Internal decorator to support Fast bakery
|
1099
|
-
"""
|
988
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1100
989
|
...
|
1101
990
|
|
1102
991
|
@typing.overload
|
1103
|
-
def
|
992
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1104
993
|
...
|
1105
994
|
|
1106
|
-
def
|
995
|
+
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):
|
1107
996
|
"""
|
1108
|
-
|
997
|
+
Enables loading / saving of models within a step.
|
998
|
+
|
999
|
+
> Examples
|
1000
|
+
- Saving Models
|
1001
|
+
```python
|
1002
|
+
@model
|
1003
|
+
@step
|
1004
|
+
def train(self):
|
1005
|
+
# current.model.save returns a dictionary reference to the model saved
|
1006
|
+
self.my_model = current.model.save(
|
1007
|
+
path_to_my_model,
|
1008
|
+
label="my_model",
|
1009
|
+
metadata={
|
1010
|
+
"epochs": 10,
|
1011
|
+
"batch-size": 32,
|
1012
|
+
"learning-rate": 0.001,
|
1013
|
+
}
|
1014
|
+
)
|
1015
|
+
self.next(self.test)
|
1016
|
+
|
1017
|
+
@model(load="my_model")
|
1018
|
+
@step
|
1019
|
+
def test(self):
|
1020
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
1021
|
+
# where the key is the name of the artifact and the value is the path to the model
|
1022
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
1023
|
+
self.next(self.end)
|
1024
|
+
```
|
1025
|
+
|
1026
|
+
- Loading models
|
1027
|
+
```python
|
1028
|
+
@step
|
1029
|
+
def train(self):
|
1030
|
+
# current.model.load returns the path to the model loaded
|
1031
|
+
checkpoint_path = current.model.load(
|
1032
|
+
self.checkpoint_key,
|
1033
|
+
)
|
1034
|
+
model_path = current.model.load(
|
1035
|
+
self.model,
|
1036
|
+
)
|
1037
|
+
self.next(self.test)
|
1038
|
+
```
|
1039
|
+
|
1040
|
+
|
1041
|
+
Parameters
|
1042
|
+
----------
|
1043
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
1044
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
1045
|
+
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`.
|
1046
|
+
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
|
1047
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
1048
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
1049
|
+
|
1050
|
+
temp_dir_root : str, default: None
|
1051
|
+
The root directory under which `current.model.loaded` will store loaded models
|
1109
1052
|
"""
|
1110
1053
|
...
|
1111
1054
|
|
@@ -1198,22 +1141,83 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
1198
1141
|
"""
|
1199
1142
|
...
|
1200
1143
|
|
1201
|
-
|
1202
|
-
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
1203
|
-
"""
|
1204
|
-
Decorator prototype for all step decorators. This function gets specialized
|
1205
|
-
and imported for all decorators types by _import_plugin_decorators().
|
1206
|
-
"""
|
1207
|
-
...
|
1208
|
-
|
1209
|
-
@typing.overload
|
1210
|
-
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
1211
|
-
...
|
1212
|
-
|
1213
|
-
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
1144
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
1214
1145
|
"""
|
1215
|
-
Decorator
|
1216
|
-
|
1146
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
1147
|
+
|
1148
|
+
> Examples
|
1149
|
+
|
1150
|
+
**Usage: creating references of models from huggingface that may be loaded in downstream steps**
|
1151
|
+
```python
|
1152
|
+
@huggingface_hub
|
1153
|
+
@step
|
1154
|
+
def pull_model_from_huggingface(self):
|
1155
|
+
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
1156
|
+
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
1157
|
+
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
1158
|
+
# value of the function is a reference to the model in the backend storage.
|
1159
|
+
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
1160
|
+
|
1161
|
+
self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
|
1162
|
+
self.llama_model = current.huggingface_hub.snapshot_download(
|
1163
|
+
repo_id=self.model_id,
|
1164
|
+
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
1165
|
+
)
|
1166
|
+
self.next(self.train)
|
1167
|
+
```
|
1168
|
+
|
1169
|
+
**Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
|
1170
|
+
```python
|
1171
|
+
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
1172
|
+
@step
|
1173
|
+
def pull_model_from_huggingface(self):
|
1174
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
1175
|
+
```
|
1176
|
+
|
1177
|
+
```python
|
1178
|
+
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
|
1179
|
+
@step
|
1180
|
+
def finetune_model(self):
|
1181
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
1182
|
+
# path_to_model will be /my-directory
|
1183
|
+
```
|
1184
|
+
|
1185
|
+
```python
|
1186
|
+
# Takes all the arguments passed to `snapshot_download`
|
1187
|
+
# except for `local_dir`
|
1188
|
+
@huggingface_hub(load=[
|
1189
|
+
{
|
1190
|
+
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
1191
|
+
},
|
1192
|
+
{
|
1193
|
+
"repo_id": "myorg/mistral-lora",
|
1194
|
+
"repo_type": "model",
|
1195
|
+
},
|
1196
|
+
])
|
1197
|
+
@step
|
1198
|
+
def finetune_model(self):
|
1199
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
1200
|
+
# path_to_model will be /my-directory
|
1201
|
+
```
|
1202
|
+
|
1203
|
+
|
1204
|
+
Parameters
|
1205
|
+
----------
|
1206
|
+
temp_dir_root : str, optional
|
1207
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
1208
|
+
|
1209
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
1210
|
+
The list of repos (models/datasets) to load.
|
1211
|
+
|
1212
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
1213
|
+
|
1214
|
+
- If repo (model/dataset) is not found in the datastore:
|
1215
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
1216
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
1217
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
1218
|
+
|
1219
|
+
- If repo is found in the datastore:
|
1220
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
1217
1221
|
"""
|
1218
1222
|
...
|
1219
1223
|
|
@@ -1250,6 +1254,92 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
|
|
1250
1254
|
"""
|
1251
1255
|
...
|
1252
1256
|
|
1257
|
+
@typing.overload
|
1258
|
+
def schedule(*, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1259
|
+
"""
|
1260
|
+
Specifies the times when the flow should be run when running on a
|
1261
|
+
production scheduler.
|
1262
|
+
|
1263
|
+
|
1264
|
+
Parameters
|
1265
|
+
----------
|
1266
|
+
hourly : bool, default False
|
1267
|
+
Run the workflow hourly.
|
1268
|
+
daily : bool, default True
|
1269
|
+
Run the workflow daily.
|
1270
|
+
weekly : bool, default False
|
1271
|
+
Run the workflow weekly.
|
1272
|
+
cron : str, optional, default None
|
1273
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1274
|
+
specified by this expression.
|
1275
|
+
timezone : str, optional, default None
|
1276
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1277
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1278
|
+
"""
|
1279
|
+
...
|
1280
|
+
|
1281
|
+
@typing.overload
|
1282
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1283
|
+
...
|
1284
|
+
|
1285
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
1286
|
+
"""
|
1287
|
+
Specifies the times when the flow should be run when running on a
|
1288
|
+
production scheduler.
|
1289
|
+
|
1290
|
+
|
1291
|
+
Parameters
|
1292
|
+
----------
|
1293
|
+
hourly : bool, default False
|
1294
|
+
Run the workflow hourly.
|
1295
|
+
daily : bool, default True
|
1296
|
+
Run the workflow daily.
|
1297
|
+
weekly : bool, default False
|
1298
|
+
Run the workflow weekly.
|
1299
|
+
cron : str, optional, default None
|
1300
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1301
|
+
specified by this expression.
|
1302
|
+
timezone : str, optional, default None
|
1303
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1304
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1305
|
+
"""
|
1306
|
+
...
|
1307
|
+
|
1308
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1309
|
+
"""
|
1310
|
+
Specifies what flows belong to the same project.
|
1311
|
+
|
1312
|
+
A project-specific namespace is created for all flows that
|
1313
|
+
use the same `@project(name)`.
|
1314
|
+
|
1315
|
+
|
1316
|
+
Parameters
|
1317
|
+
----------
|
1318
|
+
name : str
|
1319
|
+
Project name. Make sure that the name is unique amongst all
|
1320
|
+
projects that use the same production scheduler. The name may
|
1321
|
+
contain only lowercase alphanumeric characters and underscores.
|
1322
|
+
|
1323
|
+
branch : Optional[str], default None
|
1324
|
+
The branch to use. If not specified, the branch is set to
|
1325
|
+
`user.<username>` unless `production` is set to `True`. This can
|
1326
|
+
also be set on the command line using `--branch` as a top-level option.
|
1327
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
1328
|
+
|
1329
|
+
production : bool, default False
|
1330
|
+
Whether or not the branch is the production branch. This can also be set on the
|
1331
|
+
command line using `--production` as a top-level option. It is an error to specify
|
1332
|
+
`production` in the decorator and on the command line.
|
1333
|
+
The project branch name will be:
|
1334
|
+
- if `branch` is specified:
|
1335
|
+
- if `production` is True: `prod.<branch>`
|
1336
|
+
- if `production` is False: `test.<branch>`
|
1337
|
+
- if `branch` is not specified:
|
1338
|
+
- if `production` is True: `prod`
|
1339
|
+
- if `production` is False: `user.<username>`
|
1340
|
+
"""
|
1341
|
+
...
|
1342
|
+
|
1253
1343
|
@typing.overload
|
1254
1344
|
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]]:
|
1255
1345
|
"""
|
@@ -1343,54 +1433,10 @@ def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: t
|
|
1343
1433
|
"""
|
1344
1434
|
...
|
1345
1435
|
|
1346
|
-
|
1347
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1348
|
-
"""
|
1349
|
-
Specifies the PyPI packages for all steps of the flow.
|
1350
|
-
|
1351
|
-
Use `@pypi_base` to set common packages required by all
|
1352
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1353
|
-
|
1354
|
-
Parameters
|
1355
|
-
----------
|
1356
|
-
packages : Dict[str, str], default: {}
|
1357
|
-
Packages to use for this flow. The key is the name of the package
|
1358
|
-
and the value is the version to use.
|
1359
|
-
python : str, optional, default: None
|
1360
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1361
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1362
|
-
"""
|
1363
|
-
...
|
1364
|
-
|
1365
|
-
@typing.overload
|
1366
|
-
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1367
|
-
...
|
1368
|
-
|
1369
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1370
|
-
"""
|
1371
|
-
Specifies the PyPI packages for all steps of the flow.
|
1372
|
-
|
1373
|
-
Use `@pypi_base` to set common packages required by all
|
1374
|
-
steps and use `@pypi` to specify step-specific overrides.
|
1375
|
-
|
1376
|
-
Parameters
|
1377
|
-
----------
|
1378
|
-
packages : Dict[str, str], default: {}
|
1379
|
-
Packages to use for this flow. The key is the name of the package
|
1380
|
-
and the value is the version to use.
|
1381
|
-
python : str, optional, default: None
|
1382
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1383
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1384
|
-
"""
|
1385
|
-
...
|
1386
|
-
|
1387
|
-
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]]:
|
1436
|
+
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]]:
|
1388
1437
|
"""
|
1389
|
-
The `@
|
1390
|
-
|
1391
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1392
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1393
|
-
starts only after all sensors finish.
|
1438
|
+
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.
|
1439
|
+
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.
|
1394
1440
|
|
1395
1441
|
|
1396
1442
|
Parameters
|
@@ -1412,53 +1458,21 @@ def airflow_s3_key_sensor(*, timeout: int, poke_interval: int, mode: str, expone
|
|
1412
1458
|
Name of the sensor on Airflow
|
1413
1459
|
description : str
|
1414
1460
|
Description of sensor in the Airflow UI
|
1415
|
-
|
1416
|
-
The
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
1421
|
-
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
|
1426
|
-
|
1427
|
-
|
1428
|
-
|
1429
|
-
|
1430
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1431
|
-
"""
|
1432
|
-
Specifies what flows belong to the same project.
|
1433
|
-
|
1434
|
-
A project-specific namespace is created for all flows that
|
1435
|
-
use the same `@project(name)`.
|
1436
|
-
|
1437
|
-
|
1438
|
-
Parameters
|
1439
|
-
----------
|
1440
|
-
name : str
|
1441
|
-
Project name. Make sure that the name is unique amongst all
|
1442
|
-
projects that use the same production scheduler. The name may
|
1443
|
-
contain only lowercase alphanumeric characters and underscores.
|
1444
|
-
|
1445
|
-
branch : Optional[str], default None
|
1446
|
-
The branch to use. If not specified, the branch is set to
|
1447
|
-
`user.<username>` unless `production` is set to `True`. This can
|
1448
|
-
also be set on the command line using `--branch` as a top-level option.
|
1449
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
1450
|
-
|
1451
|
-
production : bool, default False
|
1452
|
-
Whether or not the branch is the production branch. This can also be set on the
|
1453
|
-
command line using `--production` as a top-level option. It is an error to specify
|
1454
|
-
`production` in the decorator and on the command line.
|
1455
|
-
The project branch name will be:
|
1456
|
-
- if `branch` is specified:
|
1457
|
-
- if `production` is True: `prod.<branch>`
|
1458
|
-
- if `production` is False: `test.<branch>`
|
1459
|
-
- if `branch` is not specified:
|
1460
|
-
- if `production` is True: `prod`
|
1461
|
-
- if `production` is False: `user.<username>`
|
1461
|
+
external_dag_id : str
|
1462
|
+
The dag_id that contains the task you want to wait for.
|
1463
|
+
external_task_ids : List[str]
|
1464
|
+
The list of task_ids that you want to wait for.
|
1465
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
1466
|
+
allowed_states : List[str]
|
1467
|
+
Iterable of allowed states, (Default: ['success'])
|
1468
|
+
failed_states : List[str]
|
1469
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
1470
|
+
execution_delta : datetime.timedelta
|
1471
|
+
time difference with the previous execution to look at,
|
1472
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
1473
|
+
check_existence: bool
|
1474
|
+
Set to True to check if the external task exists or check if
|
1475
|
+
the DAG to wait for exists. (Default: True)
|
1462
1476
|
"""
|
1463
1477
|
...
|
1464
1478
|
|
@@ -1563,6 +1577,49 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
1563
1577
|
"""
|
1564
1578
|
...
|
1565
1579
|
|
1580
|
+
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]]:
|
1581
|
+
"""
|
1582
|
+
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)
|
1583
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
1584
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
1585
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
1586
|
+
starts only after all sensors finish.
|
1587
|
+
|
1588
|
+
|
1589
|
+
Parameters
|
1590
|
+
----------
|
1591
|
+
timeout : int
|
1592
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
1593
|
+
poke_interval : int
|
1594
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
1595
|
+
mode : str
|
1596
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1597
|
+
exponential_backoff : bool
|
1598
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1599
|
+
pool : str
|
1600
|
+
the slot pool this task should run in,
|
1601
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1602
|
+
soft_fail : bool
|
1603
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1604
|
+
name : str
|
1605
|
+
Name of the sensor on Airflow
|
1606
|
+
description : str
|
1607
|
+
Description of sensor in the Airflow UI
|
1608
|
+
bucket_key : Union[str, List[str]]
|
1609
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
1610
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
1611
|
+
bucket_name : str
|
1612
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
1613
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
1614
|
+
wildcard_match : bool
|
1615
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
1616
|
+
aws_conn_id : str
|
1617
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
1618
|
+
verify : bool
|
1619
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
1620
|
+
"""
|
1621
|
+
...
|
1622
|
+
|
1566
1623
|
@typing.overload
|
1567
1624
|
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]]:
|
1568
1625
|
"""
|
@@ -1614,49 +1671,6 @@ def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packa
|
|
1614
1671
|
"""
|
1615
1672
|
...
|
1616
1673
|
|
1617
|
-
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]]:
|
1618
|
-
"""
|
1619
|
-
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.
|
1620
|
-
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.
|
1621
|
-
|
1622
|
-
|
1623
|
-
Parameters
|
1624
|
-
----------
|
1625
|
-
timeout : int
|
1626
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
1627
|
-
poke_interval : int
|
1628
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
1629
|
-
mode : str
|
1630
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
1631
|
-
exponential_backoff : bool
|
1632
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
1633
|
-
pool : str
|
1634
|
-
the slot pool this task should run in,
|
1635
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
1636
|
-
soft_fail : bool
|
1637
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
1638
|
-
name : str
|
1639
|
-
Name of the sensor on Airflow
|
1640
|
-
description : str
|
1641
|
-
Description of sensor in the Airflow UI
|
1642
|
-
external_dag_id : str
|
1643
|
-
The dag_id that contains the task you want to wait for.
|
1644
|
-
external_task_ids : List[str]
|
1645
|
-
The list of task_ids that you want to wait for.
|
1646
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
1647
|
-
allowed_states : List[str]
|
1648
|
-
Iterable of allowed states, (Default: ['success'])
|
1649
|
-
failed_states : List[str]
|
1650
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
1651
|
-
execution_delta : datetime.timedelta
|
1652
|
-
time difference with the previous execution to look at,
|
1653
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
1654
|
-
check_existence: bool
|
1655
|
-
Set to True to check if the external task exists or check if
|
1656
|
-
the DAG to wait for exists. (Default: True)
|
1657
|
-
"""
|
1658
|
-
...
|
1659
|
-
|
1660
1674
|
def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None):
|
1661
1675
|
"""
|
1662
1676
|
Allows setting external datastores to save data for the
|
@@ -1772,53 +1786,43 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
1772
1786
|
...
|
1773
1787
|
|
1774
1788
|
@typing.overload
|
1775
|
-
def
|
1789
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
1776
1790
|
"""
|
1777
|
-
Specifies the
|
1778
|
-
production scheduler.
|
1791
|
+
Specifies the PyPI packages for all steps of the flow.
|
1779
1792
|
|
1793
|
+
Use `@pypi_base` to set common packages required by all
|
1794
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1780
1795
|
|
1781
1796
|
Parameters
|
1782
1797
|
----------
|
1783
|
-
|
1784
|
-
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
cron : str, optional, default None
|
1790
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1791
|
-
specified by this expression.
|
1792
|
-
timezone : str, optional, default None
|
1793
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1794
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1798
|
+
packages : Dict[str, str], default: {}
|
1799
|
+
Packages to use for this flow. The key is the name of the package
|
1800
|
+
and the value is the version to use.
|
1801
|
+
python : str, optional, default: None
|
1802
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1803
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1795
1804
|
"""
|
1796
1805
|
...
|
1797
1806
|
|
1798
1807
|
@typing.overload
|
1799
|
-
def
|
1808
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
1800
1809
|
...
|
1801
1810
|
|
1802
|
-
def
|
1811
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
1803
1812
|
"""
|
1804
|
-
Specifies the
|
1805
|
-
production scheduler.
|
1813
|
+
Specifies the PyPI packages for all steps of the flow.
|
1806
1814
|
|
1815
|
+
Use `@pypi_base` to set common packages required by all
|
1816
|
+
steps and use `@pypi` to specify step-specific overrides.
|
1807
1817
|
|
1808
1818
|
Parameters
|
1809
1819
|
----------
|
1810
|
-
|
1811
|
-
|
1812
|
-
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
cron : str, optional, default None
|
1817
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
1818
|
-
specified by this expression.
|
1819
|
-
timezone : str, optional, default None
|
1820
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
1821
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
1820
|
+
packages : Dict[str, str], default: {}
|
1821
|
+
Packages to use for this flow. The key is the name of the package
|
1822
|
+
and the value is the version to use.
|
1823
|
+
python : str, optional, default: None
|
1824
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
1825
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
1822
1826
|
"""
|
1823
1827
|
...
|
1824
1828
|
|