Coverage for /usr/local/lib/python3.12/site-packages/prefect/settings/models/server/root.py: 100%
42 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 11:21 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 11:21 +0000
1from __future__ import annotations 1a
3from pathlib import Path 1a
4from typing import ClassVar 1a
6from pydantic import AliasChoices, AliasPath, Field 1a
7from pydantic_settings import SettingsConfigDict 1a
9from prefect.settings.base import PrefectBaseSettings, build_settings_config 1a
10from prefect.settings.models.server.concurrency import ServerConcurrencySettings 1a
11from prefect.settings.models.server.docket import ServerDocketSettings 1a
12from prefect.types import LogLevel 1a
14from .._defaults import default_memo_store_path 1a
15from .api import ServerAPISettings 1a
16from .database import ServerDatabaseSettings 1a
17from .deployments import ServerDeploymentsSettings 1a
18from .ephemeral import ServerEphemeralSettings 1a
19from .events import ServerEventsSettings 1a
20from .flow_run_graph import ServerFlowRunGraphSettings 1a
21from .logs import ServerLogsSettings 1a
22from .services import ServerServicesSettings 1a
23from .tasks import ServerTasksSettings 1a
24from .ui import ServerUISettings 1a
27class ServerSettings(PrefectBaseSettings): 1a
28 """
29 Settings for controlling server behavior
30 """
32 model_config: ClassVar[SettingsConfigDict] = build_settings_config(("server",)) 1a
34 logging_level: LogLevel = Field( 1a
35 default="WARNING",
36 description="The default logging level for the Prefect API server.",
37 validation_alias=AliasChoices(
38 AliasPath("logging_level"),
39 "prefect_server_logging_level",
40 "prefect_logging_server_level",
41 ),
42 )
44 analytics_enabled: bool = Field( 1a
45 default=True,
46 description="""
47 When enabled, Prefect sends anonymous data (e.g. count of flow runs, package version)
48 on server startup to help us improve our product.
49 """,
50 )
52 metrics_enabled: bool = Field( 1a
53 default=False,
54 description="Whether or not to enable Prometheus metrics in the API.",
55 validation_alias=AliasChoices(
56 AliasPath("metrics_enabled"),
57 "prefect_server_metrics_enabled",
58 "prefect_api_enable_metrics",
59 ),
60 )
62 log_retryable_errors: bool = Field( 1a
63 default=False,
64 description="If `True`, log retryable errors in the API and it's services.",
65 validation_alias=AliasChoices(
66 AliasPath("log_retryable_errors"),
67 "prefect_server_log_retryable_errors",
68 "prefect_api_log_retryable_errors",
69 ),
70 )
72 register_blocks_on_start: bool = Field( 1a
73 default=True,
74 description="If set, any block types that have been imported will be registered with the backend on application startup. If not set, block types must be manually registered.",
75 validation_alias=AliasChoices(
76 AliasPath("register_blocks_on_start"),
77 "prefect_server_register_blocks_on_start",
78 "prefect_api_blocks_register_on_start",
79 ),
80 )
82 memoize_block_auto_registration: bool = Field( 1a
83 default=True,
84 description="Controls whether or not block auto-registration on start",
85 validation_alias=AliasChoices(
86 AliasPath("memoize_block_auto_registration"),
87 "prefect_server_memoize_block_auto_registration",
88 "prefect_memoize_block_auto_registration",
89 ),
90 )
92 memo_store_path: Path = Field( 1a
93 default_factory=default_memo_store_path,
94 description="Path to the memo store file. Defaults to $PREFECT_HOME/memo_store.toml",
95 validation_alias=AliasChoices(
96 AliasPath("memo_store_path"),
97 "prefect_server_memo_store_path",
98 "prefect_memo_store_path",
99 ),
100 )
102 deployment_schedule_max_scheduled_runs: int = Field( 1a
103 default=50,
104 description="The maximum number of scheduled runs to create for a deployment.",
105 validation_alias=AliasChoices(
106 AliasPath("deployment_schedule_max_scheduled_runs"),
107 "prefect_server_deployment_schedule_max_scheduled_runs",
108 "prefect_deployment_schedule_max_scheduled_runs",
109 ),
110 )
112 api: ServerAPISettings = Field( 1a
113 default_factory=ServerAPISettings,
114 description="Settings for controlling API server behavior",
115 )
116 concurrency: ServerConcurrencySettings = Field( 1a
117 default_factory=ServerConcurrencySettings,
118 description="Settings for controlling server-side concurrency limit handling",
119 )
120 database: ServerDatabaseSettings = Field( 1a
121 default_factory=ServerDatabaseSettings,
122 description="Settings for controlling server database behavior",
123 )
124 deployments: ServerDeploymentsSettings = Field( 1a
125 default_factory=ServerDeploymentsSettings,
126 description="Settings for controlling server deployments behavior",
127 )
128 docket: ServerDocketSettings = Field( 1a
129 default_factory=ServerDocketSettings,
130 description="Settings for controlling server Docket behavior",
131 )
132 ephemeral: ServerEphemeralSettings = Field( 1a
133 default_factory=ServerEphemeralSettings,
134 description="Settings for controlling ephemeral server behavior",
135 )
136 events: ServerEventsSettings = Field( 1a
137 default_factory=ServerEventsSettings,
138 description="Settings for controlling server events behavior",
139 )
140 flow_run_graph: ServerFlowRunGraphSettings = Field( 1a
141 default_factory=ServerFlowRunGraphSettings,
142 description="Settings for controlling flow run graph behavior",
143 )
144 logs: ServerLogsSettings = Field( 1a
145 default_factory=ServerLogsSettings,
146 description="Settings for controlling server logs behavior",
147 )
148 services: ServerServicesSettings = Field( 1a
149 default_factory=ServerServicesSettings,
150 description="Settings for controlling server services behavior",
151 )
152 tasks: ServerTasksSettings = Field( 1a
153 default_factory=ServerTasksSettings,
154 description="Settings for controlling server tasks behavior",
155 )
156 ui: ServerUISettings = Field( 1a
157 default_factory=ServerUISettings,
158 description="Settings for controlling server UI behavior",
159 )