aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fl.fischer@fau.de>2020-05-15 17:37:10 +0200
committerFlorian Fischer <florian.fl.fischer@fau.de>2020-06-02 11:18:47 +0200
commit6c50793f81ed8b6ef1eee43e06ddb325c4aa047a (patch)
treea59ada7d42c3bee60914515388d791933bde4f1f
parentc9c5e185b3c32d5298ebfbad4f51f20fe966f00c (diff)
downloadallocbench-6c50793f81ed8b6ef1eee43e06ddb325c4aa047a.tar.gz
allocbench-6c50793f81ed8b6ef1eee43e06ddb325c4aa047a.zip
remove deprecated pickle code
-rw-r--r--allocbench/benchmark.py17
-rw-r--r--allocbench/facter.py5
-rw-r--r--doc/Benchmarks.md2
-rwxr-xr-xmerge.py9
4 files changed, 7 insertions, 26 deletions
diff --git a/allocbench/benchmark.py b/allocbench/benchmark.py
index afcb126..c4b3695 100644
--- a/allocbench/benchmark.py
+++ b/allocbench/benchmark.py
@@ -258,22 +258,13 @@ class Benchmark:
def load(self, path=None):
"""Load benchmark results from file"""
if not path:
- filename = self.name
- else:
- if os.path.isdir(path):
- filename = os.path.join(path, self.name)
- else:
- filename = os.path.splitext(path)
+ filename = f"{self.name}.json"
+ elif os.path.isdir(path):
+ filename = os.path.join(path, self.name)
- if os.path.exists(filename + ".json"):
- filename += ".json"
+ if os.path.exists(filename):
with open(filename, "r") as load_file:
self.results = json.load(load_file)
- elif os.path.exists(filename + ".save"):
- import pickle # pylint: disable=import-outside-toplevel
- filename += ".save"
- with open(filename, "rb") as load_file:
- self.results = pickle.load(load_file)
else:
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT),
filename)
diff --git a/allocbench/facter.py b/allocbench/facter.py
index afc1d02..374c881 100644
--- a/allocbench/facter.py
+++ b/allocbench/facter.py
@@ -82,11 +82,6 @@ def load_facts(path=None):
filename += ".json"
with open(filename, "r") as facts_file:
loaded_facts = json.load(facts_file)
- elif os.path.exists(filename + ".save"):
- import pickle
- filename += ".save"
- with open(filename, "rb") as facts_file:
- loaded_facts = pickle.load(facts_file)
else:
raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT),
filename)
diff --git a/doc/Benchmarks.md b/doc/Benchmarks.md
index e8add89..8e95a8c 100644
--- a/doc/Benchmarks.md
+++ b/doc/Benchmarks.md
@@ -131,7 +131,7 @@ loop = BenchmarkLoop()
The class Benchmark defined in the allocbench/benchmark.py implements most
common operations for a benchmark.
-It provides load and save functions using pythons pickle module,
+It provides load and save functions using pythons json module,
helpers generating plots using matplotlib and most importantly a run method using
the attributes `cmd` and `args` to execute your benchmark. To not enforce some
output format hooks are available to parse the output of your benchmark yourself.
diff --git a/merge.py b/merge.py
index ca20092..185183f 100755
--- a/merge.py
+++ b/merge.py
@@ -21,7 +21,6 @@
import argparse
import json
import os
-import pickle
import sys
import allocbench.facter as facter
@@ -29,12 +28,8 @@ from allocbench.util import print_license_and_exit
def load_file(filename):
- if filename.endswith("json"):
- with open(filename, "r") as json_file:
- return json.load(json_file)
- else:
- with open(filename, "rb") as pickle_file:
- return pickle.load(pickle_file)
+ with open(filename, "r") as json_file:
+ return json.load(json_file)
def main():