[PATCH] testbot: Remove support for archiving jobs.

Francois Gouget fgouget at codeweavers.com
Thu May 24 10:28:21 CDT 2018


We don't use it and there does not seem to be any forseable need for
it anyway.

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---

Note: This patch requires updating the database.

 testbot/bin/Janitor.pl             | 26 +--------
 testbot/ddl/update34.sql           |  4 ++
 testbot/ddl/winetestbot.sql        |  2 -
 testbot/doc/winetestbot-schema.dia | 85 +++++++++++-------------------
 testbot/lib/WineTestBot/Config.pm  |  5 +-
 testbot/lib/WineTestBot/Jobs.pm    |  9 ----
 testbot/web/index.pl               | 20 +------
 7 files changed, 39 insertions(+), 112 deletions(-)
 create mode 100644 testbot/ddl/update34.sql

diff --git a/testbot/bin/Janitor.pl b/testbot/bin/Janitor.pl
index 7c4168ca8..f7a6e33b6 100755
--- a/testbot/bin/Janitor.pl
+++ b/testbot/bin/Janitor.pl
@@ -2,7 +2,7 @@
 # -*- Mode: Perl; perl-indent-level: 2; indent-tabs-mode: nil -*-
 #
 # This script performs janitorial tasks. It removes incomplete patch series,
-# archives old jobs and purges older jobs and patches.
+# purges older jobs and patches, etc.
 #
 # Copyright 2009 Ge van Geldorp
 # Copyright 2017 Francois Gouget
@@ -172,30 +172,6 @@ if ($JobPurgeDays != 0)
   }
 }
 
-# Archive old Jobs, that is remove all their associated files
-if ($JobArchiveDays != 0)
-{
-  my $ArchiveBefore = time() - $JobArchiveDays * 86400;
-  my $Jobs = CreateJobs();
-  $Jobs->FilterNotArchived();
-  foreach my $Job (@{$Jobs->GetItems()})
-  {
-    if (defined($Job->Ended) && $Job->Ended < $ArchiveBefore)
-    {
-      Trace "Archiving job ", $Job->Id, "\n";
-      next if ($DryRun);
-
-      foreach my $Step (@{$Job->Steps->GetItems()})
-      {
-        unlink $Step->GetDir() . "/" . $Step->FileName;
-      }
-
-      $Job->Archived(1);
-      $Job->Save();
-    }
-  }
-}
-
 # Purge the deleted VMs if they are not referenced anymore
 my $VMs = CreateVMs();
 $VMs->AddFilter("Role", ["deleted"]);
diff --git a/testbot/ddl/update34.sql b/testbot/ddl/update34.sql
new file mode 100644
index 000000000..28dc4e92e
--- /dev/null
+++ b/testbot/ddl/update34.sql
@@ -0,0 +1,4 @@
+USE winetestbot;
+
+ALTER TABLE Jobs
+  DROP Archived;
diff --git a/testbot/ddl/winetestbot.sql b/testbot/ddl/winetestbot.sql
index 32eab4e3e..9ec428c04 100644
--- a/testbot/ddl/winetestbot.sql
+++ b/testbot/ddl/winetestbot.sql
@@ -110,7 +110,6 @@ ENGINE=InnoDB DEFAULT CHARSET=utf8;
 CREATE TABLE Jobs
 (
   Id         INT(5)      NOT NULL AUTO_INCREMENT,
-  Archived   ENUM('Y', 'N') NOT NULL,
   BranchName VARCHAR(20) NOT NULL,
   UserName   VARCHAR(40) NOT NULL,
   Priority   INT(1)      NOT NULL,
@@ -123,7 +122,6 @@ CREATE TABLE Jobs
   FOREIGN KEY (UserName) REFERENCES Users(Name),
   FOREIGN KEY (PatchId) REFERENCES Patches(Id),
   PRIMARY KEY (Id),
-  INDEX JobsArchived (Archived)
 )
 ENGINE=InnoDB DEFAULT CHARSET=utf8;
 
diff --git a/testbot/doc/winetestbot-schema.dia b/testbot/doc/winetestbot-schema.dia
index 2c720f2d2..0dbc7f985 100644
--- a/testbot/doc/winetestbot-schema.dia
+++ b/testbot/doc/winetestbot-schema.dia
@@ -846,16 +846,16 @@
     </dia:object>
     <dia:object type="Database - Table" version="0" id="O7">
       <dia:attribute name="obj_pos">
-        <dia:point val="-16.8208,-13.2667"/>
+        <dia:point val="-16.8208,-13.3167"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="-16.8208,-13.2667;-7.8208,-10.2667"/>
+        <dia:rectangle val="-16.8208,-13.3167;-7.8208,-10.3167"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict"/>
       </dia:attribute>
       <dia:attribute name="elem_corner">
