#2024 queue log file for kojira
Merged 2 years ago by tkopecek. Opened 2 years ago by tkopecek.
tkopecek/koji issue2023  into  master

file modified
@@ -91,6 +91,13 @@ 

      Note that you need to have your database set to use UTC, as otherwise

      you can end with weird behaviour. For details see



+ ``queue_file = None``

+     Writable path could be set here. In such case, kojira will write a

+     list of currently monitored tags there with simple statistics in

+     every cycle. File would contain information about how long these

+     tags are expired and what is the computed score for them. This can

+     be used to debug and check in realtime the actual performance.


  Garbage Collector


file modified
+12 -1
@@ -668,6 +668,14 @@ 




+         if self.options.queue_file:

+             with open(self.options.queue_file, "wt") as f:

+                 fmt = "%-40s %7s %5s\n"

+                 f.write(fmt % ("Tag", "Expired", "Score"))

+                 for tag in sorted(self.needed_tags.values(), key=lambda t: t['score'], reverse=True):

+                     time_expired = time.time() - tag['expire_ts']

+                     f.write(fmt % (tag['taginfo']['name'], int(time_expired), int(tag['score'])))


          # trigger deletes

          n_deletes = 0

          for repo in to_list(self.repos.values()):
@@ -993,6 +1001,8 @@ 

      parser.add_option("-s", "--server", help="URL of XMLRPC server")

      parser.add_option("--topdir", help="Specify topdir")

      parser.add_option("--logfile", help="Specify logfile")

+     parser.add_option("--queue-file",

+                       help="If specified, queue is dumped to separate status file each cycle")

      (options, args) = parser.parse_args()


      config = koji.read_config_files(options.configFile)
@@ -1036,6 +1046,7 @@ 

                  'cert': None,

                  'ca': '',  # FIXME: unused, remove in next major release

                  'serverca': None,

+                 'queue_file': None,


      if config.has_section(section):

          int_opts = ('deleted_repo_lifetime', 'max_repo_tasks', 'repo_tasks_limit',
@@ -1044,7 +1055,7 @@ 

                      'delete_batch_size', 'dist_repo_lifetime', 'sleeptime',


          str_opts = ('topdir', 'server', 'user', 'password', 'logfile', 'principal', 'keytab',

-                     'krbservice', 'cert', 'ca', 'serverca', 'debuginfo_tags',

+                     'krbservice', 'cert', 'ca', 'serverca', 'debuginfo_tags', 'queue_file',

                      'source_tags', 'separate_source_tags', 'ignore_tags')  # FIXME: remove ca here

          bool_opts = ('verbose', 'debug', 'ignore_stray_repos', 'offline_retry',

                       'krb_rdns', 'krb_canon_host', 'no_ssl_verify', 'check_external_repos')

Nitpick on language. If we're overwriting it all the time, is "log file" really the correct term? More of a status file, maybe?

Granted we only call it that in the issue/pr and the help text.

Minor conflicts, needs a manual rebase

otherwise :thumbsup:

rebased onto 41092424a5713e7158bafd0f098db5ee2bd7c1d8

2 years ago

1 new commit added

  • kojira: queue_file docs
2 years ago

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

rebased onto 539e024

2 years ago

Commit fd9243e fixes this pull-request

Pull-Request has been merged by tkopecek

2 years ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

2 years ago