r5614 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-18 14:39:40 +0000 (Tue, 18 Dec 2012)
New Revision: 5614
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/hadoop.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:
Uptime columns now displayed nicely.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-18 14:34:49 UTC (rev 5613)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-18 14:39:40 UTC (rev 5614)
@@ -46,7 +46,7 @@
self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
self.sub_col = SubmittedColumn(app, "sub", cls.Submitted)
self.state_col = ObjectTableColumn(app, "statecol", cls.State)
- self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
+ self.uptime_col = UptimeColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
self.add_column(self.id_col)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2012-12-18 14:34:49 UTC (rev 5613)
+++ branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2012-12-18 14:39:40 UTC (rev 5614)
@@ -206,4 +206,12 @@
d = super(SubmittedColumn, self).\
render_cell_content(session, data)
datestring = datetime.fromtimestamp(d).strftime('%Y-%m-%d %H:%M:%S')
- return datestring
\ No newline at end of file
+ return datestring
+
+class UptimeColumn(ObjectTableColumn):
+ def render_cell_content(self, session, record):
+ value = self.field.get_content(session, record)
+ days = value / 86400
+ hours = (value / 3600) - (days * 24)
+ minutes = (value / 60) - (days * 1440) - (hours * 60)
+ return '%02d:%02d:%02d' % (days, hours, minutes)
\ No newline at end of file
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-18 14:34:49 UTC (rev 5613)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-18 14:39:40 UTC (rev 5614)
@@ -52,7 +52,7 @@
self.ipc_col.width = "20%"
self.sub_col = SubmittedColumn(app, "sub", cls.Submitted)
self.state_col = ObjectTableColumn(app, "statecol", cls.State)
- self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
+ self.uptime_col = UptimeColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
self.add_column(self.id_col)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-18 14:34:49 UTC (rev 5613)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-18 14:39:40 UTC (rev 5614)
@@ -47,7 +47,7 @@
self.ipc_col.width = "20%"
self.sub_col = SubmittedColumn(app, "sub", cls.Submitted)
self.state_col = ObjectTableColumn(app, "statecol", cls.State)
- self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
+ self.uptime_col = UptimeColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
self.add_column(self.id_col)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-18 14:34:49 UTC (rev 5613)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-18 14:39:40 UTC (rev 5614)
@@ -50,7 +50,7 @@
self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
self.sub_col = SubmittedColumn(app, "sub", cls.Submitted)
self.state_col = ObjectTableColumn(app, "statecol", cls.State)
- self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
+ self.uptime_col = UptimeColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
self.add_column(self.id_col)
11 years, 4 months
r5613 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-18 14:34:49 +0000 (Tue, 18 Dec 2012)
New Revision: 5613
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/hadoop.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:
Submitted column is now formatted nicely.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-18 14:22:44 UTC (rev 5612)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-18 14:34:49 UTC (rev 5613)
@@ -44,7 +44,7 @@
super(DataNodeTable, self).__init__(app, name, cls)
self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
- self.sub_col = ObjectTableColumn(app, "sub", cls.Submitted)
+ self.sub_col = SubmittedColumn(app, "sub", cls.Submitted)
self.state_col = ObjectTableColumn(app, "statecol", cls.State)
self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2012-12-18 14:22:44 UTC (rev 5612)
+++ branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2012-12-18 14:34:49 UTC (rev 5613)
@@ -199,4 +199,11 @@
def render_item_selected_attr(self, session, item):
if item == self.param.get(session):
- return "selected=\"selected\""
\ No newline at end of file
+ return "selected=\"selected\""
+
+class SubmittedColumn(ObjectTableColumn):
+ def render_cell_content(self, session, data):
+ d = super(SubmittedColumn, self).\
+ render_cell_content(session, data)
+ datestring = datetime.fromtimestamp(d).strftime('%Y-%m-%d %H:%M:%S')
+ return datestring
\ No newline at end of file
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-18 14:22:44 UTC (rev 5612)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-18 14:34:49 UTC (rev 5613)
@@ -50,7 +50,7 @@
self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
self.ipc_col = ObjectTableColumn(app, "ipc", cls.Ipc)
self.ipc_col.width = "20%"
- self.sub_col = ObjectTableColumn(app, "sub", cls.Submitted)
+ self.sub_col = SubmittedColumn(app, "sub", cls.Submitted)
self.state_col = ObjectTableColumn(app, "statecol", cls.State)
self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-18 14:22:44 UTC (rev 5612)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-18 14:34:49 UTC (rev 5613)
@@ -45,7 +45,7 @@
self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
self.ipc_col = ObjectTableColumn(app, "ipc", cls.Ipc)
self.ipc_col.width = "20%"
- self.sub_col = ObjectTableColumn(app, "sub", cls.Submitted)
+ self.sub_col = SubmittedColumn(app, "sub", cls.Submitted)
self.state_col = ObjectTableColumn(app, "statecol", cls.State)
self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-18 14:22:44 UTC (rev 5612)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-18 14:34:49 UTC (rev 5613)
@@ -48,7 +48,7 @@
super(TaskTrackerTable, self).__init__(app, name, cls)
self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
- self.sub_col = ObjectTableColumn(app, "sub", cls.Submitted)
+ self.sub_col = SubmittedColumn(app, "sub", cls.Submitted)
self.state_col = ObjectTableColumn(app, "statecol", cls.State)
self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
11 years, 4 months
r5612 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-18 14:22:44 +0000 (Tue, 18 Dec 2012)
New Revision: 5612
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
Log:
Re-ordering the fields on the create forms for consistency.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-17 21:48:34 UTC (rev 5611)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-18 14:22:44 UTC (rev 5612)
@@ -131,15 +131,15 @@
self.nameNode = NameNodeField(app, "namenode")
self.add_field(self.nameNode)
- self.count = self.CountField(app, "count")
- self.add_field(self.count)
-
self.binfile = BinFileLoc(app, "binfile")
self.add_field(self.binfile)
self.owner = Owner(app, "owner")
self.add_field(self.owner)
+ self.count = self.CountField(app, "count")
+ self.add_field(self.count)
+
self.hadoophost = HadoopHostField(app, "hadoophost")
self.add_field(self.hadoophost)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-17 21:48:34 UTC (rev 5611)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-18 14:22:44 UTC (rev 5612)
@@ -131,21 +131,21 @@
def __init__(self, app, name, task, cls):
super(JobTrackerCreateForm, self).__init__(app, name, task, cls)
+ self.nameNode = NameNodeField(app, "namenode")
+ self.add_field(self.nameNode)
+
self.binfile = BinFileLoc(app, "binfile")
self.add_field(self.binfile)
self.owner = Owner(app, "owner")
self.add_field(self.owner)
- self.nameNode = NameNodeField(app, "namenode")
- self.add_field(self.nameNode)
+ self.count = self.CountField(app, "count")
+ self.add_field(self.count)
self.hadoophost = HadoopHostField(app, "hadoophost")
self.add_field(self.hadoophost)
- self.count = self.CountField(app, "count")
- self.add_field(self.count)
-
def process_display(self, session):
self.scheduler.validate(session)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-17 21:48:34 UTC (rev 5611)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-18 14:22:44 UTC (rev 5612)
@@ -131,15 +131,15 @@
self.jobTracker = JobTrackerField(app, "jobtracker")
self.add_field(self.jobTracker)
- self.count = self.CountField(app, "count")
- self.add_field(self.count)
-
self.binfile = BinFileLoc(app, "binfile")
self.add_field(self.binfile)
self.owner = Owner(app, "owner")
self.add_field(self.owner)
+ self.count = self.CountField(app, "count")
+ self.add_field(self.count)
+
self.hadoophost = HadoopHostField(app, "hadoophost")
self.add_field(self.hadoophost)
11 years, 4 months
r5611 - trunk/cumin/python/cumin
by eallen@fedoraproject.org
Author: eallen
Date: 2012-12-17 21:48:34 +0000 (Mon, 17 Dec 2012)
New Revision: 5611
Modified:
trunk/cumin/python/cumin/stat.py
Log:
Fix for BZ881826, BZ886924, BZ887167 - Rate charts missing
Modified: trunk/cumin/python/cumin/stat.py
===================================================================
--- trunk/cumin/python/cumin/stat.py 2012-12-17 20:28:54 UTC (rev 5610)
+++ trunk/cumin/python/cumin/stat.py 2012-12-17 21:48:34 UTC (rev 5611)
@@ -1024,7 +1024,7 @@
samples = dict()
if mode == "rate":
for stat in stats:
- os = adapter.samples(stat, dur+600, interval, method, secs2=end_seconds_ago, delta=delta)
+ os = adapter[stat].samples(stat, dur+600, interval, method, secs2=end_seconds_ago, delta=delta)
ns = list()
prev = None
11 years, 4 months
r5610 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-17 20:28:54 +0000 (Mon, 17 Dec 2012)
New Revision: 5610
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/hadoop.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:
Removing the last of the faked data.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-17 17:48:56 UTC (rev 5609)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-17 20:28:54 UTC (rev 5610)
@@ -81,11 +81,10 @@
self.validate(session)
ids = self.selection.get(session)
url = self.return_url.get(session)
+ hadoophost = self.hadoophost.get(session)
self.page.redirect.set(session, url)
if not self.errors.get(session):
- #TODO get hosts associated with each id
- hadoophost = "grid2.lab.bos.redhat.com:9090"
self.task.invoke(session, ids, (hadoophost))
Modified: branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2012-12-17 17:48:56 UTC (rev 5609)
+++ branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2012-12-17 20:28:54 UTC (rev 5610)
@@ -25,24 +25,7 @@
return len(data)
def get_sage_results(self, values):
- # Here's some fake data, eventually force the derived class to implement this
- results = MethodResult()
- results.status = "OK"
- results.data = {"node1":{"Name":"node1.lab.bos.redhat.com",\
- "id":"12345", \
- "submitted":"11/14/2012", \
- "ref":{"ipc":"some fake ipc location", "id":"12345"}, \
- "state":"FAKE*Running", \
- "uptime":"2+00:54:56", \
- "owner":"croberts"}, \
- "node2":{"Name":"node2.lab.bos.redhat.com",\
- "id":"56789", \
- "ref":{"ipc":"another fake ipc location", "id":"56789"}, \
- "submitted":"11/15/2012", \
- "state":"FAKE*Running", \
- "uptime":"1+00:24:56", \
- "owner":"croberts"}}
- return (results.status, results.data)
+ raise Exception("Not implemented")
def do_get_data(self, values):
(status, data) = self.get_sage_results(values)
@@ -65,10 +48,13 @@
field_data.append(val)
return field_data
-class HadoopNodeDeleteForm(ObjectSelectorTaskForm):
+class HadoopNodeDeleteForm(ObjectSelectorTaskForm):
def __init__(self, app, name, task, cls):
super(HadoopNodeDeleteForm, self).__init__(app, name, task)
self.task = task
+
+ self.hadoophost = HadoopHostField(app, "hadoophost")
+ self.add_child(self.hadoophost)
def get_selection(self, session):
ids = self.ids.get(session)
@@ -78,6 +64,17 @@
def render_form_class(self, session):
return " ".join((super(HadoopNodeDeleteForm, self).render_form_class(session), "mform"))
+ def render_content(self, session, *args):
+ # need to show "content" which has the selected list from objectselectortaskform
+ # also need to render any fields by hand here since
+ # the usual content block gets swapped out
+ content = ""
+ content += '''<table class="FormFieldSet"><tbody>'''
+ content += self.hadoophost.render(session)
+ content += '''</tbody></table>'''
+ content += self.content.render(session, *args)
+ return content
+
class HadoopNodeCreateForm(ObjectTaskForm):
def render_form_class(self, session):
return " ".join((super(HadoopNodeCreateForm, self).render_form_class(session), "mform"))
@@ -107,10 +104,7 @@
def render_title(self, session):
return "Hadoop host"
-
- def render_help(self, session):
- return "Submit hadoop jobs to this host"
-
+
class HadoopHostOptions(OptionInputSet):
def do_process(self, session):
id = self.param.get(session)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-17 17:48:56 UTC (rev 5609)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-17 20:28:54 UTC (rev 5610)
@@ -86,12 +86,11 @@
def process_submit(self, session):
self.validate(session)
ids = self.selection.get(session)
+ hadoophost = self.hadoophost.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 = "grid2.lab.bos.redhat.com:9090"
self.task.invoke(session, ids, (hadoophost))
def render_title(self, session):
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-17 17:48:56 UTC (rev 5609)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-17 20:28:54 UTC (rev 5610)
@@ -135,12 +135,11 @@
def process_submit(self, session):
self.validate(session)
ids = self.selection.get(session)
+ hadoophost = self.hadoophost.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 = "grid2.lab.bos.redhat.com:9090"
self.task.invoke(session, ids, (hadoophost))
def render_title(self, session):
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-17 17:48:56 UTC (rev 5609)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-17 20:28:54 UTC (rev 5610)
@@ -83,12 +83,11 @@
def process_submit(self, session):
self.validate(session)
ids = self.selection.get(session)
+ hadoophost = self.hadoophost.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 = "grid2.lab.bos.redhat.com:9090"
self.task.invoke(session, ids, (hadoophost))
def render_title(self, session):
11 years, 4 months
r5609 - branches/elephant/cumin/python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-12-17 17:48:56 +0000 (Mon, 17 Dec 2012)
New Revision: 5609
Modified:
branches/elephant/cumin/python/cumin/task.py
Log:
Make task invocations follow Failed (exception) format in yellow
banners to be consistent with Aviary ops
Modified: branches/elephant/cumin/python/cumin/task.py
===================================================================
--- branches/elephant/cumin/python/cumin/task.py 2012-12-17 17:07:54 UTC (rev 5608)
+++ branches/elephant/cumin/python/cumin/task.py 2012-12-17 17:48:56 UTC (rev 5609)
@@ -172,7 +172,14 @@
if not description:
description = ""
status = xml_escape(str(self.get_status(session)))
- return "<span class='notification_time'>%s</span> %s: %s" % ("%s-%02d-%02d %02d:%02d:%02d" % (timestamp.year, timestamp.month, timestamp.day, timestamp.hour, timestamp.minute, timestamp.second), description, status)
+ return "<span class='notification_time'>%s</span> %s: %s" % \
+ ("%s-%02d-%02d %02d:%02d:%02d" % (timestamp.year,
+ timestamp.month,
+ timestamp.day,
+ timestamp.hour,
+ timestamp.minute,
+ timestamp.second),
+ description, status)
def end(self):
log.debug("Ending %s", self.task)
@@ -229,6 +236,9 @@
# set by an ObjectTask or Task on failure
# (see Task.invoke() and Task.exception() above)
# Previously the different mechanisms produced different results.
+ if not status_code in (0,"OK"):
+ status_code = Exception(status_code)
+
if isinstance(status_code, Exception):
self.status = self.FAILED
self.exception = status_code
11 years, 4 months
r5608 - in branches/elephant: cumin/python/cumin/gridhadoop sage/python/sage/aviary
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-17 17:07:54 +0000 (Mon, 17 Dec 2012)
New Revision: 5608
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
branches/elephant/sage/python/sage/aviary/aviaryoperations.py
Log:
Fixing a couple of type-o's for task trackers.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-17 17:01:11 UTC (rev 5607)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-17 17:07:54 UTC (rev 5608)
@@ -115,7 +115,7 @@
(binfile, owner, hadoophost, count, job_tracker) = args
try:
- self.app.remote.start_data_node(hadoophost, float(job_tracker), binfile, owner, count, invoc.make_callback())
+ self.app.remote.start_task_tracker(hadoophost, float(job_tracker), binfile, owner, count, invoc.make_callback())
except Exception, e:
invoc.status = invoc.FAILED
log.debug("Creating task trackers failed", exc_info=True)
Modified: branches/elephant/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-17 17:01:11 UTC (rev 5607)
+++ branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-17 17:07:54 UTC (rev 5608)
@@ -963,7 +963,7 @@
self._operate_on_ids(host, ids, callback, "stopTaskTracker")
def start_task_tracker(self, host, nn_id, bin_file, owner, count, callback):
- return self._start_node(host, name_node_id, bin_file, owner, count,
+ return self._start_node(host, nn_id, bin_file, owner, count,
"startTaskTracker", callback)
def get_task_tracker(self, host, ids, callback=None):
11 years, 4 months
r5607 - in branches/elephant: cumin/model cumin/python/cumin/gridhadoop sage/python/sage/aviary
by croberts@fedoraproject.org
Author: croberts
Date: 2012-12-17 17:01:11 +0000 (Mon, 17 Dec 2012)
New Revision: 5607
Modified:
branches/elephant/cumin/model/cumin.xml
branches/elephant/cumin/model/rosemary.xml
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/hadoop.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
branches/elephant/sage/python/sage/aviary/aviaryoperations.py
Log:
More wiring for hadoop methods.
Modified: branches/elephant/cumin/model/cumin.xml
===================================================================
--- branches/elephant/cumin/model/cumin.xml 2012-12-17 15:54:45 UTC (rev 5606)
+++ branches/elephant/cumin/model/cumin.xml 2012-12-17 17:01:11 UTC (rev 5607)
@@ -47,7 +47,7 @@
<package name="com.redhat.cumin.grid.hadoop">
<class name="NameNode" storage="none">
- <property name="ID" type="sstr"/>
+ <property name="Id" type="sstr"/>
<property name="Ipc" type="sstr"/>
<property name="Submitted" type="sstr"/>
<property name="State" type="sstr"/>
@@ -56,25 +56,28 @@
<property name="Location" type="sstr"/>
</class>
<class name="DataNode" storage="none">
- <property name="ID" type="sstr"/>
+ <property name="Id" type="sstr"/>
+ <property name="Ipc" type="sstr"/>
<property name="Submitted" type="sstr"/>
- <property name="Status" type="sstr"/>
+ <property name="State" type="sstr"/>
<property name="Uptime" type="sstr"/>
<property name="Owner" type="sstr"/>
<property name="NameNode" type="sstr"/>
</class>
<class name="TaskTracker" storage="none">
- <property name="ID" type="sstr"/>
+ <property name="Id" type="sstr"/>
+ <property name="Ipc" type="sstr"/>
<property name="Submitted" type="sstr"/>
- <property name="Status" type="sstr"/>
+ <property name="State" type="sstr"/>
<property name="Uptime" type="sstr"/>
<property name="Owner" type="sstr"/>
<property name="JobTracker" type="sstr"/>
</class>
<class name="JobTracker" storage="none">
- <property name="ID" type="sstr"/>
+ <property name="Id" type="sstr"/>
+ <property name="Ipc" type="sstr"/>
<property name="Submitted" type="sstr"/>
- <property name="Status" type="sstr"/>
+ <property name="State" type="sstr"/>
<property name="Uptime" type="sstr"/>
<property name="Owner" type="sstr"/>
<property name="Location" type="sstr"/>
Modified: branches/elephant/cumin/model/rosemary.xml
===================================================================
--- branches/elephant/cumin/model/rosemary.xml 2012-12-17 15:54:45 UTC (rev 5606)
+++ branches/elephant/cumin/model/rosemary.xml 2012-12-17 17:01:11 UTC (rev 5607)
@@ -37,7 +37,7 @@
<package name="com.redhat.cumin.grid.hadoop">
<class name="NameNode">
- <property name="ID">
+ <property name="Id">
<title>Id</title>
</property>
<property name="Ipc">
@@ -61,56 +61,59 @@
</class>
<class name="DataNode">
- <property name="ID">
+ <property name="Id">
<title>Id</title>
</property>
+ <property name="Ipc">
+ <title>Ipc</title>
+ </property>
<property name="Submitted">
<title>Submitted</title>
</property>
- <property name="Status">
- <title>Status</title>
+ <property name="State">
+ <title>State</title>
</property>
<property name="Uptime">
<title>Uptime</title>
</property>
<property name="Owner">
<title>Owner</title>
- </property>
- <property name="NameNode">
- <title>Name node</title>
- </property>
+ </property>
</class>
<class name="TaskTracker">
- <property name="ID">
+ <property name="Id">
<title>Id</title>
</property>
+ <property name="Ipc">
+ <title>Ipc</title>
+ </property>
<property name="Submitted">
<title>Submitted</title>
</property>
- <property name="Status">
- <title>Status</title>
+ <property name="State">
+ <title>State</title>
</property>
<property name="Uptime">
<title>Uptime</title>
</property>
<property name="Owner">
<title>Owner</title>
- </property>
- <property name="JobTracker">
- <title>Job tracker</title>
- </property>
+ </property>
</class>
<class name="JobTracker">
- <property name="ID">
+ <property name="Id">
<title>Id</title>
</property>
+ <property name="Ipc">
+ <title>Ipc</title>
+ </property>
<property name="Submitted">
<title>Submitted</title>
</property>
- <property name="Status">
- <title>Status</title>
+ <property name="State">
+ <title>State</title>
</property>
<property name="Uptime">
<title>Uptime</title>
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-17 15:54:45 UTC (rev 5606)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2012-12-17 17:01:11 UTC (rev 5607)
@@ -11,15 +11,19 @@
from sage.util import *
-
+class DataNodeAdapter(HadoopAdapter):
+ def get_sage_results(self, values):
+ results = self.app.remote.get_data_node_list()
+ return results
+
class DataNodeSelector(ObjectSelector):
def __init__(self, app, name):
cls = app.model.com_redhat_cumin_grid_hadoop.DataNode
super(DataNodeSelector, self).__init__(app, name, cls)
- self.add_search_filter(self.table.nn_col)
- self.table.adapter = HadoopAdapter(app, cls)
+ self.add_search_filter(self.table.id_col)
+ self.table.adapter = DataNodeAdapter(app, cls)
task = DataNodeCreate(app)
link = TaskLink(app, "dataNode_create", task)
@@ -35,27 +39,19 @@
def render_title(self, session):
return "HDFS data nodes"
- def get_qmf_results(self, session):
- values = self.get_data_values(session)
- return self.table.adapter.get_sage_results(values)
-
-
class DataNodeTable(ObjectQmfSelectorTable):
def __init__(self, app, name, cls):
super(DataNodeTable, self).__init__(app, name, cls)
- self.nn_col = ObjectTableColumn(app, "nncol", cls.NameNode)
- self.nn_col.width="20%"
- self.id_col = ObjectTableColumn(app, "idcol", cls.ID)
+ self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
self.sub_col = ObjectTableColumn(app, "sub", cls.Submitted)
- self.status_col = ObjectTableColumn(app, "statuscol", cls.Status)
+ self.state_col = ObjectTableColumn(app, "statecol", cls.State)
self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
- self.add_column(self.nn_col)
self.add_column(self.id_col)
self.add_column(self.sub_col)
- self.add_column(self.status_col)
+ self.add_column(self.state_col)
self.add_column(self.uptime_col)
self.add_column(self.owner_col)
@@ -70,7 +66,7 @@
def do_invoke(self, invoc, id, args):
self.invoc = invoc
(hadoophost) = args
- self.app.remote.stop_data_node(hadoophost, id, invoc.make_callback())
+ self.app.remote.stop_data_node(hadoophost, [float(id)], invoc.make_callback())
def get_title(self, session):
@@ -89,7 +85,7 @@
if not self.errors.get(session):
#TODO get hosts associated with each id
- hadoophost = "TODO"
+ hadoophost = "grid2.lab.bos.redhat.com:9090"
self.task.invoke(session, ids, (hadoophost))
@@ -118,7 +114,8 @@
(binfile, owner, hadoophost, count, name_node) = args
try:
- call_async(self.callback, self.fake_call, binfile, owner, hadoophost, count, name_node)
+ self.invoc = invoc
+ self.app.remote.start_data_node(hadoophost, name_node, binfile, owner, count, invoc.make_callback())
except Exception, e:
invoc.status = invoc.FAILED
log.debug("Creating data node failed", exc_info=True)
@@ -173,61 +170,4 @@
return "Number of data nodes to start"
-class NameNodeField(ScalarField):
- def __init__(self, app, name):
- super(NameNodeField, self).__init__(app, name, None)
-
- self.param = IntegerParameter(app, "param")
- self.add_parameter(self.param)
-
- cls = app.model.com_redhat_cumin_grid_hadoop.NameNode
-
- self.input = self.NameNodeOptions(app, "input", self.param)
- self.add_child(self.input)
-
- def get(self, session):
- return self.input.get(session)
-
- def validate(self, session):
- super(NameNodeField, self).validate(session)
-
- name_nodes = self.input.get_items(session)
-
- if not name_nodes:
- error = FormError("There is no name node to bind to")
- self.form.errors.add(session, error)
-
- def render_title(self, session):
- return "Name node"
-
- def render_help(self, session):
- return "Attach data nodes to this name node"
-
- class NameNodeOptions(OptionInputSet):
- def do_process(self, session):
- cls = self.app.model.com_redhat_cumin_grid_hadoop.NameNode
- id = self.param.get(session)
-
- if id is None:
- items = self.get_items(session)
-
- if items:
- self.param.set(session, items[0])
-
- super(NameNodeField.NameNodeOptions, self).do_process \
- (session)
-
- def do_get_items(self, session):
- cls = self.app.model.com_redhat_cumin_grid_hadoop.NameNode
- name_nodes = [12345, 23456]
- return name_nodes
-
- def render_item_value(self, session, item):
- return item
-
- def render_item_content(self, session, item):
- return xml_escape(item)
-
- def render_item_selected_attr(self, session, item):
- if item == self.param.get(session):
- return "selected=\"selected\""
\ No newline at end of file
+
\ No newline at end of file
Modified: branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2012-12-17 15:54:45 UTC (rev 5606)
+++ branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2012-12-17 17:01:11 UTC (rev 5607)
@@ -29,23 +29,19 @@
results = MethodResult()
results.status = "OK"
results.data = {"node1":{"Name":"node1.lab.bos.redhat.com",\
- "ID":"12345", \
- "Submitted":"11/14/2012", \
- "Status":"FAKE*Running", \
- "Uptime":"2+00:54:56", \
- "Owner":"croberts", \
- "Location":"@http://mrg7.lab.bos.redhat.com:40222",\
- "NameNode":"796210 @ http://mrg16.lab.bos.redhat.com:50061",\
- "JobTracker":"799639 @ http://mrg44.lab.bos.redhat.com:57339"}, \
+ "id":"12345", \
+ "submitted":"11/14/2012", \
+ "ref":{"ipc":"some fake ipc location", "id":"12345"}, \
+ "state":"FAKE*Running", \
+ "uptime":"2+00:54:56", \
+ "owner":"croberts"}, \
"node2":{"Name":"node2.lab.bos.redhat.com",\
- "ID":"56789", \
- "Submitted":"11/15/2012", \
- "Status":"FAKE*Running", \
- "Uptime":"1+00:24:56", \
- "Owner":"croberts", \
- "Location":"http://mrg8.lab.bos.redhat.com:40222",\
- "NameNode":"720565 @ http://mrg14.lab.bos.redhat.com:44594",\
- "JobTracker":"799639 @ http://mrg44.lab.bos.redhat.com:57339"}}
+ "id":"56789", \
+ "ref":{"ipc":"another fake ipc location", "id":"56789"}, \
+ "submitted":"11/15/2012", \
+ "state":"FAKE*Running", \
+ "uptime":"1+00:24:56", \
+ "owner":"croberts"}}
return (results.status, results.data)
def do_get_data(self, values):
@@ -60,11 +56,14 @@
field_data = list()
for column in self.columns:
try:
- val = record[column.name]
- except KeyError:
- val = record["ID"]
+ val = record[column.name.lower()]
+ except AttributeError:
+ if (column.name == "Ipc"):
+ val = record.ref.ipc
+ else:
+ val = record.ref.id
field_data.append(val)
- return field_data
+ return field_data
class HadoopNodeDeleteForm(ObjectSelectorTaskForm):
def __init__(self, app, name, task, cls):
@@ -144,4 +143,66 @@
class Owner(StringField):
def render_title(self, session):
- return "Username of the owner"
\ No newline at end of file
+ return "Username of the owner"
+
+
+class NameNodeField(ScalarField):
+ def __init__(self, app, name):
+ super(NameNodeField, self).__init__(app, name, None)
+
+ self.param = IntegerParameter(app, "param")
+ self.add_parameter(self.param)
+
+ cls = app.model.com_redhat_cumin_grid_hadoop.NameNode
+
+ self.input = self.NameNodeOptions(app, "input", self.param)
+ self.add_child(self.input)
+
+ def get(self, session):
+ return self.input.get(session)
+
+ def validate(self, session):
+ super(NameNodeField, self).validate(session)
+
+ name_nodes = self.input.get_items(session)
+
+ if not name_nodes:
+ error = FormError("There is no name node to bind to")
+ self.form.errors.add(session, error)
+
+ def render_title(self, session):
+ return "Name node"
+
+ def render_help(self, session):
+ return "Attach data nodes to this name node"
+
+ class NameNodeOptions(OptionInputSet):
+ def do_process(self, session):
+ cls = self.app.model.com_redhat_cumin_grid_hadoop.NameNode
+ id = self.param.get(session)
+
+ if id is None:
+ items = self.get_items(session)
+
+ if items:
+ self.param.set(session, items[0])
+
+ super(NameNodeField.NameNodeOptions, self).do_process \
+ (session)
+
+ def do_get_items(self, session):
+ nodes = []
+ (status, node_list) = self.app.remote.get_name_node_list()
+ for node in node_list:
+ nodes.append(node.ref.id)
+ return nodes
+
+ def render_item_value(self, session, item):
+ return item
+
+ def render_item_content(self, session, item):
+ return xml_escape(item)
+
+ def render_item_selected_attr(self, session, item):
+ if item == self.param.get(session):
+ return "selected=\"selected\""
\ No newline at end of file
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-17 15:54:45 UTC (rev 5606)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2012-12-17 17:01:11 UTC (rev 5607)
@@ -11,15 +11,19 @@
from sage.util import *
-
+class JobTrackerAdapter(HadoopAdapter):
+ def get_sage_results(self, values):
+ results = self.app.remote.get_job_tracker_list()
+ return results
+
class JobTrackerSelector(ObjectSelector):
def __init__(self, app, name):
cls = app.model.com_redhat_cumin_grid_hadoop.JobTracker
super(JobTrackerSelector, self).__init__(app, name, cls)
- self.add_search_filter(self.table.loc_col)
- self.table.adapter = HadoopAdapter(app, cls)
+ self.add_search_filter(self.table.id_col)
+ self.table.adapter = JobTrackerAdapter(app, cls)
task = JobTrackerCreate(app)
link = TaskLink(app, "jobTracker_create", task)
@@ -43,18 +47,18 @@
def __init__(self, app, name, cls):
super(JobTrackerTable, self).__init__(app, name, cls)
- self.loc_col = ObjectTableColumn(app, "loccol", cls.Location)
- self.loc_col.width = "20%"
- self.id_col = ObjectTableColumn(app, "idcol", cls.ID)
+ self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
+ self.ipc_col = ObjectTableColumn(app, "ipc", cls.Ipc)
+ self.ipc_col.width = "20%"
self.sub_col = ObjectTableColumn(app, "sub", cls.Submitted)
- self.status_col = ObjectTableColumn(app, "statuscol", cls.Status)
+ self.state_col = ObjectTableColumn(app, "statecol", cls.State)
self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
- self.add_column(self.loc_col)
self.add_column(self.id_col)
+ self.add_column(self.ipc_col)
self.add_column(self.sub_col)
- self.add_column(self.status_col)
+ self.add_column(self.state_col)
self.add_column(self.uptime_col)
self.add_column(self.owner_col)
@@ -69,7 +73,7 @@
def do_invoke(self, invoc, id, args):
self.invoc = invoc
(hadoophost) = args
- self.app.remote.stop_job_tracker(hadoophost, id, invoc.make_callback())
+ self.app.remote.stop_job_tracker(hadoophost, [float(id)], invoc.make_callback())
def get_title(self, session):
return "Remove job trackers"
@@ -87,7 +91,7 @@
if not self.errors.get(session):
#TODO get hosts associated with each id
- hadoophost = "TODO"
+ hadoophost = "grid2.lab.bos.redhat.com:9090"
self.task.invoke(session, ids, (hadoophost))
def render_title(self, session):
@@ -111,10 +115,10 @@
def do_invoke(self, session, object, invoc, args):
self.invoc = invoc
- (binfile, owner, hadoophost) = args
+ (binfile, owner, hadoophost, name_node, count) = args
try:
- call_async(self.callback, self.fake_call, binfile, owner, hadoophost)
+ self.app.remote.start_job_tracker(hadoophost, float(name_node), binfile, owner, count, invoc.make_callback())
except Exception, e:
invoc.status = invoc.FAILED
log.debug("Creating job tracker failed", exc_info=True)
@@ -134,8 +138,14 @@
self.owner = Owner(app, "owner")
self.add_field(self.owner)
+ self.nameNode = NameNodeField(app, "namenode")
+ self.add_field(self.nameNode)
+
self.hadoophost = HadoopHostField(app, "hadoophost")
- self.add_field(self.hadoophost)
+ self.add_field(self.hadoophost)
+
+ self.count = self.CountField(app, "count")
+ self.add_field(self.count)
def process_display(self, session):
self.scheduler.validate(session)
@@ -150,8 +160,14 @@
binfile = self.binfile.get(session)
owner = self.owner.get(session)
hadoophost = self.hadoophost.get(session)
- self.task.invoke(session, None, (binfile, owner, hadoophost))
+ name_node = self.nameNode.get(session)
+ count = self.count.get(session)
+ self.task.invoke(session, None, (binfile, owner, hadoophost, name_node, count))
self.task.exit_with_redirect(session, url)
def render_title(self, session):
- return "Create a job tracker"
\ No newline at end of file
+ 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
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-17 15:54:45 UTC (rev 5606)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2012-12-17 17:01:11 UTC (rev 5607)
@@ -14,19 +14,6 @@
def get_sage_results(self, values):
results = self.app.remote.get_name_node_list()
return results
-
- def process_record(self, key, record):
- field_data = list()
- for column in self.columns:
- try:
- val = record[column.name.lower()]
- except AttributeError:
- if (column.name == "Ipc"):
- val = record.ref.ipc
- else:
- val = record.ref.id
- field_data.append(val)
- return field_data
class NameNodeSelector(ObjectSelector):
def __init__(self, app, name):
@@ -34,7 +21,7 @@
super(NameNodeSelector, self).__init__(app, name, cls)
- self.add_search_filter(self.table.ipc_col)
+ self.add_search_filter(self.table.id_col)
self.table.adapter = NameNodeAdapter(app, cls)
task = NameNodeCreate(app)
@@ -55,16 +42,16 @@
def __init__(self, app, name, cls):
super(NameNodeTable, self).__init__(app, name, cls)
+ self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
self.ipc_col = ObjectTableColumn(app, "ipc", cls.Ipc)
- self.ipc_col.width = "20%"
- self.id_col = ObjectTableColumn(app, "idcol", cls.ID)
+ self.ipc_col.width = "20%"
self.sub_col = ObjectTableColumn(app, "sub", cls.Submitted)
self.state_col = ObjectTableColumn(app, "statecol", cls.State)
self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
- self.add_column(self.ipc_col)
self.add_column(self.id_col)
+ self.add_column(self.ipc_col)
self.add_column(self.sub_col)
self.add_column(self.state_col)
self.add_column(self.uptime_col)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-17 15:54:45 UTC (rev 5606)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2012-12-17 17:01:11 UTC (rev 5607)
@@ -11,15 +11,19 @@
from sage.util import *
-
+class TaskTrackerAdapter(HadoopAdapter):
+ def get_sage_results(self, values):
+ results = self.app.remote.get_task_tracker_list()
+ return results
+
class TaskTrackerSelector(ObjectSelector):
def __init__(self, app, name):
cls = app.model.com_redhat_cumin_grid_hadoop.TaskTracker
super(TaskTrackerSelector, self).__init__(app, name, cls)
- self.add_search_filter(self.table.jt_col)
- self.table.adapter = HadoopAdapter(app, cls)
+ self.add_search_filter(self.table.id_col)
+ self.table.adapter = TaskTrackerAdapter(app, cls)
task = TaskTrackerCreate(app)
link = TaskLink(app, "taskTracker_create", task)
@@ -43,18 +47,15 @@
def __init__(self, app, name, cls):
super(TaskTrackerTable, self).__init__(app, name, cls)
- self.jt_col = ObjectTableColumn(app, "jtcol", cls.JobTracker)
- self.jt_col.width="20%"
- self.id_col = ObjectTableColumn(app, "idcol", cls.ID)
+ self.id_col = ObjectTableColumn(app, "idcol", cls.Id)
self.sub_col = ObjectTableColumn(app, "sub", cls.Submitted)
- self.status_col = ObjectTableColumn(app, "statuscol", cls.Status)
+ self.state_col = ObjectTableColumn(app, "statecol", cls.State)
self.uptime_col = ObjectTableColumn(app, "uptimecol", cls.Uptime)
self.owner_col = ObjectTableColumn(app, "ownercol", cls.Owner)
- self.add_column(self.jt_col)
self.add_column(self.id_col)
self.add_column(self.sub_col)
- self.add_column(self.status_col)
+ self.add_column(self.state_col)
self.add_column(self.uptime_col)
self.add_column(self.owner_col)
@@ -69,7 +70,7 @@
def do_invoke(self, invoc, id, args):
self.invoc = invoc
(hadoophost) = args
- self.app.remote.stop_task_tracker(hadoophost, id, invoc.make_callback())
+ self.app.remote.stop_task_tracker(hadoophost, [float(id)], invoc.make_callback())
def get_title(self, session):
return "Remove task trackers"
@@ -87,7 +88,7 @@
if not self.errors.get(session):
#TODO get hosts associated with each id
- hadoophost = "TODO"
+ hadoophost = "grid2.lab.bos.redhat.com:9090"
self.task.invoke(session, ids, (hadoophost))
def render_title(self, session):
@@ -114,7 +115,7 @@
(binfile, owner, hadoophost, count, job_tracker) = args
try:
- call_async(self.callback, self.fake_call, binfile, owner, hadoophost, count, job_tracker)
+ self.app.remote.start_data_node(hadoophost, float(job_tracker), binfile, owner, count, invoc.make_callback())
except Exception, e:
invoc.status = invoc.FAILED
log.debug("Creating task trackers failed", exc_info=True)
@@ -214,9 +215,11 @@
(session)
def do_get_items(self, session):
- cls = self.app.model.com_redhat_cumin_grid_hadoop.JobTracker
- name_nodes = [98765, 54321]
- return name_nodes
+ nodes = []
+ (status, node_list) = self.app.remote.get_job_tracker_list()
+ for node in node_list:
+ nodes.append(node.ref.id)
+ return nodes
def render_item_value(self, session, item):
return item
Modified: branches/elephant/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-17 15:54:45 UTC (rev 5606)
+++ branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-17 17:01:11 UTC (rev 5607)
@@ -950,7 +950,7 @@
return self._operate_on_ids(host, ids, callback, "getDataNode")
def start_job_tracker(self, host, nn_id, bin_file, owner, count, callback):
- return self._start_node(host, name_node_id, bin_file, owner, count,
+ return self._start_node(host, nn_id, bin_file, owner, count,
"startJobTracker", callback)
def stop_job_tracker(self, host, ids, callback):
11 years, 4 months
r5606 - branches/elephant/sage/python/sage/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-12-17 15:54:45 +0000 (Mon, 17 Dec 2012)
New Revision: 5606
Modified:
branches/elephant/sage/python/sage/aviary/aviaryoperations.py
Log:
Add start methods for all node/trackers
Modified: branches/elephant/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-17 15:04:46 UTC (rev 5605)
+++ branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-17 15:54:45 UTC (rev 5606)
@@ -939,12 +939,20 @@
def get_name_node(self, host, ids, callback=None):
return self._operate_on_ids(host, ids, callback, "getNameNode")
+ def start_data_node(self, host, nn_id, bin_file, owner, count, callback):
+ return self._start_node(host, nn_id, bin_file, owner, count,
+ "startDataNode", callback)
+
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(host, ids, callback, "getDataNode")
+ def start_job_tracker(self, host, nn_id, bin_file, owner, count, callback):
+ return self._start_node(host, name_node_id, bin_file, owner, count,
+ "startJobTracker", callback)
+
def stop_job_tracker(self, host, ids, callback):
self._operate_on_ids(host, ids, callback, "stopJobTracker")
@@ -954,6 +962,10 @@
def stop_task_tracker(self, host, ids, callback):
self._operate_on_ids(host, ids, callback, "stopTaskTracker")
+ def start_task_tracker(self, host, nn_id, bin_file, owner, count, callback):
+ return self._start_node(host, name_node_id, bin_file, owner, count,
+ "startTaskTracker", callback)
+
def get_task_tracker(self, host, ids, callback=None):
return self._operate_on_ids(host, ids, callback, "getTaskTracker")
@@ -969,6 +981,44 @@
def get_task_tracker_list(self, callback=None):
return self._get_node_list(self.get_task_tracker, callback)
+ def _start_node(self, host, ref_id, bin_file, owner, count,
+ meth_name, callback):
+ assert callable(callback)
+
+ client = self.client_pool.get_object()
+ self._setup_client(client,
+ self.servers,
+ host,
+ meth_name)
+
+ def result_tuple(result, host):
+ data = None
+ result = self._pretty_result(result, host)
+ if isinstance(result, Exception):
+ status = result
+ else:
+ status = _AviaryCommon._get_status(result.status)
+ if status == "OK" and hasattr(result, "ref"):
+ data = result.ref
+ return (status, data)
+
+ def my_callback(result):
+ self.client_pool.return_object(client)
+ callback(*result_tuple(result, host))
+
+ ref = client.factory.create("ns1:HadoopID")
+ try:
+ # In the future, if we would like to use URLs as ids,
+ # we can test for a URL value and set new_ref.ipc instead
+ #ref.ipc = id
+ ref.id = str(ref_id)
+ except Exception:
+ raise Exception("Invalid HadoopID value")
+
+ t = CallThread(self.call_client_retry, my_callback,
+ client, meth_name, ref, bin_file, owner, count)
+ t.start()
+
def _get_node_list(self, proc, callback):
try:
status = "OK"
11 years, 4 months
r5605 - branches/elephant/sage/python/sage/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2012-12-17 15:04:46 +0000 (Mon, 17 Dec 2012)
New Revision: 5605
Modified:
branches/elephant/sage/python/sage/aviary/aviaryoperations.py
Log:
Treat ids as strings in _operate_on_ids.
Add get_whatever_list routines for all nodes/trackers
Modified: branches/elephant/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-14 22:07:55 UTC (rev 5604)
+++ branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2012-12-17 15:04:46 UTC (rev 5605)
@@ -958,12 +958,24 @@
return self._operate_on_ids(host, ids, callback, "getTaskTracker")
def get_name_node_list(self, callback=None):
+ return self._get_node_list(self.get_name_node, callback)
+
+ def get_data_node_list(self, callback=None):
+ return self._get_node_list(self.get_data_node, callback)
+
+ def get_job_tracker_list(self, callback=None):
+ return self._get_node_list(self.get_job_tracker, callback)
+
+ def get_task_tracker_list(self, callback=None):
+ return self._get_node_list(self.get_task_tracker, callback)
+
+ def _get_node_list(self, proc, callback):
try:
status = "OK"
hosts = self.get_hosts(self.resource, self.subtype)
data = []
for h in hosts:
- s, n = self.get_name_node(h, [])
+ s, n = proc(h, [])
if s == "OK":
data.extend(n)
except Exception, e:
@@ -972,7 +984,7 @@
if callback:
callback(status, data)
else:
- return (status, data)
+ return (status, data)
def _operate_on_ids(self, host, ids, callback, meth_name):
if callback:
@@ -991,10 +1003,10 @@
for id in ids:
new_ref = client.factory.create("ns1:HadoopID")
try:
- if type(id) in (str,unicode):
- new_ref.ipc = id
- else:
- new_ref.id = float(id)
+ # In the future, if we would like to use URLs as ids,
+ # we can test for a URL value and set new_ref.ipc instead
+ #new_ref.ipc = id
+ new_ref.id = str(id)
except Exception:
raise Exception("Invalid HadoopID value")
refs.append(new_ref)
11 years, 4 months