patches for DPDK stable branches
 help / color / mirror / Atom feed
* [dpdk-stable] [PATCH 1/3] usertools/dpdk-telemetry: fix flake8 errors
       [not found] <20210913105137.130097-1-bruce.richardson@intel.com>
@ 2021-09-13 10:51 ` Bruce Richardson
  2021-09-15 10:05   ` Kevin Laatz
  2021-09-13 10:51 ` [dpdk-stable] [PATCH 2/3] usertools/dpdk_telemetry: fix handling EOF for input pipe Bruce Richardson
  1 sibling, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2021-09-13 10:51 UTC (permalink / raw)
  To: dev
  Cc: ciara.power, david.hunt, Bruce Richardson, stable, Keith Wiles,
	Kevin Laatz, Anatoly Burakov

Fix style errors reported by flake8.

Fixes: 6a2967c112a3 ("usertools: add new telemetry script")
Fixes: 2d9a697e41ca ("usertools: add file-prefix option for telemetry")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 usertools/dpdk-telemetry.py | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
index e04aa04702..bdc617db18 100755
--- a/usertools/dpdk-telemetry.py
+++ b/usertools/dpdk-telemetry.py
@@ -9,7 +9,6 @@
 
 import socket
 import os
-import glob
 import json
 import errno
 import readline
@@ -102,8 +101,8 @@ def get_dpdk_runtime_dir(fp):
 readline.set_completer_delims(readline.get_completer_delims().replace('/', ''))
 
 parser = argparse.ArgumentParser()
-parser.add_argument('-f', '--file-prefix', \
-        help='Provide file-prefix for DPDK runtime directory', default='rte')
+parser.add_argument('-f', '--file-prefix', default='rte',
+                    help='Provide file-prefix for DPDK runtime directory')
 args = parser.parse_args()
-rdir = get_dpdk_runtime_dir(args.file_prefix)
-handle_socket(os.path.join(rdir, 'dpdk_telemetry.{}'.format(TELEMETRY_VERSION)))
+rd = get_dpdk_runtime_dir(args.file_prefix)
+handle_socket(os.path.join(rd, 'dpdk_telemetry.{}'.format(TELEMETRY_VERSION)))
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [dpdk-stable] [PATCH 2/3] usertools/dpdk_telemetry: fix handling EOF for input pipe
       [not found] <20210913105137.130097-1-bruce.richardson@intel.com>
  2021-09-13 10:51 ` [dpdk-stable] [PATCH 1/3] usertools/dpdk-telemetry: fix flake8 errors Bruce Richardson
@ 2021-09-13 10:51 ` Bruce Richardson
  1 sibling, 0 replies; 3+ messages in thread
From: Bruce Richardson @ 2021-09-13 10:51 UTC (permalink / raw)
  To: dev; +Cc: ciara.power, david.hunt, Bruce Richardson, stable, Keith Wiles

To allow the script to take queries from input pipes e.g. "echo
/ethdev/stats,0 | dpdk-telemetry.py", we need to handle the case of EOF
correctly without crashing with an exception. Do this by using a
try-except block around the input handling.

Fixes: 6a2967c112a3 ("usertools: add new telemetry script")
Cc: stable@dpdk.org

Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
 usertools/dpdk-telemetry.py | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/usertools/dpdk-telemetry.py b/usertools/dpdk-telemetry.py
index bdc617db18..7ebbb64fce 100755
--- a/usertools/dpdk-telemetry.py
+++ b/usertools/dpdk-telemetry.py
@@ -69,13 +69,17 @@ def handle_socket(path):
     CMDS = read_socket(sock, output_buf_len, False)["/"]
 
     # interactive prompt
-    text = input('--> ').strip()
-    while text != "quit":
-        if text.startswith('/'):
-            sock.send(text.encode())
-            read_socket(sock, output_buf_len)
+    try:
         text = input('--> ').strip()
-    sock.close()
+        while text != "quit":
+            if text.startswith('/'):
+                sock.send(text.encode())
+                read_socket(sock, output_buf_len)
+            text = input('--> ').strip()
+    except EOFError:
+        pass
+    finally:
+        sock.close()
 
 
 def readline_complete(text, state):
-- 
2.30.2


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-stable] [PATCH 1/3] usertools/dpdk-telemetry: fix flake8 errors
  2021-09-13 10:51 ` [dpdk-stable] [PATCH 1/3] usertools/dpdk-telemetry: fix flake8 errors Bruce Richardson
@ 2021-09-15 10:05   ` Kevin Laatz
  0 siblings, 0 replies; 3+ messages in thread
From: Kevin Laatz @ 2021-09-15 10:05 UTC (permalink / raw)
  To: Bruce Richardson, dev
  Cc: ciara.power, david.hunt, stable, Keith Wiles, Anatoly Burakov

On 13/09/2021 11:51, Bruce Richardson wrote:
> Fix style errors reported by flake8.
>
> Fixes: 6a2967c112a3 ("usertools: add new telemetry script")
> Fixes: 2d9a697e41ca ("usertools: add file-prefix option for telemetry")
> Cc: stable@dpdk.org
>
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>   usertools/dpdk-telemetry.py | 9 ++++-----
>   1 file changed, 4 insertions(+), 5 deletions(-)


Acked-by: Kevin Laatz <kevin.laatz@intel.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-09-15 10:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210913105137.130097-1-bruce.richardson@intel.com>
2021-09-13 10:51 ` [dpdk-stable] [PATCH 1/3] usertools/dpdk-telemetry: fix flake8 errors Bruce Richardson
2021-09-15 10:05   ` Kevin Laatz
2021-09-13 10:51 ` [dpdk-stable] [PATCH 2/3] usertools/dpdk_telemetry: fix handling EOF for input pipe Bruce Richardson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).