[Branch,~linaro-validation/lava-scheduler/trunk] Rev 198: add a report for the 5 longest running jobs

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

Commit Message

Andy Doan July 18, 2012, 1:33 a.m.
Merge authors:
  Andy Doan (doanac)
Related merge proposals:
  https://code.launchpad.net/~doanac/lava-scheduler/5-longest-jobs/+merge/115422
  proposed by: Andy Doan (doanac)
------------------------------------------------------------
revno: 198 [merge]
committer: Andy Doan <andy.doan@linaro.org>
branch nick: lava-scheduler
timestamp: Tue 2012-07-17 17:31:03 -0500
message:
  add a report for the 5 longest running jobs
modified:
  lava_scheduler_app/templates/lava_scheduler_app/reports.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

Patch

=== modified file 'lava_scheduler_app/templates/lava_scheduler_app/reports.html'
--- lava_scheduler_app/templates/lava_scheduler_app/reports.html	2012-06-16 03:48:18 +0000
+++ lava_scheduler_app/templates/lava_scheduler_app/reports.html	2012-07-17 22:20:10 +0000
@@ -142,4 +142,15 @@ 
 </script>
 </div>
 
+<h2>Longest Running Jobs</h2>
+{% if long_running|length_is:"0" %}
+There are no running jobs.
+{% else %}
+<ul>
+{% for job in long_running %}
+  <li><a href="{{job.get_absolute_url}}">{{job.id}}</a>: {{job.start_time}}</li>
+{% endfor %}
+</ul>
+{% endif %}
+
 {% endblock %}

=== modified file 'lava_scheduler_app/views.py'
--- lava_scheduler_app/views.py	2012-06-26 01:49:31 +0000
+++ lava_scheduler_app/views.py	2012-07-17 19:15:14 +0000
@@ -232,6 +232,11 @@ 
     for week in reversed(range(10)):
         health_week_report.append(job_report(week*-7-7, week*-7, True))
         job_week_report.append(job_report(week*-7-7, week*-7, False))
+
+    long_running = TestJob.objects.filter(
+            status__in = [TestJob.RUNNING, TestJob.CANCELING]
+        ).order_by('start_time')[:5]
+
     return render_to_response(
         "lava_scheduler_app/reports.html",
         {
@@ -239,6 +244,7 @@ 
             'health_day_report': health_day_report,
             'job_week_report': job_week_report,
             'job_day_report': job_day_report,
+            'long_running': long_running,
             'bread_crumb_trail': BreadCrumbTrail.leading_to(index),
         },
         RequestContext(request))