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