diff --git a/analytics/analytic_unit_manager.py b/analytics/analytic_unit_manager.py index 68302f0..252ca1c 100644 --- a/analytics/analytic_unit_manager.py +++ b/analytics/analytic_unit_manager.py @@ -1,10 +1,13 @@ from typing import Dict +import logging import detectors from analytic_unit_worker import AnalyticUnitWorker +logger = logging.getLogger('AnalyticUnitManager') + analytic_unit_id = str -analytic_workers: Dict[analytic_unit_id, AnalyticUnitWorker] = Dict() +analytic_workers: Dict[analytic_unit_id, AnalyticUnitWorker] = dict() def get_detector(self, analytic_unit_type) -> detectors.Detector: if analytic_unit_type == 'GENERAL': @@ -34,9 +37,7 @@ async def handle_analytic_task(task): raise ValueError('Unknown task type "%s"' % type) except Exception as e: - #traceback.extract_stack() - error_text = traceback.format_exc() - logger.error("do_task Exception: '%s'" % error_text) + logger.error("handle_analytic_task exception: '%s'" % error_text) # TODO: move result to a class which renders to json for messaging to analytics result = { 'status': "FAILED", diff --git a/analytics/analytic_unit_worker.py b/analytics/analytic_unit_worker.py index a0c1f9d..a1309c4 100644 --- a/analytics/analytic_unit_worker.py +++ b/analytics/analytic_unit_worker.py @@ -1,10 +1,6 @@ import config import detectors -import json import logging -import sys -import traceback -import time logger = logging.getLogger('AnalyticUnitWorker') diff --git a/analytics/server.py b/analytics/server.py index 8cc62d4..cd6a258 100644 --- a/analytics/server.py +++ b/analytics/server.py @@ -78,8 +78,6 @@ async def app_loop(): if __name__ == "__main__": loop = asyncio.get_event_loop() - logger.info("Starting worker...") - worker = AnalyticUnitWorker() logger.info("Ok") server_service, data_service = init_services() print('Analytics process is running') # we need to print to stdout and flush