rhmessaging commits: r3653 - mgmt/trunk/wooly/python/wooly.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-09-30 10:08:03 -0400 (Wed, 30 Sep 2009)
New Revision: 3653
Modified:
mgmt/trunk/wooly/python/wooly/sql.py
Log:
Move the lower-level sql machinery into a reusable superclass
Modified: mgmt/trunk/wooly/python/wooly/sql.py
===================================================================
--- mgmt/trunk/wooly/python/wooly/sql.py 2009-09-28 21:27:04 UTC (rev 3652)
+++ mgmt/trunk/wooly/python/wooly/sql.py 2009-09-30 14:08:03 UTC (rev 3653)
@@ -5,16 +5,58 @@
strings = StringCatalog(__file__)
log = logging.getLogger("wooly.sql")
-class SqlDataSet(object):
+class SqlOperation(object):
def __init__(self, app):
- super(SqlDataSet, self).__init__()
+ super(SqlOperation, self).__init__()
self.app = app
sql_string = self.get_string("sql")
+ self.sql_tmpl = ObjectTemplate(self, sql_string)
+
+ # XXX instead of this, make the lookup logic on Widget generic and
+ # use it here as well
+ def get_string(self, key):
+ cls = self.__class__
+ module = sys.modules[cls.__module__]
+ strs = module.__dict__.get("strings")
+
+ if strs:
+ return strs.get(cls.__name__ + "." + key)
+
+ def get_connection(self, session):
+ pass
+
+ def do_execute(self, session, sql):
+ conn = self.get_connection(session)
+
+ if not conn:
+ raise Exception("Database error")
+
+ cursor = conn.cursor()
+
+ log.debug("Query: \n%s", sql)
+
+ cursor.execute(sql)
+
+ return cursor
+
+ def execute(self, session):
+ sql = self.render_sql(session)
+
+ return self.do_execute(session, sql)
+
+ def render_sql(self, session):
+ writer = Writer()
+ self.sql_tmpl.render(writer, session)
+ return writer.to_string()
+
+class SqlDataSet(SqlOperation):
+ def __init__(self, app):
+ super(SqlDataSet, self).__init__(app)
+
count_sql_string = self.get_string("count_sql")
- self.sql_tmpl = ObjectTemplate(self, sql_string)
self.count_sql_tmpl = ObjectTemplate(self, count_sql_string)
self.where_exprs = SessionAttribute(self, "where")
@@ -29,16 +71,6 @@
exprs = self.where_exprs.get(session)
exprs.append(expr % args)
- # XXX instead of this, make the lookup logic on Widget generic and
- # use it here as well
- def get_string(self, key):
- cls = self.__class__
- module = sys.modules[cls.__module__]
- strs = module.__dict__.get("strings")
-
- if strs:
- return strs.get(cls.__name__ + "." + key)
-
def get_connection(self, session):
pass
15 years, 3 months
rhmessaging commits: r3652 - in mgmt/trunk/cumin/python/cumin: usergrid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-09-28 17:27:04 -0400 (Mon, 28 Sep 2009)
New Revision: 3652
Modified:
mgmt/trunk/cumin/python/cumin/main.py
mgmt/trunk/cumin/python/cumin/main.strings
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings
Log:
Change formatting for overview views
Modified: mgmt/trunk/cumin/python/cumin/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/main.py 2009-09-28 18:44:17 UTC (rev 3651)
+++ mgmt/trunk/cumin/python/cumin/main.py 2009-09-28 21:27:04 UTC (rev 3652)
@@ -143,9 +143,6 @@
def __init__(self, app, name):
super(OverviewView, self).__init__(app, name)
- heading = self.Heading(app, "heading")
- self.add_child(heading)
-
notice = self.ManagementServerNotice(app, "notice")
self.add_child(notice)
Modified: mgmt/trunk/cumin/python/cumin/main.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/main.strings 2009-09-28 18:44:17 UTC (rev 3651)
+++ mgmt/trunk/cumin/python/cumin/main.strings 2009-09-28 21:27:04 UTC (rev 3652)
@@ -15,8 +15,6 @@
[OverviewView.html]
<div class="oblock OverviewView">
- {heading}
-
{notice}
<table>
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2009-09-28 18:44:17 UTC (rev 3651)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2009-09-28 21:27:04 UTC (rev 3652)
@@ -80,12 +80,8 @@
return list()
def do_get_items(self, session):
- items = list()
+ return zip(self.stats, self.get_values(session))
- values = self.get_values(session)
-
- return zip(self.stats, values)
-
def render_item_title(self, session, item):
stat, value = item
return stat.get_title(session)
Modified: mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/widgets.py 2009-09-28 18:44:17 UTC (rev 3651)
+++ mgmt/trunk/cumin/python/cumin/usergrid/widgets.py 2009-09-28 21:27:04 UTC (rev 3652)
@@ -55,22 +55,12 @@
def __init__(self, app, name, user):
super(OverviewView, self).__init__(app, name)
- heading = self.Heading(app, "heading")
- self.add_child(heading)
-
self.stats = UserJobStatSet(self.app, "jobs", user)
self.add_child(self.stats)
self.stats = UserSlotStatSet(self.app, "slots", user)
self.add_child(self.stats)
- class Heading(CuminHeading):
- def render_title(self, session):
- return "Overview"
-
- def render_icon_href(self, session):
- return "resource?name=action-36.png"
-
class UserSubmissionSet(SubmissionSet):
def __init__(self, app, name, user):
super(UserSubmissionSet, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings 2009-09-28 18:44:17 UTC (rev 3651)
+++ mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings 2009-09-28 21:27:04 UTC (rev 3652)
@@ -1,13 +1,26 @@
+[OverviewView.css]
+table.OverviewView h2 > img {
+ margin: 0 0.2em 0 0;
+ vertical-align: bottom;
+}
+
[OverviewView.html]
-{heading}
-
-<table class="twocol">
+<table class="twocol OverviewView">
<tbody>
<tr>
<td>
- <h2>Jobs</h2>
+ <h2>
+ <img src="resource?name=job-20.png"/>
+ Jobs
+ </h2>
+
{jobs}
- <h2>Slots</h2>
+
+ <h2>
+ <img src="resource?name=pool-20.png"/>
+ Slots
+ </h2>
+
{slots}
</td>
<td>
15 years, 3 months
rhmessaging commits: r3651 - in mgmt/trunk/cumin/python/cumin: usergrid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-09-28 14:44:17 -0400 (Mon, 28 Sep 2009)
New Revision: 3651
Added:
mgmt/trunk/cumin/python/cumin/usergrid/model.py
mgmt/trunk/cumin/python/cumin/usergrid/model.strings
Modified:
mgmt/trunk/cumin/python/cumin/model.py
mgmt/trunk/cumin/python/cumin/stat.py
mgmt/trunk/cumin/python/cumin/stat.strings
mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings
Log:
* Introduce a new stat widget that can handle queried data rather
than only data from sqlobject data
* Likewise, introduce a statistic object to the metadata that can
handle queried data
* Add stats tables to the usergrid overview
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2009-09-28 17:28:24 UTC (rev 3650)
+++ mgmt/trunk/cumin/python/cumin/model.py 2009-09-28 18:44:17 UTC (rev 3651)
@@ -770,6 +770,24 @@
writer.write("<stat name=\"%s\" value=\"%s\" rate=\"%s\"/>" \
% (self.name, value, rate))
+class CuminStatistic(object):
+ formatters = {
+ None: lambda x: fmt_none(),
+ float: lambda x: "%0.2d" % x
+ }
+
+ def __init__(self, name):
+ self.name = name
+
+ def get_title(self, session):
+ return self.name
+
+ def format_value(self, session, value):
+ try:
+ return self.formatters[type(value)](value)
+ except KeyError:
+ return value
+
class CuminClass(object):
def __init__(self, model, name, mint_class):
self.model = model
Modified: mgmt/trunk/cumin/python/cumin/stat.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.py 2009-09-28 17:28:24 UTC (rev 3650)
+++ mgmt/trunk/cumin/python/cumin/stat.py 2009-09-28 18:44:17 UTC (rev 3651)
@@ -66,6 +66,38 @@
return stat.rate_html(object)
+class NewStatSet(ItemSet):
+ def __init__(self, app, name):
+ super(NewStatSet, self).__init__(app, name)
+
+ self.stats = list()
+ self.update_enabled = True
+
+ def render_rate_text(self, session):
+ return "Per second"
+
+ def get_values(self, session):
+ return list()
+
+ def do_get_items(self, session):
+ items = list()
+
+ values = self.get_values(session)
+
+ return zip(self.stats, values)
+
+ def render_item_title(self, session, item):
+ stat, value = item
+ return stat.get_title(session)
+
+ def render_item_name(self, session, item):
+ stat, value = item
+ return stat.name
+
+ def render_item_value(self, session, item):
+ stat, value = item
+ return stat.format_value(session, value)
+
class DurationSwitch(StateSwitch):
def __init__(self, app, name):
super(DurationSwitch, self).__init__(app, name)
Modified: mgmt/trunk/cumin/python/cumin/stat.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/stat.strings 2009-09-28 17:28:24 UTC (rev 3650)
+++ mgmt/trunk/cumin/python/cumin/stat.strings 2009-09-28 18:44:17 UTC (rev 3651)
@@ -53,6 +53,61 @@
<td class="ralign"> {item_rate}</td>
</tr>
+[NewStatSet.css]
+table.NewStatSet {
+ width: 100%;
+ border-collapse: collapse;
+ margin: 1em 0;
+}
+
+table.NewStatSet tr {
+ border-top: 1px dotted #ccc;
+}
+
+table.NewStatSet td, table.NewStatSet th {
+ padding: 0.35em 0.5em;
+ font-weight: normal;
+}
+
+table.NewStatSet th {
+ color: #444;
+}
+
+table.NewStatSet thead th {
+ font-style: italic;
+ font-size: 0.9em;
+ text-align: right;
+}
+
+table.NewStatSet tbody th {
+ text-align: left;
+}
+
+table.NewStatSet td {
+ text-align: right;
+}
+
+[NewStatSet.html]
+<table id="{id}" class="NewStatSet">
+ <col style="width: 50%; text-align: left"/>
+ <col style="width: 50%"/>
+ <thead>
+ <tr>
+ <th style="text-align: left">Statistic</th>
+ <th>Value</th>
+ </tr>
+ </thead>
+ <tbody>
+ {items}
+ </tbody>
+</table>
+
+[NewStatSet.item_html]
+<tr class="item">
+ <th>{item_title}</th>
+ <td class="ralign"> {item_value}</td>
+</tr>
+
[StatValueChart.css]
div.StatValueChart {
font-size: 0.9em;
@@ -73,6 +128,7 @@
div.StatValueChart object {
margin: 0 0 0 1em;
}
+
div.StatValueChart img.Loading {
opacity: 0.5;
cursor: wait;
Added: mgmt/trunk/cumin/python/cumin/usergrid/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/model.py (rev 0)
+++ mgmt/trunk/cumin/python/cumin/usergrid/model.py 2009-09-28 18:44:17 UTC (rev 3651)
@@ -0,0 +1,37 @@
+from wooly.sql import *
+
+strings = StringCatalog(__file__)
+
+class Object(object):
+ pass
+
+class UserSqlOperation(SqlOperation):
+ def __init__(self, app, user):
+ super(UserSqlOperation, self).__init__(app)
+
+ self.user = user
+
+ def render_user_name(self, session):
+ return self.user.get(session).name
+
+ def get_connection(self, session):
+ return self.app.model.get_sql_connection()
+
+ def get_object(self, session):
+ cursor = self.execute(session)
+
+ record = cursor.fetchone()
+ description = cursor.description
+
+ obj = Object()
+
+ for value, metadata in zip(record, description):
+ setattr(obj, metadata[0], value)
+
+ return obj
+
+class LoadUserJobStats(UserSqlOperation):
+ pass
+
+class LoadUserSlotStats(UserSqlOperation):
+ pass
Added: mgmt/trunk/cumin/python/cumin/usergrid/model.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/model.strings (rev 0)
+++ mgmt/trunk/cumin/python/cumin/usergrid/model.strings 2009-09-28 18:44:17 UTC (rev 3651)
@@ -0,0 +1,23 @@
+[LoadUserJobStats.sql]
+select
+ sum(c.running + c.idle + c.removed + c.held + c.completed) as total,
+ sum(c.running) as running,
+ sum(c.idle) as idle,
+ sum(c.removed) as removed,
+ sum(c.held) as held,
+ sum(c.completed) as completed
+from submission as s
+left outer join submission_stats as c on c.id = s.stats_curr_id
+
+[xxx]
+where s.submitter like '{user_name}@%'
+
+[LoadUserSlotStats.sql]
+select
+ count(*) as total,
+ count(case c.activity when 'Busy' then 1 end) as busy,
+ count(case c.activity when 'Idle' then 1 end) as idle,
+ count(case c.activity when 'Suspended' then 1 end) as suspended
+from slot as s
+left outer join slot_stats as c on c.id = s.stats_curr_id
+where s.remote_owner like '{user_name}@%'
Modified: mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/widgets.py 2009-09-28 17:28:24 UTC (rev 3650)
+++ mgmt/trunk/cumin/python/cumin/usergrid/widgets.py 2009-09-28 18:44:17 UTC (rev 3651)
@@ -3,6 +3,7 @@
import cumin.grid
+from cumin.model import CuminStatistic
from cumin.parameters import *
from cumin.widgets import *
from cumin.util import *
@@ -11,6 +12,7 @@
from wooly.widgets import Link
+from model import *
from widgets import *
strings = StringCatalog(__file__)
@@ -19,7 +21,7 @@
def __init__(self, app, name):
super(MainPage, self).__init__(app, name)
- self.main = MainView(app, "main")
+ self.main = MainView(app, "main", self.user)
self.add_mode(self.main)
self.set_default_frame(self.main)
@@ -27,26 +29,54 @@
return "User Grid"
class MainView(CuminMainView):
- def __init__(self, app, name):
+ def __init__(self, app, name, user):
super(MainView, self).__init__(app, name)
- self.overview = OverviewFrame(app, "overview")
+ self.overview = OverviewFrame(app, "overview", user)
self.add_tab(self.overview)
- self.submissions = UserSubmissionSet(app, "submissions")
+ self.submissions = UserSubmissionSet(app, "submissions", user)
self.add_tab(self.submissions)
- self.slots = UserSlotSet(app, "slots")
+ self.slots = UserSlotSet(app, "slots", user)
self.add_tab(self.slots)
-class OverviewFrame(Widget):
+class OverviewFrame(CuminFrame):
+ def __init__(self, app, name, user):
+ super(OverviewFrame, self).__init__(app, name)
+
+ self.view = OverviewView(app, "view", user)
+ self.add_mode(self.view)
+
def render_title(self, session):
return "Overview"
+class OverviewView(Widget):
+ def __init__(self, app, name, user):
+ super(OverviewView, self).__init__(app, name)
+
+ heading = self.Heading(app, "heading")
+ self.add_child(heading)
+
+ self.stats = UserJobStatSet(self.app, "jobs", user)
+ self.add_child(self.stats)
+
+ self.stats = UserSlotStatSet(self.app, "slots", user)
+ self.add_child(self.stats)
+
+ class Heading(CuminHeading):
+ def render_title(self, session):
+ return "Overview"
+
+ def render_icon_href(self, session):
+ return "resource?name=action-36.png"
+
class UserSubmissionSet(SubmissionSet):
- def __init__(self, app, name):
+ def __init__(self, app, name, user):
super(UserSubmissionSet, self).__init__(app, name)
+ self.user = user
+
self.scheduler_col.visible = False
self.submitter_col.visible = False
@@ -62,9 +92,102 @@
return {"name": user.name}
class UserSlotSet(SlotSet):
+ def __init__(self, app, name, user):
+ super(UserSlotSet, self).__init__(app, name)
+
+ self.user = user
+
def render_sql_where(self, session):
return "where s.remote_user like %(name)s"
def get_sql_values(self, session):
- user = self.page.user.get(session)
- return {"name": "%s%%" % user.name}
+ user = self.user.get(session)
+ return {"name": "%s@%%" % user.name}
+
+class UserJobStatSet(NewStatSet):
+ def __init__(self, app, name, user):
+ super(UserJobStatSet, self).__init__(app, name)
+
+ stat = self.TotalJobs("total")
+ self.stats.append(stat)
+
+ stat = self.RunningJobs("running")
+ self.stats.append(stat)
+
+ stat = self.IdleJobs("idle")
+ self.stats.append(stat)
+
+ stat = self.RemovedJobs("removed")
+ self.stats.append(stat)
+
+ stat = self.HeldJobs("held")
+ self.stats.append(stat)
+
+ stat = self.CompletedJobs("completed")
+ self.stats.append(stat)
+
+ self.load = LoadUserJobStats(app, user)
+
+ def get_values(self, session):
+ return self.load.execute(session).fetchone()
+
+ class TotalJobs(CuminStatistic):
+ def get_title(self, session):
+ return "Total"
+
+ class RunningJobs(CuminStatistic):
+ def get_title(self, session):
+ return "Running"
+
+ class IdleJobs(CuminStatistic):
+ def get_title(self, session):
+ return "Idle"
+
+ class RemovedJobs(CuminStatistic):
+ def get_title(self, session):
+ return "Removed"
+
+ class HeldJobs(CuminStatistic):
+ def get_title(self, session):
+ return "Held"
+
+ class CompletedJobs(CuminStatistic):
+ def get_title(self, session):
+ return "Completed"
+
+class UserSlotStatSet(NewStatSet):
+ def __init__(self, app, name, user):
+ super(UserSlotStatSet, self).__init__(app, name)
+
+ stat = self.TotalSlots("total")
+ self.stats.append(stat)
+
+ stat = self.BusySlots("busy")
+ self.stats.append(stat)
+
+ stat = self.IdleSlots("idle")
+ self.stats.append(stat)
+
+ stat = self.SuspendedSlots("suspended")
+ self.stats.append(stat)
+
+ self.load = LoadUserSlotStats(app, user)
+
+ def get_values(self, session):
+ return self.load.execute(session).fetchone()
+
+ class TotalSlots(CuminStatistic):
+ def get_title(self, session):
+ return "Total"
+
+ class BusySlots(CuminStatistic):
+ def get_title(self, session):
+ return "Busy"
+
+ class IdleSlots(CuminStatistic):
+ def get_title(self, session):
+ return "Idle"
+
+ class SuspendedSlots(CuminStatistic):
+ def get_title(self, session):
+ return "Suspended"
Modified: mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings 2009-09-28 17:28:24 UTC (rev 3650)
+++ mgmt/trunk/cumin/python/cumin/usergrid/widgets.strings 2009-09-28 18:44:17 UTC (rev 3651)
@@ -0,0 +1,17 @@
+[OverviewView.html]
+{heading}
+
+<table class="twocol">
+ <tbody>
+ <tr>
+ <td>
+ <h2>Jobs</h2>
+ {jobs}
+ <h2>Slots</h2>
+ {slots}
+ </td>
+ <td>
+ </td>
+ </tr>
+ </tbody>
+</table>
15 years, 3 months
rhmessaging commits: r3650 - store/trunk/cpp/lib.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-09-28 13:28:24 -0400 (Mon, 28 Sep 2009)
New Revision: 3650
Modified:
store/trunk/cpp/lib/JournalImpl.cpp
store/trunk/cpp/lib/JournalImpl.h
Log:
Fix to RHM_IORES_EMPTY problem on flow-to-disk. See BZ525813 - "Move Flow to disk from BDB to journal".
Modified: store/trunk/cpp/lib/JournalImpl.cpp
===================================================================
--- store/trunk/cpp/lib/JournalImpl.cpp 2009-09-28 15:13:35 UTC (rev 3649)
+++ store/trunk/cpp/lib/JournalImpl.cpp 2009-09-28 17:28:24 UTC (rev 3650)
@@ -262,13 +262,20 @@
// Free any previous msg
free_read_buffers();
+ // Last read encountered out-of-order rids, check if this rid is in that list
+ bool oooFlag = false;
+ for (std::vector<u_int64_t>::const_iterator i=oooRidList.begin(); i!=oooRidList.end() && !oooFlag; i++) {
+ if (*i == rid) {
+ oooFlag = true;
+ }
+ }
+
// TODO: This is a brutal approach - very inefficient and slow. Rather introduce a system of remembering
// jumpover points and allow the read to jump back to the first known jumpover point - but this needs
// a mechanism in rrfc to accomplish it. Also helpful is a struct containing a journal address - a
// combination of lid/offset.
- if (rid < lastReadRid)
+ if (oooFlag || rid < lastReadRid)
_rmgr.invalidate();
-
_dlen = 0;
_dtok.reset();
_dtok.set_wstate(DataTokenImpl::ENQ);
@@ -279,11 +286,15 @@
bool done = false;
bool rid_found = false;
unsigned aio_sleep_cnt = 0;
+ oooRidList.clear();
while (!done) {
iores res = read_data_record(&_datap, _dlen, &_xidp, xlen, transient, _external, &_dtok);
switch (res) {
case mrg::journal::RHM_IORES_SUCCESS:
if (_dtok.rid() != rid) {
+ // Check if this is an out-of-order rid that may impact next read
+ if (_dtok.rid() > rid)
+ oooRidList.push_back(_dtok.rid());
free_read_buffers();
// Reset data token for next read
_dlen = 0;
Modified: store/trunk/cpp/lib/JournalImpl.h
===================================================================
--- store/trunk/cpp/lib/JournalImpl.h 2009-09-28 15:13:35 UTC (rev 3649)
+++ store/trunk/cpp/lib/JournalImpl.h 2009-09-28 17:28:24 UTC (rev 3650)
@@ -79,7 +79,8 @@
boost::intrusive_ptr<qpid::sys::TimerTask> getEventsFireEventsPtr;
pthread_mutex_t _getf_mutex;
- u_int64_t lastReadRid; // rid of last read msg for loadMsgContent()
+ u_int64_t lastReadRid; // rid of last read msg for loadMsgContent() - detects out-of-order read requests
+ std::vector<u_int64_t> oooRidList; // list of out-of-order rids (greater than current rid) encountered during read sequence
bool writeActivityFlag;
bool flushTriggeredFlag;
15 years, 3 months
rhmessaging commits: r3649 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-09-28 11:13:35 -0400 (Mon, 28 Sep 2009)
New Revision: 3649
Modified:
mgmt/trunk/cumin/python/cumin/main.py
Log:
Don't import a module we no longer have
Modified: mgmt/trunk/cumin/python/cumin/main.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/main.py 2009-09-24 16:51:53 UTC (rev 3648)
+++ mgmt/trunk/cumin/python/cumin/main.py 2009-09-28 15:13:35 UTC (rev 3649)
@@ -16,7 +16,6 @@
from model import *
from user import *
from widgets import *
-from managementserver import *
from wooly import Session
15 years, 3 months
rhmessaging commits: r3648 - store/trunk/cpp/lib/jrnl.
by rhmessaging-commits@lists.jboss.org
Author: kpvdr
Date: 2009-09-24 12:51:53 -0400 (Thu, 24 Sep 2009)
New Revision: 3648
Modified:
store/trunk/cpp/lib/jrnl/wmgr.cpp
store/trunk/cpp/lib/jrnl/wmgr.hpp
Log:
Refactor of wmgr to clean up duplicate code
Modified: store/trunk/cpp/lib/jrnl/wmgr.cpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.cpp 2009-09-23 18:04:02 UTC (rev 3647)
+++ store/trunk/cpp/lib/jrnl/wmgr.cpp 2009-09-24 16:51:53 UTC (rev 3648)
@@ -204,50 +204,8 @@
else
dtokp->set_wstate(data_tok::ENQ_PART);
- // Has the file header been written (i.e. write pointers still at 0)?
- if (_wrfc.is_void())
- {
- u_int32_t rec_dblks_rem = _enq_rec.rec_size_dblks() - data_offs_dblks;
- bool file_fit = rec_dblks_rem <= _jfsize_dblks;
- bool file_full = rec_dblks_rem == _jfsize_dblks;
- std::size_t fro = 0;
- if (cont)
- {
- if (file_fit && !file_full)
- fro = (rec_dblks_rem + JRNL_SBLK_SIZE) * JRNL_DBLK_SIZE;
- }
- else
- fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
- }
-
- // Is the page full? If so, flush.
- if (_pg_offset_dblks >= _cache_pgsize_sblks * JRNL_SBLK_SIZE)
- {
- res = write_flush();
- assert(res == RHM_IORES_SUCCESS);
-
- if (_page_cb_arr[_pg_index]._state == AIO_PENDING && !done)
- {
- res = RHM_IORES_PAGE_AIOWAIT;
- done = true;
- }
-
- // File full?
- if (_pg_cntr >= _jfsize_pgs)
- {
- iores rfres = rotate_file();
- if (rfres != RHM_IORES_SUCCESS)
- res = rfres;
- if (!done)
- {
- if (rfres == RHM_IORES_SUCCESS)
- cont = true;
- else
- done = true;
- }
- }
- }
+ file_header_check(rid, cont, _enq_rec.rec_size_dblks() - data_offs_dblks);
+ flush_check(res, cont, done);
}
if (dtokp->wstate() >= data_tok::ENQ_SUBM)
_enq_busy = false;
@@ -345,50 +303,8 @@
else
dtokp->set_wstate(data_tok::DEQ_PART);
- // Has the file header been written (i.e. write pointers still at 0)?
- if (_wrfc.is_void())
- {
- u_int32_t rec_dblks_rem = _deq_rec.rec_size_dblks() - data_offs_dblks;
- bool file_fit = rec_dblks_rem <= _jfsize_dblks;
- bool file_full = rec_dblks_rem == _jfsize_dblks;
- std::size_t fro = 0;
- if (cont)
- {
- if (file_fit && !file_full)
- fro = (rec_dblks_rem + JRNL_SBLK_SIZE) * JRNL_DBLK_SIZE;
- }
- else
- fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
- }
-
- // Is the page full? If so, flush.
- if (_pg_offset_dblks >= _cache_pgsize_sblks * JRNL_SBLK_SIZE)
- {
- res = write_flush();
- assert(res == RHM_IORES_SUCCESS);
-
- if (_page_cb_arr[_pg_index]._state == AIO_PENDING && !done)
- {
- res = RHM_IORES_PAGE_AIOWAIT;
- done = true;
- }
-
- // File full?
- if (_pg_cntr >= _jfsize_pgs)
- {
- iores rfres = rotate_file();
- if (rfres != RHM_IORES_SUCCESS)
- res = rfres;
- if (!done)
- {
- if (rfres == RHM_IORES_SUCCESS)
- cont = true;
- else
- done = true;
- }
- }
- }
+ file_header_check(rid, cont, _deq_rec.rec_size_dblks() - data_offs_dblks);
+ flush_check(res, cont, done);
}
if (dtokp->wstate() >= data_tok::DEQ_SUBM)
_deq_busy = false;
@@ -484,50 +400,8 @@
else
dtokp->set_wstate(data_tok::ABORT_PART);
- // Has the file header been written (i.e. write pointers still at 0)?
- if (_wrfc.is_void())
- {
- u_int32_t rec_dblks_rem = _txn_rec.rec_size_dblks() - data_offs_dblks;
- bool file_fit = rec_dblks_rem <= _jfsize_dblks;
- bool file_full = rec_dblks_rem == _jfsize_dblks;
- std::size_t fro = 0;
- if (cont)
- {
- if (file_fit && !file_full)
- fro = (rec_dblks_rem + JRNL_SBLK_SIZE) * JRNL_DBLK_SIZE;
- }
- else
- fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
- }
-
- // Is the page full? If so, flush.
- if (_pg_offset_dblks >= _cache_pgsize_sblks * JRNL_SBLK_SIZE)
- {
- res = write_flush();
- assert(res == RHM_IORES_SUCCESS);
-
- if (_page_cb_arr[_pg_index]._state == AIO_PENDING && !done)
- {
- res = RHM_IORES_PAGE_AIOWAIT;
- done = true;
- }
-
- // File full?
- if (_pg_cntr >= _jfsize_pgs)
- {
- iores rfres = rotate_file();
- if (rfres != RHM_IORES_SUCCESS)
- res = rfres;
- if (!done)
- {
- if (rfres == RHM_IORES_SUCCESS)
- cont = true;
- else
- done = true;
- }
- }
- }
+ file_header_check(rid, cont, _txn_rec.rec_size_dblks() - data_offs_dblks);
+ flush_check(res, cont, done);
}
if (dtokp->wstate() >= data_tok::ABORT_SUBM)
_abort_busy = false;
@@ -619,54 +493,64 @@
else
dtokp->set_wstate(data_tok::COMMIT_PART);
- // Has the file header been written (i.e. write pointers still at 0)?
- if (_wrfc.is_void())
+ file_header_check(rid, cont, _txn_rec.rec_size_dblks() - data_offs_dblks);
+ flush_check(res, cont, done);
+ }
+ if (dtokp->wstate() >= data_tok::COMMIT_SUBM)
+ _commit_busy = false;
+ return res;
+}
+
+void
+wmgr::file_header_check(const u_int64_t rid, const bool cont, const u_int32_t rec_dblks_rem)
+{
+ // Has the file header been written (i.e. write pointers still at 0)?
+ if (_wrfc.is_void())
+ {
+ bool file_fit = rec_dblks_rem <= _jfsize_dblks;
+ bool file_full = rec_dblks_rem == _jfsize_dblks;
+ std::size_t fro = 0;
+ if (cont)
{
- u_int32_t rec_dblks_rem = _txn_rec.rec_size_dblks() - data_offs_dblks;
- bool file_fit = rec_dblks_rem <= _jfsize_dblks;
- bool file_full = rec_dblks_rem == _jfsize_dblks;
- std::size_t fro = 0;
- if (cont)
- {
- if (file_fit && !file_full)
- fro = (rec_dblks_rem + JRNL_SBLK_SIZE) * JRNL_DBLK_SIZE;
- }
- else
- fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
- write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
+ if (file_fit && !file_full)
+ fro = (rec_dblks_rem + JRNL_SBLK_SIZE) * JRNL_DBLK_SIZE;
}
+ else
+ fro = JRNL_SBLK_SIZE * JRNL_DBLK_SIZE;
+ write_fhdr(rid, _wrfc.index(), _wrfc.index(), fro);
+ }
+}
- // Is the page full? If so, flush.
- if (_pg_offset_dblks >= _cache_pgsize_sblks * JRNL_SBLK_SIZE)
+void
+wmgr::flush_check(iores& res, bool& cont, bool& done)
+{
+ // Is page is full, flush
+ if (_pg_offset_dblks >= _cache_pgsize_sblks * JRNL_SBLK_SIZE)
+ {
+ res = write_flush();
+ assert(res == RHM_IORES_SUCCESS);
+
+ if (_page_cb_arr[_pg_index]._state == AIO_PENDING && !done)
{
- res = write_flush();
- assert(res == RHM_IORES_SUCCESS);
+ res = RHM_IORES_PAGE_AIOWAIT;
+ done = true;
+ }
- if (_page_cb_arr[_pg_index]._state == AIO_PENDING && !done)
+ // If file is full, rotate to next file
+ if (_pg_cntr >= _jfsize_pgs)
+ {
+ iores rfres = rotate_file();
+ if (rfres != RHM_IORES_SUCCESS)
+ res = rfres;
+ if (!done)
{
- res = RHM_IORES_PAGE_AIOWAIT;
- done = true;
+ if (rfres == RHM_IORES_SUCCESS)
+ cont = true;
+ else
+ done = true;
}
-
- // File full?
- if (_pg_cntr >= _jfsize_pgs)
- {
- iores rfres = rotate_file();
- if (rfres != RHM_IORES_SUCCESS)
- res = rfres;
- if (!done)
- {
- if (rfres == RHM_IORES_SUCCESS)
- cont = true;
- else
- done = true;
- }
- }
}
}
- if (dtokp->wstate() >= data_tok::COMMIT_SUBM)
- _commit_busy = false;
- return res;
}
iores
Modified: store/trunk/cpp/lib/jrnl/wmgr.hpp
===================================================================
--- store/trunk/cpp/lib/jrnl/wmgr.hpp 2009-09-23 18:04:02 UTC (rev 3647)
+++ store/trunk/cpp/lib/jrnl/wmgr.hpp 2009-09-24 16:51:53 UTC (rev 3648)
@@ -131,6 +131,8 @@
const std::size_t xidsize = 0, const std::size_t dsize = 0, const bool external = false)
const;
void dequeue_check(const std::string& xid, const u_int64_t drid);
+ void file_header_check(const u_int64_t rid, const bool cont, const u_int32_t rec_dblks_rem);
+ void flush_check(iores& res, bool& cont, bool& done);
iores write_flush();
iores rotate_file();
void dblk_roundup();
15 years, 3 months
rhmessaging commits: r3647 - mgmt/trunk/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-09-23 14:04:02 -0400 (Wed, 23 Sep 2009)
New Revision: 3647
Modified:
mgmt/trunk/cumin/python/cumin/grid/slot.py
Log:
Don't crash if there are no schedulers
Modified: mgmt/trunk/cumin/python/cumin/grid/slot.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/slot.py 2009-09-23 17:39:51 UTC (rev 3646)
+++ mgmt/trunk/cumin/python/cumin/grid/slot.py 2009-09-23 18:04:02 UTC (rev 3647)
@@ -84,10 +84,20 @@
if data[self.name]:
job = Identifiable(data[self.name])
pool = self.frame.get_object(session)
- scheduler = Scheduler.select("pool='%s'" % pool.id)[0]
- href = self.page.main.grid.pool.job.get_href(session, job, scheduler)
- return fmt_link(href, data[self.name])
+ scheduler = None
+ for scheduler in Scheduler.select("pool='%s'" % pool.id):
+ break
+
+ if scheduler:
+ href = self.page.main.grid.pool.job.get_href \
+ (session, job, scheduler)
+ return fmt_link(href, data[self.name])
+ else:
+ return fmt_none()
+ else:
+ return fmt_none()
+
class SlotFrame(CuminFrame):
def __init__(self, app, name):
super(SlotFrame, self).__init__(app, name)
15 years, 3 months
rhmessaging commits: r3646 - mgmt/trunk/mint/instance.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-09-23 13:39:51 -0400 (Wed, 23 Sep 2009)
New Revision: 3646
Added:
mgmt/trunk/mint/instance/sql
Log:
Add missing symlink to make mint-admin work
Added: mgmt/trunk/mint/instance/sql
===================================================================
--- mgmt/trunk/mint/instance/sql (rev 0)
+++ mgmt/trunk/mint/instance/sql 2009-09-23 17:39:51 UTC (rev 3646)
@@ -0,0 +1 @@
+link ../sql
\ No newline at end of file
Property changes on: mgmt/trunk/mint/instance/sql
___________________________________________________________________
Name: svn:special
+ *
15 years, 3 months
rhmessaging commits: r3645 - in mgmt/trunk/cumin/python/cumin: usergrid and 1 other directory.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-09-23 13:27:00 -0400 (Wed, 23 Sep 2009)
New Revision: 3645
Modified:
mgmt/trunk/cumin/python/cumin/grid/model.py
mgmt/trunk/cumin/python/cumin/grid/scheduler.py
mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
Log:
Add a submission create link to the user submission set
Modified: mgmt/trunk/cumin/python/cumin/grid/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/model.py 2009-09-23 15:48:00 UTC (rev 3644)
+++ mgmt/trunk/cumin/python/cumin/grid/model.py 2009-09-23 17:27:00 UTC (rev 3645)
@@ -41,9 +41,10 @@
#return "Create submission to pool '%s'" % pool.name
def do_enter(self, session, pool):
- assert isinstance(pool, Pool)
+ if pool:
+ assert isinstance(pool, Pool)
- self.form.pool.set(session, pool)
+ self.form.pool.set(session, pool)
def do_invoke(self, completion, session, scheduler,
description, command, args):
Modified: mgmt/trunk/cumin/python/cumin/grid/scheduler.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/scheduler.py 2009-09-23 15:48:00 UTC (rev 3644)
+++ mgmt/trunk/cumin/python/cumin/grid/scheduler.py 2009-09-23 17:27:00 UTC (rev 3645)
@@ -93,8 +93,6 @@
def __init__(self, app, name, pool):
super(SchedulerSelectField, self).__init__(app, name)
- assert isinstance(pool, PoolParameter)
-
self.pool = pool
self.param = SchedulerParameter(app, "param")
@@ -122,8 +120,12 @@
class SchedulerOptions(OptionInputSet):
def do_get_items(self, session):
pool = self.parent.pool.get(session)
- schedulers = list(Scheduler.selectBy(Pool=pool.id))
+ if pool:
+ schedulers = list(Scheduler.selectBy(Pool=pool.id))
+ else:
+ schedulers = list(Scheduler.select())
+
return schedulers
def render_item_value(self, session, item):
Modified: mgmt/trunk/cumin/python/cumin/usergrid/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/usergrid/widgets.py 2009-09-23 15:48:00 UTC (rev 3644)
+++ mgmt/trunk/cumin/python/cumin/usergrid/widgets.py 2009-09-23 17:27:00 UTC (rev 3645)
@@ -1,6 +1,8 @@
from wooly import *
from wooly.widgets import *
+import cumin.grid
+
from cumin.parameters import *
from cumin.widgets import *
from cumin.util import *
@@ -48,6 +50,10 @@
self.scheduler_col.visible = False
self.submitter_col.visible = False
+ task = cumin.grid.module.submission_add
+ link = TaskLink(app, "add", task, None)
+ self.links.add_child(link)
+
def render_sql_where(self, session):
pass # XXX return "where m.name = %(name)s"
15 years, 3 months
rhmessaging commits: r3644 - mgmt/trunk/cumin/python/cumin/grid.
by rhmessaging-commits@lists.jboss.org
Author: justi9
Date: 2009-09-23 11:48:00 -0400 (Wed, 23 Sep 2009)
New Revision: 3644
Modified:
mgmt/trunk/cumin/python/cumin/grid/model.py
Log:
Fix title
Modified: mgmt/trunk/cumin/python/cumin/grid/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/grid/model.py 2009-09-23 15:29:33 UTC (rev 3643)
+++ mgmt/trunk/cumin/python/cumin/grid/model.py 2009-09-23 15:48:00 UTC (rev 3644)
@@ -13,7 +13,7 @@
class SeePoolsTask(Task):
def get_title(self, session):
- return "Create submission"
+ return "See all pools"
def do_enter(self, session, scheduler):
self.app.main_page.grid.view.show(branch)
15 years, 3 months