showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 1 | import common |
| 2 | from autotest_lib.client.common_lib import global_config |
| 3 | |
| 4 | CONFIG_SECTION = 'SCHEDULER' |
| 5 | |
| 6 | class SchedulerConfig(object): |
| 7 | """ |
| 8 | Contains configuration that can be changed during scheduler execution. |
| 9 | """ |
Alex Miller | ac189f3 | 2014-06-23 13:55:23 -0700 | [diff] [blame] | 10 | FIELDS = [ |
| 11 | ('max_processes_per_drone', int), |
| 12 | ('max_processes_warning_threshold', float), |
Alex Miller | ac189f3 | 2014-06-23 13:55:23 -0700 | [diff] [blame] | 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 | ] |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 23 | |
showard | 7718256 | 2009-06-10 00:16:05 +0000 | [diff] [blame] | 24 | |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 25 | def __init__(self): |
| 26 | self.read_config() |
| 27 | |
| 28 | |
| 29 | def read_config(self): |
Paul Hobbs | b92af21b | 2015-04-09 15:12:41 -0700 | [diff] [blame] | 30 | """ |
| 31 | Reads the attributes (listed in `FIELDS`) from the global config |
| 32 | and copies them into self. |
| 33 | """ |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 34 | config = global_config.global_config |
| 35 | config.parse_config_file() |
Alex Miller | ac189f3 | 2014-06-23 13:55:23 -0700 | [diff] [blame] | 36 | for field, data_type in self.FIELDS: |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 37 | setattr(self, field, config.get_config_value(CONFIG_SECTION, |
Alex Miller | ac189f3 | 2014-06-23 13:55:23 -0700 | [diff] [blame] | 38 | field, |
Fang Deng | 9a0c6c3 | 2013-09-04 15:34:55 -0700 | [diff] [blame] | 39 | type=data_type)) |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 40 | |
showard | 7718256 | 2009-06-10 00:16:05 +0000 | [diff] [blame] | 41 | |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 42 | config = SchedulerConfig() |