in variance-analysis/mach_perftest_notebook_dev/perftestnotebook/perftestnotebook.py [0:0]
def process(self, no_iodide=False):
"""
Process the file groups and return the results of the requested analyses.
:return: All the results in a dictionary. The field names are the Analyzer
funtions that were called.
"""
fmt_data = []
notebook_sections = ""
for name, files in self.file_groups.items():
files = self.parse_file_grouping(files)
if isinstance(files, dict):
for subtest, files in files.items():
self.transformer.files = files
trfm_data = self.transformer.process(name)
if type(trfm_data) == list:
for e in trfm_data:
if "subtest" not in e:
e["subtest"] = subtest
else:
e["subtest"] = "%s-%s" % (subtest, e["subtest"])
fmt_data.extend(trfm_data)
else:
if "subtest" not in trfm_data:
trfm_data["subtest"] = subtest
else:
trfm_data["subtest"] = "%s-%s" % (
subtest,
trfm_data["subtest"],
)
fmt_data.append(trfm_data)
else:
# Transform the data
self.transformer.files = files
trfm_data = self.transformer.process(name)
if type(trfm_data) == list:
fmt_data.extend(trfm_data)
else:
fmt_data.append(trfm_data)
self.fmt_data = fmt_data
# Write formatted data output to filepath
output_data_filepath = self.parse_output()
print("Writing results to %s" % output_data_filepath)
with open(output_data_filepath, "w") as f:
json.dump(self.fmt_data, f, indent=4, sort_keys=True)
# Gather config["analysis"] corresponding notebook sections
if "analysis" in self.config:
for func in self.config["analysis"]:
notebook_sections += self.analyzer.get_notebook_section(func)
# Post to Iodide server
if not no_iodide:
self.post_to_iodide(output_data_filepath, notebook_sections)
return self.fmt_data