Browse Source

worker->analytic_worker

pull/1/head
Alexey Velikiy 6 years ago
parent
commit
9da8bbcf11
  1. 4
      analytics/analytic_unit_worker.py
  2. 4
      analytics/server.py

4
analytics/worker.py → analytics/analytic_unit_worker.py

@ -13,7 +13,7 @@ import time
logger = logging.getLogger('WORKER') logger = logging.getLogger('WORKER')
class Worker(object): class AnalyticUnitWorker(object):
models_cache = {} models_cache = {}
thread = None thread = None
queue = queue.Queue() queue = queue.Queue()
@ -85,7 +85,7 @@ class Worker(object):
} }
else: else:
result = self.do_predict(analytic_unit_id, last_prediction_time, pattern) result = self.do_predict(analytic_unit_id, last_prediction_time, pattern)
result['task'] = 'learn' result['task'] = 'learn'
return result return result

4
analytics/server.py

@ -4,7 +4,7 @@ import logging
import zmq import zmq
import sys import sys
from worker import Worker from worker import AnalyticUnitWorker
root = logging.getLogger() root = logging.getLogger()
@ -46,7 +46,7 @@ def handle_task(text):
if __name__ == "__main__": if __name__ == "__main__":
worker = Worker() worker = AnalyticUnitWorker()
logger.info("Worker was started") logger.info("Worker was started")
logger.info("Binding to %s ..." % config.ZEROMQ_CONNECTION_STRING) logger.info("Binding to %s ..." % config.ZEROMQ_CONNECTION_STRING)

Loading…
Cancel
Save