make metadata indexing optional

while indexing the rally results to ES make the metadata indexing
optional.

now we can remove the metadata field in browbeat-config.yml and
disable the metadata indexing.

Change-Id: I68fcf4153f79bc321d920203525fea228fa0e996
This commit is contained in:
Masco 2024-10-07 13:25:19 +05:30
parent 58f4d9316b
commit 11c80c02b3
3 changed files with 16 additions and 18 deletions

View File

@ -73,22 +73,20 @@ class Elastic(object):
return json_data
def combine_metadata(self, result):
if (self.config['elasticsearch']['metadata_files'] is not None and
len(self.config['elasticsearch']['metadata_files']) > 0):
meta = self.config['elasticsearch']['metadata_files']
for _meta in meta:
try:
with open(_meta['file']) as jdata:
result[_meta['name']] = json.load(jdata)
except Exception:
self.logger.error(
"Error loading Metadata file : {}".format(
_meta['file']))
self.logger.error(
"Please make sure the metadata file exists and"
" is valid JSON or run the playbook ansible/gather/site.yml"
" before running the Browbeat test Suite")
sys.exit(1)
meta = self.config['elasticsearch'].get('metadata_files', []) or []
for _meta in meta:
try:
with open(_meta['file']) as jdata:
result[_meta['name']] = json.load(jdata)
except Exception:
self.logger.error(
"Error loading Metadata file : {}".format(
_meta['file']))
self.logger.error(
"Please make sure the metadata file exists and"
" is valid JSON or run the playbook ansible/gather/site.yml"
" before running the Browbeat test Suite")
sys.exit(1)
return result
# Used to transform the cache dict into an elastic insertable iterable

View File

@ -62,7 +62,7 @@ mapping:
required: True
metadata_files:
type: seq
required: True
required: False
sequence:
- type: map
mapping:

View File

@ -70,7 +70,7 @@ class Tools(object):
workloads.run_workload(copy.deepcopy(workload), run_iteration)
def check_metadata(self):
meta = self.config['elasticsearch']['metadata_files']
meta = self.config['elasticsearch'].get('metadata_files', []) or []
for _meta in meta:
if not os.path.isfile(_meta['file']):
self.logger.info(