From fddfe0a1e974c4f6fc46dce3d92eac0ff8404c5d Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Jan 13 2021 15:09:18 +0000 Subject: [PATCH 1/2] lower multicall batches in koji-gc --- diff --git a/util/koji-gc b/util/koji-gc index e84e15a..9eb65c3 100755 --- a/util/koji-gc +++ b/util/koji-gc @@ -459,7 +459,7 @@ def handle_trash(): print("2nd pass: references") i = 0 - mcall = koji.MultiCallSession(session, batch=1000) + mcall = koji.MultiCallSession(session, batch=10) for binfo in continuing: mcall.buildReferences(binfo['id'], limit=10, lazy=True) for binfo, [refs] in zip(continuing, mcall.call_all()): @@ -554,7 +554,7 @@ def handle_trash(): for binfo in to_trash: by_owner.setdefault(binfo['owner_name'], []).append(binfo) owners = sorted(to_list(by_owner.keys())) - mcall = koji.MultiCallSession(session, batch=1000) + mcall = koji.MultiCallSession(session, batch=100) for owner_name in owners: builds = sorted([(b['nvr'], b) for b in by_owner[owner_name]]) send_warning_notice(owner_name, [x[1] for x in builds]) @@ -643,7 +643,7 @@ def handle_delete(just_salvage=False): print("2nd pass: tags") continuing, trash = [], continuing - mcall = koji.MultiCallSession(session, batch=1000) + mcall = koji.MultiCallSession(session, batch=100) for nvr, binfo in trash: mcall.listTags(build=binfo['id'], perms=False) for (nvr, binfo), [tags] in zip(trash, mcall.call_all()): From b3732c508b7ad9d3b6168dd225544341eaad0668 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Jan 13 2021 15:17:10 +0000 Subject: [PATCH 2/2] lower batches in clone-tag multicalls Fixes: https://pagure.io/koji/issue/2616 --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 6e11e63..6e84386 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -3410,7 +3410,7 @@ def handle_clone_tag(goptions, session, args): parser.add_option("-f", "--force", action="store_true", help=_("override tag locks if necessary")) parser.add_option("-n", "--test", action="store_true", help=_("test mode")) - parser.add_option("--batch", type='int', default=1000, metavar='SIZE', + parser.add_option("--batch", type='int', default=100, metavar='SIZE', help=_("batch size of multicalls [0 to disable, default: %default]")) (options, args) = parser.parse_args(args) diff --git a/tests/test_cli/test_clone_tag.py b/tests/test_cli/test_clone_tag.py index 67d4e0d..d493bac 100644 --- a/tests/test_cli/test_clone_tag.py +++ b/tests/test_cli/test_clone_tag.py @@ -223,7 +223,7 @@ clone-tag will create the destination tag if it does not already exist block=True, extra_arches='arch3 arch4', owner='userB'), - call.multiCall(batch=1000), + call.multiCall(batch=100), call.listTagged(1, event=None, inherit=None, latest=None), @@ -255,7 +255,7 @@ clone-tag will create the destination tag if it does not already exist 'tag_name': 'src-tag', 'name': 'pkg1'}, force=None, notify=False), - call.multiCall(batch=1000), + call.multiCall(batch=100), call.getTagGroups('src-tag', event=None), call.groupListAdd('dst-tag', 'group1'), @@ -276,7 +276,7 @@ clone-tag will create the destination tag if it does not already exist 'group2', 'bpkg', block=False), - call.multiCall(batch=1000)]) + call.multiCall(batch=100)]) self.assert_console_message(stdout, """ List of changes: @@ -508,7 +508,7 @@ List of changes: block=True, extra_arches='arch3 arch4', owner='userB'), - call.multiCall(batch=1000), + call.multiCall(batch=100), call.untagBuildBypass('dst-tag', { 'owner_name': 'b_owner', 'nvr': 'pkg1-2.1-2', @@ -530,7 +530,7 @@ List of changes: 'tag_name': 'dst-tag', 'name': 'pkg3'}, force=None, notify=False), - call.multiCall(batch=1000), + call.multiCall(batch=100), call.tagBuildBypass('dst-tag', { 'owner_name': 'b_owner', 'nvr': 'pkg1-0.1-1', @@ -552,8 +552,8 @@ List of changes: 'tag_name': 'src-tag', 'name': 'pkg1'}, force=None, notify=False), - call.multiCall(batch=1000), - call.multiCall(batch=1000), + call.multiCall(batch=100), + call.multiCall(batch=100), call.groupPackageListAdd('dst-tag', 'group1', 'pkg2', @@ -570,21 +570,21 @@ List of changes: 'group2', 'bpkg', force=None), - call.multiCall(batch=1000), - call.multiCall(batch=1000), + call.multiCall(batch=100), + call.multiCall(batch=100), call.packageListBlock('dst-tag', 'bpkg'), call.packageListBlock('dst-tag', 'cpkg'), call.packageListBlock('dst-tag', 'dpkg'), - call.multiCall(batch=1000), + call.multiCall(batch=100), call.groupListRemove('dst-tag', 'group3', force=None), call.groupListBlock('dst-tag', 'group4'), - call.multiCall(batch=1000), + call.multiCall(batch=100), call.groupPackageListRemove('dst-tag', 'group1', 'pkg5', @@ -592,7 +592,7 @@ List of changes: call.groupPackageListBlock('dst-tag', 'group2', 'cpkg'), - call.multiCall(batch=1000)]) + call.multiCall(batch=100)]) self.assert_console_message(stdout, """ List of changes: @@ -886,7 +886,7 @@ Options: --notify Send tagging/untagging notifications -f, --force override tag locks if necessary -n, --test test mode - --batch=SIZE batch size of multicalls [0 to disable, default: 1000] + --batch=SIZE batch size of multicalls [0 to disable, default: 100] """ % self.progname)