-        <dia:point val="-16.8208,-13.2667"/>
+        <dia:point val="-16.8208,-13.3167"/>
       </dia:attribute>
       <dia:attribute name="elem_width">
         <dia:real val="9"/>
@@ -1239,22 +1239,22 @@
     </dia:object>
     <dia:object type="Database - Table" version="0" id="O9">
       <dia:attribute name="obj_pos">
-        <dia:point val="-4.57083,-14.8667"/>
+        <dia:point val="-4.57083,-14.9167"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="-4.57083,-14.8667;4.81417,-5.4667"/>
+        <dia:rectangle val="-4.57083,-14.9167;4.81417,-6.3167"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict"/>
       </dia:attribute>
       <dia:attribute name="elem_corner">
-        <dia:point val="-4.57083,-14.8667"/>
+        <dia:point val="-4.57083,-14.9167"/>
       </dia:attribute>
       <dia:attribute name="elem_width">
         <dia:real val="9.3850000000000016"/>
       </dia:attribute>
       <dia:attribute name="elem_height">
-        <dia:real val="9.3999999999999986"/>
+        <dia:real val="8.5999999999999996"/>
       </dia:attribute>
       <dia:attribute name="name">
         <dia:string>#Jobs#</dia:string>
@@ -1298,29 +1298,6 @@
             <dia:string>##</dia:string>
           </dia:attribute>
         </dia:composite>
-        <dia:composite type="table_attribute">
-          <dia:attribute name="name">
-            <dia:string>#Archived#</dia:string>
-          </dia:attribute>
-          <dia:attribute name="type">
-            <dia:string>#BOOL#</dia:string>
-          </dia:attribute>
-          <dia:attribute name="comment">
-            <dia:string>##</dia:string>
-          </dia:attribute>
-          <dia:attribute name="primary_key">
-            <dia:boolean val="false"/>
-          </dia:attribute>
-          <dia:attribute name="nullable">
-            <dia:boolean val="false"/>
-          </dia:attribute>
-          <dia:attribute name="unique">
-            <dia:boolean val="false"/>
-          </dia:attribute>
-          <dia:attribute name="default_value">
-            <dia:string>##</dia:string>
-          </dia:attribute>
-        </dia:composite>
         <dia:composite type="table_attribute">
           <dia:attribute name="name">
             <dia:string>#BranchName#</dia:string>
@@ -2004,7 +1981,7 @@
         <dia:point val="25.4792,-14.8834"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="25.4792,-14.8834;36.0192,-4.6834"/>
+        <dia:rectangle val="25.4792,-14.8834;36.0192,-5.4834"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict"/>
@@ -2016,7 +1993,7 @@
         <dia:real val="10.539999999999999"/>
       </dia:attribute>
       <dia:attribute name="elem_height">
-        <dia:real val="10.199999999999999"/>
+        <dia:real val="9.3999999999999986"/>
       </dia:attribute>
       <dia:attribute name="name">
         <dia:string>#Tasks#</dia:string>
@@ -2304,7 +2281,7 @@
         <dia:point val="25.6708,-2.02919"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="25.6708,-2.02919;36.2108,8.97081"/>
+        <dia:rectangle val="25.6708,-2.02919;36.5958,10.5708"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict"/>
@@ -2313,10 +2290,10 @@
         <dia:point val="25.6708,-2.02919"/>
       </dia:attribute>
       <dia:attribute name="elem_width">
-        <dia:real val="10.539999999999999"/>
+        <dia:real val="10.925000000000001"/>
       </dia:attribute>
       <dia:attribute name="elem_height">
-        <dia:real val="11"/>
+        <dia:real val="12.600000000000001"/>
       </dia:attribute>
       <dia:attribute name="name">
         <dia:string>#VMs#</dia:string>
@@ -2693,19 +2670,19 @@
     </dia:object>
     <dia:object type="Database - Reference" version="0" id="O14">
       <dia:attribute name="obj_pos">
-        <dia:point val="-7.82083,-11.5667"/>
+        <dia:point val="-7.8208,-11.6167"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="-7.87083,-12.2167;-4.52083,-11.5167"/>
+        <dia:rectangle val="-7.8708,-12.2667;-4.52083,-11.5667"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict"/>
       </dia:attribute>
       <dia:attribute name="orth_points">
