rhmessaging commits: r2642 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-15 13:30:04 -0400 (Wed, 15 Oct 2008)
New Revision: 2642
Modified:
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/job.strings
mgmt/trunk/cumin/python/cumin/model.py
Log:
Display the last refreshed date/time using javascript instead of ajax.
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-15 13:21:18 UTC (rev 2641)
+++ mgmt/…
[View More]trunk/cumin/python/cumin/job.py 2008-10-15 17:30:04 UTC (rev 2642)
@@ -770,9 +770,6 @@
self.output = self.OutputFile(app, "job_output")
self.add_child(self.output)
- self.out_time = self.OutTime(app, "out_time")
- self.add_child(self.out_time)
-
def get_args(self, session):
return self.frame.get_args(session)
Modified: mgmt/trunk/cumin/python/cumin/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.strings 2008-10-15 13:21:18 UTC (rev 2641)
+++ mgmt/trunk/cumin/python/cumin/job.strings 2008-10-15 17:30:04 UTC (rev 2642)
@@ -298,7 +298,7 @@
<div class="rfloat">{first_last}</div>
{file}
</div>
-<div class="sactions refresh_info">{refresh} <h2>Last refresh was at <span id="out_time">{out_time}</span></h2></div>
+<div class="sactions refresh_info">{refresh} <h2>Last refresh was at <span id="out_time"></span></h2></div>
<div><textarea name="job_output" id="job_output" disabled="disabled" rows="20" cols="80">
loading...{job_output}
</textarea>
@@ -322,6 +322,10 @@
if (obj.fetch.tail == "t") {
outputEnd();
}
- wooly.deferredUpdate('call.xml?class=job;id=0;method=gettime', got_out_time, "out_time");
+ var d = new Date();
+ var out_time = document.getElementById("out_time");
+ if (out_time) {
+ out_time.innerHTML = d.toLocaleString();
+ }
}
}
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-10-15 13:21:18 UTC (rev 2641)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-15 17:30:04 UTC (rev 2642)
@@ -1889,9 +1889,6 @@
action = self.Fetch(self, "fetch")
action.navigable = False
- action = self.GetTime(self, "gettime")
- action.navigable = False
-
def get_title(self, session):
return "Job"
@@ -1972,11 +1969,6 @@
wait(predicate, timeout=20)
return self.job_ads
- class GetTime(CuminAction):
- def do_invoke(self, job):
- now = datetime.now()
- return "<time value=\"%s\" />" % fmt_datetime(now, sec=True)
-
class Fetch(CuminAction):
def do_invoke(self, job, *args):
file, start, end, tail = args
[View Less]
16 years, 2 months
rhmessaging commits: r2641 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-15 09:21:18 -0400 (Wed, 15 Oct 2008)
New Revision: 2641
Modified:
mgmt/trunk/cumin/python/cumin/model.py
Log:
Better handling of error return on Fetch call
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-10-14 21:16:14 UTC (rev 2640)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-15 13:21:18 UTC (rev 2641)
@@ -1982,6 +1982,7 @@
…
[View More]file, start, end, tail = args
self.job_output = None
self.got_data = False
+ self.reason = None
def completion(status, job_output):
if "Data" in job_output:
@@ -1992,7 +1993,10 @@
while ord(raw[-lindex:][0]) != ord_nl:
lindex = lindex + 1
self.job_output = raw[:-lindex]
- self.got_data = True
+ else:
+ self.reason = status
+
+ self.got_data = True
def predicate():
return self.got_data
@@ -2003,9 +2007,12 @@
# wait for up to 20 seconds for completion to be called
wait(predicate, timeout=20)
if not self.got_data:
- self.job_output = "Unable to get file at %s. Reason: time out" % file
+ self.reason = "time out"
except Exception, e:
- self.job_output = "Unable to get file at %s. Reason: %s" % (file, e)
+ self.reason = e
+
+ if self.reason:
+ self.job_output = "Unable to get file at %s. Reason: %s" % (file, self.reason)
return self.job_output and "<fetch><output>%s</output><tail>%s</tail></fetch>" % (escape_entity(self.job_output), tail)
[View Less]
16 years, 3 months
rhmessaging commits: r2640 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-14 17:16:14 -0400 (Tue, 14 Oct 2008)
New Revision: 2640
Modified:
mgmt/trunk/cumin/python/cumin/limits.py
Log:
Fixing limitset so that it actually gets the list of limits
Modified: mgmt/trunk/cumin/python/cumin/limits.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/limits.py 2008-10-14 20:51:15 UTC (rev 2639)
+++ mgmt/trunk/cumin/python/cumin/limits.py 2008-10-14 21:16:14 UTC (rev 2640)
@@ -68,6 +68,9 @@
…
[View More]
def do_get_items(self, session, *args):
limits = self.limits.get(session)
+ if not len(limits):
+ limits = self.fetch_limits(session)
+ self.limits.set(session, limits)
keys = limits.keys()
keys.sort()
return [{"name":x, "curr":limits[x]["CURRENT"], "max":limits[x]["MAX"]} for x in keys]
[View Less]
16 years, 3 months
rhmessaging commits: r2639 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-14 16:51:15 -0400 (Tue, 14 Oct 2008)
New Revision: 2639
Modified:
mgmt/trunk/cumin/python/cumin/job.py
mgmt/trunk/cumin/python/cumin/job.strings
mgmt/trunk/cumin/python/cumin/model.py
Log:
Defer fetching Job output until after page loads
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-14 20:49:59 UTC (rev 2638)
+++ mgmt/trunk/cumin/python/…
[View More]cumin/job.py 2008-10-14 20:51:15 UTC (rev 2639)
@@ -755,9 +755,6 @@
self.__fetch = self.FetchButton(app, "refresh")
self.add_child(self.__fetch)
- self.out_time = Attribute(app, "out_time")
- self.add_attribute(self.out_time)
-
self.ads = JobAdsSet(app, "ads")
self.add_child(self.ads)
@@ -770,6 +767,12 @@
self.user_file = Parameter(app, "user")
self.add_parameter(self.user_file)
+ self.output = self.OutputFile(app, "job_output")
+ self.add_child(self.output)
+
+ self.out_time = self.OutTime(app, "out_time")
+ self.add_child(self.out_time)
+
def get_args(self, session):
return self.frame.get_args(session)
@@ -815,15 +818,7 @@
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, job):
+ def get_file_args(self, session):
first_last = self.first_last.get(session)
if first_last == "t":
start = -2048
@@ -832,9 +827,23 @@
start = 0
end = 2048
file = self.which_file.get_current_file_name(session)
- if file:
- action = self.app.model.job.fetch
- return action.do_invoke(job, file, start, end)
+ return (file, start, end)
+
+ class OutTime(AjaxField):
+ pass
+
+ class OutputFile(AjaxField):
+ def get_url(self, session):
+ job = self.parent.frame.get_args(session)[0]
+ if job:
+ file, start, end = self.parent.get_file_args(session)
+ fl = self.parent.first_last.get(session)
+ args = "%s&%i&%i&%s" % (file, start, end, fl)
+ args = escape_amp(args)
+ return "call.xml?class=job;id=%i;method=fetch;xargs=%s" % (job.id, args)
+
+ def do_render(self, session):
+ return self.render_script(session)
class FetchButton(FormButton):
def render_content(self, session):
Modified: mgmt/trunk/cumin/python/cumin/job.strings
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.strings 2008-10-14 20:49:59 UTC (rev 2638)
+++ mgmt/trunk/cumin/python/cumin/job.strings 2008-10-14 20:51:15 UTC (rev 2639)
@@ -262,7 +262,7 @@
[JobOutput.css]
-textarea#the_output {
+textarea#job_output {
height: 25em;
width: 100%;
border: 1px solid #EAEAEA;
@@ -287,7 +287,7 @@
}
}
function outputEnd() {
- var tarea = document.getElementById("the_output");
+ var tarea = document.getElementById("job_output");
if (tarea)
scrollToEnd(tarea);
}
@@ -298,10 +298,30 @@
<div class="rfloat">{first_last}</div>
{file}
</div>
-<div class="sactions refresh_info">{refresh} <h2>Last refresh was at {out_time}</h2></div>
-<textarea name="the_output" id="the_output" disabled="disabled" rows="20">
-{the_output}
+<div class="sactions refresh_info">{refresh} <h2>Last refresh was at <span id="out_time">{out_time}</span></h2></div>
+<div><textarea name="job_output" id="job_output" disabled="disabled" rows="20" cols="80">
+loading...{job_output}
</textarea>
-<div>{hidden_inputs}</div>
+{hidden_inputs}</div>
</form>
-{tail_js}
+
+[OutTime.javascript]
+function got_out_time(obj, id) {
+ var elem = document.getElementById(id);
+ if (elem) {
+ var str = obj.time.value;
+ elem.innerHTML = str;
+ }
+}
+[OutputFile.javascript]
+function got_job_output(obj, id) {
+ var elem = document.getElementById(id);
+ if (elem) {
+ var str = obj.fetch.output;
+ elem.value = str;
+ if (obj.fetch.tail == "t") {
+ outputEnd();
+ }
+ wooly.deferredUpdate('call.xml?class=job;id=0;method=gettime', got_out_time, "out_time");
+ }
+}
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-10-14 20:49:59 UTC (rev 2638)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-14 20:51:15 UTC (rev 2639)
@@ -1888,6 +1888,9 @@
action = self.Fetch(self, "fetch")
action.navigable = False
+
+ action = self.GetTime(self, "gettime")
+ action.navigable = False
def get_title(self, session):
return "Job"
@@ -1969,8 +1972,14 @@
wait(predicate, timeout=20)
return self.job_ads
+ class GetTime(CuminAction):
+ def do_invoke(self, job):
+ now = datetime.now()
+ return "<time value=\"%s\" />" % fmt_datetime(now, sec=True)
+
class Fetch(CuminAction):
- def do_invoke(self, job, file, start, end):
+ def do_invoke(self, job, *args):
+ file, start, end, tail = args
self.job_output = None
self.got_data = False
@@ -1998,7 +2007,7 @@
except Exception, e:
self.job_output = "Unable to get file at %s. Reason: %s" % (file, e)
- return self.job_output and escape_entity(self.job_output)
+ return self.job_output and "<fetch><output>%s</output><tail>%s</tail></fetch>" % (escape_entity(self.job_output), tail)
class Hold(CuminAction):
def show(self, session, job):
@@ -2408,6 +2417,9 @@
self.__method = Parameter(app, "method")
self.add_parameter(self.__method)
+ self.__args = Parameter(app, "xargs")
+ self.add_parameter(self.__args)
+
def get_content_type(self, session):
return Page.xml_content_type
@@ -2417,14 +2429,19 @@
cls = self.__class.get(session)
id = self.__id.get(session)
+ xargs = self.__args.get(session)
if cls:
- object = cls.mint_class.get(id)
+ try:
+ object = cls.mint_class.get(id)
+ except:
+ object = None
method = self.__method.get(session)
#self.app.model.write_xml(writer, objects)
for action in cls.actions:
if action.name == method:
- data = action.do_invoke(object)
+ args = xargs and xargs.split("&") or list()
+ data = action.do_invoke(object, *args)
self.write_xml(writer, data)
return writer.to_string()
[View Less]
16 years, 3 months
rhmessaging commits: r2638 - mgmt/trunk/cumin/resources.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-14 16:49:59 -0400 (Tue, 14 Oct 2008)
New Revision: 2638
Modified:
mgmt/trunk/cumin/resources/wooly.js
Log:
Fixing javascript so multiple concurrent ajax requests can be made
Modified: mgmt/trunk/cumin/resources/wooly.js
===================================================================
--- mgmt/trunk/cumin/resources/wooly.js 2008-10-14 20:49:17 UTC (rev 2637)
+++ mgmt/trunk/cumin/resources/wooly.js 2008-10-14 20:49:59 UTC (rev 2638)
@@ -199,19 +199,23 @@
}…
[View More]
function Wooly() {
- if (window.XMLHttpRequest) {
- this.request = new XMLHttpRequest();
- }
- else {
- if (window.ActiveXObject) {
- try {
- this.request = new ActiveXObject("Microsoft.XMLHTTP");
- } catch (e) {
- this.request = new ActiveXObject("Msxml2.XMLHTTP");
+ this.getNewRequest = function() {
+ var request;
+ if (window.XMLHttpRequest) {
+ request = new XMLHttpRequest();
+ }
+ else {
+ if (window.ActiveXObject) {
+ try {
+ request = new ActiveXObject("Microsoft.XMLHTTP");
+ } catch (e) {
+ request = new ActiveXObject("Msxml2.XMLHTTP");
+ }
}
}
+ return request;
}
-
+
this.assert = assert;
this.log = log;
this.dir = dir;
@@ -223,7 +227,7 @@
this.deferredUpdate = function(url, callback, passback) {
- var req = this.request;
+ var req = this.getNewRequest();
req.open("get", url, true);
req.onreadystatechange = update;
@@ -244,7 +248,7 @@
}
this.setIntervalUpdate = function(url, callback, interval) {
- var req = this.request;
+ var req = this.getNewRequest();
function fetch() {
req.open("get", url, true);
[View Less]
16 years, 3 months
rhmessaging commits: r2637 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-14 16:49:17 -0400 (Tue, 14 Oct 2008)
New Revision: 2637
Modified:
mgmt/trunk/cumin/python/cumin/widgets.py
Log:
Removing invalid xml from script tag
Modified: mgmt/trunk/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-14 13:20:46 UTC (rev 2636)
+++ mgmt/trunk/cumin/python/cumin/widgets.py 2008-10-14 20:49:17 UTC (rev 2637)
@@ -1164,7 +1164,7 @@
class …
[View More]AjaxField(Widget):
def render_script(self, session):
script = """
- <script language="javascript">
+ <script type="text/javascript">
function get_%s() {
wooly.deferredUpdate('%s', got_%s, "%s");
}
[View Less]
16 years, 3 months
rhmessaging commits: r2636 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-14 09:20:46 -0400 (Tue, 14 Oct 2008)
New Revision: 2636
Modified:
mgmt/trunk/cumin/python/cumin/model.py
Log:
Adding Removed jobs to pool stats
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-10-14 13:07:18 UTC (rev 2635)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-14 13:20:46 UTC (rev 2636)
@@ -1577,6 +1577,9 @@
stat = CuminStat(…
[View More]self, "Held")
stat.title = "Held Jobs"
+ stat = CuminStat(self, "Removed")
+ stat.title = "Removed Jobs"
+
stat = CuminStat(self, "Jobs")
stat.title = "Total Jobs"
[View Less]
16 years, 3 months
rhmessaging commits: r2635 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-14 09:07:18 -0400 (Tue, 14 Oct 2008)
New Revision: 2635
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Now seeing Removed jobs without a deletion_time. Check status explicitly in JobSet display
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-14 12:50:09 UTC (rev 2634)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-14 13:07:18 UTC (rev 2635)
…
[View More]@@ -1231,7 +1231,7 @@
alive = "((c.rec_time is null or " + \
"c.rec_time <= now() - interval '10 minutes')" + \
- " and j.deletion_time is null)"
+ " and j.deletion_time is null and j.job_status != %i)" % JobStatusInfo.get_status_int("Removed")
if phase == "a":
sql = alive
@@ -1245,7 +1245,7 @@
sql = "(j.job_status = %i" % JobStatusInfo.get_status_int("Held") + \
" and %s)" % alive
else:
- sql = "j.deletion_time is not null"
+ sql = "j.deletion_time is not null or j.job_status = %i" % JobStatusInfo.get_status_int("Removed")
return sql
[View Less]
16 years, 3 months
rhmessaging commits: r2634 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-14 08:50:09 -0400 (Tue, 14 Oct 2008)
New Revision: 2634
Modified:
mgmt/trunk/cumin/python/cumin/job.py
Log:
Restore the soft breaks in property values to see what breaks
Modified: mgmt/trunk/cumin/python/cumin/job.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/job.py 2008-10-14 12:48:51 UTC (rev 2633)
+++ mgmt/trunk/cumin/python/cumin/job.py 2008-10-14 12:50:09 UTC (rev 2634)
@@ -597,7 +597,7 @@
…
[View More] if property.renderer:
value = property.renderer(session, value)
ret = escape_entity(str(value))
- return ret # XXX
+ #return ret # XXX
return self.insert_breaks(ret)
def insert_breaks(self, value):
[View Less]
16 years, 3 months
rhmessaging commits: r2633 - mgmt/trunk/cumin/python/cumin.
by rhmessaging-commits@lists.jboss.org
Author: eallen
Date: 2008-10-14 08:48:51 -0400 (Tue, 14 Oct 2008)
New Revision: 2633
Modified:
mgmt/trunk/cumin/python/cumin/model.py
Log:
Don't escape the & in links that may be shortened
Modified: mgmt/trunk/cumin/python/cumin/model.py
===================================================================
--- mgmt/trunk/cumin/python/cumin/model.py 2008-10-14 12:04:52 UTC (rev 2632)
+++ mgmt/trunk/cumin/python/cumin/model.py 2008-10-14 12:48:51 UTC (rev 2633)
@@ -1911,7 +1911,7 @@
…
[View More] try:
group = JobGroup(job.CustomGroup)
frame.show_job_group(branch, group)
- return escape_amp(fmt_olink(branch, group, name=group.get_id()))
+ return fmt_olink(branch, group, name=group.get_id())
except Exception, e:
return "Unavailable"
@@ -1928,7 +1928,7 @@
submitter.Name = "Unavailable"
frame.show_job(branch, job)
- return escape_amp(fmt_olink(branch, submitter, name=submitter.Name))
+ return fmt_olink(branch, submitter, name=submitter.Name)
class SchedulerProperty(CuminProperty):
@@ -1943,7 +1943,7 @@
scheduler.Name = "Unavailable"
frame.show_job(branch, job)
- return escape_amp(fmt_olink(branch, scheduler, name=scheduler.Name))
+ return fmt_olink(branch, scheduler, name=scheduler.Name)
class GetAd(CuminAction):
def do_invoke(self, job):
[View Less]
16 years, 3 months