|
|
@ -290,6 +290,8 @@ export async function runLearning(id: AnalyticUnit.AnalyticUnitId, from?: number |
|
|
|
if(result.status !== AnalyticUnit.AnalyticUnitStatus.SUCCESS) { |
|
|
|
if(result.status !== AnalyticUnit.AnalyticUnitStatus.SUCCESS) { |
|
|
|
throw new Error(result.error); |
|
|
|
throw new Error(result.error); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
// TODO: rename SUCCESS to something better
|
|
|
|
|
|
|
|
await AnalyticUnit.setStatus(id, AnalyticUnit.AnalyticUnitStatus.SUCCESS); |
|
|
|
await AnalyticUnitCache.setData(id, result.payload.cache); |
|
|
|
await AnalyticUnitCache.setData(id, result.payload.cache); |
|
|
|
} catch (err) { |
|
|
|
} catch (err) { |
|
|
|
const message = err.message || JSON.stringify(err); |
|
|
|
const message = err.message || JSON.stringify(err); |
|
|
@ -331,8 +333,7 @@ export async function runDetect(id: AnalyticUnit.AnalyticUnitId, from?: number, |
|
|
|
{ detector, analyticUnitType, lastDetectionTime: unit.lastDetectionTime, data, cache: oldCache } |
|
|
|
{ detector, analyticUnitType, lastDetectionTime: unit.lastDetectionTime, data, cache: oldCache } |
|
|
|
); |
|
|
|
); |
|
|
|
console.log(`run task, id:${id}`); |
|
|
|
console.log(`run task, id:${id}`); |
|
|
|
// TODO: status: detection
|
|
|
|
await AnalyticUnit.setStatus(id, AnalyticUnit.AnalyticUnitStatus.DETECTION); |
|
|
|
await AnalyticUnit.setStatus(id, AnalyticUnit.AnalyticUnitStatus.LEARNING); |
|
|
|
|
|
|
|
const result = await runTask(task); |
|
|
|
const result = await runTask(task); |
|
|
|
|
|
|
|
|
|
|
|
if(result.status === AnalyticUnit.AnalyticUnitStatus.FAILED) { |
|
|
|
if(result.status === AnalyticUnit.AnalyticUnitStatus.FAILED) { |
|
|
|