diff mbox series

[OSSTEST,33/60] sg-report-job-history: Use fork-based parallelism

Message ID 20200814172205.9624-34-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:21 p.m. UTC
For now, one child per job (for all branches).  This is already a
speedup.

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

Patch

diff --git a/sg-report-job-history b/sg-report-job-history
index 424053f1..384a7670 100755
--- a/sg-report-job-history
+++ b/sg-report-job-history
@@ -26,11 +26,13 @@  use IO::Handle;
 use HTML::Entities;
 
 use Osstest::Executive;
+use Osstest::HistoryReport;
 
 our (@blessings,@branches);
 our $limit= 100;
 our $htmlout;
 our $flight;
+our $maxjobs=10;
 our $job;
 
 open DEBUG, ">/dev/null";
@@ -38,7 +40,7 @@  open DEBUG, ">/dev/null";
 while (@ARGV && $ARGV[0] =~ m/^-/) {
     $_= shift @ARGV;
     last if m/^--?$/;
-    if (m/^--(job|flight)\=(.*)$/) {
+    if (m/^--(job|flight|maxjobs)\=(.*)$/) {
         $$1= $2;
     } elsif (m/^--(limit)\=([1-9]\d*)$/) {
         $$1= $2;
@@ -300,6 +302,9 @@  sub processjob ($) {
     processjobbranch($j,$_) foreach @branches;
 }
 
-db_begin_work($dbh_tests, []);
-db_readonly_report();
-foreach my $j (@jobs) { processjob($j); }
+parallel_by_fork('sg-report-job-history', $maxjobs, \@jobs, sub {
+    my ($j) = @_;
+    db_retry($dbh_tests, [], sub {
+        processjob($j);
+    });
+});