From 16356c4b0a60d868f3083d1bafd140040c8bd518 Mon Sep 17 00:00:00 2001
From: Mike McLean <mikem@redhat.com>
Date: Apr 15 2026 02:42:14 +0000
Subject: [PATCH 1/4] more query options for scheduler logs


---

diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py
index 0947ecf..844c1d4 100644
--- a/cli/koji_cli/commands.py
+++ b/cli/koji_cli/commands.py
@@ -8653,10 +8653,18 @@ def handle_scheduler_logs(goptions, session, args):
     "[monitor] Query scheduler logs"
     usage = "usage: %prog scheduler-logs <options>"
     parser = OptionParser(usage=get_usage_str(usage))
-    parser.add_option("--task", type="int", action="store",
+    parser.add_option("--task", type="int", action="append",
                       help="Filter by task ID")
-    parser.add_option("--host", type="str", action="store",
+    parser.add_option("--host", type="str", action="append",
                       help="Filter by host (name/ID)")
+    parser.add_option("--channel", type="str", action="append",
+                      help="Filter by channel (name/ID)")
+    parser.add_option("--arch", type="str", action="append",
+                      help="Filter by arch")
+    parser.add_option("--method", type="str", action="append",
+                      help="Filter by method")
+    parser.add_option("--owner", type="str", action="append",
+                      help="Filter by owner")
     parser.add_option("--from", type="float", action="store", dest="from_ts",
                       help="Logs from given timestamp")
     parser.add_option("--to", type="float", action="store", dest="to_ts",
@@ -8671,13 +8679,38 @@ def handle_scheduler_logs(goptions, session, args):
 
     clauses = []
     if options.task:
-        clauses.append(['task_id', options.task])
+        clauses.append(['task_id', 'IN', options.task])
     if options.host:
-        try:
-            host_id = int(options.host)
-        except ValueError:
-            host_id = session.getHost(options.host)['id']
-        clauses.append(['host_id', host_id])
+        hosts = []
+        for host in options.host:
+            try:
+                host_id = int(host)
+            except ValueError:
+                host_id = session.getHost(host)['id']
+            hosts.append(host_id)
+        clauses.append(['host_id', 'IN', hosts])
+    if options.channel:
+        channels = []
+        for chan in options.channel:
+            try:
+                chan_id = int(chan)
+            except ValueError:
+                chan_id = session.getChannel(chan)['id']
+            channels.append(chan_id)
+        clauses.append(['channel_id', 'IN', channels])
+    if options.arch:
+        clauses.append(['arch', 'IN', options.arch])
+    if options.method:
+        clauses.append(['method', 'IN', options.method])
+    if options.owner:
+        users = []
+        for user in options.owner:
+            try:
+                user_id = int(user)
+            except ValueError:
+                user_id = session.getUser(user)['id']
+            users.append(user_id)
+        clauses.append(['owner', 'IN', users])
     if options.from_ts:
         clauses.append(['msg_ts', '>=', options.from_ts])
     if options.to_ts:

From 8f2d9a517817ddf93c74a413ff9735153132eaeb Mon Sep 17 00:00:00 2001
From: Mike McLean <mikem@redhat.com>
Date: Apr 15 2026 13:47:54 +0000
Subject: [PATCH 2/4] tweak output format


---

diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py
index 844c1d4..45e0367 100644
--- a/cli/koji_cli/commands.py
+++ b/cli/koji_cli/commands.py
@@ -8741,7 +8741,7 @@ def handle_scheduler_logs(goptions, session, args):
     for log in logs:
         log['time'] = time.asctime(time.localtime(log['msg_ts']))
 
-    mask = ("%(task_id)-10s %(host_name)-20s %(time)-25s %(msg)-30s")
+    mask = ("%(time)s %(task_id)s %(host_name)-20s - %(msg)-30s")
     if not goptions.quiet:
         h = mask % {
             'task_id': 'Task',

From 7fb2f070e6affe4ceef29e9aea8560b255c304a8 Mon Sep 17 00:00:00 2001
From: Mike McLean <mikem@redhat.com>
Date: Apr 15 2026 14:00:41 +0000
Subject: [PATCH 3/4] strict lookups and keep header aligned


---

diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py
index 45e0367..39d623d 100644
--- a/cli/koji_cli/commands.py
+++ b/cli/koji_cli/commands.py
@@ -8686,7 +8686,7 @@ def handle_scheduler_logs(goptions, session, args):
             try:
                 host_id = int(host)
             except ValueError:
-                host_id = session.getHost(host)['id']
+                host_id = session.getHost(host, strict=True)['id']
             hosts.append(host_id)
         clauses.append(['host_id', 'IN', hosts])
     if options.channel:
@@ -8695,7 +8695,7 @@ def handle_scheduler_logs(goptions, session, args):
             try:
                 chan_id = int(chan)
             except ValueError:
-                chan_id = session.getChannel(chan)['id']
+                chan_id = session.getChannel(chan, strict=True)['id']
             channels.append(chan_id)
         clauses.append(['channel_id', 'IN', channels])
     if options.arch:
@@ -8708,7 +8708,7 @@ def handle_scheduler_logs(goptions, session, args):
             try:
                 user_id = int(user)
             except ValueError:
-                user_id = session.getUser(user)['id']
+                user_id = session.getUser(user, strict=True)['id']
             users.append(user_id)
         clauses.append(['owner', 'IN', users])
     if options.from_ts:
@@ -8741,7 +8741,7 @@ def handle_scheduler_logs(goptions, session, args):
     for log in logs:
         log['time'] = time.asctime(time.localtime(log['msg_ts']))
 
-    mask = ("%(time)s %(task_id)s %(host_name)-20s - %(msg)-30s")
+    mask = ("%(time)-25s %(task_id)-10s %(host_name)-20s - %(msg)-30s")
     if not goptions.quiet:
         h = mask % {
             'task_id': 'Task',

From 20ee5e547cb05c572aa595768c4efc043a7d4309 Mon Sep 17 00:00:00 2001
From: Mike McLean <mikem@redhat.com>
Date: Apr 15 2026 14:08:48 +0000
Subject: [PATCH 4/4] more output tweaks


---

diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py
index 39d623d..dfb0914 100644
--- a/cli/koji_cli/commands.py
+++ b/cli/koji_cli/commands.py
@@ -8740,8 +8740,12 @@ def handle_scheduler_logs(goptions, session, args):
 
     for log in logs:
         log['time'] = time.asctime(time.localtime(log['msg_ts']))
+        if log['task_id'] is None:
+            log['task_id'] = '-'
+        if log['host_name'] is None:
+            log['host_name'] = '-'
 
-    mask = ("%(time)-25s %(task_id)-10s %(host_name)-20s - %(msg)-30s")
+    mask = ("%(time)-25s %(task_id)-10s %(host_name)-20s — %(msg)-30s")
     if not goptions.quiet:
         h = mask % {
             'task_id': 'Task',

