ob-metaflow-stubs 6.0.10.17__py2.py3-none-any.whl → 6.0.10.19__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 +1109 -1109
- metaflow-stubs/cards.pyi +2 -2
- metaflow-stubs/cli.pyi +2 -2
- metaflow-stubs/cli_components/__init__.pyi +2 -2
- metaflow-stubs/cli_components/utils.pyi +2 -2
- metaflow-stubs/client/__init__.pyi +2 -2
- metaflow-stubs/client/core.pyi +5 -5
- metaflow-stubs/client/filecache.pyi +3 -3
- metaflow-stubs/events.pyi +3 -3
- metaflow-stubs/exception.pyi +2 -2
- metaflow-stubs/flowspec.pyi +6 -6
- metaflow-stubs/generated_for.txt +1 -1
- metaflow-stubs/includefile.pyi +3 -3
- metaflow-stubs/meta_files.pyi +2 -2
- metaflow-stubs/metadata_provider/__init__.pyi +2 -2
- metaflow-stubs/metadata_provider/heartbeat.pyi +2 -2
- metaflow-stubs/metadata_provider/metadata.pyi +3 -3
- metaflow-stubs/metadata_provider/util.pyi +2 -2
- metaflow-stubs/metaflow_config.pyi +2 -2
- metaflow-stubs/metaflow_current.pyi +51 -51
- 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 +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/checkpoint_lister.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/cards/lineage_card.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/checkpoint_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/constructors.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/core.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/checkpoints/decorator.pyi +5 -5
- 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 +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/core.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/decorator.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/task_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastore/utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/datastructures.pyi +3 -3
- 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/cards/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/cards/hf_hub_card.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/hf_hub/decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/core.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/modeling_utils/model_storage.pyi +4 -4
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/flowspec_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/general.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/identity_utils.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/base.pyi +2 -2
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/serialization_handler/tar.pyi +3 -3
- metaflow-stubs/mf_extensions/obcheckpoint/plugins/machine_learning_utilities/utils/tar_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/_state_machine.pyi +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 +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/cli_generator.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/config_utils.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/schema_export.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/typed_configs.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/config/unified_config.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/apps/core/dependencies.pyi +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 +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/aws/assume_role_decorator.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/async_cards.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/plugins/card_utilities/injector.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/coreweave.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/checkpoint_datastores/nebius.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/baker.pyi +4 -4
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/docker_environment.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/fast_bakery/fast_bakery.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/kubernetes/pod_killer.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/constants.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/exceptions.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/ollama.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/ollama/status_card.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/plugins/snowflake/snowflake.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/profilers/gpu.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/remote_config.pyi +3 -3
- metaflow-stubs/mf_extensions/outerbounds/toplevel/__init__.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/global_aliases_for_metaflow_package.pyi +2 -2
- metaflow-stubs/mf_extensions/outerbounds/toplevel/s3_proxy.pyi +2 -2
- metaflow-stubs/multicore_utils.pyi +2 -2
- metaflow-stubs/ob_internal.pyi +2 -2
- metaflow-stubs/packaging_sys/__init__.pyi +7 -7
- metaflow-stubs/packaging_sys/backend.pyi +2 -2
- metaflow-stubs/packaging_sys/distribution_support.pyi +4 -4
- metaflow-stubs/packaging_sys/tar_backend.pyi +5 -5
- metaflow-stubs/packaging_sys/utils.pyi +2 -2
- metaflow-stubs/packaging_sys/v1.pyi +4 -4
- metaflow-stubs/parameters.pyi +3 -3
- metaflow-stubs/plugins/__init__.pyi +12 -12
- metaflow-stubs/plugins/airflow/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/airflow_utils.pyi +2 -2
- metaflow-stubs/plugins/airflow/exception.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/__init__.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/base_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/external_task_sensor.pyi +2 -2
- metaflow-stubs/plugins/airflow/sensors/s3_sensor.pyi +2 -2
- metaflow-stubs/plugins/argo/__init__.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_client.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_events.pyi +2 -2
- metaflow-stubs/plugins/argo/argo_workflows.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_decorator.pyi +3 -3
- metaflow-stubs/plugins/argo/argo_workflows_deployer.pyi +4 -4
- metaflow-stubs/plugins/argo/argo_workflows_deployer_objects.pyi +4 -4
- metaflow-stubs/plugins/argo/exit_hooks.pyi +3 -3
- metaflow-stubs/plugins/aws/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_client.pyi +2 -2
- metaflow-stubs/plugins/aws/aws_utils.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_client.pyi +2 -2
- metaflow-stubs/plugins/aws/batch/batch_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/secrets_manager/aws_secrets_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/aws/step_functions/__init__.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/event_bridge_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/schedule_decorator.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_client.pyi +2 -2
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer.pyi +4 -4
- metaflow-stubs/plugins/aws/step_functions/step_functions_deployer_objects.pyi +4 -4
- metaflow-stubs/plugins/azure/__init__.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_credential.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_exceptions.pyi +2 -2
- metaflow-stubs/plugins/azure/azure_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/azure/azure_utils.pyi +2 -2
- metaflow-stubs/plugins/azure/blob_service_client_factory.pyi +2 -2
- metaflow-stubs/plugins/azure/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/cards/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_client.pyi +3 -3
- 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 +3 -3
- metaflow-stubs/plugins/cards/card_modules/__init__.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/basic.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/card.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/components.pyi +18 -6
- metaflow-stubs/plugins/cards/card_modules/convert_to_native_type.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/json_viewer.pyi +4 -4
- metaflow-stubs/plugins/cards/card_modules/renderer_tools.pyi +2 -2
- metaflow-stubs/plugins/cards/card_modules/test_cards.pyi +2 -2
- metaflow-stubs/plugins/cards/card_resolver.pyi +2 -2
- metaflow-stubs/plugins/cards/component_serializer.pyi +2 -2
- metaflow-stubs/plugins/cards/exception.pyi +2 -2
- metaflow-stubs/plugins/catch_decorator.pyi +2 -2
- metaflow-stubs/plugins/datatools/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/local.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/__init__.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3.pyi +3 -3
- metaflow-stubs/plugins/datatools/s3/s3tail.pyi +2 -2
- metaflow-stubs/plugins/datatools/s3/s3util.pyi +2 -2
- metaflow-stubs/plugins/debug_logger.pyi +2 -2
- metaflow-stubs/plugins/debug_monitor.pyi +2 -2
- metaflow-stubs/plugins/environment_decorator.pyi +2 -2
- metaflow-stubs/plugins/events_decorator.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/__init__.pyi +2 -2
- metaflow-stubs/plugins/exit_hook/exit_hook_decorator.pyi +2 -2
- metaflow-stubs/plugins/frameworks/__init__.pyi +2 -2
- metaflow-stubs/plugins/frameworks/pytorch.pyi +2 -2
- metaflow-stubs/plugins/gcp/__init__.pyi +2 -2
- metaflow-stubs/plugins/gcp/gcp_secret_manager_secrets_provider.pyi +3 -3
- metaflow-stubs/plugins/gcp/gs_exceptions.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_storage_client_factory.pyi +2 -2
- metaflow-stubs/plugins/gcp/gs_utils.pyi +2 -2
- metaflow-stubs/plugins/gcp/includefile_support.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/__init__.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kube_utils.pyi +3 -3
- metaflow-stubs/plugins/kubernetes/kubernetes.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_client.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_decorator.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/kubernetes_jobsets.pyi +2 -2
- metaflow-stubs/plugins/kubernetes/spot_monitor_sidecar.pyi +2 -2
- metaflow-stubs/plugins/ollama/__init__.pyi +2 -2
- metaflow-stubs/plugins/optuna/__init__.pyi +2 -2
- metaflow-stubs/plugins/parallel_decorator.pyi +2 -2
- metaflow-stubs/plugins/parsers.pyi +2 -2
- metaflow-stubs/plugins/perimeters.pyi +2 -2
- metaflow-stubs/plugins/project_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/__init__.pyi +3 -3
- metaflow-stubs/plugins/pypi/conda_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/conda_environment.pyi +5 -5
- metaflow-stubs/plugins/pypi/parsers.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_decorator.pyi +2 -2
- metaflow-stubs/plugins/pypi/pypi_environment.pyi +2 -2
- metaflow-stubs/plugins/pypi/utils.pyi +2 -2
- metaflow-stubs/plugins/resources_decorator.pyi +2 -2
- metaflow-stubs/plugins/retry_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/__init__.pyi +2 -2
- metaflow-stubs/plugins/secrets/inline_secrets_provider.pyi +4 -4
- metaflow-stubs/plugins/secrets/secrets_decorator.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_func.pyi +2 -2
- metaflow-stubs/plugins/secrets/secrets_spec.pyi +2 -2
- metaflow-stubs/plugins/secrets/utils.pyi +2 -2
- metaflow-stubs/plugins/snowflake/__init__.pyi +2 -2
- metaflow-stubs/plugins/storage_executor.pyi +2 -2
- metaflow-stubs/plugins/test_unbounded_foreach_decorator.pyi +2 -2
- metaflow-stubs/plugins/timeout_decorator.pyi +2 -2
- metaflow-stubs/plugins/torchtune/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/__init__.pyi +2 -2
- metaflow-stubs/plugins/uv/uv_environment.pyi +2 -2
- metaflow-stubs/profilers/__init__.pyi +2 -2
- metaflow-stubs/pylint_wrapper.pyi +2 -2
- metaflow-stubs/runner/__init__.pyi +2 -2
- metaflow-stubs/runner/deployer.pyi +34 -34
- metaflow-stubs/runner/deployer_impl.pyi +2 -2
- metaflow-stubs/runner/metaflow_runner.pyi +4 -4
- metaflow-stubs/runner/nbdeploy.pyi +2 -2
- metaflow-stubs/runner/nbrun.pyi +2 -2
- metaflow-stubs/runner/subprocess_manager.pyi +2 -2
- metaflow-stubs/runner/utils.pyi +2 -2
- metaflow-stubs/system/__init__.pyi +2 -2
- metaflow-stubs/system/system_logger.pyi +2 -2
- metaflow-stubs/system/system_monitor.pyi +2 -2
- metaflow-stubs/tagging_util.pyi +2 -2
- metaflow-stubs/tuple_util.pyi +2 -2
- metaflow-stubs/user_configs/__init__.pyi +2 -2
- metaflow-stubs/user_configs/config_options.pyi +3 -3
- metaflow-stubs/user_configs/config_parameters.pyi +6 -6
- metaflow-stubs/user_decorators/__init__.pyi +2 -2
- metaflow-stubs/user_decorators/common.pyi +2 -2
- metaflow-stubs/user_decorators/mutable_flow.pyi +4 -4
- metaflow-stubs/user_decorators/mutable_step.pyi +4 -4
- metaflow-stubs/user_decorators/user_flow_decorator.pyi +5 -5
- metaflow-stubs/user_decorators/user_step_decorator.pyi +6 -6
- {ob_metaflow_stubs-6.0.10.17.dist-info → ob_metaflow_stubs-6.0.10.19.dist-info}/METADATA +1 -1
- ob_metaflow_stubs-6.0.10.19.dist-info/RECORD +266 -0
- ob_metaflow_stubs-6.0.10.17.dist-info/RECORD +0 -266
- {ob_metaflow_stubs-6.0.10.17.dist-info → ob_metaflow_stubs-6.0.10.19.dist-info}/WHEEL +0 -0
- {ob_metaflow_stubs-6.0.10.17.dist-info → ob_metaflow_stubs-6.0.10.19.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.18.
|
|
4
|
-
# Generated on 2025-10-
|
|
3
|
+
# MF version: 2.18.13.1+obcheckpoint(0.2.8);ob(v1) #
|
|
4
|
+
# Generated on 2025-10-21T09:01:27.410960 #
|
|
5
5
|
######################################################################################################
|
|
6
6
|
|
|
7
7
|
from __future__ import annotations
|
|
8
8
|
|
|
9
9
|
import typing
|
|
10
10
|
if typing.TYPE_CHECKING:
|
|
11
|
-
import typing
|
|
12
11
|
import datetime
|
|
12
|
+
import typing
|
|
13
13
|
FlowSpecDerived = typing.TypeVar("FlowSpecDerived", bound="FlowSpec", contravariant=False, covariant=False)
|
|
14
14
|
StepFlag = typing.NewType("StepFlag", bool)
|
|
15
15
|
|
|
@@ -39,19 +39,19 @@ from .user_decorators.user_step_decorator import UserStepDecorator as UserStepDe
|
|
|
39
39
|
from .user_decorators.user_step_decorator import StepMutator as StepMutator
|
|
40
40
|
from .user_decorators.user_step_decorator import user_step_decorator as user_step_decorator
|
|
41
41
|
from .user_decorators.user_flow_decorator import FlowMutator as FlowMutator
|
|
42
|
+
from . import events as events
|
|
42
43
|
from . import metaflow_git as metaflow_git
|
|
43
|
-
from . import tuple_util as tuple_util
|
|
44
44
|
from . import cards as cards
|
|
45
|
-
from . import
|
|
45
|
+
from . import tuple_util as tuple_util
|
|
46
46
|
from . import runner as runner
|
|
47
47
|
from . import plugins as plugins
|
|
48
48
|
from .mf_extensions.outerbounds.toplevel.global_aliases_for_metaflow_package import S3 as S3
|
|
49
49
|
from . import includefile as includefile
|
|
50
50
|
from .includefile import IncludeFile as IncludeFile
|
|
51
|
+
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
52
|
+
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
51
53
|
from .plugins.parsers import yaml_parser as yaml_parser
|
|
52
54
|
from .plugins.pypi.parsers import requirements_txt_parser as requirements_txt_parser
|
|
53
|
-
from .plugins.pypi.parsers import conda_environment_yml_parser as conda_environment_yml_parser
|
|
54
|
-
from .plugins.pypi.parsers import pyproject_toml_parser as pyproject_toml_parser
|
|
55
55
|
from . import client as client
|
|
56
56
|
from .client.core import namespace as namespace
|
|
57
57
|
from .client.core import get_namespace as get_namespace
|
|
@@ -170,276 +170,145 @@ def step(f: typing.Union[typing.Callable[[FlowSpecDerived], None], typing.Callab
|
|
|
170
170
|
...
|
|
171
171
|
|
|
172
172
|
@typing.overload
|
|
173
|
-
def
|
|
173
|
+
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]]]:
|
|
174
174
|
"""
|
|
175
|
-
Specifies the
|
|
175
|
+
Specifies the resources needed when executing this step.
|
|
176
176
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
177
|
+
Use `@resources` to specify the resource requirements
|
|
178
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
179
|
+
|
|
180
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
181
|
+
```
|
|
182
|
+
python myflow.py run --with batch
|
|
183
|
+
```
|
|
184
|
+
or
|
|
185
|
+
```
|
|
186
|
+
python myflow.py run --with kubernetes
|
|
187
|
+
```
|
|
188
|
+
which executes the flow on the desired system using the
|
|
189
|
+
requirements specified in `@resources`.
|
|
181
190
|
|
|
182
191
|
|
|
183
192
|
Parameters
|
|
184
193
|
----------
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
194
|
+
cpu : int, default 1
|
|
195
|
+
Number of CPUs required for this step.
|
|
196
|
+
gpu : int, optional, default None
|
|
197
|
+
Number of GPUs required for this step.
|
|
198
|
+
disk : int, optional, default None
|
|
199
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
200
|
+
memory : int, default 4096
|
|
201
|
+
Memory size (in MB) required for this step.
|
|
202
|
+
shared_memory : int, optional, default None
|
|
203
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
204
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
191
205
|
"""
|
|
192
206
|
...
|
|
193
207
|
|
|
194
208
|
@typing.overload
|
|
195
|
-
def
|
|
209
|
+
def resources(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
196
210
|
...
|
|
197
211
|
|
|
198
212
|
@typing.overload
|
|
199
|
-
def
|
|
213
|
+
def resources(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
200
214
|
...
|
|
201
215
|
|
|
202
|
-
def
|
|
216
|
+
def resources(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, cpu: int = 1, gpu: typing.Optional[int] = None, disk: typing.Optional[int] = None, memory: int = 4096, shared_memory: typing.Optional[int] = None):
|
|
203
217
|
"""
|
|
204
|
-
Specifies the
|
|
218
|
+
Specifies the resources needed when executing this step.
|
|
205
219
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
220
|
+
Use `@resources` to specify the resource requirements
|
|
221
|
+
independently of the specific compute layer (`@batch`, `@kubernetes`).
|
|
222
|
+
|
|
223
|
+
You can choose the compute layer on the command line by executing e.g.
|
|
224
|
+
```
|
|
225
|
+
python myflow.py run --with batch
|
|
226
|
+
```
|
|
227
|
+
or
|
|
228
|
+
```
|
|
229
|
+
python myflow.py run --with kubernetes
|
|
230
|
+
```
|
|
231
|
+
which executes the flow on the desired system using the
|
|
232
|
+
requirements specified in `@resources`.
|
|
210
233
|
|
|
211
234
|
|
|
212
235
|
Parameters
|
|
213
236
|
----------
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
237
|
+
cpu : int, default 1
|
|
238
|
+
Number of CPUs required for this step.
|
|
239
|
+
gpu : int, optional, default None
|
|
240
|
+
Number of GPUs required for this step.
|
|
241
|
+
disk : int, optional, default None
|
|
242
|
+
Disk size (in MB) required for this step. Only applies on Kubernetes.
|
|
243
|
+
memory : int, default 4096
|
|
244
|
+
Memory size (in MB) required for this step.
|
|
245
|
+
shared_memory : int, optional, default None
|
|
246
|
+
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
247
|
+
This parameter maps to the `--shm-size` option in Docker.
|
|
220
248
|
"""
|
|
221
249
|
...
|
|
222
250
|
|
|
223
|
-
|
|
251
|
+
@typing.overload
|
|
252
|
+
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
224
253
|
"""
|
|
225
|
-
|
|
226
|
-
It exists to make it easier for users to know that this decorator should only be used with
|
|
227
|
-
a Neo Cloud like Nebius. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
231
|
-
for S3 read and write requests.
|
|
232
|
-
|
|
233
|
-
This decorator requires an integration in the Outerbounds platform that
|
|
234
|
-
points to an external bucket. It affects S3 operations performed via
|
|
235
|
-
Metaflow's `get_aws_client` and `S3` within a `@step`.
|
|
236
|
-
|
|
237
|
-
Read operations
|
|
238
|
-
---------------
|
|
239
|
-
All read operations pass through the proxy. If an object does not already
|
|
240
|
-
exist in the external bucket, it is cached there. For example, if code reads
|
|
241
|
-
from buckets `FOO` and `BAR` using the `S3` interface, objects from both
|
|
242
|
-
buckets are cached in the external bucket.
|
|
243
|
-
|
|
244
|
-
During task execution, all S3‑related read requests are routed through the
|
|
245
|
-
proxy:
|
|
246
|
-
- If the object is present in the external object store, the proxy
|
|
247
|
-
streams it directly from there without accessing the requested origin
|
|
248
|
-
bucket.
|
|
249
|
-
- If the object is not present in the external storage, the proxy
|
|
250
|
-
fetches it from the requested bucket, caches it in the external
|
|
251
|
-
storage, and streams the response from the origin bucket.
|
|
252
|
-
|
|
253
|
-
Warning
|
|
254
|
-
-------
|
|
255
|
-
All READ operations (e.g., GetObject, HeadObject) pass through the external
|
|
256
|
-
bucket regardless of the bucket specified in user code. Even
|
|
257
|
-
`S3(run=self)` and `S3(s3root="mybucketfoo")` requests go through the
|
|
258
|
-
external bucket cache.
|
|
259
|
-
|
|
260
|
-
Write operations
|
|
261
|
-
----------------
|
|
262
|
-
Write behavior is controlled by the `write_mode` parameter, which determines
|
|
263
|
-
whether writes also persist objects in the cache.
|
|
264
|
-
|
|
265
|
-
`write_mode` values:
|
|
266
|
-
- `origin-and-cache`: objects are written both to the cache and to their
|
|
267
|
-
intended origin bucket.
|
|
268
|
-
- `origin`: objects are written only to their intended origin bucket.
|
|
254
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
269
255
|
|
|
270
256
|
|
|
271
257
|
Parameters
|
|
272
258
|
----------
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
that holds the configuration for the external, S3‑compatible object
|
|
276
|
-
storage bucket. If not specified, the only available S3 proxy
|
|
277
|
-
integration in the namespace is used (fails if multiple exist).
|
|
278
|
-
write_mode : str, optional
|
|
279
|
-
Controls whether writes also go to the external bucket.
|
|
280
|
-
- `origin` (default)
|
|
281
|
-
- `origin-and-cache`
|
|
282
|
-
debug : bool, optional
|
|
283
|
-
Enables debug logging for proxy operations.
|
|
259
|
+
vars : Dict[str, str], default {}
|
|
260
|
+
Dictionary of environment variables to set.
|
|
284
261
|
"""
|
|
285
262
|
...
|
|
286
263
|
|
|
287
264
|
@typing.overload
|
|
288
|
-
def
|
|
265
|
+
def environment(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
266
|
+
...
|
|
267
|
+
|
|
268
|
+
@typing.overload
|
|
269
|
+
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
270
|
+
...
|
|
271
|
+
|
|
272
|
+
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
289
273
|
"""
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
> Examples
|
|
293
|
-
|
|
294
|
-
- Saving Checkpoints
|
|
295
|
-
|
|
296
|
-
```python
|
|
297
|
-
@checkpoint
|
|
298
|
-
@step
|
|
299
|
-
def train(self):
|
|
300
|
-
model = create_model(self.parameters, checkpoint_path = None)
|
|
301
|
-
for i in range(self.epochs):
|
|
302
|
-
# some training logic
|
|
303
|
-
loss = model.train(self.dataset)
|
|
304
|
-
if i % 10 == 0:
|
|
305
|
-
model.save(
|
|
306
|
-
current.checkpoint.directory,
|
|
307
|
-
)
|
|
308
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
309
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
310
|
-
self.latest_checkpoint = current.checkpoint.save(
|
|
311
|
-
name="epoch_checkpoint",
|
|
312
|
-
metadata={
|
|
313
|
-
"epoch": i,
|
|
314
|
-
"loss": loss,
|
|
315
|
-
}
|
|
316
|
-
)
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
- Using Loaded Checkpoints
|
|
320
|
-
|
|
321
|
-
```python
|
|
322
|
-
@retry(times=3)
|
|
323
|
-
@checkpoint
|
|
324
|
-
@step
|
|
325
|
-
def train(self):
|
|
326
|
-
# Assume that the task has restarted and the previous attempt of the task
|
|
327
|
-
# saved a checkpoint
|
|
328
|
-
checkpoint_path = None
|
|
329
|
-
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
330
|
-
print("Loaded checkpoint from the previous attempt")
|
|
331
|
-
checkpoint_path = current.checkpoint.directory
|
|
332
|
-
|
|
333
|
-
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
334
|
-
for i in range(self.epochs):
|
|
335
|
-
...
|
|
336
|
-
```
|
|
274
|
+
Specifies environment variables to be set prior to the execution of a step.
|
|
337
275
|
|
|
338
276
|
|
|
339
277
|
Parameters
|
|
340
278
|
----------
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
344
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
345
|
-
will be loaded at the start of the task.
|
|
346
|
-
- "none": Do not load any checkpoint
|
|
347
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
348
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
349
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
350
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
351
|
-
|
|
352
|
-
temp_dir_root : str, default: None
|
|
353
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
279
|
+
vars : Dict[str, str], default {}
|
|
280
|
+
Dictionary of environment variables to set.
|
|
354
281
|
"""
|
|
355
282
|
...
|
|
356
283
|
|
|
357
284
|
@typing.overload
|
|
358
|
-
def
|
|
285
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
286
|
+
"""
|
|
287
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
288
|
+
to inject a card and render simple markdown content.
|
|
289
|
+
"""
|
|
359
290
|
...
|
|
360
291
|
|
|
361
292
|
@typing.overload
|
|
362
|
-
def
|
|
293
|
+
def test_append_card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
363
294
|
...
|
|
364
295
|
|
|
365
|
-
def
|
|
296
|
+
def test_append_card(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
366
297
|
"""
|
|
367
|
-
|
|
298
|
+
A simple decorator that demonstrates using CardDecoratorInjector
|
|
299
|
+
to inject a card and render simple markdown content.
|
|
300
|
+
"""
|
|
301
|
+
...
|
|
302
|
+
|
|
303
|
+
@typing.overload
|
|
304
|
+
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]]]:
|
|
305
|
+
"""
|
|
306
|
+
Specifies the Conda environment for the step.
|
|
368
307
|
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
```python
|
|
374
|
-
@checkpoint
|
|
375
|
-
@step
|
|
376
|
-
def train(self):
|
|
377
|
-
model = create_model(self.parameters, checkpoint_path = None)
|
|
378
|
-
for i in range(self.epochs):
|
|
379
|
-
# some training logic
|
|
380
|
-
loss = model.train(self.dataset)
|
|
381
|
-
if i % 10 == 0:
|
|
382
|
-
model.save(
|
|
383
|
-
current.checkpoint.directory,
|
|
384
|
-
)
|
|
385
|
-
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
386
|
-
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
387
|
-
self.latest_checkpoint = current.checkpoint.save(
|
|
388
|
-
name="epoch_checkpoint",
|
|
389
|
-
metadata={
|
|
390
|
-
"epoch": i,
|
|
391
|
-
"loss": loss,
|
|
392
|
-
}
|
|
393
|
-
)
|
|
394
|
-
```
|
|
395
|
-
|
|
396
|
-
- Using Loaded Checkpoints
|
|
397
|
-
|
|
398
|
-
```python
|
|
399
|
-
@retry(times=3)
|
|
400
|
-
@checkpoint
|
|
401
|
-
@step
|
|
402
|
-
def train(self):
|
|
403
|
-
# Assume that the task has restarted and the previous attempt of the task
|
|
404
|
-
# saved a checkpoint
|
|
405
|
-
checkpoint_path = None
|
|
406
|
-
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
407
|
-
print("Loaded checkpoint from the previous attempt")
|
|
408
|
-
checkpoint_path = current.checkpoint.directory
|
|
409
|
-
|
|
410
|
-
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
411
|
-
for i in range(self.epochs):
|
|
412
|
-
...
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
Parameters
|
|
417
|
-
----------
|
|
418
|
-
load_policy : str, default: "fresh"
|
|
419
|
-
The policy for loading the checkpoint. The following policies are supported:
|
|
420
|
-
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
421
|
-
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
422
|
-
will be loaded at the start of the task.
|
|
423
|
-
- "none": Do not load any checkpoint
|
|
424
|
-
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
425
|
-
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
426
|
-
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
427
|
-
created within the task will be loaded when the task is retries execution on failure.
|
|
428
|
-
|
|
429
|
-
temp_dir_root : str, default: None
|
|
430
|
-
The root directory under which `current.checkpoint.directory` will be created.
|
|
431
|
-
"""
|
|
432
|
-
...
|
|
433
|
-
|
|
434
|
-
@typing.overload
|
|
435
|
-
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]]]:
|
|
436
|
-
"""
|
|
437
|
-
Specifies the Conda environment for the step.
|
|
438
|
-
|
|
439
|
-
Information in this decorator will augment any
|
|
440
|
-
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
441
|
-
you can use `@conda_base` to set packages required by all
|
|
442
|
-
steps and use `@conda` to specify step-specific overrides.
|
|
308
|
+
Information in this decorator will augment any
|
|
309
|
+
attributes set in the `@conda_base` flow-level decorator. Hence,
|
|
310
|
+
you can use `@conda_base` to set packages required by all
|
|
311
|
+
steps and use `@conda` to specify step-specific overrides.
|
|
443
312
|
|
|
444
313
|
|
|
445
314
|
Parameters
|
|
@@ -491,160 +360,423 @@ def conda(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], ty
|
|
|
491
360
|
...
|
|
492
361
|
|
|
493
362
|
@typing.overload
|
|
494
|
-
def
|
|
363
|
+
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]]]:
|
|
495
364
|
"""
|
|
496
|
-
|
|
365
|
+
Specifies the number of times the task corresponding
|
|
366
|
+
to a step needs to be retried.
|
|
367
|
+
|
|
368
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
369
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
370
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
371
|
+
|
|
372
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
373
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
374
|
+
ensuring that the flow execution can continue.
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
Parameters
|
|
378
|
+
----------
|
|
379
|
+
times : int, default 3
|
|
380
|
+
Number of times to retry this task.
|
|
381
|
+
minutes_between_retries : int, default 2
|
|
382
|
+
Number of minutes between retries.
|
|
497
383
|
"""
|
|
498
384
|
...
|
|
499
385
|
|
|
500
386
|
@typing.overload
|
|
501
|
-
def
|
|
387
|
+
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
502
388
|
...
|
|
503
389
|
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
Internal decorator to support Fast bakery
|
|
507
|
-
"""
|
|
390
|
+
@typing.overload
|
|
391
|
+
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
508
392
|
...
|
|
509
393
|
|
|
510
|
-
|
|
511
|
-
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]]]:
|
|
394
|
+
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):
|
|
512
395
|
"""
|
|
513
|
-
Specifies
|
|
514
|
-
|
|
396
|
+
Specifies the number of times the task corresponding
|
|
397
|
+
to a step needs to be retried.
|
|
398
|
+
|
|
399
|
+
This decorator is useful for handling transient errors, such as networking issues.
|
|
400
|
+
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
401
|
+
it is advisable to annotate it with `@retry(times=0)`.
|
|
402
|
+
|
|
403
|
+
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
404
|
+
decorator will execute a no-op task after all retries have been exhausted,
|
|
405
|
+
ensuring that the flow execution can continue.
|
|
515
406
|
|
|
516
407
|
|
|
517
408
|
Parameters
|
|
518
409
|
----------
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
410
|
+
times : int, default 3
|
|
411
|
+
Number of times to retry this task.
|
|
412
|
+
minutes_between_retries : int, default 2
|
|
413
|
+
Number of minutes between retries.
|
|
523
414
|
"""
|
|
524
415
|
...
|
|
525
416
|
|
|
526
417
|
@typing.overload
|
|
527
|
-
def
|
|
418
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
419
|
+
"""
|
|
420
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
421
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
422
|
+
"""
|
|
528
423
|
...
|
|
529
424
|
|
|
530
425
|
@typing.overload
|
|
531
|
-
def
|
|
426
|
+
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
532
427
|
...
|
|
533
428
|
|
|
534
|
-
def
|
|
429
|
+
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
535
430
|
"""
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
Parameters
|
|
541
|
-
----------
|
|
542
|
-
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
543
|
-
List of secret specs, defining how the secrets are to be retrieved
|
|
544
|
-
role : str, optional, default: None
|
|
545
|
-
Role to use for fetching secrets
|
|
431
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
432
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
546
433
|
"""
|
|
547
434
|
...
|
|
548
435
|
|
|
549
436
|
@typing.overload
|
|
550
|
-
def
|
|
437
|
+
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]]]:
|
|
551
438
|
"""
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
This decorator is useful if this step may hang indefinitely.
|
|
555
|
-
|
|
556
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
557
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
558
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
439
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
559
440
|
|
|
560
|
-
Note that
|
|
561
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
441
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
562
442
|
|
|
563
443
|
|
|
564
444
|
Parameters
|
|
565
445
|
----------
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
446
|
+
type : str, default 'default'
|
|
447
|
+
Card type.
|
|
448
|
+
id : str, optional, default None
|
|
449
|
+
If multiple cards are present, use this id to identify this card.
|
|
450
|
+
options : Dict[str, Any], default {}
|
|
451
|
+
Options passed to the card. The contents depend on the card type.
|
|
452
|
+
timeout : int, default 45
|
|
453
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
572
454
|
"""
|
|
573
455
|
...
|
|
574
456
|
|
|
575
457
|
@typing.overload
|
|
576
|
-
def
|
|
458
|
+
def card(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
577
459
|
...
|
|
578
460
|
|
|
579
461
|
@typing.overload
|
|
580
|
-
def
|
|
462
|
+
def card(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
581
463
|
...
|
|
582
464
|
|
|
583
|
-
def
|
|
465
|
+
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):
|
|
584
466
|
"""
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
This decorator is useful if this step may hang indefinitely.
|
|
588
|
-
|
|
589
|
-
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
590
|
-
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
591
|
-
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
467
|
+
Creates a human-readable report, a Metaflow Card, after this step completes.
|
|
592
468
|
|
|
593
|
-
Note that
|
|
594
|
-
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
469
|
+
Note that you may add multiple `@card` decorators in a step with different parameters.
|
|
595
470
|
|
|
596
471
|
|
|
597
472
|
Parameters
|
|
598
473
|
----------
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
474
|
+
type : str, default 'default'
|
|
475
|
+
Card type.
|
|
476
|
+
id : str, optional, default None
|
|
477
|
+
If multiple cards are present, use this id to identify this card.
|
|
478
|
+
options : Dict[str, Any], default {}
|
|
479
|
+
Options passed to the card. The contents depend on the card type.
|
|
480
|
+
timeout : int, default 45
|
|
481
|
+
Interrupt reporting if it takes more than this many seconds.
|
|
605
482
|
"""
|
|
606
483
|
...
|
|
607
484
|
|
|
608
|
-
|
|
609
|
-
def environment(*, vars: typing.Dict[str, str] = {}) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
485
|
+
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]]]:
|
|
610
486
|
"""
|
|
611
|
-
|
|
487
|
+
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
|
488
|
+
|
|
489
|
+
User code call
|
|
490
|
+
--------------
|
|
491
|
+
@ollama(
|
|
492
|
+
models=[...],
|
|
493
|
+
...
|
|
494
|
+
)
|
|
495
|
+
|
|
496
|
+
Valid backend options
|
|
497
|
+
---------------------
|
|
498
|
+
- 'local': Run as a separate process on the local task machine.
|
|
499
|
+
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
500
|
+
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
501
|
+
|
|
502
|
+
Valid model options
|
|
503
|
+
-------------------
|
|
504
|
+
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
612
505
|
|
|
613
506
|
|
|
614
507
|
Parameters
|
|
615
508
|
----------
|
|
616
|
-
|
|
617
|
-
|
|
509
|
+
models: list[str]
|
|
510
|
+
List of Ollama containers running models in sidecars.
|
|
511
|
+
backend: str
|
|
512
|
+
Determines where and how to run the Ollama process.
|
|
513
|
+
force_pull: bool
|
|
514
|
+
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
515
|
+
cache_update_policy: str
|
|
516
|
+
Cache update policy: "auto", "force", or "never".
|
|
517
|
+
force_cache_update: bool
|
|
518
|
+
Simple override for "force" cache update policy.
|
|
519
|
+
debug: bool
|
|
520
|
+
Whether to turn on verbose debugging logs.
|
|
521
|
+
circuit_breaker_config: dict
|
|
522
|
+
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
523
|
+
timeout_config: dict
|
|
524
|
+
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
618
525
|
"""
|
|
619
526
|
...
|
|
620
527
|
|
|
621
528
|
@typing.overload
|
|
622
|
-
def
|
|
623
|
-
...
|
|
624
|
-
|
|
625
|
-
@typing.overload
|
|
626
|
-
def environment(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
627
|
-
...
|
|
628
|
-
|
|
629
|
-
def environment(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, vars: typing.Dict[str, str] = {}):
|
|
529
|
+
def checkpoint(*, load_policy: str = 'fresh', temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
630
530
|
"""
|
|
631
|
-
|
|
531
|
+
Enables checkpointing for a step.
|
|
632
532
|
|
|
533
|
+
> Examples
|
|
633
534
|
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
535
|
+
- Saving Checkpoints
|
|
536
|
+
|
|
537
|
+
```python
|
|
538
|
+
@checkpoint
|
|
539
|
+
@step
|
|
540
|
+
def train(self):
|
|
541
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
|
542
|
+
for i in range(self.epochs):
|
|
543
|
+
# some training logic
|
|
544
|
+
loss = model.train(self.dataset)
|
|
545
|
+
if i % 10 == 0:
|
|
546
|
+
model.save(
|
|
547
|
+
current.checkpoint.directory,
|
|
548
|
+
)
|
|
549
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
550
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
551
|
+
self.latest_checkpoint = current.checkpoint.save(
|
|
552
|
+
name="epoch_checkpoint",
|
|
553
|
+
metadata={
|
|
554
|
+
"epoch": i,
|
|
555
|
+
"loss": loss,
|
|
556
|
+
}
|
|
557
|
+
)
|
|
558
|
+
```
|
|
559
|
+
|
|
560
|
+
- Using Loaded Checkpoints
|
|
561
|
+
|
|
562
|
+
```python
|
|
563
|
+
@retry(times=3)
|
|
564
|
+
@checkpoint
|
|
565
|
+
@step
|
|
566
|
+
def train(self):
|
|
567
|
+
# Assume that the task has restarted and the previous attempt of the task
|
|
568
|
+
# saved a checkpoint
|
|
569
|
+
checkpoint_path = None
|
|
570
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
571
|
+
print("Loaded checkpoint from the previous attempt")
|
|
572
|
+
checkpoint_path = current.checkpoint.directory
|
|
573
|
+
|
|
574
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
575
|
+
for i in range(self.epochs):
|
|
576
|
+
...
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
|
|
580
|
+
Parameters
|
|
581
|
+
----------
|
|
582
|
+
load_policy : str, default: "fresh"
|
|
583
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
584
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
585
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
586
|
+
will be loaded at the start of the task.
|
|
587
|
+
- "none": Do not load any checkpoint
|
|
588
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
589
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
590
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
591
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
592
|
+
|
|
593
|
+
temp_dir_root : str, default: None
|
|
594
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
642
595
|
"""
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
596
|
+
...
|
|
597
|
+
|
|
598
|
+
@typing.overload
|
|
599
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
600
|
+
...
|
|
601
|
+
|
|
602
|
+
@typing.overload
|
|
603
|
+
def checkpoint(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
604
|
+
...
|
|
605
|
+
|
|
606
|
+
def checkpoint(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load_policy: str = 'fresh', temp_dir_root: str = None):
|
|
607
|
+
"""
|
|
608
|
+
Enables checkpointing for a step.
|
|
609
|
+
|
|
610
|
+
> Examples
|
|
611
|
+
|
|
612
|
+
- Saving Checkpoints
|
|
613
|
+
|
|
614
|
+
```python
|
|
615
|
+
@checkpoint
|
|
616
|
+
@step
|
|
617
|
+
def train(self):
|
|
618
|
+
model = create_model(self.parameters, checkpoint_path = None)
|
|
619
|
+
for i in range(self.epochs):
|
|
620
|
+
# some training logic
|
|
621
|
+
loss = model.train(self.dataset)
|
|
622
|
+
if i % 10 == 0:
|
|
623
|
+
model.save(
|
|
624
|
+
current.checkpoint.directory,
|
|
625
|
+
)
|
|
626
|
+
# saves the contents of the `current.checkpoint.directory` as a checkpoint
|
|
627
|
+
# and returns a reference dictionary to the checkpoint saved in the datastore
|
|
628
|
+
self.latest_checkpoint = current.checkpoint.save(
|
|
629
|
+
name="epoch_checkpoint",
|
|
630
|
+
metadata={
|
|
631
|
+
"epoch": i,
|
|
632
|
+
"loss": loss,
|
|
633
|
+
}
|
|
634
|
+
)
|
|
635
|
+
```
|
|
636
|
+
|
|
637
|
+
- Using Loaded Checkpoints
|
|
638
|
+
|
|
639
|
+
```python
|
|
640
|
+
@retry(times=3)
|
|
641
|
+
@checkpoint
|
|
642
|
+
@step
|
|
643
|
+
def train(self):
|
|
644
|
+
# Assume that the task has restarted and the previous attempt of the task
|
|
645
|
+
# saved a checkpoint
|
|
646
|
+
checkpoint_path = None
|
|
647
|
+
if current.checkpoint.is_loaded: # Check if a checkpoint is loaded
|
|
648
|
+
print("Loaded checkpoint from the previous attempt")
|
|
649
|
+
checkpoint_path = current.checkpoint.directory
|
|
650
|
+
|
|
651
|
+
model = create_model(self.parameters, checkpoint_path = checkpoint_path)
|
|
652
|
+
for i in range(self.epochs):
|
|
653
|
+
...
|
|
654
|
+
```
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
Parameters
|
|
658
|
+
----------
|
|
659
|
+
load_policy : str, default: "fresh"
|
|
660
|
+
The policy for loading the checkpoint. The following policies are supported:
|
|
661
|
+
- "eager": Loads the the latest available checkpoint within the namespace.
|
|
662
|
+
With this mode, the latest checkpoint written by any previous task (can be even a different run) of the step
|
|
663
|
+
will be loaded at the start of the task.
|
|
664
|
+
- "none": Do not load any checkpoint
|
|
665
|
+
- "fresh": Loads the lastest checkpoint created within the running Task.
|
|
666
|
+
This mode helps loading checkpoints across various retry attempts of the same task.
|
|
667
|
+
With this mode, no checkpoint will be loaded at the start of a task but any checkpoints
|
|
668
|
+
created within the task will be loaded when the task is retries execution on failure.
|
|
669
|
+
|
|
670
|
+
temp_dir_root : str, default: None
|
|
671
|
+
The root directory under which `current.checkpoint.directory` will be created.
|
|
672
|
+
"""
|
|
673
|
+
...
|
|
674
|
+
|
|
675
|
+
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]]]:
|
|
676
|
+
"""
|
|
677
|
+
Specifies that this step should execute on DGX cloud.
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
Parameters
|
|
681
|
+
----------
|
|
682
|
+
gpu : int
|
|
683
|
+
Number of GPUs to use.
|
|
684
|
+
gpu_type : str
|
|
685
|
+
Type of Nvidia GPU to use.
|
|
686
|
+
"""
|
|
687
|
+
...
|
|
688
|
+
|
|
689
|
+
def kubernetes(*, cpu: int = 1, memory: int = 4096, disk: int = 10240, image: typing.Optional[str] = None, image_pull_policy: str = 'KUBERNETES_IMAGE_PULL_POLICY', image_pull_secrets: typing.List[str] = [], service_account: str = 'METAFLOW_KUBERNETES_SERVICE_ACCOUNT', secrets: typing.Optional[typing.List[str]] = None, node_selector: typing.Union[typing.Dict[str, str], str, None] = None, namespace: str = 'METAFLOW_KUBERNETES_NAMESPACE', gpu: typing.Optional[int] = None, gpu_vendor: str = 'KUBERNETES_GPU_VENDOR', tolerations: typing.List[typing.Dict[str, str]] = [], labels: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_LABELS', annotations: typing.Dict[str, str] = 'METAFLOW_KUBERNETES_ANNOTATIONS', use_tmpfs: bool = False, tmpfs_tempdir: bool = True, tmpfs_size: typing.Optional[int] = None, tmpfs_path: typing.Optional[str] = '/metaflow_temp', persistent_volume_claims: typing.Optional[typing.Dict[str, str]] = None, shared_memory: typing.Optional[int] = None, port: typing.Optional[int] = None, compute_pool: typing.Optional[str] = None, hostname_resolution_timeout: int = 600, qos: str = 'Burstable', security_context: typing.Optional[typing.Dict[str, typing.Any]] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
690
|
+
"""
|
|
691
|
+
Specifies that this step should execute on Kubernetes.
|
|
646
692
|
|
|
647
693
|
|
|
694
|
+
Parameters
|
|
695
|
+
----------
|
|
696
|
+
cpu : int, default 1
|
|
697
|
+
Number of CPUs required for this step. If `@resources` is
|
|
698
|
+
also present, the maximum value from all decorators is used.
|
|
699
|
+
memory : int, default 4096
|
|
700
|
+
Memory size (in MB) required for this step. If
|
|
701
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
702
|
+
used.
|
|
703
|
+
disk : int, default 10240
|
|
704
|
+
Disk size (in MB) required for this step. If
|
|
705
|
+
`@resources` is also present, the maximum value from all decorators is
|
|
706
|
+
used.
|
|
707
|
+
image : str, optional, default None
|
|
708
|
+
Docker image to use when launching on Kubernetes. If not specified, and
|
|
709
|
+
METAFLOW_KUBERNETES_CONTAINER_IMAGE is specified, that image is used. If
|
|
710
|
+
not, a default Docker image mapping to the current version of Python is used.
|
|
711
|
+
image_pull_policy: str, default KUBERNETES_IMAGE_PULL_POLICY
|
|
712
|
+
If given, the imagePullPolicy to be applied to the Docker image of the step.
|
|
713
|
+
image_pull_secrets: List[str], default []
|
|
714
|
+
The default is extracted from METAFLOW_KUBERNETES_IMAGE_PULL_SECRETS.
|
|
715
|
+
Kubernetes image pull secrets to use when pulling container images
|
|
716
|
+
in Kubernetes.
|
|
717
|
+
service_account : str, default METAFLOW_KUBERNETES_SERVICE_ACCOUNT
|
|
718
|
+
Kubernetes service account to use when launching pod in Kubernetes.
|
|
719
|
+
secrets : List[str], optional, default None
|
|
720
|
+
Kubernetes secrets to use when launching pod in Kubernetes. These
|
|
721
|
+
secrets are in addition to the ones defined in `METAFLOW_KUBERNETES_SECRETS`
|
|
722
|
+
in Metaflow configuration.
|
|
723
|
+
node_selector: Union[Dict[str,str], str], optional, default None
|
|
724
|
+
Kubernetes node selector(s) to apply to the pod running the task.
|
|
725
|
+
Can be passed in as a comma separated string of values e.g.
|
|
726
|
+
'kubernetes.io/os=linux,kubernetes.io/arch=amd64' or as a dictionary
|
|
727
|
+
{'kubernetes.io/os': 'linux', 'kubernetes.io/arch': 'amd64'}
|
|
728
|
+
namespace : str, default METAFLOW_KUBERNETES_NAMESPACE
|
|
729
|
+
Kubernetes namespace to use when launching pod in Kubernetes.
|
|
730
|
+
gpu : int, optional, default None
|
|
731
|
+
Number of GPUs required for this step. A value of zero implies that
|
|
732
|
+
the scheduled node should not have GPUs.
|
|
733
|
+
gpu_vendor : str, default KUBERNETES_GPU_VENDOR
|
|
734
|
+
The vendor of the GPUs to be used for this step.
|
|
735
|
+
tolerations : List[Dict[str,str]], default []
|
|
736
|
+
The default is extracted from METAFLOW_KUBERNETES_TOLERATIONS.
|
|
737
|
+
Kubernetes tolerations to use when launching pod in Kubernetes.
|
|
738
|
+
labels: Dict[str, str], default: METAFLOW_KUBERNETES_LABELS
|
|
739
|
+
Kubernetes labels to use when launching pod in Kubernetes.
|
|
740
|
+
annotations: Dict[str, str], default: METAFLOW_KUBERNETES_ANNOTATIONS
|
|
741
|
+
Kubernetes annotations to use when launching pod in Kubernetes.
|
|
742
|
+
use_tmpfs : bool, default False
|
|
743
|
+
This enables an explicit tmpfs mount for this step.
|
|
744
|
+
tmpfs_tempdir : bool, default True
|
|
745
|
+
sets METAFLOW_TEMPDIR to tmpfs_path if set for this step.
|
|
746
|
+
tmpfs_size : int, optional, default: None
|
|
747
|
+
The value for the size (in MiB) of the tmpfs mount for this step.
|
|
748
|
+
This parameter maps to the `--tmpfs` option in Docker. Defaults to 50% of the
|
|
749
|
+
memory allocated for this step.
|
|
750
|
+
tmpfs_path : str, optional, default /metaflow_temp
|
|
751
|
+
Path to tmpfs mount for this step.
|
|
752
|
+
persistent_volume_claims : Dict[str, str], optional, default None
|
|
753
|
+
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
754
|
+
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
755
|
+
shared_memory: int, optional
|
|
756
|
+
Shared memory size (in MiB) required for this step
|
|
757
|
+
port: int, optional
|
|
758
|
+
Port number to specify in the Kubernetes job object
|
|
759
|
+
compute_pool : str, optional, default None
|
|
760
|
+
Compute pool to be used for for this step.
|
|
761
|
+
If not specified, any accessible compute pool within the perimeter is used.
|
|
762
|
+
hostname_resolution_timeout: int, default 10 * 60
|
|
763
|
+
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
764
|
+
Only applicable when @parallel is used.
|
|
765
|
+
qos: str, default: Burstable
|
|
766
|
+
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
767
|
+
|
|
768
|
+
security_context: Dict[str, Any], optional, default None
|
|
769
|
+
Container security context. Applies to the task container. Allows the following keys:
|
|
770
|
+
- privileged: bool, optional, default None
|
|
771
|
+
- allow_privilege_escalation: bool, optional, default None
|
|
772
|
+
- run_as_user: int, optional, default None
|
|
773
|
+
- run_as_group: int, optional, default None
|
|
774
|
+
- run_as_non_root: bool, optional, default None
|
|
775
|
+
"""
|
|
776
|
+
...
|
|
777
|
+
|
|
778
|
+
def s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typing.Optional[str] = None, debug: typing.Optional[bool] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
779
|
+
"""
|
|
648
780
|
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
649
781
|
for S3 read and write requests.
|
|
650
782
|
|
|
@@ -702,159 +834,12 @@ def coreweave_s3_proxy(*, integration_name: typing.Optional[str] = None, write_m
|
|
|
702
834
|
"""
|
|
703
835
|
...
|
|
704
836
|
|
|
705
|
-
def
|
|
837
|
+
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, cache_scope: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
706
838
|
"""
|
|
707
|
-
|
|
839
|
+
Decorator that helps cache, version, and store models/datasets from the Hugging Face Hub.
|
|
708
840
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
----------
|
|
712
|
-
gpu : int
|
|
713
|
-
Number of GPUs to use.
|
|
714
|
-
gpu_type : str
|
|
715
|
-
Type of Nvidia GPU to use.
|
|
716
|
-
queue_timeout : int
|
|
717
|
-
Time to keep the job in NVCF's queue.
|
|
718
|
-
"""
|
|
719
|
-
...
|
|
720
|
-
|
|
721
|
-
@typing.overload
|
|
722
|
-
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]]]:
|
|
723
|
-
"""
|
|
724
|
-
Specifies the number of times the task corresponding
|
|
725
|
-
to a step needs to be retried.
|
|
726
|
-
|
|
727
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
728
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
729
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
730
|
-
|
|
731
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
732
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
733
|
-
ensuring that the flow execution can continue.
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
Parameters
|
|
737
|
-
----------
|
|
738
|
-
times : int, default 3
|
|
739
|
-
Number of times to retry this task.
|
|
740
|
-
minutes_between_retries : int, default 2
|
|
741
|
-
Number of minutes between retries.
|
|
742
|
-
"""
|
|
743
|
-
...
|
|
744
|
-
|
|
745
|
-
@typing.overload
|
|
746
|
-
def retry(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
747
|
-
...
|
|
748
|
-
|
|
749
|
-
@typing.overload
|
|
750
|
-
def retry(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
751
|
-
...
|
|
752
|
-
|
|
753
|
-
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):
|
|
754
|
-
"""
|
|
755
|
-
Specifies the number of times the task corresponding
|
|
756
|
-
to a step needs to be retried.
|
|
757
|
-
|
|
758
|
-
This decorator is useful for handling transient errors, such as networking issues.
|
|
759
|
-
If your task contains operations that can't be retried safely, e.g. database updates,
|
|
760
|
-
it is advisable to annotate it with `@retry(times=0)`.
|
|
761
|
-
|
|
762
|
-
This can be used in conjunction with the `@catch` decorator. The `@catch`
|
|
763
|
-
decorator will execute a no-op task after all retries have been exhausted,
|
|
764
|
-
ensuring that the flow execution can continue.
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
Parameters
|
|
768
|
-
----------
|
|
769
|
-
times : int, default 3
|
|
770
|
-
Number of times to retry this task.
|
|
771
|
-
minutes_between_retries : int, default 2
|
|
772
|
-
Number of minutes between retries.
|
|
773
|
-
"""
|
|
774
|
-
...
|
|
775
|
-
|
|
776
|
-
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]]]:
|
|
777
|
-
"""
|
|
778
|
-
This decorator is used to run Ollama APIs as Metaflow task sidecars.
|
|
779
|
-
|
|
780
|
-
User code call
|
|
781
|
-
--------------
|
|
782
|
-
@ollama(
|
|
783
|
-
models=[...],
|
|
784
|
-
...
|
|
785
|
-
)
|
|
786
|
-
|
|
787
|
-
Valid backend options
|
|
788
|
-
---------------------
|
|
789
|
-
- 'local': Run as a separate process on the local task machine.
|
|
790
|
-
- (TODO) 'managed': Outerbounds hosts and selects compute provider.
|
|
791
|
-
- (TODO) 'remote': Spin up separate instance to serve Ollama models.
|
|
792
|
-
|
|
793
|
-
Valid model options
|
|
794
|
-
-------------------
|
|
795
|
-
Any model here https://ollama.com/search, e.g. 'llama3.2', 'llama3.3'
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
Parameters
|
|
799
|
-
----------
|
|
800
|
-
models: list[str]
|
|
801
|
-
List of Ollama containers running models in sidecars.
|
|
802
|
-
backend: str
|
|
803
|
-
Determines where and how to run the Ollama process.
|
|
804
|
-
force_pull: bool
|
|
805
|
-
Whether to run `ollama pull` no matter what, or first check the remote cache in Metaflow datastore for this model key.
|
|
806
|
-
cache_update_policy: str
|
|
807
|
-
Cache update policy: "auto", "force", or "never".
|
|
808
|
-
force_cache_update: bool
|
|
809
|
-
Simple override for "force" cache update policy.
|
|
810
|
-
debug: bool
|
|
811
|
-
Whether to turn on verbose debugging logs.
|
|
812
|
-
circuit_breaker_config: dict
|
|
813
|
-
Configuration for circuit breaker protection. Keys: failure_threshold, recovery_timeout, reset_timeout.
|
|
814
|
-
timeout_config: dict
|
|
815
|
-
Configuration for various operation timeouts. Keys: pull, stop, health_check, install, server_startup.
|
|
816
|
-
"""
|
|
817
|
-
...
|
|
818
|
-
|
|
819
|
-
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]]]:
|
|
820
|
-
"""
|
|
821
|
-
Specifies that this step should execute on DGX cloud.
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
Parameters
|
|
825
|
-
----------
|
|
826
|
-
gpu : int
|
|
827
|
-
Number of GPUs to use.
|
|
828
|
-
gpu_type : str
|
|
829
|
-
Type of Nvidia GPU to use.
|
|
830
|
-
"""
|
|
831
|
-
...
|
|
832
|
-
|
|
833
|
-
@typing.overload
|
|
834
|
-
def app_deploy(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
835
|
-
"""
|
|
836
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
837
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
838
|
-
"""
|
|
839
|
-
...
|
|
840
|
-
|
|
841
|
-
@typing.overload
|
|
842
|
-
def app_deploy(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
843
|
-
...
|
|
844
|
-
|
|
845
|
-
def app_deploy(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
846
|
-
"""
|
|
847
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
848
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
849
|
-
"""
|
|
850
|
-
...
|
|
851
|
-
|
|
852
|
-
def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, cache_scope: typing.Optional[str] = None, load: typing.Union[typing.List[str], typing.List[typing.Tuple[typing.Dict, str]], typing.List[typing.Tuple[str, str]], typing.List[typing.Dict], None]) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
853
|
-
"""
|
|
854
|
-
Decorator that helps cache, version, and store models/datasets from the Hugging Face Hub.
|
|
855
|
-
|
|
856
|
-
Examples
|
|
857
|
-
--------
|
|
841
|
+
Examples
|
|
842
|
+
--------
|
|
858
843
|
|
|
859
844
|
```python
|
|
860
845
|
# **Usage: creating references to models from the Hugging Face Hub that may be loaded in downstream steps**
|
|
@@ -967,221 +952,270 @@ def huggingface_hub(*, temp_dir_root: typing.Optional[str] = None, cache_scope:
|
|
|
967
952
|
...
|
|
968
953
|
|
|
969
954
|
@typing.overload
|
|
970
|
-
def
|
|
955
|
+
def model(*, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
971
956
|
"""
|
|
972
|
-
|
|
957
|
+
Enables loading / saving of models within a step.
|
|
973
958
|
|
|
974
|
-
|
|
975
|
-
|
|
959
|
+
> Examples
|
|
960
|
+
- Saving Models
|
|
961
|
+
```python
|
|
962
|
+
@model
|
|
963
|
+
@step
|
|
964
|
+
def train(self):
|
|
965
|
+
# current.model.save returns a dictionary reference to the model saved
|
|
966
|
+
self.my_model = current.model.save(
|
|
967
|
+
path_to_my_model,
|
|
968
|
+
label="my_model",
|
|
969
|
+
metadata={
|
|
970
|
+
"epochs": 10,
|
|
971
|
+
"batch-size": 32,
|
|
972
|
+
"learning-rate": 0.001,
|
|
973
|
+
}
|
|
974
|
+
)
|
|
975
|
+
self.next(self.test)
|
|
976
976
|
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
977
|
+
@model(load="my_model")
|
|
978
|
+
@step
|
|
979
|
+
def test(self):
|
|
980
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
|
981
|
+
# where the key is the name of the artifact and the value is the path to the model
|
|
982
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
|
983
|
+
self.next(self.end)
|
|
982
984
|
```
|
|
983
|
-
|
|
985
|
+
|
|
986
|
+
- Loading models
|
|
987
|
+
```python
|
|
988
|
+
@step
|
|
989
|
+
def train(self):
|
|
990
|
+
# current.model.load returns the path to the model loaded
|
|
991
|
+
checkpoint_path = current.model.load(
|
|
992
|
+
self.checkpoint_key,
|
|
993
|
+
)
|
|
994
|
+
model_path = current.model.load(
|
|
995
|
+
self.model,
|
|
996
|
+
)
|
|
997
|
+
self.next(self.test)
|
|
984
998
|
```
|
|
985
|
-
which executes the flow on the desired system using the
|
|
986
|
-
requirements specified in `@resources`.
|
|
987
999
|
|
|
988
1000
|
|
|
989
1001
|
Parameters
|
|
990
1002
|
----------
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
1001
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
1003
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
1004
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
1005
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
|
|
1006
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
|
1007
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
1008
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
1009
|
+
|
|
1010
|
+
temp_dir_root : str, default: None
|
|
1011
|
+
The root directory under which `current.model.loaded` will store loaded models
|
|
1002
1012
|
"""
|
|
1003
1013
|
...
|
|
1004
1014
|
|
|
1005
1015
|
@typing.overload
|
|
1006
|
-
def
|
|
1016
|
+
def model(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1007
1017
|
...
|
|
1008
1018
|
|
|
1009
1019
|
@typing.overload
|
|
1010
|
-
def
|
|
1020
|
+
def model(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1011
1021
|
...
|
|
1012
1022
|
|
|
1013
|
-
def
|
|
1023
|
+
def model(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None, *, load: typing.Union[typing.List[str], str, typing.List[typing.Tuple[str, typing.Optional[str]]]] = None, temp_dir_root: str = None):
|
|
1014
1024
|
"""
|
|
1015
|
-
|
|
1025
|
+
Enables loading / saving of models within a step.
|
|
1016
1026
|
|
|
1017
|
-
|
|
1018
|
-
|
|
1027
|
+
> Examples
|
|
1028
|
+
- Saving Models
|
|
1029
|
+
```python
|
|
1030
|
+
@model
|
|
1031
|
+
@step
|
|
1032
|
+
def train(self):
|
|
1033
|
+
# current.model.save returns a dictionary reference to the model saved
|
|
1034
|
+
self.my_model = current.model.save(
|
|
1035
|
+
path_to_my_model,
|
|
1036
|
+
label="my_model",
|
|
1037
|
+
metadata={
|
|
1038
|
+
"epochs": 10,
|
|
1039
|
+
"batch-size": 32,
|
|
1040
|
+
"learning-rate": 0.001,
|
|
1041
|
+
}
|
|
1042
|
+
)
|
|
1043
|
+
self.next(self.test)
|
|
1019
1044
|
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1045
|
+
@model(load="my_model")
|
|
1046
|
+
@step
|
|
1047
|
+
def test(self):
|
|
1048
|
+
# `current.model.loaded` returns a dictionary of the loaded models
|
|
1049
|
+
# where the key is the name of the artifact and the value is the path to the model
|
|
1050
|
+
print(os.listdir(current.model.loaded["my_model"]))
|
|
1051
|
+
self.next(self.end)
|
|
1025
1052
|
```
|
|
1026
|
-
|
|
1053
|
+
|
|
1054
|
+
- Loading models
|
|
1055
|
+
```python
|
|
1056
|
+
@step
|
|
1057
|
+
def train(self):
|
|
1058
|
+
# current.model.load returns the path to the model loaded
|
|
1059
|
+
checkpoint_path = current.model.load(
|
|
1060
|
+
self.checkpoint_key,
|
|
1061
|
+
)
|
|
1062
|
+
model_path = current.model.load(
|
|
1063
|
+
self.model,
|
|
1064
|
+
)
|
|
1065
|
+
self.next(self.test)
|
|
1027
1066
|
```
|
|
1028
|
-
which executes the flow on the desired system using the
|
|
1029
|
-
requirements specified in `@resources`.
|
|
1030
1067
|
|
|
1031
1068
|
|
|
1032
1069
|
Parameters
|
|
1033
1070
|
----------
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
The value for the size (in MiB) of the /dev/shm volume for this step.
|
|
1044
|
-
This parameter maps to the `--shm-size` option in Docker.
|
|
1071
|
+
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
1072
|
+
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
1073
|
+
These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
|
|
1074
|
+
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
|
1075
|
+
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
1076
|
+
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
1077
|
+
|
|
1078
|
+
temp_dir_root : str, default: None
|
|
1079
|
+
The root directory under which `current.model.loaded` will store loaded models
|
|
1045
1080
|
"""
|
|
1046
1081
|
...
|
|
1047
1082
|
|
|
1048
|
-
def
|
|
1083
|
+
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]]]:
|
|
1049
1084
|
"""
|
|
1050
|
-
Specifies that this step should execute on
|
|
1085
|
+
Specifies that this step should execute on DGX cloud.
|
|
1051
1086
|
|
|
1052
1087
|
|
|
1053
1088
|
Parameters
|
|
1054
1089
|
----------
|
|
1055
|
-
|
|
1056
|
-
Number of
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
persistent_volume_claims : Dict[str, str], optional, default None
|
|
1112
|
-
A map (dictionary) of persistent volumes to be mounted to the pod for this step. The map is from persistent
|
|
1113
|
-
volumes to the path to which the volume is to be mounted, e.g., `{'pvc-name': '/path/to/mount/on'}`.
|
|
1114
|
-
shared_memory: int, optional
|
|
1115
|
-
Shared memory size (in MiB) required for this step
|
|
1116
|
-
port: int, optional
|
|
1117
|
-
Port number to specify in the Kubernetes job object
|
|
1118
|
-
compute_pool : str, optional, default None
|
|
1119
|
-
Compute pool to be used for for this step.
|
|
1120
|
-
If not specified, any accessible compute pool within the perimeter is used.
|
|
1121
|
-
hostname_resolution_timeout: int, default 10 * 60
|
|
1122
|
-
Timeout in seconds for the workers tasks in the gang scheduled cluster to resolve the hostname of control task.
|
|
1123
|
-
Only applicable when @parallel is used.
|
|
1124
|
-
qos: str, default: Burstable
|
|
1125
|
-
Quality of Service class to assign to the pod. Supported values are: Guaranteed, Burstable, BestEffort
|
|
1090
|
+
gpu : int
|
|
1091
|
+
Number of GPUs to use.
|
|
1092
|
+
gpu_type : str
|
|
1093
|
+
Type of Nvidia GPU to use.
|
|
1094
|
+
queue_timeout : int
|
|
1095
|
+
Time to keep the job in NVCF's queue.
|
|
1096
|
+
"""
|
|
1097
|
+
...
|
|
1098
|
+
|
|
1099
|
+
def coreweave_s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typing.Optional[str] = None, debug: typing.Optional[bool] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
1100
|
+
"""
|
|
1101
|
+
`@coreweave_s3_proxy` is a CoreWeave-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
1102
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
|
1103
|
+
a Neo Cloud like CoreWeave. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
|
|
1104
|
+
|
|
1105
|
+
|
|
1106
|
+
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
1107
|
+
for S3 read and write requests.
|
|
1108
|
+
|
|
1109
|
+
This decorator requires an integration in the Outerbounds platform that
|
|
1110
|
+
points to an external bucket. It affects S3 operations performed via
|
|
1111
|
+
Metaflow's `get_aws_client` and `S3` within a `@step`.
|
|
1112
|
+
|
|
1113
|
+
Read operations
|
|
1114
|
+
---------------
|
|
1115
|
+
All read operations pass through the proxy. If an object does not already
|
|
1116
|
+
exist in the external bucket, it is cached there. For example, if code reads
|
|
1117
|
+
from buckets `FOO` and `BAR` using the `S3` interface, objects from both
|
|
1118
|
+
buckets are cached in the external bucket.
|
|
1119
|
+
|
|
1120
|
+
During task execution, all S3‑related read requests are routed through the
|
|
1121
|
+
proxy:
|
|
1122
|
+
- If the object is present in the external object store, the proxy
|
|
1123
|
+
streams it directly from there without accessing the requested origin
|
|
1124
|
+
bucket.
|
|
1125
|
+
- If the object is not present in the external storage, the proxy
|
|
1126
|
+
fetches it from the requested bucket, caches it in the external
|
|
1127
|
+
storage, and streams the response from the origin bucket.
|
|
1128
|
+
|
|
1129
|
+
Warning
|
|
1130
|
+
-------
|
|
1131
|
+
All READ operations (e.g., GetObject, HeadObject) pass through the external
|
|
1132
|
+
bucket regardless of the bucket specified in user code. Even
|
|
1133
|
+
`S3(run=self)` and `S3(s3root="mybucketfoo")` requests go through the
|
|
1134
|
+
external bucket cache.
|
|
1135
|
+
|
|
1136
|
+
Write operations
|
|
1137
|
+
----------------
|
|
1138
|
+
Write behavior is controlled by the `write_mode` parameter, which determines
|
|
1139
|
+
whether writes also persist objects in the cache.
|
|
1140
|
+
|
|
1141
|
+
`write_mode` values:
|
|
1142
|
+
- `origin-and-cache`: objects are written both to the cache and to their
|
|
1143
|
+
intended origin bucket.
|
|
1144
|
+
- `origin`: objects are written only to their intended origin bucket.
|
|
1145
|
+
|
|
1126
1146
|
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1147
|
+
Parameters
|
|
1148
|
+
----------
|
|
1149
|
+
integration_name : str, optional
|
|
1150
|
+
[Outerbounds integration name](https://docs.outerbounds.com/outerbounds/configuring-secrets/#integrations-view)
|
|
1151
|
+
that holds the configuration for the external, S3‑compatible object
|
|
1152
|
+
storage bucket. If not specified, the only available S3 proxy
|
|
1153
|
+
integration in the namespace is used (fails if multiple exist).
|
|
1154
|
+
write_mode : str, optional
|
|
1155
|
+
Controls whether writes also go to the external bucket.
|
|
1156
|
+
- `origin` (default)
|
|
1157
|
+
- `origin-and-cache`
|
|
1158
|
+
debug : bool, optional
|
|
1159
|
+
Enables debug logging for proxy operations.
|
|
1134
1160
|
"""
|
|
1135
1161
|
...
|
|
1136
1162
|
|
|
1137
1163
|
@typing.overload
|
|
1138
|
-
def
|
|
1164
|
+
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]]]:
|
|
1139
1165
|
"""
|
|
1140
|
-
Specifies
|
|
1166
|
+
Specifies a timeout for your step.
|
|
1141
1167
|
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1168
|
+
This decorator is useful if this step may hang indefinitely.
|
|
1169
|
+
|
|
1170
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
1171
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
1172
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
1173
|
+
|
|
1174
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
1175
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
1146
1176
|
|
|
1147
1177
|
|
|
1148
1178
|
Parameters
|
|
1149
1179
|
----------
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1180
|
+
seconds : int, default 0
|
|
1181
|
+
Number of seconds to wait prior to timing out.
|
|
1182
|
+
minutes : int, default 0
|
|
1183
|
+
Number of minutes to wait prior to timing out.
|
|
1184
|
+
hours : int, default 0
|
|
1185
|
+
Number of hours to wait prior to timing out.
|
|
1156
1186
|
"""
|
|
1157
1187
|
...
|
|
1158
1188
|
|
|
1159
1189
|
@typing.overload
|
|
1160
|
-
def
|
|
1190
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1161
1191
|
...
|
|
1162
1192
|
|
|
1163
1193
|
@typing.overload
|
|
1164
|
-
def
|
|
1194
|
+
def timeout(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1165
1195
|
...
|
|
1166
1196
|
|
|
1167
|
-
def
|
|
1197
|
+
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):
|
|
1168
1198
|
"""
|
|
1169
|
-
Specifies
|
|
1199
|
+
Specifies a timeout for your step.
|
|
1170
1200
|
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1201
|
+
This decorator is useful if this step may hang indefinitely.
|
|
1202
|
+
|
|
1203
|
+
This can be used in conjunction with the `@retry` decorator as well as the `@catch` decorator.
|
|
1204
|
+
A timeout is considered to be an exception thrown by the step. It will cause the step to be
|
|
1205
|
+
retried if needed and the exception will be caught by the `@catch` decorator, if present.
|
|
1206
|
+
|
|
1207
|
+
Note that all the values specified in parameters are added together so if you specify
|
|
1208
|
+
60 seconds and 1 hour, the decorator will have an effective timeout of 1 hour and 1 minute.
|
|
1175
1209
|
|
|
1176
1210
|
|
|
1177
1211
|
Parameters
|
|
1178
1212
|
----------
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1213
|
+
seconds : int, default 0
|
|
1214
|
+
Number of seconds to wait prior to timing out.
|
|
1215
|
+
minutes : int, default 0
|
|
1216
|
+
Number of minutes to wait prior to timing out.
|
|
1217
|
+
hours : int, default 0
|
|
1218
|
+
Number of hours to wait prior to timing out.
|
|
1185
1219
|
"""
|
|
1186
1220
|
...
|
|
1187
1221
|
|
|
@@ -1236,223 +1270,138 @@ def vllm(*, model: str, backend: str, openai_api_server: bool, debug: bool, card
|
|
|
1236
1270
|
...
|
|
1237
1271
|
|
|
1238
1272
|
@typing.overload
|
|
1239
|
-
def
|
|
1273
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1240
1274
|
"""
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
> Examples
|
|
1244
|
-
- Saving Models
|
|
1245
|
-
```python
|
|
1246
|
-
@model
|
|
1247
|
-
@step
|
|
1248
|
-
def train(self):
|
|
1249
|
-
# current.model.save returns a dictionary reference to the model saved
|
|
1250
|
-
self.my_model = current.model.save(
|
|
1251
|
-
path_to_my_model,
|
|
1252
|
-
label="my_model",
|
|
1253
|
-
metadata={
|
|
1254
|
-
"epochs": 10,
|
|
1255
|
-
"batch-size": 32,
|
|
1256
|
-
"learning-rate": 0.001,
|
|
1257
|
-
}
|
|
1258
|
-
)
|
|
1259
|
-
self.next(self.test)
|
|
1260
|
-
|
|
1261
|
-
@model(load="my_model")
|
|
1262
|
-
@step
|
|
1263
|
-
def test(self):
|
|
1264
|
-
# `current.model.loaded` returns a dictionary of the loaded models
|
|
1265
|
-
# where the key is the name of the artifact and the value is the path to the model
|
|
1266
|
-
print(os.listdir(current.model.loaded["my_model"]))
|
|
1267
|
-
self.next(self.end)
|
|
1268
|
-
```
|
|
1269
|
-
|
|
1270
|
-
- Loading models
|
|
1271
|
-
```python
|
|
1272
|
-
@step
|
|
1273
|
-
def train(self):
|
|
1274
|
-
# current.model.load returns the path to the model loaded
|
|
1275
|
-
checkpoint_path = current.model.load(
|
|
1276
|
-
self.checkpoint_key,
|
|
1277
|
-
)
|
|
1278
|
-
model_path = current.model.load(
|
|
1279
|
-
self.model,
|
|
1280
|
-
)
|
|
1281
|
-
self.next(self.test)
|
|
1282
|
-
```
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
Parameters
|
|
1286
|
-
----------
|
|
1287
|
-
load : Union[List[str],str,List[Tuple[str,Union[str,None]]]], default: None
|
|
1288
|
-
Artifact name/s referencing the models/checkpoints to load. Artifact names refer to the names of the instance variables set to `self`.
|
|
1289
|
-
These artifact names give to `load` be reference objects or reference `key` string's from objects created by `current.checkpoint` / `current.model` / `current.huggingface_hub`.
|
|
1290
|
-
If a list of tuples is provided, the first element is the artifact name and the second element is the path the artifact needs be unpacked on
|
|
1291
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
1292
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
1293
|
-
|
|
1294
|
-
temp_dir_root : str, default: None
|
|
1295
|
-
The root directory under which `current.model.loaded` will store loaded models
|
|
1275
|
+
Internal decorator to support Fast bakery
|
|
1296
1276
|
"""
|
|
1297
1277
|
...
|
|
1298
1278
|
|
|
1299
1279
|
@typing.overload
|
|
1300
|
-
def
|
|
1280
|
+
def fast_bakery_internal(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1301
1281
|
...
|
|
1302
1282
|
|
|
1303
|
-
|
|
1304
|
-
|
|
1283
|
+
def fast_bakery_internal(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
1284
|
+
"""
|
|
1285
|
+
Internal decorator to support Fast bakery
|
|
1286
|
+
"""
|
|
1305
1287
|
...
|
|
1306
1288
|
|
|
1307
|
-
|
|
1289
|
+
@typing.overload
|
|
1290
|
+
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]]]:
|
|
1308
1291
|
"""
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
> Examples
|
|
1312
|
-
- Saving Models
|
|
1313
|
-
```python
|
|
1314
|
-
@model
|
|
1315
|
-
@step
|
|
1316
|
-
def train(self):
|
|
1317
|
-
# current.model.save returns a dictionary reference to the model saved
|
|
1318
|
-
self.my_model = current.model.save(
|
|
1319
|
-
path_to_my_model,
|
|
1320
|
-
label="my_model",
|
|
1321
|
-
metadata={
|
|
1322
|
-
"epochs": 10,
|
|
1323
|
-
"batch-size": 32,
|
|
1324
|
-
"learning-rate": 0.001,
|
|
1325
|
-
}
|
|
1326
|
-
)
|
|
1327
|
-
self.next(self.test)
|
|
1328
|
-
|
|
1329
|
-
@model(load="my_model")
|
|
1330
|
-
@step
|
|
1331
|
-
def test(self):
|
|
1332
|
-
# `current.model.loaded` returns a dictionary of the loaded models
|
|
1333
|
-
# where the key is the name of the artifact and the value is the path to the model
|
|
1334
|
-
print(os.listdir(current.model.loaded["my_model"]))
|
|
1335
|
-
self.next(self.end)
|
|
1336
|
-
```
|
|
1337
|
-
|
|
1338
|
-
- Loading models
|
|
1339
|
-
```python
|
|
1340
|
-
@step
|
|
1341
|
-
def train(self):
|
|
1342
|
-
# current.model.load returns the path to the model loaded
|
|
1343
|
-
checkpoint_path = current.model.load(
|
|
1344
|
-
self.checkpoint_key,
|
|
1345
|
-
)
|
|
1346
|
-
model_path = current.model.load(
|
|
1347
|
-
self.model,
|
|
1348
|
-
)
|
|
1349
|
-
self.next(self.test)
|
|
1350
|
-
```
|
|
1292
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
1293
|
+
the execution of a step.
|
|
1351
1294
|
|
|
1352
1295
|
|
|
1353
1296
|
Parameters
|
|
1354
1297
|
----------
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
the local filesystem. If the second element is None, the artifact will be unpacked in the current working directory.
|
|
1360
|
-
If a string is provided, then the artifact corresponding to that name will be loaded in the current working directory.
|
|
1361
|
-
|
|
1362
|
-
temp_dir_root : str, default: None
|
|
1363
|
-
The root directory under which `current.model.loaded` will store loaded models
|
|
1298
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
1299
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
1300
|
+
role : str, optional, default: None
|
|
1301
|
+
Role to use for fetching secrets
|
|
1364
1302
|
"""
|
|
1365
1303
|
...
|
|
1366
1304
|
|
|
1367
1305
|
@typing.overload
|
|
1368
|
-
def
|
|
1369
|
-
"""
|
|
1370
|
-
Decorator prototype for all step decorators. This function gets specialized
|
|
1371
|
-
and imported for all decorators types by _import_plugin_decorators().
|
|
1372
|
-
"""
|
|
1306
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1373
1307
|
...
|
|
1374
1308
|
|
|
1375
1309
|
@typing.overload
|
|
1376
|
-
def
|
|
1310
|
+
def secrets(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1377
1311
|
...
|
|
1378
1312
|
|
|
1379
|
-
def
|
|
1313
|
+
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):
|
|
1380
1314
|
"""
|
|
1381
|
-
|
|
1382
|
-
|
|
1315
|
+
Specifies secrets to be retrieved and injected as environment variables prior to
|
|
1316
|
+
the execution of a step.
|
|
1317
|
+
|
|
1318
|
+
|
|
1319
|
+
Parameters
|
|
1320
|
+
----------
|
|
1321
|
+
sources : List[Union[str, Dict[str, Any]]], default: []
|
|
1322
|
+
List of secret specs, defining how the secrets are to be retrieved
|
|
1323
|
+
role : str, optional, default: None
|
|
1324
|
+
Role to use for fetching secrets
|
|
1383
1325
|
"""
|
|
1384
1326
|
...
|
|
1385
1327
|
|
|
1386
1328
|
@typing.overload
|
|
1387
|
-
def
|
|
1329
|
+
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]]]:
|
|
1388
1330
|
"""
|
|
1389
|
-
|
|
1331
|
+
Specifies that the step will success under all circumstances.
|
|
1390
1332
|
|
|
1391
|
-
|
|
1333
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
1334
|
+
contains the exception raised. You can use it to detect the presence
|
|
1335
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
1336
|
+
are missing.
|
|
1392
1337
|
|
|
1393
1338
|
|
|
1394
1339
|
Parameters
|
|
1395
1340
|
----------
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
timeout : int, default 45
|
|
1403
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
1341
|
+
var : str, optional, default None
|
|
1342
|
+
Name of the artifact in which to store the caught exception.
|
|
1343
|
+
If not specified, the exception is not stored.
|
|
1344
|
+
print_exception : bool, default True
|
|
1345
|
+
Determines whether or not the exception is printed to
|
|
1346
|
+
stdout when caught.
|
|
1404
1347
|
"""
|
|
1405
1348
|
...
|
|
1406
1349
|
|
|
1407
1350
|
@typing.overload
|
|
1408
|
-
def
|
|
1351
|
+
def catch(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1409
1352
|
...
|
|
1410
1353
|
|
|
1411
1354
|
@typing.overload
|
|
1412
|
-
def
|
|
1355
|
+
def catch(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1413
1356
|
...
|
|
1414
1357
|
|
|
1415
|
-
def
|
|
1358
|
+
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):
|
|
1416
1359
|
"""
|
|
1417
|
-
|
|
1360
|
+
Specifies that the step will success under all circumstances.
|
|
1418
1361
|
|
|
1419
|
-
|
|
1362
|
+
The decorator will create an optional artifact, specified by `var`, which
|
|
1363
|
+
contains the exception raised. You can use it to detect the presence
|
|
1364
|
+
of errors, indicating that all happy-path artifacts produced by the step
|
|
1365
|
+
are missing.
|
|
1420
1366
|
|
|
1421
1367
|
|
|
1422
1368
|
Parameters
|
|
1423
1369
|
----------
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
timeout : int, default 45
|
|
1431
|
-
Interrupt reporting if it takes more than this many seconds.
|
|
1370
|
+
var : str, optional, default None
|
|
1371
|
+
Name of the artifact in which to store the caught exception.
|
|
1372
|
+
If not specified, the exception is not stored.
|
|
1373
|
+
print_exception : bool, default True
|
|
1374
|
+
Determines whether or not the exception is printed to
|
|
1375
|
+
stdout when caught.
|
|
1432
1376
|
"""
|
|
1433
1377
|
...
|
|
1434
1378
|
|
|
1435
1379
|
@typing.overload
|
|
1436
|
-
def
|
|
1380
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1437
1381
|
"""
|
|
1438
|
-
|
|
1439
|
-
|
|
1382
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
1383
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
1440
1384
|
"""
|
|
1441
1385
|
...
|
|
1442
1386
|
|
|
1443
1387
|
@typing.overload
|
|
1444
|
-
def
|
|
1388
|
+
def parallel(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1445
1389
|
...
|
|
1446
1390
|
|
|
1447
|
-
def
|
|
1391
|
+
def parallel(f: typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None], None] = None):
|
|
1448
1392
|
"""
|
|
1449
|
-
|
|
1450
|
-
|
|
1393
|
+
Decorator prototype for all step decorators. This function gets specialized
|
|
1394
|
+
and imported for all decorators types by _import_plugin_decorators().
|
|
1451
1395
|
"""
|
|
1452
1396
|
...
|
|
1453
1397
|
|
|
1454
|
-
def
|
|
1398
|
+
def nebius_s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typing.Optional[str] = None, debug: typing.Optional[bool] = None) -> typing.Callable[[typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]], typing.Union[typing.Callable[[FlowSpecDerived, StepFlag], None], typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]]]:
|
|
1455
1399
|
"""
|
|
1400
|
+
`@nebius_s3_proxy` is a Nebius-specific S3 Proxy decorator for routing S3 requests through a local proxy service.
|
|
1401
|
+
It exists to make it easier for users to know that this decorator should only be used with
|
|
1402
|
+
a Neo Cloud like Nebius. The underlying mechanics of the decorator is the same as the `@s3_proxy`:
|
|
1403
|
+
|
|
1404
|
+
|
|
1456
1405
|
Set up an S3 proxy that caches objects in an external, S3‑compatible bucket
|
|
1457
1406
|
for S3 read and write requests.
|
|
1458
1407
|
|
|
@@ -1511,103 +1460,276 @@ def s3_proxy(*, integration_name: typing.Optional[str] = None, write_mode: typin
|
|
|
1511
1460
|
...
|
|
1512
1461
|
|
|
1513
1462
|
@typing.overload
|
|
1514
|
-
def
|
|
1463
|
+
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]]]:
|
|
1515
1464
|
"""
|
|
1516
|
-
Specifies the
|
|
1465
|
+
Specifies the PyPI packages for the step.
|
|
1517
1466
|
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1521
|
-
|
|
1522
|
-
```
|
|
1523
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1524
|
-
```
|
|
1525
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1526
|
-
when upstream runs within the same namespace complete successfully
|
|
1467
|
+
Information in this decorator will augment any
|
|
1468
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
1469
|
+
you can use `@pypi_base` to set packages required by all
|
|
1470
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1527
1471
|
|
|
1528
|
-
Additionally, you can specify project aware upstream flow dependencies
|
|
1529
|
-
by specifying the fully qualified project_flow_name.
|
|
1530
|
-
```
|
|
1531
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1532
|
-
```
|
|
1533
|
-
or
|
|
1534
|
-
```
|
|
1535
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1536
|
-
```
|
|
1537
1472
|
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1473
|
+
Parameters
|
|
1474
|
+
----------
|
|
1475
|
+
packages : Dict[str, str], default: {}
|
|
1476
|
+
Packages to use for this step. The key is the name of the package
|
|
1477
|
+
and the value is the version to use.
|
|
1478
|
+
python : str, optional, default: None
|
|
1479
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1480
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1481
|
+
"""
|
|
1482
|
+
...
|
|
1483
|
+
|
|
1484
|
+
@typing.overload
|
|
1485
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, StepFlag], None]:
|
|
1486
|
+
...
|
|
1487
|
+
|
|
1488
|
+
@typing.overload
|
|
1489
|
+
def pypi(f: typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]) -> typing.Callable[[FlowSpecDerived, typing.Any, StepFlag], None]:
|
|
1490
|
+
...
|
|
1491
|
+
|
|
1492
|
+
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):
|
|
1493
|
+
"""
|
|
1494
|
+
Specifies the PyPI packages for the step.
|
|
1495
|
+
|
|
1496
|
+
Information in this decorator will augment any
|
|
1497
|
+
attributes set in the `@pyi_base` flow-level decorator. Hence,
|
|
1498
|
+
you can use `@pypi_base` to set packages required by all
|
|
1499
|
+
steps and use `@pypi` to specify step-specific overrides.
|
|
1500
|
+
|
|
1501
|
+
|
|
1502
|
+
Parameters
|
|
1503
|
+
----------
|
|
1504
|
+
packages : Dict[str, str], default: {}
|
|
1505
|
+
Packages to use for this step. The key is the name of the package
|
|
1506
|
+
and the value is the version to use.
|
|
1507
|
+
python : str, optional, default: None
|
|
1508
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1509
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1510
|
+
"""
|
|
1511
|
+
...
|
|
1512
|
+
|
|
1513
|
+
@typing.overload
|
|
1514
|
+
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]]:
|
|
1515
|
+
"""
|
|
1516
|
+
Specifies the times when the flow should be run when running on a
|
|
1517
|
+
production scheduler.
|
|
1518
|
+
|
|
1519
|
+
|
|
1520
|
+
Parameters
|
|
1521
|
+
----------
|
|
1522
|
+
hourly : bool, default False
|
|
1523
|
+
Run the workflow hourly.
|
|
1524
|
+
daily : bool, default True
|
|
1525
|
+
Run the workflow daily.
|
|
1526
|
+
weekly : bool, default False
|
|
1527
|
+
Run the workflow weekly.
|
|
1528
|
+
cron : str, optional, default None
|
|
1529
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1530
|
+
specified by this expression.
|
|
1531
|
+
timezone : str, optional, default None
|
|
1532
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1533
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1534
|
+
"""
|
|
1535
|
+
...
|
|
1536
|
+
|
|
1537
|
+
@typing.overload
|
|
1538
|
+
def schedule(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1539
|
+
...
|
|
1540
|
+
|
|
1541
|
+
def schedule(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, hourly: bool = False, daily: bool = True, weekly: bool = False, cron: typing.Optional[str] = None, timezone: typing.Optional[str] = None):
|
|
1542
|
+
"""
|
|
1543
|
+
Specifies the times when the flow should be run when running on a
|
|
1544
|
+
production scheduler.
|
|
1545
|
+
|
|
1546
|
+
|
|
1547
|
+
Parameters
|
|
1548
|
+
----------
|
|
1549
|
+
hourly : bool, default False
|
|
1550
|
+
Run the workflow hourly.
|
|
1551
|
+
daily : bool, default True
|
|
1552
|
+
Run the workflow daily.
|
|
1553
|
+
weekly : bool, default False
|
|
1554
|
+
Run the workflow weekly.
|
|
1555
|
+
cron : str, optional, default None
|
|
1556
|
+
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1557
|
+
specified by this expression.
|
|
1558
|
+
timezone : str, optional, default None
|
|
1559
|
+
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1560
|
+
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1561
|
+
"""
|
|
1562
|
+
...
|
|
1563
|
+
|
|
1564
|
+
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]]:
|
|
1565
|
+
"""
|
|
1566
|
+
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)
|
|
1567
|
+
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1568
|
+
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1569
|
+
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1570
|
+
starts only after all sensors finish.
|
|
1571
|
+
|
|
1572
|
+
|
|
1573
|
+
Parameters
|
|
1574
|
+
----------
|
|
1575
|
+
timeout : int
|
|
1576
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1577
|
+
poke_interval : int
|
|
1578
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1579
|
+
mode : str
|
|
1580
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1581
|
+
exponential_backoff : bool
|
|
1582
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1583
|
+
pool : str
|
|
1584
|
+
the slot pool this task should run in,
|
|
1585
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1586
|
+
soft_fail : bool
|
|
1587
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1588
|
+
name : str
|
|
1589
|
+
Name of the sensor on Airflow
|
|
1590
|
+
description : str
|
|
1591
|
+
Description of sensor in the Airflow UI
|
|
1592
|
+
bucket_key : Union[str, List[str]]
|
|
1593
|
+
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1594
|
+
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1595
|
+
bucket_name : str
|
|
1596
|
+
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1597
|
+
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1598
|
+
wildcard_match : bool
|
|
1599
|
+
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1600
|
+
aws_conn_id : str
|
|
1601
|
+
a reference to the s3 connection on Airflow. (Default: None)
|
|
1602
|
+
verify : bool
|
|
1603
|
+
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1604
|
+
"""
|
|
1605
|
+
...
|
|
1606
|
+
|
|
1607
|
+
@typing.overload
|
|
1608
|
+
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]]:
|
|
1609
|
+
"""
|
|
1610
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1611
|
+
|
|
1612
|
+
Use `@conda_base` to set common libraries required by all
|
|
1613
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1614
|
+
|
|
1615
|
+
|
|
1616
|
+
Parameters
|
|
1617
|
+
----------
|
|
1618
|
+
packages : Dict[str, str], default {}
|
|
1619
|
+
Packages to use for this flow. The key is the name of the package
|
|
1620
|
+
and the value is the version to use.
|
|
1621
|
+
libraries : Dict[str, str], default {}
|
|
1622
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1623
|
+
python : str, optional, default None
|
|
1624
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1625
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1626
|
+
disabled : bool, default False
|
|
1627
|
+
If set to True, disables Conda.
|
|
1628
|
+
"""
|
|
1629
|
+
...
|
|
1630
|
+
|
|
1631
|
+
@typing.overload
|
|
1632
|
+
def conda_base(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1633
|
+
...
|
|
1634
|
+
|
|
1635
|
+
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):
|
|
1636
|
+
"""
|
|
1637
|
+
Specifies the Conda environment for all steps of the flow.
|
|
1638
|
+
|
|
1639
|
+
Use `@conda_base` to set common libraries required by all
|
|
1640
|
+
steps and use `@conda` to specify step-specific additions.
|
|
1641
|
+
|
|
1642
|
+
|
|
1643
|
+
Parameters
|
|
1644
|
+
----------
|
|
1645
|
+
packages : Dict[str, str], default {}
|
|
1646
|
+
Packages to use for this flow. The key is the name of the package
|
|
1647
|
+
and the value is the version to use.
|
|
1648
|
+
libraries : Dict[str, str], default {}
|
|
1649
|
+
Supported for backward compatibility. When used with packages, packages will take precedence.
|
|
1650
|
+
python : str, optional, default None
|
|
1651
|
+
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
1652
|
+
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
1653
|
+
disabled : bool, default False
|
|
1654
|
+
If set to True, disables Conda.
|
|
1655
|
+
"""
|
|
1656
|
+
...
|
|
1657
|
+
|
|
1658
|
+
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1659
|
+
"""
|
|
1660
|
+
Specifies what flows belong to the same project.
|
|
1543
1661
|
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
- `user.bob`
|
|
1547
|
-
- `test.my_experiment`
|
|
1548
|
-
- `prod.staging`
|
|
1662
|
+
A project-specific namespace is created for all flows that
|
|
1663
|
+
use the same `@project(name)`.
|
|
1549
1664
|
|
|
1550
1665
|
|
|
1551
1666
|
Parameters
|
|
1552
1667
|
----------
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1668
|
+
name : str
|
|
1669
|
+
Project name. Make sure that the name is unique amongst all
|
|
1670
|
+
projects that use the same production scheduler. The name may
|
|
1671
|
+
contain only lowercase alphanumeric characters and underscores.
|
|
1672
|
+
|
|
1673
|
+
branch : Optional[str], default None
|
|
1674
|
+
The branch to use. If not specified, the branch is set to
|
|
1675
|
+
`user.<username>` unless `production` is set to `True`. This can
|
|
1676
|
+
also be set on the command line using `--branch` as a top-level option.
|
|
1677
|
+
It is an error to specify `branch` in the decorator and on the command line.
|
|
1678
|
+
|
|
1679
|
+
production : bool, default False
|
|
1680
|
+
Whether or not the branch is the production branch. This can also be set on the
|
|
1681
|
+
command line using `--production` as a top-level option. It is an error to specify
|
|
1682
|
+
`production` in the decorator and on the command line.
|
|
1683
|
+
The project branch name will be:
|
|
1684
|
+
- if `branch` is specified:
|
|
1685
|
+
- if `production` is True: `prod.<branch>`
|
|
1686
|
+
- if `production` is False: `test.<branch>`
|
|
1687
|
+
- if `branch` is not specified:
|
|
1688
|
+
- if `production` is True: `prod`
|
|
1689
|
+
- if `production` is False: `user.<username>`
|
|
1559
1690
|
"""
|
|
1560
1691
|
...
|
|
1561
1692
|
|
|
1562
|
-
|
|
1563
|
-
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1564
|
-
...
|
|
1565
|
-
|
|
1566
|
-
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
1693
|
+
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]]:
|
|
1567
1694
|
"""
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
```
|
|
1571
|
-
@trigger_on_finish(flow='FooFlow')
|
|
1572
|
-
```
|
|
1573
|
-
or
|
|
1574
|
-
```
|
|
1575
|
-
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1576
|
-
```
|
|
1577
|
-
This decorator respects the @project decorator and triggers the flow
|
|
1578
|
-
when upstream runs within the same namespace complete successfully
|
|
1579
|
-
|
|
1580
|
-
Additionally, you can specify project aware upstream flow dependencies
|
|
1581
|
-
by specifying the fully qualified project_flow_name.
|
|
1582
|
-
```
|
|
1583
|
-
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1584
|
-
```
|
|
1585
|
-
or
|
|
1586
|
-
```
|
|
1587
|
-
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1588
|
-
```
|
|
1589
|
-
|
|
1590
|
-
You can also specify just the project or project branch (other values will be
|
|
1591
|
-
inferred from the current project or project branch):
|
|
1592
|
-
```
|
|
1593
|
-
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1594
|
-
```
|
|
1595
|
-
|
|
1596
|
-
Note that `branch` is typically one of:
|
|
1597
|
-
- `prod`
|
|
1598
|
-
- `user.bob`
|
|
1599
|
-
- `test.my_experiment`
|
|
1600
|
-
- `prod.staging`
|
|
1695
|
+
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.
|
|
1696
|
+
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.
|
|
1601
1697
|
|
|
1602
1698
|
|
|
1603
1699
|
Parameters
|
|
1604
1700
|
----------
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
|
|
1609
|
-
|
|
1610
|
-
|
|
1701
|
+
timeout : int
|
|
1702
|
+
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1703
|
+
poke_interval : int
|
|
1704
|
+
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1705
|
+
mode : str
|
|
1706
|
+
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1707
|
+
exponential_backoff : bool
|
|
1708
|
+
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1709
|
+
pool : str
|
|
1710
|
+
the slot pool this task should run in,
|
|
1711
|
+
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1712
|
+
soft_fail : bool
|
|
1713
|
+
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1714
|
+
name : str
|
|
1715
|
+
Name of the sensor on Airflow
|
|
1716
|
+
description : str
|
|
1717
|
+
Description of sensor in the Airflow UI
|
|
1718
|
+
external_dag_id : str
|
|
1719
|
+
The dag_id that contains the task you want to wait for.
|
|
1720
|
+
external_task_ids : List[str]
|
|
1721
|
+
The list of task_ids that you want to wait for.
|
|
1722
|
+
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1723
|
+
allowed_states : List[str]
|
|
1724
|
+
Iterable of allowed states, (Default: ['success'])
|
|
1725
|
+
failed_states : List[str]
|
|
1726
|
+
Iterable of failed or dis-allowed states. (Default: None)
|
|
1727
|
+
execution_delta : datetime.timedelta
|
|
1728
|
+
time difference with the previous execution to look at,
|
|
1729
|
+
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1730
|
+
check_existence: bool
|
|
1731
|
+
Set to True to check if the external task exists or check if
|
|
1732
|
+
the DAG to wait for exists. (Default: True)
|
|
1611
1733
|
"""
|
|
1612
1734
|
...
|
|
1613
1735
|
|
|
@@ -1726,232 +1848,103 @@ def with_artifact_store(f: typing.Optional[typing.Type[FlowSpecDerived]] = None)
|
|
|
1726
1848
|
...
|
|
1727
1849
|
|
|
1728
1850
|
@typing.overload
|
|
1729
|
-
def
|
|
1730
|
-
"""
|
|
1731
|
-
Specifies the event(s) that this flow depends on.
|
|
1732
|
-
|
|
1733
|
-
```
|
|
1734
|
-
@trigger(event='foo')
|
|
1735
|
-
```
|
|
1736
|
-
or
|
|
1737
|
-
```
|
|
1738
|
-
@trigger(events=['foo', 'bar'])
|
|
1739
|
-
```
|
|
1740
|
-
|
|
1741
|
-
Additionally, you can specify the parameter mappings
|
|
1742
|
-
to map event payload to Metaflow parameters for the flow.
|
|
1743
|
-
```
|
|
1744
|
-
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
1745
|
-
```
|
|
1746
|
-
or
|
|
1747
|
-
```
|
|
1748
|
-
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
1749
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1750
|
-
```
|
|
1751
|
-
|
|
1752
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
1753
|
-
```
|
|
1754
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1755
|
-
```
|
|
1756
|
-
This is equivalent to:
|
|
1757
|
-
```
|
|
1758
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1759
|
-
```
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
Parameters
|
|
1763
|
-
----------
|
|
1764
|
-
event : Union[str, Dict[str, Any]], optional, default None
|
|
1765
|
-
Event dependency for this flow.
|
|
1766
|
-
events : List[Union[str, Dict[str, Any]]], default []
|
|
1767
|
-
Events dependency for this flow.
|
|
1768
|
-
options : Dict[str, Any], default {}
|
|
1769
|
-
Backend-specific configuration for tuning eventing behavior.
|
|
1770
|
-
"""
|
|
1771
|
-
...
|
|
1772
|
-
|
|
1773
|
-
@typing.overload
|
|
1774
|
-
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1775
|
-
...
|
|
1776
|
-
|
|
1777
|
-
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] = {}):
|
|
1851
|
+
def trigger_on_finish(*, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
1778
1852
|
"""
|
|
1779
|
-
Specifies the
|
|
1853
|
+
Specifies the flow(s) that this flow depends on.
|
|
1780
1854
|
|
|
1781
1855
|
```
|
|
1782
|
-
@
|
|
1856
|
+
@trigger_on_finish(flow='FooFlow')
|
|
1783
1857
|
```
|
|
1784
1858
|
or
|
|
1785
1859
|
```
|
|
1786
|
-
@
|
|
1860
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1787
1861
|
```
|
|
1862
|
+
This decorator respects the @project decorator and triggers the flow
|
|
1863
|
+
when upstream runs within the same namespace complete successfully
|
|
1788
1864
|
|
|
1789
|
-
Additionally, you can specify
|
|
1790
|
-
|
|
1865
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
1866
|
+
by specifying the fully qualified project_flow_name.
|
|
1791
1867
|
```
|
|
1792
|
-
@
|
|
1868
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1793
1869
|
```
|
|
1794
1870
|
or
|
|
1795
1871
|
```
|
|
1796
|
-
@
|
|
1797
|
-
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
1798
|
-
```
|
|
1799
|
-
|
|
1800
|
-
'parameters' can also be a list of strings and tuples like so:
|
|
1801
|
-
```
|
|
1802
|
-
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
1803
|
-
```
|
|
1804
|
-
This is equivalent to:
|
|
1805
|
-
```
|
|
1806
|
-
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
1872
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1807
1873
|
```
|
|
1808
1874
|
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1821
|
-
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]]:
|
|
1822
|
-
"""
|
|
1823
|
-
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)
|
|
1824
|
-
before the start step of the flow. This decorator only works when a flow is scheduled on Airflow
|
|
1825
|
-
and is compiled using `airflow create`. More than one `@airflow_s3_key_sensor` can be
|
|
1826
|
-
added as a flow decorators. Adding more than one decorator will ensure that `start` step
|
|
1827
|
-
starts only after all sensors finish.
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
Parameters
|
|
1831
|
-
----------
|
|
1832
|
-
timeout : int
|
|
1833
|
-
Time, in seconds before the task times out and fails. (Default: 3600)
|
|
1834
|
-
poke_interval : int
|
|
1835
|
-
Time in seconds that the job should wait in between each try. (Default: 60)
|
|
1836
|
-
mode : str
|
|
1837
|
-
How the sensor operates. Options are: { poke | reschedule }. (Default: "poke")
|
|
1838
|
-
exponential_backoff : bool
|
|
1839
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1840
|
-
pool : str
|
|
1841
|
-
the slot pool this task should run in,
|
|
1842
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1843
|
-
soft_fail : bool
|
|
1844
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1845
|
-
name : str
|
|
1846
|
-
Name of the sensor on Airflow
|
|
1847
|
-
description : str
|
|
1848
|
-
Description of sensor in the Airflow UI
|
|
1849
|
-
bucket_key : Union[str, List[str]]
|
|
1850
|
-
The key(s) being waited on. Supports full s3:// style url or relative path from root level.
|
|
1851
|
-
When it's specified as a full s3:// url, please leave `bucket_name` as None
|
|
1852
|
-
bucket_name : str
|
|
1853
|
-
Name of the S3 bucket. Only needed when bucket_key is not provided as a full s3:// url.
|
|
1854
|
-
When specified, all the keys passed to bucket_key refers to this bucket. (Default:None)
|
|
1855
|
-
wildcard_match : bool
|
|
1856
|
-
whether the bucket_key should be interpreted as a Unix wildcard pattern. (Default: False)
|
|
1857
|
-
aws_conn_id : str
|
|
1858
|
-
a reference to the s3 connection on Airflow. (Default: None)
|
|
1859
|
-
verify : bool
|
|
1860
|
-
Whether or not to verify SSL certificates for S3 connection. (Default: None)
|
|
1861
|
-
"""
|
|
1862
|
-
...
|
|
1863
|
-
|
|
1864
|
-
@typing.overload
|
|
1865
|
-
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]]:
|
|
1866
|
-
"""
|
|
1867
|
-
Specifies the times when the flow should be run when running on a
|
|
1868
|
-
production scheduler.
|
|
1875
|
+
You can also specify just the project or project branch (other values will be
|
|
1876
|
+
inferred from the current project or project branch):
|
|
1877
|
+
```
|
|
1878
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1879
|
+
```
|
|
1880
|
+
|
|
1881
|
+
Note that `branch` is typically one of:
|
|
1882
|
+
- `prod`
|
|
1883
|
+
- `user.bob`
|
|
1884
|
+
- `test.my_experiment`
|
|
1885
|
+
- `prod.staging`
|
|
1869
1886
|
|
|
1870
1887
|
|
|
1871
1888
|
Parameters
|
|
1872
1889
|
----------
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
cron : str, optional, default None
|
|
1880
|
-
Run the workflow at [a custom Cron schedule](https://docs.aws.amazon.com/eventbridge/latest/userguide/scheduled-events.html#cron-expressions)
|
|
1881
|
-
specified by this expression.
|
|
1882
|
-
timezone : str, optional, default None
|
|
1883
|
-
Timezone on which the schedule runs (default: None). Currently supported only for Argo workflows,
|
|
1884
|
-
which accepts timezones in [IANA format](https://nodatime.org/TimeZones).
|
|
1890
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1891
|
+
Upstream flow dependency for this flow.
|
|
1892
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1893
|
+
Upstream flow dependencies for this flow.
|
|
1894
|
+
options : Dict[str, Any], default {}
|
|
1895
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1885
1896
|
"""
|
|
1886
1897
|
...
|
|
1887
1898
|
|
|
1888
1899
|
@typing.overload
|
|
1889
|
-
def
|
|
1900
|
+
def trigger_on_finish(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
1890
1901
|
...
|
|
1891
1902
|
|
|
1892
|
-
def
|
|
1903
|
+
def trigger_on_finish(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, flow: typing.Union[typing.Dict[str, str], str, None] = None, flows: typing.List[typing.Union[str, typing.Dict[str, str]]] = [], options: typing.Dict[str, typing.Any] = {}):
|
|
1893
1904
|
"""
|
|
1894
|
-
Specifies the
|
|
1895
|
-
production scheduler.
|
|
1905
|
+
Specifies the flow(s) that this flow depends on.
|
|
1896
1906
|
|
|
1907
|
+
```
|
|
1908
|
+
@trigger_on_finish(flow='FooFlow')
|
|
1909
|
+
```
|
|
1910
|
+
or
|
|
1911
|
+
```
|
|
1912
|
+
@trigger_on_finish(flows=['FooFlow', 'BarFlow'])
|
|
1913
|
+
```
|
|
1914
|
+
This decorator respects the @project decorator and triggers the flow
|
|
1915
|
+
when upstream runs within the same namespace complete successfully
|
|
1897
1916
|
|
|
1898
|
-
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1917
|
+
Additionally, you can specify project aware upstream flow dependencies
|
|
1918
|
+
by specifying the fully qualified project_flow_name.
|
|
1919
|
+
```
|
|
1920
|
+
@trigger_on_finish(flow='my_project.branch.my_branch.FooFlow')
|
|
1921
|
+
```
|
|
1922
|
+
or
|
|
1923
|
+
```
|
|
1924
|
+
@trigger_on_finish(flows=['my_project.branch.my_branch.FooFlow', 'BarFlow'])
|
|
1925
|
+
```
|
|
1926
|
+
|
|
1927
|
+
You can also specify just the project or project branch (other values will be
|
|
1928
|
+
inferred from the current project or project branch):
|
|
1929
|
+
```
|
|
1930
|
+
@trigger_on_finish(flow={"name": "FooFlow", "project": "my_project", "project_branch": "branch"})
|
|
1931
|
+
```
|
|
1932
|
+
|
|
1933
|
+
Note that `branch` is typically one of:
|
|
1934
|
+
- `prod`
|
|
1935
|
+
- `user.bob`
|
|
1936
|
+
- `test.my_experiment`
|
|
1937
|
+
- `prod.staging`
|
|
1919
1938
|
|
|
1920
1939
|
|
|
1921
1940
|
Parameters
|
|
1922
1941
|
----------
|
|
1923
|
-
|
|
1924
|
-
|
|
1925
|
-
|
|
1926
|
-
|
|
1927
|
-
|
|
1928
|
-
|
|
1929
|
-
exponential_backoff : bool
|
|
1930
|
-
allow progressive longer waits between pokes by using exponential backoff algorithm. (Default: True)
|
|
1931
|
-
pool : str
|
|
1932
|
-
the slot pool this task should run in,
|
|
1933
|
-
slot pools are a way to limit concurrency for certain tasks. (Default:None)
|
|
1934
|
-
soft_fail : bool
|
|
1935
|
-
Set to true to mark the task as SKIPPED on failure. (Default: False)
|
|
1936
|
-
name : str
|
|
1937
|
-
Name of the sensor on Airflow
|
|
1938
|
-
description : str
|
|
1939
|
-
Description of sensor in the Airflow UI
|
|
1940
|
-
external_dag_id : str
|
|
1941
|
-
The dag_id that contains the task you want to wait for.
|
|
1942
|
-
external_task_ids : List[str]
|
|
1943
|
-
The list of task_ids that you want to wait for.
|
|
1944
|
-
If None (default value) the sensor waits for the DAG. (Default: None)
|
|
1945
|
-
allowed_states : List[str]
|
|
1946
|
-
Iterable of allowed states, (Default: ['success'])
|
|
1947
|
-
failed_states : List[str]
|
|
1948
|
-
Iterable of failed or dis-allowed states. (Default: None)
|
|
1949
|
-
execution_delta : datetime.timedelta
|
|
1950
|
-
time difference with the previous execution to look at,
|
|
1951
|
-
the default is the same logical date as the current task or DAG. (Default: None)
|
|
1952
|
-
check_existence: bool
|
|
1953
|
-
Set to True to check if the external task exists or check if
|
|
1954
|
-
the DAG to wait for exists. (Default: True)
|
|
1942
|
+
flow : Union[str, Dict[str, str]], optional, default None
|
|
1943
|
+
Upstream flow dependency for this flow.
|
|
1944
|
+
flows : List[Union[str, Dict[str, str]]], default []
|
|
1945
|
+
Upstream flow dependencies for this flow.
|
|
1946
|
+
options : Dict[str, Any], default {}
|
|
1947
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
1955
1948
|
"""
|
|
1956
1949
|
...
|
|
1957
1950
|
|
|
@@ -1997,88 +1990,95 @@ def pypi_base(f: typing.Optional[typing.Type[FlowSpecDerived]] = None, *, packag
|
|
|
1997
1990
|
...
|
|
1998
1991
|
|
|
1999
1992
|
@typing.overload
|
|
2000
|
-
def
|
|
1993
|
+
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]]:
|
|
2001
1994
|
"""
|
|
2002
|
-
Specifies the
|
|
1995
|
+
Specifies the event(s) that this flow depends on.
|
|
2003
1996
|
|
|
2004
|
-
|
|
2005
|
-
|
|
1997
|
+
```
|
|
1998
|
+
@trigger(event='foo')
|
|
1999
|
+
```
|
|
2000
|
+
or
|
|
2001
|
+
```
|
|
2002
|
+
@trigger(events=['foo', 'bar'])
|
|
2003
|
+
```
|
|
2004
|
+
|
|
2005
|
+
Additionally, you can specify the parameter mappings
|
|
2006
|
+
to map event payload to Metaflow parameters for the flow.
|
|
2007
|
+
```
|
|
2008
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
2009
|
+
```
|
|
2010
|
+
or
|
|
2011
|
+
```
|
|
2012
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
2013
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
2014
|
+
```
|
|
2015
|
+
|
|
2016
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
2017
|
+
```
|
|
2018
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
2019
|
+
```
|
|
2020
|
+
This is equivalent to:
|
|
2021
|
+
```
|
|
2022
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
2023
|
+
```
|
|
2006
2024
|
|
|
2007
2025
|
|
|
2008
2026
|
Parameters
|
|
2009
2027
|
----------
|
|
2010
|
-
|
|
2011
|
-
|
|
2012
|
-
|
|
2013
|
-
|
|
2014
|
-
|
|
2015
|
-
|
|
2016
|
-
Version of Python to use, e.g. '3.7.4'. A default value of None implies
|
|
2017
|
-
that the version used will correspond to the version of the Python interpreter used to start the run.
|
|
2018
|
-
disabled : bool, default False
|
|
2019
|
-
If set to True, disables Conda.
|
|
2028
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
2029
|
+
Event dependency for this flow.
|
|
2030
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
2031
|
+
Events dependency for this flow.
|
|
2032
|
+
options : Dict[str, Any], default {}
|
|
2033
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
2020
2034
|
"""
|
|
2021
2035
|
...
|
|
2022
2036
|
|
|
2023
2037
|
@typing.overload
|
|
2024
|
-
def
|
|
2038
|
+
def trigger(f: typing.Type[FlowSpecDerived]) -> typing.Type[FlowSpecDerived]:
|
|
2025
2039
|
...
|
|
2026
2040
|
|
|
2027
|
-
def
|
|
2041
|
+
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] = {}):
|
|
2028
2042
|
"""
|
|
2029
|
-
Specifies the
|
|
2030
|
-
|
|
2031
|
-
Use `@conda_base` to set common libraries required by all
|
|
2032
|
-
steps and use `@conda` to specify step-specific additions.
|
|
2043
|
+
Specifies the event(s) that this flow depends on.
|
|
2033
2044
|
|
|
2045
|
+
```
|
|
2046
|
+
@trigger(event='foo')
|
|
2047
|
+
```
|
|
2048
|
+
or
|
|
2049
|
+
```
|
|
2050
|
+
@trigger(events=['foo', 'bar'])
|
|
2051
|
+
```
|
|
2034
2052
|
|
|
2035
|
-
|
|
2036
|
-
|
|
2037
|
-
|
|
2038
|
-
|
|
2039
|
-
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
disabled : bool, default False
|
|
2046
|
-
If set to True, disables Conda.
|
|
2047
|
-
"""
|
|
2048
|
-
...
|
|
2049
|
-
|
|
2050
|
-
def project(*, name: str, branch: typing.Optional[str] = None, production: bool = False) -> typing.Callable[[typing.Type[FlowSpecDerived]], typing.Type[FlowSpecDerived]]:
|
|
2051
|
-
"""
|
|
2052
|
-
Specifies what flows belong to the same project.
|
|
2053
|
+
Additionally, you can specify the parameter mappings
|
|
2054
|
+
to map event payload to Metaflow parameters for the flow.
|
|
2055
|
+
```
|
|
2056
|
+
@trigger(event={'name':'foo', 'parameters':{'flow_param': 'event_field'}})
|
|
2057
|
+
```
|
|
2058
|
+
or
|
|
2059
|
+
```
|
|
2060
|
+
@trigger(events=[{'name':'foo', 'parameters':{'flow_param_1': 'event_field_1'},
|
|
2061
|
+
{'name':'bar', 'parameters':{'flow_param_2': 'event_field_2'}])
|
|
2062
|
+
```
|
|
2053
2063
|
|
|
2054
|
-
|
|
2055
|
-
|
|
2064
|
+
'parameters' can also be a list of strings and tuples like so:
|
|
2065
|
+
```
|
|
2066
|
+
@trigger(event={'name':'foo', 'parameters':['common_name', ('flow_param', 'event_field')]})
|
|
2067
|
+
```
|
|
2068
|
+
This is equivalent to:
|
|
2069
|
+
```
|
|
2070
|
+
@trigger(event={'name':'foo', 'parameters':{'common_name': 'common_name', 'flow_param': 'event_field'}})
|
|
2071
|
+
```
|
|
2056
2072
|
|
|
2057
2073
|
|
|
2058
2074
|
Parameters
|
|
2059
2075
|
----------
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
|
|
2063
|
-
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
The branch to use. If not specified, the branch is set to
|
|
2067
|
-
`user.<username>` unless `production` is set to `True`. This can
|
|
2068
|
-
also be set on the command line using `--branch` as a top-level option.
|
|
2069
|
-
It is an error to specify `branch` in the decorator and on the command line.
|
|
2070
|
-
|
|
2071
|
-
production : bool, default False
|
|
2072
|
-
Whether or not the branch is the production branch. This can also be set on the
|
|
2073
|
-
command line using `--production` as a top-level option. It is an error to specify
|
|
2074
|
-
`production` in the decorator and on the command line.
|
|
2075
|
-
The project branch name will be:
|
|
2076
|
-
- if `branch` is specified:
|
|
2077
|
-
- if `production` is True: `prod.<branch>`
|
|
2078
|
-
- if `production` is False: `test.<branch>`
|
|
2079
|
-
- if `branch` is not specified:
|
|
2080
|
-
- if `production` is True: `prod`
|
|
2081
|
-
- if `production` is False: `user.<username>`
|
|
2076
|
+
event : Union[str, Dict[str, Any]], optional, default None
|
|
2077
|
+
Event dependency for this flow.
|
|
2078
|
+
events : List[Union[str, Dict[str, Any]]], default []
|
|
2079
|
+
Events dependency for this flow.
|
|
2080
|
+
options : Dict[str, Any], default {}
|
|
2081
|
+
Backend-specific configuration for tuning eventing behavior.
|
|
2082
2082
|
"""
|
|
2083
2083
|
...
|
|
2084
2084
|
|