diff mbox series

[OSSTEST,59/60] sg-report-job-history: Provide --time-limit

Message ID 20200814172205.9624-60-ian.jackson@eu.citrix.com (mailing list archive)
State New, archived
Headers show
Series Speed up sg-report-job-history | expand

Commit Message

Ian Jackson Aug. 14, 2020, 5:22 p.m. UTC
Calculate a minflight based on the time limit, and set the time limit
to a year ago by default.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
---
 sg-report-job-history | 7 +++++++
 1 file changed, 7 insertions(+)
diff mbox series

Patch

diff --git a/sg-report-job-history b/sg-report-job-history
index 5d2a7e15..e09c694f 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -30,6 +30,7 @@  use Osstest::HistoryReport;
 
 our (@blessings,@branches);
 our $limit= 100;
+our $timelimit= 86400 * (366 + 14);
 our $htmlout = '.';
 our $flight;
 our $maxjobs=10;
@@ -44,6 +45,8 @@  while (@ARGV && $ARGV[0] =~ m/^-/) {
         $$1= $2;
     } elsif (m/^--(limit)\=([1-9]\d*)$/) {
         $$1= $2;
+    } elsif (m/^--time-limit\=([1-9]\d*)$/) {
+        $timelimit= $1;
     } elsif (restrictflight_arg($_)) {
 	# Handled by Executive
     } elsif (m/^--html-dir=(.*)$/) {
@@ -67,6 +70,9 @@  csreadconfig();
 
 our @jobs;
 
+our $minflight = minflight_by_time($timelimit);
+print DEBUG "MINFLIGHT $minflight\n";
+
 sub findflight () {
     my $branches= $dbh_tests->selectcol_arrayref(<<END, {}, $flight);
         SELECT branch FROM flights WHERE flight=?
@@ -144,6 +150,7 @@  END
         SELECT * 
           FROM jobs JOIN flights USING (flight)
          WHERE ($cond)
+           AND flight > $minflight
       ORDER BY flight DESC
          LIMIT $limit
 END