/// <summary> /// signals that training is done /// </summary> public void TrainingDone() { trainingDone = true; //background thread to stop session db workers when done Task.Run(() => { while (true) { bool processing = Sessions.Any(a => a.Value.CreatedToDb == false || a.Value.UpdatedToDb == false); if (!processing && /*Sessions.Count > 0 &&*/ trainingDone) { StopRlmDbWorkersSessions(); System.Diagnostics.Debug.WriteLine("Worker Session done"); break; } Task.Delay(5 * 1000).Wait(); } }); //background thread to stop case db workers when done Task.Run(() => { while (true) { ////bool processing = Cases.Any(a => a.SavedToDb == false); //if (/*!processing &&*/ Cases.Count == 0 && trainingDone && sessionsDone && rlmDb.DistinctCaseSessionsCount() == totalSessionsCount) //{ // StopRlmDbWorkersCases(); // System.Diagnostics.Debug.WriteLine("Worker Cases done"); // break; //} if (sessionsDone && rlmDb.DistinctCaseSessionsCount() == totalSessionsCount && MASTER_CASE_QUEUE.Count == 1 && MASTER_CASE_QUEUE.ElementAt(0).Count == 0) { StopRlmDbWorkersCases(); System.Diagnostics.Debug.WriteLine("Worker Cases done"); break; } Task.Delay(5 * 1000).Wait(); } }); }
/// <summary> /// signals that training is done /// </summary> public void TrainingDone() { trainingDone = true; //background thread to stop session db workers when done Task.Run(() => { while (true) { bool processing = Sessions.Any(a => a.Value.CreatedToDb == false || a.Value.UpdatedToDb == false); if (!processing && Sessions.Count > 0 && trainingDone) { StopRlmDbWorkersSessions(); System.Diagnostics.Debug.WriteLine("Worker Session done"); break; } Task.Delay(5 * 1000).Wait(); } }); //background thread to stop case db workers when done Task.Run(() => { while (true) { bool processing = Cases.Any(a => a.SavedToDb == false); if (!processing && Cases.Count > 0 && trainingDone && sessionsDone && rlmDb.DistinctCaseSessionsCount() == totalSessionsCount) { StopRlmDbWorkersCases(); System.Diagnostics.Debug.WriteLine("Worker Cases done"); break; } Task.Delay(5 * 1000).Wait(); } }); }