-        <dia:point val="-7.82083,-11.5667"/>
-        <dia:point val="-5.92083,-11.5667"/>
-        <dia:point val="-5.92083,-11.5667"/>
-        <dia:point val="-4.57083,-11.5667"/>
+        <dia:point val="-7.8208,-11.6167"/>
+        <dia:point val="-5.92083,-11.6167"/>
+        <dia:point val="-5.92083,-11.6167"/>
+        <dia:point val="-4.57083,-11.6167"/>
       </dia:attribute>
       <dia:attribute name="orth_orient">
         <dia:enum val="0"/>
@@ -2753,17 +2730,17 @@
     </dia:object>
     <dia:object type="Database - Reference" version="0" id="O15">
       <dia:attribute name="obj_pos">
-        <dia:point val="4.81417,-13.1667"/>
+        <dia:point val="4.81417,-13.2167"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="4.76417,-13.8334;8.29583,-13.1167"/>
+        <dia:rectangle val="4.76417,-13.8667;8.29583,-13.1334"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict"/>
       </dia:attribute>
       <dia:attribute name="orth_points">
-        <dia:point val="4.81417,-13.1667"/>
-        <dia:point val="6.4625,-13.1667"/>
+        <dia:point val="4.81417,-13.2167"/>
+        <dia:point val="6.4625,-13.2167"/>
         <dia:point val="6.4625,-13.1834"/>
         <dia:point val="8.24583,-13.1834"/>
       </dia:attribute>
@@ -2885,7 +2862,7 @@
         <dia:point val="36.0192,-9.98336"/>
         <dia:point val="37.6193,-9.98336"/>
         <dia:point val="37.6193,-0.32919"/>
-        <dia:point val="36.2108,-0.32919"/>
+        <dia:point val="36.5958,-0.32919"/>
       </dia:attribute>
       <dia:attribute name="orth_orient">
         <dia:enum val="0"/>
@@ -2936,7 +2913,7 @@
         <dia:point val="0.1125,-17.85"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="0.0625,-17.9;1.48167,-14.8167"/>
+        <dia:rectangle val="0.0625,-17.9;1.48167,-14.8667"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict"/>
@@ -2944,8 +2921,8 @@
       <dia:attribute name="orth_points">
         <dia:point val="0.1125,-17.85"/>
         <dia:point val="0.1125,-15.3584"/>
-        <dia:point val="0.121667,-15.3584"/>
-        <dia:point val="0.121667,-14.8667"/>
+        <dia:point val="0.12167,-15.3584"/>
+        <dia:point val="0.12167,-14.9167"/>
       </dia:attribute>
       <dia:attribute name="orth_orient">
         <dia:enum val="1"/>
@@ -2993,17 +2970,17 @@
     </dia:object>
     <dia:object type="Database - Reference" version="0" id="O19">
       <dia:attribute name="obj_pos">
-        <dia:point val="-4.57083,-5.96669"/>
+        <dia:point val="-4.57083,-6.8167"/>
       </dia:attribute>
       <dia:attribute name="obj_bb">
-        <dia:rectangle val="-18.2807,-6.61669;-4.52083,-0.80002"/>
+        <dia:rectangle val="-18.2807,-7.4667;-4.52083,-0.80002"/>
       </dia:attribute>
       <dia:attribute name="meta">
         <dia:composite type="dict"/>
       </dia:attribute>
       <dia:attribute name="orth_points">
-        <dia:point val="-4.57083,-5.96669"/>
-        <dia:point val="-18.2307,-5.96669"/>
+        <dia:point val="-4.57083,-6.8167"/>
+        <dia:point val="-18.2307,-6.8167"/>
         <dia:point val="-18.2307,-0.85002"/>
         <dia:point val="-16.4708,-0.85002"/>
       </dia:attribute>
@@ -3047,7 +3024,7 @@
         <dia:real val="0.59999999999999998"/>
       </dia:attribute>
       <dia:connections>
-        <dia:connection handle="0" to="O9" connection="30"/>
+        <dia:connection handle="0" to="O9" connection="28"/>
         <dia:connection handle="1" to="O8" connection="12"/>
       </dia:connections>
     </dia:object>
diff --git a/testbot/lib/WineTestBot/Config.pm b/testbot/lib/WineTestBot/Config.pm
index 4f4c8d82a..b7d633db6 100644
--- a/testbot/lib/WineTestBot/Config.pm
+++ b/testbot/lib/WineTestBot/Config.pm
@@ -35,7 +35,7 @@ use vars qw (@ISA @EXPORT @EXPORT_OK $UseSSL $LogDir $DataDir $BinDir
              $MaxUnitSize $ProjectName $PatchesMailingList $LDAPServer
              $LDAPBindDN $LDAPSearchBase $LDAPSearchFilter
              $LDAPRealNameAttribute $LDAPEMailAttribute $AgentPort $Tunnel
-             $TunnelDefaults $PrettyHostNames $JobPurgeDays $JobArchiveDays
+             $TunnelDefaults $PrettyHostNames $JobPurgeDays
              $WebHostName $RegistrationQ $RegistrationARE $MuninAPIKey);
 
 require Exporter;
