Code Review
/
nfvbench.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
NFVBENCH-32 Check nan result values before integer casting
[nfvbench.git]
/
nfvbench
/
utils.py
diff --git
a/nfvbench/utils.py
b/nfvbench/utils.py
index
4d9749c
..
fc72517
100644
(file)
--- a/
nfvbench/utils.py
+++ b/
nfvbench/utils.py
@@
-17,6
+17,7
@@
import fcntl
from functools import wraps
import json
from log import LOG
from functools import wraps
import json
from log import LOG
+from math import isnan
import os
import re
import signal
import os
import re
import signal
@@
-141,6
+142,10
@@
def parse_flow_count(flow_count):
return flow_count * multiplier
return flow_count * multiplier
+def cast_integer(value):
+ return int(value) if not isnan(value) else value
+
+
class RunLock(object):
"""
Attempts to lock file and run current instance of NFVbench as the first,
class RunLock(object):
"""
Attempts to lock file and run current instance of NFVbench as the first,