Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 14EF1C678D5 for ; Wed, 8 Mar 2023 18:54:05 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3131785DF9; Wed, 8 Mar 2023 19:53:31 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="ejhOaJcl"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 32B5C85DCA; Wed, 8 Mar 2023 19:53:22 +0100 (CET) Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 467C685DCB for ; Wed, 8 Mar 2023 19:53:18 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-pj1-x102d.google.com with SMTP id x34so17432276pjj.0 for ; Wed, 08 Mar 2023 10:53:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1678301596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/006FZECY0ny7MeFpC12u/vMWXb7CmsTojeVbO7AJaM=; b=ejhOaJcl8HglIB6UZBtgARsAmqfM++WV2I4LoYLKOndPxD/Q3fo8j4CrC1vW8HWfVE PuJm8lyv1o7l6+QKd927HVFgIMO2JsAKLwnBV81Uz1IC0i0kA3O/wNUKIx98HmNCxbVM MhMhrnVFOFpDEI/lPLTH2JVlSEEtMYJ2BWG8g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678301596; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/006FZECY0ny7MeFpC12u/vMWXb7CmsTojeVbO7AJaM=; b=3LEhtHCt57dpmv8q1KB9Ffefgyz5VU4JrTpecejR1IMCINrrLl5BM4wDw1PIP5G0rm OlSbph38+3q/wKdGMim+gbZHYkB5/Y5WVwD+95YkAb2ZKqxHH/LEmHte8iXsWb4/jlp9 99wUaYIJteP3aRexStCwM0BpheGciJagnP8EwxWgUPZwvh5lm965yTSui4I7X1Xq5Gpp Keh7LCQ1pxc3W2ljI4PB31vk4qijHKmVmBOHqq36mKlazTmHU1P2p9fenMkfY7jgn7xs lfqh46uhpUbcsr6tXCzldg1BMn+TGzmo/kj0eHQdXxhAPAb5gMiyNrWRqjfpfLvPeyGX Ph2g== X-Gm-Message-State: AO0yUKXrbW0/r3O9nbrCkHwC+XOM2I2bf4Nj28NP274D5lJTUZd/T3l1 gGPCciHbQE9hK+ZNnxW9WAttGu/wfpUCx7QTgFM= X-Google-Smtp-Source: AK7set+qZgKCGVyRC0rSStd3SE53xwYipE4HQYTzhA4/wHiRvU2mUCRdZk1Jbfssy9jG8600b59PIg== X-Received: by 2002:a17:902:720b:b0:19e:2495:20e0 with SMTP id ba11-20020a170902720b00b0019e249520e0mr18162673plb.21.1678301596498; Wed, 08 Mar 2023 10:53:16 -0800 (PST) Received: from sjg1.corp.google.com ([2620:15c:9d:200:f975:4c6:dcaf:7762]) by smtp.gmail.com with ESMTPSA id kf3-20020a17090305c300b001994fc55998sm10134198plb.217.2023.03.08.10.53.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 10:53:16 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Doug Anderson , Simon Glass , Maxim Cournoyer Subject: [PATCH v3 3/4] patman: Run get_maintainer.pl in parallel Date: Wed, 8 Mar 2023 10:52:54 -0800 Message-Id: <20230308185256.120345-4-sjg@chromium.org> X-Mailer: git-send-email 2.40.0.rc0.216.gc4246ad0f0-goog In-Reply-To: <20230308185256.120345-1-sjg@chromium.org> References: <20230308185256.120345-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean This script can take ages on some series. Try to limit the time by using threads. If a few stubborn patches remain, show progress so the user has some idea what is going on. Signed-off-by: Simon Glass Reviewed-by: Douglas Anderson --- (no changes since v1) tools/patmanu/func_test.py | 2 ++ tools/patmanu/series.py | 33 ++++++++++++++++++++++++++++++--- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/tools/patmanu/func_test.py b/tools/patmanu/func_test.py index 238fd5b6100..48109ae5725 100644 --- a/tools/patmanu/func_test.py +++ b/tools/patmanu/func_test.py @@ -240,6 +240,8 @@ class TestFunctional(unittest.TestCase): self.assertEqual('Change log missing for v3', next(lines)) self.assertEqual('Change log for unknown version v4', next(lines)) self.assertEqual("Alias 'pci' not found", next(lines)) + while next(lines) != 'Cc processing complete': + pass self.assertIn('Dry run', next(lines)) self.assertEqual('', next(lines)) self.assertIn('Send a total of %d patches' % count, next(lines)) diff --git a/tools/patmanu/series.py b/tools/patmanu/series.py index 4fbcc60b797..d58a960ccc5 100644 --- a/tools/patmanu/series.py +++ b/tools/patmanu/series.py @@ -5,8 +5,11 @@ from __future__ import print_function import collections +import concurrent.futures import itertools import os +import sys +import time from patmanu import get_maintainer from patmanu import gitutil @@ -303,10 +306,34 @@ class Series(dict): fd = open(fname, 'w', encoding='utf-8') all_ccs = [] all_skips = set() + with concurrent.futures.ThreadPoolExecutor(max_workers=16) as executor: + for i, commit in enumerate(self.commits): + commit.seq = i + commit.future = executor.submit( + self.GetCcForCommit, commit, process_tags, warn_on_error, + add_maintainers, limit, get_maintainer_script, all_skips) + + # Show progress any commits that are taking forever + lastlen = 0 + while True: + left = [commit for commit in self.commits + if not commit.future.done()] + if not left: + break + names = ', '.join(f'{c.seq + 1}:{c.subject}' + for c in left[:2]) + out = f'\r{len(left)} remaining: {names}'[:79] + spaces = ' ' * (lastlen - len(out)) + if lastlen: # Don't print anything the first time + print(out, spaces, end='') + sys.stdout.flush() + lastlen = len(out) + time.sleep(.25) + print(f'\rdone{" " * lastlen}\r', end='') + print('Cc processing complete') + for commit in self.commits: - cc = self.GetCcForCommit(commit, process_tags, warn_on_error, - add_maintainers, limit, - get_maintainer_script, all_skips) + cc = commit.future.result() all_ccs += cc print(commit.patch, '\0'.join(sorted(set(cc))), file=fd) self._generated_cc[commit.patch] = cc -- 2.40.0.rc0.216.gc4246ad0f0-goog