Skip to content

Commit

Permalink
Add launchNumber on suggest request and correct logging
Browse files Browse the repository at this point in the history
  • Loading branch information
HardNorth committed Nov 9, 2023
1 parent 3426c99 commit f498d98
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
1 change: 1 addition & 0 deletions app/commons/launch_objects.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ class TestItemInfo(BaseModel):
clusterId: int = 0
launchId: int
launchName: str = ""
launchNumber: int = 0
testItemName: str = ""
project: int
analyzerConfig: AnalyzerConf = AnalyzerConf()
Expand Down
2 changes: 0 additions & 2 deletions app/service/analyzer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from app.commons.esclient import EsClient
from app.utils import utils
from app.commons.log_preparation import LogPreparation
from app.commons.log_merger import LogMerger
Expand All @@ -29,7 +28,6 @@ class AnalyzerService:
def __init__(self, model_chooser, app_config=None, search_cfg=None):
self.app_config = app_config or {}
self.search_cfg = search_cfg or {}
self.es_client = EsClient(app_config=self.app_config, search_cfg=self.search_cfg)
self.log_preparation = LogPreparation()
self.log_merger = LogMerger()
self.namespace_finder = namespace_finder.NamespaceFinder(app_config)
Expand Down
9 changes: 6 additions & 3 deletions app/service/auto_analyzer_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
# limitations under the License.

from app.utils import utils, text_processing
from app.commons.esclient import EsClient
from app.commons.launch_objects import AnalysisResult, BatchLogInfo, AnalysisCandidate, SuggestAnalysisResult
from app.boosting_decision_making import boosting_featurizer
from app.service.analyzer_service import AnalyzerService
Expand All @@ -31,11 +32,13 @@

class AutoAnalyzerService(AnalyzerService):

def __init__(self, model_chooser, app_config=None, search_cfg=None):
es_client: EsClient

def __init__(self, model_chooser, app_config=None, search_cfg=None, es_client: EsClient = None):
self.app_config = app_config or {}
self.search_cfg = search_cfg or {}
super(AutoAnalyzerService, self).__init__(
model_chooser, app_config=self.app_config, search_cfg=self.search_cfg)
super().__init__(model_chooser, app_config=self.app_config, search_cfg=self.search_cfg)
self.es_client = es_client or EsClient(app_config=self.app_config, search_cfg=self.search_cfg)

def get_config_for_boosting(self, analyzer_config):
min_should_match = self.find_min_should_match_threshold(analyzer_config) / 100
Expand Down
3 changes: 2 additions & 1 deletion app/service/search_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,8 @@ def search_similar_items_for_log(self, search_req, queried_log,
def search_logs(self, search_req):
"""Get all logs similar to given logs"""
similar_log_ids = {}
logger.info("Started searching by request %s", search_req.json())
logger.info(f'Started searching for test item with id: {search_req.itemId}')
logger.debug(f'Started searching by request: {search_req.json()}')
logger.info("ES Url %s", text_processing.remove_credentials_from_url(self.es_client.host))
index_name = text_processing.unite_project_name(
str(search_req.projectId), self.app_config["esProjectIndexPrefix"])
Expand Down
11 changes: 8 additions & 3 deletions app/service/suggest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
from app.amqp.amqp import AmqpClient
from app.boosting_decision_making.suggest_boosting_featurizer import SuggestBoostingFeaturizer
from app.commons import similarity_calculator
from app.commons.esclient import EsClient
from app.commons.launch_objects import SuggestAnalysisResult
from app.service.analyzer_service import AnalyzerService
from app.utils import utils, text_processing
Expand All @@ -37,10 +38,13 @@

class SuggestService(AnalyzerService):

def __init__(self, model_chooser, app_config=None, search_cfg=None):
es_client: EsClient

def __init__(self, model_chooser, app_config=None, search_cfg=None, es_client: EsClient = None):
self.app_config = app_config or {}
self.search_cfg = search_cfg or {}
super(SuggestService, self).__init__(model_chooser, app_config=self.app_config, search_cfg=self.search_cfg)
super().__init__(model_chooser, app_config=self.app_config, search_cfg=self.search_cfg)
self.es_client = es_client or EsClient(app_config=self.app_config, search_cfg=self.search_cfg)
self.suggest_threshold = 0.4
self.rp_suggest_index_template = "rp_suggestions_info"
self.rp_suggest_metrics_index_template = "rp_suggestions_info_metrics"
Expand Down Expand Up @@ -320,7 +324,8 @@ def prepare_logs_for_suggestions(self, test_item_info, index_name):

@utils.ignore_warnings
def suggest_items(self, test_item_info):
logger.info("Started suggesting test items by request %s", test_item_info.json())
logger.info(f'Started suggesting for test item with id: {test_item_info.testItemId}')
logger.debug(f'Started suggesting items by request: {test_item_info.json()}')
logger.info("ES Url %s", text_processing.remove_credentials_from_url(self.es_client.host))
index_name = text_processing.unite_project_name(
str(test_item_info.project), self.app_config["esProjectIndexPrefix"])
Expand Down

0 comments on commit f498d98

Please sign in to comment.