From e1a0de951c8862324eb15c626b08d829f799b58d Mon Sep 17 00:00:00 2001 From: Erich Focht Date: Sun, 25 Nov 2018 02:28:45 +0100 Subject: [PATCH] Added a try: except for the case that a query for a PID fails. --- veperf | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/veperf b/veperf index d4aa5d8..502e6b4 100755 --- a/veperf +++ b/veperf @@ -148,14 +148,14 @@ parser = argparse.ArgumentParser( description=DESCR, formatter_class=argparse.RawTextHelpFormatter ) parser.add_argument("-d", "--delay", type=int, default=[2], nargs=1, help="Measurement interval [seconds]. Default: 2s.") parser.add_argument("-n", "--node", action="append", help="VE Node ID to be included into measurement. Default: all nodes.") -parser.add_argument("other", type=int, nargs='?', metavar='INTERVALS', help="number of measurement intervals before exiting") +parser.add_argument("interv", type=int, nargs='?', metavar='INTERVALS', help="number of measurement intervals before exiting") args, rest = parser.parse_known_args() DELAY = args.delay[0] INTERV = -1 -if args.other is not None: +if args.interv is not None: try: - INTERV = args.other + 1 + INTERV = args.interv + 1 except: pass @@ -197,7 +197,10 @@ while 1: del METR[nodeid][prevpid] for pid in pids: - DATA[nodeid][pid] = ve_pid_perf(nodeid, pid) + try: + DATA[nodeid][pid] = ve_pid_perf(nodeid, pid) + except: + continue if pid in PREV[nodeid].keys(): METR[nodeid][pid] = calc_metrics(nodeid, PREV[nodeid][pid], DATA[nodeid][pid]) PREV[nodeid][pid] = DATA[nodeid][pid]