prefect-client 3.0.10__py3-none-any.whl → 3.0.11__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.
- prefect/__init__.py +17 -14
- prefect/_internal/schemas/bases.py +1 -0
- prefect/_internal/schemas/validators.py +5 -3
- prefect/_version.py +3 -3
- prefect/client/cloud.py +2 -2
- prefect/client/orchestration.py +4 -4
- prefect/client/schemas/filters.py +14 -0
- prefect/context.py +3 -2
- prefect/deployments/runner.py +15 -6
- prefect/events/schemas/automations.py +3 -3
- prefect/events/schemas/deployment_triggers.py +10 -5
- prefect/flow_engine.py +4 -4
- prefect/flows.py +24 -9
- prefect/futures.py +4 -4
- prefect/logging/handlers.py +1 -1
- prefect/logging/highlighters.py +2 -0
- prefect/logging/logging.yml +82 -83
- prefect/runner/runner.py +1 -2
- prefect/runner/server.py +12 -1
- prefect/settings/__init__.py +59 -0
- prefect/settings/base.py +131 -0
- prefect/settings/constants.py +8 -0
- prefect/settings/context.py +65 -0
- prefect/settings/legacy.py +167 -0
- prefect/settings/models/__init__.py +0 -0
- prefect/settings/models/api.py +41 -0
- prefect/settings/models/cli.py +31 -0
- prefect/settings/models/client.py +90 -0
- prefect/settings/models/cloud.py +58 -0
- prefect/settings/models/deployments.py +40 -0
- prefect/settings/models/flows.py +37 -0
- prefect/settings/models/internal.py +21 -0
- prefect/settings/models/logging.py +137 -0
- prefect/settings/models/results.py +47 -0
- prefect/settings/models/root.py +447 -0
- prefect/settings/models/runner.py +65 -0
- prefect/settings/models/server/__init__.py +1 -0
- prefect/settings/models/server/api.py +133 -0
- prefect/settings/models/server/database.py +202 -0
- prefect/settings/models/server/deployments.py +24 -0
- prefect/settings/models/server/ephemeral.py +34 -0
- prefect/settings/models/server/events.py +140 -0
- prefect/settings/models/server/flow_run_graph.py +34 -0
- prefect/settings/models/server/root.py +143 -0
- prefect/settings/models/server/services.py +485 -0
- prefect/settings/models/server/tasks.py +86 -0
- prefect/settings/models/server/ui.py +52 -0
- prefect/settings/models/tasks.py +91 -0
- prefect/settings/models/testing.py +52 -0
- prefect/settings/models/ui.py +0 -0
- prefect/settings/models/worker.py +46 -0
- prefect/settings/profiles.py +390 -0
- prefect/settings/sources.py +162 -0
- prefect/task_engine.py +24 -29
- prefect/task_runners.py +6 -1
- prefect/tasks.py +63 -28
- prefect/utilities/asyncutils.py +1 -1
- prefect/utilities/engine.py +11 -3
- prefect/utilities/services.py +3 -3
- prefect/workers/base.py +8 -2
- {prefect_client-3.0.10.dist-info → prefect_client-3.0.11.dist-info}/METADATA +2 -2
- {prefect_client-3.0.10.dist-info → prefect_client-3.0.11.dist-info}/RECORD +66 -33
- prefect/settings.py +0 -2172
- /prefect/{profiles.toml → settings/profiles.toml} +0 -0
- {prefect_client-3.0.10.dist-info → prefect_client-3.0.11.dist-info}/LICENSE +0 -0
- {prefect_client-3.0.10.dist-info → prefect_client-3.0.11.dist-info}/WHEEL +0 -0
- {prefect_client-3.0.10.dist-info → prefect_client-3.0.11.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,202 @@
|
|
1
|
+
import warnings
|
2
|
+
from typing import Optional
|
3
|
+
from urllib.parse import quote_plus
|
4
|
+
|
5
|
+
from pydantic import AliasChoices, AliasPath, Field, SecretStr, model_validator
|
6
|
+
from pydantic_settings import SettingsConfigDict
|
7
|
+
from typing_extensions import Literal, Self
|
8
|
+
|
9
|
+
from prefect.settings.base import PrefectBaseSettings
|
10
|
+
|
11
|
+
|
12
|
+
class ServerDatabaseSettings(PrefectBaseSettings):
|
13
|
+
"""
|
14
|
+
Settings for controlling server database behavior
|
15
|
+
"""
|
16
|
+
|
17
|
+
model_config = SettingsConfigDict(
|
18
|
+
env_prefix="PREFECT_SERVER_DATABASE_",
|
19
|
+
env_file=".env",
|
20
|
+
extra="ignore",
|
21
|
+
)
|
22
|
+
|
23
|
+
connection_url: Optional[SecretStr] = Field(
|
24
|
+
default=None,
|
25
|
+
description="""
|
26
|
+
A database connection URL in a SQLAlchemy-compatible
|
27
|
+
format. Prefect currently supports SQLite and Postgres. Note that all
|
28
|
+
Prefect database engines must use an async driver - for SQLite, use
|
29
|
+
`sqlite+aiosqlite` and for Postgres use `postgresql+asyncpg`.
|
30
|
+
|
31
|
+
SQLite in-memory databases can be used by providing the url
|
32
|
+
`sqlite+aiosqlite:///file::memory:?cache=shared&uri=true&check_same_thread=false`,
|
33
|
+
which will allow the database to be accessed by multiple threads. Note
|
34
|
+
that in-memory databases can not be accessed from multiple processes and
|
35
|
+
should only be used for simple tests.
|
36
|
+
""",
|
37
|
+
validation_alias=AliasChoices(
|
38
|
+
AliasPath("connection_url"),
|
39
|
+
"prefect_server_database_connection_url",
|
40
|
+
"prefect_api_database_connection_url",
|
41
|
+
),
|
42
|
+
)
|
43
|
+
|
44
|
+
driver: Optional[Literal["postgresql+asyncpg", "sqlite+aiosqlite"]] = Field(
|
45
|
+
default=None,
|
46
|
+
description=(
|
47
|
+
"The database driver to use when connecting to the database. "
|
48
|
+
"If not set, the driver will be inferred from the connection URL."
|
49
|
+
),
|
50
|
+
validation_alias=AliasChoices(
|
51
|
+
AliasPath("driver"),
|
52
|
+
"prefect_server_database_driver",
|
53
|
+
"prefect_api_database_driver",
|
54
|
+
),
|
55
|
+
)
|
56
|
+
|
57
|
+
host: Optional[str] = Field(
|
58
|
+
default=None,
|
59
|
+
description="The database server host.",
|
60
|
+
validation_alias=AliasChoices(
|
61
|
+
AliasPath("host"),
|
62
|
+
"prefect_server_database_host",
|
63
|
+
"prefect_api_database_host",
|
64
|
+
),
|
65
|
+
)
|
66
|
+
|
67
|
+
port: Optional[int] = Field(
|
68
|
+
default=None,
|
69
|
+
description="The database server port.",
|
70
|
+
validation_alias=AliasChoices(
|
71
|
+
AliasPath("port"),
|
72
|
+
"prefect_server_database_port",
|
73
|
+
"prefect_api_database_port",
|
74
|
+
),
|
75
|
+
)
|
76
|
+
|
77
|
+
user: Optional[str] = Field(
|
78
|
+
default=None,
|
79
|
+
description="The user to use when connecting to the database.",
|
80
|
+
validation_alias=AliasChoices(
|
81
|
+
AliasPath("user"),
|
82
|
+
"prefect_server_database_user",
|
83
|
+
"prefect_api_database_user",
|
84
|
+
),
|
85
|
+
)
|
86
|
+
|
87
|
+
name: Optional[str] = Field(
|
88
|
+
default=None,
|
89
|
+
description="The name of the Prefect database on the remote server, or the path to the database file for SQLite.",
|
90
|
+
validation_alias=AliasChoices(
|
91
|
+
AliasPath("name"),
|
92
|
+
"prefect_server_database_name",
|
93
|
+
"prefect_api_database_name",
|
94
|
+
),
|
95
|
+
)
|
96
|
+
|
97
|
+
password: Optional[SecretStr] = Field(
|
98
|
+
default=None,
|
99
|
+
description="The password to use when connecting to the database. Should be kept secret.",
|
100
|
+
validation_alias=AliasChoices(
|
101
|
+
AliasPath("password"),
|
102
|
+
"prefect_server_database_password",
|
103
|
+
"prefect_api_database_password",
|
104
|
+
),
|
105
|
+
)
|
106
|
+
|
107
|
+
echo: bool = Field(
|
108
|
+
default=False,
|
109
|
+
description="If `True`, SQLAlchemy will log all SQL issued to the database. Defaults to `False`.",
|
110
|
+
validation_alias=AliasChoices(
|
111
|
+
AliasPath("echo"),
|
112
|
+
"prefect_server_database_echo",
|
113
|
+
"prefect_api_database_echo",
|
114
|
+
),
|
115
|
+
)
|
116
|
+
|
117
|
+
migrate_on_start: bool = Field(
|
118
|
+
default=True,
|
119
|
+
description="If `True`, the database will be migrated on application startup.",
|
120
|
+
validation_alias=AliasChoices(
|
121
|
+
AliasPath("migrate_on_start"),
|
122
|
+
"prefect_server_database_migrate_on_start",
|
123
|
+
"prefect_api_database_migrate_on_start",
|
124
|
+
),
|
125
|
+
)
|
126
|
+
|
127
|
+
timeout: Optional[float] = Field(
|
128
|
+
default=10.0,
|
129
|
+
description="A statement timeout, in seconds, applied to all database interactions made by the API. Defaults to 10 seconds.",
|
130
|
+
validation_alias=AliasChoices(
|
131
|
+
AliasPath("timeout"),
|
132
|
+
"prefect_server_database_timeout",
|
133
|
+
"prefect_api_database_timeout",
|
134
|
+
),
|
135
|
+
)
|
136
|
+
|
137
|
+
connection_timeout: Optional[float] = Field(
|
138
|
+
default=5,
|
139
|
+
description="A connection timeout, in seconds, applied to database connections. Defaults to `5`.",
|
140
|
+
validation_alias=AliasChoices(
|
141
|
+
AliasPath("connection_timeout"),
|
142
|
+
"prefect_server_database_connection_timeout",
|
143
|
+
"prefect_api_database_connection_timeout",
|
144
|
+
),
|
145
|
+
)
|
146
|
+
|
147
|
+
sqlalchemy_pool_size: Optional[int] = Field(
|
148
|
+
default=None,
|
149
|
+
description="Controls connection pool size when using a PostgreSQL database with the Prefect API. If not set, the default SQLAlchemy pool size will be used.",
|
150
|
+
validation_alias=AliasChoices(
|
151
|
+
AliasPath("sqlalchemy_pool_size"),
|
152
|
+
"prefect_server_database_sqlalchemy_pool_size",
|
153
|
+
"prefect_sqlalchemy_pool_size",
|
154
|
+
),
|
155
|
+
)
|
156
|
+
|
157
|
+
sqlalchemy_max_overflow: Optional[int] = Field(
|
158
|
+
default=None,
|
159
|
+
description="Controls maximum overflow of the connection pool when using a PostgreSQL database with the Prefect API. If not set, the default SQLAlchemy maximum overflow value will be used.",
|
160
|
+
validation_alias=AliasChoices(
|
161
|
+
AliasPath("sqlalchemy_max_overflow"),
|
162
|
+
"prefect_server_database_sqlalchemy_max_overflow",
|
163
|
+
"prefect_sqlalchemy_max_overflow",
|
164
|
+
),
|
165
|
+
)
|
166
|
+
|
167
|
+
@model_validator(mode="after")
|
168
|
+
def emit_warnings(self) -> Self: # noqa: F821
|
169
|
+
"""More post-hoc validation of settings, including warnings for misconfigurations."""
|
170
|
+
warn_on_database_password_value_without_usage(self)
|
171
|
+
return self
|
172
|
+
|
173
|
+
|
174
|
+
def warn_on_database_password_value_without_usage(settings: ServerDatabaseSettings):
|
175
|
+
"""
|
176
|
+
Validator for settings warning if the database password is set but not used.
|
177
|
+
"""
|
178
|
+
db_password = (
|
179
|
+
settings.password.get_secret_value()
|
180
|
+
if isinstance(settings.password, SecretStr)
|
181
|
+
else None
|
182
|
+
)
|
183
|
+
api_db_connection_url = (
|
184
|
+
settings.connection_url.get_secret_value()
|
185
|
+
if isinstance(settings.connection_url, SecretStr)
|
186
|
+
else settings.connection_url
|
187
|
+
)
|
188
|
+
|
189
|
+
if (
|
190
|
+
db_password
|
191
|
+
and api_db_connection_url is not None
|
192
|
+
and "PREFECT_API_DATABASE_PASSWORD" not in api_db_connection_url
|
193
|
+
and "PREFECT_SERVER_DATABASE_PASSWORD" not in api_db_connection_url
|
194
|
+
and db_password not in api_db_connection_url
|
195
|
+
and quote_plus(db_password) not in api_db_connection_url
|
196
|
+
):
|
197
|
+
warnings.warn(
|
198
|
+
"PREFECT_SERVER_DATABASE_PASSWORD is set but not included in the "
|
199
|
+
"PREFECT_SERVER_DATABASE_CONNECTION_URL. "
|
200
|
+
"The provided password will be ignored."
|
201
|
+
)
|
202
|
+
return settings
|
@@ -0,0 +1,24 @@
|
|
1
|
+
from pydantic import AliasChoices, AliasPath, Field
|
2
|
+
from pydantic_settings import SettingsConfigDict
|
3
|
+
|
4
|
+
from prefect.settings.base import PrefectBaseSettings
|
5
|
+
|
6
|
+
|
7
|
+
class ServerDeploymentsSettings(PrefectBaseSettings):
|
8
|
+
model_config = SettingsConfigDict(
|
9
|
+
env_prefix="PREFECT_SERVER_DEPLOYMENTS_", env_file=".env", extra="ignore"
|
10
|
+
)
|
11
|
+
|
12
|
+
concurrency_slot_wait_seconds: float = Field(
|
13
|
+
default=30.0,
|
14
|
+
ge=0.0,
|
15
|
+
description=(
|
16
|
+
"The number of seconds to wait before retrying when a deployment flow run"
|
17
|
+
" cannot secure a concurrency slot from the server."
|
18
|
+
),
|
19
|
+
validation_alias=AliasChoices(
|
20
|
+
AliasPath("concurrency_slot_wait_seconds"),
|
21
|
+
"prefect_server_deployments_concurrency_slot_wait_seconds",
|
22
|
+
"prefect_deployment_concurrency_slot_wait_seconds",
|
23
|
+
),
|
24
|
+
)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
from pydantic import AliasChoices, AliasPath, Field
|
2
|
+
from pydantic_settings import SettingsConfigDict
|
3
|
+
|
4
|
+
from prefect.settings.base import PrefectBaseSettings
|
5
|
+
|
6
|
+
|
7
|
+
class ServerEphemeralSettings(PrefectBaseSettings):
|
8
|
+
"""
|
9
|
+
Settings for controlling ephemeral server behavior
|
10
|
+
"""
|
11
|
+
|
12
|
+
model_config = SettingsConfigDict(
|
13
|
+
env_prefix="PREFECT_SERVER_EPHEMERAL_", env_file=".env", extra="ignore"
|
14
|
+
)
|
15
|
+
|
16
|
+
enabled: bool = Field(
|
17
|
+
default=False,
|
18
|
+
description="""
|
19
|
+
Controls whether or not a subprocess server can be started when no API URL is provided.
|
20
|
+
""",
|
21
|
+
validation_alias=AliasChoices(
|
22
|
+
AliasPath("enabled"),
|
23
|
+
"prefect_server_ephemeral_enabled",
|
24
|
+
"prefect_server_allow_ephemeral_mode",
|
25
|
+
),
|
26
|
+
)
|
27
|
+
|
28
|
+
startup_timeout_seconds: int = Field(
|
29
|
+
default=20,
|
30
|
+
description="""
|
31
|
+
The number of seconds to wait for the server to start when ephemeral mode is enabled.
|
32
|
+
Defaults to `10`.
|
33
|
+
""",
|
34
|
+
)
|
@@ -0,0 +1,140 @@
|
|
1
|
+
from datetime import timedelta
|
2
|
+
|
3
|
+
from pydantic import AliasChoices, AliasPath, Field
|
4
|
+
from pydantic_settings import SettingsConfigDict
|
5
|
+
|
6
|
+
from prefect.settings.base import PrefectBaseSettings
|
7
|
+
|
8
|
+
|
9
|
+
class ServerEventsSettings(PrefectBaseSettings):
|
10
|
+
"""
|
11
|
+
Settings for controlling behavior of the events subsystem
|
12
|
+
"""
|
13
|
+
|
14
|
+
model_config = SettingsConfigDict(
|
15
|
+
env_prefix="PREFECT_SERVER_EVENTS_", env_file=".env", extra="ignore"
|
16
|
+
)
|
17
|
+
|
18
|
+
###########################################################################
|
19
|
+
# Events settings
|
20
|
+
|
21
|
+
stream_out_enabled: bool = Field(
|
22
|
+
default=True,
|
23
|
+
description="Whether or not to stream events out to the API via websockets.",
|
24
|
+
validation_alias=AliasChoices(
|
25
|
+
AliasPath("stream_out_enabled"),
|
26
|
+
"prefect_server_events_stream_out_enabled",
|
27
|
+
"prefect_api_events_stream_out_enabled",
|
28
|
+
),
|
29
|
+
)
|
30
|
+
|
31
|
+
related_resource_cache_ttl: timedelta = Field(
|
32
|
+
default=timedelta(minutes=5),
|
33
|
+
description="The number of seconds to cache related resources for in the API.",
|
34
|
+
validation_alias=AliasChoices(
|
35
|
+
AliasPath("related_resource_cache_ttl"),
|
36
|
+
"prefect_server_events_related_resource_cache_ttl",
|
37
|
+
"prefect_api_events_related_resource_cache_ttl",
|
38
|
+
),
|
39
|
+
)
|
40
|
+
|
41
|
+
maximum_labels_per_resource: int = Field(
|
42
|
+
default=500,
|
43
|
+
description="The maximum number of labels a resource may have.",
|
44
|
+
validation_alias=AliasChoices(
|
45
|
+
AliasPath("maximum_labels_per_resource"),
|
46
|
+
"prefect_server_events_maximum_labels_per_resource",
|
47
|
+
"prefect_events_maximum_labels_per_resource",
|
48
|
+
),
|
49
|
+
)
|
50
|
+
|
51
|
+
maximum_related_resources: int = Field(
|
52
|
+
default=500,
|
53
|
+
description="The maximum number of related resources an Event may have.",
|
54
|
+
validation_alias=AliasChoices(
|
55
|
+
AliasPath("maximum_related_resources"),
|
56
|
+
"prefect_server_events_maximum_related_resources",
|
57
|
+
"prefect_events_maximum_related_resources",
|
58
|
+
),
|
59
|
+
)
|
60
|
+
|
61
|
+
maximum_size_bytes: int = Field(
|
62
|
+
default=1_500_000,
|
63
|
+
description="The maximum size of an Event when serialized to JSON",
|
64
|
+
validation_alias=AliasChoices(
|
65
|
+
AliasPath("maximum_size_bytes"),
|
66
|
+
"prefect_server_events_maximum_size_bytes",
|
67
|
+
"prefect_events_maximum_size_bytes",
|
68
|
+
),
|
69
|
+
)
|
70
|
+
|
71
|
+
expired_bucket_buffer: timedelta = Field(
|
72
|
+
default=timedelta(seconds=60),
|
73
|
+
description="The amount of time to retain expired automation buckets",
|
74
|
+
validation_alias=AliasChoices(
|
75
|
+
AliasPath("expired_bucket_buffer"),
|
76
|
+
"prefect_server_events_expired_bucket_buffer",
|
77
|
+
"prefect_events_expired_bucket_buffer",
|
78
|
+
),
|
79
|
+
)
|
80
|
+
|
81
|
+
proactive_granularity: timedelta = Field(
|
82
|
+
default=timedelta(seconds=5),
|
83
|
+
description="How frequently proactive automations are evaluated",
|
84
|
+
validation_alias=AliasChoices(
|
85
|
+
AliasPath("proactive_granularity"),
|
86
|
+
"prefect_server_events_proactive_granularity",
|
87
|
+
"prefect_events_proactive_granularity",
|
88
|
+
),
|
89
|
+
)
|
90
|
+
|
91
|
+
retention_period: timedelta = Field(
|
92
|
+
default=timedelta(days=7),
|
93
|
+
description="The amount of time to retain events in the database.",
|
94
|
+
validation_alias=AliasChoices(
|
95
|
+
AliasPath("retention_period"),
|
96
|
+
"prefect_server_events_retention_period",
|
97
|
+
"prefect_events_retention_period",
|
98
|
+
),
|
99
|
+
)
|
100
|
+
|
101
|
+
maximum_websocket_backfill: timedelta = Field(
|
102
|
+
default=timedelta(minutes=15),
|
103
|
+
description="The maximum range to look back for backfilling events for a websocket subscriber.",
|
104
|
+
validation_alias=AliasChoices(
|
105
|
+
AliasPath("maximum_websocket_backfill"),
|
106
|
+
"prefect_server_events_maximum_websocket_backfill",
|
107
|
+
"prefect_events_maximum_websocket_backfill",
|
108
|
+
),
|
109
|
+
)
|
110
|
+
|
111
|
+
websocket_backfill_page_size: int = Field(
|
112
|
+
default=250,
|
113
|
+
gt=0,
|
114
|
+
description="The page size for the queries to backfill events for websocket subscribers.",
|
115
|
+
validation_alias=AliasChoices(
|
116
|
+
AliasPath("websocket_backfill_page_size"),
|
117
|
+
"prefect_server_events_websocket_backfill_page_size",
|
118
|
+
"prefect_events_websocket_backfill_page_size",
|
119
|
+
),
|
120
|
+
)
|
121
|
+
|
122
|
+
messaging_broker: str = Field(
|
123
|
+
default="prefect.server.utilities.messaging.memory",
|
124
|
+
description="Which message broker implementation to use for the messaging system, should point to a module that exports a Publisher and Consumer class.",
|
125
|
+
validation_alias=AliasChoices(
|
126
|
+
AliasPath("messaging_broker"),
|
127
|
+
"prefect_server_events_messaging_broker",
|
128
|
+
"prefect_messaging_broker",
|
129
|
+
),
|
130
|
+
)
|
131
|
+
|
132
|
+
messaging_cache: str = Field(
|
133
|
+
default="prefect.server.utilities.messaging.memory",
|
134
|
+
description="Which cache implementation to use for the events system. Should point to a module that exports a Cache class.",
|
135
|
+
validation_alias=AliasChoices(
|
136
|
+
AliasPath("messaging_cache"),
|
137
|
+
"prefect_server_events_messaging_cache",
|
138
|
+
"prefect_messaging_cache",
|
139
|
+
),
|
140
|
+
)
|
@@ -0,0 +1,34 @@
|
|
1
|
+
from pydantic import AliasChoices, AliasPath, Field
|
2
|
+
from pydantic_settings import SettingsConfigDict
|
3
|
+
|
4
|
+
from prefect.settings.base import PrefectBaseSettings
|
5
|
+
|
6
|
+
|
7
|
+
class ServerFlowRunGraphSettings(PrefectBaseSettings):
|
8
|
+
"""
|
9
|
+
Settings for controlling behavior of the flow run graph
|
10
|
+
"""
|
11
|
+
|
12
|
+
model_config = SettingsConfigDict(
|
13
|
+
env_prefix="PREFECT_SERVER_FLOW_RUN_GRAPH_", env_file=".env", extra="ignore"
|
14
|
+
)
|
15
|
+
|
16
|
+
max_nodes: int = Field(
|
17
|
+
default=10000,
|
18
|
+
description="The maximum size of a flow run graph on the v2 API",
|
19
|
+
validation_alias=AliasChoices(
|
20
|
+
AliasPath("max_nodes"),
|
21
|
+
"prefect_server_flow_run_graph_max_nodes",
|
22
|
+
"prefect_api_max_flow_run_graph_nodes",
|
23
|
+
),
|
24
|
+
)
|
25
|
+
|
26
|
+
max_artifacts: int = Field(
|
27
|
+
default=10000,
|
28
|
+
description="The maximum number of artifacts to show on a flow run graph on the v2 API",
|
29
|
+
validation_alias=AliasChoices(
|
30
|
+
AliasPath("max_artifacts"),
|
31
|
+
"prefect_server_flow_run_graph_max_artifacts",
|
32
|
+
"prefect_api_max_flow_run_graph_artifacts",
|
33
|
+
),
|
34
|
+
)
|
@@ -0,0 +1,143 @@
|
|
1
|
+
from pathlib import Path
|
2
|
+
from typing import Optional
|
3
|
+
|
4
|
+
from pydantic import AliasChoices, AliasPath, Field
|
5
|
+
from pydantic_settings import SettingsConfigDict
|
6
|
+
|
7
|
+
from prefect.settings.base import PrefectBaseSettings
|
8
|
+
from prefect.types import LogLevel
|
9
|
+
|
10
|
+
from .api import ServerAPISettings
|
11
|
+
from .database import ServerDatabaseSettings
|
12
|
+
from .deployments import ServerDeploymentsSettings
|
13
|
+
from .ephemeral import ServerEphemeralSettings
|
14
|
+
from .events import ServerEventsSettings
|
15
|
+
from .flow_run_graph import ServerFlowRunGraphSettings
|
16
|
+
from .services import ServerServicesSettings
|
17
|
+
from .tasks import ServerTasksSettings
|
18
|
+
from .ui import ServerUISettings
|
19
|
+
|
20
|
+
|
21
|
+
class ServerSettings(PrefectBaseSettings):
|
22
|
+
"""
|
23
|
+
Settings for controlling server behavior
|
24
|
+
"""
|
25
|
+
|
26
|
+
model_config = SettingsConfigDict(
|
27
|
+
env_prefix="PREFECT_SERVER_", env_file=".env", extra="ignore"
|
28
|
+
)
|
29
|
+
|
30
|
+
logging_level: LogLevel = Field(
|
31
|
+
default="WARNING",
|
32
|
+
description="The default logging level for the Prefect API server.",
|
33
|
+
validation_alias=AliasChoices(
|
34
|
+
AliasPath("logging_level"),
|
35
|
+
"prefect_server_logging_level",
|
36
|
+
"prefect_logging_server_level",
|
37
|
+
),
|
38
|
+
)
|
39
|
+
|
40
|
+
analytics_enabled: bool = Field(
|
41
|
+
default=True,
|
42
|
+
description="""
|
43
|
+
When enabled, Prefect sends anonymous data (e.g. count of flow runs, package version)
|
44
|
+
on server startup to help us improve our product.
|
45
|
+
""",
|
46
|
+
)
|
47
|
+
|
48
|
+
metrics_enabled: bool = Field(
|
49
|
+
default=False,
|
50
|
+
description="Whether or not to enable Prometheus metrics in the API.",
|
51
|
+
validation_alias=AliasChoices(
|
52
|
+
AliasPath("metrics_enabled"),
|
53
|
+
"prefect_server_metrics_enabled",
|
54
|
+
"prefect_api_enable_metrics",
|
55
|
+
),
|
56
|
+
)
|
57
|
+
|
58
|
+
log_retryable_errors: bool = Field(
|
59
|
+
default=False,
|
60
|
+
description="If `True`, log retryable errors in the API and it's services.",
|
61
|
+
validation_alias=AliasChoices(
|
62
|
+
AliasPath("log_retryable_errors"),
|
63
|
+
"prefect_server_log_retryable_errors",
|
64
|
+
"prefect_api_log_retryable_errors",
|
65
|
+
),
|
66
|
+
)
|
67
|
+
|
68
|
+
register_blocks_on_start: bool = Field(
|
69
|
+
default=True,
|
70
|
+
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.",
|
71
|
+
validation_alias=AliasChoices(
|
72
|
+
AliasPath("register_blocks_on_start"),
|
73
|
+
"prefect_server_register_blocks_on_start",
|
74
|
+
"prefect_api_blocks_register_on_start",
|
75
|
+
),
|
76
|
+
)
|
77
|
+
|
78
|
+
memoize_block_auto_registration: bool = Field(
|
79
|
+
default=True,
|
80
|
+
description="Controls whether or not block auto-registration on start",
|
81
|
+
validation_alias=AliasChoices(
|
82
|
+
AliasPath("memoize_block_auto_registration"),
|
83
|
+
"prefect_server_memoize_block_auto_registration",
|
84
|
+
"prefect_memoize_block_auto_registration",
|
85
|
+
),
|
86
|
+
)
|
87
|
+
|
88
|
+
memo_store_path: Optional[Path] = Field(
|
89
|
+
default=None,
|
90
|
+
description="The path to the memo store file.",
|
91
|
+
validation_alias=AliasChoices(
|
92
|
+
AliasPath("memo_store_path"),
|
93
|
+
"prefect_server_memo_store_path",
|
94
|
+
"prefect_memo_store_path",
|
95
|
+
),
|
96
|
+
)
|
97
|
+
|
98
|
+
deployment_schedule_max_scheduled_runs: int = Field(
|
99
|
+
default=50,
|
100
|
+
description="The maximum number of scheduled runs to create for a deployment.",
|
101
|
+
validation_alias=AliasChoices(
|
102
|
+
AliasPath("deployment_schedule_max_scheduled_runs"),
|
103
|
+
"prefect_server_deployment_schedule_max_scheduled_runs",
|
104
|
+
"prefect_deployment_schedule_max_scheduled_runs",
|
105
|
+
),
|
106
|
+
)
|
107
|
+
|
108
|
+
api: ServerAPISettings = Field(
|
109
|
+
default_factory=ServerAPISettings,
|
110
|
+
description="Settings for controlling API server behavior",
|
111
|
+
)
|
112
|
+
database: ServerDatabaseSettings = Field(
|
113
|
+
default_factory=ServerDatabaseSettings,
|
114
|
+
description="Settings for controlling server database behavior",
|
115
|
+
)
|
116
|
+
deployments: ServerDeploymentsSettings = Field(
|
117
|
+
default_factory=ServerDeploymentsSettings,
|
118
|
+
description="Settings for controlling server deployments behavior",
|
119
|
+
)
|
120
|
+
ephemeral: ServerEphemeralSettings = Field(
|
121
|
+
default_factory=ServerEphemeralSettings,
|
122
|
+
description="Settings for controlling ephemeral server behavior",
|
123
|
+
)
|
124
|
+
events: ServerEventsSettings = Field(
|
125
|
+
default_factory=ServerEventsSettings,
|
126
|
+
description="Settings for controlling server events behavior",
|
127
|
+
)
|
128
|
+
flow_run_graph: ServerFlowRunGraphSettings = Field(
|
129
|
+
default_factory=ServerFlowRunGraphSettings,
|
130
|
+
description="Settings for controlling flow run graph behavior",
|
131
|
+
)
|
132
|
+
services: ServerServicesSettings = Field(
|
133
|
+
default_factory=ServerServicesSettings,
|
134
|
+
description="Settings for controlling server services behavior",
|
135
|
+
)
|
136
|
+
tasks: ServerTasksSettings = Field(
|
137
|
+
default_factory=ServerTasksSettings,
|
138
|
+
description="Settings for controlling server tasks behavior",
|
139
|
+
)
|
140
|
+
ui: ServerUISettings = Field(
|
141
|
+
default_factory=ServerUISettings,
|
142
|
+
description="Settings for controlling server UI behavior",
|
143
|
+
)
|