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 | """ |
showard | 8dbd05a | 2010-01-12 18:54:59 +0000 | [diff] [blame] | 10 | FIELDS = {'max_processes_per_drone': 'max_processes_per_drone', |
| 11 | 'max_processes_started_per_cycle': 'max_jobs_started_per_cycle', |
| 12 | 'clean_interval': 'clean_interval_minutes', |
| 13 | 'max_parse_processes': 'max_parse_processes', |
| 14 | 'tick_pause_sec': 'tick_pause_sec', |
| 15 | 'max_transfer_processes': 'max_transfer_processes', |
Alex Miller | c23a7f0 | 2013-08-27 17:36:42 -0700 | [diff] [blame] | 16 | 'max_hostless_processes': 'max_hostless_processes', |
showard | 8dbd05a | 2010-01-12 18:54:59 +0000 | [diff] [blame] | 17 | 'secs_to_wait_for_atomic_group_hosts': |
showard | 7718256 | 2009-06-10 00:16:05 +0000 | [diff] [blame] | 18 | 'secs_to_wait_for_atomic_group_hosts', |
showard | 8dbd05a | 2010-01-12 18:54:59 +0000 | [diff] [blame] | 19 | 'reverify_period_minutes': 'reverify_period_minutes', |
Eric Li | e0493a4 | 2010-11-15 13:05:43 -0800 | [diff] [blame] | 20 | 'reverify_max_hosts_at_once': 'reverify_max_hosts_at_once', |
Alex Miller | a4a78ef | 2013-09-03 21:23:05 -0700 | [diff] [blame^] | 21 | 'max_repair_limit': 'max_repair_limit', |
| 22 | 'max_provision_retries': 'max_provision_retries', |
showard | d1ee1dd | 2009-01-07 21:33:08 +0000 | [diff] [blame] | 23 | } |
| 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() |
| 33 | for field, config_option in self.FIELDS.iteritems(): |
| 34 | setattr(self, field, config.get_config_value(CONFIG_SECTION, |
| 35 | config_option, |
| 36 | type=int)) |
| 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() |