From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 568E248961; Fri, 17 Oct 2025 15:56:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8F4B342DBB; Fri, 17 Oct 2025 15:56:31 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.11]) by mails.dpdk.org (Postfix) with ESMTP id AD33840269 for ; Fri, 17 Oct 2025 15:56:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1760709389; x=1792245389; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=MMQ6I0LN48EUIaUZb+rAvOh5HtjUdmf/U+dh3ugp6S4=; b=BDLEXkXVc2yzuLYuckUXT/mUEFRDCI8k5sOB2EiabLvfpYbiGeV9Uxow lcb9Thw2W/ODUIIdA2lF4yBEMovENQT4lw95ebX7pVGg553zPlu1xXgxi EnHf5LMMWv70q5dKWm1a0WitrDEW3YGBUj3ACINrnJgtyJY1TLwsnARDs mTVW3E0WP2p9T1Df79Rl6+iLyMHY8/XC7hVtSdpWQoFUcBmPnzZf5Sy1E AONeV7jO+FwDuNxBkHA0+aAQgbSIE18euRFRyO9NElRZ9SuqRqc9FPh+J XwZyU2MZQeonF8M4rQZci6Cfz483ntFpWLUgtOPrAQXzAXIyn09P/xJJg A==; X-CSE-ConnectionGUID: YO3WZWuYQFKQWOYX6shJAw== X-CSE-MsgGUID: RgXo6KTuSuObqCmk29Yzrg== X-IronPort-AV: E=McAfee;i="6800,10657,11585"; a="73522790" X-IronPort-AV: E=Sophos;i="6.19,236,1754982000"; d="scan'208";a="73522790" Received: from orviesa006.jf.intel.com ([10.64.159.146]) by fmvoesa105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Oct 2025 06:56:28 -0700 X-CSE-ConnectionGUID: drl/hebmQBS8HDo/hF9GdA== X-CSE-MsgGUID: anFkt+cUSsOoHqCuJ9E38Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.19,236,1754982000"; d="scan'208";a="181878251" Received: from silpixa00401385.ir.intel.com ([10.20.224.226]) by orviesa006.jf.intel.com with ESMTP; 17 Oct 2025 06:56:28 -0700 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 2/2] usertools/dpdk-telemetry-client: correct script formatting Date: Fri, 17 Oct 2025 14:56:22 +0100 Message-ID: <20251017135622.1152341-3-bruce.richardson@intel.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: <20251017135622.1152341-1-bruce.richardson@intel.com> References: <20251017135622.1152341-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Auto-format the dpdk-telemetry-client script using "black" tool, to ensure it meets default DPDK python formatting style. Signed-off-by: Bruce Richardson --- usertools/dpdk-telemetry-client.py | 49 +++++++++++++++++------------- 1 file changed, 28 insertions(+), 21 deletions(-) diff --git a/usertools/dpdk-telemetry-client.py b/usertools/dpdk-telemetry-client.py index e3bb1c9ee0..f65d2e0be4 100755 --- a/usertools/dpdk-telemetry-client.py +++ b/usertools/dpdk-telemetry-client.py @@ -9,13 +9,13 @@ BUFFER_SIZE = 200000 -METRICS_REQ = "{\"action\":0,\"command\":\"ports_all_stat_values\",\"data\":null}" -API_REG = "{\"action\":1,\"command\":\"clients\",\"data\":{\"client_path\":\"" -API_UNREG = "{\"action\":2,\"command\":\"clients\",\"data\":{\"client_path\":\"" -GLOBAL_METRICS_REQ = "{\"action\":0,\"command\":\"global_stat_values\",\"data\":null}" +METRICS_REQ = '{"action":0,"command":"ports_all_stat_values","data":null}' +API_REG = '{"action":1,"command":"clients","data":{"client_path":"' +API_UNREG = '{"action":2,"command":"clients","data":{"client_path":"' +GLOBAL_METRICS_REQ = '{"action":0,"command":"global_stat_values","data":null}' DEFAULT_FP = "/var/run/dpdk/default_client" -DEFAULT_PREFIX = 'rte' -RUNTIME_SOCKET_NAME = 'telemetry' +DEFAULT_PREFIX = "rte" +RUNTIME_SOCKET_NAME = "telemetry" class Socket: @@ -56,8 +56,7 @@ def getFilepath(self, file_path): self.file_path = file_path def setRunpath(self, file_prefix): - self.run_path = os.path.join(get_dpdk_runtime_dir(file_prefix), - RUNTIME_SOCKET_NAME) + self.run_path = os.path.join(get_dpdk_runtime_dir(file_prefix), RUNTIME_SOCKET_NAME) def register(self): # Connects a client to DPDK-instance @@ -69,7 +68,7 @@ def register(self): print("Error - Socket binding error: " + str(msg) + "\n") self.socket.recv_fd.settimeout(2) self.socket.send_fd.connect(self.run_path) - JSON = (API_REG + self.file_path + "\"}}") + JSON = API_REG + self.file_path + '"}}' self.socket.send_fd.sendall(JSON.encode()) self.socket.recv_fd.listen(1) @@ -77,7 +76,7 @@ def register(self): def unregister(self): # Unregister a given client - self.socket.client_fd.send((API_UNREG + self.file_path + "\"}}").encode()) + self.socket.client_fd.send((API_UNREG + self.file_path + '"}}').encode()) self.socket.client_fd.close() def requestMetrics(self): @@ -133,25 +132,33 @@ def interactiveMenu(self, sleep_time): def get_dpdk_runtime_dir(fp): - """ Using the same logic as in DPDK's EAL, get the DPDK runtime directory - based on the file-prefix and user """ - run_dir = os.environ.get('RUNTIME_DIRECTORY') + """Using the same logic as in DPDK's EAL, get the DPDK runtime directory + based on the file-prefix and user""" + run_dir = os.environ.get("RUNTIME_DIRECTORY") if not run_dir: - if (os.getuid() == 0): - run_dir = '/var/run' + if os.getuid() == 0: + run_dir = "/var/run" else: - run_dir = os.environ.get('XDG_RUNTIME_DIR', '/tmp') - return os.path.join(run_dir, 'dpdk', fp) + run_dir = os.environ.get("XDG_RUNTIME_DIR", "/tmp") + return os.path.join(run_dir, "dpdk", fp) if __name__ == "__main__": sleep_time = 1 parser = argparse.ArgumentParser() - parser.add_argument('-f', '--file-prefix', default=DEFAULT_PREFIX, - help='Provide file-prefix for DPDK runtime directory') - parser.add_argument('sock_path', nargs='?', default=DEFAULT_FP, - help='Provide socket file path connected by legacy client') + parser.add_argument( + "-f", + "--file-prefix", + default=DEFAULT_PREFIX, + help="Provide file-prefix for DPDK runtime directory", + ) + parser.add_argument( + "sock_path", + nargs="?", + default=DEFAULT_FP, + help="Provide socket file path connected by legacy client", + ) args = parser.parse_args() client = Client() -- 2.48.1