rhmessaging commits: r2506 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-19 17:38:33 -0400 (Fri, 19 Sep 2008)
New Revision: 2506
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Put back fake Job output data
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-09-19 21:35:55 UTC (rev 2505)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-09-19 21:38:33 UTC (rev 2506)
@@ -781,8 +781,8 @@
# wait for up to 20 seconds for completion to be called
wait(predicate, timeout=20)
except Exception, e:
- self.job_output = "Unable to get file at %s. Reason: %s" % (file, e)
- #self.job_output = self.get_fake_output()
+ #self.job_output = "Unable to get file at %s. Reason: %s" % (file, e)
+ self.job_output = self.get_fake_output()
return self.job_output and escape_entity(self.job_output)
17 years, 7 months
rhmessaging commits: r2505 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-19 17:35:55 -0400 (Fri, 19 Sep 2008)
New Revision: 2505
Modified:
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/job.strings
mgmt/trunk/cumin/python/cumin/model.py
Log:
Added JobGroup Stats tab
Removed JobGroup Details tab
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-09-19 21:35:01 UTC (rev 2504)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-09-19 21:35:55 UTC (rev 2505)
@@ -204,10 +204,69 @@
self.__tabs = TabbedModeSet(app, "tabs")
self.add_child(self.__tabs)
+ self.__tabs.add_tab(JobGroupStats(app, "stats"))
self.__tabs.add_tab(JobGroupJobSet(app, "jobs"))
self.__tabs.add_tab(SystemSet(app, "systems"))
- self.__tabs.add_tab(CuminDetails(app, "details"))
+ #self.__tabs.add_tab(CuminDetails(app, "details"))
+class JobGroupStats(Widget):
+ def __init__(self, app, name):
+ super(JobGroupStats, self).__init__(app, name)
+
+ stats = JobGroupStatSet(app, "general", "general")
+ self.add_child(stats)
+
+ def render_title(self, session):
+ return "Statistics"
+
+class JobGroupStatSet(StatSet):
+ def __init__(self, app, name, category):
+ super(JobGroupStatSet, self).__init__(app, name, category)
+
+ self.jobs = Attribute(app, "jobs")
+ self.add_attribute(self.jobs)
+
+ def process(self, session):
+ group = self.frame.get_args(session)[0]
+ where_group = "custom_group = '%s'" % group.get_id()
+ value = Job.select(where_group).count()
+ self.jobs.set(session, value)
+ super(JobGroupStatSet, self).process(session)
+
+ def render_rate_text(self, session, args):
+ return "Percentage"
+
+ def render_item_name(self, session, args):
+ stat, object = args
+ return stat.name
+
+ def render_item_value(self, session, args):
+ stat, group = args
+ if stat.name == "Jobs":
+ return self.jobs.get(session)
+ else:
+ state = stat.name
+ value = self.get_value(group, state)
+ return value
+
+ def get_value(self, group, state):
+ where_group = "custom_group = '%s' \
+ and job_status = %i" % (group.get_id(),
+ JobStatusInfo.get_status_int(state))
+ return Job.select(where_group).count()
+
+ def render_item_rate(self, session, args):
+ stat, group = args
+ jobs = self.jobs.get(session)
+ state = stat.name
+ if stat.name == "Jobs":
+ value = jobs
+ else:
+ value = self.get_value(group, state)
+ percent = (value*1.0) / (jobs*1.0) * 100.0
+ return jobs and "%2.1f" % percent or "-"
+
+
class JobRemoveButton(FormButton):
def process_submit(self, session):
ids = self.parent.ids.get(session)
@@ -703,8 +762,9 @@
self.got_data = False
def completion(status, job_output):
- self.job_output = job_output["Data"]
- self.got_data = True
+ if "Data" in job_output:
+ self.job_output = job_output["Data"]
+ self.got_data = True
def predicate():
return self.got_data
@@ -720,9 +780,9 @@
job.Fetch(model.data, completion, file, start, end)
# wait for up to 20 seconds for completion to be called
wait(predicate, timeout=20)
- except:
- #self.job_output = "Unable to get file at %s" % file
- self.job_output = self.get_fake_output()
+ except Exception, e:
+ self.job_output = "Unable to get file at %s. Reason: %s" % (file, e)
+ #self.job_output = self.get_fake_output()
return self.job_output and escape_entity(self.job_output)
Modified: mgmt/trunk/cumin/python/cumin/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.strings 2008-09-19 21:35:01 UTC (rev 2504)
+++ mgmt/trunk/cumin/python/cumin/job.strings 2008-09-19 21:35:55 UTC (rev 2505)
@@ -66,7 +66,13 @@
from job as j
{sql_where}
+[JobGroupStats.html]
+ <h2>General</h2>
+ <div style="width:50%;">
+ {general}
+ </div>
+
[JobsAndGroupsTab.html]
<div class="rfloat">{phase}</div>
{group}
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-09-19 21:35:01 UTC (rev 2504)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-09-19 21:35:55 UTC (rev 2505)
@@ -1480,10 +1480,25 @@
super(CuminJobGroup, self).__init__ \
(model, "job_group", JobGroup)
+ stat = CuminStat(self, "Running")
+ stat.title = "Running Jobs"
+
+ stat = CuminStat(self, "Completed")
+ stat.title = "Completed Jobs"
+
+ stat = CuminStat(self, "Idle")
+ stat.title = "Idle Jobs"
+
+ stat = CuminStat(self, "Held")
+ stat.title = "Held Jobs"
+
action = self.Hold(self, "hold")
action.title = "Hold"
action.summary = True
+ stat = CuminStat(self, "Jobs")
+ stat.title = "Total Jobs"
+
action = self.Release(self, "release")
action.title = "Release"
action.summary = True
17 years, 7 months
rhmessaging commits: r2504 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-19 17:35:01 -0400 (Fri, 19 Sep 2008)
New Revision: 2504
Modified:
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/stat.strings
Log:
Added ability overide statistics "rate" column name
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2008-09-19 16:07:40 UTC (rev 2503)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2008-09-19 21:35:01 UTC (rev 2504)
@@ -40,6 +40,9 @@
stat, object = args
return stat.title
+ def render_rate_text(self, session, args):
+ return "Per Second"
+
def render_item_name(self, session, args):
stat, object = args
return stat.name
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2008-09-19 16:07:40 UTC (rev 2503)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2008-09-19 21:35:01 UTC (rev 2504)
@@ -81,7 +81,7 @@
<tr>
<th style="width: 50%; text-align: left;">Statistic</th>
<th style="width: 25%;">Value</th>
- <th style="width: 25%;">Per Second</th>
+ <th style="width: 25%;">{rate_text}</th>
</tr>
</thead>
<tbody>
17 years, 7 months
rhmessaging commits: r2503 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-19 12:07:40 -0400 (Fri, 19 Sep 2008)
New Revision: 2503
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Changing Fetch dictionary key to 'Data' to match actual return.
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-09-19 14:17:07 UTC (rev 2502)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-09-19 16:07:40 UTC (rev 2503)
@@ -703,7 +703,7 @@
self.got_data = False
def completion(status, job_output):
- self.job_output = job_output["JobOutput"]
+ self.job_output = job_output["Data"]
self.got_data = True
def predicate():
17 years, 7 months
rhmessaging commits: r2502 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-19 10:17:07 -0400 (Fri, 19 Sep 2008)
New Revision: 2502
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Prepare for job.Fetch
Handle case where job ad attributes contain double quotes within the value.
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-09-19 14:12:00 UTC (rev 2501)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-09-19 14:17:07 UTC (rev 2502)
@@ -380,7 +380,7 @@
return items
- def gen_items(self, session, job):
+ def get_raw_ads(self, session, job):
self.job_ads = dict()
self.got_data = False
@@ -394,20 +394,25 @@
model = self.app.model
job.GetAd(model.data, completion, self.job_ads)
- cls = self.app.model.get_class_by_object(job)
# wait for up to 20 seconds for completion to be called
succeeded = wait(predicate, timeout=20)
if not succeeded:
self.job_ads = {"": ""}
+
+ return self.job_ads
+
+ def gen_items(self, session, job):
+ job_ads = self.get_raw_ads(session, job)
+
+ cls = self.app.model.get_class_by_object(job)
# list of dictionaries
# each disctionary has:
# name:, value:, type: [, error:] [, property:] [,path:]
- return [self.gen_item(x, self.job_ads[x], cls) for x in self.job_ads]
-#TODO: handle case where completion status isn't OK
-
+ return [self.gen_item(x, job_ads[x], cls) for x in job_ads]
+#
def gen_item(self, name, value, cls, path=None, dtype=None, error=None, orig=None):
- """ Generate a dict with name, value, type, error, path, property
+ """ Generate a dict with name, value, type, error, path, property, orig
This is called with raw GetAd data and with processed data from
a form submit. With raw data, only the name and value will be present.
@@ -441,15 +446,20 @@
def get_type(self, value):
dvalue = value
- if isinstance(value, int):
- dtype = "number"
- else:
- dquote = value.split("\"")
- if len(dquote) == 3 and (not dquote[0] and not dquote[2]):
- dtype = "string"
- dvalue = dquote[1]
- else:
- dtype = "expression"
+ dtype = "string"
+ try:
+ if isinstance(value, int) or isinstance(value, float) or isinstance(value, long):
+ dtype = "number"
+ elif isinstance(value, basestring):
+ if value[:1] == "\"" and value[-1:] == "\"":
+ dtype = "string"
+ dvalue = value[1:-1]
+ else:
+ dtype = "expression"
+ elif value is None:
+ dvalue = ""
+ except:
+ pass
return dtype, dvalue
class JobPropertyRenderer(TemplateRenderer):
@@ -467,7 +477,16 @@
property = item["property"]
if property.renderer:
value = property.renderer(session, value)
- return escape_entity(str(value))
+ ret = escape_entity(str(value))
+ return self.insert_breaks(ret)
+
+ def insert_breaks(self, value):
+ subwords = list()
+ while len(value) > 40:
+ subwords.append(value[:40])
+ value = value[40:]
+ subwords.append(value)
+ return "​".join(subwords)
def render_inline_help(self, session, item):
if "property" in item:
@@ -485,7 +504,7 @@
return self.frame.get_args(session)
def render_title(self, session, job):
- return "Properties"
+ return "Attributes"
def do_get_items(self, session, args):
job = args[0]
@@ -610,20 +629,105 @@
self.out_time = Attribute(app, "out_time")
self.add_attribute(self.out_time)
+
+ self.ads = JobAdsSet(app, "ads")
+ self.add_child(self.ads)
- def render_title(self, session):
+ self.out_file = Parameter(app, "out")
+ self.add_parameter(self.out_file)
+ self.add_form_parameter(self.out_file)
+
+ self.err_file = Parameter(app, "err")
+ self.add_parameter(self.err_file)
+ self.add_form_parameter(self.err_file)
+
+ self.user_file = Parameter(app, "user")
+ self.add_parameter(self.user_file)
+ self.add_form_parameter(self.user_file)
+
+ def get_args(self, session):
+ return self.frame.get_args(session)
+
+ def render_title(self, session, *args):
return "Output"
- def render_out_time(self, session):
- return "13:14:00 Sept 16 2008"
+ def render(self, session, *args):
+ out_file = self.out_file.get(session)
+ err_file = self.err_file.get(session)
+ user_file = self.user_file.get(session)
+ if not out_file:
+ job = self.frame.get_args(session)[0]
+ items = self.ads.get_raw_ads(session, job)
+ out_file = err_file = user_file = None
+ if "Out" in items:
+ out_file = items["Out"]
+ if "Err" in items:
+ err_file = items["Err"]
+ if "UserLog" in items:
+ user_file = items["UserLog"]
- def render_tail_js(self, session):
+ # strip any double quotes surrounding file names
+ dtype, out_file = self.ads.get_type(out_file)
+ dtype, err_file = self.ads.get_type(err_file)
+ dtype, user_file = self.ads.get_type(user_file)
+
+ # remember the file names so we don't need to reget them
+ self.out_file.set(session, out_file)
+ self.err_file.set(session, err_file)
+ self.user_file.set(session, user_file)
+
+ # set title for radiotab so mouseover will display file name
+ self.which_file.set_file_name(session, "o", out_file)
+ self.which_file.set_file_name(session,"e", err_file)
+ self.which_file.set_file_name(session,"u", user_file)
+
+ if self.which_file.is_bad(out_file):
+ self.which_file.disable(session, "o")
+ if self.which_file.is_bad(err_file):
+ self.which_file.disable(session, "e")
+ if self.which_file.is_bad(user_file):
+ self.which_file.disable(session, "u")
+
+ return super(JobOutput, self).render(session, *args)
+
+ def render_out_time(self, session, *args):
+ now = datetime.now()
+ return fmt_datetime(now, sec=True)
+
+ def render_tail_js(self, session, *args):
is_tail = self.first_last.get(session) == "t"
return is_tail and "<script language=\"javascript\" type=\"text/javascript\">addEvent(window, \"load\", outputEnd);</script>" or ""
def render_the_output(self, session, *args):
+ self.job_output = None
+ self.got_data = False
- raw = """fcrawler.looksmart.com - - [26/Apr/2000:00:00:12 -0400] "GET /contacts.html HTTP/1.0" 200 4595 "-" "FAST-WebCrawler/2.1-pre2 (ashen(a)looksmart.net)"
+ def completion(status, job_output):
+ self.job_output = job_output["JobOutput"]
+ self.got_data = True
+
+ def predicate():
+ return self.got_data
+
+ first_last = self.first_last.get(session)
+ start = first_last == "t" and -1024 or 0
+ end = first_last == "t" and 0 or 1024
+ file = self.which_file.get_current_file_name(session)
+ if file:
+ try:
+ model = self.app.model
+ job = args[0]
+ job.Fetch(model.data, completion, file, start, end)
+ # wait for up to 20 seconds for completion to be called
+ wait(predicate, timeout=20)
+ except:
+ #self.job_output = "Unable to get file at %s" % file
+ self.job_output = self.get_fake_output()
+
+ return self.job_output and escape_entity(self.job_output)
+
+ def get_fake_output(self):
+ return """fcrawler.looksmart.com - - [26/Apr/2000:00:00:12 -0400] "GET /contacts.html HTTP/1.0" 200 4595 "-" "FAST-WebCrawler/2.1-pre2 (ashen(a)looksmart.net)"
fcrawler.looksmart.com - - [26/Apr/2000:00:17:19 -0400] "GET /news/news.html HTTP/1.0" 200 16716 "-" "FAST-WebCrawler/2.1-pre2 (ashen(a)looksmart.net)"
ppp931.on.bellglobal.com - - [26/Apr/2000:00:16:12 -0400] "GET /download/windows/asctab31.zip HTTP/1.0" 200 1540096 "http://www.htmlgoodies.com/downloads/freeware/webdevelopment/15.html" "Mozilla/4.7 [en]C-SYMPA (Win95; U)"
@@ -649,12 +753,8 @@
123.123.123.123 - - [26/Apr/2000:00:23:51 -0400] "GET /pics/a2hlogo.jpg HTTP/1.0" 200 4282 "http://www.jafsoft.com/asctortf/" "Mozilla/4.05 (Macintosh; I; PPC)"
123.123.123.123 - - [26/Apr/2000:00:23:51 -0400] "GET /cgi-bin/newcount?jafsof3&width=4&font=digital&noshow HTTP/1.0" 200 36 "http://www.jafsoft.com/asctortf/" "Mozilla/4.05 (Macintosh; I; PPC)"
192.168.2.20 - - [28/Jul/2006:10:27:10 -0300] "GET /cgi-bin/try/ HTTP/1.0" 200 3395"""
- return escape_entity(raw)
class FetchButton(FormButton):
- def process_submit(self, session):
- pass
-
def render_content(self, session):
return "Refresh"
@@ -664,14 +764,81 @@
self.add_state("o", "Output")
self.add_state("e", "Error")
- self.add_state("l", "UserLog")
+ self.add_state("u", "UserLog")
+ self.disabled = self.DisabledList(app, "disabled")
+ self.add_attribute(self.disabled)
+
+ self.link_titles = self.Titles(app, "link_titles")
+ self.add_attribute(self.link_titles)
+
+ class DisabledList(Attribute):
+ def get_default(self, session):
+ return list()
+
+ class Titles(Attribute):
+ def get_default(self, session):
+ return dict()
+
+ def disable(self, session, state):
+ disabled = self.disabled.get(session)
+ disabled.append(state)
+ self.disabled.set(session, disabled)
+ if state == self.get(session):
+ self.select_first_enabled(session)
+
+ def set_file_name(self, session, state, link_title):
+ link_titles = self.link_titles.get(session)
+ link_titles[state] = link_title
+ self.link_titles.set(session, link_titles)
+
+ def get_file_name(self, session, state):
+ link_titles = self.link_titles.get(session)
+ return state in link_titles and link_titles[state] or ""
+
+ def get_current_file_name(self, session):
+ state = self.get(session)
+ return self.get_file_name(session, state)
+
+ def select_first_enabled(self, session):
+ states = self.get_items(session)
+ disabled = self.disabled.get(session)
+ for state in states:
+ if not state in disabled:
+ self.set(session, state)
+ break
+
+ def render_item_link(self, session, state, id=""):
+ branch = session.branch()
+ self.set(branch, state)
+
+ title = self.get_title(state)
+ link_titles = self.link_titles.get(session)
+ link_title = state in link_titles and link_titles[state] or ""
+ disabled = self.disabled.get(session)
+ if state in disabled:
+ class_ = "disabled"
+ href = "javascript:void(0)"
+ else:
+ class_ = self.get(session) == state and "selected"
+ href = branch.marshal()
+ return fmt_link(href, title, class_, id=id, link_title=link_title)
+
+ def is_bad(self, file):
+ bad = False
+ if not file:
+ bad = True
+ elif "/dev/null" in file.lower():
+ bad = True
+ return bad
+
+
class FLSwitch(StateSwitch):
def __init__(self, app, name):
super(JobOutput.FLSwitch, self).__init__(app, name)
- self.add_state("t", "Tail")
- self.add_state("h", "Head")
+ self.add_state("t", "Tail", "Display end of file")
+ self.add_state("h", "Head", "Display beginning of file")
class JobStatus(CuminStatus):
def render_color(self, session, job):
17 years, 7 months
rhmessaging commits: r2501 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-19 10:12:00 -0400 (Fri, 19 Sep 2008)
New Revision: 2501
Modified:
mgmt/trunk/cumin/python/cumin/job.strings
Log:
Changed Properties to Attributes
Modified: mgmt/trunk/cumin/python/cumin/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.strings 2008-09-19 14:11:15 UTC (rev 2500)
+++ mgmt/trunk/cumin/python/cumin/job.strings 2008-09-19 14:12:00 UTC (rev 2501)
@@ -130,7 +130,7 @@
[JobAdsViewer.html]
<ul class="actions">
- <li><a class="nav" href="{edit_ads_url}">Edit Properties</a></li>
+ <li><a class="nav" href="{edit_ads_url}">Edit Attributes</a></li>
</ul>
<table class="CuminDetails">
<tbody>
@@ -142,7 +142,7 @@
</tbody>
</table>
<ul class="actions">
- <li><a class="nav" href="{edit_ads_url}">Edit Properties</a></li>
+ <li><a class="nav" href="{edit_ads_url}">Edit Attributes</a></li>
</ul>
[JobAdsViewer.group_html]
17 years, 7 months
rhmessaging commits: r2500 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-19 10:11:15 -0400 (Fri, 19 Sep 2008)
New Revision: 2500
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Added optional title= text to StateSwitch
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-09-19 14:10:09 UTC (rev 2499)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-09-19 14:11:15 UTC (rev 2500)
@@ -490,10 +490,12 @@
self.__states = list()
self.__titles = dict()
+ self.__hover = dict()
- def add_state(self, state, title):
+ def add_state(self, state, title, hover=""):
self.__states.append(state)
self.__titles[state] = title
+ self.__hover[state] = hover
if self.__param.default is None:
self.__param.default = state
@@ -507,15 +509,19 @@
def get_items(self, session):
return self.__states
+
+ def get_title(self, state):
+ return state in self.__titles and self.__titles[state]
def render_item_link(self, session, state, id=""):
branch = session.branch()
self.set(branch, state)
title = self.__titles[state]
+ hover = self.__hover[state]
class_ = self.get(session) == state and "selected"
- return fmt_link(branch.marshal(), title, class_, id=id)
+ return fmt_link(branch.marshal(), title, class_, id=id, link_title=hover)
class GroupSwitch(StateSwitch):
def __init__(self, app, name):
17 years, 7 months
rhmessaging commits: r2499 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-19 10:10:09 -0400 (Fri, 19 Sep 2008)
New Revision: 2499
Modified:
mgmt/trunk/cumin/python/cumin/page.strings
Log:
Added styles for disabled radiotab buttons
Modified: mgmt/trunk/cumin/python/cumin/page.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/page.strings 2008-09-19 14:08:54 UTC (rev 2498)
+++ mgmt/trunk/cumin/python/cumin/page.strings 2008-09-19 14:10:09 UTC (rev 2499)
@@ -308,6 +308,13 @@
content: url(resource?name=radio-button-checked.png);
}
+ul.radiotabs li a.disabled:before {
+ content: url(resource?name=radio-button.png);
+}
+ul.radiotabs li a.disabled {
+ color: #666666;
+}
+
div.statuslight {
float: left;
width: 1em;
17 years, 7 months
rhmessaging commits: r2498 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-09-19 10:08:54 -0400 (Fri, 19 Sep 2008)
New Revision: 2498
Modified:
mgmt/trunk/cumin/python/cumin/formats.py
Log:
Added optional argument to display seconds with fmt_datetime
Added optional argument to display title= on a link formated with fmt_link
Modified: mgmt/trunk/cumin/python/cumin/formats.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/formats.py 2008-09-18 17:32:03 UTC (rev 2497)
+++ mgmt/trunk/cumin/python/cumin/formats.py 2008-09-19 14:08:54 UTC (rev 2498)
@@ -6,9 +6,12 @@
def fmt_count(count):
return "<span class=\"count\">(%i)</span>" % count
-def fmt_datetime(dtime):
+def fmt_datetime(dtime, sec=False):
if dtime:
- tstamp = dtime.strftime("%d %b %Y %H:%M")
+ if sec:
+ tstamp = dtime.strftime("%d %b %Y %H:%M:%S")
+ else:
+ tstamp = dtime.strftime("%d %b %Y %H:%M")
else:
tstamp = fmt_none()
@@ -112,9 +115,10 @@
else:
return string
-def fmt_link(href, content, class_="", id=""):
- return "<a %s href=\"%s\"%s>%s</a>" % \
- (id and "id=\"%s\"" % id or "", href, class_ and " class=\"%s\" " % class_ or " ", content)
+def fmt_link(href, content, class_="", id="", link_title=""):
+ return "<a %s href=\"%s\"%s%s>%s</a>" % \
+ (id and "id=\"%s\"" % id or "", href, class_ and " class=\"%s\" " % class_ or " ",
+ link_title and "title=\"%s\"" % link_title or "", content)
def fmt_olink(session, object, selected=False, name=None):
if name is None:
17 years, 7 months
rhmessaging commits: r2497 - in store/trunk/cpp/lib: jrnl and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2008-09-18 13:32:03 -0400 (Thu, 18 Sep 2008)
New Revision: 2497
Modified:
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/MessageStoreImpl.cpp
store/trunk/cpp/lib/MessageStoreImpl.h
store/trunk/cpp/lib/jrnl/rmgr.cpp
Log:
Backport to trunk of r.2496: Fix for BZ458053: "txtest failures when broker killed during transfer phase". Fixed problem with certain out-of-order libaio read returns in the read pipeline which causes this bug.
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2008-09-18 17:31:21 UTC (rev 2496)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2008-09-18 17:32:03 UTC (rev 2497)
@@ -95,7 +95,7 @@
agent->addObject(_mgmtObject);
}
- log(LOG_NOTICE, "Instantiation");
+ log(LOG_NOTICE, "Created");
std::ostringstream oss;
oss << "Journal directory = \"" << journalDirectory << "\"; Base file name = \"" << journalBaseFilename << "\"";
log(LOG_DEBUG, oss.str());
Modified: store/trunk/cpp/lib/MessageStoreImpl.cpp
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.cpp 2008-09-18 17:31:21 UTC (rev 2496)
+++ store/trunk/cpp/lib/MessageStoreImpl.cpp 2008-09-18 17:32:03 UTC (rev 2497)
@@ -635,11 +635,14 @@
try
{
+ long rcnt = 0L; // recovered msg count
+ long idcnt = 0L; // in-doubt msg count
u_int64_t thisHighestRid = 0;
jQueue->recover(numJrnlFiles, jrnlFsizeSblks, wCacheNumPages, wCachePgSizeSblks, &prepared, thisHighestRid, key.id); // start recovery
if (thisHighestRid > highestRid)
highestRid = thisHighestRid;
- recoverMessages(txn, registry, queue, prepared, messages);
+ recoverMessages(txn, registry, queue, prepared, messages, rcnt, idcnt);
+ QPID_LOG(info, "Recovered queue \"" << queueName << "\": " << rcnt << " messages recovered; " << idcnt << " messages in-doubt.");
jQueue->recover_complete(); // start journal.
} catch (const journal::jexception& e) {
THROW_STORE_EXCEPTION(std::string("Queue ") + queueName + ": recoverQueues() failed: " + e.what());
@@ -742,7 +745,9 @@
qpid::broker::RecoveryManager& recovery,
qpid::broker::RecoverableQueue::shared_ptr& queue,
txn_list& prepared,
- message_index& messages)
+ message_index& messages,
+ long& rcnt,
+ long& idcnt)
{
size_t preambleLength = sizeof(u_int32_t)/*header size*/;
@@ -798,6 +803,7 @@
PreparedTransaction::list::iterator i = PreparedTransaction::getLockedPreparedTransaction(prepared, queue->getPersistenceId(), dtok.rid());
if (i == prepared.end()) { // not in prepared list
+ rcnt++;
queue->recover(msg);
} else {
u_int64_t rid = dtok.rid();
@@ -805,13 +811,14 @@
TplRecoverMapCitr citr = tplRecoverMap.find(xid);
if (citr == tplRecoverMap.end()) THROW_STORE_EXCEPTION("XID not found in tplRecoverMap");
- // deq present in prepared list, this xid is part of incomplete txn commit/abort
+ // deq present in prepared list: this xid is part of incomplete txn commit/abort
// or this is a 1PC txn that must be rolled forward
if (citr->second.deq_flag || !citr->second.tpc_flag) {
if (jc->is_enqueued(rid, true)) {
// Enqueue is non-tx, dequeue tx
assert(jc->is_locked(rid)); // This record MUST be locked by a txn dequeue
if (!citr->second.commit_flag) {
+ rcnt++;
queue->recover(msg); // recover message in abort case only
}
} else {
@@ -825,10 +832,12 @@
else if (!j->_enq_flag && j->_drid == rid) deq = true;
}
if (enq && !deq && citr->second.commit_flag) {
+ rcnt++;
queue->recover(msg); // recover txn message in commit case only
}
}
} else {
+ idcnt++;
messages[rid] = msg;
}
}
Modified: store/trunk/cpp/lib/MessageStoreImpl.h
===================================================================
--- store/trunk/cpp/lib/MessageStoreImpl.h 2008-09-18 17:31:21 UTC (rev 2496)
+++ store/trunk/cpp/lib/MessageStoreImpl.h 2008-09-18 17:32:03 UTC (rev 2497)
@@ -140,7 +140,9 @@
qpid::broker::RecoveryManager& recovery,
qpid::broker::RecoverableQueue::shared_ptr& queue,
txn_list& locked,
- message_index& prepared);
+ message_index& prepared,
+ long& rcnt,
+ long& idcnt);
qpid::broker::RecoverableMessage::shared_ptr getExternMessage(qpid::broker::RecoveryManager& recovery,
uint64_t mId,
unsigned& headerSize);
Modified: store/trunk/cpp/lib/jrnl/rmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-09-18 17:31:21 UTC (rev 2496)
+++ store/trunk/cpp/lib/jrnl/rmgr.cpp 2008-09-18 17:32:03 UTC (rev 2497)
@@ -135,7 +135,7 @@
aio_cycle(); // check if rd AIOs returned; initiate new reads if possible
if (_jc->unflushed_dblks() > 0)
_jc->flush();
- else
+ else if (!_aio_evt_rem)
return RHM_IORES_EMPTY;
}
if (_page_cb_arr[_pg_index]._state != AIO_COMPLETE)
@@ -370,7 +370,7 @@
aio_cycle(); // check if any AIOs have returned
if (_jc->unflushed_dblks() > 0)
_jc->flush();
- else
+ else if (!_aio_evt_rem)
return RHM_IORES_EMPTY;
}
17 years, 7 months