in benchmarking/download_benchmarks/download_benchmarks.py [0:0]
def _processOneBenchmark(self, benchmark):
filename = benchmark["filename"]
one_benchmark = benchmark["content"]
locations = []
# TODO refactor the code to collect files
if "model" in one_benchmark:
if "files" in one_benchmark["model"]:
for field in one_benchmark["model"]["files"]:
value = one_benchmark["model"]["files"][field]
assert (
"location" in value
), "location field is missing in benchmark " "{}".format(filename)
location = value["location"]
md5 = value.get("md5")
path = self.downloadFile(location, md5)
locations.append(path)
if "libraries" in one_benchmark["model"]:
for value in one_benchmark["model"]["libraries"]:
assert (
"location" in value
), "location field is missing in benchmark " "{}".format(filename)
location = value["location"]
md5 = value["md5"]
path = self.downloadFile(location, md5)
locations.append(path)
assert (
"tests" in one_benchmark
), "tests field is missing in benchmark {}".format(filename)
tests = one_benchmark["tests"]
for test in tests:
if "input_files" in test:
path = self._downloadTestFiles(test["input_files"])
locations.extend(path)
if "output_files" in test:
path = self._downloadTestFiles(test["output_files"])
locations.extend(path)
if "preprocess" in test and "files" in test["preprocess"]:
path = self._downloadTestFiles(test["preprocess"]["files"])
locations.extend(path)
if "postprocess" in test and "files" in test["postprocess"]:
path = self._downloadTestFiles(test["postprocess"]["files"])
locations.extend(path)
return locations