diff mbox

[Branch,~linaro-validation/lava-scheduler/trunk] Rev 155: improve the scheduler log page (mostly ChiThu, some fixes/tweaks by mwhudson)

Message ID 20120319020712.12359.40035.launchpad@ackee.canonical.com
State Accepted
Headers show

Commit Message

Michael-Doyle Hudson March 19, 2012, 2:07 a.m. UTC
Merge authors:
  Le Chi Thu le.chi.thu@linaro.org <le.chi.thu@linaro.org>
  Michael Hudson-Doyle (mwhudson)
Related merge proposals:
  https://code.launchpad.net/~le-chi-thu/lava-scheduler/improve-log-summary-page/+merge/97597
  proposed by: Le Chi Thu (le-chi-thu)
------------------------------------------------------------
revno: 155 [merge]
committer: Michael Hudson-Doyle <michael.hudson@linaro.org>
branch nick: trunk
timestamp: Mon 2012-03-19 15:05:32 +1300
message:
  improve the scheduler log page (mostly ChiThu, some fixes/tweaks by mwhudson)
modified:
  doc/changes.rst
  lava_scheduler_app/logfile_helper.py
  lava_scheduler_app/static/css/scheduler.css
  lava_scheduler_app/templates/lava_scheduler_app/job.html
  lava_scheduler_app/views.py


--
lp:lava-scheduler
https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk

You are subscribed to branch lp:lava-scheduler.
To unsubscribe from this branch go to https://code.launchpad.net/~linaro-validation/lava-scheduler/trunk/+edit-subscription
diff mbox

Patch

=== modified file 'doc/changes.rst'
--- doc/changes.rst	2012-03-15 01:44:09 +0000
+++ doc/changes.rst	2012-03-15 21:27:02 +0000
@@ -1,6 +1,10 @@ 
 Version History
 ***************
 
+* Show all dispatcher logs.
+* Highlight action lines.
+* Download log file in summary page
+
 .. _version_0_12:
 
 Version 0.12 (UNRELEASED)

=== modified file 'lava_scheduler_app/logfile_helper.py'
--- lava_scheduler_app/logfile_helper.py	2012-01-20 04:20:04 +0000
+++ lava_scheduler_app/logfile_helper.py	2012-03-19 02:00:36 +0000
@@ -12,17 +12,27 @@ 
 def getDispatcherLogMessages(logfile):
     logs = []
     log_prefix = '<LAVA_DISPATCHER>'
-    level_pattern = re.compile('....-..-.. ..:..:.. .. ([A-Z]+):')
+    action_begin = '[ACTION-B]'
+    level_pattern = re.compile('....-..-.. (..:..:.. .. ([A-Z]+): .*)')
     for line in logfile:
-        if not line.startswith(log_prefix):
+        # log_prefix not always start at beginning of the line
+        pos = line.find(log_prefix)
+        if (pos == -1): # log_prefix not found
             continue
+        if (pos > 0): # remove log_prefix leading characters
+            line = line[pos:-1]
+
         line = line[len(log_prefix):].strip()
         match = level_pattern.match(line)
         if not match:
             continue
-        if len(line) > 90:
-            line = line[:90] + '...'
-        logs.append((match.group(1), line))
+        line = match.group(1)
+        if len(line) > 120:
+            line = line[:120] + '...'
+        if line.find(action_begin) != -1:
+            logs.append((match.group(2), line, "action"))
+        else:
+            logs.append((match.group(2), line, ""))
     return logs
 
 class Sections:

=== modified file 'lava_scheduler_app/static/css/scheduler.css'
--- lava_scheduler_app/static/css/scheduler.css	2011-12-09 01:53:59 +0000
+++ lava_scheduler_app/static/css/scheduler.css	2012-03-15 09:27:48 +0000
@@ -38,6 +38,10 @@ 
     margin: 0;
 }
 
+pre.action {
+    color: blue
+}
+
 .logbuttons .ui-button-text {
     padding: 0.1em 0.4em;
 }
\ No newline at end of file

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/job.html'
--- lava_scheduler_app/templates/lava_scheduler_app/job.html	2012-01-11 22:20:43 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/job.html	2012-03-15 09:27:48 +0000
@@ -18,7 +18,9 @@ 
 <pre>{{ job_errors }}</pre>
 </div>
 {% endif %}
-<h3>Dispatcher Log messages (file size = {{ job_file_size|filesizeformat }})</h3>
+<h3>Dispatcher Log messages (file size = {{ job_file_size|filesizeformat }}) &nbsp;  &nbsp; 
+    <a href="{% url lava.scheduler.job.log_file.plain job.pk %}">Download as text file</a>
+</h3>
 <span class="logbuttons">
 {% for level in levels %}
 {% if level.1 %}
@@ -30,7 +32,7 @@ 
 </span>
 <div id="log-messages">
 {% for log in job_log_messages %}
-<pre class="log {{log.0}}">{{ log.1 }}</pre>
+<pre class="log {{log.0}} {{log.2}}">{{ log.1 }}</pre>
 {% endfor %}
 {% if job.status == job.RUNNING %}
 <img src="{{ STATIC_URL }}lava_scheduler_app/images/ajax-progress.gif"/>

=== modified file 'lava_scheduler_app/views.py'
--- lava_scheduler_app/views.py	2012-03-13 03:29:49 +0000
+++ lava_scheduler_app/views.py	2012-03-19 02:01:59 +0000
@@ -308,7 +308,7 @@ 
         levels = defaultdict(int)
         for kl in ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']:
             levels[kl] = 0
-        for level, msg in job_log_messages:
+        for level, msg, _ in job_log_messages:
             levels[level] += 1
         levels = sorted(levels.items(), key=lambda (k,v):logging._levelNames.get(k))
         data.update({