huangcm
2025-09-01 53d8e046ac1bf2ebe94f671983e3d3be059df91a
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import common
from autotest_lib.client.common_lib import global_config
 
CONFIG_SECTION = 'SCHEDULER'
 
class SchedulerConfig(object):
    """
    Contains configuration that can be changed during scheduler execution.
    """
    FIELDS = [
                ('max_processes_per_drone', int),
                ('clean_interval_minutes', int),
                ('max_parse_processes', int),
                ('tick_pause_sec', float),
                ('max_transfer_processes', int),
                ('secs_to_wait_for_atomic_group_hosts', int),
                ('reverify_period_minutes', int),
                ('reverify_max_hosts_at_once', int),
                ('max_repair_limit', int),
                ('max_provision_retries', int),
             ]
 
 
    def __init__(self):
        self.read_config()
 
 
    def read_config(self):
        """
        Reads the attributes (listed in `FIELDS`) from the global config
        and copies them into self.
        """
        config = global_config.global_config
        config.parse_config_file()
        for field, data_type in self.FIELDS:
            setattr(self, field, config.get_config_value(CONFIG_SECTION,
                                                         field,
                                                         type=data_type))
 
 
config = SchedulerConfig()