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,485 @@
|
|
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 ServerServicesCancellationCleanupSettings(PrefectBaseSettings):
|
10
|
+
"""
|
11
|
+
Settings for controlling the cancellation cleanup service
|
12
|
+
"""
|
13
|
+
|
14
|
+
model_config = SettingsConfigDict(
|
15
|
+
env_prefix="PREFECT_SERVER_SERVICES_CANCELLATION_CLEANUP_",
|
16
|
+
env_file=".env",
|
17
|
+
extra="ignore",
|
18
|
+
)
|
19
|
+
|
20
|
+
enabled: bool = Field(
|
21
|
+
default=True,
|
22
|
+
description="Whether or not to start the cancellation cleanup service in the server application.",
|
23
|
+
validation_alias=AliasChoices(
|
24
|
+
AliasPath("enabled"),
|
25
|
+
"prefect_server_services_cancellation_cleanup_enabled",
|
26
|
+
"prefect_api_services_cancellation_cleanup_enabled",
|
27
|
+
),
|
28
|
+
)
|
29
|
+
|
30
|
+
loop_seconds: float = Field(
|
31
|
+
default=20,
|
32
|
+
description="The cancellation cleanup service will look for non-terminal tasks and subflows this often. Defaults to `20`.",
|
33
|
+
validation_alias=AliasChoices(
|
34
|
+
AliasPath("loop_seconds"),
|
35
|
+
"prefect_server_services_cancellation_cleanup_loop_seconds",
|
36
|
+
"prefect_api_services_cancellation_cleanup_loop_seconds",
|
37
|
+
),
|
38
|
+
)
|
39
|
+
|
40
|
+
|
41
|
+
class ServerServicesEventPersisterSettings(PrefectBaseSettings):
|
42
|
+
"""
|
43
|
+
Settings for controlling the event persister service
|
44
|
+
"""
|
45
|
+
|
46
|
+
model_config = SettingsConfigDict(
|
47
|
+
env_prefix="PREFECT_SERVER_SERVICES_EVENT_PERSISTER_",
|
48
|
+
env_file=".env",
|
49
|
+
extra="ignore",
|
50
|
+
)
|
51
|
+
|
52
|
+
enabled: bool = Field(
|
53
|
+
default=True,
|
54
|
+
description="Whether or not to start the event persister service in the server application.",
|
55
|
+
validation_alias=AliasChoices(
|
56
|
+
AliasPath("enabled"),
|
57
|
+
"prefect_server_services_event_persister_enabled",
|
58
|
+
"prefect_api_services_event_persister_enabled",
|
59
|
+
),
|
60
|
+
)
|
61
|
+
|
62
|
+
batch_size: int = Field(
|
63
|
+
default=20,
|
64
|
+
gt=0,
|
65
|
+
description="The number of events the event persister will attempt to insert in one batch.",
|
66
|
+
validation_alias=AliasChoices(
|
67
|
+
AliasPath("batch_size"),
|
68
|
+
"prefect_server_services_event_persister_batch_size",
|
69
|
+
"prefect_api_services_event_persister_batch_size",
|
70
|
+
),
|
71
|
+
)
|
72
|
+
|
73
|
+
flush_interval: float = Field(
|
74
|
+
default=5,
|
75
|
+
gt=0.0,
|
76
|
+
description="The maximum number of seconds between flushes of the event persister.",
|
77
|
+
validation_alias=AliasChoices(
|
78
|
+
AliasPath("flush_interval"),
|
79
|
+
"prefect_server_services_event_persister_flush_interval",
|
80
|
+
"prefect_api_services_event_persister_flush_interval",
|
81
|
+
),
|
82
|
+
)
|
83
|
+
|
84
|
+
|
85
|
+
class ServerServicesFlowRunNotificationsSettings(PrefectBaseSettings):
|
86
|
+
"""
|
87
|
+
Settings for controlling the flow run notifications service
|
88
|
+
"""
|
89
|
+
|
90
|
+
model_config = SettingsConfigDict(
|
91
|
+
env_prefix="PREFECT_SERVER_SERVICES_FLOW_RUN_NOTIFICATIONS_",
|
92
|
+
env_file=".env",
|
93
|
+
extra="ignore",
|
94
|
+
)
|
95
|
+
|
96
|
+
enabled: bool = Field(
|
97
|
+
default=True,
|
98
|
+
description="Whether or not to start the flow run notifications service in the server application.",
|
99
|
+
validation_alias=AliasChoices(
|
100
|
+
AliasPath("enabled"),
|
101
|
+
"prefect_server_services_flow_run_notifications_enabled",
|
102
|
+
"prefect_api_services_flow_run_notifications_enabled",
|
103
|
+
),
|
104
|
+
)
|
105
|
+
|
106
|
+
|
107
|
+
class ServerServicesForemanSettings(PrefectBaseSettings):
|
108
|
+
"""
|
109
|
+
Settings for controlling the foreman service
|
110
|
+
"""
|
111
|
+
|
112
|
+
model_config = SettingsConfigDict(
|
113
|
+
env_prefix="PREFECT_SERVER_SERVICES_FOREMAN_",
|
114
|
+
env_file=".env",
|
115
|
+
extra="ignore",
|
116
|
+
)
|
117
|
+
|
118
|
+
enabled: bool = Field(
|
119
|
+
default=True,
|
120
|
+
description="Whether or not to start the foreman service in the server application.",
|
121
|
+
validation_alias=AliasChoices(
|
122
|
+
AliasPath("enabled"),
|
123
|
+
"prefect_server_services_foreman_enabled",
|
124
|
+
"prefect_api_services_foreman_enabled",
|
125
|
+
),
|
126
|
+
)
|
127
|
+
|
128
|
+
loop_seconds: float = Field(
|
129
|
+
default=15,
|
130
|
+
description="The foreman service will check for offline workers this often. Defaults to `15`.",
|
131
|
+
validation_alias=AliasChoices(
|
132
|
+
AliasPath("loop_seconds"),
|
133
|
+
"prefect_server_services_foreman_loop_seconds",
|
134
|
+
"prefect_api_services_foreman_loop_seconds",
|
135
|
+
),
|
136
|
+
)
|
137
|
+
|
138
|
+
inactivity_heartbeat_multiple: int = Field(
|
139
|
+
default=3,
|
140
|
+
description="""
|
141
|
+
The number of heartbeats that must be missed before a worker is marked as offline. Defaults to `3`.
|
142
|
+
""",
|
143
|
+
validation_alias=AliasChoices(
|
144
|
+
AliasPath("inactivity_heartbeat_multiple"),
|
145
|
+
"prefect_server_services_foreman_inactivity_heartbeat_multiple",
|
146
|
+
"prefect_api_services_foreman_inactivity_heartbeat_multiple",
|
147
|
+
),
|
148
|
+
)
|
149
|
+
|
150
|
+
fallback_heartbeat_interval_seconds: int = Field(
|
151
|
+
default=30,
|
152
|
+
description="""
|
153
|
+
The number of seconds to use for online/offline evaluation if a worker's heartbeat
|
154
|
+
interval is not set. Defaults to `30`.
|
155
|
+
""",
|
156
|
+
validation_alias=AliasChoices(
|
157
|
+
AliasPath("fallback_heartbeat_interval_seconds"),
|
158
|
+
"prefect_server_services_foreman_fallback_heartbeat_interval_seconds",
|
159
|
+
"prefect_api_services_foreman_fallback_heartbeat_interval_seconds",
|
160
|
+
),
|
161
|
+
)
|
162
|
+
|
163
|
+
deployment_last_polled_timeout_seconds: int = Field(
|
164
|
+
default=60,
|
165
|
+
description="""
|
166
|
+
The number of seconds before a deployment is marked as not ready if it has not been
|
167
|
+
polled. Defaults to `60`.
|
168
|
+
""",
|
169
|
+
validation_alias=AliasChoices(
|
170
|
+
AliasPath("deployment_last_polled_timeout_seconds"),
|
171
|
+
"prefect_server_services_foreman_deployment_last_polled_timeout_seconds",
|
172
|
+
"prefect_api_services_foreman_deployment_last_polled_timeout_seconds",
|
173
|
+
),
|
174
|
+
)
|
175
|
+
|
176
|
+
work_queue_last_polled_timeout_seconds: int = Field(
|
177
|
+
default=60,
|
178
|
+
description="""
|
179
|
+
The number of seconds before a work queue is marked as not ready if it has not been
|
180
|
+
polled. Defaults to `60`.
|
181
|
+
""",
|
182
|
+
validation_alias=AliasChoices(
|
183
|
+
AliasPath("work_queue_last_polled_timeout_seconds"),
|
184
|
+
"prefect_server_services_foreman_work_queue_last_polled_timeout_seconds",
|
185
|
+
"prefect_api_services_foreman_work_queue_last_polled_timeout_seconds",
|
186
|
+
),
|
187
|
+
)
|
188
|
+
|
189
|
+
|
190
|
+
class ServerServicesLateRunsSettings(PrefectBaseSettings):
|
191
|
+
"""
|
192
|
+
Settings for controlling the late runs service
|
193
|
+
"""
|
194
|
+
|
195
|
+
model_config = SettingsConfigDict(
|
196
|
+
env_prefix="PREFECT_SERVER_SERVICES_LATE_RUNS_", env_file=".env", extra="ignore"
|
197
|
+
)
|
198
|
+
|
199
|
+
enabled: bool = Field(
|
200
|
+
default=True,
|
201
|
+
description="Whether or not to start the late runs service in the server application.",
|
202
|
+
validation_alias=AliasChoices(
|
203
|
+
AliasPath("enabled"),
|
204
|
+
"prefect_server_services_late_runs_enabled",
|
205
|
+
"prefect_api_services_late_runs_enabled",
|
206
|
+
),
|
207
|
+
)
|
208
|
+
|
209
|
+
loop_seconds: float = Field(
|
210
|
+
default=5,
|
211
|
+
description="""
|
212
|
+
The late runs service will look for runs to mark as late this often. Defaults to `5`.
|
213
|
+
""",
|
214
|
+
validation_alias=AliasChoices(
|
215
|
+
AliasPath("loop_seconds"),
|
216
|
+
"prefect_server_services_late_runs_loop_seconds",
|
217
|
+
"prefect_api_services_late_runs_loop_seconds",
|
218
|
+
),
|
219
|
+
)
|
220
|
+
|
221
|
+
after_seconds: timedelta = Field(
|
222
|
+
default=timedelta(seconds=15),
|
223
|
+
description="""
|
224
|
+
The late runs service will mark runs as late after they have exceeded their scheduled start time by this many seconds. Defaults to `5` seconds.
|
225
|
+
""",
|
226
|
+
validation_alias=AliasChoices(
|
227
|
+
AliasPath("after_seconds"),
|
228
|
+
"prefect_server_services_late_runs_after_seconds",
|
229
|
+
"prefect_api_services_late_runs_after_seconds",
|
230
|
+
),
|
231
|
+
)
|
232
|
+
|
233
|
+
|
234
|
+
class ServerServicesSchedulerSettings(PrefectBaseSettings):
|
235
|
+
"""
|
236
|
+
Settings for controlling the scheduler service
|
237
|
+
"""
|
238
|
+
|
239
|
+
model_config = SettingsConfigDict(
|
240
|
+
env_prefix="PREFECT_SERVER_SERVICES_SCHEDULER_", env_file=".env", extra="ignore"
|
241
|
+
)
|
242
|
+
|
243
|
+
enabled: bool = Field(
|
244
|
+
default=True,
|
245
|
+
description="Whether or not to start the scheduler service in the server application.",
|
246
|
+
validation_alias=AliasChoices(
|
247
|
+
AliasPath("enabled"),
|
248
|
+
"prefect_server_services_scheduler_enabled",
|
249
|
+
"prefect_api_services_scheduler_enabled",
|
250
|
+
),
|
251
|
+
)
|
252
|
+
|
253
|
+
loop_seconds: float = Field(
|
254
|
+
default=60,
|
255
|
+
description="""
|
256
|
+
The scheduler loop interval, in seconds. This determines
|
257
|
+
how often the scheduler will attempt to schedule new flow runs, but has no
|
258
|
+
impact on how quickly either flow runs or task runs are actually executed.
|
259
|
+
Defaults to `60`.
|
260
|
+
""",
|
261
|
+
validation_alias=AliasChoices(
|
262
|
+
AliasPath("loop_seconds"),
|
263
|
+
"prefect_server_services_scheduler_loop_seconds",
|
264
|
+
"prefect_api_services_scheduler_loop_seconds",
|
265
|
+
),
|
266
|
+
)
|
267
|
+
|
268
|
+
deployment_batch_size: int = Field(
|
269
|
+
default=100,
|
270
|
+
description="""
|
271
|
+
The number of deployments the scheduler will attempt to
|
272
|
+
schedule in a single batch. If there are more deployments than the batch
|
273
|
+
size, the scheduler immediately attempts to schedule the next batch; it
|
274
|
+
does not sleep for `scheduler_loop_seconds` until it has visited every
|
275
|
+
deployment once. Defaults to `100`.
|
276
|
+
""",
|
277
|
+
validation_alias=AliasChoices(
|
278
|
+
AliasPath("deployment_batch_size"),
|
279
|
+
"prefect_server_services_scheduler_deployment_batch_size",
|
280
|
+
"prefect_api_services_scheduler_deployment_batch_size",
|
281
|
+
),
|
282
|
+
)
|
283
|
+
|
284
|
+
max_runs: int = Field(
|
285
|
+
default=100,
|
286
|
+
description="""
|
287
|
+
The scheduler will attempt to schedule up to this many
|
288
|
+
auto-scheduled runs in the future. Note that runs may have fewer than
|
289
|
+
this many scheduled runs, depending on the value of
|
290
|
+
`scheduler_max_scheduled_time`. Defaults to `100`.
|
291
|
+
""",
|
292
|
+
validation_alias=AliasChoices(
|
293
|
+
AliasPath("max_runs"),
|
294
|
+
"prefect_server_services_scheduler_max_runs",
|
295
|
+
"prefect_api_services_scheduler_max_runs",
|
296
|
+
),
|
297
|
+
)
|
298
|
+
|
299
|
+
min_runs: int = Field(
|
300
|
+
default=3,
|
301
|
+
description="""
|
302
|
+
The scheduler will attempt to schedule at least this many
|
303
|
+
auto-scheduled runs in the future. Note that runs may have more than
|
304
|
+
this many scheduled runs, depending on the value of
|
305
|
+
`scheduler_min_scheduled_time`. Defaults to `3`.
|
306
|
+
""",
|
307
|
+
validation_alias=AliasChoices(
|
308
|
+
AliasPath("min_runs"),
|
309
|
+
"prefect_server_services_scheduler_min_runs",
|
310
|
+
"prefect_api_services_scheduler_min_runs",
|
311
|
+
),
|
312
|
+
)
|
313
|
+
|
314
|
+
max_scheduled_time: timedelta = Field(
|
315
|
+
default=timedelta(days=100),
|
316
|
+
description="""
|
317
|
+
The scheduler will create new runs up to this far in the
|
318
|
+
future. Note that this setting will take precedence over
|
319
|
+
`scheduler_max_runs`: if a flow runs once a month and
|
320
|
+
`scheduler_max_scheduled_time` is three months, then only three runs will be
|
321
|
+
scheduled. Defaults to 100 days (`8640000` seconds).
|
322
|
+
""",
|
323
|
+
validation_alias=AliasChoices(
|
324
|
+
AliasPath("max_scheduled_time"),
|
325
|
+
"prefect_server_services_scheduler_max_scheduled_time",
|
326
|
+
"prefect_api_services_scheduler_max_scheduled_time",
|
327
|
+
),
|
328
|
+
)
|
329
|
+
|
330
|
+
min_scheduled_time: timedelta = Field(
|
331
|
+
default=timedelta(hours=1),
|
332
|
+
description="""
|
333
|
+
The scheduler will create new runs at least this far in the
|
334
|
+
future. Note that this setting will take precedence over `scheduler_min_runs`:
|
335
|
+
if a flow runs every hour and `scheduler_min_scheduled_time` is three hours,
|
336
|
+
then three runs will be scheduled even if `scheduler_min_runs` is 1. Defaults to
|
337
|
+
""",
|
338
|
+
validation_alias=AliasChoices(
|
339
|
+
AliasPath("min_scheduled_time"),
|
340
|
+
"prefect_server_services_scheduler_min_scheduled_time",
|
341
|
+
"prefect_api_services_scheduler_min_scheduled_time",
|
342
|
+
),
|
343
|
+
)
|
344
|
+
|
345
|
+
insert_batch_size: int = Field(
|
346
|
+
default=500,
|
347
|
+
description="""
|
348
|
+
The number of runs the scheduler will attempt to insert in a single batch.
|
349
|
+
Defaults to `500`.
|
350
|
+
""",
|
351
|
+
validation_alias=AliasChoices(
|
352
|
+
AliasPath("insert_batch_size"),
|
353
|
+
"prefect_server_services_scheduler_insert_batch_size",
|
354
|
+
"prefect_api_services_scheduler_insert_batch_size",
|
355
|
+
),
|
356
|
+
)
|
357
|
+
|
358
|
+
|
359
|
+
class ServerServicesPauseExpirationsSettings(PrefectBaseSettings):
|
360
|
+
"""
|
361
|
+
Settings for controlling the pause expiration service
|
362
|
+
"""
|
363
|
+
|
364
|
+
model_config = SettingsConfigDict(
|
365
|
+
env_prefix="PREFECT_SERVER_SERVICES_PAUSE_EXPIRATIONS_",
|
366
|
+
env_file=".env",
|
367
|
+
extra="ignore",
|
368
|
+
)
|
369
|
+
|
370
|
+
enabled: bool = Field(
|
371
|
+
default=True,
|
372
|
+
description="""
|
373
|
+
Whether or not to start the paused flow run expiration service in the server
|
374
|
+
application. If disabled, paused flows that have timed out will remain in a Paused state
|
375
|
+
until a resume attempt.
|
376
|
+
""",
|
377
|
+
validation_alias=AliasChoices(
|
378
|
+
AliasPath("enabled"),
|
379
|
+
"prefect_server_services_pause_expirations_enabled",
|
380
|
+
"prefect_api_services_pause_expirations_enabled",
|
381
|
+
),
|
382
|
+
)
|
383
|
+
|
384
|
+
loop_seconds: float = Field(
|
385
|
+
default=5,
|
386
|
+
description="""
|
387
|
+
The pause expiration service will look for runs to mark as failed this often. Defaults to `5`.
|
388
|
+
""",
|
389
|
+
validation_alias=AliasChoices(
|
390
|
+
AliasPath("loop_seconds"),
|
391
|
+
"prefect_server_services_pause_expirations_loop_seconds",
|
392
|
+
"prefect_api_services_pause_expirations_loop_seconds",
|
393
|
+
),
|
394
|
+
)
|
395
|
+
|
396
|
+
|
397
|
+
class ServerServicesTaskRunRecorderSettings(PrefectBaseSettings):
|
398
|
+
"""
|
399
|
+
Settings for controlling the task run recorder service
|
400
|
+
"""
|
401
|
+
|
402
|
+
model_config = SettingsConfigDict(
|
403
|
+
env_prefix="PREFECT_SERVER_SERVICES_TASK_RUN_RECORDER_",
|
404
|
+
env_file=".env",
|
405
|
+
extra="ignore",
|
406
|
+
)
|
407
|
+
|
408
|
+
enabled: bool = Field(
|
409
|
+
default=True,
|
410
|
+
description="Whether or not to start the task run recorder service in the server application.",
|
411
|
+
validation_alias=AliasChoices(
|
412
|
+
AliasPath("enabled"),
|
413
|
+
"prefect_server_services_task_run_recorder_enabled",
|
414
|
+
"prefect_api_services_task_run_recorder_enabled",
|
415
|
+
),
|
416
|
+
)
|
417
|
+
|
418
|
+
|
419
|
+
class ServerServicesTriggersSettings(PrefectBaseSettings):
|
420
|
+
"""
|
421
|
+
Settings for controlling the triggers service
|
422
|
+
"""
|
423
|
+
|
424
|
+
model_config = SettingsConfigDict(
|
425
|
+
env_prefix="PREFECT_SERVER_SERVICES_TRIGGERS_",
|
426
|
+
env_file=".env",
|
427
|
+
extra="ignore",
|
428
|
+
)
|
429
|
+
|
430
|
+
enabled: bool = Field(
|
431
|
+
default=True,
|
432
|
+
description="Whether or not to start the triggers service in the server application.",
|
433
|
+
validation_alias=AliasChoices(
|
434
|
+
AliasPath("enabled"),
|
435
|
+
"prefect_server_services_triggers_enabled",
|
436
|
+
"prefect_api_services_triggers_enabled",
|
437
|
+
),
|
438
|
+
)
|
439
|
+
|
440
|
+
|
441
|
+
class ServerServicesSettings(PrefectBaseSettings):
|
442
|
+
"""
|
443
|
+
Settings for controlling server services
|
444
|
+
"""
|
445
|
+
|
446
|
+
model_config = SettingsConfigDict(
|
447
|
+
env_prefix="PREFECT_SERVER_SERVICES_", env_file=".env", extra="ignore"
|
448
|
+
)
|
449
|
+
|
450
|
+
cancellation_cleanup: ServerServicesCancellationCleanupSettings = Field(
|
451
|
+
default_factory=ServerServicesCancellationCleanupSettings,
|
452
|
+
description="Settings for controlling the cancellation cleanup service",
|
453
|
+
)
|
454
|
+
event_persister: ServerServicesEventPersisterSettings = Field(
|
455
|
+
default_factory=ServerServicesEventPersisterSettings,
|
456
|
+
description="Settings for controlling the event persister service",
|
457
|
+
)
|
458
|
+
flow_run_notifications: ServerServicesFlowRunNotificationsSettings = Field(
|
459
|
+
default_factory=ServerServicesFlowRunNotificationsSettings,
|
460
|
+
description="Settings for controlling the flow run notifications service",
|
461
|
+
)
|
462
|
+
foreman: ServerServicesForemanSettings = Field(
|
463
|
+
default_factory=ServerServicesForemanSettings,
|
464
|
+
description="Settings for controlling the foreman service",
|
465
|
+
)
|
466
|
+
late_runs: ServerServicesLateRunsSettings = Field(
|
467
|
+
default_factory=ServerServicesLateRunsSettings,
|
468
|
+
description="Settings for controlling the late runs service",
|
469
|
+
)
|
470
|
+
scheduler: ServerServicesSchedulerSettings = Field(
|
471
|
+
default_factory=ServerServicesSchedulerSettings,
|
472
|
+
description="Settings for controlling the scheduler service",
|
473
|
+
)
|
474
|
+
pause_expirations: ServerServicesPauseExpirationsSettings = Field(
|
475
|
+
default_factory=ServerServicesPauseExpirationsSettings,
|
476
|
+
description="Settings for controlling the pause expiration service",
|
477
|
+
)
|
478
|
+
task_run_recorder: ServerServicesTaskRunRecorderSettings = Field(
|
479
|
+
default_factory=ServerServicesTaskRunRecorderSettings,
|
480
|
+
description="Settings for controlling the task run recorder service",
|
481
|
+
)
|
482
|
+
triggers: ServerServicesTriggersSettings = Field(
|
483
|
+
default_factory=ServerServicesTriggersSettings,
|
484
|
+
description="Settings for controlling the triggers service",
|
485
|
+
)
|
@@ -0,0 +1,86 @@
|
|
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 ServerTasksSchedulingSettings(PrefectBaseSettings):
|
10
|
+
"""
|
11
|
+
Settings for controlling server-side behavior related to task scheduling
|
12
|
+
"""
|
13
|
+
|
14
|
+
model_config = SettingsConfigDict(
|
15
|
+
env_file=".env",
|
16
|
+
env_prefix="PREFECT_SERVER_TASKS_SCHEDULING_",
|
17
|
+
extra="ignore",
|
18
|
+
)
|
19
|
+
|
20
|
+
max_scheduled_queue_size: int = Field(
|
21
|
+
default=1000,
|
22
|
+
description="The maximum number of scheduled tasks to queue for submission.",
|
23
|
+
validation_alias=AliasChoices(
|
24
|
+
AliasPath("max_scheduled_queue_size"),
|
25
|
+
"prefect_server_tasks_scheduling_max_scheduled_queue_size",
|
26
|
+
"prefect_task_scheduling_max_scheduled_queue_size",
|
27
|
+
),
|
28
|
+
)
|
29
|
+
|
30
|
+
max_retry_queue_size: int = Field(
|
31
|
+
default=100,
|
32
|
+
description="The maximum number of retries to queue for submission.",
|
33
|
+
validation_alias=AliasChoices(
|
34
|
+
AliasPath("max_retry_queue_size"),
|
35
|
+
"prefect_server_tasks_scheduling_max_retry_queue_size",
|
36
|
+
"prefect_task_scheduling_max_retry_queue_size",
|
37
|
+
),
|
38
|
+
)
|
39
|
+
|
40
|
+
pending_task_timeout: timedelta = Field(
|
41
|
+
default=timedelta(0),
|
42
|
+
description="How long before a PENDING task are made available to another task worker.",
|
43
|
+
validation_alias=AliasChoices(
|
44
|
+
AliasPath("pending_task_timeout"),
|
45
|
+
"prefect_server_tasks_scheduling_pending_task_timeout",
|
46
|
+
"prefect_task_scheduling_pending_task_timeout",
|
47
|
+
),
|
48
|
+
)
|
49
|
+
|
50
|
+
|
51
|
+
class ServerTasksSettings(PrefectBaseSettings):
|
52
|
+
"""
|
53
|
+
Settings for controlling server-side behavior related to tasks
|
54
|
+
"""
|
55
|
+
|
56
|
+
model_config = SettingsConfigDict(
|
57
|
+
env_file=".env",
|
58
|
+
env_prefix="PREFECT_SERVER_TASKS_",
|
59
|
+
extra="ignore",
|
60
|
+
)
|
61
|
+
|
62
|
+
tag_concurrency_slot_wait_seconds: float = Field(
|
63
|
+
default=30,
|
64
|
+
ge=0,
|
65
|
+
description="The number of seconds to wait before retrying when a task run cannot secure a concurrency slot from the server.",
|
66
|
+
validation_alias=AliasChoices(
|
67
|
+
AliasPath("tag_concurrency_slot_wait_seconds"),
|
68
|
+
"prefect_server_tasks_tag_concurrency_slot_wait_seconds",
|
69
|
+
"prefect_task_run_tag_concurrency_slot_wait_seconds",
|
70
|
+
),
|
71
|
+
)
|
72
|
+
|
73
|
+
max_cache_key_length: int = Field(
|
74
|
+
default=2000,
|
75
|
+
description="The maximum number of characters allowed for a task run cache key.",
|
76
|
+
validation_alias=AliasChoices(
|
77
|
+
AliasPath("max_cache_key_length"),
|
78
|
+
"prefect_server_tasks_max_cache_key_length",
|
79
|
+
"prefect_api_task_cache_key_max_length",
|
80
|
+
),
|
81
|
+
)
|
82
|
+
|
83
|
+
scheduling: ServerTasksSchedulingSettings = Field(
|
84
|
+
default_factory=ServerTasksSchedulingSettings,
|
85
|
+
description="Settings for controlling server-side behavior related to task scheduling",
|
86
|
+
)
|
@@ -0,0 +1,52 @@
|
|
1
|
+
from typing import Optional
|
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 ServerUISettings(PrefectBaseSettings):
|
10
|
+
model_config = SettingsConfigDict(
|
11
|
+
env_prefix="PREFECT_SERVER_UI_", env_file=".env", extra="ignore"
|
12
|
+
)
|
13
|
+
|
14
|
+
enabled: bool = Field(
|
15
|
+
default=True,
|
16
|
+
description="Whether or not to serve the Prefect UI.",
|
17
|
+
validation_alias=AliasChoices(
|
18
|
+
AliasPath("enabled"),
|
19
|
+
"prefect_server_ui_enabled",
|
20
|
+
"prefect_ui_enabled",
|
21
|
+
),
|
22
|
+
)
|
23
|
+
|
24
|
+
api_url: Optional[str] = Field(
|
25
|
+
default=None,
|
26
|
+
description="The connection url for communication from the UI to the API. Defaults to `PREFECT_API_URL` if set. Otherwise, the default URL is generated from `PREFECT_SERVER_API_HOST` and `PREFECT_SERVER_API_PORT`.",
|
27
|
+
validation_alias=AliasChoices(
|
28
|
+
AliasPath("api_url"),
|
29
|
+
"prefect_server_ui_api_url",
|
30
|
+
"prefect_ui_api_url",
|
31
|
+
),
|
32
|
+
)
|
33
|
+
|
34
|
+
serve_base: str = Field(
|
35
|
+
default="/",
|
36
|
+
description="The base URL path to serve the Prefect UI from.",
|
37
|
+
validation_alias=AliasChoices(
|
38
|
+
AliasPath("serve_base"),
|
39
|
+
"prefect_server_ui_serve_base",
|
40
|
+
"prefect_ui_serve_base",
|
41
|
+
),
|
42
|
+
)
|
43
|
+
|
44
|
+
static_directory: Optional[str] = Field(
|
45
|
+
default=None,
|
46
|
+
description="The directory to serve static files from. This should be used when running into permissions issues when attempting to serve the UI from the default directory (for example when running in a Docker container).",
|
47
|
+
validation_alias=AliasChoices(
|
48
|
+
AliasPath("static_directory"),
|
49
|
+
"prefect_server_ui_static_directory",
|
50
|
+
"prefect_ui_static_directory",
|
51
|
+
),
|
52
|
+
)
|