Author: tmckay
Date: 2013-03-06 20:00:18 +0000 (Wed, 06 Mar 2013)
New Revision: 5731
Added:
trunk/mint/python/mint/aviary/sysimage.py
Modified:
trunk/cumin/bin/cumin-data
trunk/cumin/model/rosemary.xml
trunk/cumin/model/sesame.xml
trunk/cumin/python/cumin/config.py
trunk/mint/python/mint/aviary/endpoints.py
trunk/mint/python/mint/aviary/locator.py
trunk/mint/python/mint/main.py
Log:
Initial support for wallaroo meta data to replace sesame
Modified: trunk/cumin/bin/cumin-data
===================================================================
--- trunk/cumin/bin/cumin-data 2013-03-06 02:18:46 UTC (rev 5730)
+++ trunk/cumin/bin/cumin-data 2013-03-06 20:00:18 UTC (rev 5731)
@@ -49,6 +49,11 @@
# Defautl is True. Undocumented.
mint.aviary_prefer_condor = values.aviary_prefer_condor
+ if values.wallaroo_host == "None":
+ values.wallaroo_host = None
+
+ mint.wallaroo_host = values.wallaroo_host
+
return mint
if __name__ == "__main__":
Modified: trunk/cumin/model/rosemary.xml
===================================================================
--- trunk/cumin/model/rosemary.xml 2013-03-06 02:18:46 UTC (rev 5730)
+++ trunk/cumin/model/rosemary.xml 2013-03-06 20:00:18 UTC (rev 5731)
@@ -164,10 +164,6 @@
<title>%(nodeName)s</title>
</object>
- <property name="uuid">
- <title>System ID</title>
- </property>
-
<property name="nodeName">
<title>Host</title>
</property>
Modified: trunk/cumin/model/sesame.xml
===================================================================
--- trunk/cumin/model/sesame.xml 2013-03-06 02:18:46 UTC (rev 5730)
+++ trunk/cumin/model/sesame.xml 2013-03-06 20:00:18 UTC (rev 5731)
@@ -1,10 +1,8 @@
<schema package="com.redhat.sesame">
<class name="Sysimage">
- <property name="uuid" index="y" type="uuid"
access="RC" desc="UUID of System Image"/>
-
<property name="osName" type="sstr" access="RO"
desc="Operating System Name"/>
- <property name="nodeName" type="sstr" access="RO"
desc="Node Name"/>
+ <property name="nodeName" index="y" type="sstr"
access="RO" desc="Node Name"/>
<property name="release" type="sstr"
access="RO"/>
<property name="version" type="sstr"
access="RO"/>
<property name="machine" type="sstr"
access="RO"/>
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2013-03-06 02:18:46 UTC (rev 5730)
+++ trunk/cumin/python/cumin/config.py 2013-03-06 20:00:18 UTC (rev 5731)
@@ -202,6 +202,9 @@
param = ConfigParameter(self, "aviary-prefer-condor", bool)
param.default = True
+ param = ConfigParameter(self, "wallaroo-host", str)
+ param.default = "http://localhost"
+
class CuminDataConfigSection(BrokeredConfigSection):
def __init__(self, config, name, strict_section=False):
super(CuminDataConfigSection, self).__init__(config, name,
@@ -226,9 +229,6 @@
# param = ConfigParameter(self, "auth-proxy", bool)
# param.default = False
- param = ConfigParameter(self, "wallaroo-host", str)
- param.default = "http://localhost"
-
param = ConfigParameter(self, "wallaroo-refresh", int)
param.default = 60
Modified: trunk/mint/python/mint/aviary/endpoints.py
===================================================================
--- trunk/mint/python/mint/aviary/endpoints.py 2013-03-06 02:18:46 UTC (rev 5730)
+++ trunk/mint/python/mint/aviary/endpoints.py 2013-03-06 20:00:18 UTC (rev 5731)
@@ -3,6 +3,7 @@
from submissions import QuerySubmissionsBefore, QuerySubmissionsAfter
from collector import QueryCollector, QueryNegotiator, QuerySubmitter, \
QueryScheduler, QuerySlot
+from sysimage import QueryWallarooMeta
class Endpoint(object):
def __init__(self, url, id):
@@ -93,6 +94,16 @@
return work
+class WallarooEndpoint(Endpoint):
+ def __init__(self, url, factory):
+ super(WallarooEndpoint, self).__init__(url, None)
+
+ self.url = url
+ self.app = factory.app
+
+ def get_work_list(self):
+ return [QueryWallarooMeta(self)]
+
class EndpointFactory(object):
def __init__(self, app, classes, poll_delta, history_delta):
'''
@@ -105,35 +116,36 @@
self.app = app
self.classes = classes
- # For now we only support com.redhat.grid so
- # make a class list without package names
self.abbrev_classes = [c[1] for c in self.classes \
- if c[0] == "com.redhat.grid"]
+ if c[0] in ("com.redhat.grid",
+ "com.redhat.sesame")]
self.poll_delta = poll_delta
self.history_delta = history_delta
self.type_map = \
{("CUSTOM","QUERY_SERVER"):
self._make_submission_endpoint,
- ("COLLECTOR", "POOL"): self._make_collector_endpoint}
+ ("COLLECTOR", "POOL"): self._make_collector_endpoint,
+ ("WALLAROO", "META"): self._make_wallaroo_endpoint}
def get_endpoint_types(self):
- # This routine maps Rosemary class names to Aviary
+ # This routine maps Rosemary class names to
# endpoint types (resource, sub_type) so a locator class can know
# what types of endpoints to report
- classes_to_aviary = \
+ classes_to_endpoints = \
{"Collector": ("COLLECTOR", "POOL"),
"Negotiator": ("COLLECTOR", "POOL"),
"Scheduler": ("COLLECTOR", "POOL"),
"Submitter": ("COLLECTOR", "POOL"),
"Slot": ("COLLECTOR", "POOL"),
- "Submission": ("CUSTOM", "QUERY_SERVER")}
+ "Submission": ("CUSTOM", "QUERY_SERVER"),
+ "Sysimage": ("WALLAROO", "META")}
endpoints = set()
for c in self.abbrev_classes:
try:
- endpoints.add(classes_to_aviary[c])
+ endpoints.add(classes_to_endpoints[c])
except:
pass
return list(endpoints)
@@ -144,6 +156,11 @@
def _make_submission_endpoint(self, url, id):
return SubmissionEndpoint(url, id, self)
+ def _make_wallaroo_endpoint(self, url=None, id=None):
+ if not url:
+ url = self.app.wallaroo_host
+ return WallarooEndpoint(url, self)
+
def make_endpoint(self, url, id):
try:
return self.type_map[(id.resource, id.sub_type)](url, id)
Modified: trunk/mint/python/mint/aviary/locator.py
===================================================================
--- trunk/mint/python/mint/aviary/locator.py 2013-03-06 02:18:46 UTC (rev 5730)
+++ trunk/mint/python/mint/aviary/locator.py 2013-03-06 20:00:18 UTC (rev 5731)
@@ -35,6 +35,12 @@
self._condition.wait(self.interval_secs)
self._condition.release()
+ # There is no dynamic discovery for the wallaroo url.
+ # For now, just create the endpoint here and add the
+ # work list to the foreman so that it is polled
+ wallaroo = self.ep_fact._make_wallaroo_endpoint()
+ self.foreman.add_work(wallaroo.get_work_list())
+
endpoints = dict()
while not self.stop_requested:
try:
Added: trunk/mint/python/mint/aviary/sysimage.py
===================================================================
--- trunk/mint/python/mint/aviary/sysimage.py (rev 0)
+++ trunk/mint/python/mint/aviary/sysimage.py 2013-03-06 20:00:18 UTC (rev 5731)
@@ -0,0 +1,61 @@
+from work import Work
+from datetime import datetime
+from mint.update import AviaryUpdate
+import wallaroo
+
+class SysimageID(object):
+ def __init__(self, name):
+ self.resource = "WALLAROO"
+ self.subtype = "META"
+ self.name = name
+
+class SysimageObj(object):
+
+ types = {"memTotal": int,
+ "swapTotal": int,
+ "memFree": int,
+ "swapFree": int,
+ "loadAverage1Min": float,
+ "loadAverage5Min": float,
+ "loadAverage10Min": float,
+ "procTotal": int,
+ "procRunning": int}
+
+ def __init__(self, data):
+ self.id = SysimageID(data["nodeName"])
+
+ for k,v in data.iteritems():
+ if k in self.types:
+ setattr(self, k, self.types[k](v))
+ else:
+ setattr(self, k, v)
+
+class QueryWallarooMeta(Work):
+ def __init__(self, ep):
+ super(QueryWallarooMeta, self).__init__()
+ self.ep = ep
+ self.connection = None
+
+ def do_the_job(self, foreman):
+
+ # query wallaroo for the node meta data
+ # transform it into a WallarooMetaUpdate
+ # enqueue it
+ if self.connection is None:
+ try:
+ self.connection = wallaroo.client.ConnectionMeta(host=self.ep.url)
+ except:
+ pass
+
+ if self.connection:
+ data =
self.connection.fetch_json_resource("/meta/sysinfo/grid9.lab.bos.redhat.com")
+
+ obj = SysimageObj(data)
+ update = AviaryUpdate(self.ep.app.model,
+ obj,
+ self.ep.app.model.com_redhat_sesame.Sysimage)
+ self.ep.app.update_thread.enqueue(update)
+
+
+ def completed(self):
+ return self.ep.abandoned
Modified: trunk/mint/python/mint/main.py
===================================================================
--- trunk/mint/python/mint/main.py 2013-03-06 02:18:46 UTC (rev 5730)
+++ trunk/mint/python/mint/main.py 2013-03-06 20:00:18 UTC (rev 5731)
@@ -52,6 +52,9 @@
self.aviary_root_cert = ""
self.aviary_domain_verify=True
self.aviary_locator = ""
+
+ # Wallaroo interface for inventory data
+ self.wallaroo_host = ""
# For development use only
self.aviary_suds_logs = False
@@ -85,7 +88,8 @@
self.model.com_redhat_grid.Negotiator,
self.model.com_redhat_grid.Submitter,
self.model.com_redhat_grid.Scheduler,
- self.model.com_redhat_grid.Slot]
+ self.model.com_redhat_grid.Slot,
+ self.model.com_redhat_sesame.Sysimage]
# supported_classes = [self.model.com_redhat_grid.Submitter,
# self.model.com_redhat_grid.Scheduler]