More fix
This commit is contained in:
parent
54d40f117b
commit
2570d3c450
|
@ -53,7 +53,25 @@ class NodeInstance(threading.Thread):
|
|||
|
||||
def run(self):
|
||||
if self.name == socket.gethostname():
|
||||
self.setup_local_node()
|
||||
conn = self.setup_local_node()
|
||||
|
||||
while True:
|
||||
if self.name == socket.gethostname():
|
||||
self.memfree = conn.getFreeMemory()
|
||||
self.cpuload = os.getloadavg()[0]
|
||||
try:
|
||||
self.zk.set(self.zkey + '/memfree', str(self.memfree).encode('ascii'))
|
||||
self.zk.set(self.zkey + '/cpuload', str(self.cpuload).encode('ascii'))
|
||||
except:
|
||||
if self.stop_thread.is_set():
|
||||
return
|
||||
print("Free memory: %s | Load: %s" % ( self.memfree, self.cpuload ))
|
||||
print("Active domains: %s" % self.domainlist)
|
||||
|
||||
for x in range(0,100):
|
||||
time.sleep(0.1)
|
||||
if self.stop_thread.is_set():
|
||||
return
|
||||
|
||||
@zk.DataWatch(self.zkey + '/state')
|
||||
def watch_state(data, stat):
|
||||
|
@ -93,20 +111,4 @@ class NodeInstance(threading.Thread):
|
|||
print("Node hostname: %s" % self.name)
|
||||
print("CPUs: %s" % self.cpucount)
|
||||
|
||||
while True:
|
||||
self.memfree = conn.getFreeMemory()
|
||||
self.cpuload = os.getloadavg()[0]
|
||||
try:
|
||||
self.zk.set(self.zkey + '/memfree', str(self.memfree).encode('ascii'))
|
||||
self.zk.set(self.zkey + '/cpuload', str(self.cpuload).encode('ascii'))
|
||||
except:
|
||||
if self.stop_thread.is_set():
|
||||
return
|
||||
|
||||
print("Free memory: %s | Load: %s" % ( self.memfree, self.cpuload ))
|
||||
print("Active domains: %s" % self.domainlist)
|
||||
for x in range(0,100):
|
||||
time.sleep(0.1)
|
||||
if self.stop_thread.is_set():
|
||||
return
|
||||
|
||||
return conn
|
||||
|
|
Loading…
Reference in New Issue