incubator-tashi-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From strou...@apache.org
Subject svn commit: r1229301 - /incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py
Date Mon, 09 Jan 2012 19:11:03 GMT
Author: stroucki
Date: Mon Jan  9 19:11:03 2012
New Revision: 1229301

URL: http://svn.apache.org/viewvc?rev=1229301&view=rev
Log:
enable temporary accounting in CM

Modified:
    incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py

Modified: incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py
URL: http://svn.apache.org/viewvc/incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py?rev=1229301&r1=1229300&r2=1229301&view=diff
==============================================================================
--- incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py
(original)
+++ incubator/tashi/branches/stroucki-accounting/src/tashi/clustermanager/clustermanagerservice.py
Mon Jan  9 19:11:03 2012
@@ -88,9 +88,14 @@ class ClusterManagerService(object):
 
 
 	def __ACCOUNTFLUSH(self):
-		print "Called account flush"
-		self.accountLines = 0
-		self.accountBuffer = []
+		try:
+			from tashi.rpycservices import rpycservices
+			client=rpycservices.client("clustermanager", 31337)
+			client.record(self.accountBuffer)
+			self.accountLines = 0
+			self.accountBuffer = []
+		except:
+			self.log.exception("Failed to flush accounting data")
 
 
 	def __ACCOUNT(self, text, instance=None, host=None):
@@ -100,13 +105,13 @@ class ClusterManagerService(object):
 
 		if instance is not None:
 			try:
-				instanceText = 'Instance(id %d host %d vmId %d user %d cores %d memory %d)' % (instance.id,
instance.hostId, instance.vmId, instance.userId, instance.cores, instance.memory)
+				instanceText = 'Instance(%s)' % (instance)
 			except:
 				self.log.exception("Invalid instance data")
 
 		if host is not None:
 			try:
-				hostText = "Host(id %d memory %d cores %d)" % (host.id, host.memory, host.cores)
+				hostText = "Host(%s)" % (host)
 			except:
 				self.log.exception("Invalid host data")
 



Mime
View raw message