• 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                ('clean_interval_minutes', int),
13                ('max_parse_processes', int),
14                ('tick_pause_sec', float),
15                ('max_transfer_processes', int),
16                ('secs_to_wait_for_atomic_group_hosts', int),
17                ('reverify_period_minutes', int),
18                ('reverify_max_hosts_at_once', int),
19                ('max_repair_limit', int),
20                ('max_provision_retries', int),
21             ]
22
23
24    def __init__(self):
25        self.read_config()
26
27
28    def read_config(self):
29        """
30        Reads the attributes (listed in `FIELDS`) from the global config
31        and copies them into self.
32        """
33        config = global_config.global_config
34        config.parse_config_file()
35        for field, data_type in self.FIELDS:
36            setattr(self, field, config.get_config_value(CONFIG_SECTION,
37                                                         field,
38                                                         type=data_type))
39
40
41config = SchedulerConfig()
42