diff --git a/config/common.py b/config/common.py index 5497a0100..bd7bf6c02 100644 --- a/config/common.py +++ b/config/common.py @@ -6,9 +6,31 @@ # ReFrame CSCS settings # +import json import os +def _format_httpjson(record, extras, ignore_keys): + """ + https://github.com/eth-cscs/cscs-reframe-tests/pull/380 + """ + data = {} + for attr, val in record.__dict__.items(): + if attr in ignore_keys or attr.startswith('_'): + continue + + if attr == "check_perf_value" and val is not None: + data[attr] = float(val) + elif attr == "check_perf_ref" and val is not None: + data[attr] = float(val) + else: + data[attr] = val + + data.update(extras) + + return json.dumps(data) + + site_configuration = { 'environments': [ { @@ -75,6 +97,8 @@ 'rfm_ci_pipeline': os.getenv("CI_PIPELINE_URL", "#"), 'rfm_ci_project': os.getenv("CI_PROJECT_PATH", "Unknown CI Project") }, + # 'debug': True, + "json_formatter": _format_httpjson, 'ignore_keys': ['check_perfvalues'] } ]