Browse Source

Uppercase hotfix

pull/1/head
rozetko 6 years ago
parent
commit
892ba6db6f
  1. 6
      analytics/analytic_unit_worker.py
  2. 3
      analytics/server.py

6
analytics/analytic_unit_worker.py

@ -28,7 +28,7 @@ class AnalyticUnitWorker(object):
result = await self.do_learn(analytic_unit_id, segments, pattern)
else:
result = {
'status': "failed",
'status': "FAILED",
'error': "unknown type " + str(type)
}
except Exception as e:
@ -50,7 +50,7 @@ class AnalyticUnitWorker(object):
last_prediction_time = await model.learn(segments)
# TODO: we should not do predict before labeling in all models, not just in drops
if pattern == 'drop' and len(segments) == 0:
if pattern == 'DROP' and len(segments) == 0:
# TODO: move result to a class which renders to json for messaging to analytics
result = {
'status': 'SUCCESS',
@ -61,7 +61,7 @@ class AnalyticUnitWorker(object):
else:
result = await self.do_predict(analytic_unit_id, last_prediction_time, pattern)
result['task'] = 'learn'
result['task'] = 'LEARN'
return result
async def do_predict(self, analytic_unit_id, last_prediction_time, pattern):

3
analytics/server.py

@ -46,7 +46,8 @@ async def handle_task(task: object):
res = await worker.do_task(task)
res['_taskId'] = task['_taskId']
await server_service.send_message(json.dumps(res))
message = services.server_service.ServerMessage('TASK_RESULT', res)
await server_service.send_message(message)
except Exception as e:
logger.error("handle_task Exception: '%s'" % str(e))

Loading…
Cancel
Save