diff --git a/app/commons/launch_objects.py b/app/commons/launch_objects.py index 7a81e8e9..a7e0bed1 100644 --- a/app/commons/launch_objects.py +++ b/app/commons/launch_objects.py @@ -67,6 +67,7 @@ class TestItemInfo(BaseModel): clusterId: int = 0 launchId: int launchName: str = "" + launchNumber: int = 0 testItemName: str = "" project: int analyzerConfig: AnalyzerConf = AnalyzerConf() diff --git a/app/service/analyzer_service.py b/app/service/analyzer_service.py index 69637d27..9abef4bd 100644 --- a/app/service/analyzer_service.py +++ b/app/service/analyzer_service.py @@ -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 @@ -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) diff --git a/app/service/auto_analyzer_service.py b/app/service/auto_analyzer_service.py index d23a904d..90b6d6cb 100644 --- a/app/service/auto_analyzer_service.py +++ b/app/service/auto_analyzer_service.py @@ -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 @@ -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 diff --git a/app/service/search_service.py b/app/service/search_service.py index cf4dd70f..3861247f 100644 --- a/app/service/search_service.py +++ b/app/service/search_service.py @@ -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"]) diff --git a/app/service/suggest_service.py b/app/service/suggest_service.py index 470fc55e..8872535e 100644 --- a/app/service/suggest_service.py +++ b/app/service/suggest_service.py @@ -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 @@ -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" @@ -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"])