def __init__(self, max_batch_size, max_batch_interval, met_buffer,
                 collectd):
        """
        Init MetricsBatcher with max_batch_size, max_batch_interval, and met_buffer
        """

        Timer.__init__(self, max_batch_interval, self.flush)

        self.collectd = collectd

        # initiate max_batch_size and max_batch_interval
        self.max_batch_size = max_batch_size
        self.max_batch_interval = max_batch_interval

        # init batching queue to 2 * max_batch_size so that producer can still write while flushing
        self.queue = queue.Queue(2 * max_batch_size)

        # init lock for flushing
        self.flushing_lock = threading.Lock()
        self.metrics_buffer = met_buffer

        # start timer
        self.start_timer()

        collectd.info(
            'Initialized MetricsBatcher with max_batch_size %s, max_batch_interval %s'
            % (max_batch_size, max_batch_interval))
Exemplo n.º 2
0
	def __init__(self):
		Timer.__init__(self)

		self.Filename = Directories.resolveFilename(Directories.SCOPE_CONFIG, "pm_timers.xml")

		try:
			self.loadTimer()
		except IOError:
			print "unable to load timers from file!"
Exemplo n.º 3
0
    def __init__(self, start_pin, finish_pin, track):
        TrackSensor.__init__(self, start_pin, finish_pin)
        Timer.__init__(self)
        Form.__init__(self)

        self.track = track

        self.is_started = False
        self.is_finished = False

        self.school_code = None
        self.team = None
Exemplo n.º 4
0
	def __init__(self):
		BirthdayStore.__init__(self)
		Timer.__init__(self)
		
		# this is used to detect settings changes, because we only want to change preremind timers if a different value was saved by the user
		config.plugins.birthdayreminder.preremindChanged.addNotifier(self.cbPreremindChanged, initial_call = False)
		config.plugins.birthdayreminder.notificationTimeChanged.addNotifier(self.cbNotificationTimeChanged, initial_call = False)
		
		# let's wait for the system time being up to date before starting the timers. needed when the box was powered off
		if not eDVBLocalTimeHandler.getInstance().ready():
			eDVBLocalTimeHandler.getInstance().m_timeUpdated.get().append(self.startTimer)
		else:
			self.start()
			self.startNetworking()
Exemplo n.º 5
0
    def __init__(self, conf, met_buf, collectd):
        """
        Init MetricsSender with conf and met_buf
        """

        Timer.__init__(self, conf[ConfigOptions.http_post_interval],
                       self._request_scheduler)

        self.collectd = collectd
        self.conf = conf
        self.buffer = met_buf
        self.http_headers = self._build_header()
        self.timer = None
        # start timer
        self.start_timer()
Exemplo n.º 6
0
	def __init__(self):
		BirthdayStore.__init__(self)
		Timer.__init__(self)
		
		# this is used to detect settings changes, because we only want to change preremind timers if a different value was saved by the user
		config.plugins.birthdayreminder.preremindChanged.addNotifier(self.cbPreremindChanged, initial_call = False)
		config.plugins.birthdayreminder.notificationTimeChanged.addNotifier(self.cbNotificationTimeChanged, initial_call = False)
		
		# let's wait for the system time being up to date before starting the timers. needed when the box was powered off
		if not eDVBLocalTimeHandler.getInstance().ready():
			self.local_time_handler_conn = eDVBLocalTimeHandler.getInstance().m_timeUpdated.connect(self.startTimer)
		else:
			self.start()
			self.startNetworking()
		self.broadcastPort = None
		self.transferServerPort = None
Exemplo n.º 7
0
	def __init__(self):
		Timer.__init__(self)
		self.timersFilename = resolveFilename(SCOPE_CONFIG, "pm_timers.xml")
		self.loadTimers()