コード例 #1
0
ファイル: master.py プロジェクト: ohpauleez/aupy
	def handle(self):
		print "%10.5f :: Handling request" % time.time()
		req = self.rfile.readline().strip()
		req = req.split(":")
		if req[1] == "log utility":
			print "%10.5f :: Log request" % time.time()
			slave_addr = tuple(req[-2:])
			slave_ip = slave_addr[0]
			slave_port = slave_addr[1]
			log_info = req[2]
			try:
				with Utility.contextUtility(self.logUtility, log_info, evalFunc=bool, 
						utilityCallback=self.explosionHandler, utilityCallbackArgs=[(slave_addr)]) as status:
					if not isinstance(status, Utility.UtilityError):
						print "%10.5f :: No Explosion Before :: slave->%s" %(time.time(), str(slave_addr))
			except RuntimeError:
				print "\tSEE TODO: yield was never reached in the generator" #TODO: replace contexts with either wrappers or classes
		else:
			pass
コード例 #2
0
ファイル: master.py プロジェクト: ohpauleez/aupy
	def handle(self):
		print "%10.5f :: Handling request" % time.time()
		req = self.rfile.readline().strip()
		req = req.split(":")
		if req[1] == "log utility":
			print "%10.5f :: Log request" % time.time()
			slave_addr = tuple(req[-2:])
			slave_ip = slave_addr[0]
			slave_port = slave_addr[1]
			log_writes = int(req[2])
			timestamp = float(req[0])
			print "WE GOT TIME:", timestamp
			try:
				with Utility.contextPreUtility(self.logUtility, timestamp, log_writes, evalFunc=bool, 
						utilityCallback=self.explosionHandler, utilityCallbackArgs=[(slave_addr)]) as status:
					if not isinstance(status, Utility.UtilityError):
						print "%10.5f :: No Explosion Before :: slave->%s" %(time.time(), str(slave_addr))
			except RuntimeError:
				# you should never see this.. you should check "status" for an exception
				print "\tSEE TODO: yield was never reached in the generator"
		else:
			pass
コード例 #3
0
ファイル: slave.py プロジェクト: ohpauleez/aupy
	def monitorLog(self, log_file):
		with Utility.contextUtility(self.log_utility, evalFunc=bool, utilityCallback=self.log_callback) as status:
			while True:
				pass