Coverage for /usr/local/lib/python3.12/site-packages/prefect/settings/models/server/tasks.py: 100%
15 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 ServerTasksSchedulingSettings(PrefectBaseSettings): 1a
11 """
12 Settings for controlling server-side behavior related to task scheduling
13 """
15 model_config: ClassVar[SettingsConfigDict] = build_settings_config( 1a
16 ("server", "tasks", "scheduling")
17 )
19 max_scheduled_queue_size: int = Field( 1a
20 default=1000,
21 description="The maximum number of scheduled tasks to queue for submission.",
22 validation_alias=AliasChoices(
23 AliasPath("max_scheduled_queue_size"),
24 "prefect_server_tasks_scheduling_max_scheduled_queue_size",
25 "prefect_task_scheduling_max_scheduled_queue_size",
26 ),
27 )
29 max_retry_queue_size: int = Field( 1a
30 default=100,
31 description="The maximum number of retries to queue for submission.",
32 validation_alias=AliasChoices(
33 AliasPath("max_retry_queue_size"),
34 "prefect_server_tasks_scheduling_max_retry_queue_size",
35 "prefect_task_scheduling_max_retry_queue_size",
36 ),
37 )
39 pending_task_timeout: timedelta = Field( 1a
40 default=timedelta(0),
41 description="How long before a PENDING task are made available to another task worker.",
42 validation_alias=AliasChoices(
43 AliasPath("pending_task_timeout"),
44 "prefect_server_tasks_scheduling_pending_task_timeout",
45 "prefect_task_scheduling_pending_task_timeout",
46 ),
47 )
50class ServerTasksSettings(PrefectBaseSettings): 1a
51 """
52 Settings for controlling server-side behavior related to tasks
53 """
55 model_config: ClassVar[SettingsConfigDict] = build_settings_config( 1a
56 ("server", "tasks")
57 )
59 tag_concurrency_slot_wait_seconds: float = Field( 1a
60 default=30,
61 ge=0,
62 description="The number of seconds to wait before retrying when a task run cannot secure a concurrency slot from the server.",
63 validation_alias=AliasChoices(
64 AliasPath("tag_concurrency_slot_wait_seconds"),
65 "prefect_server_tasks_tag_concurrency_slot_wait_seconds",
66 "prefect_task_run_tag_concurrency_slot_wait_seconds",
67 ),
68 )
70 max_cache_key_length: int = Field( 1a
71 default=2000,
72 description="The maximum number of characters allowed for a task run cache key.",
73 validation_alias=AliasChoices(
74 AliasPath("max_cache_key_length"),
75 "prefect_server_tasks_max_cache_key_length",
76 "prefect_api_task_cache_key_max_length",
77 ),
78 )
80 scheduling: ServerTasksSchedulingSettings = Field( 1a
81 default_factory=ServerTasksSchedulingSettings,
82 description="Settings for controlling server-side behavior related to task scheduling",
83 )