|
|
@ -229,8 +229,9 @@ export async function runLearning(id: AnalyticUnit.AnalyticUnitId) { |
|
|
|
} |
|
|
|
} |
|
|
|
await AnalyticUnitCache.setData(id, result.payload.cache); |
|
|
|
await AnalyticUnitCache.setData(id, result.payload.cache); |
|
|
|
} catch (err) { |
|
|
|
} catch (err) { |
|
|
|
let message = err.message || JSON.stringify(err); |
|
|
|
const message = err.message || JSON.stringify(err); |
|
|
|
await AnalyticUnit.setStatus(id, AnalyticUnit.AnalyticUnitStatus.FAILED, message); |
|
|
|
await AnalyticUnit.setStatus(id, AnalyticUnit.AnalyticUnitStatus.FAILED, message); |
|
|
|
|
|
|
|
throw new Error(message) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
@ -429,9 +430,10 @@ export async function updateThreshold( |
|
|
|
await Threshold.updateThreshold(id, value, condition); |
|
|
|
await Threshold.updateThreshold(id, value, condition); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export async function runFirstLearning(id: AnalyticUnit.AnalyticUnitId) { |
|
|
|
export async function runLearningWithDetection(id: AnalyticUnit.AnalyticUnitId) { |
|
|
|
// TODO: move setting status somehow "inside" learning
|
|
|
|
// TODO: move setting status somehow "inside" learning
|
|
|
|
await AnalyticUnit.setStatus(id, AnalyticUnit.AnalyticUnitStatus.PENDING); |
|
|
|
await AnalyticUnit.setStatus(id, AnalyticUnit.AnalyticUnitStatus.PENDING); |
|
|
|
runLearning(id) |
|
|
|
runLearning(id) |
|
|
|
.then(() => runDetect(id)); |
|
|
|
.then(() => runDetect(id)) |
|
|
|
|
|
|
|
.catch(err => console.error(err)); |
|
|
|
} |
|
|
|
} |
|
|
|