summaryrefslogtreecommitdiff
path: root/scheduler/scheduler_config.py
blob: 814b227e3b8452d68ea52dd75fc1a4a2634aaba9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import common
from autotest_lib.client.common_lib import global_config

CONFIG_SECTION = 'SCHEDULER'

class SchedulerConfig(object):
    """
    Contains configuration that can be changed during scheduler execution.
    """
    FIELDS = {'max_processes_per_drone' : 'max_processes_per_drone',
              'max_processes_started_per_cycle' : 'max_jobs_started_per_cycle',
              'clean_interval' : 'clean_interval_minutes',
              'synch_job_start_timeout_minutes' :
                  'synch_job_start_timeout_minutes',
              'max_parse_processes' : 'max_parse_processes',
              'tick_pause_sec' : 'tick_pause_sec',
              'max_transfer_processes' : 'max_transfer_processes',
             }

    def __init__(self):
        self.read_config()


    def read_config(self):
        config = global_config.global_config
        config.parse_config_file()
        for field, config_option in self.FIELDS.iteritems():
            setattr(self, field, config.get_config_value(CONFIG_SECTION,
                                                         config_option,
                                                         type=int))

config = SchedulerConfig()