Add support for Python 3
[yardstick.git] / yardstick / benchmark / scenarios / compute / lmbench.py
index 518840c..6a17ae8 100644 (file)
@@ -6,9 +6,13 @@
 # which accompanies this distribution, and is available at
 # http://www.apache.org/licenses/LICENSE-2.0
 ##############################################################################
-import pkg_resources
+from __future__ import absolute_import
+from __future__ import print_function
+
 import logging
-import json
+
+import pkg_resources
+from oslo_serialization import jsonutils
 
 import yardstick.ssh as ssh
 from yardstick.benchmark.scenarios import base
@@ -130,9 +134,10 @@ class Lmbench(base.Scenario):
             raise RuntimeError(stderr)
 
         if test_type == 'latency':
-            result.update({"latencies": json.loads(stdout)})
+            result.update(
+                {"latencies": jsonutils.loads(stdout)})
         else:
-            result.update(json.loads(stdout))
+            result.update(jsonutils.loads(stdout))
 
         if "sla" in self.scenario_cfg:
             sla_error = ""
@@ -185,7 +190,8 @@ def _test():
 
     p = Lmbench(args, ctx)
     p.run(result)
-    print result
+    print(result)
+
 
 if __name__ == '__main__':
     _test()