Coverage for /usr/local/lib/python3.12/site-packages/prefect/settings/models/server/events.py: 100%
21 statements
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 10:48 +0000
« prev ^ index » next coverage.py v7.10.6, created at 2025-12-05 10:48 +0000
1from datetime import timedelta 1a
2from typing import ClassVar 1a
4from pydantic import AliasChoices, AliasPath, Field 1a
5from pydantic_settings import SettingsConfigDict 1a
7from prefect.settings.base import PrefectBaseSettings, build_settings_config 1a
10class ServerEventsSettings(PrefectBaseSettings): 1a
11 """
12 Settings for controlling behavior of the events subsystem
13 """
15 model_config: ClassVar[SettingsConfigDict] = build_settings_config( 1a
16 ("server", "events")
17 )
19 ###########################################################################
20 # Events settings
22 stream_out_enabled: bool = Field( 1a
23 default=True,
24 description="Whether or not to stream events out to the API via websockets.",
25 validation_alias=AliasChoices(
26 AliasPath("stream_out_enabled"),
27 "prefect_server_events_stream_out_enabled",
28 "prefect_api_events_stream_out_enabled",
29 ),
30 )
32 related_resource_cache_ttl: timedelta = Field( 1a
33 default=timedelta(minutes=5),
34 description="The number of seconds to cache related resources for in the API.",
35 validation_alias=AliasChoices(
36 AliasPath("related_resource_cache_ttl"),
37 "prefect_server_events_related_resource_cache_ttl",
38 "prefect_api_events_related_resource_cache_ttl",
39 ),
40 )
42 maximum_labels_per_resource: int = Field( 1a
43 default=500,
44 description="The maximum number of labels a resource may have.",
45 validation_alias=AliasChoices(
46 AliasPath("maximum_labels_per_resource"),
47 "prefect_server_events_maximum_labels_per_resource",
48 "prefect_events_maximum_labels_per_resource",
49 ),
50 )
52 maximum_related_resources: int = Field( 1a
53 default=100,
54 description="The maximum number of related resources an Event may have.",
55 validation_alias=AliasChoices(
56 AliasPath("maximum_related_resources"),
57 "prefect_server_events_maximum_related_resources",
58 "prefect_events_maximum_related_resources",
59 ),
60 )
62 maximum_size_bytes: int = Field( 1a
63 default=1_500_000,
64 description="The maximum size of an Event when serialized to JSON",
65 validation_alias=AliasChoices(
66 AliasPath("maximum_size_bytes"),
67 "prefect_server_events_maximum_size_bytes",
68 "prefect_events_maximum_size_bytes",
69 ),
70 )
72 expired_bucket_buffer: timedelta = Field( 1a
73 default=timedelta(seconds=60),
74 description="The amount of time to retain expired automation buckets",
75 validation_alias=AliasChoices(
76 AliasPath("expired_bucket_buffer"),
77 "prefect_server_events_expired_bucket_buffer",
78 "prefect_events_expired_bucket_buffer",
79 ),
80 )
82 proactive_granularity: timedelta = Field( 1a
83 default=timedelta(seconds=5),
84 description="How frequently proactive automations are evaluated",
85 validation_alias=AliasChoices(
86 AliasPath("proactive_granularity"),
87 "prefect_server_events_proactive_granularity",
88 "prefect_events_proactive_granularity",
89 ),
90 )
92 retention_period: timedelta = Field( 1a
93 default=timedelta(days=7),
94 description="The amount of time to retain events in the database.",
95 validation_alias=AliasChoices(
96 AliasPath("retention_period"),
97 "prefect_server_events_retention_period",
98 "prefect_events_retention_period",
99 ),
100 )
102 maximum_websocket_backfill: timedelta = Field( 1a
103 default=timedelta(minutes=15),
104 description="The maximum range to look back for backfilling events for a websocket subscriber.",
105 validation_alias=AliasChoices(
106 AliasPath("maximum_websocket_backfill"),
107 "prefect_server_events_maximum_websocket_backfill",
108 "prefect_events_maximum_websocket_backfill",
109 ),
110 )
112 websocket_backfill_page_size: int = Field( 1a
113 default=250,
114 gt=0,
115 description="The page size for the queries to backfill events for websocket subscribers.",
116 validation_alias=AliasChoices(
117 AliasPath("websocket_backfill_page_size"),
118 "prefect_server_events_websocket_backfill_page_size",
119 "prefect_events_websocket_backfill_page_size",
120 ),
121 )
123 messaging_broker: str = Field( 1a
124 default="prefect.server.utilities.messaging.memory",
125 description="Which message broker implementation to use for the messaging system, should point to a module that exports a Publisher and Consumer class.",
126 validation_alias=AliasChoices(
127 AliasPath("messaging_broker"),
128 "prefect_server_events_messaging_broker",
129 "prefect_messaging_broker",
130 ),
131 )
133 messaging_cache: str = Field( 1a
134 default="prefect.server.utilities.messaging.memory",
135 description="Which cache implementation to use for the events system. Should point to a module that exports a Cache class.",
136 validation_alias=AliasChoices(
137 AliasPath("messaging_cache"),
138 "prefect_server_events_messaging_cache",
139 "prefect_messaging_cache",
140 ),
141 )
143 causal_ordering: str = Field( 1a
144 default="prefect.server.events.ordering.memory",
145 description="Which causal ordering implementation to use for the events system. Should point to a module that exports a CausalOrdering class.",
146 )
148 maximum_event_name_length: int = Field( 1a
149 default=1024,
150 gt=0,
151 description="The maximum length of an event name.",
152 validation_alias=AliasChoices(
153 AliasPath("maximum_event_name_length"),
154 "prefect_server_events_maximum_event_name_length",
155 ),
156 )