From 496deb1cf832ea0c342e4b583580684b9f1ec027 Mon Sep 17 00:00:00 2001 From: smathews Date: Thu, 19 Dec 2019 18:45:48 -0800 Subject: [PATCH 1/2] Include metadata in results.json file: - break up the jsonable logic for Metadata to its own function - use this jsonable function when generating results.json --- toolset/utils/metadata.py | 14 ++++++++++---- toolset/utils/results.py | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/toolset/utils/metadata.py b/toolset/utils/metadata.py index 42cf3e9634c..8eb316f387b 100644 --- a/toolset/utils/metadata.py +++ b/toolset/utils/metadata.py @@ -234,12 +234,12 @@ def parse_config(self, config, directory): return tests - def list_test_metadata(self): + def to_jsonable(self): ''' - Prints the metadata for all the available tests + Returns an array suitable for jsonification ''' all_tests = self.gather_tests() - all_tests_json = json.dumps(map(lambda test: { + return map(lambda test: { "project_name": test.project_name, "name": test.name, "approach": test.approach, @@ -256,7 +256,13 @@ def list_test_metadata(self): "notes": test.notes, "versus": test.versus, "tags": hasattr(test, "tags") and test.tags or [] - }, all_tests)) + }, all_tests) + + def list_test_metadata(self): + ''' + Prints the metadata for all the available tests + ''' + all_tests_json = json.dumps(self.to_jsonable()) with open( os.path.join(self.benchmarker.results.directory, diff --git a/toolset/utils/results.py b/toolset/utils/results.py index 60f618bf787..39723dd77ec 100644 --- a/toolset/utils/results.py +++ b/toolset/utils/results.py @@ -336,6 +336,7 @@ def __to_jsonable(self): toRet['succeeded'] = self.succeeded toRet['failed'] = self.failed toRet['verify'] = self.verify + toRet['metadata'] = self.benchmarker.metadata.to_jsonable() return toRet From 267add9d8ada905c7f4b0eca8be0655d2f6a5800 Mon Sep 17 00:00:00 2001 From: smathews-techempower Date: Fri, 20 Dec 2019 12:52:49 -0800 Subject: [PATCH 2/2] Store test metadata array under the test_metadata key for consistency and clarity --- toolset/utils/results.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolset/utils/results.py b/toolset/utils/results.py index 39723dd77ec..7ea004d4e24 100644 --- a/toolset/utils/results.py +++ b/toolset/utils/results.py @@ -336,7 +336,7 @@ def __to_jsonable(self): toRet['succeeded'] = self.succeeded toRet['failed'] = self.failed toRet['verify'] = self.verify - toRet['metadata'] = self.benchmarker.metadata.to_jsonable() + toRet['test_metadata'] = self.benchmarker.metadata.to_jsonable() return toRet