#2485 builder: configurable TTL for buildroots
Merged 10 months ago by tkopecek. Opened 10 months ago by tkopecek.
tkopecek/koji issue2374  into  master

file modified
+4 -1
@@ -6441,6 +6441,8 @@ 

              quit('invalid section found in config file: %s' % x)

      defaults = {'sleeptime': 15,

                  'maxjobs': 10,

+                 'buildroot_basic_cleanup_delay': 120,

+                 'buildroot_final_cleanup_delay': 86400,

                  'literal_task_arches': '',

                  'minspace': 8192,

                  'admin_emails': None,
@@ -6500,7 +6502,8 @@ 

              if name in ['sleeptime', 'maxjobs', 'minspace', 'retry_interval',

                          'max_retries', 'offline_retry_interval', 'failed_buildroot_lifetime',

                          'timeout', 'rpmbuild_timeout', 'oz_install_timeout',

-                         'task_avail_delay']:

+                         'task_avail_delay', 'buildroot_basic_cleanup_delay',

+                         'buildroot_final_cleanup_delay']:

                  try:

                      defaults[name] = int(value)

                  except ValueError:

file modified
+8
@@ -5,6 +5,14 @@ 

  ; The maximum number of jobs that kojid will handle at a time

  ; maxjobs=10

  

+ ; Time after successfully finished task's buildroot is deleted (2 minutes in seconds)

+ ; Some logs and directories are left in place until buildroot_final_cleanup_delay

+ ; buildroot_basic_cleanup_delay=120

+ 

+ 

+ ; Time after successfully finished task's buildroot is deleted completely (1 day in seconds)

+ ; buildroot_final_cleanup_delay=86400

+ 

  ; The minimum amount of free space (in MBs) required for each build root

  ; minspace=8192

  

@@ -25,6 +25,16 @@ 

        serves as a backup to the capacity check and prevents a tremendous

        number of low weight jobs from piling up.

  

+    buildroot_basic_cleanup_delay=120

+       Time after which successfully finished task's buildroot is deleted (2

+       minutes in seconds). Some logs and directories are left in place until

+       buildroot_final_cleanup_delay

+ 

+    buildroot_final_cleanup_delay=86400

+       Time after which buildroot (pre-cleand after

+       ``buildroot_basic_cleanup_delay``) is deleted completely. (1 day in

+       seconds)

+ 

     max_retries=120

        Set the maximum number of times that an individual hub call can be

        retried.

file modified
+2 -2
@@ -737,7 +737,7 @@ 

                  # can lead to a world of hurt.

                  # We remove the rootdir contents but leave the rootdir unless it

                  # is really old

-                 if age > 3600 * 24:

+                 if age > self.options.buildroot_final_cleanup_delay:

                      # dir untouched for a day

                      self.logger.info("Removing buildroot: %s" % desc)

                      if ((topdir and safe_rmtree(topdir, unmount=True, strict=False) != 0) or
@@ -749,7 +749,7 @@ 

                          os.unlink(data['cfg'])

                      except OSError as e:

                          self.logger.warning("%s: can't remove config: %s" % (desc, e))

-                 elif age > 120 and rootdir:

+                 elif age > self.options.buildroot_basic_cleanup_delay and rootdir:

                      for d in (topdir, topdir_bootstrap):

                          if not d:

                              continue