Fix scheduler email notifications when the job is not run at all

Signed-off-by: James Ren <[email protected]>

--- autotest/scheduler/scheduler_models.py      2010-09-07 13:01:26.000000000 
-0700
+++ autotest/scheduler/scheduler_models.py      2010-09-08 16:24:45.000000000 
-0700
@@ -920,11 +920,15 @@
                    WHERE afe_job_id = %s
                    """ % self.id)
 
-        t_begin, t_end = time_row[0]
-        delta = t_end - t_begin
-        minutes, seconds = divmod(delta.seconds, 60)
-        hours, minutes = divmod(minutes, 60)
-        stats['execution_time'] = "%02d:%02d:%02d" % (hours, minutes, seconds)
+        if time_row:
+            t_begin, t_end = time_row[0]
+            delta = t_end - t_begin
+            minutes, seconds = divmod(delta.seconds, 60)
+            hours, minutes = divmod(minutes, 60)
+            stats['execution_time'] = "%02d:%02d:%02d" % (
+                    hours, minutes, seconds)
+        else:
+            stats['execution_time'] = '(none)'
 
         return stats
_______________________________________________
Autotest mailing list
[email protected]
http://test.kernel.org/cgi-bin/mailman/listinfo/autotest

Reply via email to