@@ -49,7 +49,7 @@ require Exporter;
              $TagPrefix $MaxUnitSize $ProjectName $PatchesMailingList
              $LDAPServer $LDAPBindDN $LDAPSearchBase $LDAPSearchFilter
              $LDAPRealNameAttribute $LDAPEMailAttribute $AgentPort $Tunnel
-             $TunnelDefaults $PrettyHostNames $JobPurgeDays $JobArchiveDays
+             $TunnelDefaults $PrettyHostNames $JobPurgeDays
              $WebHostName $RegistrationQ $RegistrationARE $MuninAPIKey);
 @EXPORT_OK = qw($DbDataSource $DbUsername $DbPassword);
 
@@ -116,7 +116,6 @@ $LDAPRealNameAttribute = undef;
 $LDAPEMailAttribute = undef;
 
 $JobPurgeDays = 7;
-$JobArchiveDays = 0;
 
 if (!$::BuildEnv)
 {
diff --git a/testbot/lib/WineTestBot/Jobs.pm b/testbot/lib/WineTestBot/Jobs.pm
index 1dbee9b37..6be271ba3 100644
--- a/testbot/lib/WineTestBot/Jobs.pm
+++ b/testbot/lib/WineTestBot/Jobs.pm
@@ -74,7 +74,6 @@ sub InitializeNew($$)
 {
   my ($self, $Collection) = @_;
 
-  $self->Archived(!1);
   $self->Branch(CreateBranches()->GetDefaultBranch());
   $self->Status("queued");
   $self->Submitted(time());
@@ -421,7 +420,6 @@ sub CreateItem($)
 
 my @PropertyDescriptors = (
   CreateBasicPropertyDescriptor("Id", "Job id", 1, 1, "S",  5),
-  CreateBasicPropertyDescriptor("Archived", "Job is archived", !1, 1, "B", 1),
   CreateItemrefPropertyDescriptor("Branch", "Branch", !1, 1, \&CreateBranches, ["BranchName"]),
   CreateItemrefPropertyDescriptor("User", "Author", !1, 1, \&CreateUsers, ["UserName"]),
   CreateBasicPropertyDescriptor("Priority", "Priority", !1, 1, "N", 1),
@@ -451,11 +449,4 @@ sub CreateJobs(;$)
                                 $ScopeObject);
 }
 
-sub FilterNotArchived($)
-{
-  my ($self) = @_;
-
-  $self->AddFilter("Archived", [!1]);
-}
-
 1;
diff --git a/testbot/web/index.pl b/testbot/web/index.pl
index 3e5a48106..37b41eae8 100644
--- a/testbot/web/index.pl
+++ b/testbot/web/index.pl
@@ -56,8 +56,7 @@ sub DisplayProperty($$)
   my ($self, $PropertyDescriptor) = @_;
 
   my $PropertyName = $PropertyDescriptor->GetName();
-  if ($PropertyName eq "Archived" ||
-      $PropertyName eq "Patch" ||
+  if ($PropertyName eq "Patch" ||
       ($PropertyName eq "Branch" &&
        ! CreateBranches()->MultipleBranchesPresent))
   {
@@ -278,26 +277,9 @@ sub GenerateBody($)
 
   print "<h2><a name='jobs'></a>Jobs</h2>\n";
   my $Jobs = CreateJobs();
-  $Jobs->FilterNotArchived();
   my $JobsCollectionBlock = new JobStatusBlock($Jobs, $self);
   $JobsCollectionBlock->GenerateList();
 
-  if ($JobArchiveDays != 0)
-  {
-    my $PropertyDescriptor = $Jobs->GetPropertyDescriptorByName('Id');
-    my $MaxIdLength = $PropertyDescriptor->GetMaxLength();
-    print <<EOF
-<br>
-<form action='/JobDetails.pl' method='post' enctype='multipart/form-data'>
-<div class='ItemProperty'>
-<label>Archived job id</label><div class='ItemValue'><input type='text' name='Key' maxlength='$MaxIdLength' size='$MaxIdLength'/></div>
- 
-<input type='submit' name='Action' value='Show details'/>
-</div>
-</form>
-EOF
-  }
-
   print "<h2><a name='vms'></a>VMs</h2>\n";
   my $VMsCollectionBlock = new VMStatusBlock(CreateVMs(), $self);
   $VMsCollectionBlock->GenerateList();
-- 
2.17.0




More information about the wine-devel mailing list