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), |
| 13 | ('max_processes_started_per_cycle', int), |
| 14 | ('clean_interval_minutes', int), |
| 15 | ('max_parse_processes', int), |
| 16 | ('tick_pause_sec', float), |
| 17 | ('max_transfer_processes', int), |
| 18 | ('secs_to_wait_for_atomic_group_hosts', int), |
| 19 | ('reverify_period_minutes', int), |
| 20 | ('reverify_max_hosts_at_once', int), |
| 21 | ('max_repair_limit', int), |
| 22 | ('max_provision_retries', int), |
| 23 | ] |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 24 | |
showard | 7718256 | 2009-06-10 00:16:05 +0000 | [diff] [blame] | 25 | |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 26 | def __init__(self): |
| 27 | self.read_config() |
| 28 | |
| 29 | |
| 30 | def read_config(self): |
| 31 | config = global_config.global_config |
| 32 | config.parse_config_file() |
Alex Miller | ac189f3 | 2014-06-23 13:55:23 -0700 | [diff] [blame] | 33 | for field, data_type in self.FIELDS: |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 34 | setattr(self, field, config.get_config_value(CONFIG_SECTION, |
Alex Miller | ac189f3 | 2014-06-23 13:55:23 -0700 | [diff] [blame] | 35 | field, |
Fang Deng | 9a0c6c3 | 2013-09-04 15:34:55 -0700 | [diff] [blame] | 36 | type=data_type)) |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 37 | |
showard | 7718256 | 2009-06-10 00:16:05 +0000 | [diff] [blame] | 38 | |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 39 | config = SchedulerConfig() |