r4676 - in trunk/cumin: python/cumin/grid python/cumin/inventory resources
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-31 18:05:25 +0000 (Thu, 31 Mar 2011)
New Revision: 4676
Modified:
trunk/cumin/python/cumin/grid/slot.py
trunk/cumin/python/cumin/grid/slotvis.py
trunk/cumin/python/cumin/grid/slotvis.strings
trunk/cumin/python/cumin/inventory/system.py
trunk/cumin/resources/slots.swf
Log:
Artificial slot vis groups when the number of groups is > 50
Various white-space tweaks.
Modified: trunk/cumin/python/cumin/grid/slot.py
===================================================================
--- trunk/cumin/python/cumin/grid/slot.py 2011-03-30 18:42:39 UTC (rev 4675)
+++ trunk/cumin/python/cumin/grid/slot.py 2011-03-31 18:05:25 UTC (rev 4676)
@@ -129,7 +129,10 @@
max_width = 400
max_png_age = 30
- max_visible_slots = 200 # start drill-down mode after this number
+
+ # start creating artificial groupings after the number of real groups
+ max_top_level_items = 49
+
def __init__(self, app, name, param, desc):
super(SlotMapPage, self).__init__(app, name)
@@ -155,9 +158,8 @@
self.expanded.all = "all"
self.add_parameter(self.expanded)
- group = Parameter(app, "agroup")
- self.groups = ListParameter(app, "group", group)
- self.add_parameter(self.groups)
+ self.group = Parameter(app, "group")
+ self.add_parameter(self.group)
self.slots = SlotDataSet(app)
@@ -224,17 +226,69 @@
map.write(writer)
return writer.to_string()
+ def split_compound_attribute(self, record, attr):
+ if "|" in attr:
+ attr_list = attr.split("|")
+ atr_list = [record[x] for x in attr_list]
+ return ":".join(atr_list)
+ return ""
+
def get_info_array(self, records, array, attr):
+ '''
+ Creates a list of record indexes for each unique value of attr
+ @param records: all the records
+ @param array: list of indexes to check
+ @param attr: the rosemary attribute to create the array for
+ '''
d = dict()
for i in array:
- atr = records[i][attr]
+ try:
+ atr = records[i][attr]
+ except KeyError:
+ atr = self.split_compound_attribute(records[i], attr)
if not atr:
atr = "Unknown %s" % attr
if not atr in d:
- d[atr] = list()
- d[atr].append(i)
+ d[atr] = {"plist": list()}
+ d[atr]["klist"] = [atr]
+ d[atr]["plist"].append(i)
return d
+ def collapse_level(self, level_dict, count):
+ collapsed = dict()
+
+ def save_bucket(low_key, key, plist, keylist):
+ if low_key is not key:
+ coll_key = "%s - %s" % (low_key, key)
+ else:
+ coll_key = low_key
+ collapsed[coll_key] = {"plist": plist,
+ "klist": keylist}
+
+ plist = list()
+ keylist = list()
+ max_edge = len(level_dict) - 1
+ bucket_size = int(max_edge / count)
+ edge = bucket_size
+ low_key = None
+ for i, key in enumerate(sorted(level_dict.keys())):
+ if not low_key:
+ low_key = key
+ plist.extend(level_dict[key]["plist"])
+ keylist.append(key)
+ if i >= edge:
+ save_bucket(low_key, key, plist, keylist)
+ low_key = None
+ plist = list()
+ keylist = list()
+ edge += bucket_size
+ if edge > max_edge:
+ edge = max_edge
+
+ if low_key:
+ save_bucket(low_key, key, plist, keylist)
+ return collapsed
+
@classmethod
def get_cat_and_group(cls, state, activity):
act = activity
@@ -274,7 +328,7 @@
return "[]"
records = self.slots.sort_records(records)
- groups = self.groups.get(session)
+ group = self.group.get(session)
slot_count = len(records)
root = Element()
@@ -288,69 +342,96 @@
root.shape_info = self.shapes
root.activity_colors = self.interiors
expanded = self.expanded.get(session)
- leaves = True
- (root.tree, root.back) = self.treeify(records, range(slot_count), groups, 0,
- expanded, leaves, slot_count, json)
-
+ root.tree = self.treeify(records, range(slot_count), group, expanded)
+ root.back = False
return "[%s]" % root.create()
- def treeify(self, records, plist, groups, level, expanded, leaves, slot_count, json):
+ def treeify(self, records, plist, group, expanded):
+ def add_branch(level_list, tree, back, group, key, slots):
+ if len(tree):
+ el = Element()
+ el.tree = tree
+ el.back = back
+ el.name = group
+ el.value = key
+ el.slots = slots
+ el.level = 0
+ level_list.append(el)
+
+ def gen_leaves(plist):
+ level_list = list()
+ for i in sorted(plist, key=lambda x:"%s%s%s" %
+ (records[x]["category_group"], records[x]["category"], records[x]["Name"])):
+ el = Element()
+ el.job_id = records[i]["JobId"] and records[i]["JobId"] or ""
+ el.activity = records[i]["Activity"] and records[i]["Activity"] or "Unknown"
+ el.state = records[i]["State"] and records[i]["State"] or "Unknown"
+ el.category = records[i]["category"]
+ el.category_group = records[i]["category_group"]
+ el.value = records[i]["Name"] and records[i]["Name"] or ""
+ el.load_avg = records[i]["LoadAvg"] and round(records[i]["LoadAvg"], 2) or 0
+ el.name = "slot"
+ el.slot_id = records[i]["_id"]
+ level_list.append(el)
+ return level_list
+
+ def gen_summary(plist):
+ # display summary info for all the slots under this grouping
+ level_list = list()
+ category_groups = self.get_cats(records, plist)
+ for category_group in sorted(category_groups):
+ el = Element()
+ el.name = "slot_info"
+ el.category = category_group
+ el.category_group = category_group
+ el.count = category_groups[category_group]["_count"]
+ try:
+ el.value = "%s.%s" % (records[plist[0]][group], category_group) # uid
+ except KeyError:
+ atr = self.split_compound_attribute(records[plist[0]], group)
+ el.value = "%s.%s" % (atr, category_group)
+ level_list.append(el)
+ return level_list
+
level_list = list()
- # leaf
- if level == len(groups):
- if leaves:
- for i in sorted(plist, key=lambda x:"%s%s%s" %
- (records[x]["category_group"], records[x]["category"], records[x]["Name"])):
- el = Element()
- el.job_id = records[i]["JobId"] and records[i]["JobId"] or ""
- el.activity = records[i]["Activity"] and records[i]["Activity"] or "Unknown"
- el.state = records[i]["State"] and records[i]["State"] or "Unknown"
- el.category = records[i]["category"]
- el.category_group = records[i]["category_group"]
- el.value = records[i]["Name"] and records[i]["Name"] or ""
- el.load_avg = records[i]["LoadAvg"] and round(records[i]["LoadAvg"], 2) or 0
- el.name = "slot"
- el.slot_id = records[i]["_id"]
- level_list.append(el)
- return (level_list, True)
- else:
- if not expanded:
- # display summary info for all the slots under this grouping
- category_groups = self.get_cats(records, plist)
- for category_group in sorted(category_groups):
- el = Element()
- el.name = "slot_info"
- el.category = category_group
- el.category_group = category_group
- el.count = category_groups[category_group]["_count"]
- el.value = "%s.%s" % (records[plist[0]][groups[level-1]], category_group) # uid
- level_list.append(el)
- return (level_list, False)
+ if not group:
+ tree = gen_leaves(plist)
+ add_branch(level_list, tree, False, "", "", len(plist))
+ return level_list
- # not a leaf
- group = groups[level]
- level_dict = self.get_info_array(records, plist, group)
+ original_level_dict = level_dict = self.get_info_array(records, plist, group)
+
+ if len(original_level_dict) > self.max_top_level_items:
+ # collapse groups into artificial sub-groups
+ level_dict = self.collapse_level(original_level_dict, self.max_top_level_items)
+
for key in sorted(level_dict):
- el = Element()
- el.name = group
- el.value = key
- el.slots = len(level_dict[key])
- el.level = level
- if level < len(groups):
- if json == "slots":
- if expanded == key:
- leaves = True
- elif expanded == "None" and key is None:
- leaves = True
- else:
- leaves = False
- (el.tree, el.back) = self.treeify(records, level_dict[key], groups, level + 1,
- expanded, leaves, slot_count, json)
-
- if len(el.tree):
- level_list.append(el)
+ tree = list()
+ if not expanded:
+ if len(level_dict) == 1:
+ # there is only one grouping. no need to make them click on it
+ tree = gen_leaves(level_dict[key]["plist"])
+ add_branch(level_list, tree, False, group, key, len(level_dict[key]["plist"]))
+ else:
+ # display the top level of groups (artificial or notural)
+ tree = gen_summary(level_dict[key]["plist"])
+ add_branch(level_list, tree, False, group, key, len(level_dict[key]["plist"]))
+ elif expanded == key:
+ # lowest level of a natural group
+ if key in original_level_dict:
+ tree = gen_leaves(level_dict[key]["plist"])
+ add_branch(level_list, tree, True, group, key, len(level_dict[key]["plist"]))
+ else:
+ # we want to display the groups that went into an atrificial sub-group
+ for original_key in level_dict[key]["klist"]:
+ tree = gen_summary(original_level_dict[original_key]["plist"])
+ add_branch(level_list, tree, True, group, original_key, len(original_level_dict[original_key]["plist"]))
+ elif expanded in level_dict[key]["klist"]:
+ # lowest level of an artificial group
+ tree = gen_leaves(original_level_dict[expanded]["plist"])
+ add_branch(level_list, tree, True, group, expanded, len(original_level_dict[expanded]["plist"]))
- return (level_list, False)
+ return level_list
class SlotMap(Widget):
def __init__(self, app, name):
Modified: trunk/cumin/python/cumin/grid/slotvis.py
===================================================================
--- trunk/cumin/python/cumin/grid/slotvis.py 2011-03-30 18:42:39 UTC (rev 4675)
+++ trunk/cumin/python/cumin/grid/slotvis.py 2011-03-31 18:05:25 UTC (rev 4676)
@@ -139,7 +139,7 @@
page.collector.set(sess, collector)
page.json.set(sess, "slots")
- page.groups.set(sess, [self.group_by.get(session)])
+ page.group.set(sess, self.group_by.get(session))
return sess.marshal()
@@ -188,6 +188,9 @@
self.add_state("System", "By system")
self.add_state("AccountingGroup", "By accounting group")
+ self.add_state("Activity|State", "By activity/state")
+ self.add_state("Arch", "By architecture")
+ self.add_state("OpSys", "By operating system")
#self.add_state("OpSys", "By opsys")
def get_click(self, session, state):
Modified: trunk/cumin/python/cumin/grid/slotvis.strings
===================================================================
--- trunk/cumin/python/cumin/grid/slotvis.strings 2011-03-30 18:42:39 UTC (rev 4675)
+++ trunk/cumin/python/cumin/grid/slotvis.strings 2011-03-31 18:05:25 UTC (rev 4676)
@@ -25,7 +25,6 @@
<div class="slot_visualization">
<div class="duration">{group_by}</div>
<div id="{id}_chart"></div>
- <div>Click and drag up and down within the list of slots to scroll</div>
</div>
<div class="slot_legend">{slot_legend}</div><div style="clear:both;"></div>
</div>
@@ -67,6 +66,8 @@
updatePoolSlotVis('{id}', "load");
}
}
+
+ // we want to drill down a level in the slot vis
function vis_expand(parent) {
if (parent == null) {
parent = "None";
@@ -74,20 +75,68 @@
var chart = cumin.getFlashChart("{id}");
var src = chart.src;
var branch = wooly.session.branch(src);
+
+ // save the value of the current expanded
+ var curExpand = "";
+ if (typeof branch.expanded != "undefined") {
+ curExpand = branch.expanded;
+ }
+
+ // expand to the level that was passed in
branch['expanded'] = parent;
+
+ // add the original expand to the end of the back list
+ var backList = [];
+ if (typeof branch.back != "undefined") {
+ backList = branch.back.split("|");
+ }
+ if (curExpand != "")
+ backList.push(curExpand);
+ if (backList.length > 0)
+ branch["back"] = backList.join("|");
+ else if (typeof branch.back != "undefined")
+ delete branch.back;
+
chart.src = branch.marshal();
updatePoolSlotVis("{id}", "load");
var myFx = new Fx.Scroll(window).toTop();
}
+
+ // we want to go back 1 level in the slot vis
function vis_back() {
var chart = cumin.getFlashChart("{id}");
var src = chart.src;
var branch = wooly.session.branch(src);
- if (typeof branch.expanded != "undefined")
- delete branch.expanded;
+
+ // get the current back list
+ var backList = [];
+ if (typeof branch.back != "undefined") {
+ backList = branch.back.split("|");
+ }
+
+ // remove the last entry from the back list
+ // and use it as the expand
+ var expand = backList.pop();
+ if (typeof expand != "undefined") {
+ branch["expanded"] = expand;
+ } else {
+ // we are back to the top level
+ if (typeof branch.expanded != "undefined")
+ delete branch.expanded;
+ }
+
+ // save the new back list
+ if (backList.length > 0) {
+ branch["back"] = backList.join("|");
+ } else {
+ if (typeof branch.back != "undefined")
+ delete branch.back;
+ }
+
chart.src = branch.marshal();
updatePoolSlotVis("{id}", "load");
}
+
function vis_treemap_over(type, value) {
var chart = cumin.getFlashChart("{id}");
if (chart) {
@@ -150,4 +199,9 @@
//]]>
</script>
-
\ No newline at end of file
+
+[SlotSelector.css]
+div.SlotSelector div.ObjectSelectorFilters {
+ padding-bottom: 0.5em;
+}
+
Modified: trunk/cumin/python/cumin/inventory/system.py
===================================================================
--- trunk/cumin/python/cumin/inventory/system.py 2011-03-30 18:42:39 UTC (rev 4675)
+++ trunk/cumin/python/cumin/inventory/system.py 2011-03-31 18:05:25 UTC (rev 4676)
@@ -136,7 +136,7 @@
page.sysimage.set(sess, system)
page.json.set(sess, "slots")
- page.groups.set(sess, [])
+ page.group.set(sess, None)
return sess.marshal()
Modified: trunk/cumin/resources/slots.swf
===================================================================
(Binary files differ)
13 years, 1 month
r4675 - trunk/cumin/etc
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-03-30 18:42:39 +0000 (Wed, 30 Mar 2011)
New Revision: 4675
Modified:
trunk/cumin/etc/cumin.conf
Log:
Add sasl-mech-list to list of default params in [common]
Modified: trunk/cumin/etc/cumin.conf
===================================================================
--- trunk/cumin/etc/cumin.conf 2011-03-30 15:56:10 UTC (rev 4674)
+++ trunk/cumin/etc/cumin.conf 2011-03-30 18:42:39 UTC (rev 4675)
@@ -13,6 +13,7 @@
[common]
# database: dbname=cumin user=cumin host=localhost
# brokers: localhost:5672
+# sasl-mech-list: [allow all available mechanisms]
# log-level: info
# log-max-mb: 10
# log-max-archives: 1
13 years, 1 month
r4674 - in trunk: cumin/bin cumin/etc cumin/python/cumin mint/python/mint
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-03-30 15:56:10 +0000 (Wed, 30 Mar 2011)
New Revision: 4674
Modified:
trunk/cumin/bin/cumin-data
trunk/cumin/bin/cumin-web
trunk/cumin/etc/cumin.conf
trunk/cumin/python/cumin/config.py
trunk/cumin/python/cumin/main.py
trunk/cumin/python/cumin/session.py
trunk/mint/python/mint/main.py
trunk/mint/python/mint/session.py
Log:
Add sasl-mech-list config parameter to cumin.conf to allow Cumin to
restrict the allowable authentication mechanism. Default is consistent
with existing behavior.
BZ692129
Modified: trunk/cumin/bin/cumin-data
===================================================================
--- trunk/cumin/bin/cumin-data 2011-03-30 14:54:16 UTC (rev 4673)
+++ trunk/cumin/bin/cumin-data 2011-03-30 15:56:10 UTC (rev 4674)
@@ -125,6 +125,8 @@
mint = Mint(model_dir, broker_uris, opts.database)
+ mint.sasl_mech_list = values.sasl_mech_list
+
mint.print_event_level = opts.print_events
mint.expire_thread.interval = values.expire_interval
Modified: trunk/cumin/bin/cumin-web
===================================================================
--- trunk/cumin/bin/cumin-web 2011-03-30 14:54:16 UTC (rev 4673)
+++ trunk/cumin/bin/cumin-web 2011-03-30 15:56:10 UTC (rev 4674)
@@ -85,6 +85,7 @@
cumin = Cumin(config.get_home(), broker_uris, opts.database,
opts.host, opts.port, values.persona)
+ cumin.sasl_mech_list = values.sasl_mech_list
cumin.debug = opts.debug
cumin.user = values.user
cumin.update_interval = values.update_interval
Modified: trunk/cumin/etc/cumin.conf
===================================================================
--- trunk/cumin/etc/cumin.conf 2011-03-30 14:54:16 UTC (rev 4673)
+++ trunk/cumin/etc/cumin.conf 2011-03-30 15:56:10 UTC (rev 4674)
@@ -1,8 +1,15 @@
# Fields in comments reflect the default values.
# Explanatory comments for some options are included
# at the end of the file.
-# All sections except master inherit from [common]
+# If a configuration section does not set a value for
+# a particular parameter, the parameter is searched for
+# in the [common] section. This allows values to be set
+# globally and then optionally overridden per section.
+# For example, to set the 'persona' value to grid for every
+# web section in the file, you may add 'persona: grid'
+# to the common section.
+
[common]
# database: dbname=cumin user=cumin host=localhost
# brokers: localhost:5672
Modified: trunk/cumin/python/cumin/config.py
===================================================================
--- trunk/cumin/python/cumin/config.py 2011-03-30 14:54:16 UTC (rev 4673)
+++ trunk/cumin/python/cumin/config.py 2011-03-30 15:56:10 UTC (rev 4674)
@@ -135,6 +135,10 @@
param = ConfigParameter(self, "brokers", str)
param.default = "amqp://localhost"
+ # Leave default set to None, which is equivalent to
+ # previous behavior
+ param = ConfigParameter(self, "sasl-mech-list", str)
+
self.log_file = ConfigParameter(self, "log-file", str)
param = ConfigParameter(self, "log-level", str)
Modified: trunk/cumin/python/cumin/main.py
===================================================================
--- trunk/cumin/python/cumin/main.py 2011-03-30 14:54:16 UTC (rev 4673)
+++ trunk/cumin/python/cumin/main.py 2011-03-30 15:56:10 UTC (rev 4674)
@@ -43,7 +43,6 @@
self.server = CuminServer(self, host, port)
self.admin = CuminAdmin(self)
-
self.add_resource_dir(os.path.join(self.home, "resources-wooly"))
self.add_resource_dir(os.path.join(self.home, "resources"))
@@ -71,6 +70,10 @@
# self.model.sql_logging_enabled = True
+ # Space separated list of sasl authentication
+ # mechanisms, according to the sasl documentation
+ self.sasl_mech_list = None
+
def server_alive(self):
return self.server.server_alive()
@@ -174,6 +177,9 @@
def start(self):
log.info("Starting %s", self)
+ # Late binding. sasl_mech_list is not needed until
+ # session is started.
+ self.session.sasl_mech_list = self.sasl_mech_list
self.session.start()
self.server.start()
Modified: trunk/cumin/python/cumin/session.py
===================================================================
--- trunk/cumin/python/cumin/session.py 2011-03-30 14:54:16 UTC (rev 4673)
+++ trunk/cumin/python/cumin/session.py 2011-03-30 15:56:10 UTC (rev 4674)
@@ -11,6 +11,7 @@
def __init__(self, app, broker_uris):
self.app = app
self.broker_uris = broker_uris
+ self.sasl_mech_list = None
self.qmf_session = None
self.qmf_brokers = list()
@@ -26,7 +27,7 @@
assert self.qmf_session
- qmf_broker = self.qmf_session.addBroker(uri)
+ qmf_broker = self.qmf_session.addBroker(uri,mechanisms=self.sasl_mech_list)
self.qmf_brokers.append(qmf_broker)
Modified: trunk/mint/python/mint/main.py
===================================================================
--- trunk/mint/python/mint/main.py 2011-03-30 14:54:16 UTC (rev 4673)
+++ trunk/mint/python/mint/main.py 2011-03-30 15:56:10 UTC (rev 4674)
@@ -27,6 +27,10 @@
self.print_event_level = 0
+ # Space separated list of sasl authentication
+ # mechanisms, according to the sasl documentation
+ self.sasl_mech_list = None
+
def check(self):
log.info("Checking %s", self)
@@ -56,6 +60,9 @@
self.update_thread.start()
+ # Late binding. sasl_mech_list is not needed until
+ # session is started.
+ self.session.sasl_mech_list = self.sasl_mech_list
self.session.start()
if self.expire_enabled:
Modified: trunk/mint/python/mint/session.py
===================================================================
--- trunk/mint/python/mint/session.py 2011-03-30 14:54:16 UTC (rev 4673)
+++ trunk/mint/python/mint/session.py 2011-03-30 15:56:10 UTC (rev 4674)
@@ -9,6 +9,7 @@
def __init__(self, app, broker_uris):
self.app = app
self.broker_uris = broker_uris
+ self.sasl_mech_list = None
self.qmf_session = None
self.qmf_brokers = list()
@@ -22,7 +23,7 @@
assert self.qmf_session
- qmf_broker = self.qmf_session.addBroker(uri)
+ qmf_broker = self.qmf_session.addBroker(uri, mechanisms=self.sasl_mech_list)
self.qmf_brokers.append(qmf_broker)
def check(self):
13 years, 1 month
r4673 - in trunk/cumin/python/cumin: . grid
by eallen@fedoraproject.org
Author: eallen
Date: 2011-03-30 14:54:16 +0000 (Wed, 30 Mar 2011)
New Revision: 4673
Modified:
trunk/cumin/python/cumin/grid/negotiator.py
trunk/cumin/python/cumin/grid/pool.strings
trunk/cumin/python/cumin/objectframe.py
trunk/cumin/python/cumin/objectframe.strings
Log:
Don't display the task summary section if there are no visible tasks
Allow a task to be marked as not visible in the page header
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2011-03-29 20:47:56 UTC (rev 4672)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2011-03-30 14:54:16 UTC (rev 4673)
@@ -422,6 +422,8 @@
super(NegotiatorEditDynamicQuota, self).__init__(app, frame)
self.form = EditDynamicQuotaForm(app, self.name, self)
+ # don't show in page summary section
+ self.visible = False
def get_title(self, session):
return ""
Modified: trunk/cumin/python/cumin/grid/pool.strings
===================================================================
--- trunk/cumin/python/cumin/grid/pool.strings 2011-03-29 20:47:56 UTC (rev 4672)
+++ trunk/cumin/python/cumin/grid/pool.strings 2011-03-30 14:54:16 UTC (rev 4673)
@@ -1,12 +1,3 @@
-[PoolView.css]
-div.PoolView div.ObjectViewSummary {
- display: none;
-}
-
-div.PoolView div.ObjectViewSummaryClear {
- margin-top: 1em;
-}
-
[PoolView.error_html]
<div id="{id}" class="{class}">
{heading}
Modified: trunk/cumin/python/cumin/objectframe.py
===================================================================
--- trunk/cumin/python/cumin/objectframe.py 2011-03-29 20:47:56 UTC (rev 4672)
+++ trunk/cumin/python/cumin/objectframe.py 2011-03-30 14:54:16 UTC (rev 4673)
@@ -28,15 +28,6 @@
self.tasks = list()
- self.summary_attributes = list()
-
- #self.add_summary_attribute(cls._qmf_update_time)
-
- def add_summary_attribute(self, attr):
- assert attr not in self.summary_attributes, attr
-
- self.summary_attributes.append(attr)
-
def init(self):
super(ObjectFrame, self).init()
@@ -145,7 +136,8 @@
self.table_tmpl = WidgetTemplate(self, "table_html")
def do_render(self, session):
- if len(self.frame.tasks) > 6:
+ visible_tasks = [x for x in self.frame.tasks if x.visible]
+ if len(visible_tasks) > 6:
writer = Writer()
self.table_tmpl.render(writer, session)
return writer.to_string()
@@ -160,8 +152,9 @@
def render_task_links(self, session, start):
writer = Writer()
- end = min(start + 6, len(self.frame.tasks))
- for task in self.frame.tasks[start:end]:
+ visible_tasks = [x for x in self.frame.tasks if x.visible]
+ end = min(start + 6, len(visible_tasks))
+ for task in visible_tasks[start:end]:
writer.write(self.link.render(session, task))
return writer.to_string()
@@ -176,11 +169,13 @@
def render_content(self, session, task):
return task.get_title(session)
-class SummaryAttributes(ObjectAttributes):
- pass
-
class SummaryTasks(ObjectTasks):
- pass
+ # don't ouput the html container if there will not be any
+ # content since the container has margins
+ def do_render(self, session):
+ visible_tasks = [x for x in self.frame.tasks if x.visible]
+ if len(visible_tasks):
+ return super(SummaryTasks, self).do_render(session)
class ObjectView(Widget):
def __init__(self, app, name, object):
@@ -272,20 +267,14 @@
def __init__(self, app, name, object):
super(ObjectViewSummary, self).__init__(app, name, object)
- attributes = self.Attributes(app, "attributes", self.object)
- self.add_child(attributes)
-
tasks = SummaryTasks(app, "tasks", self.object)
self.add_child(tasks)
def render_wide(self, session):
- if len(self.frame.tasks) > 6:
+ visible_tasks = [x for x in self.frame.tasks if x.visible]
+ if len(visible_tasks) > 6:
return "wide"
- class Attributes(SummaryAttributes):
- def get_attributes(self, session):
- return self.frame.summary_attributes
-
class DetailsAttributes(ObjectAttributes):
pass
@@ -353,6 +342,9 @@
self.frame = frame
self.frame.tasks.append(self)
+ # should this task be listed in the ObjectViewSummary section
+ self.visible = True
+
def init(self):
super(ObjectFrameTask, self).init()
Modified: trunk/cumin/python/cumin/objectframe.strings
===================================================================
--- trunk/cumin/python/cumin/objectframe.strings 2011-03-29 20:47:56 UTC (rev 4672)
+++ trunk/cumin/python/cumin/objectframe.strings 2011-03-30 14:54:16 UTC (rev 4673)
@@ -57,30 +57,11 @@
[ObjectTasksLink.html]
<li><a href="{href}">{content}</a></li>
-[SummaryAttributes.css]
-div.SummaryAttributes {
- width: 20em;
- margin: 0 0 1.5em 0;
- font-size: 0.9em;
-}
-
-div.SummaryAttributes tbody th, div.SummaryAttributes tbody td {
- padding: 0.125em 0;
-}
-
-[SummaryAttributes.html]
-<div id="{id}" class="{class}">
- <table>
- <tbody>{attributes}</tbody>
- </table>
-</div>
-
[SummaryTasks.css]
ul.SummaryTasks {
width: 15em;
- float: right;
list-style: none;
- margin: 0 0 1.5em 0;
+ margin: 0.5em 0 0 0;
}
[ObjectView.css]
@@ -109,7 +90,7 @@
div.ObjectViewSummary {
/* border-top: 1px dotted #ccc; */
- padding: 0.5em 0 0 0;
+ /* padding: 0.5em 0 0 0; */
width: 40em;
font-size: 0.9em;
}
@@ -117,14 +98,17 @@
width: 55em;
}
+div.ObjectViewHeader {
+ margin-bottom: 1em;
+}
+
[ObjectView.html]
<div id="{id}" class="{class}">
-{context}
-
-{heading}
-
-{summary}
-
+ <div class="ObjectViewHeader">
+ {context}
+ {heading}
+ {summary}
+ </div>
{body}
</div>
@@ -138,8 +122,7 @@
[ObjectViewSummary.html]
<div class="{class} {wide}">
{tasks}
- {attributes}
-</div><div class="ObjectViewSummaryClear" style="clear:both;"></div>
+</div>
[ObjectViewContext.html]
<div class="{class}">{links}</div>
13 years, 1 month
r4672 - trunk/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-03-29 20:47:56 +0000 (Tue, 29 Mar 2011)
New Revision: 4672
Modified:
trunk/cumin/bin/cumin-database
Log:
Add check-created-wait function that looks at output from psql command on failure to determine if the problem is a connection issue.
If so, retries up to 30 times with 1 second delay.
BZ681124
Modified: trunk/cumin/bin/cumin-database
===================================================================
--- trunk/cumin/bin/cumin-database 2011-03-29 17:08:41 UTC (rev 4671)
+++ trunk/cumin/bin/cumin-database 2011-03-29 20:47:56 UTC (rev 4672)
@@ -34,6 +34,19 @@
return ${PIPESTATUS[0]}
}
+function retry {
+ completed=1
+ for ((c=0; c<=$2; c++))
+ do
+ $1 && completed=0
+ if [ $completed -eq 0 ]; then
+ break
+ fi
+ sleep 1
+ done
+ return $completed
+}
+
function check-environment {
which rpm > /dev/null
@@ -86,6 +99,34 @@
}
}
+function check-created-wait {
+ for ((c=0; c<=30; c++))
+ do
+ res="$(psql -d cumin -U cumin -h localhost -c '\q' 2>&1)"
+ case $res in
+ *"could not connect"*)
+ if [ $c -eq 0 ] ; then
+ echo
+ fi
+ echo could not connect to server, retry...
+ sleep 1
+ ;;
+ "")
+ return 0
+ ;;
+ *)
+ echo "Error: The database is not created"
+ if [ "$1" != noadvice ]; then
+ echo "Hint: Run 'cumin-database create'"
+ fi
+ return 1
+ ;;
+ esac
+ done
+ echo "Error: Could not connect to server"
+ return 1
+}
+
function confirm-install {
cat <<EOF
WARNING
@@ -140,7 +181,7 @@
check-started &> /dev/null || start > /dev/null
- check-created &> /dev/null || create
+ check-created-wait &> /dev/null || create
}
function start {
@@ -166,19 +207,10 @@
# proper restart is thus simulated with condstop and start.
# Apparently condstop sometimes fails. Try up to 5 times.
- stopped=1
- for i in 1 2 3 4 5
- do
- run "/sbin/service postgresql condstop" && stopped=0
- if [ $stopped -eq 0 ] ; then
- break
- fi
- sleep 1
- done
- if [ $stopped -eq 1 ] ; then
+ retry "/sbin/service postgresql condstop" 5 || {
echo "postgres restart failed"
exit 1
- fi
+ }
/sbin/service postgresql start
}
@@ -332,7 +364,7 @@
echo "OK"
echo -n "Checking database 'cumin' ... "
- check-created $2 || exit 1
+ check-created-wait $2 || exit 1
echo "OK"
echo "The database is ready"
13 years, 1 month
r4671 - trunk/cumin/bin
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-03-29 17:08:41 +0000 (Tue, 29 Mar 2011)
New Revision: 4671
Modified:
trunk/cumin/bin/cumin-database
Log:
Give user the chance to restart the database server after configuration.
Also, in the case that configure is called and the database server is already
configured, remind the user that the database server needs to be restarted
after configuration.
BZ641406
Modified: trunk/cumin/bin/cumin-database
===================================================================
--- trunk/cumin/bin/cumin-database 2011-03-28 13:10:54 UTC (rev 4670)
+++ trunk/cumin/bin/cumin-database 2011-03-29 17:08:41 UTC (rev 4671)
@@ -169,7 +169,7 @@
stopped=1
for i in 1 2 3 4 5
do
- /sbin/service postgresql condstop && stopped=0
+ run "/sbin/service postgresql condstop" && stopped=0
if [ $stopped -eq 0 ] ; then
break
fi
@@ -221,6 +221,9 @@
if check-configured &> /dev/null; then
echo "Error: The database server is already configured"
+ echo "(Note, the server must be restarted after configuration."
+ echo " If it has not been restarted since configuration, use"
+ echo " 'cumin-database stop' and 'cumin-database start' to restart it)"
exit 1
fi
@@ -354,8 +357,13 @@
echo "The database server is initialized"
;;
configure)
- configure
- echo "The database server is configured"
+ configure && {
+ echo "The database server is configured"
+ echo -e "\nAfter configuration the server must be restarted."
+ echo -e "Would you like to restart the server now?\n"
+ get-explicit-confirmation
+ restart
+ }
;;
create)
create
13 years, 1 month
r4670 - in trunk/cumin: bin etc
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-03-28 13:10:54 +0000 (Mon, 28 Mar 2011)
New Revision: 4670
Modified:
trunk/cumin/bin/cumin-database
trunk/cumin/etc/sysvinit-cumin
Log:
Add a "noadvice" undocumented argument to cumin-database check so that if/when
detailed output is given from /etc/init.d/cumin, the user is not confused
by advice from a particular check routine. The correct thing for them to do is run cumin-database install and delegate responsibility for fixes to that script if at all possible; this is how the init.d script instructs them.
Modified: trunk/cumin/bin/cumin-database
===================================================================
--- trunk/cumin/bin/cumin-database 2011-03-28 01:54:09 UTC (rev 4669)
+++ trunk/cumin/bin/cumin-database 2011-03-28 13:10:54 UTC (rev 4670)
@@ -39,7 +39,9 @@
rpm -q postgresql-server &> /dev/null || {
echo "Error: postgresql-server is not installed"
- echo "Hint: Run 'yum install postgresql-server'"
+ if [ "$1" != noadvice ]; then
+ echo "Hint: Run 'yum install postgresql-server'"
+ fi
return 1
}
}
@@ -47,7 +49,9 @@
function check-started {
/sbin/service postgresql status &> /dev/null || {
echo "Error: The database is not running"
- echo "Hint: Run 'cumin-database start'"
+ if [ "$1" != noadvice ]; then
+ echo "Hint: Run 'cumin-database start'"
+ fi
return 1
}
}
@@ -55,7 +59,9 @@
function check-initialized {
if [[ ! -f "$pghbaconf" ]]; then
echo "Error: The database is not initialized"
- echo "Hint: Run 'cumin-database initialize'"
+ if [ "$1" != noadvice ]; then
+ echo "Hint: Run 'cumin-database initialize'"
+ fi
return 1
fi
}
@@ -63,7 +69,9 @@
function check-configured {
grep "$dbname" "$pghbaconf" &> /dev/null || {
echo "Error: The database is not configured"
- echo "Hint: Run 'cumin-database configure'"
+ if [ "$1" != noadvice ]; then
+ echo "Hint: Run 'cumin-database configure'"
+ fi
return 1
}
}
@@ -71,7 +79,9 @@
function check-created {
psql -d cumin -U cumin -h localhost -c '\q' &> /dev/null || {
echo "Error: The database is not created"
- echo "Hint: Run 'cumin-database create'"
+ if [ "$1" != noadvice ]; then
+ echo "Hint: Run 'cumin-database create'"
+ fi
return 1
}
}
@@ -303,23 +313,23 @@
case "$1" in
check)
echo -n "Checking environment ........ "
- check-environment || exit 1
+ check-environment $2 || exit 1
echo "OK"
echo -n "Checking initialization ..... "
- check-initialized || exit 1
+ check-initialized $2 || exit 1
echo "OK"
echo -n "Checking configuration ...... "
- check-configured || exit 1
+ check-configured $2 || exit 1
echo "OK"
echo -n "Checking server ............. "
- check-started || exit 1
+ check-started $2 || exit 1
echo "OK"
echo -n "Checking database 'cumin' ... "
- check-created || exit 1
+ check-created $2 || exit 1
echo "OK"
echo "The database is ready"
Modified: trunk/cumin/etc/sysvinit-cumin
===================================================================
--- trunk/cumin/etc/sysvinit-cumin 2011-03-28 01:54:09 UTC (rev 4669)
+++ trunk/cumin/etc/sysvinit-cumin 2011-03-28 13:10:54 UTC (rev 4670)
@@ -26,7 +26,7 @@
echo "Run 'cumin-database install' as root"
echo "(detailed output from cumin-database check:)"
- cumin-database check
+ cumin-database check noadvice
exit 1
}
13 years, 1 month
r4669 - in trunk/cumin: bin etc
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-03-28 01:54:09 +0000 (Mon, 28 Mar 2011)
New Revision: 4669
Modified:
trunk/cumin/bin/cumin
trunk/cumin/etc/sysvinit-cumin
Log:
Include of cumin.config has to come after setting of python path.
Tweak debug output in sysvinit-cumin
Modified: trunk/cumin/bin/cumin
===================================================================
--- trunk/cumin/bin/cumin 2011-03-28 01:32:32 UTC (rev 4668)
+++ trunk/cumin/bin/cumin 2011-03-28 01:54:09 UTC (rev 4669)
@@ -5,11 +5,12 @@
import os
import sys
import signal
-from cumin.config import *
home = os.environ.get("CUMIN_HOME", os.path.normpath("/usr/share/cumin"))
sys.path.append(os.path.join(home, "python"))
+from cumin.config import *
+
from parsley.loggingex import *
log = logging.getLogger("cumin.master")
Modified: trunk/cumin/etc/sysvinit-cumin
===================================================================
--- trunk/cumin/etc/sysvinit-cumin 2011-03-28 01:32:32 UTC (rev 4668)
+++ trunk/cumin/etc/sysvinit-cumin 2011-03-28 01:54:09 UTC (rev 4669)
@@ -22,9 +22,11 @@
cumin-database check &> /dev/null || {
# Run again with output left on for user.
- cumin-database check
echo "Cumin's database is not yet installed"
echo "Run 'cumin-database install' as root"
+
+ echo "(detailed output from cumin-database check:)"
+ cumin-database check
exit 1
}
13 years, 1 month
r4668 - in trunk/cumin: bin etc
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-03-28 01:32:32 +0000 (Mon, 28 Mar 2011)
New Revision: 4668
Modified:
trunk/cumin/bin/cumin-database
trunk/cumin/etc/sysvinit-cumin
Log:
Add another run of cumin-database check in startup script on failure
with output left on so that a user has a better idea what is wrong.
Add a retry around condstop of postgresql inside function restart in
cumin-database; postgresql condstop apparently fails sometimes. This causes
the script to exit, leaving the database install incomplete.
Modified: trunk/cumin/bin/cumin-database
===================================================================
--- trunk/cumin/bin/cumin-database 2011-03-25 19:52:13 UTC (rev 4667)
+++ trunk/cumin/bin/cumin-database 2011-03-28 01:32:32 UTC (rev 4668)
@@ -154,7 +154,21 @@
# The postgresql 8.1.22 init script violates LSB 3.1 Chapter 20.2,
# and returns 1 on a successful restart of a stopped service. A
# proper restart is thus simulated with condstop and start.
- /sbin/service postgresql condstop
+
+ # Apparently condstop sometimes fails. Try up to 5 times.
+ stopped=1
+ for i in 1 2 3 4 5
+ do
+ /sbin/service postgresql condstop && stopped=0
+ if [ $stopped -eq 0 ] ; then
+ break
+ fi
+ sleep 1
+ done
+ if [ $stopped -eq 1 ] ; then
+ echo "postgres restart failed"
+ exit 1
+ fi
/sbin/service postgresql start
}
Modified: trunk/cumin/etc/sysvinit-cumin
===================================================================
--- trunk/cumin/etc/sysvinit-cumin 2011-03-25 19:52:13 UTC (rev 4667)
+++ trunk/cumin/etc/sysvinit-cumin 2011-03-28 01:32:32 UTC (rev 4668)
@@ -21,6 +21,8 @@
}
cumin-database check &> /dev/null || {
+ # Run again with output left on for user.
+ cumin-database check
echo "Cumin's database is not yet installed"
echo "Run 'cumin-database install' as root"
exit 1
13 years, 1 month
r4667 - trunk/cumin/python/cumin/grid
by tmckay@fedoraproject.org
Author: tmckay
Date: 2011-03-25 19:52:13 +0000 (Fri, 25 Mar 2011)
New Revision: 4667
Modified:
trunk/cumin/python/cumin/grid/negotiator.py
Log:
Status code for pending negotiator task set incorrectly.
BZ690740
Modified: trunk/cumin/python/cumin/grid/negotiator.py
===================================================================
--- trunk/cumin/python/cumin/grid/negotiator.py 2011-03-25 13:53:15 UTC (rev 4666)
+++ trunk/cumin/python/cumin/grid/negotiator.py 2011-03-25 19:52:13 UTC (rev 4667)
@@ -404,7 +404,7 @@
if result.error:
raise result.error
- invoc.status_code = invoc.status
+ invoc.status_code = result.status
try:
group = group.split("_")[-1]
invoc.description = "Set %s to %s" % (group, value)
13 years, 1 month