Author: croberts Date: 2012-12-14 17:33:47 +0000 (Fri, 14 Dec 2012) New Revision: 5599
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py branches/elephant/cumin/python/cumin/gridhadoop/namenode.py branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py Log: More wiring of new aviary methods in sage. Now relying on the built-in async nature and error handling by using invoc.make_callback() instead of custom callback.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py =================================================================== --- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-14 17:14:01 UTC (rev 5598) +++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-14 17:33:47 UTC (rev 5599) @@ -66,7 +66,13 @@
self.form = DataNodeDeleteForm(app, self.name, self, cls) self.invoc = None + + def do_invoke(self, invoc, id, args): + self.invoc = invoc + (hadoophost) = args + self.app.remote.stop_data_node(hadoophost, id, invoc.make_callback())
+ def get_title(self, session): return "Remove data nodes"
@@ -76,14 +82,16 @@
class DataNodeDeleteForm(HadoopNodeDeleteForm): def process_submit(self, session): - name_nodes_to_kill = self.selection.get(session) - - if not self.errors.get(session): - print "Here is where I'd make a call to kill some data nodes [%s]" % name_nodes_to_kill - #self.task.invoke(session, name_nodes_to_kill) - + self.validate(session) + ids = self.selection.get(session) url = self.return_url.get(session) self.page.redirect.set(session, url) + + if not self.errors.get(session): + #TODO get hosts associated with each id + hadoophost = "TODO" + self.task.invoke(session, ids, (hadoophost)) +
def render_title(self, session): return "Remove data nodes"
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py =================================================================== --- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-14 17:14:01 UTC (rev 5598) +++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-14 17:33:47 UTC (rev 5599) @@ -65,6 +65,11 @@
self.form = JobTrackerDeleteForm(app, self.name, self, cls) self.invoc = None + + def do_invoke(self, invoc, id, args): + self.invoc = invoc + (hadoophost) = args + self.app.remote.stop_job_tracker(hadoophost, id, invoc.make_callback())
def get_title(self, session): return "Remove job trackers" @@ -75,14 +80,15 @@
class JobTrackerDeleteForm(HadoopNodeDeleteForm): def process_submit(self, session): - name_nodes_to_kill = self.selection.get(session) - - if not self.errors.get(session): - print "Here is where I'd make a call to kill some job trackers [%s]" % name_nodes_to_kill - #self.task.invoke(session, name_nodes_to_kill) - + self.validate(session) + ids = self.selection.get(session) url = self.return_url.get(session) self.page.redirect.set(session, url) + + if not self.errors.get(session): + #TODO get hosts associated with each id + hadoophost = "TODO" + self.task.invoke(session, ids, (hadoophost))
def render_title(self, session): return "Remove job trackers"
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py =================================================================== --- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-14 17:14:01 UTC (rev 5598) +++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-14 17:33:47 UTC (rev 5599) @@ -72,13 +72,7 @@ def do_invoke(self, session, object, invoc, args): self.invoc = invoc (binfile, owner, hadoophost) = args - - try: - call_async(self.callback, self.app.remote.start_name_node, hadoophost, binfile, owner) - except Exception, e: - invoc.status = invoc.FAILED - log.debug("Creating name node failed", exc_info=True) - invoc.end() + self.app.remote.start_name_node(hadoophost, binfile, owner, invoc.make_callback())
def get_title(self, session, x): return "Create a name node" @@ -123,6 +117,11 @@
self.form = NameNodeDeleteForm(app, self.name, self, cls) self.invoc = None + + def do_invoke(self, invoc, id, args): + self.invoc = invoc + (hadoophost) = args + self.app.remote.stop_name_node(hadoophost, id, invoc.make_callback())
def get_title(self, session): return "Remove name nodes" @@ -133,14 +132,15 @@
class NameNodeDeleteForm(HadoopNodeDeleteForm): def process_submit(self, session): - name_nodes_to_kill = self.selection.get(session) - - if not self.errors.get(session): - print "Here is where I'd make a call to kill some name nodes [%s]" % name_nodes_to_kill - #self.task.invoke(session, name_nodes_to_kill) - + self.validate(session) + ids = self.selection.get(session) url = self.return_url.get(session) self.page.redirect.set(session, url) + + if not self.errors.get(session): + #TODO get hosts associated with each id + hadoophost = "TODO" + self.task.invoke(session, ids, (hadoophost))
def render_title(self, session): return "Remove name nodes"
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py =================================================================== --- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-14 17:14:01 UTC (rev 5598) +++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-14 17:33:47 UTC (rev 5599) @@ -65,6 +65,11 @@
self.form = TaskTrackerDeleteForm(app, self.name, self, cls) self.invoc = None + + def do_invoke(self, invoc, id, args): + self.invoc = invoc + (hadoophost) = args + self.app.remote.stop_task_tracker(hadoophost, id, invoc.make_callback())
def get_title(self, session): return "Remove task trackers" @@ -75,14 +80,15 @@
class TaskTrackerDeleteForm(HadoopNodeDeleteForm): def process_submit(self, session): - name_nodes_to_kill = self.selection.get(session) - - if not self.errors.get(session): - print "Here is where I'd make a call to kill some task trackers [%s]" % name_nodes_to_kill - #self.task.invoke(session, name_nodes_to_kill) - + self.validate(session) + ids = self.selection.get(session) url = self.return_url.get(session) self.page.redirect.set(session, url) + + if not self.errors.get(session): + #TODO get hosts associated with each id + hadoophost = "TODO" + self.task.invoke(session, ids, (hadoophost))
def render_title(self, session): return "Remove task trackers"
cumin-developers@lists.fedorahosted.org