From patchwork Fri Jun 3 16:12:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 578604 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 7B9F0C433EF for ; Fri, 3 Jun 2022 16:12:38 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343665AbiFCQMh (ORCPT ); Fri, 3 Jun 2022 12:12:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343661AbiFCQMg (ORCPT ); Fri, 3 Jun 2022 12:12:36 -0400 Received: from mail-qv1-xf2a.google.com (mail-qv1-xf2a.google.com [IPv6:2607:f8b0:4864:20::f2a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 995033389C for ; Fri, 3 Jun 2022 09:12:34 -0700 (PDT) Received: by mail-qv1-xf2a.google.com with SMTP id j2so5869942qvp.9 for ; Fri, 03 Jun 2022 09:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZNf63hNMi0f9CJ5Yqp7nwiFopFCL87vgTQ0RBPzS+YM=; b=ilbe3NQy0wCmKO5NhX+ZFExAue1gFjWXlDjpiIWaQha8Fjzn50OG4mgb0FeynC2nQm 6x/jgulcmvxVK8VWFVsR3316vL+AlMnqBJ5mjeUdaajS4mTxqfHa5YO1O7EMX5hZEfVU 73xXGjqXleGB48vZ3SPsttDAKrerRh3g0DR0YrDi+j4Ry09TyNtugdjua1snprXbZirZ yfFZWMWI2wZyjUpkX1wDovA+k37cXOIbRoVDTb06pYTGfu6n72BT/7dMguUiozEKO04Z ed8KwtPOsgLq5otf/GqYV3CP6UA5GIKz3+4XMDMqcQ10IIBSqu9DiXqmhc3PBTmMgyYJ RYEA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :mime-version:content-transfer-encoding; bh=ZNf63hNMi0f9CJ5Yqp7nwiFopFCL87vgTQ0RBPzS+YM=; b=gLCHc7Q793FVVL4DmuIiD/tplQTEEZmIf/Axyvkkc476K+tVSBW/9C6zj7Y3iKsdYk CBG5z8A+wcOq4u0Rm5JTQ8WmPdUh7VpXhY+FjtbVgWw0UF3wMSs6UPT0fGy8bNY6kr5T 3VwgwsqgL3ybHUT/oV+HqegutZPhpsxFXoACHq+Z2cS7mx/GWwoXvPVcf/yT9bRhb5k1 +Cz34L5LIFd8nBnUQ+qWokNbL9NHTYFUk9ZKV6mlOR5+keiQ7oxg8FtZVjZa3e5mUG1b cEwtW172i0455LNphSG1nd0RdYcSW5FjWkpBp9g3JW9/QrhR5owwms3FzPcBMUP6FEUM X+9w== X-Gm-Message-State: AOAM530Zz2R4cUuLxsRloNhpr+KPXMS1GzH0/Jy5oW0u/psrGEt2TbIX WqW/tZNT3wsHR6d6t5pm8xEBybjXdBU= X-Google-Smtp-Source: ABdhPJxul0s9U7ZLXkvPdd9jXT2JigsfEN29/JkzxJezIJ+C+w8Wmgm6hsL0rw9SIR7K3B24+4oMQw== X-Received: by 2002:a05:6214:4013:b0:467:d600:76ea with SMTP id kd19-20020a056214401300b00467d60076eamr4998749qvb.70.1654272753450; Fri, 03 Jun 2022 09:12:33 -0700 (PDT) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-09-184-147-143-93.dsl.bell.ca. [184.147.143.93]) by smtp.gmail.com with ESMTPSA id n12-20020a05622a11cc00b003022cdcd28bsm5234973qtk.2.2022.06.03.09.12.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 09:12:33 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Valentin Schneider , Manasi Godse , John Kacur Subject: [PATCH 1/7] rteval: rteval-cmd: Use "with" with open Date: Fri, 3 Jun 2022 12:12:18 -0400 Message-Id: <20220603161224.10947-1-jkacur@redhat.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Use "with" for resource allocating operation open Signed-off-by: John Kacur --- rteval-cmd | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/rteval-cmd b/rteval-cmd index 2c775ee52f69..4598ba514ddc 100755 --- a/rteval-cmd +++ b/rteval-cmd @@ -72,15 +72,13 @@ def summarize(repfile, xslt): isarchive = True # Load the XSLT template - xsltfp = open(xslt, "r") - xsltdoc = lxml.etree.parse(xsltfp) - xsltprs = lxml.etree.XSLT(xsltdoc) - xsltfp.close() + with open(xslt, "r") as xsltfp: + xsltdoc = lxml.etree.parse(xsltfp) + xsltprs = lxml.etree.XSLT(xsltdoc) # Load the summay.xml report - with some simple sanity checks - xmlfp = open(summaryfile, "r") - xmldoc = lxml.etree.parse(xmlfp) - xmlfp.close() + with open(summaryfile, "r") as xmlfp: + xmldoc = lxml.etree.parse(xmlfp) if xmldoc.docinfo.root_name != 'rteval': raise RuntimeError("The report doesn't seem like a rteval summary report") From patchwork Fri Jun 3 16:12:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 578840 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 52138C433EF for ; Fri, 3 Jun 2022 16:12:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343680AbiFCQMl (ORCPT ); Fri, 3 Jun 2022 12:12:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241391AbiFCQMj (ORCPT ); Fri, 3 Jun 2022 12:12:39 -0400 Received: from mail-qv1-xf2e.google.com (mail-qv1-xf2e.google.com [IPv6:2607:f8b0:4864:20::f2e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ABB5D5131B for ; Fri, 3 Jun 2022 09:12:35 -0700 (PDT) Received: by mail-qv1-xf2e.google.com with SMTP id ea7so5861218qvb.12 for ; Fri, 03 Jun 2022 09:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=xusc7CaWy4EXEaPn8FcYGHWAN3q0Pvb46rghq/RuOug=; b=ZyPIin4Qx0zEXxwNJp/3RYxygJUxBLbJ7Dh2g5cVp+w/xSJWjrE8nZNVP4QDi3cOEK CIwjOAAD3T8DtSOJX859P0ze1qa/G8plVWVIqqF9wRyiOqhb/IqVmZ8sF14rn6uvhoaS FzGbtya8tGUiHx+FCAQDSwPkPkhtT7W0HaapZWuQvfVXbt3MJ4BvAccapIP/JcjVDawH 3K3YgTO1sZUR5gIuPPR29PqV74hzMkqHY4W6X5iZx0KvYnh/aG/+TpsbVuq+bya4y4qK SnrIC5kaS5mhA8JGr8VRkGskCnQl3zFFpmij/BpbxcDbC+0MItvBIIX7izlJViolZEG+ xC+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=xusc7CaWy4EXEaPn8FcYGHWAN3q0Pvb46rghq/RuOug=; b=l7zlVs6ZoieA/wSc4QywO6mqWZCmvNvnRId1m9h/saPCJcm1hO9P2zYZTUpvDR0UhM N62czz98Bbt6urVJtY4uA/U+KD+ICbcWIHCxi9kdrIzVujNvqQtBVt4wF0qjSpBN0o+u UL8qUOGoYlH3bW4cwRdpl7fxswITR8y57oqYAck9ug4yS4R4RXDfn22t6lWAmvyOKg4K NWB/ELXwnTzkyV3YJ2jFbLk9aYDh7siCmhO5Hc+lKZeE65/RzjSGr+Esxg7YGc+IL4Wo IlNM3y0E4ScdfaSfBBTk0dfyf9f09gNwIWlc65K2RfIFDIbnMql/lqBittkuCJbYsXmR 6CvQ== X-Gm-Message-State: AOAM5309cks6UDZbfVfrn2g2f+Tt2+G/Zab+a+EL5kkz927ajIejN+O0 vo69Xi+Tf+23S4wCKq5ZGHKzBQVjjwA= X-Google-Smtp-Source: ABdhPJzeJpt85OJ0X9QCZCbGbiFODlWbc/BmwdW4V0oAguovvopbXEC5IFlm6Qh7BPp+HQInnK5joA== X-Received: by 2002:a05:6214:2406:b0:464:41bb:3582 with SMTP id fv6-20020a056214240600b0046441bb3582mr7487319qvb.3.1654272754415; Fri, 03 Jun 2022 09:12:34 -0700 (PDT) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-09-184-147-143-93.dsl.bell.ca. [184.147.143.93]) by smtp.gmail.com with ESMTPSA id n12-20020a05622a11cc00b003022cdcd28bsm5234973qtk.2.2022.06.03.09.12.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 09:12:34 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Valentin Schneider , Manasi Godse , John Kacur Subject: [PATCH 2/7] rteval: misc.py: Use "with" for resource allocation Date: Fri, 3 Jun 2022 12:12:19 -0400 Message-Id: <20220603161224.10947-2-jkacur@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603161224.10947-1-jkacur@redhat.com> References: <20220603161224.10947-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org - Use "with" for resource allocation. - Add docstrings to the module and to functions Signed-off-by: John Kacur --- rteval/misc.py | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/rteval/misc.py b/rteval/misc.py index 6fdb24261bec..a7c515b0d293 100755 --- a/rteval/misc.py +++ b/rteval/misc.py @@ -15,6 +15,7 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +''' Functions for operating on a cpulists ''' import os @@ -36,6 +37,7 @@ def expand_cpulist(cpulist): return [str(i) for i in list(set(result))] def online_cpus(): + ''' Collapse a list of cpu numbers into a string range ''' online_cpus = [] # Check for the online file with cpu1 since cpu0 can't always be offlined if os.path.exists('/sys/devices/system/cpu/cpu1/online'): @@ -56,27 +58,31 @@ def online_cpus(): return online_cpus def invert_cpulist(cpulist): + ''' return a list of online cpus not in cpulist ''' return [c for c in online_cpus() if c not in cpulist] def compress_cpulist(cpulist): + ''' return a string representation of cpulist ''' if isinstance(cpulist[0], int): return ",".join(str(e) for e in cpulist) return ",".join(cpulist) def cpuinfo(): + ''' return a dictionary of cpu keys with various cpu information ''' core = -1 info = {} - for l in open('/proc/cpuinfo'): - l = l.strip() - if not l: - continue - # Split a maximum of one time. In case a model name has ':' in it - key, val = [i.strip() for i in l.split(':', 1)] - if key == 'processor': - core = val - info[core] = {} - continue - info[core][key] = val + with open('/proc/cpuinfo') as fp: + for l in fp: + l = l.strip() + if not l: + continue + # Split a maximum of one time. In case a model name has ':' in it + key, val = [i.strip() for i in l.split(':', 1)] + if key == 'processor': + core = val + info[core] = {} + continue + info[core][key] = val for (core, pcdict) in info.items(): if not 'model name' in pcdict: From patchwork Fri Jun 3 16:12:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 578603 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 136B2C43334 for ; Fri, 3 Jun 2022 16:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343666AbiFCQMn (ORCPT ); Fri, 3 Jun 2022 12:12:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343659AbiFCQMj (ORCPT ); Fri, 3 Jun 2022 12:12:39 -0400 Received: from mail-qv1-xf30.google.com (mail-qv1-xf30.google.com [IPv6:2607:f8b0:4864:20::f30]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 90B3B24591 for ; Fri, 3 Jun 2022 09:12:36 -0700 (PDT) Received: by mail-qv1-xf30.google.com with SMTP id c12so5896889qvr.3 for ; Fri, 03 Jun 2022 09:12:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=BbwmfuLS0mUDZI+i5hLQoLgqGPHyuFWXNcwgrI4nD8Y=; b=NRdRBlMlllJ3ExCbmrdBJWd+lNpAJ7HkeHzaU6NoRcsWYjLJ1LTz3NyZdsHO7/eeb9 FNPBXgXR78dWB0eT2SDbGiS2E1vX7hCRiBLERQREA225gr9DoJrY9TvK2wJK4CyIhdso Rx/f8YxfJFKcKrFGq1Kmz9cJ2V/l6zxmCeywP+yVX7Va90ScBbiOJV07yI+JI4PHqLYt 7qeeorYBYHpmr0t/vOxAVtTOHKrw3YlQpH6breGkpP9vuxJK4Fm2YRpZYWvusE4ASjrz ZJEw6zclfAJVrSqum0tfRcxc8YZBEQupNMibDueXVPTa+zxHGKnmpYQuzjAi6ljlfpcl iCJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=BbwmfuLS0mUDZI+i5hLQoLgqGPHyuFWXNcwgrI4nD8Y=; b=j5Defn8Ks6N8QiEK0EfDMhjzSetsLg5eqLzr1A2MWl91+pEZtOoZAeUW8mHNJNCfib eyqWcITu4iMTbmKOWcKYriIUXaH2J1AmIzBb/iQKMEo21aCg7Ov2x+siCpzUuOznf+0g jNsMmcRQNu9G/Q+ycA8c9LHL1VUeyAulTi9b6gWLArR72mJiUZDrR4A9d4DL5HaCMEwQ NMafOlCH+evCXrQTSCQZ1kvjId4F2tN5Dap4Taj5m15P72ke0VKC3uang2/aiPHpnkvR mdoHUQX51zhwp1ljw1cGGFRXBj+e2K7LynClDKyAQH2vCRl+RGOW2yo2kpV8s+yyvMS6 404g== X-Gm-Message-State: AOAM531K9Y+Lg6s0j4/jkjGa4TiKrpdJxOo1QvTH09d0ZqjBMeBqnRIG ejLp87SVcvh1+Eoe/M83ISqhxX+QERA= X-Google-Smtp-Source: ABdhPJzJwdQwnDFyNozJew+8gI6mbDgvf5ZqJG5C+VaTyFDujOs8cjKN/Xqm1hhLa9sjSbbz6OtZeg== X-Received: by 2002:ad4:5cab:0:b0:464:643b:1099 with SMTP id q11-20020ad45cab000000b00464643b1099mr14209184qvh.95.1654272755467; Fri, 03 Jun 2022 09:12:35 -0700 (PDT) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-09-184-147-143-93.dsl.bell.ca. [184.147.143.93]) by smtp.gmail.com with ESMTPSA id n12-20020a05622a11cc00b003022cdcd28bsm5234973qtk.2.2022.06.03.09.12.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 09:12:35 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Valentin Schneider , Manasi Godse , John Kacur Subject: [PATCH 3/7] rteval: stressng.py: Remove unnecessary list Date: Fri, 3 Jun 2022 12:12:20 -0400 Message-Id: <20220603161224.10947-3-jkacur@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603161224.10947-1-jkacur@redhat.com> References: <20220603161224.10947-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org Remove unnecessary word list around cpus.items() Signed-off-by: John Kacur --- rteval/modules/loads/stressng.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rteval/modules/loads/stressng.py b/rteval/modules/loads/stressng.py index d084814142fb..d0772ce77662 100644 --- a/rteval/modules/loads/stressng.py +++ b/rteval/modules/loads/stressng.py @@ -69,7 +69,7 @@ class Stressng(CommandLineLoad): cpus[n] = [c for c in cpus[n] if str(c) in expand_cpulist(self.cpulist)] # remove nodes with no cpus available for running - for node, cpu in list(cpus.items()): + for node, cpu in cpus.items(): if not cpu: nodes.remove(node) self._log(Log.DEBUG, "node %s has no available cpus, removing" % node) From patchwork Fri Jun 3 16:12:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 578839 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 473EDC433EF for ; Fri, 3 Jun 2022 16:12:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343685AbiFCQMo (ORCPT ); Fri, 3 Jun 2022 12:12:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47280 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343661AbiFCQMj (ORCPT ); Fri, 3 Jun 2022 12:12:39 -0400 Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F0F251326 for ; Fri, 3 Jun 2022 09:12:37 -0700 (PDT) Received: by mail-qk1-x736.google.com with SMTP id br33so4596536qkb.0 for ; Fri, 03 Jun 2022 09:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=iV1XT8cWEw4sm8BATQpBK4G1tXOnjegU46o+Tq7zcs0=; b=jib+asndWmOousLD2Hxscc5IJl7XZ8GYEbRaMNLynP5qWIat145eBrWNatuzdtkxVj t6LLZ7cDOPJb826cLTeq7CsjMADbbqISG1GSFoaZ747Js9yjvOZNOJfTmzeWD1Y2hrLJ yPleNHMfFCs4LHv0m3W5wif3OLRif8jHCaTckl3IY4oRpXqW5pvD5cQXcFZKHfpbFIHQ VG+7UVMi9ZPD+kt4E7qrchTk8tMqIIQCPPaY6KasKM2X2viO2W6q5gLYMMt0B12SEl/T pE9hbpj0aI4U2hDuVajadm7jA/39m5QtgAWoF04xJCdGej323r5vPYT/FMgSGRMZsBKG RnTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=iV1XT8cWEw4sm8BATQpBK4G1tXOnjegU46o+Tq7zcs0=; b=JTH2mEfi8NHCdv+1A0GC/7knYlTNqBkRZ2FxDpFtfwKip+PxlGbmjrwfjFwqGfqNJ8 bZcLhYs9Bg6naYtfY2jeO/4mNy2Ocx9iXc8tUMVuMp4qH8JcYM1yo3TLyeFvCbtj8nYz 9aRY5zHOmzD5o1URJloxvNcPiYvI2pehT5NGKbJR8W81oy0iVbnJBKojjZ8vWpWV8sRP D1aYEMfyXv7XBPSKVOQDk/Z0yRIWxHQ9AXVe6vM+Tn/TaNZvhadKwymyiET5gMthJPSn gNYY37XM0GsLz+LUHCtWmni6sEzzlunlQodjdXjObZg3HHw4oQCNAUr5I1cB7sOgrWS9 95IA== X-Gm-Message-State: AOAM530xhrDj33A8GQ4SSx9HrtDc1O6nqvucHip5iZQDcnot3+XcHlcN Cmfyc1pS87DzmHKrbdeox0+4yngnqnI= X-Google-Smtp-Source: ABdhPJzNNHMh4ZZ8McTnF92qhS9m3swryucttx1kh02CPo08hPH0RFtqbyzHx7T5V0wZwHfo2PKBLg== X-Received: by 2002:a05:620a:1a0e:b0:6a5:dac2:d0ec with SMTP id bk14-20020a05620a1a0e00b006a5dac2d0ecmr6939234qkb.667.1654272756467; Fri, 03 Jun 2022 09:12:36 -0700 (PDT) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-09-184-147-143-93.dsl.bell.ca. [184.147.143.93]) by smtp.gmail.com with ESMTPSA id n12-20020a05622a11cc00b003022cdcd28bsm5234973qtk.2.2022.06.03.09.12.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 09:12:36 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Valentin Schneider , Manasi Godse , John Kacur Subject: [PATCH 4/7] rteval: cyclictest.py: Use "with" with resource allocation Date: Fri, 3 Jun 2022 12:12:21 -0400 Message-Id: <20220603161224.10947-4-jkacur@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603161224.10947-1-jkacur@redhat.com> References: <20220603161224.10947-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org - Use "with" with open - Add a module docstring Signed-off-by: John Kacur --- rteval/modules/measurement/cyclictest.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/rteval/modules/measurement/cyclictest.py b/rteval/modules/measurement/cyclictest.py index 8fdd5341794a..4c8d510c4a34 100644 --- a/rteval/modules/measurement/cyclictest.py +++ b/rteval/modules/measurement/cyclictest.py @@ -24,6 +24,7 @@ # including keys needed to generate an equivalently functional executable # are deemed to be part of the source code. # +""" cyclictest.py - object to manage a cyclictest executable instance """ import os import subprocess @@ -254,14 +255,13 @@ class Cyclictest(rtevalModulePrototype): @staticmethod def __get_debugfs_mount(): ret = None - mounts = open('/proc/mounts') - for l in mounts: - field = l.split() - if field[2] == "debugfs": - ret = field[1] - break - mounts.close() - return ret + with open('/proc/mounts') as mounts: + for l in mounts: + field = l.split() + if field[2] == "debugfs": + ret = field[1] + break + return ret def _WorkloadSetup(self): From patchwork Fri Jun 3 16:12:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 578602 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 E142ACCA47C for ; Fri, 3 Jun 2022 16:12:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343677AbiFCQMp (ORCPT ); Fri, 3 Jun 2022 12:12:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343675AbiFCQMk (ORCPT ); Fri, 3 Jun 2022 12:12:40 -0400 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 78F702458D for ; Fri, 3 Jun 2022 09:12:38 -0700 (PDT) Received: by mail-qt1-x82c.google.com with SMTP id hh4so5932520qtb.10 for ; Fri, 03 Jun 2022 09:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=/aWJuzVYe3qDTmxu38CCqQJ4X0BWQjcreVq6YRaA4u8=; b=BPnEckFT1P482lO8Bibtg7tkP2SKFsGCobgjKjBEnuI+NvOfYYbcRVqZSWlUWw9a42 2T52kyDdKyuk6FFkPlG5AdpOY3oEOqRfzmRvqJhcsnlDo62Sxv7lQft7RDq9AqSwMyhC WLL0ib/WYWA+8jG1jMt7+QtVQ/044HOvhgLEWw0WTuLLY6Sct5QKLnHJxsnKsSrootZR 45OmOck9I4ofIitztfuHE3c8in/5qjWYw1ibzOYSUZuALaWfZ/HmsICsl4R9piDbaDDH BqJepx0rrtGybiyo1iLaoRAOK8/IJ8cIPGIlX5jgs3xHPKEqAgg+0YicgAQDPovMnn0Q juVg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=/aWJuzVYe3qDTmxu38CCqQJ4X0BWQjcreVq6YRaA4u8=; b=3WVh0EDtiN6PDWbWil10u+TlNyeMfC2t1eZR++ZYgTSgFj9Pk2bm83VrePYIlkAO+g ELTsIuSbZfYJUIkmKyefmpYIU0zedBq2dgoTxab+aB7dAVgb00f3sVXh/L6hLv8PH2uL jRvPgjtABwex/MaHOSI81akZ16GI5+1x4rCGQLPGuf0w+UJWFWdmIB7SuiFpQJ4b1Ki0 AzSFYDg/5Ik0cjBrMrccw63z6hWp2g4cXVv6Vws0xonOSf1o58GQJQWD1WuPjeE666vn 9a/huwT4HaVBuakN8p6ouCqd9433BduGNZp/yWpXY0UUdACnwjTH2+POxyDLOFpHXVW4 G5jw== X-Gm-Message-State: AOAM533jgKC5qR0Gkxyf0WCo3aDxf76NgfeqRRWJoikqgmoQLfBP0/1z vtNBOoaCdlUP/pFiG2I9g6uMlAsCFGg= X-Google-Smtp-Source: ABdhPJx3i5X4cVSsjJaIMMs79814kudHeX7jDvU5DzZflYncxvnbyLAntromGegLVlAQ6XX2F3U6UA== X-Received: by 2002:ac8:5802:0:b0:300:8490:b2a with SMTP id g2-20020ac85802000000b0030084900b2amr8245464qtg.128.1654272757373; Fri, 03 Jun 2022 09:12:37 -0700 (PDT) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-09-184-147-143-93.dsl.bell.ca. [184.147.143.93]) by smtp.gmail.com with ESMTPSA id n12-20020a05622a11cc00b003022cdcd28bsm5234973qtk.2.2022.06.03.09.12.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 09:12:37 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Valentin Schneider , Manasi Godse , John Kacur Subject: [PATCH 5/7] rteval: systopology.py: Use "with" for resource allocation Date: Fri, 3 Jun 2022 12:12:22 -0400 Message-Id: <20220603161224.10947-5-jkacur@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603161224.10947-1-jkacur@redhat.com> References: <20220603161224.10947-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org - Use "with" with open Signed-off-by: John Kacur --- rteval/systopology.py | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/rteval/systopology.py b/rteval/systopology.py index b2da7bba7de0..e852f86e450f 100644 --- a/rteval/systopology.py +++ b/rteval/systopology.py @@ -180,13 +180,14 @@ class NumaNode: def getmeminfo(self): """ read info about memory attached to this node """ self.meminfo = {} - for l in open(os.path.join(self.path, "meminfo"), "r"): - elements = l.split() - key = elements[2][0:-1] - val = int(elements[3]) - if len(elements) == 5 and elements[4] == "kB": - val *= 1024 - self.meminfo[key] = val + with open(os.path.join(self.path, "meminfo"), "r") as fp: + for l in fp: + elements = l.split() + key = elements[2][0:-1] + val = int(elements[3]) + if len(elements) == 5 and elements[4] == "kB": + val *= 1024 + self.meminfo[key] = val def getcpustr(self): """ return list of cpus for this node as a string """ @@ -212,13 +213,14 @@ class SimNumaNode(NumaNode): def getmeminfo(self): self.meminfo = {} - for l in open(SimNumaNode.mempath, "r"): - elements = l.split() - key = elements[0][0:-1] - val = int(elements[1]) - if len(elements) == 3 and elements[2] == "kB": - val *= 1024 - self.meminfo[key] = val + with open(SimNumaNode.mempath, "r") as fp: + for l in fp: + elements = l.split() + key = elements[0][0:-1] + val = int(elements[1]) + if len(elements) == 3 and elements[2] == "kB": + val *= 1024 + self.meminfo[key] = val # # Class to abstract the system topology of numa nodes and cpus From patchwork Fri Jun 3 16:12:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 578601 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 5A151C43334 for ; Fri, 3 Jun 2022 16:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343661AbiFCQMp (ORCPT ); Fri, 3 Jun 2022 12:12:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47278 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343670AbiFCQMl (ORCPT ); Fri, 3 Jun 2022 12:12:41 -0400 Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB295132D for ; Fri, 3 Jun 2022 09:12:39 -0700 (PDT) Received: by mail-qt1-x82f.google.com with SMTP id 2so5976055qtw.0 for ; Fri, 03 Jun 2022 09:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=9k0mMemLrP5rNiq07wr/uvfB+u7bQdlKBfH17TMLQPw=; b=KxPGBdVTdcjHFrJse6pCqJP3R1LGZ3/txFgcsY1RvJrWZjXnohAv7W5S5qeKco4Kd6 cpQJCTMMW/6OF5HfNzFIPMBnl5T0r1i/+RSkPKfqQAd+bB4KqweALJaIweh5l9I8NKKH 9gw6t9bEJhyrv1zp7utnBKMU42duoVIYtZChlniiaeuvU7Orq2AmHcNZNEjK1uk1mFxl /jBz5XwZjX9+Dyrpt6l2rXaNH0/f84Fm9mCGljwUywtOPdWRA0zgvpNnoIUsumsSciHA hox5WGT0HSAcyKOuioEqbbw0KPcV5ZOkATcoLzB7FXkuOIwnymlJUzcuvDV85aCmm34N p72w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=9k0mMemLrP5rNiq07wr/uvfB+u7bQdlKBfH17TMLQPw=; b=yvodgOkub5+Qyno0FIyDZr8c0ATwKZOU5KskwzCaIGHiNoBJY0xYc6knvu/CZFXoaG x+s7uql28c8sZDvqSRNPWzQH7FeBz4wx5OxBZvyd6wr5Jr23JnBhl6S8f4pVtJva4A5v 2mv8zAfCSpaKmPY34f6fIw1DI5tvrxXxGdWPpNMV23o6GogUHtig5R4yM6ex2Cu9qsGr rB8/1yeR0Mx2+Cr23aRobNN2iSOCQQ5AI/cYcdV/7gkg9xNgBlhMw+eGbwdbi2NBBtue k6owBV27As15INjx0nnr2CSR0+M0gxmlPl4akAt+8KLSAyQSHmQ2+bWYKpjqPNpmVB7i xDwQ== X-Gm-Message-State: AOAM533aeNXsuhZtCJBTSx/yvV1de/HPoyHLcEMvahZM9lQeWHz3TRqF 199wpwdLZooeU8Cp2ULhwh7USUBOrNU= X-Google-Smtp-Source: ABdhPJxDVLqhnHLe4mD82clzhVqxAcWz2jyo5QFOKMuJxXGbmFYXFBGhwUFJl0Q1bsV626Sbh5G+0Q== X-Received: by 2002:a05:622a:54f:b0:2f3:d566:e22c with SMTP id m15-20020a05622a054f00b002f3d566e22cmr8123550qtx.466.1654272758287; Fri, 03 Jun 2022 09:12:38 -0700 (PDT) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-09-184-147-143-93.dsl.bell.ca. [184.147.143.93]) by smtp.gmail.com with ESMTPSA id n12-20020a05622a11cc00b003022cdcd28bsm5234973qtk.2.2022.06.03.09.12.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 09:12:37 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Valentin Schneider , Manasi Godse , John Kacur Subject: [PATCH 6/7] rteval: kcompile: Fix regular expression to match kernel prefix Date: Fri, 3 Jun 2022 12:12:23 -0400 Message-Id: <20220603161224.10947-6-jkacur@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603161224.10947-1-jkacur@redhat.com> References: <20220603161224.10947-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org If the user specifies a kernel to compile as a load other than the default kernel, the kernel prefix is obtained with a regular expression. Currently the regular expression does not accomodate two digit numbers in the kernel version. Fix that regular expression to accomodate different kernel versions, with room to grow for the future. Signed-off-by: John Kacur --- rteval/modules/loads/kcompile.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rteval/modules/loads/kcompile.py b/rteval/modules/loads/kcompile.py index 2701a0dcba91..3d9b882d8810 100644 --- a/rteval/modules/loads/kcompile.py +++ b/rteval/modules/loads/kcompile.py @@ -169,7 +169,7 @@ class Kcompile(CommandLineLoad): if not os.path.exists(tarfile): raise rtevalRuntimeError(self, " tarfile %s does not exist!" % tarfile) self.source = tarfile - kernel_prefix = re.search(r"linux-\d\.\d", self.source).group(0) + kernel_prefix = re.search(r"linux-\d{1,2}\.\d{1,3}", self.source).group(0) else: tarfiles = glob.glob(os.path.join(self.srcdir, "%s*" % DEFAULT_KERNEL_PREFIX)) if tarfiles: @@ -177,6 +177,7 @@ class Kcompile(CommandLineLoad): else: raise rtevalRuntimeError(self, " no kernel tarballs found in %s" % self.srcdir) kernel_prefix = DEFAULT_KERNEL_PREFIX + self._log(Log.DEBUG, f"kernel_prefix = {kernel_prefix}") # check for existing directory kdir = None From patchwork Fri Jun 3 16:12:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Kacur X-Patchwork-Id: 578838 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 2CD51CCA47E for ; Fri, 3 Jun 2022 16:12:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1343679AbiFCQMq (ORCPT ); Fri, 3 Jun 2022 12:12:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1343681AbiFCQMo (ORCPT ); Fri, 3 Jun 2022 12:12:44 -0400 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 3A4CF51321 for ; Fri, 3 Jun 2022 09:12:40 -0700 (PDT) Received: by mail-qt1-x835.google.com with SMTP id hf10so5944264qtb.7 for ; Fri, 03 Jun 2022 09:12:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=HAuyq01gEJicW8kHsVE1DlDa7X2Ma8pHmz09RMBBqUU=; b=UrqPuG3yMRNS2xuFbKmqLlV3Lt4cslG3p1aXGDB5au0RXS9cgoxPpSwWg48aiQxbcP mgyTEt/xTCM7PY/5Obfmi1hgAfPuenbmL0x1cqaZWxSIsxoOvRK+L2lpgnRlmKO2p/2u drY32S5yg2OS4qfvlXGLt2432NEHC2kVt9tDZQJN/UjkXCDkGcnKm6bsK87db0ns3X+7 bx+zs2CaUX9TRItsMRxTcE40zRogWR4J2D5ctNgoMsyQjXq7IPsB46/zPBETFU8USm/x HcdRLmwygKh1fEFTPoSg7Ru9E8luoyTW4ZS+5dCcM0XdhJZNagyDaWofJ3ZLUWcShcHV QpQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=HAuyq01gEJicW8kHsVE1DlDa7X2Ma8pHmz09RMBBqUU=; b=wVz5FpBxFi1ByE5KN2XbusYikhJ6bOa4uQ6RztVBorPfS6UKnMYPjI6tb43Tn2M5yy NqE5GghZd0fPuJaeUFKq2R3a5Lf3aSvu4ga+xJHDD236IzOYcoH4xNqnwZAdQDVBg8jP q3liMYewUSuL9jUuQjlUXobuq7+9pwd+RwlUltw82Kr0hv5rbHZgrI6VN2dyIl0Y2l1X jsxjXKXe2VCQvCpWGouOKqB2ANaagrxiVz/dq91wQmNUpBtOdyKGmqfQQo/kwgymvsfx uxP86ooFDafqYd0IGho9aRkGkt5WYJxmAiB3j4xwTFLYTMyb0N6rDOySAbC4zHjFFBZ+ bGNQ== X-Gm-Message-State: AOAM531kHuWQkeAdaYUn02ZLUjrewDIMMrhmdFQFuCOcH7zLbgTm5MDM XHzJXhsrMGbkvFzh1nlUwph+anRyyVc= X-Google-Smtp-Source: ABdhPJwZnrzc4MDHko9zwfCc6qADKi5oN2MHgtczrSQkiaWbxS/5jMeuQLMjND/5GPf0r1bsgGJoQA== X-Received: by 2002:a05:622a:108:b0:2fc:7ed3:a158 with SMTP id u8-20020a05622a010800b002fc7ed3a158mr8094471qtw.597.1654272759313; Fri, 03 Jun 2022 09:12:39 -0700 (PDT) Received: from fionn.redhat.com (bras-base-rdwyon0600w-grc-09-184-147-143-93.dsl.bell.ca. [184.147.143.93]) by smtp.gmail.com with ESMTPSA id n12-20020a05622a11cc00b003022cdcd28bsm5234973qtk.2.2022.06.03.09.12.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Jun 2022 09:12:38 -0700 (PDT) Sender: John Kacur From: John Kacur To: RT Cc: Clark Williams , Leah Leshchinsky , Valentin Schneider , Manasi Godse , John Kacur Subject: [PATCH 7/7] rteval: stressng: The stressng option should not be a string Date: Fri, 3 Jun 2022 12:12:24 -0400 Message-Id: <20220603161224.10947-7-jkacur@redhat.com> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220603161224.10947-1-jkacur@redhat.com> References: <20220603161224.10947-1-jkacur@redhat.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-rt-users@vger.kernel.org When rteval passes stressng a timeout option, it should not be stringified. Signed-off-by: John Kacur --- rteval/modules/loads/stressng.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rteval/modules/loads/stressng.py b/rteval/modules/loads/stressng.py index d0772ce77662..fe97189d3816 100644 --- a/rteval/modules/loads/stressng.py +++ b/rteval/modules/loads/stressng.py @@ -54,7 +54,8 @@ class Stressng(CommandLineLoad): if self.cfg.arg is not None: self.args.append(self.cfg.arg) if self.cfg.timeout is not None: - self.args.append('--timeout %s' % str(self.cfg.timeout)) + self.args.append('--timeout') + self.args.append(self.cfg.timeout) systop = SysTopology() # get the number of nodes