r5635 - trunk/cumin/python/cumin
by eallen@fedoraproject.org
Author: eallen
Date: 2013-01-03 16:48:40 +0000 (Thu, 03 Jan 2013)
New Revision: 5635
Modified:
trunk/cumin/python/cumin/util.py
Log:
Part of fix for 886937 - update is_active to work with Rosemary objects
Modified: trunk/cumin/python/cumin/util.py
===================================================================
--- trunk/cumin/python/cumin/util.py 2013-01-03 16:46:28 UTC (rev 5634)
+++ trunk/cumin/python/cumin/util.py 2013-01-03 16:48:40 UTC (rev 5635)
@@ -67,9 +67,9 @@
return host, port
def is_active(obj):
- delTime = obj._get_qmfDeleteTime()
- if not delTime and obj.statsCurr:
- updateTime = obj.statsCurr.qmfUpdateTime
+ delTime = obj._qmf_delete_time
+ if not delTime and obj._qmf_update_time:
+ updateTime = obj._qmf_update_time
delta = timedelta(minutes=10)
# mirroring logic in widgets/PhaseSwitch.get_sql_constraint
if not updateTime or (updateTime > datetime.now() - delta):
11 years, 4 months
r5634 - trunk/sage/python/sage/qmf
by eallen@fedoraproject.org
Author: eallen
Date: 2013-01-03 16:46:28 +0000 (Thu, 03 Jan 2013)
New Revision: 5634
Modified:
trunk/sage/python/sage/qmf/qmfoperations.py
Log:
Fix for unreported high priority regression: Move messages fails
Modified: trunk/sage/python/sage/qmf/qmfoperations.py
===================================================================
--- trunk/sage/python/sage/qmf/qmfoperations.py 2013-01-03 16:44:48 UTC (rev 5633)
+++ trunk/sage/python/sage/qmf/qmfoperations.py 2013-01-03 16:46:28 UTC (rev 5634)
@@ -51,7 +51,7 @@
def queue_move_messages(self, broker, src, dst, count, callback):
assert callback
- self._call(broker, "queueMoveMessages", callback, 0, 0, src, dst, count)
+ self._call(broker, "queueMoveMessages", callback, 0, 0, src, dst, count, {})
# methods on various broker objects. close is implemented on multiple objects
11 years, 4 months
r5633 - trunk/wooly/python/wooly
by eallen@fedoraproject.org
Author: eallen
Date: 2013-01-03 16:44:48 +0000 (Thu, 03 Jan 2013)
New Revision: 5633
Modified:
trunk/wooly/python/wooly/server.py
Log:
Part of fix for 886937 - Display notice when object becomes unavailable/deleted
Modified: trunk/wooly/python/wooly/server.py
===================================================================
--- trunk/wooly/python/wooly/server.py 2013-01-03 15:58:07 UTC (rev 5632)
+++ trunk/wooly/python/wooly/server.py 2013-01-03 16:44:48 UTC (rev 5633)
@@ -205,8 +205,13 @@
return status, headers, content
def adapt_request_to_session(self, env, session):
- session.unmarshal_url_vars(env["QUERY_STRING"])
+ try:
+ session.unmarshal_url_vars(env["QUERY_STRING"])
+ except:
+ # allow exceptions to pass so we can trap ReosmaryNotFound later
+ pass
+
session.post = env["REQUEST_METHOD"] == "POST"
if session.post:
content_type = env["CONTENT_TYPE"]
11 years, 4 months
r5632 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-03 15:58:07 +0000 (Thu, 03 Jan 2013)
New Revision: 5632
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
Log:
Additional form/code cleanup
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-03 14:46:30 UTC (rev 5631)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-03 15:58:07 UTC (rev 5632)
@@ -161,7 +161,7 @@
def render_title(self, session):
return "Create data nodes"
- class CountField(StringField):
+ class CountField(IntegerField):
def render_title(self, session):
return "Number of data nodes to start"
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-03 14:46:30 UTC (rev 5631)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-03 15:58:07 UTC (rev 5632)
@@ -38,11 +38,7 @@
def render_title(self, session):
return "Hadoop job trackers"
-
- def get_qmf_results(self, session):
- values = self.get_data_values(session)
- return self.table.adapter.get_sage_results(values)
-
+
class JobTrackerTable(ObjectQmfSelectorTable):
def __init__(self, app, name, cls):
super(JobTrackerTable, self).__init__(app, name, cls)
@@ -117,7 +113,7 @@
(binfile, owner, hadoophost, name_node, count) = args
try:
- self.app.remote.start_job_tracker(hadoophost, float(name_node), binfile, owner, count, invoc.make_callback())
+ self.app.remote.start_job_tracker(hadoophost, name_node, binfile, owner, count, invoc.make_callback())
except Exception, e:
invoc.status = invoc.FAILED
log.debug("Creating job tracker failed", exc_info=True)
11 years, 4 months
r5631 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-03 14:46:30 +0000 (Thu, 03 Jan 2013)
New Revision: 5631
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
Log:
Now displaying ipc and id in create dropdowns. also sorting list by id. removing some unused code
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-03 14:43:34 UTC (rev 5630)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-03 14:46:30 UTC (rev 5631)
@@ -38,11 +38,7 @@
def render_title(self, session):
return "Hadoop task trackers"
-
- def get_qmf_results(self, session):
- values = self.get_data_values(session)
- return self.table.adapter.get_sage_results(values)
-
+
class TaskTrackerTable(ObjectQmfSelectorTable):
def __init__(self, app, name, cls):
super(TaskTrackerTable, self).__init__(app, name, cls)
@@ -114,7 +110,7 @@
(binfile, owner, hadoophost, count, job_tracker) = args
try:
- self.app.remote.start_task_tracker(hadoophost, float(job_tracker), binfile, owner, count, invoc.make_callback())
+ self.app.remote.start_task_tracker(hadoophost, job_tracker, binfile, owner, count, invoc.make_callback())
except Exception, e:
invoc.status = invoc.FAILED
log.debug("Creating task trackers failed", exc_info=True)
@@ -161,7 +157,7 @@
def render_title(self, session):
return "Create task trackers"
- class CountField(StringField):
+ class CountField(IntegerField):
def render_title(self, session):
return "Number of task trackers to start"
@@ -214,14 +210,20 @@
nodes = []
(status, node_list) = self.app.remote.get_job_tracker_list()
for node in node_list:
- nodes.append(node.ref.id)
- return nodes
+ nodes.append(node.ref)
+ return sorted(nodes, cmp=compareHadoopIds)
def render_item_value(self, session, item):
- return item
+ value = None
+ if item.ipc:
+ value = item.ipc
+ else:
+ value = item.id
+ return value
def render_item_content(self, session, item):
- return xml_escape(item)
+ display_string = "%s (%s)" % (item.ipc, item.id)
+ return xml_escape(display_string)
def render_item_selected_attr(self, session, item):
if item == self.param.get(session):
11 years, 4 months
r5630 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-03 14:43:34 +0000 (Thu, 03 Jan 2013)
New Revision: 5630
Modified:
branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
Log:
Now displaying ipc and id in create dropdowns. also sorting list by id
Modified: branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2013-01-02 19:45:26 UTC (rev 5629)
+++ branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2013-01-03 14:43:34 UTC (rev 5630)
@@ -15,6 +15,9 @@
strings = StringCatalog(__file__)
+def compareHadoopIds(x, y):
+ return int(float(x.id) - float(y.id))
+
class HadoopAdapter(ObjectQmfAdapter):
def __init__(self, app, cls):
super(HadoopAdapter, self).__init__(app, cls)
@@ -195,14 +198,20 @@
nodes = []
(status, node_list) = self.app.remote.get_name_node_list()
for node in node_list:
- nodes.append(node.ref.id)
- return nodes
+ nodes.append(node.ref)
+ return sorted(nodes, cmp=compareHadoopIds)
def render_item_value(self, session, item):
- return item
+ value = None
+ if item.ipc:
+ value = item.ipc
+ else:
+ value = item.id
+ return value
def render_item_content(self, session, item):
- return xml_escape(item)
+ display_string = "%s (%s)" % (item.ipc, item.id)
+ return xml_escape(display_string)
def render_item_selected_attr(self, session, item):
if item == self.param.get(session):
11 years, 4 months
r5629 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-02 19:45:26 +0000 (Wed, 02 Jan 2013)
New Revision: 5629
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:
Now passing "list" of users to the hadoop get* methods. Still need to figure out if user is an admin, then remove user filter.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-02 19:07:17 UTC (rev 5628)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-02 19:45:26 UTC (rev 5629)
@@ -13,7 +13,7 @@
class DataNodeAdapter(HadoopAdapter):
def get_sage_results(self, values):
- results = self.app.remote.get_data_node_list()
+ results = self.app.remote.get_data_node_list(owner=["condor", self.app.user]) #condor is a temporary hack
return results
class DataNodeSelector(ObjectSelector):
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-02 19:07:17 UTC (rev 5628)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-02 19:45:26 UTC (rev 5629)
@@ -13,7 +13,7 @@
class JobTrackerAdapter(HadoopAdapter):
def get_sage_results(self, values):
- results = self.app.remote.get_job_tracker_list()
+ results = self.app.remote.get_job_tracker_list(owner=["condor", self.app.user]) #condor is a temporary hack
return results
class JobTrackerSelector(ObjectSelector):
@@ -137,9 +137,6 @@
self.binfile = BinFileLoc(app, "binfile")
self.add_field(self.binfile)
- self.count = self.CountField(app, "count")
- self.add_field(self.count)
-
self.hadoophost = HadoopHostField(app, "hadoophost")
self.add_field(self.hadoophost)
@@ -157,13 +154,9 @@
owner = session.app.user
hadoophost = self.hadoophost.get(session)
name_node = self.nameNode.get(session)
- count = self.count.get(session)
+ count = 1
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"
-
- 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 2013-01-02 19:07:17 UTC (rev 5628)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2013-01-02 19:45:26 UTC (rev 5629)
@@ -12,7 +12,7 @@
class NameNodeAdapter(HadoopAdapter):
def get_sage_results(self, values):
- results = self.app.remote.get_name_node_list()
+ results = self.app.remote.get_name_node_list(owner=["condor", self.app.user]) #condor is a temporary hack
return results
class NameNodeSelector(ObjectSelector):
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-02 19:07:17 UTC (rev 5628)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-02 19:45:26 UTC (rev 5629)
@@ -13,7 +13,7 @@
class TaskTrackerAdapter(HadoopAdapter):
def get_sage_results(self, values):
- results = self.app.remote.get_task_tracker_list()
+ results = self.app.remote.get_task_tracker_list(owner=["condor", self.app.user]) #condor is a temporary hack
return results
class TaskTrackerSelector(ObjectSelector):
11 years, 4 months
r5628 - in branches/elephant/cumin: bin etc python/cumin python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-02 19:07:17 +0000 (Wed, 02 Jan 2013)
New Revision: 5628
Modified:
branches/elephant/cumin/bin/cumin-web
branches/elephant/cumin/etc/cumin.conf
branches/elephant/cumin/python/cumin/config.py
branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
Log:
The default value for the hadoop_bin_tarball location is now optionally configurable.
Modified: branches/elephant/cumin/bin/cumin-web
===================================================================
--- branches/elephant/cumin/bin/cumin-web 2013-01-02 18:28:38 UTC (rev 5627)
+++ branches/elephant/cumin/bin/cumin-web 2013-01-02 19:07:17 UTC (rev 5628)
@@ -74,6 +74,10 @@
def set_kerberos_configs(cumin, values):
cumin.kerberos_realm = values.kerberos_realm
+def set_hadoop_configs(cumin, values):
+ cumin.hadoop_bin_tarball = values.hadoop_bin_tarball
+
+
def check_cert_files(opts):
# If a certificate or key file has been specified,
# check to make sure that both exist and that the
@@ -219,6 +223,7 @@
set_wallaby_configs(cumin, values, broker_uris)
set_ldap_configs(cumin, values)
set_kerberos_configs(cumin, values)
+ set_hadoop_configs(cumin, values)
# Not used right now
#cumin.auth_create_ondemand = values.auth_create_ondemand
Modified: branches/elephant/cumin/etc/cumin.conf
===================================================================
--- branches/elephant/cumin/etc/cumin.conf 2013-01-02 18:28:38 UTC (rev 5627)
+++ branches/elephant/cumin/etc/cumin.conf 2013-01-02 19:07:17 UTC (rev 5628)
@@ -106,6 +106,7 @@
# ldap_timeout: 30
# kerberos_server:
# kerberos_realm:
+# hadoop_bin_tarball:
#notification-timeout: 180
# Number of seconds that a message in the yellow notification banner
@@ -322,6 +323,10 @@
## defined by your kerberos server. Typically, this value will be in all caps
## and look like "EXAMPLE.COM"
+## hadoop_bin_tarball:
+## Setting this will yield a default value in the grid-hadoop forms
+## for the location of the hadoop bin-tarball
+
## [data]
## log-file:
Modified: branches/elephant/cumin/python/cumin/config.py
===================================================================
--- branches/elephant/cumin/python/cumin/config.py 2013-01-02 18:28:38 UTC (rev 5627)
+++ branches/elephant/cumin/python/cumin/config.py 2013-01-02 19:07:17 UTC (rev 5628)
@@ -272,6 +272,9 @@
param = ConfigParameter(self, "notification-timeout", int)
param.default = 180
+ param = ConfigParameter(self, "hadoop_bin_tarball", str)
+ param.default = ""
+
# Hidden parameter used to force html doctype rather than xhtml
# This is hopefully a temporary workaround so that selenium can
# be used to do some automated testing against cumin
Modified: branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2013-01-02 18:28:38 UTC (rev 5627)
+++ branches/elephant/cumin/python/cumin/gridhadoop/hadoop.py 2013-01-02 19:07:17 UTC (rev 5628)
@@ -104,7 +104,7 @@
if not name_nodes:
error = FormError("There is no hadoop host to submit to")
self.form.errors.add(session, error)
-
+
def render_title(self, session):
return "Hadoop host"
@@ -135,8 +135,12 @@
return "selected=\"selected\""
class BinFileLoc(StringField):
- def render_title(self, session):
- return "Location of hadoop bin-tar file"
+ def __init__(self, app, name):
+ super(BinFileLoc, self).__init__(app, name)
+ self.input.param.default = app.hadoop_bin_tarball
+
+ def render_title(self, session):
+ return "Location of hadoop bin-tar file"
class Owner(StringField):
def render_title(self, session):
11 years, 4 months
r5627 - branches/elephant/cumin/python/cumin/gridhadoop
by croberts@fedoraproject.org
Author: croberts
Date: 2013-01-02 18:28:38 +0000 (Wed, 02 Jan 2013)
New Revision: 5627
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:
Now defaulting the owner of hadoop jobs to the current cumin user name.
Modified: branches/elephant/cumin/python/cumin/gridhadoop/datanode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-02 18:06:09 UTC (rev 5626)
+++ branches/elephant/cumin/python/cumin/gridhadoop/datanode.py 2013-01-02 18:28:38 UTC (rev 5627)
@@ -134,9 +134,6 @@
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)
@@ -154,7 +151,7 @@
if not self.errors.get(session):
binfile = self.binfile.get(session)
- owner = self.owner.get(session)
+ owner = session.app.user
hadoophost = self.hadoophost.get(session)
count = self.count.get(session)
name_node = self.nameNode.get(session)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-02 18:06:09 UTC (rev 5626)
+++ branches/elephant/cumin/python/cumin/gridhadoop/jobtracker.py 2013-01-02 18:28:38 UTC (rev 5627)
@@ -137,9 +137,6 @@
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)
@@ -157,7 +154,7 @@
if not self.errors.get(session):
binfile = self.binfile.get(session)
- owner = self.owner.get(session)
+ owner = session.app.user
hadoophost = self.hadoophost.get(session)
name_node = self.nameNode.get(session)
count = self.count.get(session)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/namenode.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2013-01-02 18:06:09 UTC (rev 5626)
+++ branches/elephant/cumin/python/cumin/gridhadoop/namenode.py 2013-01-02 18:28:38 UTC (rev 5627)
@@ -85,10 +85,7 @@
self.binfile = BinFileLoc(app, "binfile")
self.add_field(self.binfile)
-
- self.owner = Owner(app, "owner")
- self.add_field(self.owner)
-
+
self.hadoophost = HadoopHostField(app, "hadoophost")
self.add_field(self.hadoophost)
@@ -103,8 +100,8 @@
if not self.errors.get(session):
binfile = self.binfile.get(session)
- owner = self.owner.get(session)
hadoophost = self.hadoophost.get(session)
+ owner = session.app.user
self.task.invoke(session, None, (binfile, owner, hadoophost))
self.task.exit_with_redirect(session, url)
Modified: branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py
===================================================================
--- branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-02 18:06:09 UTC (rev 5626)
+++ branches/elephant/cumin/python/cumin/gridhadoop/tasktracker.py 2013-01-02 18:28:38 UTC (rev 5627)
@@ -133,10 +133,7 @@
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)
@@ -154,7 +151,7 @@
if not self.errors.get(session):
binfile = self.binfile.get(session)
- owner = self.owner.get(session)
+ owner = session.app.user
hadoophost = self.hadoophost.get(session)
count = self.count.get(session)
job_tracker = self.jobTracker.get(session)
11 years, 4 months
r5626 - branches/elephant/sage/python/sage/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-01-02 18:06:09 +0000 (Wed, 02 Jan 2013)
New Revision: 5626
Modified:
branches/elephant/sage/python/sage/aviary/aviaryoperations.py
Log:
Allow hadoop "get" methods to filter results based on owner.
The owner argument may be a list of owners.
Modified: branches/elephant/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2013-01-02 16:27:36 UTC (rev 5625)
+++ branches/elephant/sage/python/sage/aviary/aviaryoperations.py 2013-01-02 18:06:09 UTC (rev 5626)
@@ -936,8 +936,8 @@
assert callback
self._operate_on_ids(host, ids, callback, "stopNameNode")
- def get_name_node(self, host, ids, callback=None):
- return self._operate_on_ids(host, ids, callback, "getNameNode")
+ def get_name_node(self, host, ids, owner=None, callback=None):
+ return self._query_ids(host, ids, owner, 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,
@@ -946,8 +946,8 @@
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 get_data_node(self, host, ids, owner=None, callback=None):
+ return self._query_ids(host, ids, owner, callback, "getDataNode")
def start_job_tracker(self, host, nn_id, bin_file, owner, count, callback):
return self._start_node(host, nn_id, bin_file, owner, count,
@@ -956,8 +956,8 @@
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(host, ids, callback, "getJobTracker")
+ def get_job_tracker(self, host, ids, owner=None, callback=None):
+ return self._query_ids(host, ids, owner, callback, "getJobTracker")
def stop_task_tracker(self, host, ids, callback):
self._operate_on_ids(host, ids, callback, "stopTaskTracker")
@@ -966,20 +966,20 @@
return self._start_node(host, nn_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")
+ def get_task_tracker(self, host, ids, owner=None, callback=None):
+ return self._query_ids(host, ids, owner, callback, "getTaskTracker")
- def get_name_node_list(self, callback=None):
- return self._get_node_list(self.get_name_node, callback)
+ def get_name_node_list(self, owner=None, callback=None):
+ return self._get_node_list(self.get_name_node, owner, callback)
- def get_data_node_list(self, callback=None):
- return self._get_node_list(self.get_data_node, callback)
+ def get_data_node_list(self, owner=None, callback=None):
+ return self._get_node_list(self.get_data_node, owner, callback)
- def get_job_tracker_list(self, callback=None):
- return self._get_node_list(self.get_job_tracker, callback)
+ def get_job_tracker_list(self, owner=None, callback=None):
+ return self._get_node_list(self.get_job_tracker, owner, callback)
- def get_task_tracker_list(self, callback=None):
- return self._get_node_list(self.get_task_tracker, callback)
+ def get_task_tracker_list(self, owner=None, callback=None):
+ return self._get_node_list(self.get_task_tracker, owner, callback)
def _make_id(self, client, val):
@@ -1038,13 +1038,13 @@
client, meth_name, ref, bin_file, owner, count)
t.start()
- def _get_node_list(self, proc, callback):
+ def _get_node_list(self, proc, owner, callback):
try:
status = "OK"
hosts = self.get_hosts(self.resource, self.subtype)
data = []
for h in hosts:
- s, n = proc(h, [])
+ s, n = proc(h, [], owner)
if s == "OK":
data.extend(n)
except Exception, e:
@@ -1054,8 +1054,28 @@
callback(status, data)
else:
return (status, data)
-
- def _operate_on_ids(self, host, ids, callback, meth_name):
+
+ def _query_ids(self, host, ids, owner, callback, meth_name):
+ # Allow query results to be constrained by owner
+ def filter_results(results):
+ if type(owner) not in (list, tuple):
+ o = [owner]
+ else:
+ o = owner
+ res = []
+ for r in results:
+ if r.owner in o:
+ res.append(r)
+ return res
+
+ if owner is None:
+ return self._operate_on_ids(host, ids, callback, meth_name)
+ else:
+ return self._operate_on_ids(host, ids, callback, meth_name,
+ filter_results)
+
+
+ def _operate_on_ids(self, host, ids, callback, meth_name, filter_results=None):
if callback:
assert callable(callback)
@@ -1079,6 +1099,8 @@
status = _AviaryCommon._get_status(result.status)
if status == "OK" and hasattr(result, "results"):
data = result.results
+ if filter_results:
+ data = filter_results(data)
return (status, data)
if callback:
11 years, 4 months