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