From patchwork Fri Feb 3 21:15:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 651208 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 605ABC61DA4 for ; Fri, 3 Feb 2023 21:16:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233619AbjBCVQA (ORCPT ); Fri, 3 Feb 2023 16:16:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233645AbjBCVPs (ORCPT ); Fri, 3 Feb 2023 16:15:48 -0500 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EC05A702C for ; Fri, 3 Feb 2023 13:15:36 -0800 (PST) Received: by mail-qt1-x835.google.com with SMTP id m12so7046146qth.4 for ; Fri, 03 Feb 2023 13:15:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:from:to:cc:subject:date:message-id:reply-to; bh=eLosuRYpUTaeFkEBYxygIhJoipDce+CSjeoPL1e0mss=; b=C6K2oYlj7KJYCgTiljFiciHUzR9wISmsTIgiwJELx7JUNNolMq6ZWOe/hdKndFlOJU HgB1vY96JXoF7HfnZ+/+O1c81INw+Xf+NbRSKpl9CL50l9XDPIqtMzDkiaCLs8MKXbAp fojO2FUgeTFzC9JLiVnewxmma+BhgmU4PTLb9s+MHuRMFDOG2p9kutIFXWsvpC5em61J nK+uBPydhHsRGuAW5k2b6WefmVzLtDOma6K6bjtWsU6MTdhMd0asFE0jRamv6LOQIqVy bLPIoan44K9CGX6upxYxEKhLhFSN1FDJhR3jCG9DSqGTAO04EbGr90ljmSjULDRqmp4l Qafw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:sender:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=eLosuRYpUTaeFkEBYxygIhJoipDce+CSjeoPL1e0mss=; b=TlYWb2QL9AghYBB6J/kyjZRdOttmAdCvDZtsYotW8wIv8sTElhXnjHKI/m7hwcQ/O2 zhr38X/4TVCA+C+jPjUK/yAuIilDNdIRn+RW1sfcSpQpvbUrsjPdivTLbGzh7+hmiiB4 n8eD9uEdzcVI/kXXAkTE0ZX8Zm0hRIv/2yCqjj2RaZyn/gNMxrcwu/HoVZchbJzvPZCz Yc0TfJpVlTrzMmelWPLM3lM3zK46740hiVVC0gGxrpJ1FaJeXd1++qF8V7f5HNrk1zQ0 W7Sf6W4pYOjyn3qpElUcIoECy5CXuwnGaLDa7K80UQRC0LXnf+/EX5Z9pFqWuUg+4htb SnLA== X-Gm-Message-State: AO0yUKXC+ZANuTmRGgIO9tfcjYmEct6LEnONvRAzG74R2ajFke7bcx7V /MjXc5Bvz3RVLTTyN10I4ytRMcjvzW4= X-Google-Smtp-Source: AK7set9ll57rzSON65tml/V0ozFuk/w953xR47H6uZhg86NHvcpQrl01EyFA3BBeMufCffKTqpuDug== X-Received: by 2002:ac8:4e90:0:b0:3b6:9c63:5ca1 with SMTP id 16-20020ac84e90000000b003b69c635ca1mr23047284qtp.43.1675458934897; Fri, 03 Feb 2023 13:15:34 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-14-76-71-123-7.dsl.bell.ca. [76.71.123.7]) by smtp.gmail.com with ESMTPSA id br15-20020a05620a460f00b00706bc44fda8sm2531004qkb.79.2023.02.03.13.15.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 13:15:33 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , John Kacur Subject: [PATCH 1/8] rteval: rteval/__init__.py: Convert regular strings to f-strings Date: Fri, 3 Feb 2023 16:15:20 -0500 Message-Id: <20230203211527.71181-1-jkacur@redhat.com> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Convert regular strings to f-strings in __init__.py Signed-off-by: John Kacur --- rteval/__init__.py | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/rteval/__init__.py b/rteval/__init__.py index 22af8e85d5aa..d8127425febe 100644 --- a/rteval/__init__.py +++ b/rteval/__init__.py @@ -59,7 +59,7 @@ def sig_handler(signum, frame): stopsig_received = True print("*** stop signal received - stopping rteval run ***") else: - raise RuntimeError("SIGNAL received! (%d)" % signum) + raise RuntimeError(f"SIGNAL received! ({signum})") class RtEval(rtevalReport): def __init__(self, config, loadmods, measuremods, logger): @@ -96,10 +96,10 @@ class RtEval(rtevalReport): self.__mailer = None if not os.path.exists(self.__rtevcfg.xslt_report): - raise RuntimeError("can't find XSL template (%s)!" % self.__rtevcfg.xslt_report) + raise RuntimeError(f"can't find XSL template ({self.__rtevcfg.xslt_report})!") # Add rteval directory into module search path - sys.path.insert(0, '%s/rteval' % sysconfig.get_python_lib()) + sys.path.insert(0, f'{sysconfig.get_python_lib()}/rteval') # Initialise the report module rtevalReport.__init__(self, self.__version, @@ -110,8 +110,7 @@ class RtEval(rtevalReport): self.__xmlrpc = rtevalXMLRPC(self.__rtevcfg.xmlrpc, self.__logger, self.__mailer) if not self.__xmlrpc.Ping(): if not self.__rtevcfg.xmlrpc_noabort: - print("ERROR: Could not reach XML-RPC server '%s'. Aborting." % \ - self.__rtevcfg.xmlrpc) + print(f"ERROR: Could not reach XML-RPC server '{self.__rtevcfg.xmlrpc}'. Aborting.") sys.exit(2) else: print("WARNING: Could not ping the XML-RPC server. Will continue anyway.") @@ -174,8 +173,7 @@ class RtEval(rtevalReport): measure_start = None (with_loads, run_parallel) = measure_profile.GetProfile() - self.__logger.log(Log.INFO, "Using measurement profile [loads: %s parallel: %s]" % ( - with_loads, run_parallel)) + self.__logger.log(Log.INFO, f"Using measurement profile [loads: {with_loads} parallel: {run_parallel}]") try: nthreads = 0 @@ -183,23 +181,23 @@ class RtEval(rtevalReport): if with_loads: self._loadmods.Start() - print("rteval run on %s started at %s" % (os.uname()[2], time.asctime())) + print(f"rteval run on {os.uname()[2]} started at {time.asctime()}") onlinecpus = self._sysinfo.cpu_getCores(True) cpulist = self._loadmods._cfg.GetSection("loads").cpulist if cpulist: - print("started %d loads on cores %s" % (self._loadmods.ModulesLoaded(), cpulist), end=' ') + print(f"started {self._loadmods.ModulesLoaded()} loads on cores {cpulist}", end=' ') else: - print("started %d loads on %d cores" % (self._loadmods.ModulesLoaded(), onlinecpus), end=' ') + print(f"started {self._loadmods.ModulesLoaded()} loads on {onlinecpus} cores", end=' ') if self._sysinfo.mem_get_numa_nodes() > 1: - print(" with %d numa nodes" % self._sysinfo.mem_get_numa_nodes()) + print(f" with {self._sysinfo.mem_get_numa_nodes()} numa nodes") else: print("") cpulist = self._measuremods._MeasurementModules__cfg.GetSection("measurement").cpulist if cpulist: - print("started measurement threads on cores %s" % cpulist) + print(f"started measurement threads on cores {cpulist}") else: - print("started measurement threads on %d cores" % onlinecpus) - print("Run duration: %s seconds" % str(self.__rtevcfg.duration)) + print(f"started measurement threads on {onlinecpus} cores") + print(f"Run duration: {str(self.__rtevcfg.duration)} seconds") # start the cyclictest thread measure_profile.Start() @@ -219,7 +217,7 @@ class RtEval(rtevalReport): # wait for time to expire or thread to die signal.signal(signal.SIGINT, sig_handler) signal.signal(signal.SIGTERM, sig_handler) - self.__logger.log(Log.INFO, "waiting for duration (%s)" % str(self.__rtevcfg.duration)) + self.__logger.log(Log.INFO, f"waiting for duration ({str(self.__rtevcfg.duration)})") stoptime = (time.time() + float(self.__rtevcfg.duration)) currtime = time.time() rpttime = currtime + report_interval @@ -246,7 +244,7 @@ class RtEval(rtevalReport): left_to_run = stoptime - currtime self.__show_remaining_time(left_to_run) rpttime = currtime + report_interval - print("load average: %.2f" % self._loadmods.GetLoadAvg()) + print(f"load average: {self._loadmods.GetLoadAvg():.2f}") currtime = time.time() self.__logger.log(Log.DEBUG, "out of measurement loop") @@ -265,7 +263,7 @@ class RtEval(rtevalReport): if with_loads: self._loadmods.Stop() - print("stopping run at %s" % time.asctime()) + print(f"stopping run at {time.asctime()}") # wait for measurement modules to finish calculating stats measure_profile.WaitForCompletion() From patchwork Fri Feb 3 21:15:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 650542 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D6D5FC05027 for ; Fri, 3 Feb 2023 21:16:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233714AbjBCVQB (ORCPT ); Fri, 3 Feb 2023 16:16:01 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59860 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233678AbjBCVPs (ORCPT ); Fri, 3 Feb 2023 16:15:48 -0500 Received: from mail-qt1-x836.google.com (mail-qt1-x836.google.com [IPv6:2607:f8b0:4864:20::836]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF1C6A702A for ; Fri, 3 Feb 2023 13:15:37 -0800 (PST) Received: by mail-qt1-x836.google.com with SMTP id m12so7046219qth.4 for ; Fri, 03 Feb 2023 13:15:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=274VLyemMF45k4do6pGazU4MeQ8NbrpshgUgH5GAyPo=; b=lN+Qt5s0IK6iwSkwNP/jrUiHFz8y8LXKI3vPAV7ebtQjFCZSGlW//ZkxDWRm8Fhg3y 8yj3xjfCAAOTd9q9Ji5teHyhHi0L2KypqogcJEaemPBmGwaU3fJVyDOZbOZq9R2CP4Qm hQ6MJZKQPU/6Y24Bp2VwYOsBxff5BLUL67UvrNqRoBxFPxTnHX6GeZYo1FRvgcclJUTH V703mp6r726sAX6X1DH/npYy0ZLsrab163HGZH24GloORNC1c6q4tB8eSf63R9R+QVvn iEsbt5Qbv9Lyg5uh6s0A/hpnN2Mg3xEd0FZktzyKRFQr4oxUHPAfxWzjX7JZXzZiv436 1BCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=274VLyemMF45k4do6pGazU4MeQ8NbrpshgUgH5GAyPo=; b=z1yfGtSQ8t7IHfuFqNy6BJJO39mGGYlAMyjoWEh/52poF0+fs3zETcSlbQBFkSLIrn 85Ur2eBRpTo/lb5SwhPdOnvonA6UiXWXPc7Xbf9k1xFOPAIbg1HPi1pRLfevRYBOg9T1 sZT2M+Jum/1BVRGF01mgORSlxIFqCBlrdbqHzdF8jHh+B9fE8i0JkKMtR/4n9aAJRba6 OrjWj5NlAgG+ivtverwiFSP3i57CUfbQu898OOZhd1muPSYP1L0QelILSlDEeH/wFROh SCnaQmSJw+16DOMjyN5ekiHbBXoSTZ80wmc7Jy840/CQ9CHeoQSG35ypCWxkmE4ds52q e+pw== X-Gm-Message-State: AO0yUKU7dooYa0TAaHTQKZxPhL/ppyQChKxj9pvKzDayOqz2/i3gU5Uf o6ZPuxYVwvU0WkaGQUaFp/4kGAslRSU= X-Google-Smtp-Source: AK7set/xa42Srjukq/ByJlIBhnHZ6iCEV4A8YbW1ZYVdTWUhxL5+YL5KYkn1pOQMoqaobeB1lm736w== X-Received: by 2002:a05:622a:15d1:b0:3ad:202f:8797 with SMTP id d17-20020a05622a15d100b003ad202f8797mr22573969qty.9.1675458936313; Fri, 03 Feb 2023 13:15:36 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-14-76-71-123-7.dsl.bell.ca. [76.71.123.7]) by smtp.gmail.com with ESMTPSA id br15-20020a05620a460f00b00706bc44fda8sm2531004qkb.79.2023.02.03.13.15.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 13:15:35 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , John Kacur Subject: [PATCH 2/8] rteval: rtevalReport.py: Convert regular strings to f-strings Date: Fri, 3 Feb 2023 16:15:21 -0500 Message-Id: <20230203211527.71181-2-jkacur@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203211527.71181-1-jkacur@redhat.com> References: <20230203211527.71181-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Convert regular strings to f-strings in rtevalReport.py Signed-off-by: John Kacur --- rteval/rtevalReport.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rteval/rtevalReport.py b/rteval/rtevalReport.py index fdfaed560cfa..af3e6c9a703b 100644 --- a/rteval/rtevalReport.py +++ b/rteval/rtevalReport.py @@ -100,11 +100,11 @@ class rtevalReport: def _show_report(self, xmlfile, xsltfile): '''summarize a previously generated xml file''' - print("Loading %s for summarizing" % xmlfile) + print(f"Loading {xmlfile} for summarizing") xsltfullpath = os.path.join(self.__installdir, xsltfile) if not os.path.exists(xsltfullpath): - raise RuntimeError("can't find XSL template (%s)!" % xsltfullpath) + raise RuntimeError(f"can't find XSL template ({xsltfullpath})!") xmlreport = xmlout.XMLOut('rteval', self.__version) xmlreport.LoadReport(xmlfile) @@ -131,7 +131,7 @@ class rtevalReport: def _tar_results(self): if not os.path.isdir(self.__reportdir): - raise RuntimeError("no such directory: %s" % self.__reportdir) + raise RuntimeError(f"no such directory: {self.__reportdir}") dirname = os.path.dirname(self.__reportdir) rptdir = os.path.basename(self.__reportdir) From patchwork Fri Feb 3 21:15:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 651207 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2902CC636CC for ; Fri, 3 Feb 2023 21:16:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233723AbjBCVQC (ORCPT ); Fri, 3 Feb 2023 16:16:02 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233581AbjBCVPy (ORCPT ); Fri, 3 Feb 2023 16:15:54 -0500 Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2B719A701A for ; Fri, 3 Feb 2023 13:15:39 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id m26so7017429qtp.9 for ; Fri, 03 Feb 2023 13:15:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=up87JT+Oy5cK09OPgZIVT8p4/CiyWa4g1UtMA+kE6c4=; b=kuDCVHy/9FY8KusrhAw1MqMTfhlaCPOvU/Uw+2Xj5Yy7N6/s8fHmIwlaNT9T2GtCx+ HbJKacQKKMaM7XcqhQNk65bhsw3YJHxwIsA9UrFaf5M4fZZi1Jgaa/SYdqP3w4/pER5U 2yJNyH2YihLtOZdlo38dRlG5x2vwSN+0cg/uPX5lsj7pC5CZTr4bSeOJY+leFNnJIcqS 7hS/svLAhyThBC1mEkRu4yhOf4LKHta8Gqmj/N60F/slD1yRC1Z/1QSXXd1XlZQ48Wrx aT7Wcsc5V1Z8EspTMiEO0wFGvRYt0TsAoXJMVStA1Qj88K9CpiDEcL9lR0awEYddxCZH 5okA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=up87JT+Oy5cK09OPgZIVT8p4/CiyWa4g1UtMA+kE6c4=; b=BFE6gczQt4ZQLjZlqjGltRJnIGNHbB363xaCSXOFCVAHzFstDhZI9K7c90mN+kz01j RARU7EFp6ro9+YDTe0T5UuHApWKsive8XJLLDvmYKymonhE/hWnu1O8ZgZkqIGnk5/bA B/TSR2SyiCx5kLynO339qG2makInslOPCEuPJbzDrngeBkqoXWQAhYxSeG/6+oWFN3sC WU24vNIgDMsEjM2PN44z6d6xRApTfq2PgApfxSMUfW7NBam+0csC4QYpcOVM6KhHMAgi WgWuhRK70yRBMZ694TRnDfT8Lhvof5k2R4ghWU9gb0DXUni4Vt1M3sGv+qz2TFbtz2Up 1zMw== X-Gm-Message-State: AO0yUKXre+sBhWGF8QVWQFNwQtgFKNuaJ4RDiW3APlxAYtAd/bxHEw2r obC/2J2OhQNSx5+3a4OA58aRFC8o/nY= X-Google-Smtp-Source: AK7set/SMlUwb/9VgmkkG4sV+isjiKs0fe+0qnENSLmpePPb7/v23Dr8TvN+jkF+XhftN/2jWHjBUw== X-Received: by 2002:a05:622a:2ca:b0:3b9:b1a1:73ec with SMTP id a10-20020a05622a02ca00b003b9b1a173ecmr22307637qtx.23.1675458937693; Fri, 03 Feb 2023 13:15:37 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-14-76-71-123-7.dsl.bell.ca. [76.71.123.7]) by smtp.gmail.com with ESMTPSA id br15-20020a05620a460f00b00706bc44fda8sm2531004qkb.79.2023.02.03.13.15.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 13:15:36 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , John Kacur Subject: [PATCH 3/8] rteval: rtevalXMLRPC.py: Convert regular strings to f-strings Date: Fri, 3 Feb 2023 16:15:22 -0500 Message-Id: <20230203211527.71181-3-jkacur@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203211527.71181-1-jkacur@redhat.com> References: <20230203211527.71181-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Convert regular strings to f-strings in rtevalXMLRPC.py Signed-off-by: John Kacur --- rteval/rtevalXMLRPC.py | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/rteval/rtevalXMLRPC.py b/rteval/rtevalXMLRPC.py index f24e21a8ed2f..6dce12ad78bb 100644 --- a/rteval/rtevalXMLRPC.py +++ b/rteval/rtevalXMLRPC.py @@ -33,7 +33,7 @@ from .Log import Log class rtevalXMLRPC: def __init__(self, host, logger, mailer=None): self.__host = host - self.__url = "http://%s/rteval/API1/" % self.__host + self.__url = f"http://{self.__host}/rteval/API1/" self.__logger = logger self.__mailer = mailer self.__client = rtevalclient.rtevalclient(self.__url) @@ -41,7 +41,7 @@ class rtevalXMLRPC: def Ping(self): res = None - self.__logger.log(Log.DEBUG, "Checking if XML-RPC server '%s' is reachable" % self.__host) + self.__logger.log(Log.DEBUG, f"Checking if XML-RPC server '{self.__host}' is reachable") attempt = 0 ping_success = False warning_sent = False @@ -52,10 +52,10 @@ class rtevalXMLRPC: ping_success = True except xmlrpc.client.ProtocolError: # Server do not support Hello(), but is reachable - self.__logger.log(Log.INFO, "Got XML-RPC connection with %s but it did not support Hello()" % self.__host) + self.__logger.log(Log.INFO, f"Got XML-RPC connection with {self.__host} but it did not support Hello()") res = None except socket.error as err: - self.__logger.log(Log.INFO, "Could not establish XML-RPC contact with %s\n%s" % (self.__host, str(err))) + self.__logger.log(Log.INFO, f"Could not establish XML-RPC contact with {self.__host}\n{str(err)}") # Do attempts handling attempt += 1 @@ -63,17 +63,16 @@ class rtevalXMLRPC: break # To avoid sleeping before we abort if (self.__mailer is not None) and (not warning_sent): - self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to ping XML-RPC server", "Server %s did not respond." % self.__host) + self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to ping XML-RPC server", f"Server {self.__host} did not respond.") warning_sent = True - print("Failed pinging XML-RPC server. Doing another attempt(%i) " % attempt) + print(f"Failed pinging XML-RPC server. Doing another attempt({attempt}) ") time.sleep(attempt) #*15) # Incremental sleep - sleep attempts*15 seconds ping_success = False if res: - self.__logger.log(Log.INFO, "Verified XML-RPC connection with %s (XML-RPC API version: %i)" % (res["server"], res["APIversion"])) - self.__logger.log(Log.DEBUG, "Recieved greeting: %s" % res["greeting"]) - + self.__logger.log(Log.INFO, f'Verified XML-RPC connection with {res["server"]} (XML-RPC API version: {res["APIversion"]})') + self.__logger.log(Log.DEBUG, f"Recieved greeting: {res['greeting']}") return ping_success @@ -85,9 +84,9 @@ class rtevalXMLRPC: warning_sent = False while attempt < 6: try: - print("Submitting report to %s" % self.__url) + print(f"Submitting report to {self.__url}") rterid = self.__client.SendReport(xmlreport) - print("Report registered with submission id %i" % rterid) + print(f"Report registered with submission id {rterid}") attempt = 10 exitcode = 0 # Success except socket.error: @@ -96,12 +95,10 @@ class rtevalXMLRPC: break # To avoid sleeping before we abort if (self.__mailer is not None) and (not warning_sent): - self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to submit report to XML-RPC server", - "Server %s did not respond. Not giving up yet." - % self.__host) + self.__mailer.SendMessage("[RTEVAL:WARNING] Failed to submit report to XML-RPC server", f"Server {self.__host} did not respond. Not giving up yet.") warning_sent = True - print("Failed sending report. Doing another attempt(%i) " % attempt) + print(f"Failed sending report. Making another attempt({attempt}) ") time.sleep(attempt) #*5*60) # Incremental sleep - sleep attempts*5 minutes except Exception as err: @@ -111,12 +108,9 @@ class rtevalXMLRPC: if self.__mailer is not None: # Send final result messages if exitcode == 2: - self.__mailer.SendMessage("[RTEVAL:FAILURE] Failed to submit report to XML-RPC server", - "Server %s did not respond at all after %i attempts." - % (self.__host, attempt - 1)) + self.__mailer.SendMessage("[RTEVAL:FAILURE] Failed to submit report to XML-RPC server", f"Server {self.__host} did not respond at all after {attempt - 1} attempts.") elif (exitcode == 0) and warning_sent: self.__mailer.SendMessage("[RTEVAL:SUCCESS] XML-RPC server available again", - "Succeeded to submit the report to %s" - % self.__host) + f"Succeeded to submit the report to {self.__host}") return exitcode From patchwork Fri Feb 3 21:15:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 650541 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D5368C64EC3 for ; Fri, 3 Feb 2023 21:16:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233341AbjBCVQE (ORCPT ); Fri, 3 Feb 2023 16:16:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59426 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233733AbjBCVP5 (ORCPT ); Fri, 3 Feb 2023 16:15:57 -0500 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 893DF3E624 for ; Fri, 3 Feb 2023 13:15:40 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id m26so7017501qtp.9 for ; Fri, 03 Feb 2023 13:15:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=DYHFwBql9yDJdrtxm7rhuu/vT39X4ElwB4K31Kfb6+0=; b=q0jYAd+p5MzI8vnZ9bYIxPN0Ho47S8Dv9yz8wrU/Pul84eYYu5ctYheGuj0IMSkM3a FB6YBSKpqVk4atf4agO3TA9B2a8NKnbDLlzvkk+xnKQ4cuAuwl6xwKSn1D//MbZZJPPT Wpf3DfRvyHhDXVvyP6xloWiv+yS3QWx8AFSG0r+mD8nY0mM3I3Mc8B64sUrOku6OhjWB NsurSF+DJn+PYrCw5fxkXPL0r/CTCVe0BZUj/sL2JoXMMGdlf4jf8rST1hTkVY3ubb2w /1+91jPU670QxO6jjP3GZZOMcjRwJa4RsGTzVZp5QFm55FT0lc+aPwv+wIINBgab23C8 DtCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=DYHFwBql9yDJdrtxm7rhuu/vT39X4ElwB4K31Kfb6+0=; b=QDTHKoDawHJUNgT//XanUfVxT9vjSxg4LyhBFcqgDj0eDZwA5cWkqsD9H6AgCD5skw yBUJH0ptPnmN7X+clsoLa11/2WYagbJCI/LLBbspdHJozAHL25Mh6xaR4Gq17YwlNhxS 5ev+yUHOTr8MzF68icf2pk23TvNDi8r0HtstTer7o74dfKoAkovyS8N5kqFel/G5cWaF wqeyVAFwm9wCMRE4Ov6FbNZP5DmzdHA1kOfy/TQVUZmKsovK0tUynsYtlJHV560/nLlG Yh413++p9xZ/no6MV6Ll86shDi9I1R21ryrLERaTQzdT+qMHYD6e8IkfyRHtuvFJsbtb kzAA== X-Gm-Message-State: AO0yUKXH3r6zYdP51h+112JtbZBSuJ/w7AyOoAbh00wWpRhQM1esdcTd tyQTPffo5x1XPchEUWGPTXsHU4zTGXw= X-Google-Smtp-Source: AK7set8WaoqBkbBvmhKbXbe7iqVQkt1esjA4kP7TL6w/w66tYeTcJaeC1suQ5YtGK68mrxL7ys4GIg== X-Received: by 2002:a05:622a:13d1:b0:3b6:3596:182b with SMTP id p17-20020a05622a13d100b003b63596182bmr21717166qtk.36.1675458939038; Fri, 03 Feb 2023 13:15:39 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-14-76-71-123-7.dsl.bell.ca. [76.71.123.7]) by smtp.gmail.com with ESMTPSA id br15-20020a05620a460f00b00706bc44fda8sm2531004qkb.79.2023.02.03.13.15.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 13:15:38 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , John Kacur Subject: [PATCH 4/8] rteval: rtevalConfig.py: Convert regular strings to f-strings Date: Fri, 3 Feb 2023 16:15:23 -0500 Message-Id: <20230203211527.71181-4-jkacur@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203211527.71181-1-jkacur@redhat.com> References: <20230203211527.71181-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Convert regular strings to f-strings in rtevalConfig.py Signed-off-by: John Kacur --- rteval/rtevalConfig.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rteval/rtevalConfig.py b/rteval/rtevalConfig.py index decd36ed18ab..de88924642ca 100644 --- a/rteval/rtevalConfig.py +++ b/rteval/rtevalConfig.py @@ -196,7 +196,7 @@ class rtevalConfig: # get our system topology info self.__systopology = SysTopology() - print(("got system topology: %s" % self.__systopology)) + print(f"got system topology: {self.__systopology}") # Import the default config first for sect, vals in list(default_config.items()): @@ -225,7 +225,7 @@ class rtevalConfig: "Simple method for dumping config when object is used as a string" ret = "" for sect in list(self.__config_data.keys()): - ret += "[%s]\n%s\n" % (sect, str(self.__config_data[sect])) + ret += f"[{sect}]\n{str(self.__config_data[sect])}\n" return ret @@ -240,7 +240,7 @@ class rtevalConfig: for f in ('rteval.conf', '/etc/rteval.conf'): p = os.path.abspath(f) if os.path.exists(p): - self.__info("found config file %s" % p) + self.__info(f"found config file {p}") return p raise RuntimeError("Unable to find configfile") @@ -258,7 +258,7 @@ class rtevalConfig: # Don't try to reread this file if it's already been parsed return - self.__info("reading config file %s" % cfgfile) + self.__info(f"reading config file {cfgfile}") ini = configparser.ConfigParser() ini.optionxform = str ini.read(cfgfile) @@ -321,7 +321,7 @@ class rtevalConfig: # Return a new object with config settings of a given section return self.__config_data[section] except KeyError: - raise KeyError("The section '%s' does not exist in the config file" % section) + raise KeyError(f"The section '{section}' does not exist in the config file") def unit_test(rootdir): From patchwork Fri Feb 3 21:15:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 651206 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 086B1C05027 for ; Fri, 3 Feb 2023 21:16:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233581AbjBCVQF (ORCPT ); Fri, 3 Feb 2023 16:16:05 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59430 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233741AbjBCVP6 (ORCPT ); Fri, 3 Feb 2023 16:15:58 -0500 Received: from mail-qv1-xf2b.google.com (mail-qv1-xf2b.google.com [IPv6:2607:f8b0:4864:20::f2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1278C3E094 for ; Fri, 3 Feb 2023 13:15:42 -0800 (PST) Received: by mail-qv1-xf2b.google.com with SMTP id jf11so3658062qvb.4 for ; Fri, 03 Feb 2023 13:15:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=sbm3UeRZlKObssufKU07+Am1x9iSVkxm/kD5oFGhp0Q=; b=ks+Fbxkm7/lGj8HgblM/c6Qn1KbxAgOiwNrDlyEwkYg/5W/Do6ABNAC2UWWi5fB5CA JqeO545BDCETgP4GvHQf7yG3hbx/DkRZSzCv1sFZWx+8r8K+TfYbirPZwUowRLHmAjqs 2qGR5nmL8mnfqga4rUjRLZWZmIy6ApDy0Iikicq5chDhyaUSOd2bvQaQakXljtjPvfXt iFr3vWt+dod+xTFY8iMPQwCeyHpSXjAUWTtL5iY2FBF+WcR3J8Dh1UVdhiRd6o9bOyVh XvXQXSYqCU0e0vvG0iFaHBmZWblEMgdPA6QK7mTGfBYjf/XeyzAaqXrUXZO9yCVHIjFF Li3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=sbm3UeRZlKObssufKU07+Am1x9iSVkxm/kD5oFGhp0Q=; b=xlR05oTs+XSsfBFsnNQNjpLtjNjCUS1YrfiC8yLiT/r8WYzmc2RctMNigX1UVyOKZE s380r7Yab0JxfBNirS+CyTDVxgTdBK66wCvrEIR79jnm9oXvl25cD2Y7XyrYc4TVLK// h57vh8zUspBcq2VAHUETGbi1mvqxIaeuRrO+HKSNDbO3Tgx0Imzv7Q/qlDy0oF7vTPy/ GSl8Totsvoabz0cA+qENOqwiB/gTmU+3hWsRPtGIjGM5f06NL0AqG30JjE4LU1ZOpy9F y7biibvZdlbOpFrIYqtboytZxtypM4ybYAbJAv4qXM/ZhRsgdZAYqUz3geZLWJqZ7dx6 BeWQ== X-Gm-Message-State: AO0yUKVieGVt6ROqpd0zJzsY4z8tGPLxiy0CWSjk2WsfgkEd/3JmtAHq 5ZUSihQritj2KoS7izwsrnTUUKwJ61w= X-Google-Smtp-Source: AK7set999o3u7+ykTooqWVHa6bLXSTzWp7tzqwEUog55AEOBxP21btLrEdlvL+ow4F+RLlPiToYAKw== X-Received: by 2002:a05:6214:12d0:b0:537:695e:9f13 with SMTP id s16-20020a05621412d000b00537695e9f13mr16853342qvv.34.1675458940553; Fri, 03 Feb 2023 13:15:40 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-14-76-71-123-7.dsl.bell.ca. [76.71.123.7]) by smtp.gmail.com with ESMTPSA id br15-20020a05620a460f00b00706bc44fda8sm2531004qkb.79.2023.02.03.13.15.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 13:15:39 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , John Kacur Subject: [PATCH 5/8] rteval: xmlout.py: Convert to f-strings where possible Date: Fri, 3 Feb 2023 16:15:24 -0500 Message-Id: <20230203211527.71181-5-jkacur@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203211527.71181-1-jkacur@redhat.com> References: <20230203211527.71181-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Convert xmlout.py to f-strings where possible Signed-off-by: John Kacur --- rteval/xmlout.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/rteval/xmlout.py b/rteval/xmlout.py index a955fb11c77a..b549cc87a2cc 100644 --- a/rteval/xmlout.py +++ b/rteval/xmlout.py @@ -67,7 +67,7 @@ class XMLOut: def __del__(self): if self.level > 0: - raise RuntimeError("XMLOut: open blocks at __del__ (last opened '%s')" % self.currtag.name) + raise RuntimeError(f"XMLOut: open blocks at __del__ (last opened '{self.currtag.name}')") if self.xmldoc is not None: self.xmldoc.freeDoc() @@ -131,7 +131,7 @@ class XMLOut: self.__parseToXML(n, v) node.addChild(n) else: - raise TypeError("unhandled type (%s) for value '%s'" % (type(data), str(data))) + raise TypeError(f"unhandled type ({str(type(data))}) for value '{str(data)}'") def close(self): if self.status == 0: @@ -139,7 +139,7 @@ class XMLOut: if self.status == 3: raise RuntimeError("XMLOut: XML document already closed") if self.level > 0: - raise RuntimeError("XMLOut: open blocks at close() (last opened '%s')" % self.currtag.name) + raise RuntimeError(f"XMLOut: open blocks at close() (last opened '{self.currtag.name}')") if self.status == 1: # Only set the root node in the doc on created reports (NewReport called) self.xmldoc.setRootElement(self.xmlroot) @@ -172,7 +172,7 @@ class XMLOut: root = self.xmldoc.children if root.name != self.roottag: self.status = 3 - raise RuntimeError("XMLOut: Loaded report is not a valid %s XML file" % self.roottag) + raise RuntimeError(f"XMLOut: Loaded report is not a valid {self.roottag} XML file") if validate_version is True: ver = root.hasProp('version') @@ -183,7 +183,7 @@ class XMLOut: if ver.getContent() != self.version: self.status = 3 - raise RuntimeError("XMLOut: Loaded report is not of version %s" % self.version) + raise RuntimeError(f"XMLOut: Loaded report is not of version {self.version}") self.status = 2 # Confirm that we have loaded a report from file From patchwork Fri Feb 3 21:15:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 650540 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72AF3C05027 for ; Fri, 3 Feb 2023 21:16:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233740AbjBCVQI (ORCPT ); Fri, 3 Feb 2023 16:16:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60032 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233751AbjBCVP7 (ORCPT ); Fri, 3 Feb 2023 16:15:59 -0500 Received: from mail-qt1-x835.google.com (mail-qt1-x835.google.com [IPv6:2607:f8b0:4864:20::835]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8527838EAA for ; Fri, 3 Feb 2023 13:15:43 -0800 (PST) Received: by mail-qt1-x835.google.com with SMTP id g8so7001743qtq.13 for ; Fri, 03 Feb 2023 13:15:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=LHJRzDobW7a1YAjs6ATWZwHOSKCBI3eNm4mlLC/FZok=; b=ErJfU91yCZqkSK3osju4y7ww3FW/Ypqc9x4pMjtuif601v0jMz7VCO0I0vkC3ZPskG 7XQ9eBCQ1YixAw60xHdYrlZ1UL40E5C5NAiyw8pJ8yw0bxo+EPQIXOdggwHCzcZue+/x ybH1IY2IHP7TFufmv6uc/6iPIJGPduo681U2OxdC4z5NbIPHyQ7eKbM/cB1Nk3ZQuN5l fhV2wsg+4D+qzdao6Fu5GT2GtxjJCDAwy/ohOc+Yeh/Tz/Ro+y3XL9RlrxJIrv7/+ZuU fFjMDeUHRGu1A8GfUzvbQtMNEbiGIl2b5U/UUqhhbG9uO7lNrQ89QMC6K3GGg1P+5nZm h31g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=LHJRzDobW7a1YAjs6ATWZwHOSKCBI3eNm4mlLC/FZok=; b=jutQRyaeELLfJD2fWQkANEeVTD/+Gdw/2DI0t47ZJVMNkQZLKTSpO+SBc3VKZd/3qs aQjTjBR4y125Dn9ulVTptyrwC5YKB1a0Nh86nE6ZzP70e6llVOzlUMkz4/EKpuRo28pt wilkCVjrt8tsnWSmdxpL7y8Jghrmd+9c2Mpn3s41L74ci4Gh4HvaMzwBr8XURY3sxcB6 P/1vqdh1jc1vTPCBBtjpBOMZQ3kKO11y4x19fKVmOfAKQeoXg9h4J3OkM2zfrtgyDg8m UcNdl/vfndZsbBNp24KaxrfVwOLOB4l9p88+DwqE1UP39cxJuqQ869DKFUdqmlctQ/sz 2NrQ== X-Gm-Message-State: AO0yUKX94b9wATp06B83FYfpVE/6N1TWQRPTDIq5db53bbUSTLMUIGDy VVIh+dH8pYV1XK4bv0WlNxXNsuWx0PU= X-Google-Smtp-Source: AK7set8zOzGOJwAvQVITB0tLKWrbOG3rY72TIdl+H0pAXye1GEWbqQCljB676wrUEf5jCRJwVMnalg== X-Received: by 2002:ac8:41d4:0:b0:3b9:bc8c:c1fc with SMTP id o20-20020ac841d4000000b003b9bc8cc1fcmr9002955qtm.7.1675458942122; Fri, 03 Feb 2023 13:15:42 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-14-76-71-123-7.dsl.bell.ca. [76.71.123.7]) by smtp.gmail.com with ESMTPSA id br15-20020a05620a460f00b00706bc44fda8sm2531004qkb.79.2023.02.03.13.15.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 13:15:41 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , John Kacur Subject: [PATCH 6/8] rteval: Log.py: Convert to f-strings Date: Fri, 3 Feb 2023 16:15:25 -0500 Message-Id: <20230203211527.71181-6-jkacur@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203211527.71181-1-jkacur@redhat.com> References: <20230203211527.71181-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Convert Log.py to f-strings Signed-off-by: John Kacur --- rteval/Log.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/rteval/Log.py b/rteval/Log.py index 63ca3b8681f8..8d08ab3e210a 100644 --- a/rteval/Log.py +++ b/rteval/Log.py @@ -60,10 +60,7 @@ class Log: def log(self, logtype, msg): if (logtype & self.__logverb) or logtype == self.ALWAYS: - self.__logfile.write("%s%s\n" % - (self.__logtype_str(logtype), - msg) - ) + self.__logfile.write(f"{self.__logtype_str(logtype)}{msg}\n") @@ -80,8 +77,8 @@ def unit_test(rootdir): def run_log_test(l): for lt in range(min(logtypes), max(logtypes)*2): test = ", ".join([logtypes_s[logtypes.index(i)] for i in [p for p in takewhile(lambda x: x <= lt, (2**i for i in count())) if p & lt]]) - print("Testing verbosity flags set to: (%i) %s" % (lt, test)) - msg = "Log entry when verbosity is set to %i [%s]" % (lt, test) + print(f"Testing verbosity flags set to: ({lt}) {test}") + msg = f"Log entry when verbosity is set to {lt} [{test}]" l.SetLogVerbosity(lt) test_log(l, msg) print("-"*20) From patchwork Fri Feb 3 21:15:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 651205 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37D8FC61DA4 for ; Fri, 3 Feb 2023 21:16:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233568AbjBCVQO (ORCPT ); Fri, 3 Feb 2023 16:16:14 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233602AbjBCVP7 (ORCPT ); Fri, 3 Feb 2023 16:15:59 -0500 Received: from mail-qv1-xf34.google.com (mail-qv1-xf34.google.com [IPv6:2607:f8b0:4864:20::f34]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 13D67A8793 for ; Fri, 3 Feb 2023 13:15:45 -0800 (PST) Received: by mail-qv1-xf34.google.com with SMTP id k18so3648793qvm.7 for ; Fri, 03 Feb 2023 13:15:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=sLU+RcBrQWKqw2VXU2hRmXDAh0kROsoTCVz/TKP7/Ww=; b=ZNmxHHrfsOhOf5XTROyGVPKwoIhXAAw76vZA8igRdurfWQDVxcDg+9nCUZV1KJcz7b Zl1Lv2EMHoEHZULKAgkjeoyB7TwimyG9gwNqiM4NzDWLWKrrk2hm//HLBYjmAKsj/C37 oB00LKVsYSv9dyXF+r/VPD5p39s/8VvblkZ8h+PB8Mthyzadw9kk9R6gwOmLoy606jdx IwbncTZERI/v8kgVcy2PCUFECN4IyykLoVF9EbK4HIBtVIrShNUvqjIiwLfMbkdosVGo ab+RU5Z81L9ZI/q2pUI8nZlkhuEB/F1wD5In/ME4jVa9rsSgIESQrGrX3q7ukv/eZFsi tTxg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=sLU+RcBrQWKqw2VXU2hRmXDAh0kROsoTCVz/TKP7/Ww=; b=nZipHtzaf2PGepMYvrjAEFwOFFvd2liLKyq04yfi/9herFFDMt60A/4QAR56lGhhwX 1Bh8JYr9N531SmBJUSuB68JOjOiWrTRopILQonp0h25gCbQ5SH6hIvHsR6oqoTa674+y lqQtjRNxtX8HDm6oOESAANm9A1Ovha1zR64140cO6HtaqMSUQgknaaYXEMlUyCELTOI0 fKuQPGZSiOtMOVJ8mLNC9f/+kmv6oW5/6L5RecyFYRXWu0gP7mQUnlJs7o24goqS2x1i evVB8bkd1tc4aoIxO3ihMQ40o9Pxnlufrba7d2/E3hNxD797dQ5saan6afE55c+/ofWv 52lA== X-Gm-Message-State: AO0yUKXvsJnNvupOqEf5nspZe1UQWwUY2zEfrTrBU1gRukXgGOHuzbGo TNDIX2cKg6jHAAbx82ujLdszaXpYmSM= X-Google-Smtp-Source: AK7set+m+17H0OCI8cUUnT8rH37eiOU5TmSmyvzMXV/IE/Vi/bd4Pee7io3mzyHjH86Ffk5dKdHr4w== X-Received: by 2002:a0c:b38a:0:b0:534:c933:4d5b with SMTP id t10-20020a0cb38a000000b00534c9334d5bmr17319792qve.46.1675458943637; Fri, 03 Feb 2023 13:15:43 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-14-76-71-123-7.dsl.bell.ca. [76.71.123.7]) by smtp.gmail.com with ESMTPSA id br15-20020a05620a460f00b00706bc44fda8sm2531004qkb.79.2023.02.03.13.15.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 13:15:42 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , John Kacur Subject: [PATCH 7/8] rteval: Catch failures in python-dmidecode Date: Fri, 3 Feb 2023 16:15:26 -0500 Message-Id: <20230203211527.71181-7-jkacur@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203211527.71181-1-jkacur@redhat.com> References: <20230203211527.71181-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org python-dmidecode can generate incorrect xml, namely Attribute unit redefined Although useful, the dmidecode is not critical to rteval reporting. Therefore catch this, and first see if we can at least query the bios. If that works report the bios instead of all, and if that doesn't work, just continue without the dmidecode report. Signed-off-by: John Kacur --- rteval/sysinfo/dmi.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/rteval/sysinfo/dmi.py b/rteval/sysinfo/dmi.py index 83f347623b58..89a7faae06b1 100644 --- a/rteval/sysinfo/dmi.py +++ b/rteval/sysinfo/dmi.py @@ -79,6 +79,7 @@ class DMIinfo: def __init__(self, logger=None): self.__version = '0.6' + self._log = logger if not dmidecode_avail: logger.log(Log.DEBUG, "DMI info unavailable, ignoring DMI tables") @@ -115,7 +116,18 @@ class DMIinfo: rep_n.newProp("not_available", "1") else: self.__dmixml.SetResultType(dmidecode.DMIXML_DOC) - dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('all')) + try: + dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('all')) + except Exception as ex1: + self._log.log(Log.DEBUG, f'** EXCEPTION {str(ex1)}, will query BIOS only') + try: + # If we can't query 'all', at least query 'bios' + dmiqry = xmlout.convert_libxml2_to_lxml_doc(self.__dmixml.QuerySection('bios')) + except Exception as ex2: + rep_n.addContent("No DMI tables available") + rep_n.newProp("not_available", "1") + self._log.log(Log.DEBUG, f'** EXCEPTION {str(ex2)}, dmi info will not be reported') + return rep_n resdoc = self.__xsltparser(dmiqry) dmi_n = xmlout.convert_lxml_to_libxml2_nodes(resdoc.getroot()) rep_n.addChild(dmi_n) From patchwork Fri Feb 3 21:15:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 650539 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CF06C636CC for ; Fri, 3 Feb 2023 21:16:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233612AbjBCVQP (ORCPT ); Fri, 3 Feb 2023 16:16:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59894 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233758AbjBCVQA (ORCPT ); Fri, 3 Feb 2023 16:16:00 -0500 Received: from mail-qt1-x82c.google.com (mail-qt1-x82c.google.com [IPv6:2607:f8b0:4864:20::82c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B1AB9D59E for ; Fri, 3 Feb 2023 13:15:46 -0800 (PST) Received: by mail-qt1-x82c.google.com with SMTP id g7so7009594qto.11 for ; Fri, 03 Feb 2023 13:15:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=SAmJ4bWrL6uHqTRBbi7KacegWXByiEy1/B9GJH3uDyg=; b=iK8DNtpGkBcdFXmkYQcDV/JecbiFNQFQXIqlAgxkfFQGgJ+5a3I41XaIVSd1RYHjtK FEZhBKw8IrbstufsNYKfA/86gjSzhJIjVa0NDDatPDRz2+MWgO/o4PVBBW1q7fVKVArs AtduEWsjUs1nMSV51lhxx4PCzmipO3o4r6YBzabGX/hKCXHbavZR+4xARlolKAxKacCd hmdZvtQKQ/QiULsqaMr7tnniKZQ1DFYjx83ZQSH7SsJQQFeiAI5oklfoYX3/YFuAEuIa ISDdJR3TlnHWmVfZB7jk+29IJPn39vF5GLRA/pwsnsrEmnoz3yCx+osYyqXqL1QQbNZv JBJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SAmJ4bWrL6uHqTRBbi7KacegWXByiEy1/B9GJH3uDyg=; b=QvFrzqY6399WWwiGX1a0yIUlgq3A7Eagkl82ccTqCHKYbXVNlNPFUFgtpSYJx8sNB1 1VgTxM4gy9t+IB2iI97kiw1bWEIzg8B6czzDQ7QSJfp/06xr/ofQlbOLM297cEbLelNi ycDM7IRgod2J8ggKPAwhpibxBZatgp8+8fXgnQvXRTQbpPVwusnsC/cKwjXybbAuqW+Q eRE7MQRctJodfYHX1qvFDbJ2ILW0SwC1cok2zsUEizEWV50o3FiPZYB42yvVJn/kBRhv zL6syeL/ya3aE0bUoEDU+TKoCkXsGlk9zX3EGQbjoyXdEK/zwozEu3NuuhTraqJhRrBH n8tw== X-Gm-Message-State: AO0yUKUzbamLGLY7ixsc6jOAWTzu7+J4wxyssO6az+OLxHbKPW/wsw/x 3Ic5bLZS3FQnSX2KTfbXxDqV0mrSWGQ= X-Google-Smtp-Source: AK7set8HAyTfP8ZgE/OsQKvY/dDs1hg3hfERqM3COZfoaRDJShNb+K9X6gHhOJHvM/HpjEnw7+pV5A== X-Received: by 2002:ac8:5a4b:0:b0:3b6:8881:6b07 with SMTP id o11-20020ac85a4b000000b003b688816b07mr19763635qta.48.1675458945188; Fri, 03 Feb 2023 13:15:45 -0800 (PST) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-14-76-71-123-7.dsl.bell.ca. [76.71.123.7]) by smtp.gmail.com with ESMTPSA id br15-20020a05620a460f00b00706bc44fda8sm2531004qkb.79.2023.02.03.13.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Feb 2023 13:15:44 -0800 (PST) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , John Kacur Subject: [PATCH 8/8] rteval: Change the default kernel to compile to linux-6.1.8 Date: Fri, 3 Feb 2023 16:15:27 -0500 Message-Id: <20230203211527.71181-8-jkacur@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230203211527.71181-1-jkacur@redhat.com> References: <20230203211527.71181-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org rteval compiles the linux kernel as a load Change the default kernel that rteval compiles to linux-6.1.8 Signed-off-by: John Kacur --- Makefile | 2 +- rteval/modules/loads/kcompile.py | 4 ++-- rteval/rteval.conf | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index ffea8a05f460..81ca8242bbbe 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ PREFIX := /usr DATADIR := $(DESTDIR)/$(PREFIX)/share LOADDIR := loadsource -KLOAD := $(LOADDIR)/linux-5.18.1.tar.xz +KLOAD := $(LOADDIR)/linux-6.1.8.tar.xz BLOAD := $(LOADDIR)/dbench-4.0.tar.gz LOADS := $(KLOAD) $(BLOAD) diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py index 6faa686f81d0..35ee5cbbb52d 100644 --- a/rteval/modules/loads/kcompile.py +++ b/rteval/modules/loads/kcompile.py @@ -38,7 +38,7 @@ from rteval.systopology import CpuList, SysTopology expand_cpulist = CpuList.expand_cpulist compress_cpulist = CpuList.compress_cpulist -DEFAULT_KERNEL_PREFIX = "linux-5.18" +DEFAULT_KERNEL_PREFIX = "linux-6.1" class KBuildJob: '''Class to manage a build job bound to a particular node''' @@ -349,7 +349,7 @@ class Kcompile(CommandLineLoad): def ModuleParameters(): return {"source": {"descr": "Source tar ball", - "default": "linux-5.18.1.tar.xz", + "default": "linux-6.1.8.tar.xz", "metavar": "TARBALL"}, "jobspercore": {"descr": "Number of working threads per core", "default": 2, diff --git a/rteval/rteval.conf b/rteval/rteval.conf index 1a8d0afd2642..79e28032dc6b 100644 --- a/rteval/rteval.conf +++ b/rteval/rteval.conf @@ -18,7 +18,7 @@ dbench: external stressng: module [kcompile] -source: linux-5.18.1.xz +source: linux-6.1.8.xz jobspercore: 2 [hackbench]