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

18 statements  

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

1from typing import ClassVar, Optional 1a

2 

3from pydantic import Field 1a

4from pydantic_settings import SettingsConfigDict 1a

5 

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

7from prefect.types import LogLevel 1a

8 

9 

10class RunnerServerSettings(PrefectBaseSettings): 1a

11 """ 

12 Settings for controlling runner server behavior 

13 """ 

14 

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

16 ("runner", "server") 

17 ) 

18 

19 enable: bool = Field( 1a

20 default=False, 

21 description="Whether or not to enable the runner's webserver.", 

22 ) 

23 

24 host: str = Field( 1a

25 default="localhost", 

26 description="The host address the runner's webserver should bind to.", 

27 ) 

28 

29 port: int = Field( 1a

30 default=8080, 

31 description="The port the runner's webserver should bind to.", 

32 ) 

33 

34 log_level: LogLevel = Field( 1a

35 default="ERROR", 

36 description="The log level of the runner's webserver.", 

37 ) 

38 

39 missed_polls_tolerance: int = Field( 1a

40 default=2, 

41 description="Number of missed polls before a runner is considered unhealthy by its webserver.", 

42 ) 

43 

44 

45class RunnerSettings(PrefectBaseSettings): 1a

46 """ 

47 Settings for controlling runner behavior 

48 """ 

49 

50 model_config: ClassVar[SettingsConfigDict] = build_settings_config(("runner",)) 1a

51 

52 process_limit: int = Field( 1a

53 default=5, 

54 description="Maximum number of processes a runner will execute in parallel.", 

55 ) 

56 

57 poll_frequency: int = Field( 1a

58 default=10, 

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

60 ) 

61 

62 heartbeat_frequency: Optional[int] = Field( 1a

63 default=None, 

64 description="Number of seconds a runner should wait between heartbeats for flow runs.", 

65 ge=30, 

66 ) 

67 

68 server: RunnerServerSettings = Field( 1a

69 default_factory=RunnerServerSettings, 

70 description="Settings for controlling runner server behavior", 

71 )