r5738 - trunk/cumin/resources
by croberts@fedoraproject.org
Author: croberts
Date: 2013-03-14 14:48:42 +0000 (Thu, 14 Mar 2013)
New Revision: 5738
Modified:
trunk/cumin/resources/app.js
Log:
Additional tweak for bz 911503 that is needed to reset charts to their original size after being expanded to full page.
Modified: trunk/cumin/resources/app.js
===================================================================
--- trunk/cumin/resources/app.js 2013-03-12 21:36:19 UTC (rev 5737)
+++ trunk/cumin/resources/app.js 2013-03-14 14:48:42 UTC (rev 5738)
@@ -318,14 +318,17 @@
oFullPage.originalParent.appendChild(oFullPage);
oIcon.setProperty("title", "Full Page");
setFullpageParam(false, oFullPage);
- $(oFullPage).getElement(".jqplotgraph").setProperty("style", "width:400px;height:150px;");
+ var origStyle = $(oFullPage).getElement(".jqplotgraph").getProperty("origStyle");
+ $(oFullPage).getElement(".jqplotgraph").setProperty("style", origStyle);
drawSingleChart($(oFullPage).getElement(".jqplotgraph"), false);
var onrestore = oFullPage.onrestore;
if (onrestore) onrestore();
window.scrollTo(oFullPage.origScroll.x, oFullPage.origScroll.y);
} else {
// make it full page
-
+ var origStyle = $(oFullPage).getElement(".jqplotgraph").getProperty("style");
+ $(oFullPage).getElement(".jqplotgraph").setProperty("origStyle", origStyle);
+
oBack.style.display = "block";
oBack.style.height = Math.max($(document.body).getCoordinates().height, window.getScrollSize().y) + "px";
document.body.style.height = "100%";
11 years, 1 month
r5737 - in trunk: mint/python/mint/aviary sage/python/sage/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-03-12 21:36:19 +0000 (Tue, 12 Mar 2013)
New Revision: 5737
Modified:
trunk/mint/python/mint/aviary/collector.py
trunk/sage/python/sage/aviary/aviaryoperations.py
Log:
Switch slot query to use paging
Modified: trunk/mint/python/mint/aviary/collector.py
===================================================================
--- trunk/mint/python/mint/aviary/collector.py 2013-03-11 13:38:20 UTC (rev 5736)
+++ trunk/mint/python/mint/aviary/collector.py 2013-03-12 21:36:19 UTC (rev 5737)
@@ -96,7 +96,8 @@
if self.no_summary:
# We're going to get everything from classads, we
# did not ask for summaries
- ids = [o.id for o in objs if o.status.code == "OK"]
+ ids = [o.id for o in objs \
+ if not hasattr(o, "status_code") or o.status.code == "OK"]
else:
# We'll get things from classads and/or summaries.
# Save the summaries in a dictionary so we can look them up
@@ -115,7 +116,8 @@
log.debug("Queueing updates, summary based")
for i in ids:
update = self.make_update(i, [], summaries)
- self.ep.app.update_thread.enqueue(update)
+ if update:
+ self.ep.app.update_thread.enqueue(update)
else:
# get the classad in addition to the ids and summaries
log.debug("Gathering attributes")
@@ -128,7 +130,8 @@
if ad.status.code == "OK":
update = self.make_update(ad.id,
ad.ad.attrs, summaries)
- self.ep.app.update_thread.enqueue(update)
+ if update:
+ self.ep.app.update_thread.enqueue(update)
# Remember the objects that we have just seen
for id in ids:
@@ -474,6 +477,11 @@
def __init__(self, ep):
super(QuerySlot, self).__init__(ep)
+ # Initialize the name index for paging
+ # We are extending the basic collector endpoint here
+ self.ep.idx = None
+ self.ep.size = 8
+
self.names = ["CondorPlatform",
"CondorVersion",
"DaemonStartTime",
@@ -568,5 +576,23 @@
return SlotObj(self.ep.id, id)
def get_objects(self, no_summary):
- return self.ep.app.aviary_ops.get_slot(self.ep.url, no_summary=no_summary)
+ if self.ep.idx is None:
+ mode = None
+ else:
+ mode = "AFTER"
+ status, ids = self.ep.app.aviary_ops.get_slot_id(self.ep.url,
+ self.ep.size,
+ mode,
+ self.ep.idx,
+ no_summary=no_summary)
+
+ if ids.remaining == 0:
+ self.ep.idx = None
+ else:
+ self.ep.idx = ids.results[-1].id
+
+ # We can't return the whole thing because the caller expects
+ # only a list, not the "remaining"
+ return status, ids.results
+
Modified: trunk/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- trunk/sage/python/sage/aviary/aviaryoperations.py 2013-03-11 13:38:20 UTC (rev 5736)
+++ trunk/sage/python/sage/aviary/aviaryoperations.py 2013-03-12 21:36:19 UTC (rev 5737)
@@ -1302,8 +1302,8 @@
def get_master_id(self, host, page_size, mode=None, offset=None):
return self._get_obj_by_id(host, page_size, mode, offset, "getMasterID")
- def get_slot_id(self, host, page_size, mode=None, offset=None):
- return self._get_obj_by_id(host, page_size, mode, offset, "getSlotID")
+ def get_slot_id(self, host, page_size, mode=None, offset=None, no_summary=False):
+ return self._get_obj_by_id(host, page_size, mode, offset, "getSlotID", no_summary)
def get_attributes(self, host, ids, names=[]):
if not type(ids) in (list, tuple):
@@ -1340,7 +1340,7 @@
self.client_pool.return_object(client)
return res;
- def _get_obj_by_id(self, host, page_size, mode, offset, meth_name):
+ def _get_obj_by_id(self, host, page_size, mode, offset, meth_name, no_summary=False):
assert mode is None or mode in ("BEFORE", "AFTER")
@@ -1366,14 +1366,19 @@
self._setup_client(client,
self.servers,
host,
- "getMasterID")
+ meth_name)
+ if no_summary:
+ client.set_enable_attributes(True)
+ client.set_attributes({"includeSummaries": "false"})
+
res = self._call_sync(self.call_client_retry,
my_process_results,
client,
- "getMasterID",
+ meth_name,
page_size, mode, resID)
+ client.set_enable_attributes(False)
self.client_pool.return_object(client)
return res;
11 years, 1 month
r5736 - in trunk/cumin/python/cumin: . grid
by croberts@fedoraproject.org
Author: croberts
Date: 2013-03-11 13:38:20 +0000 (Mon, 11 Mar 2013)
New Revision: 5736
Modified:
trunk/cumin/python/cumin/grid/dashboard.py
trunk/cumin/python/cumin/stat.py
trunk/cumin/python/cumin/stat.strings
Log:
Fixing BZ 911503 by shrinking the negotiator throughput chart a bit horizontally. Also added plumbing to make chart sizing more flexible.
Modified: trunk/cumin/python/cumin/grid/dashboard.py
===================================================================
--- trunk/cumin/python/cumin/grid/dashboard.py 2013-03-08 19:47:59 UTC (rev 5735)
+++ trunk/cumin/python/cumin/grid/dashboard.py 2013-03-11 13:38:20 UTC (rev 5736)
@@ -841,6 +841,8 @@
chart = self.ThroughputChart(app, "timeseries", throughput_stats.negotiator)
chart.duration.param.default = "3600"
chart.stats = self.attrs[:-1]
+ chart.width = 350
+ chart.container_width = 28
self.add_child(chart)
class ThroughputChart(StatFlashChart):
Modified: trunk/cumin/python/cumin/stat.py
===================================================================
--- trunk/cumin/python/cumin/stat.py 2013-03-08 19:47:59 UTC (rev 5735)
+++ trunk/cumin/python/cumin/stat.py 2013-03-11 13:38:20 UTC (rev 5736)
@@ -146,6 +146,9 @@
self.chart_type = None
self.title = None
self.colors = None
+ self.height = 150
+ self.width = 400
+ self.container_width = 33 #em not px
self.stats_tmpl = WidgetTemplate(self, "stat_html")
@@ -205,10 +208,13 @@
return getattr(cls, self.stats[0]).title
def render_width(self, session):
- return 360
+ return "%spx" % self.width
def render_height(self, session):
- return 100
+ return "%spx" % self.height
+
+ def render_container_width(self, session):
+ return "%sem" % self.container_width
class ReportingStatValueChart(StatValueChart):
def __init__(self, app, name, cls):
@@ -278,12 +284,6 @@
params = self.get_href_params(session)
return escape_entity("flashpage.html?" + ";".join(params))
- def render_width(self, session):
- return 360
-
- def render_height(self, session):
- return 120
-
def render_id_nodots(self, session):
return self.render_id(session).replace(".", "_")
@@ -309,10 +309,10 @@
return escape_entity("flashpage.html?" + ";".join(params))
def render_width(self, session):
- return 360
+ return "%spx" % self.width
def render_height(self, session):
- return 120
+ return "%spx" % self.height
def render_id_nodots(self, session):
return self.render_id(session).replace(".", "_")
Modified: trunk/cumin/python/cumin/stat.strings
===================================================================
--- trunk/cumin/python/cumin/stat.strings 2013-03-08 19:47:59 UTC (rev 5735)
+++ trunk/cumin/python/cumin/stat.strings 2013-03-11 13:38:20 UTC (rev 5736)
@@ -141,7 +141,6 @@
font-size: 0.9em;
margin: 0 0 1.5em 0;
position: relative;
- width: 33em;
}
div.StatValueChart div.duration {
@@ -300,7 +299,7 @@
[StatValueChart.html]
<div>
-<div class="StatValueChart{fullpageable}" id="{id}">
+<div class="StatValueChart{fullpageable}" id="{id}" style="width:{container_width}">
<h2>{title}</h2>
<div class="duration">{duration}</div>
@@ -325,14 +324,14 @@
[StatFlashChart.html]
<div>
- <div class="StatValueChart{fullpageable}" id="{id}">
+ <div class="StatValueChart{fullpageable}" id="{id}" style="width:{container_width}">
<h2>{title}</h2>
<div class="duration" style="float:left;">{duration}</div>
<div style="clear:both;"></div>
<div>
<!-- don't put this data url inside the holder div, jqplot will kill it on a zoom -->
<a rel="api" type="application/json" href="{href}" style="display:none">Data</a>
- <div id="{id_nodots}_chart" class="jqplotgraph leftlegend" style="height:150px;width:400px;">
+ <div id="{id_nodots}_chart" class="jqplotgraph leftlegend" style="height:{height};width:{width};">
<div class="loading" style="display:none;"><span>Loading...</span></div>
</div>
</div>
@@ -349,7 +348,7 @@
<div>
<!-- don't put this data url inside the holder div, jqplot will kill it on a zoom -->
<a rel="api" type="application/json" href="{href}" style="display:none">Data</a>
- <div id="{id_nodots}_chart" class="jqplotgraph leftlegend" style="height:150px;width:400px;">
+ <div id="{id_nodots}_chart" class="jqplotgraph leftlegend" style="height:{height};width:{width};">
<div class="loading" style="display:none;"><span>Loading...</span></div>
</div>
</div>
11 years, 1 month
r5735 - trunk/mint/python/mint/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-03-08 19:47:59 +0000 (Fri, 08 Mar 2013)
New Revision: 5735
Modified:
trunk/mint/python/mint/aviary/work.py
Log:
Fix time calculation error in WaitList
Modified: trunk/mint/python/mint/aviary/work.py
===================================================================
--- trunk/mint/python/mint/aviary/work.py 2013-03-07 20:11:17 UTC (rev 5734)
+++ trunk/mint/python/mint/aviary/work.py 2013-03-08 19:47:59 UTC (rev 5735)
@@ -137,7 +137,7 @@
# for the first item on the list
if self.waiting:
d = self.waiting[0][0] - datetime.now()
- s = d.days * 86400 + d.seconds
+ s = d.days * 86400.0 + d.microseconds / 1000000.0 + d.seconds
else:
s = None
if s is None or s > 0:
@@ -149,7 +149,7 @@
# See if something finished...
if self.waiting and \
- datetime.now() > self.waiting[0][0]:
+ datetime.now() >= self.waiting[0][0]:
work = self.waiting.pop(0)[1]
self.ready_queue.put(work)
work = None
11 years, 1 month
r5734 - in trunk: mint/python/mint/aviary sage/python/sage sage/python/sage/aviary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-03-07 20:11:17 +0000 (Thu, 07 Mar 2013)
New Revision: 5734
Modified:
trunk/mint/python/mint/aviary/endpoints.py
trunk/mint/python/mint/aviary/locator.py
trunk/mint/python/mint/aviary/session.py
trunk/mint/python/mint/aviary/sysimage.py
trunk/sage/python/sage/aviary/aviaryoperations.py
trunk/sage/python/sage/util.py
Log:
Generalize locator thread handling of multiple endpoint providers.
Add wallaroo as an endpoint provider.
Modified: trunk/mint/python/mint/aviary/endpoints.py
===================================================================
--- trunk/mint/python/mint/aviary/endpoints.py 2013-03-06 21:55:02 UTC (rev 5733)
+++ trunk/mint/python/mint/aviary/endpoints.py 2013-03-07 20:11:17 UTC (rev 5734)
@@ -95,8 +95,8 @@
return work
class WallarooEndpoint(Endpoint):
- def __init__(self, url, factory):
- super(WallarooEndpoint, self).__init__(url, None)
+ def __init__(self, url, id, factory):
+ super(WallarooEndpoint, self).__init__(url, id)
self.url = url
self.app = factory.app
@@ -159,7 +159,7 @@
def _make_wallaroo_endpoint(self, url=None, id=None):
if not url:
url = self.app.wallaroo_host
- return WallarooEndpoint(url, self)
+ return WallarooEndpoint(url, id, self)
def make_endpoint(self, url, id):
try:
Modified: trunk/mint/python/mint/aviary/locator.py
===================================================================
--- trunk/mint/python/mint/aviary/locator.py 2013-03-06 21:55:02 UTC (rev 5733)
+++ trunk/mint/python/mint/aviary/locator.py 2013-03-07 20:11:17 UTC (rev 5734)
@@ -7,13 +7,13 @@
log = logging.getLogger("mint.aviary")
class LocatorThread(MintBlockingDaemonThread):
- def __init__(self, aviary_ops, foreman, endpoint_factory):
+ def __init__(self, data_providers, foreman, endpoint_factory):
# We don't care about app for this thread,
# at least not currently
super(LocatorThread, self).__init__(None)
- self.aviary_ops = aviary_ops
+ self.data_providers = data_providers
self.foreman = foreman
self.ep_fact = endpoint_factory
self.daemon = True
@@ -35,16 +35,16 @@
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())
+ def gather_endpoints(endpoint_types):
+ ends = []
+ for provider in self.data_providers:
+ ends.extend(provider.get_endpoints_list(endpoint_types))
+ return ends
endpoints = dict()
while not self.stop_requested:
try:
- ends = self.aviary_ops.get_endpoints_list(endpoint_types)
+ ends = gather_endpoints(endpoint_types)
except Exception:
import traceback
message = traceback.format_exc()
@@ -52,7 +52,9 @@
block()
continue
- locs = dict([[e.location[0], e.id] for e in ends])
+ locs = dict([[(e.id.name,
+ e.id.resource,
+ e.id.sub_type), e] for e in ends])
loc_keys = set(locs.keys())
# the endpoints that we already know about
@@ -75,7 +77,8 @@
del endpoints[e]
for e in new_endpoints:
- endpoints[e] = self.ep_fact.make_endpoint(e, locs[e])
+ endpoints[e] = self.ep_fact.make_endpoint(locs[e].location[0],
+ locs[e].id)
self.foreman.add_work(endpoints[e].get_work_list())
block()
Modified: trunk/mint/python/mint/aviary/session.py
===================================================================
--- trunk/mint/python/mint/aviary/session.py 2013-03-06 21:55:02 UTC (rev 5733)
+++ trunk/mint/python/mint/aviary/session.py 2013-03-07 20:11:17 UTC (rev 5734)
@@ -4,6 +4,7 @@
from endpoints import EndpointFactory
from locator import LocatorThread
from datetime import timedelta
+from sage.util import SynthEndpoint, ResourceID
log = logging.getLogger("mint.aviary.session")
@@ -44,12 +45,22 @@
self.foreman = Foreman(num_workers=8)
+ # This class stores which types of endpoints we want to poll
+ # and knows what queries we want to make for each endpoint we find.
+ # The locator thread uses this class and the data_providers below
+ # to find valid endpoints and generate work for the Foreman.
endpoint_factory = EndpointFactory(self.app,
classes,
poll_delta=timedelta(days=64),
history_delta=timedelta(weeks=52))
- self.locatorThread = LocatorThread(self.app.aviary_ops,
+ # These objects return the raw list of known data providers that
+ # can be polled for data. The locator thread will poll them
+ # for data providers (contrained by endpoint type)
+ data_providers = (self.app.aviary_ops,
+ WallarooEndpoints(self.app.wallaroo_host))
+
+ self.locatorThread = LocatorThread(data_providers,
self.foreman,
endpoint_factory)
@@ -63,3 +74,18 @@
self.locatorThread.stop()
self.locatorThread.join()
log.info("Stopped %s", self)
+
+class WallarooEndpoints(object):
+ def __init__(self, wallaroo_host):
+ self.wallaroo_host = wallaroo_host
+
+ def get_endpoints_list(self, endpoint_types):
+ ends = []
+ if ("WALLAROO","META") in endpoint_types:
+ res_id = ResourceID("WALLAROO",
+ sub_type="META",
+ name=self.wallaroo_host)
+ url_strs = [self.wallaroo_host]
+ ends.append(SynthEndpoint(res_id,
+ url_strs))
+ return ends
Modified: trunk/mint/python/mint/aviary/sysimage.py
===================================================================
--- trunk/mint/python/mint/aviary/sysimage.py 2013-03-06 21:55:02 UTC (rev 5733)
+++ trunk/mint/python/mint/aviary/sysimage.py 2013-03-07 20:11:17 UTC (rev 5734)
@@ -1,8 +1,12 @@
+import wallaroo
from work import Work
from datetime import datetime
from mint.update import AviaryUpdate
-import wallaroo
+from requests.exceptions import ConnectionError, HTTPError
+import logging
+log = logging.getLogger("mint.aviary.sysimage")
+
class SysimageID(object):
def __init__(self, name):
self.resource = "WALLAROO"
@@ -42,14 +46,15 @@
# transform it into a WallarooMetaUpdate
# enqueue it
if self.connection is None:
- try:
- self.connection = wallaroo.client.ConnectionMeta(host=self.ep.url)
- except:
- pass
+ self.connection = wallaroo.client.ConnectionMeta(host=self.ep.url)
- if self.connection:
+ try:
data = self.connection.fetch_json_resource("/meta/sysinfo/grid9.lab.bos.redhat.com")
+ except (ConnectionError, HTTPError), e:
+ log.debug("Sysimage: wallaroo client fetch_json_resource failed %s" % str(e))
+ data = None
+ if data:
obj = SysimageObj(data)
update = AviaryUpdate(self.ep.app.model,
obj,
Modified: trunk/sage/python/sage/aviary/aviaryoperations.py
===================================================================
--- trunk/sage/python/sage/aviary/aviaryoperations.py 2013-03-06 21:55:02 UTC (rev 5733)
+++ trunk/sage/python/sage/aviary/aviaryoperations.py 2013-03-07 20:11:17 UTC (rev 5734)
@@ -12,7 +12,7 @@
from threading import Lock
from suds import *
from sage.util import MethodResult, CallSync, CallThread, host_list,\
- parse_URL, get_datadir
+ parse_URL, get_datadir, SynthEndpoint, ResourceID
from sage.catalog import Catalog
from aviarylocator import AviaryLocator
from clients import ClientPool, TransportFactory
@@ -245,21 +245,6 @@
self._lock.release()
return res
-class ResourceID(object):
- def __init__(self, resource="COLLECTOR", pool="", name="",
- address="", sub_type="", birthdate=None):
- self.resource = resource
- self.pool = pool
- self.name = name
- self.address = address
- self.sub_type = sub_type
- self.birthdate = birthdate
-
-class Fake_Endpoint(object):
- def __init__(self, resource_id, url_list):
- self.id = resource_id
- self.location = url_list
-
class FixedServerList(BaseServerList):
'''
Query a fixed server list for Aviary endpoints.
@@ -307,7 +292,7 @@
for host, urls in self.servers.iteritems():
res_id = ResourceID(self.resource, sub_type=self.subtype, name=host)
url_strs = [str(u) for u in urls]
- ep = Fake_Endpoint(res_id, url_strs)
+ ep = SynthEndpoint(res_id, url_strs)
endpoints.append(ep)
return endpoints
Modified: trunk/sage/python/sage/util.py
===================================================================
--- trunk/sage/python/sage/util.py 2013-03-06 21:55:02 UTC (rev 5733)
+++ trunk/sage/python/sage/util.py 2013-03-07 20:11:17 UTC (rev 5734)
@@ -353,3 +353,18 @@
# Hmm, well, just return the first one since we're
# going to get an error anyway.
return datadir[0]
+
+class ResourceID(object):
+ def __init__(self, resource="COLLECTOR", pool="", name="",
+ address="", sub_type="", birthdate=None):
+ self.resource = resource
+ self.pool = pool
+ self.name = name
+ self.address = address
+ self.sub_type = sub_type
+ self.birthdate = birthdate
+
+class SynthEndpoint(object):
+ def __init__(self, resource_id, url_list):
+ self.id = resource_id
+ self.location = url_list
11 years, 1 month
r5733 - in trunk: cumin/python/cumin cumin/python/cumin/grid mint/python/mint rosemary/python/rosemary
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-03-06 21:55:02 +0000 (Wed, 06 Mar 2013)
New Revision: 5733
Modified:
trunk/cumin/python/cumin/grid/submission.py
trunk/cumin/python/cumin/main.py
trunk/cumin/python/cumin/util.py
trunk/cumin/python/cumin/widgets.py
trunk/mint/python/mint/update.py
trunk/rosemary/python/rosemary/model.py
Log:
Remove some more unnecessary code.
Modified: trunk/cumin/python/cumin/grid/submission.py
===================================================================
--- trunk/cumin/python/cumin/grid/submission.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/cumin/python/cumin/grid/submission.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -82,7 +82,7 @@
table = cls.sql_table
fmt = "(%s > now() - interval '10 days' or %s > 0 or %s > 0 or %s > 0)"
- args = (table._qmf_update_time.identifier,
+ args = (table.QDate.identifier,
table.Idle.identifier,
table.Running.identifier,
table.Held.identifier)
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/cumin/python/cumin/main.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -395,9 +395,6 @@
col = self.NameColumn(app, cls.Name.name, cls.Name, cls._id, None)
self.add_column(col)
-# col = self.DurationColumn(app, cls._qmf_create_time.name,
-# cls._qmf_create_time)
-
col = self.DurationColumn(app, cls.QDate.name, cls.QDate)
self.add_column(col)
self.set_default_sort_column(col)
Modified: trunk/cumin/python/cumin/util.py
===================================================================
--- trunk/cumin/python/cumin/util.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/cumin/python/cumin/util.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -55,25 +55,6 @@
if dt is not None:
return mktime(dt.timetuple())
-def parse_broker_addr(string):
- addr = string.split(":")
-
- if len(addr) > 1:
- host, port = addr[0], int(addr[1])
- else:
- host, port = addr[0], 5672
-
- return host, port
-
-def is_active(obj):
- 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):
- return True
-
class Identifiable(object):
def __init__(self, id=None):
self.id = id
Modified: trunk/cumin/python/cumin/widgets.py
===================================================================
--- trunk/cumin/python/cumin/widgets.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/cumin/python/cumin/widgets.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -1499,105 +1499,6 @@
self.classes.add(nsession, cls._name)
self.agents.add(nsession, obj._qmf_object_id)
-class IncrementalSearchInput(StringInput, ItemSet):
- def __init__(self, app, name, field_param):
- super(IncrementalSearchInput, self).__init__(app, name)
-
- self.disabled_tmpl = WidgetTemplate(self, "disabled_html")
- self.field = field_param
-
- def do_get_items(self, session):
- return ()
-
- def render_name(self, session):
- return self.field.path
-
- def do_render(self, session, *args):
- if self.disabled:
- writer = Writer()
-
- self.disabled_tmpl.render(writer, session, *args)
-
- return writer.to_string()
- else:
- return super(IncrementalSearchInput, self).do_render(session, *args)
-
-class BaseBindingInput(IncrementalSearchInput):
- def __init__(self, app, name, field_param):
- super(BaseBindingInput, self).__init__(app, name, field_param)
-
- def render_item_content(self, session, field):
- return xml_escape(field.name) or "Default"
-
- def render_value(self, session):
- if self.disabled:
- field = self.form.object.get(session)
- return fmt_shorten(field.get_formatted_value("name", escape=True),
- pre=36, post=4, spanify=False)
- else:
- input_value = self.param.get(session)
- return input_value and xml_escape(input_value) or ""
-
- def base_get_items(self, session, objects):
- obj_list = []
- if not self.disabled:
- obj_list_full = sorted_by(list(objects))
-
- delta = timedelta(days=3)
- for _obj in obj_list_full:
- if (_obj._qmf_update_time > (datetime.now() - delta)):
- obj_list.append(_obj)
-
- return obj_list
-
-class BindingAddTask(ObjectFrameTask):
- def get_title(self, session):
- return "Add binding"
-
- def do_invoke(self, invoc, obj, queue, exchange, key, args):
- session = self.app.model.get_session_by_object(obj)
- session.exchange_bind(queue=queue, exchange=exchange,
- binding_key=key, arguments=args)
- session.sync()
-
- invoc.end()
-
-class QueueBindingField(ScalarField):
- def __init__(self, app, name, queue):
- super(QueueBindingField, self).__init__(app, name, None)
-
- self.input = QueueInput(app, "input", queue)
- self.add_child(self.input)
-
- def render_title(self, session):
- return "Queue"
-
-class ExchangeBindingField(ScalarField):
- def __init__(self, app, name, exchange):
- super(ExchangeBindingField, self).__init__(app, name, None)
-
- self.input = ExchangeInput(app, "input", exchange)
- self.add_child(self.input)
-
- def render_title(self, session):
- return "Exchange"
-
-class QueueInput(BaseBindingInput):
- def do_get_items(self, session):
- cls = self.app.model.org_apache_qpid_broker.Queue
- queue = self.form.object.get(session)
- vhostid = queue._vhostRef_id
- queues = cls.get_selection(session.cursor, _vhostRef_id=vhostid)
- return self.base_get_items(session, queues)
-
-class ExchangeInput(BaseBindingInput):
- def do_get_items(self, session):
- cls = self.app.model.org_apache_qpid_broker.Exchange
- obj = self.form.object.get(session)
- vhostid = obj._class._name == "Vhost" and obj._id or obj._vhostRef_id
- exchanges = cls.get_selection(session.cursor, _vhostRef_id=vhostid)
- return self.base_get_items(session, exchanges)
-
class TopTable(ObjectTable):
def __init__(self, app, name, cls):
super(TopTable, self).__init__(app, name, cls)
Modified: trunk/mint/python/mint/update.py
===================================================================
--- trunk/mint/python/mint/update.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/mint/python/mint/update.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -311,7 +311,6 @@
obj = cls.create_object(cursor)
obj._qmf_agent_id = self.get_agent_id()
obj._qmf_object_id = self.get_object_id()
- obj._qmf_create_time = create_time
obj._qmf_update_time = update_time
object_columns = list()
@@ -322,7 +321,6 @@
object_columns.append(table._id)
object_columns.append(table._qmf_agent_id)
object_columns.append(table._qmf_object_id)
- object_columns.append(table._qmf_create_time)
object_columns.append(table._qmf_update_time)
self.process_properties(obj, object_columns, cursor)
Modified: trunk/rosemary/python/rosemary/model.py
===================================================================
--- trunk/rosemary/python/rosemary/model.py 2013-03-06 20:29:21 UTC (rev 5732)
+++ trunk/rosemary/python/rosemary/model.py 2013-03-06 21:55:02 UTC (rev 5733)
@@ -673,19 +673,10 @@
self._qmf_object_id = RosemaryHeader(self, name, sql_text)
self._qmf_object_id.title = "Object ID"
- name = "_qmf_create_time"
- self._qmf_create_time = RosemaryHeader(self, name, sql_timestamp)
- self._qmf_create_time.title = "Create Time"
-
name = "_qmf_update_time"
self._qmf_update_time = RosemaryHeader(self, name, sql_timestamp)
self._qmf_update_time.title = "Update Time"
- name = "_qmf_delete_time"
- self._qmf_delete_time = RosemaryHeader(self, name, sql_timestamp)
- self._qmf_delete_time.title = "Delete Time"
- self._qmf_delete_time.optional = True
-
# Default timestamp field for Qmf objects will be _qmf_update_time
self.timestamp = "_qmf_update_time"
@@ -1226,7 +1217,6 @@
def fake_qmf_values(self):
self._qmf_agent_id = "__rosemary__"
self._qmf_object_id = str(datetime.now())
- self._qmf_create_time = datetime.now()
self._qmf_update_time = datetime.now()
class RosemaryNotFound(Exception):
11 years, 1 month
r5732 - trunk/cumin/python/cumin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-03-06 20:29:21 +0000 (Wed, 06 Mar 2013)
New Revision: 5732
Modified:
trunk/cumin/python/cumin/config.py
Log:
Fix wallaroo host default
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2013-03-06 20:00:18 UTC (rev 5731)
+++ trunk/cumin/python/cumin/config.py 2013-03-06 20:29:21 UTC (rev 5732)
@@ -203,7 +203,7 @@
param.default = True
param = ConfigParameter(self, "wallaroo-host", str)
- param.default = "http://localhost"
+ param.default = "localhost"
class CuminDataConfigSection(BrokeredConfigSection):
def __init__(self, config, name, strict_section=False):
11 years, 1 month
r5731 - in trunk: cumin/bin cumin/model cumin/python/cumin mint/python/mint mint/python/mint/aviary
by tmckay@fedoraproject.org
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]
11 years, 1 month
FYI, trunk renamed to trunk_qmf and tmckay branch renamed to trunk
by Trevor McKay
Hi all,
Just a heads up that the svn trunk was renamed and replaced with the
tmckay branch. If you have working directories on trunk, you'll need to
retarget them to trunk_qmf (if you have changes you're working on), or
svn update, or simply checkout again in a new directory.
This change is part of the Cumin migration to condor-aviary for object
discovery, and removal of QMF as a data source for Cumin. Swapping out
the branches after a merge to tmckay and a graphical diff was the
simplest way to preserve the old trunk and move the new source in from
the tmckay branch.
Best,
Trev
11 years, 1 month
r5730 - / branches
by tmckay@fedoraproject.org
Author: tmckay
Date: 2013-03-06 02:18:46 +0000 (Wed, 06 Mar 2013)
New Revision: 5730
Added:
trunk/
Removed:
branches/tmckay/
Log:
Swap the tmckay branch in for trunk.
The old trunk has been moved to trunk_qmf
11 years, 1 month