[2/2] testbot/Engine: Remove the JobSubmit() notification. It's redundant with RescheduleJobs().

Francois Gouget fgouget at codeweavers.com
Thu May 15 08:48:11 CDT 2014


It does not need to call Step::HandleStaging() since the Job scheduler does that already.
So then it's identical to the RescheduleJobs() notification.
---
 testbot/bin/Engine.pl                    | 34 --------------------------------
 testbot/lib/WineTestBot/Engine/Notify.pm | 19 +-----------------
 testbot/web/Submit.pl                    |  8 +++++---
 3 files changed, 6 insertions(+), 55 deletions(-)

diff --git a/testbot/bin/Engine.pl b/testbot/bin/Engine.pl
index f8b7e1e..6e2ff1c 100755
--- a/testbot/bin/Engine.pl
+++ b/testbot/bin/Engine.pl
@@ -257,39 +257,6 @@ sub HandlePing
   return "1pong\n";
 }
 
-sub HandleJobSubmit
-{
-  my $JobKey = $_[0];
-
-  my $Job = CreateJobs()->GetItem($JobKey);
-  if (! $Job)
-  {
-    LogMsg "JobSubmit for nonexistent job $JobKey\n";
-    return "0Job $JobKey not found";
-  }
-  # We've already determined that JobKey is valid, untaint it
-  $JobKey =~ m/^(.*)$/;
-  $JobKey = $1;
-
-  my $ErrMessage;
-  foreach my $Step (@{$Job->Steps->GetItems()})
-  {
-    $ErrMessage = $Step->HandleStaging($JobKey);
-    if (defined($ErrMessage))
-    {
-      LogMsg "Staging problem: $ErrMessage\n";
-    }
-  }
-
-  $ErrMessage = ScheduleJobs();
-  if (defined($ErrMessage))
-  {
-    LogMsg "Scheduling problem in HandleJobSubmit: $ErrMessage\n";
-  }
-
-  return "1OK";
-}
-
 sub HandleJobStatusChange
 {
   my ($JobKey, $OldStatus, $NewStatus) = @_;
@@ -579,7 +546,6 @@ my %Handlers=(
     "jobcancel"                => \&HandleJobCancel,
     "jobrestart"               => \&HandleJobRestart,
     "jobstatuschange"          => \&HandleJobStatusChange,
-    "jobsubmit"                => \&HandleJobSubmit,
     "ping"                     => \&HandlePing,
     "shutdown"                 => \&HandleShutdown,
     "reschedulejobs"           => \&HandleRescheduleJobs,
diff --git a/testbot/lib/WineTestBot/Engine/Notify.pm b/testbot/lib/WineTestBot/Engine/Notify.pm
index a241c81..d0d4890 100644
--- a/testbot/lib/WineTestBot/Engine/Notify.pm
+++ b/testbot/lib/WineTestBot/Engine/Notify.pm
@@ -33,7 +33,7 @@ use vars qw (@ISA @EXPORT @EXPORT_OK $RunningInEngine);
 
 require Exporter;
 @ISA = qw(Exporter);
- at EXPORT = qw(&Shutdown &PingEngine &JobSubmit &JobStatusChange &JobCancel
+ at EXPORT = qw(&Shutdown &PingEngine &JobStatusChange &JobCancel
              &JobRestart &RescheduleJobs &VMStatusChange
              &WinePatchMLSubmission &WinePatchWebSubmission &GetScreenshot);
 @EXPORT_OK = qw($RunningInEngine);
@@ -99,23 +99,6 @@ sub PingEngine
   return 1 <= length($Reply) && substr($Reply, 0, 1) eq "1";
 }
 
-sub JobSubmit
-{
-  my $JobKey = $_[0];
-
-  my $Reply = SendCmdReceiveReply("jobsubmit $JobKey\n");
-  if (length($Reply) < 1)
-  {
-    return "Unrecognized reply received from engine";
-  }
-  if (substr($Reply, 0, 1) eq "1")
-  {
-    return undef;
-  }
- 
-  return substr($Reply, 1);
-}
-
 sub JobStatusChange
 {
   my ($JobKey, $OldStatus, $NewStatus) = @_;
diff --git a/testbot/web/Submit.pl b/testbot/web/Submit.pl
index 0d9d0b4..3bcfad9 100644
--- a/testbot/web/Submit.pl
+++ b/testbot/web/Submit.pl
@@ -917,14 +917,16 @@ sub OnSubmit
   $Jobs = undef;
 
   # Notify engine
-  if (defined(JobSubmit($JobKey)))
+  my $ErrMessage = RescheduleJobs();
+  if (defined $ErrMessage)
   {
+    LogMsg "$ErrMessage\n";
     $self->{Page} = 4;
-    $self->{JobKey} = $NewJob->GetKey();
+    $self->{JobKey} = $JobKey;
     return !1;
   }
 
-  $self->Redirect("/JobDetails.pl?Key=" . $NewJob->Id);
+  $self->Redirect("/JobDetails.pl?Key=$JobKey");
   exit;
 }
 
-- 
2.0.0.rc0



More information about the wine-patches mailing list