Coverage for /usr/local/lib/python3.12/site-packages/prefect/settings/models/results.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 10:48 +0000

1from __future__ import annotations 1a

2 

3from pathlib import Path 1a

4from typing import ClassVar, Optional 1a

5 

6from pydantic import AliasChoices, AliasPath, Field 1a

7from pydantic_settings import SettingsConfigDict 1a

8 

9from prefect.settings.base import PrefectBaseSettings, build_settings_config 1a

10 

11from ._defaults import default_local_storage_path 1a

12 

13 

14class ResultsSettings(PrefectBaseSettings): 1a

15 """ 

16 Settings for controlling result storage behavior 

17 """ 

18 

19 model_config: ClassVar[SettingsConfigDict] = build_settings_config(("results",)) 1a

20 

21 default_serializer: str = Field( 1a

22 default="pickle", 

23 description="The default serializer to use when not otherwise specified.", 

24 ) 

25 

26 persist_by_default: bool = Field( 1a

27 default=False, 

28 description="The default setting for persisting results when not otherwise specified.", 

29 ) 

30 

31 default_storage_block: Optional[str] = Field( 1a

32 default=None, 

33 description="The `block-type/block-document` slug of a block to use as the default result storage.", 

34 validation_alias=AliasChoices( 

35 AliasPath("default_storage_block"), 

36 "prefect_results_default_storage_block", 

37 "prefect_default_result_storage_block", 

38 ), 

39 ) 

40 

41 local_storage_path: Path = Field( 1a

42 default_factory=default_local_storage_path, 

43 description="The default location for locally persisted results. Defaults to $PREFECT_HOME/storage.", 

44 validation_alias=AliasChoices( 

45 AliasPath("local_storage_path"), 

46 "prefect_results_local_storage_path", 

47 "prefect_local_storage_path", 

48 ), 

49 )