Author: tmckay
Date: 2012-12-14 20:04:43 +0000 (Fri, 14 Dec 2012)
New Revision: 5600
Modified:
branches/elephant/sage/python/sage/aviary/aviaryoperations.py
Log:
Add get_name_node_list, fix error in all the "get_" methods
Modified: branches/elephant/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-14 17:33:47 UTC
(rev 5599)
+++ branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-14 20:04:43 UTC
(rev 5600)
@@ -937,26 +937,43 @@
self._operate_on_ids(host, ids, callback, "stopNameNode")
def get_name_node(self, host, ids, callback=None):
- return self._operate_on_ids(self, host, ids, callback, "getNameNode")
+ return self._operate_on_ids(host, ids, callback, "getNameNode")
def stop_data_node(self, host, ids, callback):
self._operate_on_ids(host, ids, callback, "stopDataNode")
def get_data_node(self, host, ids, callback=None):
- return self._operate_on_ids(self, host, ids, callback, "getDataNode")
+ return self._operate_on_ids(host, ids, callback, "getDataNode")
def stop_job_tracker(self, host, ids, callback):
self._operate_on_ids(host, ids, callback, "stopJobTracker")
def get_job_tracker(self, host, ids, callback=None):
- return self._operate_on_ids(self, host, ids, callback,
"getJobTracker")
+ return self._operate_on_ids(host, ids, callback, "getJobTracker")
def stop_task_tracker(self, host, ids, callback):
self._operate_on_ids(host, ids, callback, "stopTaskTracker")
def get_task_tracker(self, host, ids, callback=None):
- return self._operate_on_ids(self, host, ids, callback,
"getTaskTracker")
+ return self._operate_on_ids(host, ids, callback, "getTaskTracker")
+ def get_name_node_list(self, callback=None):
+ try:
+ status = "OK"
+ hosts = self.get_hosts(self.resource, self.subtype)
+ data = []
+ for h in hosts:
+ s, n = self.get_name_node(h, [])
+ if s == "OK":
+ data.extend(n)
+ except Exception, e:
+ status = e
+ data = None
+ if callback:
+ callback(status, data)
+ else:
+ return (status, data)
+
def _operate_on_ids(self, host, ids, callback, meth_name):
if callback:
assert callable(callback)