Browse Source

analytics repair

pull/1/head
Coin de Gamma 6 years ago
parent
commit
1aada3240e
  1. 9
      analytics/analytic_unit_manager.py
  2. 4
      analytics/analytic_unit_worker.py
  3. 2
      analytics/server.py

9
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",

4
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')

2
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

Loading…
Cancel
Save