From: Ian Jackson Date: Tue, 4 Aug 2020 16:23:18 +0000 (+0100) Subject: sg-report-job-history: Use one child per report X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=0a6eb521a925852a647539d36bb62c7afb991986;p=people%2Faperard%2Fosstest.git sg-report-job-history: Use one child per report Rather than one child per job, which then did one report per branch. This will mean we can use the cache machinery, which is rather global so wouldn't cope well with processing multiple job history reports within a process. Signed-off-by: Ian Jackson --- diff --git a/sg-report-job-history b/sg-report-job-history index 384a7670..3307b281 100755 --- a/sg-report-job-history +++ b/sg-report-job-history @@ -296,15 +296,16 @@ END } } -sub processjob ($) { - my ($j) = @_; - processjobbranch($j,undef); - processjobbranch($j,$_) foreach @branches; +my @tasks; +foreach my $j (@jobs) { + push @tasks, $j; + push @tasks, "$j $_" foreach @branches; } -parallel_by_fork('sg-report-job-history', $maxjobs, \@jobs, sub { - my ($j) = @_; +parallel_by_fork('sg-report-job-history', $maxjobs, \@tasks, sub { + my ($task) = @_; + my ($job, $branch) = split / /, $task; # $branch might be undef db_retry($dbh_tests, [], sub { - processjob($j); + processjobbranch($job, $branch); }); });