Browse Source

Queue or drop learning task on new learning task #664 (#669)

pull/1/head
Evgeny Smyshlyaev 5 years ago committed by GitHub
parent
commit
7254237b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      server/src/controllers/analytics_controller.ts

3
server/src/controllers/analytics_controller.ts

@ -206,7 +206,8 @@ export async function runLearning(id: AnalyticUnit.AnalyticUnitId, from?: number
let analyticUnit = await AnalyticUnit.findById(id);
if(analyticUnit.status === AnalyticUnit.AnalyticUnitStatus.LEARNING) {
throw new Error('Can`t start learning when it`s already started [' + id + ']');
console.log(`cancel already started learning for ${id}, run new learning`);
await cancelAnalyticsTask(id);
}
const oldSegments = await Segment.findMany(id, { labeled: false, deleted: false });
// TODO: segments and spans are coupled. So their removing should be a transaction

Loading…
Cancel
Save