Enable customizing runroot task weight
For different cases where runroot is used it's now possible to set custom weight. The usecase for this is to avoid one builder taking too many tasks. Especially buildinstall is quite resource intensive, so one builder taking multiple tasks at the same time leads to very slow compose time. Signed-off-by: Lubomír Sedlář <lsedlar@redhat.com>
This commit is contained in:
parent
d9ab899920
commit
4ea1916a87
10 changed files with 52 additions and 19 deletions
|
|
@ -467,6 +467,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||
'runroot': True,
|
||||
'runroot_tag': 'rrt',
|
||||
'koji_profile': 'koji',
|
||||
'runroot_weights': {'buildinstall': 123},
|
||||
})
|
||||
|
||||
get_buildroot_rpms.return_value = ['bash', 'zsh']
|
||||
|
|
@ -491,7 +492,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||
get_runroot_cmd.mock_calls,
|
||||
[mock.call('rrt', 'x86_64', cmd, channel=None,
|
||||
use_shell=True, task_id=True,
|
||||
packages=['strace', 'lorax'], mounts=[self.topdir])])
|
||||
packages=['strace', 'lorax'], mounts=[self.topdir], weight=123)])
|
||||
self.assertItemsEqual(
|
||||
run_runroot_cmd.mock_calls,
|
||||
[mock.call(get_runroot_cmd.return_value,
|
||||
|
|
@ -533,7 +534,7 @@ class BuildinstallThreadTestCase(PungiTestCase):
|
|||
get_runroot_cmd.mock_calls,
|
||||
[mock.call('rrt', 'x86_64', cmd, channel=None,
|
||||
use_shell=True, task_id=True,
|
||||
packages=['strace', 'anaconda'], mounts=[self.topdir])])
|
||||
packages=['strace', 'anaconda'], mounts=[self.topdir], weight=None)])
|
||||
self.assertItemsEqual(
|
||||
run_runroot_cmd.mock_calls,
|
||||
[mock.call(get_runroot_cmd.return_value,
|
||||
|
|
|
|||
|
|
@ -252,7 +252,7 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
|||
mounts=[self.topdir],
|
||||
packages=['coreutils', 'genisoimage', 'isomd5sum',
|
||||
'jigdo'],
|
||||
task_id=True, use_shell=True)])
|
||||
task_id=True, use_shell=True, weight=None)])
|
||||
self.assertEqual(
|
||||
run_runroot.call_args_list,
|
||||
[mock.call(get_runroot_cmd.return_value,
|
||||
|
|
@ -286,6 +286,7 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
|||
'runroot_tag': 'f25-build',
|
||||
'koji_profile': 'koji',
|
||||
'create_jigdo': False,
|
||||
'runroot_weights': {'createiso': 123},
|
||||
})
|
||||
cmd = {
|
||||
'iso_path': '%s/compose/Server/x86_64/iso/image-name' % self.topdir,
|
||||
|
|
@ -316,7 +317,7 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
|||
[mock.call('f25-build', 'x86_64', cmd['cmd'], channel=None,
|
||||
mounts=[self.topdir],
|
||||
packages=['coreutils', 'genisoimage', 'isomd5sum'],
|
||||
task_id=True, use_shell=True)])
|
||||
task_id=True, use_shell=True, weight=123)])
|
||||
self.assertEqual(
|
||||
run_runroot.call_args_list,
|
||||
[mock.call(get_runroot_cmd.return_value,
|
||||
|
|
@ -382,7 +383,7 @@ class CreateisoThreadTest(helpers.PungiTestCase):
|
|||
mounts=[self.topdir],
|
||||
packages=['coreutils', 'genisoimage', 'isomd5sum',
|
||||
'jigdo', 'lorax'],
|
||||
task_id=True, use_shell=True)])
|
||||
task_id=True, use_shell=True, weight=None)])
|
||||
self.assertEqual(
|
||||
run_runroot.call_args_list,
|
||||
[mock.call(get_runroot_cmd.return_value,
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||
self.assertEqual(compose.im.add.mock_calls,
|
||||
[mock.call('Everything', 'x86_64', image)])
|
||||
|
||||
def assertRunrootCall(self, koji, sources, release, isfinal=False, extra=[]):
|
||||
def assertRunrootCall(self, koji, sources, release, isfinal=False, extra=[], weight=None):
|
||||
lorax_cmd = [
|
||||
'lorax',
|
||||
'--product=Fedora',
|
||||
|
|
@ -101,7 +101,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||
lorax_cmd,
|
||||
channel=None, mounts=[self.topdir],
|
||||
packages=['pungi', 'lorax', 'ostree'],
|
||||
task_id=True, use_shell=True)])
|
||||
task_id=True, use_shell=True, weight=weight)])
|
||||
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
||||
[mock.call(koji.get_runroot_cmd.return_value,
|
||||
log_file=self.topdir + '/logs/x86_64/ostree_installer/runroot.log')])
|
||||
|
|
@ -377,6 +377,7 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||
"ostree_ref=fedora-atomic/Rawhide/x86_64/docker-host",
|
||||
],
|
||||
}
|
||||
self.compose.conf['runroot_weights'] = {'ostree_installer': 123}
|
||||
koji = KojiWrapper.return_value
|
||||
koji.run_runroot_cmd.return_value = {
|
||||
'task_id': 1234,
|
||||
|
|
@ -404,7 +405,8 @@ class OstreeThreadTest(helpers.PungiTestCase):
|
|||
'--add-arch-template-var=ostree_repo=https://kojipkgs.fedoraproject.org/compose/atomic/Rawhide/',
|
||||
'--add-arch-template-var=ostree_osname=fedora-atomic',
|
||||
'--add-arch-template-var=ostree_ref=fedora-atomic/Rawhide/x86_64/docker-host',
|
||||
'--logfile=%s/logs/x86_64/ostree_installer/lorax.log' % self.topdir]
|
||||
'--logfile=%s/logs/x86_64/ostree_installer/lorax.log' % self.topdir],
|
||||
weight=123,
|
||||
)
|
||||
self.assertIsoLinked(link, get_file_size, get_mtime, final_iso_path)
|
||||
self.assertImageAdded(self.compose, ImageCls, iso)
|
||||
|
|
|
|||
|
|
@ -95,6 +95,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
|
|||
@mock.patch('pungi.wrappers.kojiwrapper.KojiWrapper')
|
||||
def test_run(self, KojiWrapper, get_dir_from_scm):
|
||||
get_dir_from_scm.side_effect = self._dummy_config_repo
|
||||
self.compose.conf['runroot_weights'] = {'ostree': 123}
|
||||
|
||||
koji = KojiWrapper.return_value
|
||||
koji.run_runroot_cmd.side_effect = self._mock_runroot(0)
|
||||
|
|
@ -118,7 +119,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
|
|||
'--extra-config=%s/extra_config.json' % (self.topdir + '/work/ostree-1')],
|
||||
channel=None, mounts=[self.topdir, self.repo],
|
||||
packages=['pungi', 'ostree', 'rpm-ostree'],
|
||||
task_id=True, use_shell=True, new_chroot=True)])
|
||||
task_id=True, use_shell=True, new_chroot=True, weight=123)])
|
||||
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
||||
[mock.call(koji.get_runroot_cmd.return_value,
|
||||
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
|
||||
|
|
@ -255,7 +256,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
|
|||
'--update-summary'],
|
||||
channel=None, mounts=[self.topdir, self.repo],
|
||||
packages=['pungi', 'ostree', 'rpm-ostree'],
|
||||
task_id=True, use_shell=True, new_chroot=True)])
|
||||
task_id=True, use_shell=True, new_chroot=True, weight=None)])
|
||||
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
||||
[mock.call(koji.get_runroot_cmd.return_value,
|
||||
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
|
||||
|
|
@ -290,7 +291,7 @@ class OSTreeThreadTest(helpers.PungiTestCase):
|
|||
'--extra-config=%s/work/ostree-1/extra_config.json' % self.topdir],
|
||||
channel=None, mounts=[self.topdir, self.repo],
|
||||
packages=['pungi', 'ostree', 'rpm-ostree'],
|
||||
task_id=True, use_shell=True, new_chroot=True)])
|
||||
task_id=True, use_shell=True, new_chroot=True, weight=None)])
|
||||
self.assertEqual(koji.run_runroot_cmd.call_args_list,
|
||||
[mock.call(koji.get_runroot_cmd.return_value,
|
||||
log_file=self.topdir + '/logs/x86_64/Everything/ostree-1/runroot.log')])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue