From 3bc88579e9eadeafe141dc3d7fff7765486a5ee6 Mon Sep 17 00:00:00 2001 From: Kerim Gokarslan Date: Thu, 21 Sep 2017 15:30:43 -0700 Subject: NFVBENCH-32 Check nan result values before integer casting Change-Id: Ia675672b40f93d7503ebe5a355896a084e3d0cbf Signed-off-by: Kerim Gokarslan --- nfvbench/utils.py | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'nfvbench/utils.py') 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, -- cgit 1.2.3-korg