Coverage for /usr/local/lib/python3.12/site-packages/prefect/settings/models/worker.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.10.6, created at 2025-12-05 10:48 +0000

1from typing import ClassVar 1a

2 

3from pydantic import Field 1a

4from pydantic_settings import SettingsConfigDict 1a

5 

6from prefect.settings.base import PrefectBaseSettings, build_settings_config 1a

7 

8 

9class WorkerWebserverSettings(PrefectBaseSettings): 1a

10 model_config: ClassVar[SettingsConfigDict] = build_settings_config( 1a

11 ("worker", "webserver") 

12 ) 

13 

14 host: str = Field( 1a

15 default="0.0.0.0", 

16 description="The host address the worker's webserver should bind to.", 

17 ) 

18 

19 port: int = Field( 1a

20 default=8080, 

21 description="The port the worker's webserver should bind to.", 

22 ) 

23 

24 

25class WorkerSettings(PrefectBaseSettings): 1a

26 model_config: ClassVar[SettingsConfigDict] = build_settings_config(("worker",)) 1a

27 

28 heartbeat_seconds: float = Field( 1a

29 default=30, 

30 description="Number of seconds a worker should wait between sending a heartbeat.", 

31 ) 

32 

33 query_seconds: float = Field( 1a

34 default=10, 

35 description="Number of seconds a worker should wait between queries for scheduled work.", 

36 ) 

37 

38 prefetch_seconds: float = Field( 1a

39 default=10, 

40 description="The number of seconds into the future a worker should query for scheduled work.", 

41 ) 

42 

43 webserver: WorkerWebserverSettings = Field( 1a

44 default_factory=WorkerWebserverSettings, 

45 description="Settings for a worker's webserver", 

46 )