summaryrefslogtreecommitdiffstats
path: root/nfvbench/utils.py
diff options
context:
space:
mode:
authorKerim Gokarslan <kgokarsl@cisco.com>2017-09-21 15:30:43 -0700
committerKerim Gokarslan <kgokarsl@cisco.com>2017-09-21 17:19:35 -0700
commit97b452affb0e99816ad503a5f79b01f38b93059a (patch)
treeace763fd2eea217a663a73ea3491cb9f97e71aef /nfvbench/utils.py
parent846250f4c570798a1058dd8d3a405513c4900932 (diff)
NFVBENCH-32 Check nan result values before integer casting
Change-Id: Ia675672b40f93d7503ebe5a355896a084e3d0cbf Signed-off-by: Kerim Gokarslan <kgokarsl@cisco.com>
Diffstat (limited to 'nfvbench/utils.py')
-rw-r--r--nfvbench/utils.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/nfvbench/utils.py b/nfvbench/utils.py
index 4d9749c..fc72517 100644
--- 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 math import isnan
import os
import re
import signal
@@ -141,6 +142,10 @@ def parse_flow_count(flow_count):
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,