It already does not make sense to call ScheduleJobs() in other processes. So only call it from Engine.pl.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/Engine.pl | 6 +++++- testbot/lib/WineTestBot/Patches.pm | 7 ++----- 2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl index 3d1f2c1e5..b61db8871 100755 --- a/testbot/bin/Engine.pl +++ b/testbot/bin/Engine.pl @@ -448,6 +448,8 @@ sub HandleWinePatchMLSubmission() my $ErrMessage = CreatePatches()->NewPatch($Entity); push @ErrMessages, $ErrMessage if (defined $ErrMessage);
+ ScheduleJobs(); + # Clean up if (!rmtree($WorkDir)) { @@ -520,6 +522,8 @@ sub HandleWinePatchWebSubmission() my $ErrMessage = $Patches->NewPatch($Entity, $WebPatchId); push @ErrMessages, $ErrMessage if (defined $ErrMessage);
+ ScheduleJobs(); + # Clean up if (!rmtree($WorkDir)) { @@ -621,7 +625,6 @@ checks whether any pending patchsets are now complete and thus can be scheduled. sub SafetyNet() { CheckJobs(); - ScheduleJobs(); HandleWinePatchWebSubmission();
my $Set = CreatePendingPatchSets(); @@ -630,6 +633,7 @@ sub SafetyNet() { LogMsg "Failed to check completeness of patch series: $ErrMessage\n"; } + ScheduleJobs(); }
sub PrepareSocket($) diff --git a/testbot/lib/WineTestBot/Patches.pm b/testbot/lib/WineTestBot/Patches.pm index 5edeab06e..26127e93a 100644 --- a/testbot/lib/WineTestBot/Patches.pm +++ b/testbot/lib/WineTestBot/Patches.pm @@ -147,8 +147,8 @@ sub GetTestList() Analyzes the current patch to determine which Wine tests are impacted. Then for each impacted test it creates a high priority WineTestBot::Job to run that test. This also creates the WineTestBot::Step objects for that Job, as well as the -WineTestBot::Task objects to run the test on each 'base' VM. Finally it calls -CWineTestBot::Jobs::ScheduleJobs() to run the new Jobs. +WineTestBot::Task objects to run the test on each 'base' VM. It is the +responsibility of the caller to arrange for rescheduling of the jobs.
Note that the path to the file containing the actual patch is passed as a parameter. This is used to apply a combined patch for patch series. See @@ -341,9 +341,6 @@ sub Submit($$$) $Disposition .= $NewJob->Id; } $self->Disposition($Disposition); - - ScheduleJobs(); - return undef; }
There is no need to reschedule after handling each patch in the staging directory. The scheduler will handle them all at once.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/Engine.pl | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl index b61db8871..64359ae06 100755 --- a/testbot/bin/Engine.pl +++ b/testbot/bin/Engine.pl @@ -431,7 +431,7 @@ sub HandleWinePatchMLSubmission() my @Entries = readdir($dh); closedir($dh);
- my @ErrMessages; + my ($NewPatch, @ErrMessages); foreach my $Entry (@Entries) { # Validate file name @@ -446,9 +446,14 @@ sub HandleWinePatchMLSubmission() $Parser->output_dir($WorkDir); my $Entity = $Parser->parse_open($FullMessageFileName); my $ErrMessage = CreatePatches()->NewPatch($Entity); - push @ErrMessages, $ErrMessage if (defined $ErrMessage); - - ScheduleJobs(); + if (defined $ErrMessage) + { + push @ErrMessages, $ErrMessage; + } + else + { + $NewPatch = 1; + }
# Clean up if (!rmtree($WorkDir)) @@ -463,6 +468,7 @@ sub HandleWinePatchMLSubmission() LogMsg "Unable to delete '$FullMessageFileName': $!\n"; } } + ScheduleJobs() if ($NewPatch);
return @ErrMessages ? "0". join("; ", @ErrMessages) : "1OK"; }
There is no need to reschedule after handling each patch in the staging directory. The scheduler will handle them all at once.
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/Engine.pl | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl index 64359ae06..177578209 100755 --- a/testbot/bin/Engine.pl +++ b/testbot/bin/Engine.pl @@ -516,6 +516,7 @@ sub HandleWinePatchWebSubmission()
# Add the patches in increasing WebPatchId order so that next time # $LatestWebPatchId still makes sense in case something goes wrong now + my $NewPatch; foreach my $WebPatchId (sort { $a <=> $b } @WebPatchIds) { # Create a working dir @@ -526,9 +527,14 @@ sub HandleWinePatchWebSubmission() $Parser->output_dir($WorkDir); my $Entity = $Parser->parse_open("$DataDir/webpatches/$WebPatchId"); my $ErrMessage = $Patches->NewPatch($Entity, $WebPatchId); - push @ErrMessages, $ErrMessage if (defined $ErrMessage); - - ScheduleJobs(); + if (defined $ErrMessage) + { + push @ErrMessages, $ErrMessage; + } + else + { + $NewPatch = 1; + }
# Clean up if (!rmtree($WorkDir)) @@ -537,6 +543,7 @@ sub HandleWinePatchWebSubmission() LogMsg "Unable to delete '$WorkDir': $!\n"; } } + ScheduleJobs() if ($NewPatch);
return @ErrMessages ? "0". join("; ", @ErrMessages) : "1OK"; }
Signed-off-by: Francois Gouget fgouget@codeweavers.com --- testbot/bin/Engine.pl | 7 ++++--- testbot/lib/WineTestBot/PendingPatchSets.pm | 14 ++++++-------- 2 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl index 177578209..730fd42e2 100755 --- a/testbot/bin/Engine.pl +++ b/testbot/bin/Engine.pl @@ -638,15 +638,16 @@ checks whether any pending patchsets are now complete and thus can be scheduled. sub SafetyNet() { CheckJobs(); + ScheduleJobs(); HandleWinePatchWebSubmission();
my $Set = CreatePendingPatchSets(); - my $ErrMessage = $Set->CheckForCompleteSet(); - if (defined($ErrMessage)) + my ($Submitted, $ErrMessage) = $Set->CheckForCompleteSet(); + if (defined $ErrMessage) { LogMsg "Failed to check completeness of patch series: $ErrMessage\n"; } - ScheduleJobs(); + ScheduleJobs() if ($Submitted); }
sub PrepareSocket($) diff --git a/testbot/lib/WineTestBot/PendingPatchSets.pm b/testbot/lib/WineTestBot/PendingPatchSets.pm index c0dc56fbe..bfd05e4a3 100644 --- a/testbot/lib/WineTestBot/PendingPatchSets.pm +++ b/testbot/lib/WineTestBot/PendingPatchSets.pm @@ -94,7 +94,7 @@ sub CheckComplete($) =item C<SubmitSubset()>
Combines the patches leading to the specified part in the patchset, and then -calls WineTestBot::Patch::Submit() so it gets scheduled for testing. +calls WineTestBot::Patch::Submit() to create the corresponding job.
=back =cut @@ -307,29 +307,27 @@ sub CheckForCompleteSet($) { my ($self) = @_;
- my $ErrMessage; + my ($Submitted, @ErrMessages); foreach my $Set (@{$self->GetItems()}) { if ($Set->CheckComplete()) { my $Patch = $Set->Parts->GetItem($Set->TotalParts)->Patch; my $SetErrMessage = $Set->Submit($Patch); - if (defined($SetErrMessage)) + if (defined $SetErrMessage) { - if (! defined($ErrMessage)) - { - $ErrMessage = $SetErrMessage; - } + push @ErrMessages, $SetErrMessage; } else { $Patch->Save(); + $Submitted = 1; } $self->DeleteItem($Set); } }
- return $ErrMessage; + return ($Submitted, @ErrMessages ? join("; ", @ErrMessages) : undef); }
1;