ob-metaflow-stubs 6.0.4.6rc1__py2.py3-none-any.whl → 6.0.4.8__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of ob-metaflow-stubs might be problematic. Click here for more details.
- metaflow-stubs/__init__.pyi +830 -811
- 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 +6 -6
- metaflow-stubs/client/filecache.pyi +2 -2
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +4 -4
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +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 +2 -2
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +43 -43
- metaflow-stubs/metaflow_git.pyi +2 -2
- metaflow-stubs/mf_extensions/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/async_cards.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/deco_injection_mixin.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/card_utils/extra_components.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +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 +5 -5
- 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 +5 -5
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/final_api.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/lineage.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/context.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_state_machine.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_vendor/spinner/spinners.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_cli.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/app_config.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/capsule.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/click_importer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/code_package/code_packager.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/config_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/schema_export.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/typed_configs.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/unified_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/deployer.pyi +5 -5
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/experimental/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/perimeters.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/utils.pyi +5 -5
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +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 +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/ob_internal.pyi +2 -2
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +12 -12
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +32 -3
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +42 -2
- metaflow-stubs/plugins/argo/exit_hooks.pyi +2 -2
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +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 +24 -2
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +2 -2
- metaflow-stubs/plugins/cards/card_creator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_datastore.pyi +2 -2
- metaflow-stubs/plugins/cards/card_decorator.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +3 -3
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +3 -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 +2 -2
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +6 -6
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +3 -3
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +3 -3
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +61 -5
- metaflow-stubs/runner/deployer_impl.pyi +3 -3
- metaflow-stubs/runner/metaflow_runner.pyi +3 -3
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +3 -3
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_decorators.pyi +6 -6
- metaflow-stubs/user_configs/config_options.pyi +2 -2
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- {ob_metaflow_stubs-6.0.4.6rc1.dist-info → ob_metaflow_stubs-6.0.4.8.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.4.8.dist-info/RECORD +249 -0
- ob_metaflow_stubs-6.0.4.6rc1.dist-info/RECORD +0 -249
- {ob_metaflow_stubs-6.0.4.6rc1.dist-info → ob_metaflow_stubs-6.0.4.8.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.4.6rc1.dist-info → ob_metaflow_stubs-6.0.4.8.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.21.
|
|
4
|
-
# Generated on 2025-07-
|
|
3
|
+
# MF version: 2.15.21.5+obcheckpoint(0.2.4);ob(v1) #
|
|
4
|
+
# Generated on 2025-07-29T18:33:44.107085 #
|
|
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
|
|
|
@@ -35,18 +35,18 @@ from .user_configs.config_parameters import ConfigValue as ConfigValue
|
|
|
35
35
|
from .user_configs.config_parameters import config_expr as config_expr
|
|
36
36
|
from .user_configs.config_decorators import CustomFlowDecorator as CustomFlowDecorator
|
|
37
37
|
from .user_configs.config_decorators import CustomStepDecorator as CustomStepDecorator
|
|
38
|
-
from . import cards as cards
|
|
39
38
|
from . import tuple_util as tuple_util
|
|
40
|
-
from . import
|
|
39
|
+
from . import cards as cards
|
|
41
40
|
from . import metaflow_git as metaflow_git
|
|
41
|
+
from . import events as events
|
|
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 pyproject_toml_parser as pyproject_toml_parser
|
|
47
48
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
48
49
|
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
49
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_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
|
|
@@ -74,8 +74,8 @@ from .mf_extensions.outerbounds.plugins.checkpoint_datastores.nebius import nebi
|
|
|
74
74
|
from .mf_extensions.outerbounds.plugins.checkpoint_datastores.coreweave import coreweave_checkpoints as coreweave_checkpoints
|
|
75
75
|
from .mf_extensions.outerbounds.plugins.aws.assume_role_decorator import assume_role as assume_role
|
|
76
76
|
from .mf_extensions.outerbounds.plugins.apps.core.deployer import AppDeployer as AppDeployer
|
|
77
|
-
from . import cli_components as cli_components
|
|
78
77
|
from . import system as system
|
|
78
|
+
from . import cli_components as cli_components
|
|
79
79
|
from . import pylint_wrapper as pylint_wrapper
|
|
80
80
|
from . import cli as cli
|
|
81
81
|
from . import profilers as profilers
|
|
@@ -156,95 +156,6 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
156
156
|
"""
|
|
157
157
|
...
|
|
158
158
|
|
|
159
|
-
@typing.overload
|
|
160
|
-
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
161
|
-
"""
|
|
162
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
163
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
164
|
-
"""
|
|
165
|
-
...
|
|
166
|
-
|
|
167
|
-
@typing.overload
|
|
168
|
-
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
169
|
-
...
|
|
170
|
-
|
|
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
|
-
"""
|
|
176
|
-
...
|
|
177
|
-
|
|
178
|
-
@typing.overload
|
|
179
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
180
|
-
"""
|
|
181
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
182
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
183
|
-
"""
|
|
184
|
-
...
|
|
185
|
-
|
|
186
|
-
@typing.overload
|
|
187
|
-
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
188
|
-
...
|
|
189
|
-
|
|
190
|
-
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
191
|
-
"""
|
|
192
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
193
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
194
|
-
"""
|
|
195
|
-
...
|
|
196
|
-
|
|
197
|
-
@typing.overload
|
|
198
|
-
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
199
|
-
"""
|
|
200
|
-
Specifies that the step will success under all circumstances.
|
|
201
|
-
|
|
202
|
-
The decorator will create an optional artifact, specified by `var`, which
|
|
203
|
-
contains the exception raised. You can use it to detect the presence
|
|
204
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
|
205
|
-
are missing.
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
Parameters
|
|
209
|
-
----------
|
|
210
|
-
var : str, optional, default None
|
|
211
|
-
Name of the artifact in which to store the caught exception.
|
|
212
|
-
If not specified, the exception is not stored.
|
|
213
|
-
print_exception : bool, default True
|
|
214
|
-
Determines whether or not the exception is printed to
|
|
215
|
-
stdout when caught.
|
|
216
|
-
"""
|
|
217
|
-
...
|
|
218
|
-
|
|
219
|
-
@typing.overload
|
|
220
|
-
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
221
|
-
...
|
|
222
|
-
|
|
223
|
-
@typing.overload
|
|
224
|
-
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
225
|
-
...
|
|
226
|
-
|
|
227
|
-
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
|
228
|
-
"""
|
|
229
|
-
Specifies that the step will success under all circumstances.
|
|
230
|
-
|
|
231
|
-
The decorator will create an optional artifact, specified by `var`, which
|
|
232
|
-
contains the exception raised. You can use it to detect the presence
|
|
233
|
-
of errors, indicating that all happy-path artifacts produced by the step
|
|
234
|
-
are missing.
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
Parameters
|
|
238
|
-
----------
|
|
239
|
-
var : str, optional, default None
|
|
240
|
-
Name of the artifact in which to store the caught exception.
|
|
241
|
-
If not specified, the exception is not stored.
|
|
242
|
-
print_exception : bool, default True
|
|
243
|
-
Determines whether or not the exception is printed to
|
|
244
|
-
stdout when caught.
|
|
245
|
-
"""
|
|
246
|
-
...
|
|
247
|
-
|
|
248
159
|
@typing.overload
|
|
249
160
|
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]]]:
|
|
250
161
|
"""
|
|
@@ -324,105 +235,59 @@ def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None]
|
|
|
324
235
|
"""
|
|
325
236
|
...
|
|
326
237
|
|
|
327
|
-
|
|
238
|
+
@typing.overload
|
|
239
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
328
240
|
"""
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
User code call
|
|
332
|
-
--------------
|
|
333
|
-
@ollama(
|
|
334
|
-
models=[...],
|
|
335
|
-
...
|
|
336
|
-
)
|
|
337
|
-
|
|
338
|
-
Valid backend options
|
|
339
|
-
---------------------
|
|
340
|
-
- 'local': Run as a separate process on the local task machine.
|
|
341
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
342
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
343
|
-
|
|
344
|
-
Valid model options
|
|
345
|
-
-------------------
|
|
346
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
Parameters
|
|
350
|
-
----------
|
|
351
|
-
models: list[str]
|
|
352
|
-
List of Ollama containers running models in sidecars.
|
|
353
|
-
backend: str
|
|
354
|
-
Determines where and how to run the Ollama process.
|
|
355
|
-
force_pull: bool
|
|
356
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
357
|
-
cache_update_policy: str
|
|
358
|
-
Cache update policy: "auto", "force", or "never".
|
|
359
|
-
force_cache_update: bool
|
|
360
|
-
Simple override for "force" cache update policy.
|
|
361
|
-
debug: bool
|
|
362
|
-
Whether to turn on verbose debugging logs.
|
|
363
|
-
circuit_breaker_config: dict
|
|
364
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
365
|
-
timeout_config: dict
|
|
366
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
241
|
+
Internal decorator to support Fast bakery
|
|
367
242
|
"""
|
|
368
243
|
...
|
|
369
244
|
|
|
370
245
|
@typing.overload
|
|
371
|
-
def
|
|
246
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
247
|
+
...
|
|
248
|
+
|
|
249
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
372
250
|
"""
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
251
|
+
Internal decorator to support Fast bakery
|
|
252
|
+
"""
|
|
253
|
+
...
|
|
254
|
+
|
|
255
|
+
@typing.overload
|
|
256
|
+
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]]]:
|
|
257
|
+
"""
|
|
258
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
259
|
+
the execution of a step.
|
|
383
260
|
|
|
384
261
|
|
|
385
262
|
Parameters
|
|
386
263
|
----------
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
hours : int, default 0
|
|
392
|
-
Number of hours to wait prior to timing out.
|
|
264
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
265
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
266
|
+
role : str, optional, default: None
|
|
267
|
+
Role to use for fetching secrets
|
|
393
268
|
"""
|
|
394
269
|
...
|
|
395
270
|
|
|
396
271
|
@typing.overload
|
|
397
|
-
def
|
|
272
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
398
273
|
...
|
|
399
274
|
|
|
400
275
|
@typing.overload
|
|
401
|
-
def
|
|
276
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
402
277
|
...
|
|
403
278
|
|
|
404
|
-
def
|
|
279
|
+
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):
|
|
405
280
|
"""
|
|
406
|
-
Specifies
|
|
407
|
-
|
|
408
|
-
This decorator is useful if this step may hang indefinitely.
|
|
409
|
-
|
|
410
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
411
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
412
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
413
|
-
|
|
414
|
-
Note that all the values specified in parameters are added together so if you specify
|
|
415
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
281
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
282
|
+
the execution of a step.
|
|
416
283
|
|
|
417
284
|
|
|
418
285
|
Parameters
|
|
419
286
|
----------
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
hours : int, default 0
|
|
425
|
-
Number of hours to wait prior to timing out.
|
|
287
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
288
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
289
|
+
role : str, optional, default: None
|
|
290
|
+
Role to use for fetching secrets
|
|
426
291
|
"""
|
|
427
292
|
...
|
|
428
293
|
|
|
@@ -607,242 +472,61 @@ def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], Non
|
|
|
607
472
|
...
|
|
608
473
|
|
|
609
474
|
@typing.overload
|
|
610
|
-
def
|
|
475
|
+
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]]]:
|
|
611
476
|
"""
|
|
612
|
-
|
|
477
|
+
Specifies the Conda environment for the step.
|
|
478
|
+
|
|
479
|
+
Information in this decorator will augment any
|
|
480
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
481
|
+
you can use `@conda_base` to set packages required by all
|
|
482
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
483
|
+
|
|
484
|
+
|
|
485
|
+
Parameters
|
|
486
|
+
----------
|
|
487
|
+
packages : Dict[str, str], default {}
|
|
488
|
+
Packages to use for this step. The key is the name of the package
|
|
489
|
+
and the value is the version to use.
|
|
490
|
+
libraries : Dict[str, str], default {}
|
|
491
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
492
|
+
python : str, optional, default None
|
|
493
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
494
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
495
|
+
disabled : bool, default False
|
|
496
|
+
If set to True, disables @conda.
|
|
613
497
|
"""
|
|
614
498
|
...
|
|
615
499
|
|
|
616
500
|
@typing.overload
|
|
617
|
-
def
|
|
501
|
+
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
618
502
|
...
|
|
619
503
|
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
Internal decorator to support Fast bakery
|
|
623
|
-
"""
|
|
504
|
+
@typing.overload
|
|
505
|
+
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
624
506
|
...
|
|
625
507
|
|
|
626
|
-
def
|
|
508
|
+
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
627
509
|
"""
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
User code call
|
|
631
|
-
--------------
|
|
632
|
-
@vllm(
|
|
633
|
-
model="...",
|
|
634
|
-
...
|
|
635
|
-
)
|
|
510
|
+
Specifies the Conda environment for the step.
|
|
636
511
|
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
Valid model options
|
|
642
|
-
-------------------
|
|
643
|
-
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
|
644
|
-
|
|
645
|
-
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
|
646
|
-
If you need multiple models, you must create multiple @vllm decorators.
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
Parameters
|
|
650
|
-
----------
|
|
651
|
-
model: str
|
|
652
|
-
HuggingFace model identifier to be served by vLLM.
|
|
653
|
-
backend: str
|
|
654
|
-
Determines where and how to run the vLLM process.
|
|
655
|
-
openai_api_server: bool
|
|
656
|
-
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
|
657
|
-
Default is False (uses native engine).
|
|
658
|
-
Set to True for backward compatibility with existing code.
|
|
659
|
-
debug: bool
|
|
660
|
-
Whether to turn on verbose debugging logs.
|
|
661
|
-
card_refresh_interval: int
|
|
662
|
-
Interval in seconds for refreshing the vLLM status card.
|
|
663
|
-
Only used when openai_api_server=True.
|
|
664
|
-
max_retries: int
|
|
665
|
-
Maximum number of retries checking for vLLM server startup.
|
|
666
|
-
Only used when openai_api_server=True.
|
|
667
|
-
retry_alert_frequency: int
|
|
668
|
-
Frequency of alert logs for vLLM server startup retries.
|
|
669
|
-
Only used when openai_api_server=True.
|
|
670
|
-
engine_args : dict
|
|
671
|
-
Additional keyword arguments to pass to the vLLM engine.
|
|
672
|
-
For example, `tensor_parallel_size=2`.
|
|
673
|
-
"""
|
|
674
|
-
...
|
|
675
|
-
|
|
676
|
-
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]]]:
|
|
677
|
-
"""
|
|
678
|
-
Specifies that this step should execute on DGX cloud.
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
Parameters
|
|
682
|
-
----------
|
|
683
|
-
gpu : int
|
|
684
|
-
Number of GPUs to use.
|
|
685
|
-
gpu_type : str
|
|
686
|
-
Type of Nvidia GPU to use.
|
|
687
|
-
"""
|
|
688
|
-
...
|
|
689
|
-
|
|
690
|
-
def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
691
|
-
"""
|
|
692
|
-
Specifies that this step should execute on DGX cloud.
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
Parameters
|
|
696
|
-
----------
|
|
697
|
-
gpu : int
|
|
698
|
-
Number of GPUs to use.
|
|
699
|
-
gpu_type : str
|
|
700
|
-
Type of Nvidia GPU to use.
|
|
701
|
-
queue_timeout : int
|
|
702
|
-
Time to keep the job in NVCF's queue.
|
|
703
|
-
"""
|
|
704
|
-
...
|
|
705
|
-
|
|
706
|
-
@typing.overload
|
|
707
|
-
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]]]:
|
|
708
|
-
"""
|
|
709
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
710
|
-
|
|
711
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
Parameters
|
|
715
|
-
----------
|
|
716
|
-
type : str, default 'default'
|
|
717
|
-
Card type.
|
|
718
|
-
id : str, optional, default None
|
|
719
|
-
If multiple cards are present, use this id to identify this card.
|
|
720
|
-
options : Dict[str, Any], default {}
|
|
721
|
-
Options passed to the card. The contents depend on the card type.
|
|
722
|
-
timeout : int, default 45
|
|
723
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
724
|
-
"""
|
|
725
|
-
...
|
|
726
|
-
|
|
727
|
-
@typing.overload
|
|
728
|
-
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
729
|
-
...
|
|
730
|
-
|
|
731
|
-
@typing.overload
|
|
732
|
-
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
733
|
-
...
|
|
734
|
-
|
|
735
|
-
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):
|
|
736
|
-
"""
|
|
737
|
-
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
738
|
-
|
|
739
|
-
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
Parameters
|
|
743
|
-
----------
|
|
744
|
-
type : str, default 'default'
|
|
745
|
-
Card type.
|
|
746
|
-
id : str, optional, default None
|
|
747
|
-
If multiple cards are present, use this id to identify this card.
|
|
748
|
-
options : Dict[str, Any], default {}
|
|
749
|
-
Options passed to the card. The contents depend on the card type.
|
|
750
|
-
timeout : int, default 45
|
|
751
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
752
|
-
"""
|
|
753
|
-
...
|
|
754
|
-
|
|
755
|
-
@typing.overload
|
|
756
|
-
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]]]:
|
|
757
|
-
"""
|
|
758
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
759
|
-
the execution of a step.
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
Parameters
|
|
763
|
-
----------
|
|
764
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
765
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
766
|
-
role : str, optional, default: None
|
|
767
|
-
Role to use for fetching secrets
|
|
768
|
-
"""
|
|
769
|
-
...
|
|
770
|
-
|
|
771
|
-
@typing.overload
|
|
772
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
773
|
-
...
|
|
774
|
-
|
|
775
|
-
@typing.overload
|
|
776
|
-
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
777
|
-
...
|
|
778
|
-
|
|
779
|
-
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):
|
|
780
|
-
"""
|
|
781
|
-
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
782
|
-
the execution of a step.
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
Parameters
|
|
786
|
-
----------
|
|
787
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
788
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
789
|
-
role : str, optional, default: None
|
|
790
|
-
Role to use for fetching secrets
|
|
791
|
-
"""
|
|
792
|
-
...
|
|
793
|
-
|
|
794
|
-
@typing.overload
|
|
795
|
-
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]]]:
|
|
796
|
-
"""
|
|
797
|
-
Specifies the number of times the task corresponding
|
|
798
|
-
to a step needs to be retried.
|
|
799
|
-
|
|
800
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
801
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
802
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
803
|
-
|
|
804
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
805
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
806
|
-
ensuring that the flow execution can continue.
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
Parameters
|
|
810
|
-
----------
|
|
811
|
-
times : int, default 3
|
|
812
|
-
Number of times to retry this task.
|
|
813
|
-
minutes_between_retries : int, default 2
|
|
814
|
-
Number of minutes between retries.
|
|
815
|
-
"""
|
|
816
|
-
...
|
|
817
|
-
|
|
818
|
-
@typing.overload
|
|
819
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
820
|
-
...
|
|
821
|
-
|
|
822
|
-
@typing.overload
|
|
823
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
824
|
-
...
|
|
825
|
-
|
|
826
|
-
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):
|
|
827
|
-
"""
|
|
828
|
-
Specifies the number of times the task corresponding
|
|
829
|
-
to a step needs to be retried.
|
|
830
|
-
|
|
831
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
832
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
833
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
834
|
-
|
|
835
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
836
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
837
|
-
ensuring that the flow execution can continue.
|
|
512
|
+
Information in this decorator will augment any
|
|
513
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
514
|
+
you can use `@conda_base` to set packages required by all
|
|
515
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
838
516
|
|
|
839
517
|
|
|
840
518
|
Parameters
|
|
841
519
|
----------
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
520
|
+
packages : Dict[str, str], default {}
|
|
521
|
+
Packages to use for this step. The key is the name of the package
|
|
522
|
+
and the value is the version to use.
|
|
523
|
+
libraries : Dict[str, str], default {}
|
|
524
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
525
|
+
python : str, optional, default None
|
|
526
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
527
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
528
|
+
disabled : bool, default False
|
|
529
|
+
If set to True, disables @conda.
|
|
846
530
|
"""
|
|
847
531
|
...
|
|
848
532
|
|
|
@@ -935,193 +619,72 @@ def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: ty
|
|
|
935
619
|
"""
|
|
936
620
|
...
|
|
937
621
|
|
|
938
|
-
|
|
622
|
+
@typing.overload
|
|
623
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
939
624
|
"""
|
|
940
|
-
Decorator
|
|
625
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
626
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
627
|
+
"""
|
|
628
|
+
...
|
|
629
|
+
|
|
630
|
+
@typing.overload
|
|
631
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
632
|
+
...
|
|
633
|
+
|
|
634
|
+
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
635
|
+
"""
|
|
636
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
637
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
638
|
+
"""
|
|
639
|
+
...
|
|
640
|
+
|
|
641
|
+
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]]]:
|
|
642
|
+
"""
|
|
643
|
+
This decorator is used to run vllm APIs as Metaflow task sidecars.
|
|
941
644
|
|
|
942
|
-
|
|
645
|
+
User code call
|
|
646
|
+
--------------
|
|
647
|
+
@vllm(
|
|
648
|
+
model="...",
|
|
649
|
+
...
|
|
650
|
+
)
|
|
943
651
|
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
@step
|
|
948
|
-
def pull_model_from_huggingface(self):
|
|
949
|
-
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
|
950
|
-
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
|
951
|
-
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
|
952
|
-
# value of the function is a reference to the model in the backend storage.
|
|
953
|
-
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
|
652
|
+
Valid backend options
|
|
653
|
+
---------------------
|
|
654
|
+
- 'local': Run as a separate process on the local task machine.
|
|
954
655
|
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
|
959
|
-
)
|
|
960
|
-
self.next(self.train)
|
|
961
|
-
```
|
|
962
|
-
|
|
963
|
-
**Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
|
|
964
|
-
```python
|
|
965
|
-
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
|
966
|
-
@step
|
|
967
|
-
def pull_model_from_huggingface(self):
|
|
968
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
969
|
-
```
|
|
970
|
-
|
|
971
|
-
```python
|
|
972
|
-
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
|
|
973
|
-
@step
|
|
974
|
-
def finetune_model(self):
|
|
975
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
976
|
-
# path_to_model will be /my-directory
|
|
977
|
-
```
|
|
978
|
-
|
|
979
|
-
```python
|
|
980
|
-
# Takes all the arguments passed to `snapshot_download`
|
|
981
|
-
# except for `local_dir`
|
|
982
|
-
@huggingface_hub(load=[
|
|
983
|
-
{
|
|
984
|
-
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
|
985
|
-
},
|
|
986
|
-
{
|
|
987
|
-
"repo_id": "myorg/mistral-lora",
|
|
988
|
-
"repo_type": "model",
|
|
989
|
-
},
|
|
990
|
-
])
|
|
991
|
-
@step
|
|
992
|
-
def finetune_model(self):
|
|
993
|
-
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
994
|
-
# path_to_model will be /my-directory
|
|
995
|
-
```
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
Parameters
|
|
999
|
-
----------
|
|
1000
|
-
temp_dir_root : str, optional
|
|
1001
|
-
The root directory that will hold the temporary directory where objects will be downloaded.
|
|
1002
|
-
|
|
1003
|
-
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
|
1004
|
-
The list of repos (models/datasets) to load.
|
|
1005
|
-
|
|
1006
|
-
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
|
1007
|
-
|
|
1008
|
-
- If repo (model/dataset) is not found in the datastore:
|
|
1009
|
-
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
|
1010
|
-
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
|
1011
|
-
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
|
1012
|
-
|
|
1013
|
-
- If repo is found in the datastore:
|
|
1014
|
-
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
|
1015
|
-
"""
|
|
1016
|
-
...
|
|
1017
|
-
|
|
1018
|
-
@typing.overload
|
|
1019
|
-
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]]]:
|
|
1020
|
-
"""
|
|
1021
|
-
Specifies the Conda environment for the step.
|
|
1022
|
-
|
|
1023
|
-
Information in this decorator will augment any
|
|
1024
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
1025
|
-
you can use `@conda_base` to set packages required by all
|
|
1026
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
Parameters
|
|
1030
|
-
----------
|
|
1031
|
-
packages : Dict[str, str], default {}
|
|
1032
|
-
Packages to use for this step. The key is the name of the package
|
|
1033
|
-
and the value is the version to use.
|
|
1034
|
-
libraries : Dict[str, str], default {}
|
|
1035
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1036
|
-
python : str, optional, default None
|
|
1037
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1038
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1039
|
-
disabled : bool, default False
|
|
1040
|
-
If set to True, disables @conda.
|
|
1041
|
-
"""
|
|
1042
|
-
...
|
|
1043
|
-
|
|
1044
|
-
@typing.overload
|
|
1045
|
-
def conda(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1046
|
-
...
|
|
1047
|
-
|
|
1048
|
-
@typing.overload
|
|
1049
|
-
def conda(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1050
|
-
...
|
|
1051
|
-
|
|
1052
|
-
def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
1053
|
-
"""
|
|
1054
|
-
Specifies the Conda environment for the step.
|
|
1055
|
-
|
|
1056
|
-
Information in this decorator will augment any
|
|
1057
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
1058
|
-
you can use `@conda_base` to set packages required by all
|
|
1059
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
Parameters
|
|
1063
|
-
----------
|
|
1064
|
-
packages : Dict[str, str], default {}
|
|
1065
|
-
Packages to use for this step. The key is the name of the package
|
|
1066
|
-
and the value is the version to use.
|
|
1067
|
-
libraries : Dict[str, str], default {}
|
|
1068
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1069
|
-
python : str, optional, default None
|
|
1070
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1071
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1072
|
-
disabled : bool, default False
|
|
1073
|
-
If set to True, disables @conda.
|
|
1074
|
-
"""
|
|
1075
|
-
...
|
|
1076
|
-
|
|
1077
|
-
@typing.overload
|
|
1078
|
-
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]]]:
|
|
1079
|
-
"""
|
|
1080
|
-
Specifies the PyPI packages for the step.
|
|
1081
|
-
|
|
1082
|
-
Information in this decorator will augment any
|
|
1083
|
-
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
1084
|
-
you can use `@pypi_base` to set packages required by all
|
|
1085
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
Parameters
|
|
1089
|
-
----------
|
|
1090
|
-
packages : Dict[str, str], default: {}
|
|
1091
|
-
Packages to use for this step. The key is the name of the package
|
|
1092
|
-
and the value is the version to use.
|
|
1093
|
-
python : str, optional, default: None
|
|
1094
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1095
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1096
|
-
"""
|
|
1097
|
-
...
|
|
1098
|
-
|
|
1099
|
-
@typing.overload
|
|
1100
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1101
|
-
...
|
|
1102
|
-
|
|
1103
|
-
@typing.overload
|
|
1104
|
-
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1105
|
-
...
|
|
1106
|
-
|
|
1107
|
-
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):
|
|
1108
|
-
"""
|
|
1109
|
-
Specifies the PyPI packages for the step.
|
|
656
|
+
Valid model options
|
|
657
|
+
-------------------
|
|
658
|
+
Any HuggingFace model identifier, e.g. 'meta-llama/Llama-3.2-1B'
|
|
1110
659
|
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
you can use `@pypi_base` to set packages required by all
|
|
1114
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
660
|
+
NOTE: vLLM's OpenAI-compatible server serves ONE model per server instance.
|
|
661
|
+
If you need multiple models, you must create multiple @vllm decorators.
|
|
1115
662
|
|
|
1116
663
|
|
|
1117
664
|
Parameters
|
|
1118
665
|
----------
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
666
|
+
model: str
|
|
667
|
+
HuggingFace model identifier to be served by vLLM.
|
|
668
|
+
backend: str
|
|
669
|
+
Determines where and how to run the vLLM process.
|
|
670
|
+
openai_api_server: bool
|
|
671
|
+
Whether to use OpenAI-compatible API server mode (subprocess) instead of native engine.
|
|
672
|
+
Default is False (uses native engine).
|
|
673
|
+
Set to True for backward compatibility with existing code.
|
|
674
|
+
debug: bool
|
|
675
|
+
Whether to turn on verbose debugging logs.
|
|
676
|
+
card_refresh_interval: int
|
|
677
|
+
Interval in seconds for refreshing the vLLM status card.
|
|
678
|
+
Only used when openai_api_server=True.
|
|
679
|
+
max_retries: int
|
|
680
|
+
Maximum number of retries checking for vLLM server startup.
|
|
681
|
+
Only used when openai_api_server=True.
|
|
682
|
+
retry_alert_frequency: int
|
|
683
|
+
Frequency of alert logs for vLLM server startup retries.
|
|
684
|
+
Only used when openai_api_server=True.
|
|
685
|
+
engine_args : dict
|
|
686
|
+
Additional keyword arguments to pass to the vLLM engine.
|
|
687
|
+
For example, `tensor_parallel_size=2`.
|
|
1125
688
|
"""
|
|
1126
689
|
...
|
|
1127
690
|
|
|
@@ -1254,46 +817,459 @@ def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
1254
817
|
"""
|
|
1255
818
|
...
|
|
1256
819
|
|
|
1257
|
-
def
|
|
820
|
+
def nvct(*, gpu: int, gpu_type: str) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
1258
821
|
"""
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
822
|
+
Specifies that this step should execute on DGX cloud.
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
Parameters
|
|
826
|
+
----------
|
|
827
|
+
gpu : int
|
|
828
|
+
Number of GPUs to use.
|
|
829
|
+
gpu_type : str
|
|
830
|
+
Type of Nvidia GPU to use.
|
|
831
|
+
"""
|
|
832
|
+
...
|
|
833
|
+
|
|
834
|
+
@typing.overload
|
|
835
|
+
def catch(*, var: typing.Optional[str] = None, print_exception: bool = True) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
836
|
+
"""
|
|
837
|
+
Specifies that the step will success under all circumstances.
|
|
838
|
+
|
|
839
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
840
|
+
contains the exception raised. You can use it to detect the presence
|
|
841
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
842
|
+
are missing.
|
|
843
|
+
|
|
844
|
+
|
|
845
|
+
Parameters
|
|
846
|
+
----------
|
|
847
|
+
var : str, optional, default None
|
|
848
|
+
Name of the artifact in which to store the caught exception.
|
|
849
|
+
If not specified, the exception is not stored.
|
|
850
|
+
print_exception : bool, default True
|
|
851
|
+
Determines whether or not the exception is printed to
|
|
852
|
+
stdout when caught.
|
|
853
|
+
"""
|
|
854
|
+
...
|
|
855
|
+
|
|
856
|
+
@typing.overload
|
|
857
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
858
|
+
...
|
|
859
|
+
|
|
860
|
+
@typing.overload
|
|
861
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
862
|
+
...
|
|
863
|
+
|
|
864
|
+
def catch(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, var: typing.Optional[str] = None, print_exception: bool = True):
|
|
865
|
+
"""
|
|
866
|
+
Specifies that the step will success under all circumstances.
|
|
867
|
+
|
|
868
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
869
|
+
contains the exception raised. You can use it to detect the presence
|
|
870
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
871
|
+
are missing.
|
|
872
|
+
|
|
873
|
+
|
|
874
|
+
Parameters
|
|
875
|
+
----------
|
|
876
|
+
var : str, optional, default None
|
|
877
|
+
Name of the artifact in which to store the caught exception.
|
|
878
|
+
If not specified, the exception is not stored.
|
|
879
|
+
print_exception : bool, default True
|
|
880
|
+
Determines whether or not the exception is printed to
|
|
881
|
+
stdout when caught.
|
|
882
|
+
"""
|
|
883
|
+
...
|
|
884
|
+
|
|
885
|
+
@typing.overload
|
|
886
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
887
|
+
"""
|
|
888
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
889
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
890
|
+
"""
|
|
891
|
+
...
|
|
892
|
+
|
|
893
|
+
@typing.overload
|
|
894
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
895
|
+
...
|
|
896
|
+
|
|
897
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
898
|
+
"""
|
|
899
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
900
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
901
|
+
"""
|
|
902
|
+
...
|
|
903
|
+
|
|
904
|
+
def nvidia(*, gpu: int, gpu_type: str, queue_timeout: int) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
905
|
+
"""
|
|
906
|
+
Specifies that this step should execute on DGX cloud.
|
|
907
|
+
|
|
908
|
+
|
|
909
|
+
Parameters
|
|
910
|
+
----------
|
|
911
|
+
gpu : int
|
|
912
|
+
Number of GPUs to use.
|
|
913
|
+
gpu_type : str
|
|
914
|
+
Type of Nvidia GPU to use.
|
|
915
|
+
queue_timeout : int
|
|
916
|
+
Time to keep the job in NVCF's queue.
|
|
917
|
+
"""
|
|
918
|
+
...
|
|
919
|
+
|
|
920
|
+
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]]]:
|
|
921
|
+
"""
|
|
922
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
|
923
|
+
|
|
924
|
+
User code call
|
|
925
|
+
--------------
|
|
926
|
+
@ollama(
|
|
927
|
+
models=[...],
|
|
928
|
+
...
|
|
929
|
+
)
|
|
930
|
+
|
|
931
|
+
Valid backend options
|
|
932
|
+
---------------------
|
|
933
|
+
- 'local': Run as a separate process on the local task machine.
|
|
934
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
935
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
936
|
+
|
|
937
|
+
Valid model options
|
|
938
|
+
-------------------
|
|
939
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
940
|
+
|
|
941
|
+
|
|
942
|
+
Parameters
|
|
943
|
+
----------
|
|
944
|
+
models: list[str]
|
|
945
|
+
List of Ollama containers running models in sidecars.
|
|
946
|
+
backend: str
|
|
947
|
+
Determines where and how to run the Ollama process.
|
|
948
|
+
force_pull: bool
|
|
949
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
950
|
+
cache_update_policy: str
|
|
951
|
+
Cache update policy: "auto", "force", or "never".
|
|
952
|
+
force_cache_update: bool
|
|
953
|
+
Simple override for "force" cache update policy.
|
|
954
|
+
debug: bool
|
|
955
|
+
Whether to turn on verbose debugging logs.
|
|
956
|
+
circuit_breaker_config: dict
|
|
957
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
958
|
+
timeout_config: dict
|
|
959
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
960
|
+
"""
|
|
961
|
+
...
|
|
962
|
+
|
|
963
|
+
@typing.overload
|
|
964
|
+
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]]]:
|
|
965
|
+
"""
|
|
966
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
967
|
+
|
|
968
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
969
|
+
|
|
970
|
+
|
|
971
|
+
Parameters
|
|
972
|
+
----------
|
|
973
|
+
type : str, default 'default'
|
|
974
|
+
Card type.
|
|
975
|
+
id : str, optional, default None
|
|
976
|
+
If multiple cards are present, use this id to identify this card.
|
|
977
|
+
options : Dict[str, Any], default {}
|
|
978
|
+
Options passed to the card. The contents depend on the card type.
|
|
979
|
+
timeout : int, default 45
|
|
980
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
981
|
+
"""
|
|
982
|
+
...
|
|
983
|
+
|
|
984
|
+
@typing.overload
|
|
985
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
986
|
+
...
|
|
987
|
+
|
|
988
|
+
@typing.overload
|
|
989
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
990
|
+
...
|
|
991
|
+
|
|
992
|
+
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):
|
|
993
|
+
"""
|
|
994
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
995
|
+
|
|
996
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
997
|
+
|
|
998
|
+
|
|
999
|
+
Parameters
|
|
1000
|
+
----------
|
|
1001
|
+
type : str, default 'default'
|
|
1002
|
+
Card type.
|
|
1003
|
+
id : str, optional, default None
|
|
1004
|
+
If multiple cards are present, use this id to identify this card.
|
|
1005
|
+
options : Dict[str, Any], default {}
|
|
1006
|
+
Options passed to the card. The contents depend on the card type.
|
|
1007
|
+
timeout : int, default 45
|
|
1008
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
1009
|
+
"""
|
|
1010
|
+
...
|
|
1011
|
+
|
|
1012
|
+
@typing.overload
|
|
1013
|
+
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]]]:
|
|
1014
|
+
"""
|
|
1015
|
+
Specifies the number of times the task corresponding
|
|
1016
|
+
to a step needs to be retried.
|
|
1017
|
+
|
|
1018
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
1019
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
1020
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
1021
|
+
|
|
1022
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
1023
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
1024
|
+
ensuring that the flow execution can continue.
|
|
1025
|
+
|
|
1026
|
+
|
|
1027
|
+
Parameters
|
|
1028
|
+
----------
|
|
1029
|
+
times : int, default 3
|
|
1030
|
+
Number of times to retry this task.
|
|
1031
|
+
minutes_between_retries : int, default 2
|
|
1032
|
+
Number of minutes between retries.
|
|
1033
|
+
"""
|
|
1034
|
+
...
|
|
1035
|
+
|
|
1036
|
+
@typing.overload
|
|
1037
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1038
|
+
...
|
|
1039
|
+
|
|
1040
|
+
@typing.overload
|
|
1041
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1042
|
+
...
|
|
1043
|
+
|
|
1044
|
+
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):
|
|
1045
|
+
"""
|
|
1046
|
+
Specifies the number of times the task corresponding
|
|
1047
|
+
to a step needs to be retried.
|
|
1048
|
+
|
|
1049
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
1050
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
1051
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
1052
|
+
|
|
1053
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
1054
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
1055
|
+
ensuring that the flow execution can continue.
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
Parameters
|
|
1059
|
+
----------
|
|
1060
|
+
times : int, default 3
|
|
1061
|
+
Number of times to retry this task.
|
|
1062
|
+
minutes_between_retries : int, default 2
|
|
1063
|
+
Number of minutes between retries.
|
|
1064
|
+
"""
|
|
1065
|
+
...
|
|
1066
|
+
|
|
1067
|
+
@typing.overload
|
|
1068
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1069
|
+
"""
|
|
1070
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
1071
|
+
to inject a card and render simple markdown content.
|
|
1072
|
+
"""
|
|
1073
|
+
...
|
|
1074
|
+
|
|
1075
|
+
@typing.overload
|
|
1076
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1077
|
+
...
|
|
1078
|
+
|
|
1079
|
+
def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
1080
|
+
"""
|
|
1081
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
1082
|
+
to inject a card and render simple markdown content.
|
|
1083
|
+
"""
|
|
1084
|
+
...
|
|
1085
|
+
|
|
1086
|
+
@typing.overload
|
|
1087
|
+
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]]]:
|
|
1088
|
+
"""
|
|
1089
|
+
Specifies a timeout for your step.
|
|
1090
|
+
|
|
1091
|
+
This decorator is useful if this step may hang indefinitely.
|
|
1092
|
+
|
|
1093
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
1094
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
1095
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
1096
|
+
|
|
1097
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
1098
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
1099
|
+
|
|
1100
|
+
|
|
1101
|
+
Parameters
|
|
1102
|
+
----------
|
|
1103
|
+
seconds : int, default 0
|
|
1104
|
+
Number of seconds to wait prior to timing out.
|
|
1105
|
+
minutes : int, default 0
|
|
1106
|
+
Number of minutes to wait prior to timing out.
|
|
1107
|
+
hours : int, default 0
|
|
1108
|
+
Number of hours to wait prior to timing out.
|
|
1109
|
+
"""
|
|
1110
|
+
...
|
|
1111
|
+
|
|
1112
|
+
@typing.overload
|
|
1113
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1114
|
+
...
|
|
1115
|
+
|
|
1116
|
+
@typing.overload
|
|
1117
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1118
|
+
...
|
|
1119
|
+
|
|
1120
|
+
def timeout(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, seconds: int = 0, minutes: int = 0, hours: int = 0):
|
|
1121
|
+
"""
|
|
1122
|
+
Specifies a timeout for your step.
|
|
1123
|
+
|
|
1124
|
+
This decorator is useful if this step may hang indefinitely.
|
|
1125
|
+
|
|
1126
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
1127
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
1128
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
1129
|
+
|
|
1130
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
1131
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
1132
|
+
|
|
1133
|
+
|
|
1134
|
+
Parameters
|
|
1135
|
+
----------
|
|
1136
|
+
seconds : int, default 0
|
|
1137
|
+
Number of seconds to wait prior to timing out.
|
|
1138
|
+
minutes : int, default 0
|
|
1139
|
+
Number of minutes to wait prior to timing out.
|
|
1140
|
+
hours : int, default 0
|
|
1141
|
+
Number of hours to wait prior to timing out.
|
|
1142
|
+
"""
|
|
1143
|
+
...
|
|
1144
|
+
|
|
1145
|
+
@typing.overload
|
|
1146
|
+
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]]]:
|
|
1147
|
+
"""
|
|
1148
|
+
Specifies the PyPI packages for the step.
|
|
1149
|
+
|
|
1150
|
+
Information in this decorator will augment any
|
|
1151
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
1152
|
+
you can use `@pypi_base` to set packages required by all
|
|
1153
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1154
|
+
|
|
1155
|
+
|
|
1156
|
+
Parameters
|
|
1157
|
+
----------
|
|
1158
|
+
packages : Dict[str, str], default: {}
|
|
1159
|
+
Packages to use for this step. The key is the name of the package
|
|
1160
|
+
and the value is the version to use.
|
|
1161
|
+
python : str, optional, default: None
|
|
1162
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1163
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1164
|
+
"""
|
|
1165
|
+
...
|
|
1166
|
+
|
|
1167
|
+
@typing.overload
|
|
1168
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1169
|
+
...
|
|
1170
|
+
|
|
1171
|
+
@typing.overload
|
|
1172
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1173
|
+
...
|
|
1174
|
+
|
|
1175
|
+
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):
|
|
1176
|
+
"""
|
|
1177
|
+
Specifies the PyPI packages for the step.
|
|
1178
|
+
|
|
1179
|
+
Information in this decorator will augment any
|
|
1180
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
1181
|
+
you can use `@pypi_base` to set packages required by all
|
|
1182
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1183
|
+
|
|
1184
|
+
|
|
1185
|
+
Parameters
|
|
1186
|
+
----------
|
|
1187
|
+
packages : Dict[str, str], default: {}
|
|
1188
|
+
Packages to use for this step. The key is the name of the package
|
|
1189
|
+
and the value is the version to use.
|
|
1190
|
+
python : str, optional, default: None
|
|
1191
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1192
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1193
|
+
"""
|
|
1194
|
+
...
|
|
1195
|
+
|
|
1196
|
+
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]]]:
|
|
1197
|
+
"""
|
|
1198
|
+
Decorator that helps cache, version and store models/datasets from huggingface hub.
|
|
1199
|
+
|
|
1200
|
+
> Examples
|
|
1201
|
+
|
|
1202
|
+
**Usage: creating references of models from huggingface that may be loaded in downstream steps**
|
|
1203
|
+
```python
|
|
1204
|
+
@huggingface_hub
|
|
1205
|
+
@step
|
|
1206
|
+
def pull_model_from_huggingface(self):
|
|
1207
|
+
# `current.huggingface_hub.snapshot_download` downloads the model from the Hugging Face Hub
|
|
1208
|
+
# and saves it in the backend storage based on the model's `repo_id`. If there exists a model
|
|
1209
|
+
# with the same `repo_id` in the backend storage, it will not download the model again. The return
|
|
1210
|
+
# value of the function is a reference to the model in the backend storage.
|
|
1211
|
+
# This reference can be used to load the model in the subsequent steps via `@model(load=["llama_model"])`
|
|
1212
|
+
|
|
1213
|
+
self.model_id = "mistralai/Mistral-7B-Instruct-v0.1"
|
|
1214
|
+
self.llama_model = current.huggingface_hub.snapshot_download(
|
|
1215
|
+
repo_id=self.model_id,
|
|
1216
|
+
allow_patterns=["*.safetensors", "*.json", "tokenizer.*"],
|
|
1217
|
+
)
|
|
1218
|
+
self.next(self.train)
|
|
1219
|
+
```
|
|
1220
|
+
|
|
1221
|
+
**Usage: loading models directly from huggingface hub or from cache (from metaflow's datastore)**
|
|
1222
|
+
```python
|
|
1223
|
+
@huggingface_hub(load=["mistralai/Mistral-7B-Instruct-v0.1"])
|
|
1224
|
+
@step
|
|
1225
|
+
def pull_model_from_huggingface(self):
|
|
1226
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
1227
|
+
```
|
|
1228
|
+
|
|
1229
|
+
```python
|
|
1230
|
+
@huggingface_hub(load=[("mistralai/Mistral-7B-Instruct-v0.1", "/my-directory"), ("myorg/mistral-lora, "/my-lora-directory")])
|
|
1231
|
+
@step
|
|
1232
|
+
def finetune_model(self):
|
|
1233
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
1234
|
+
# path_to_model will be /my-directory
|
|
1235
|
+
```
|
|
1236
|
+
|
|
1237
|
+
```python
|
|
1238
|
+
# Takes all the arguments passed to `snapshot_download`
|
|
1239
|
+
# except for `local_dir`
|
|
1240
|
+
@huggingface_hub(load=[
|
|
1241
|
+
{
|
|
1242
|
+
"repo_id": "mistralai/Mistral-7B-Instruct-v0.1",
|
|
1243
|
+
},
|
|
1244
|
+
{
|
|
1245
|
+
"repo_id": "myorg/mistral-lora",
|
|
1246
|
+
"repo_type": "model",
|
|
1247
|
+
},
|
|
1248
|
+
])
|
|
1249
|
+
@step
|
|
1250
|
+
def finetune_model(self):
|
|
1251
|
+
path_to_model = current.huggingface_hub.loaded["mistralai/Mistral-7B-Instruct-v0.1"]
|
|
1252
|
+
# path_to_model will be /my-directory
|
|
1253
|
+
```
|
|
1264
1254
|
|
|
1265
1255
|
|
|
1266
1256
|
Parameters
|
|
1267
1257
|
----------
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
description : str
|
|
1284
|
-
Description of sensor in the Airflow UI
|
|
1285
|
-
bucket_key : Union[str, List[str]]
|
|
1286
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1287
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1288
|
-
bucket_name : str
|
|
1289
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1290
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1291
|
-
wildcard_match : bool
|
|
1292
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1293
|
-
aws_conn_id : str
|
|
1294
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1295
|
-
verify : bool
|
|
1296
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1258
|
+
temp_dir_root : str, optional
|
|
1259
|
+
The root directory that will hold the temporary directory where objects will be downloaded.
|
|
1260
|
+
|
|
1261
|
+
load: Union[List[str], List[Tuple[Dict, str]], List[Tuple[str, str]], List[Dict], None]
|
|
1262
|
+
The list of repos (models/datasets) to load.
|
|
1263
|
+
|
|
1264
|
+
Loaded repos can be accessed via `current.huggingface_hub.loaded`. If load is set, then the following happens:
|
|
1265
|
+
|
|
1266
|
+
- If repo (model/dataset) is not found in the datastore:
|
|
1267
|
+
- Downloads the repo from Hugging Face Hub to a temporary directory (or uses specified path) for local access
|
|
1268
|
+
- Stores it in Metaflow's datastore (s3/gcs/azure etc.) with a unique name based on repo_type/repo_id
|
|
1269
|
+
- All HF models loaded for a `@step` will be cached separately under flow/step/namespace.
|
|
1270
|
+
|
|
1271
|
+
- If repo is found in the datastore:
|
|
1272
|
+
- Loads it directly from datastore to local path (can be temporary directory or specified path)
|
|
1297
1273
|
"""
|
|
1298
1274
|
...
|
|
1299
1275
|
|
|
@@ -1411,57 +1387,6 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
|
1411
1387
|
"""
|
|
1412
1388
|
...
|
|
1413
1389
|
|
|
1414
|
-
@typing.overload
|
|
1415
|
-
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]]:
|
|
1416
|
-
"""
|
|
1417
|
-
Specifies the Conda environment for all steps of the flow.
|
|
1418
|
-
|
|
1419
|
-
Use `@conda_base` to set common libraries required by all
|
|
1420
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
Parameters
|
|
1424
|
-
----------
|
|
1425
|
-
packages : Dict[str, str], default {}
|
|
1426
|
-
Packages to use for this flow. The key is the name of the package
|
|
1427
|
-
and the value is the version to use.
|
|
1428
|
-
libraries : Dict[str, str], default {}
|
|
1429
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1430
|
-
python : str, optional, default None
|
|
1431
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1432
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1433
|
-
disabled : bool, default False
|
|
1434
|
-
If set to True, disables Conda.
|
|
1435
|
-
"""
|
|
1436
|
-
...
|
|
1437
|
-
|
|
1438
|
-
@typing.overload
|
|
1439
|
-
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1440
|
-
...
|
|
1441
|
-
|
|
1442
|
-
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
1443
|
-
"""
|
|
1444
|
-
Specifies the Conda environment for all steps of the flow.
|
|
1445
|
-
|
|
1446
|
-
Use `@conda_base` to set common libraries required by all
|
|
1447
|
-
steps and use `@conda` to specify step-specific additions.
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
Parameters
|
|
1451
|
-
----------
|
|
1452
|
-
packages : Dict[str, str], default {}
|
|
1453
|
-
Packages to use for this flow. The key is the name of the package
|
|
1454
|
-
and the value is the version to use.
|
|
1455
|
-
libraries : Dict[str, str], default {}
|
|
1456
|
-
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1457
|
-
python : str, optional, default None
|
|
1458
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1459
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1460
|
-
disabled : bool, default False
|
|
1461
|
-
If set to True, disables Conda.
|
|
1462
|
-
"""
|
|
1463
|
-
...
|
|
1464
|
-
|
|
1465
1390
|
@typing.overload
|
|
1466
1391
|
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]]:
|
|
1467
1392
|
"""
|
|
@@ -1513,131 +1438,181 @@ def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly:
|
|
|
1513
1438
|
"""
|
|
1514
1439
|
...
|
|
1515
1440
|
|
|
1516
|
-
|
|
1517
|
-
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]]:
|
|
1441
|
+
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]]:
|
|
1518
1442
|
"""
|
|
1519
|
-
|
|
1443
|
+
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.
|
|
1444
|
+
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.
|
|
1520
1445
|
|
|
1521
|
-
```
|
|
1522
|
-
@trigger(event='foo')
|
|
1523
|
-
```
|
|
1524
|
-
or
|
|
1525
|
-
```
|
|
1526
|
-
@trigger(events=['foo', 'bar'])
|
|
1527
|
-
```
|
|
1528
1446
|
|
|
1529
|
-
|
|
1530
|
-
|
|
1531
|
-
|
|
1532
|
-
|
|
1533
|
-
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1447
|
+
Parameters
|
|
1448
|
+
----------
|
|
1449
|
+
timeout : int
|
|
1450
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1451
|
+
poke_interval : int
|
|
1452
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1453
|
+
mode : str
|
|
1454
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1455
|
+
exponential_backoff : bool
|
|
1456
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1457
|
+
pool : str
|
|
1458
|
+
the slot pool this task should run in,
|
|
1459
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1460
|
+
soft_fail : bool
|
|
1461
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1462
|
+
name : str
|
|
1463
|
+
Name of the sensor on Airflow
|
|
1464
|
+
description : str
|
|
1465
|
+
Description of sensor in the Airflow UI
|
|
1466
|
+
external_dag_id : str
|
|
1467
|
+
The dag_id that contains the task you want to wait for.
|
|
1468
|
+
external_task_ids : List[str]
|
|
1469
|
+
The list of task_ids that you want to wait for.
|
|
1470
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1471
|
+
allowed_states : List[str]
|
|
1472
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1473
|
+
failed_states : List[str]
|
|
1474
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1475
|
+
execution_delta : datetime.timedelta
|
|
1476
|
+
time difference with the previous execution to look at,
|
|
1477
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1478
|
+
check_existence: bool
|
|
1479
|
+
Set to True to check if the external task exists or check if
|
|
1480
|
+
the DAG to wait for exists. (Default: True)
|
|
1481
|
+
"""
|
|
1482
|
+
...
|
|
1483
|
+
|
|
1484
|
+
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]]:
|
|
1485
|
+
"""
|
|
1486
|
+
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)
|
|
1487
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1488
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1489
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1490
|
+
starts only after all sensors finish.
|
|
1539
1491
|
|
|
1540
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
1541
|
-
```
|
|
1542
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1543
|
-
```
|
|
1544
|
-
This is equivalent to:
|
|
1545
|
-
```
|
|
1546
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1547
|
-
```
|
|
1548
1492
|
|
|
1493
|
+
Parameters
|
|
1494
|
+
----------
|
|
1495
|
+
timeout : int
|
|
1496
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1497
|
+
poke_interval : int
|
|
1498
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1499
|
+
mode : str
|
|
1500
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1501
|
+
exponential_backoff : bool
|
|
1502
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1503
|
+
pool : str
|
|
1504
|
+
the slot pool this task should run in,
|
|
1505
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1506
|
+
soft_fail : bool
|
|
1507
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1508
|
+
name : str
|
|
1509
|
+
Name of the sensor on Airflow
|
|
1510
|
+
description : str
|
|
1511
|
+
Description of sensor in the Airflow UI
|
|
1512
|
+
bucket_key : Union[str, List[str]]
|
|
1513
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1514
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1515
|
+
bucket_name : str
|
|
1516
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1517
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1518
|
+
wildcard_match : bool
|
|
1519
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1520
|
+
aws_conn_id : str
|
|
1521
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1522
|
+
verify : bool
|
|
1523
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1524
|
+
"""
|
|
1525
|
+
...
|
|
1526
|
+
|
|
1527
|
+
@typing.overload
|
|
1528
|
+
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1529
|
+
"""
|
|
1530
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1531
|
+
|
|
1532
|
+
Use `@pypi_base` to set common packages required by all
|
|
1533
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1549
1534
|
|
|
1550
1535
|
Parameters
|
|
1551
1536
|
----------
|
|
1552
|
-
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1537
|
+
packages : Dict[str, str], default: {}
|
|
1538
|
+
Packages to use for this flow. The key is the name of the package
|
|
1539
|
+
and the value is the version to use.
|
|
1540
|
+
python : str, optional, default: None
|
|
1541
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1542
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1558
1543
|
"""
|
|
1559
1544
|
...
|
|
1560
1545
|
|
|
1561
1546
|
@typing.overload
|
|
1562
|
-
def
|
|
1547
|
+
def pypi_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1548
|
+
...
|
|
1549
|
+
|
|
1550
|
+
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1551
|
+
"""
|
|
1552
|
+
Specifies the PyPI packages for all steps of the flow.
|
|
1553
|
+
|
|
1554
|
+
Use `@pypi_base` to set common packages required by all
|
|
1555
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1556
|
+
|
|
1557
|
+
Parameters
|
|
1558
|
+
----------
|
|
1559
|
+
packages : Dict[str, str], default: {}
|
|
1560
|
+
Packages to use for this flow. The key is the name of the package
|
|
1561
|
+
and the value is the version to use.
|
|
1562
|
+
python : str, optional, default: None
|
|
1563
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1564
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1565
|
+
"""
|
|
1563
1566
|
...
|
|
1564
1567
|
|
|
1565
|
-
|
|
1568
|
+
@typing.overload
|
|
1569
|
+
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]]:
|
|
1566
1570
|
"""
|
|
1567
|
-
Specifies the
|
|
1568
|
-
|
|
1569
|
-
```
|
|
1570
|
-
@trigger(event='foo')
|
|
1571
|
-
```
|
|
1572
|
-
or
|
|
1573
|
-
```
|
|
1574
|
-
@trigger(events=['foo', 'bar'])
|
|
1575
|
-
```
|
|
1576
|
-
|
|
1577
|
-
Additionally, you can specify the parameter mappings
|
|
1578
|
-
to map event payload to Metaflow parameters for the flow.
|
|
1579
|
-
```
|
|
1580
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1581
|
-
```
|
|
1582
|
-
or
|
|
1583
|
-
```
|
|
1584
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1585
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1586
|
-
```
|
|
1571
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1587
1572
|
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1591
|
-
```
|
|
1592
|
-
This is equivalent to:
|
|
1593
|
-
```
|
|
1594
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1595
|
-
```
|
|
1573
|
+
Use `@conda_base` to set common libraries required by all
|
|
1574
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1596
1575
|
|
|
1597
1576
|
|
|
1598
1577
|
Parameters
|
|
1599
1578
|
----------
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1579
|
+
packages : Dict[str, str], default {}
|
|
1580
|
+
Packages to use for this flow. The key is the name of the package
|
|
1581
|
+
and the value is the version to use.
|
|
1582
|
+
libraries : Dict[str, str], default {}
|
|
1583
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1584
|
+
python : str, optional, default None
|
|
1585
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1586
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1587
|
+
disabled : bool, default False
|
|
1588
|
+
If set to True, disables Conda.
|
|
1606
1589
|
"""
|
|
1607
1590
|
...
|
|
1608
1591
|
|
|
1609
|
-
|
|
1592
|
+
@typing.overload
|
|
1593
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1594
|
+
...
|
|
1595
|
+
|
|
1596
|
+
def conda_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, libraries: typing.Dict[str, str] = {}, python: typing.Optional[str] = None, disabled: bool = False):
|
|
1610
1597
|
"""
|
|
1611
|
-
Specifies
|
|
1598
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1612
1599
|
|
|
1613
|
-
|
|
1614
|
-
use
|
|
1600
|
+
Use `@conda_base` to set common libraries required by all
|
|
1601
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1615
1602
|
|
|
1616
1603
|
|
|
1617
1604
|
Parameters
|
|
1618
1605
|
----------
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
|
|
1630
|
-
production : bool, default False
|
|
1631
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
1632
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
1633
|
-
`production` in the decorator and on the command line.
|
|
1634
|
-
The project branch name will be:
|
|
1635
|
-
- if `branch` is specified:
|
|
1636
|
-
- if `production` is True: `prod.<branch>`
|
|
1637
|
-
- if `production` is False: `test.<branch>`
|
|
1638
|
-
- if `branch` is not specified:
|
|
1639
|
-
- if `production` is True: `prod`
|
|
1640
|
-
- if `production` is False: `user.<username>`
|
|
1606
|
+
packages : Dict[str, str], default {}
|
|
1607
|
+
Packages to use for this flow. The key is the name of the package
|
|
1608
|
+
and the value is the version to use.
|
|
1609
|
+
libraries : Dict[str, str], default {}
|
|
1610
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1611
|
+
python : str, optional, default None
|
|
1612
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1613
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1614
|
+
disabled : bool, default False
|
|
1615
|
+
If set to True, disables Conda.
|
|
1641
1616
|
"""
|
|
1642
1617
|
...
|
|
1643
1618
|
|
|
@@ -1742,87 +1717,131 @@ def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *
|
|
|
1742
1717
|
"""
|
|
1743
1718
|
...
|
|
1744
1719
|
|
|
1745
|
-
|
|
1746
|
-
def pypi_base(*, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1720
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1747
1721
|
"""
|
|
1748
|
-
Specifies
|
|
1722
|
+
Specifies what flows belong to the same project.
|
|
1723
|
+
|
|
1724
|
+
A project-specific namespace is created for all flows that
|
|
1725
|
+
use the same `@project(name)`.
|
|
1749
1726
|
|
|
1750
|
-
Use `@pypi_base` to set common packages required by all
|
|
1751
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1752
1727
|
|
|
1753
1728
|
Parameters
|
|
1754
1729
|
----------
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1730
|
+
name : str
|
|
1731
|
+
Project name. Make sure that the name is unique amongst all
|
|
1732
|
+
projects that use the same production scheduler. The name may
|
|
1733
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1734
|
+
|
|
1735
|
+
branch : Optional[str], default None
|
|
1736
|
+
The branch to use. If not specified, the branch is set to
|
|
1737
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1738
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1739
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1740
|
+
|
|
1741
|
+
production : bool, default False
|
|
1742
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1743
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1744
|
+
`production` in the decorator and on the command line.
|
|
1745
|
+
The project branch name will be:
|
|
1746
|
+
- if `branch` is specified:
|
|
1747
|
+
- if `production` is True: `prod.<branch>`
|
|
1748
|
+
- if `production` is False: `test.<branch>`
|
|
1749
|
+
- if `branch` is not specified:
|
|
1750
|
+
- if `production` is True: `prod`
|
|
1751
|
+
- if `production` is False: `user.<username>`
|
|
1761
1752
|
"""
|
|
1762
1753
|
...
|
|
1763
1754
|
|
|
1764
1755
|
@typing.overload
|
|
1765
|
-
def
|
|
1766
|
-
...
|
|
1767
|
-
|
|
1768
|
-
def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packages: typing.Dict[str, str] = {}, python: typing.Optional[str] = None):
|
|
1756
|
+
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]]:
|
|
1769
1757
|
"""
|
|
1770
|
-
Specifies the
|
|
1758
|
+
Specifies the event(s) that this flow depends on.
|
|
1759
|
+
|
|
1760
|
+
```
|
|
1761
|
+
@trigger(event='foo')
|
|
1762
|
+
```
|
|
1763
|
+
or
|
|
1764
|
+
```
|
|
1765
|
+
@trigger(events=['foo', 'bar'])
|
|
1766
|
+
```
|
|
1767
|
+
|
|
1768
|
+
Additionally, you can specify the parameter mappings
|
|
1769
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1770
|
+
```
|
|
1771
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1772
|
+
```
|
|
1773
|
+
or
|
|
1774
|
+
```
|
|
1775
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1776
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1777
|
+
```
|
|
1778
|
+
|
|
1779
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1780
|
+
```
|
|
1781
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1782
|
+
```
|
|
1783
|
+
This is equivalent to:
|
|
1784
|
+
```
|
|
1785
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1786
|
+
```
|
|
1771
1787
|
|
|
1772
|
-
Use `@pypi_base` to set common packages required by all
|
|
1773
|
-
steps and use `@pypi` to specify step-specific overrides.
|
|
1774
1788
|
|
|
1775
1789
|
Parameters
|
|
1776
1790
|
----------
|
|
1777
|
-
|
|
1778
|
-
|
|
1779
|
-
|
|
1780
|
-
|
|
1781
|
-
|
|
1782
|
-
|
|
1791
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1792
|
+
Event dependency for this flow.
|
|
1793
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1794
|
+
Events dependency for this flow.
|
|
1795
|
+
options : Dict[str, Any], default {}
|
|
1796
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1783
1797
|
"""
|
|
1784
1798
|
...
|
|
1785
1799
|
|
|
1786
|
-
|
|
1800
|
+
@typing.overload
|
|
1801
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1802
|
+
...
|
|
1803
|
+
|
|
1804
|
+
def trigger(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, event: typing.Union[str, typing.Dict[str, typing.Any], None] = None, events: typing.List[typing.Union[str, typing.Dict[str, typing.Any]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
1787
1805
|
"""
|
|
1788
|
-
|
|
1789
|
-
|
|
1806
|
+
Specifies the event(s) that this flow depends on.
|
|
1807
|
+
|
|
1808
|
+
```
|
|
1809
|
+
@trigger(event='foo')
|
|
1810
|
+
```
|
|
1811
|
+
or
|
|
1812
|
+
```
|
|
1813
|
+
@trigger(events=['foo', 'bar'])
|
|
1814
|
+
```
|
|
1815
|
+
|
|
1816
|
+
Additionally, you can specify the parameter mappings
|
|
1817
|
+
to map event payload to Metaflow parameters for the flow.
|
|
1818
|
+
```
|
|
1819
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1820
|
+
```
|
|
1821
|
+
or
|
|
1822
|
+
```
|
|
1823
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1824
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1825
|
+
```
|
|
1826
|
+
|
|
1827
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
1828
|
+
```
|
|
1829
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1830
|
+
```
|
|
1831
|
+
This is equivalent to:
|
|
1832
|
+
```
|
|
1833
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1834
|
+
```
|
|
1790
1835
|
|
|
1791
1836
|
|
|
1792
1837
|
Parameters
|
|
1793
1838
|
----------
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
exponential_backoff : bool
|
|
1801
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1802
|
-
pool : str
|
|
1803
|
-
the slot pool this task should run in,
|
|
1804
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1805
|
-
soft_fail : bool
|
|
1806
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1807
|
-
name : str
|
|
1808
|
-
Name of the sensor on Airflow
|
|
1809
|
-
description : str
|
|
1810
|
-
Description of sensor in the Airflow UI
|
|
1811
|
-
external_dag_id : str
|
|
1812
|
-
The dag_id that contains the task you want to wait for.
|
|
1813
|
-
external_task_ids : List[str]
|
|
1814
|
-
The list of task_ids that you want to wait for.
|
|
1815
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1816
|
-
allowed_states : List[str]
|
|
1817
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1818
|
-
failed_states : List[str]
|
|
1819
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1820
|
-
execution_delta : datetime.timedelta
|
|
1821
|
-
time difference with the previous execution to look at,
|
|
1822
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1823
|
-
check_existence: bool
|
|
1824
|
-
Set to True to check if the external task exists or check if
|
|
1825
|
-
the DAG to wait for exists. (Default: True)
|
|
1839
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
1840
|
+
Event dependency for this flow.
|
|
1841
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
1842
|
+
Events dependency for this flow.
|
|
1843
|
+
options : Dict[str, Any], default {}
|
|
1844
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1826
1845
|
"""
|
|
1827
1846
|
...
|
|
1828
1847
|
|