From 5b903ff0d30e8667b283eb7efa3efc4d17ab29e6 Mon Sep 17 00:00:00 2001 From: Jan Kaluza Date: Oct 11 2017 08:54:36 +0000 Subject: Fix bad performance while getting data from PDC for modules with many deps. --- diff --git a/mbs-cache-buildroot-groups.patch b/mbs-cache-buildroot-groups.patch new file mode 100644 index 0000000..e90c392 --- /dev/null +++ b/mbs-cache-buildroot-groups.patch @@ -0,0 +1,47 @@ +diff --git a/module_build_service/builder/KojiModuleBuilder.py b/module_build_service/builder/KojiModuleBuilder.py +index 78f9cfe..3fbfbda 100644 +--- a/module_build_service/builder/KojiModuleBuilder.py ++++ b/module_build_service/builder/KojiModuleBuilder.py +@@ -432,7 +432,7 @@ chmod 644 %buildroot/%_sysconfdir/rpm/macros.zz-modules + # of some earlier inconsistent situation. Let's find the task_info + # based on the list of untagged builds + release = module_build_service.utils.get_rpm_release_from_mmd(self.mmd) +- opts = {'name': artifact_name} ++ opts = {'package': artifact_name} + untagged = self.koji_session.untaggedBuilds(**opts) + for build in untagged: + if build["release"].endswith(release): +diff --git a/module_build_service/builder/base.py b/module_build_service/builder/base.py +index 7d474d5..4165295 100644 +--- a/module_build_service/builder/base.py ++++ b/module_build_service/builder/base.py +@@ -127,7 +127,28 @@ class GenericBuilder(six.with_metaclass(ABCMeta)): + builder = GenericBuilder.create( + module.owner, module, config.system, config, + tag_name=module.koji_tag, components=components) +- groups = GenericBuilder.default_buildroot_groups(session, module) ++ ++ # Getting the groups from PDC can be time consuming, because we need ++ # to get whole dependency tree from PDC, which might result in lot ++ # of calls to PDC, so just get the groups once per module build ++ # and store it in xmd. The buildroot groups of particular module ++ # build don't change during the module built, so it is OK to cache ++ # them like that. ++ mmd = module.mmd() ++ if not "buildroot_groups" in mmd.xmd["mbs"]: ++ build_groups = GenericBuilder.default_buildroot_groups( ++ session, module) ++ # Change to sets to lists, so we can store them in modulemd. ++ for key in build_groups.keys(): ++ build_groups[key] = list(build_groups[key]) ++ mmd.xmd["mbs"]["buildroot_groups"] = build_groups ++ module.modulemd = mmd.dumps() ++ ++ groups = mmd.xmd["mbs"]["buildroot_groups"] ++ # Change to lists to sets, because buildroot_connect expects sets. ++ for key in groups.keys(): ++ groups[key] = set(groups[key]) ++ + builder.buildroot_connect(groups) + return builder + diff --git a/module-build-service.spec b/module-build-service.spec index 539c5f3..833197f 100644 --- a/module-build-service.spec +++ b/module-build-service.spec @@ -1,12 +1,14 @@ Name: module-build-service Version: 1.3.31 -Release: 1%{?dist} +Release: 2%{?dist} Summary: The Module Build Service for Modularity Group: Development/Tools License: MIT URL: https://pagure.io/fm-orchestrator Source0: https://files.pythonhosted.org/packages/source/m/%{name}/%{name}-%{version}.tar.gz +# hotfix for maven module build blocking the MBS +Patch0: mbs-cache-buildroot-groups.patch BuildArch: noarch @@ -169,6 +171,8 @@ for a number of tasks: %prep %setup -q +%patch0 -p1 + # Simply remove an old .pyc file that was included in one release. rm -f module_build_service/scheduler/consumer.pyc # And this weird sqlite file that made it in... @@ -217,6 +221,9 @@ done %exclude %{python2_sitelib}/tests/ %changelog +* Wed Oct 11 2017 Jan Kaluza - 1.3.31-2 +- Fix bad performance while getting data from PDC for modules with many deps. + * Mon Oct 2 2017 Matt Prahl - 1.3.31-1 - New version