From 9c5ce7039ac2c1734f8aca9242512fd935177154 Mon Sep 17 00:00:00 2001 From: Shashank Reddy Boyapally Date: Wed, 24 Jan 2024 14:25:00 -0500 Subject: [PATCH 1/2] changed ES_URL to class level --- fmatch/matcher.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fmatch/matcher.py b/fmatch/matcher.py index b1c13cf..156804f 100644 --- a/fmatch/matcher.py +++ b/fmatch/matcher.py @@ -11,7 +11,7 @@ import pandas as pd -ES_URL = os.getenv("ES_SERVER") + class Matcher: @@ -20,6 +20,7 @@ class Matcher: def __init__(self, index="perf_scale_ci", level=logging.INFO): + ES_URL = os.getenv("ES_SERVER") #pylint: disable = invalid-name self.index = index self.es_url = ES_URL self.search_size = 10000 @@ -197,7 +198,7 @@ def burner_results(self, uuid, uuids, index): runs = [item['_source'] for item in result["hits"]["hits"]] return runs - def burner_metric_query(self, uuids, namespace, index, metricName): + def burner_metric_query(self, uuids, namespace, index, metric_name): """ burner_metric_query will query for specific metricName data. Args: @@ -241,7 +242,7 @@ def burner_metric_query(self, uuids, namespace, index, metricName): "query_string": { "query": ( f'( uuid: \"{ids}\" )' - f' AND metricName: {metricName}' + f' AND metricName: {metric_name}' f' AND labels.namespace.keyword: {namespace}' ) } From 2276c882f94013c59df156017428c5b6c5fb2dce Mon Sep 17 00:00:00 2001 From: Shashank Reddy Boyapally Date: Wed, 24 Jan 2024 15:41:47 -0500 Subject: [PATCH 2/2] added ES_URL arguments --- fmatch/matcher.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/fmatch/matcher.py b/fmatch/matcher.py index 156804f..aec9b76 100644 --- a/fmatch/matcher.py +++ b/fmatch/matcher.py @@ -1,5 +1,6 @@ """ metadata matcher """ +#pylint: disable = invalid-name import os import sys import logging @@ -19,8 +20,7 @@ class Matcher: """ - def __init__(self, index="perf_scale_ci", level=logging.INFO): - ES_URL = os.getenv("ES_SERVER") #pylint: disable = invalid-name + def __init__(self, index="perf_scale_ci", level=logging.INFO, ES_URL=os.getenv("ES_SERVER")): self.index = index self.es_url = ES_URL self.search_size = 10000 @@ -198,7 +198,7 @@ def burner_results(self, uuid, uuids, index): runs = [item['_source'] for item in result["hits"]["hits"]] return runs - def burner_metric_query(self, uuids, namespace, index, metric_name): + def burner_metric_query(self, uuids, namespace, index, metricName): """ burner_metric_query will query for specific metricName data. Args: @@ -242,7 +242,7 @@ def burner_metric_query(self, uuids, namespace, index, metric_name): "query_string": { "query": ( f'( uuid: \"{ids}\" )' - f' AND metricName: {metric_name}' + f' AND metricName: {metricName}' f' AND labels.namespace.keyword: {namespace}' ) }