Exemple #1
0
	def _schedule(self):
		"""Sleep until the next time this monitor should run"""
		s = self.stopped_at or now()
		if self.delay_for:
			if isinstance(self.delay_for,tuple):
				s = time_delta(self.delay_for, now=s)
			else:
				s += dt.timedelta(0,self.delay_for)
		if self.delay_until:
			if self.stopped_at:
				s = time_until(self.delay_until, now=s, invert=True)
			s = time_until(self.delay_until, now=s)
		if not self.delay_for and not self.delay_until:
			if isinstance(self.delay,tuple):
				s = time_delta(self.delay, now=s)
			else:
				s += dt.timedelta(0,self.delay)

		self.started_at = s
		with log_wait("monitor","sleep",*self.name):
			sleepUntil(False,s)
Exemple #2
0
		def delay():
			if isinstance(self.delay,tuple):
				sleepUntil(False,time_delta(self.delay))
			else:
				sleepUntil(False,self.delay)