Skip to content

Commit

Permalink
Generic indexes (#24)
Browse files Browse the repository at this point in the history
* added verify certs and generic indexes

Signed-off-by: Shashank Reddy Boyapally <[email protected]>

* updated unit tests

Signed-off-by: Shashank Reddy Boyapally <[email protected]>

* updated fmatch version 0.0.7

Signed-off-by: Shashank Reddy Boyapally <[email protected]>

---------

Signed-off-by: Shashank Reddy Boyapally <[email protected]>
  • Loading branch information
shashank-boyapally authored Apr 10, 2024
1 parent 099f5e6 commit 518c095
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 6 additions & 4 deletions fmatch/matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ class Matcher:
"""Matcher"""

def __init__(
self, index="perf_scale_ci", level=logging.INFO, ES_URL=os.getenv("ES_SERVER")
self, index="ospst-perf-scale-ci",
level=logging.INFO,
ES_URL=os.getenv("ES_SERVER"),
verify_certs=True
):
self.index = index
self.es_url = ES_URL
Expand All @@ -35,7 +38,7 @@ def __init__(
self.logger.addHandler(handler)
# We can set the ES logging higher if we want additional debugging
logging.getLogger("elasticsearch").setLevel(logging.WARN)
self.es = Elasticsearch([self.es_url], timeout=30)
self.es = Elasticsearch([self.es_url], timeout=30, verify_certs=verify_certs)
self.data = None

def get_metadata_by_uuid(self, uuid, index=None):
Expand Down Expand Up @@ -96,14 +99,13 @@ def get_uuid_by_metadata(self, meta, index=None):
"buildUrl":hit.to_dict()["_source"]["buildUrl"]} for hit in hits]
return uuids_docs

def match_kube_burner(self, uuids):
def match_kube_burner(self, uuids, index):
"""match kube burner runs
Args:
uuids (list): list of uuids
Returns:
list : list of runs
"""
index = "ripsaw-kube-burner*"
query = Q(
"bool",
filter=[
Expand Down
2 changes: 1 addition & 1 deletion fmatch/tests/test_matcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_get_uuid_by_metadata(matcher_instance):


def test_match_kube_burner(matcher_instance):
result = matcher_instance.match_kube_burner(["uuid1"])
result = matcher_instance.match_kube_burner(["uuid1"],index="ospst-*")
expected = [
{"uuid": "uuid1", "field1": "value1"},
{"uuid": "uuid2", "field1": "value2"},
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from setuptools import setup, find_packages


VERSION = '0.0.6'
VERSION = '0.0.7'
DESCRIPTION = 'Common package for matching runs with provided metadata'
# pylint: disable= line-too-long
LONG_DESCRIPTION = "A package that allows to match metadata and get runs and create csv files with queried metrics"
Expand Down

0 comments on commit 518c095

Please sign in to comment.