Skip to content

Commit

Permalink
Added a try: except for the case that a query for a PID fails.
Browse files Browse the repository at this point in the history
  • Loading branch information
efocht committed Nov 25, 2018
1 parent 53ba430 commit e1a0de9
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions veperf
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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]
Expand Down

0 comments on commit e1a0de9

Please sign in to comment.