Author: croberts
Date: 2012-12-13 15:38:59 +0000 (Thu, 13 Dec 2012)
New Revision: 5588
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:
Get all 4 hadoop top level "objects" ready for trying out actual calls when
available.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-13 14:51:02 UTC
(rev 5587)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-13 15:38:59 UTC
(rev 5588)
@@ -9,7 +9,7 @@
from hadoop import *
-from sage.util import MethodResult
+from sage.util import *
class DataNodeSelector(ObjectSelector):
@@ -95,6 +95,26 @@
self.form = DataNodeCreateForm(app, self.name, self, cls)
self.invoc = None
+
+
+ def callback(self, result):
+ if result == False:
+ self.invoc.status = self.invoc.FAILED
+ self.invoc.end()
+
+ def fake_call(self, binfile, owner, hadoophost, count, name_node):
+ return True
+
+ def do_invoke(self, session, object, invoc, args):
+ self.invoc = invoc
+ (binfile, owner, hadoophost, count, name_node) = args
+
+ try:
+ call_async(self.callback, self.fake_call, binfile, owner, hadoophost, count,
name_node)
+ except Exception, e:
+ invoc.status = invoc.FAILED
+ log.debug("Creating data node failed", exc_info=True)
+ invoc.end()
def get_title(self, session, x):
return "Create data nodes"
@@ -129,10 +149,12 @@
self.page.redirect.set(session, url)
if not self.errors.get(session):
+ binfile = self.binfile.get(session)
+ owner = self.owner.get(session)
+ hadoophost = self.hadoophost.get(session)
count = self.count.get(session)
name_node = self.nameNode.get(session)
-
- print "Here is where I'd do the work and start up %s data nodes
bound to name node %s" % (count, name_node)
+ self.task.invoke(session, None, (binfile, owner, hadoophost, count,
name_node))
self.task.exit_with_redirect(session, url)
def render_title(self, session):
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-13 14:51:02 UTC
(rev 5587)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-13 15:38:59 UTC
(rev 5588)
@@ -9,7 +9,7 @@
from hadoop import *
-from sage.util import MethodResult
+from sage.util import *
class JobTrackerSelector(ObjectSelector):
@@ -94,6 +94,25 @@
self.form = JobTrackerCreateForm(app, self.name, self, cls)
self.invoc = None
+
+ def callback(self, result):
+ if result == False:
+ self.invoc.status = self.invoc.FAILED
+ self.invoc.end()
+
+ def fake_call(self, binfile, owner, hadoophost):
+ return True
+
+ def do_invoke(self, session, object, invoc, args):
+ self.invoc = invoc
+ (binfile, owner, hadoophost) = args
+
+ try:
+ call_async(self.callback, self.fake_call, binfile, owner, hadoophost)
+ except Exception, e:
+ invoc.status = invoc.FAILED
+ log.debug("Creating job tracker failed", exc_info=True)
+ invoc.end()
def get_title(self, session, x):
return "Create a job tracker"
@@ -103,9 +122,6 @@
def __init__(self, app, name, task, cls):
super(JobTrackerCreateForm, self).__init__(app, name, task, cls)
- self.count = self.CountField(app, "count")
- self.add_field(self.count)
-
self.binfile = BinFileLoc(app, "binfile")
self.add_field(self.binfile)
@@ -125,14 +141,11 @@
self.page.redirect.set(session, url)
if not self.errors.get(session):
- count = self.count.get(session)
-
- print "Here is where I'd do the work and start up %s job
trackers" % count
+ binfile = self.binfile.get(session)
+ owner = self.owner.get(session)
+ hadoophost = self.hadoophost.get(session)
+ self.task.invoke(session, None, (binfile, owner, hadoophost))
self.task.exit_with_redirect(session, url)
def render_title(self, session):
- return "Create a job tracker"
-
- class CountField(StringField):
- def render_title(self, session):
- return "Number of job trackers to start"
\ No newline at end of file
+ return "Create a job tracker"
\ No newline at end of file
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-13 14:51:02 UTC
(rev 5587)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-13 15:38:59 UTC
(rev 5588)
@@ -77,11 +77,8 @@
(binfile, owner, hadoophost) = args
try:
- print "Here is where I'd do the work and start up %s name
nodes" % count
call_async(self.callback, self.fake_call, binfile, owner, hadoophost)
- #call_async(self.callback, self.app.hadoop.create_name_node, name_nodes)
- pass
- except:
+ except Exception, e:
invoc.status = invoc.FAILED
log.debug("Creating name node failed", exc_info=True)
invoc.end()
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-13 14:51:02 UTC
(rev 5587)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-13 15:38:59 UTC
(rev 5588)
@@ -9,7 +9,7 @@
from hadoop import *
-from sage.util import MethodResult
+from sage.util import *
class TaskTrackerSelector(ObjectSelector):
@@ -94,6 +94,25 @@
self.form = TaskTrackerCreateForm(app, self.name, self, cls)
self.invoc = None
+
+ def callback(self, result):
+ if result == False:
+ self.invoc.status = self.invoc.FAILED
+ self.invoc.end()
+
+ def fake_call(self, binfile, owner, hadoophost, count, job_tracker):
+ return True
+
+ def do_invoke(self, session, object, invoc, args):
+ self.invoc = invoc
+ (binfile, owner, hadoophost, count, job_tracker) = args
+
+ try:
+ call_async(self.callback, self.fake_call, binfile, owner, hadoophost, count,
job_tracker)
+ except Exception, e:
+ invoc.status = invoc.FAILED
+ log.debug("Creating task trackers failed", exc_info=True)
+ invoc.end()
def get_title(self, session, x):
return "Create task trackers"
@@ -128,10 +147,12 @@
self.page.redirect.set(session, url)
if not self.errors.get(session):
+ binfile = self.binfile.get(session)
+ owner = self.owner.get(session)
+ hadoophost = self.hadoophost.get(session)
count = self.count.get(session)
job_tracker = self.jobTracker.get(session)
-
- print "Here is where I'd do the work and start up %s task trackers
bound to job tracker %s" % (count, job_tracker)
+ self.task.invoke(session, None, (binfile, owner, hadoophost, count,
job_tracker))
self.task.exit_with_redirect(session, url)
def render_title(self, session):