From b2a1688ba8de9cf255d9d55b78d4b80a3a8ca349 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= Date: Mon, 14 Sep 2015 14:51:31 +0200 Subject: Fix multithreading When multithreading was enabled, same configuration could been build multiple times. Adding list of built configurations and filtering list of configurations sourced from database solves this problem. Now script is aware of configurations that was prepared and not yet been measured. --- scripts/loop.py | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/loop.py b/scripts/loop.py index f9df231..f7b82bf 100755 --- a/scripts/loop.py +++ b/scripts/loop.py @@ -18,18 +18,27 @@ import database import utils __confs_unmeasured__ = [] +__confs_prepared__ = [] def prepare(): """Prepare for measuring Outcome is Linux image for generated configuration.""" + def get(): + confs = dtb.get_unmeasured() + for pr in __confs_prepared__: + for cn in confs.copy(): + if pr == cn.hash: + confs.remove(cn) + break + return confs print("Preparing new image.") global __confs_unmeasured__ if len(__confs_unmeasured__) == 0: dtb = database.database() - confs = dtb.get_unmeasured() + confs = get() if len(confs) == 0: configurations.generate() - confs = dtb.get_unmeasured() + confs = get() if len(confs) == 0: raise exceptions.NoApplicableConfiguration() __confs_unmeasured__ = list(confs) @@ -37,6 +46,7 @@ def prepare(): kernel.config(con.config) img = kernel.make(con.hash) print("Prepared image: " + img) + __confs_prepared__.append(con.hash) return img, con def measure(kernelimg, con): @@ -48,6 +58,7 @@ def measure(kernelimg, con): os.symlink(kernelimg, sf(conf.jobfolder_linux_image)) boot.boot(con) print("Configuration '" + con.hash + "' measured.") + __confs_prepared__.remove(con.hash) # Multithread # __conflist__ = [] -- cgit v1.2.3