From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0AFDDA051F for ; Sun, 19 Jan 2020 22:48:22 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D363029C6; Sun, 19 Jan 2020 22:48:21 +0100 (CET) Received: from wout5-smtp.messagingengine.com (wout5-smtp.messagingengine.com [64.147.123.21]) by dpdk.org (Postfix) with ESMTP id 57AEE1BE0; Sun, 19 Jan 2020 22:48:18 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id D42DD316; Sun, 19 Jan 2020 16:48:16 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Sun, 19 Jan 2020 16:48:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding:content-type; s=mesmtp; bh=9P0itf7mM622pqoIue1zA6d7aq5abdeKpmJCTOMRlKU=; b=f3Dgcl1fUOQh +FqUDwcUf3hbR3K/vYz9vvReoL55P2KcU3bF13J6udj/LNcnVrBT6V1qllshGbgX qs1KdZJvFF1kabjgVhwo8Atx2w0o7PClOkWQH6je0tqGM4x0/9OkGRk3eNcXZNiU leuIfJw5LBvZJu6r+/28CfXN/3Gki4s= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm1; bh=9P0itf7mM622pqoIue1zA6d7aq5abdeKpmJCTOMRl KU=; b=gRDgRnPlDVSwyAoF1yy3IX/JYaBAdNfhqxNnPNV/goXm1pyzfkgxt/WJA NFd1oEfq14VLYD6MaHXMGAHgM0jOfQPWkCnhtVHTYv/jFPXlGQaBZvmrs4jH/4iv 8wrGVS+tHFeNY1HUlvg3EcdQ6KxYIXabObWyQ5Iv16aKwC5WUvgild9vgYMrm/7P yUMKydKs5NZlWujwvzClCob2LIlkgezY+Z5n2hR+ibV7ebwMZOcJRY7lGpKhRfsi U2f0N5pwIUQxdZivdHGW83LPx+hG6HBCe/H/fxGmCd/GEVtZ0vSa9aWrt32HRKoQ aEa/h9gqDhpCFpaEluvI5eo1gms/Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudefgdduhedvucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhephffvufffkfgjfhgggfgtsehtufertddttddvnecuhfhrohhmpefvhhhomhgr shcuofhonhhjrghlohhnuceothhhohhmrghssehmohhnjhgrlhhonhdrnhgvtheqnecukf hppeejjedrudefgedrvddtfedrudekgeenucfrrghrrghmpehmrghilhhfrhhomhepthhh ohhmrghssehmohhnjhgrlhhonhdrnhgvthenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from xps.localnet (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 3748280059; Sun, 19 Jan 2020 16:48:15 -0500 (EST) From: Thomas Monjalon To: Ciara Power Cc: kevin.laatz@intel.com, stable@dpdk.org, dev@dpdk.org, robin.jarry@6wind.com Date: Sun, 19 Jan 2020 22:48:14 +0100 Message-ID: <2200875.3c9HiEOlIg@xps> In-Reply-To: <20200116172425.19246-1-ciara.power@intel.com> References: <20200116172425.19246-1-ciara.power@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" Subject: Re: [dpdk-stable] [PATCH] usertools: add telemetry python3 compatibility X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" +Cc Robin, known Python expert :) 16/01/2020 18:24, Ciara Power: > The client script for use with the telemetry library did not support > python3, as the data being sent over the socket was in string format. > Python3 requires the data be explicitly converted to bytes before being > sent. Similarily, the received bytes need to be decoded into string > format. > > Cc: stable@dpdk.org > > Signed-off-by: Ciara Power > --- > usertools/dpdk-telemetry-client.py | 17 +++++++++-------- > 1 file changed, 9 insertions(+), 8 deletions(-) > > diff --git a/usertools/dpdk-telemetry-client.py b/usertools/dpdk-telemetry-client.py > index 290345dcc..71a8a8852 100755 > --- a/usertools/dpdk-telemetry-client.py > +++ b/usertools/dpdk-telemetry-client.py > @@ -65,18 +65,19 @@ def register(self): # Connects a client to DPDK-instance > self.socket.recv_fd.settimeout(2) > self.socket.send_fd.connect("/var/run/dpdk/rte/telemetry") > JSON = (API_REG + self.file_path + "\"}}") > - self.socket.send_fd.sendall(JSON) > + self.socket.send_fd.sendall(JSON.encode()) > + > self.socket.recv_fd.listen(1) > self.socket.client_fd = self.socket.recv_fd.accept()[0] > > def unregister(self): # Unregister a given client > - self.socket.client_fd.send(API_UNREG + self.file_path + "\"}}") > + self.socket.client_fd.send((API_UNREG + self.file_path + "\"}}").encode()) > self.socket.client_fd.close() > > def requestMetrics(self): # Requests metrics for given client > - self.socket.client_fd.send(METRICS_REQ) > - data = self.socket.client_fd.recv(BUFFER_SIZE) > - print("\nResponse: \n", str(data)) > + self.socket.client_fd.send(METRICS_REQ.encode()) > + data = self.socket.client_fd.recv(BUFFER_SIZE).decode() > + print("\nResponse: \n", data) > > def repeatedlyRequestMetrics(self, sleep_time): # Recursively requests metrics for given client > print("\nPlease enter the number of times you'd like to continuously request Metrics:") > @@ -88,9 +89,9 @@ def repeatedlyRequestMetrics(self, sleep_time): # Recursively requests metrics f > time.sleep(sleep_time) > > def requestGlobalMetrics(self): #Requests global metrics for given client > - self.socket.client_fd.send(GLOBAL_METRICS_REQ) > - data = self.socket.client_fd.recv(BUFFER_SIZE) > - print("\nResponse: \n", str(data)) > + self.socket.client_fd.send(GLOBAL_METRICS_REQ.encode()) > + data = self.socket.client_fd.recv(BUFFER_SIZE).decode() > + print("\nResponse: \n", data) > > def interactiveMenu(self, sleep_time): # Creates Interactive menu within the script > while self.choice != 4: >