def __init__(self, config, testonly=False): threading.Thread.__init__(self) self.daemon = True self.hostname = socket.getfqdn() self.wake_event = threading.Event() self.layout_lock = threading.Lock() self.run_handler_lock = threading.Lock() self.command_map = dict(stop=self.stop, ) self._pause = False self._exit = False self._stopped = False self.executor = None self.merger = None self.connections = None self.statsd = get_statsd(config) self.rpc = rpclistener.RPCListener(config, self) self.stats_thread = threading.Thread(target=self.runStats) self.stats_thread.daemon = True self.stats_stop = threading.Event() # TODO(jeblair): fix this # Despite triggers being part of the pipeline, there is one trigger set # per scheduler. The pipeline handles the trigger filters but since # the events are handled by the scheduler itself it needs to handle # the loading of the triggers. # self.triggers['connection_name'] = triggerObject self.triggers = dict() self.config = config self.trigger_event_queue = queue.Queue() self.result_event_queue = queue.Queue() self.management_event_queue = zuul.lib.queue.MergedQueue() self.abide = model.Abide() self.unparsed_abide = model.UnparsedAbideConfig() if not testonly: time_dir = self._get_time_database_dir() self.time_database = model.TimeDataBase(time_dir) command_socket = get_default(self.config, 'scheduler', 'command_socket', '/var/lib/zuul/scheduler.socket') self.command_socket = commandsocket.CommandSocket(command_socket) if zuul_version.is_release is False: self.zuul_version = "%s %s" % (zuul_version.release_string, zuul_version.git_version) else: self.zuul_version = zuul_version.release_string self.last_reconfigured = None self.tenant_last_reconfigured = {} self.autohold_requests = {}
def setUp(self): super(TestTimeDataBase, self).setUp() self.tmp_root = self.useFixture(fixtures.TempDir( rootdir=os.environ.get("ZUUL_TEST_ROOT")) ).path self.db = model.TimeDataBase(self.tmp_root)