public bool stateSessionTick(lexiconTaskBase task, bool forceRefresh = false) { index++; indexAbsolute++; if ((index >= task.stateSavePeriod) || forceRefresh) { var totalTime = DateTime.Now.Subtract(timeSessionStart).TotalMinutes; TimeSpan period = DateTime.Now.Subtract(lastSave); speedCurrent = ((double)index) / period.TotalMinutes; speedAverage = ((double)indexAbsolute / (double)totalTime); index = 0; scheduledTasks.file.Refresh(); currentRatio = 1 - ((double)scheduledTasks.file.Length / ((double)inputFileSize)); statusReport = task.taskTitle + "[" + currentRatio.ToString("P") + "] session[" + indexAbsolute + ":" + takeCount + "] rt[" + totalTime.ToString("#0,0") + " min] speed[" + speedCurrent.ToString("#0.00") + " n/min] avg[" + speedCurrent.ToString("#0.00") + " n/min] "; Console.Title = statusReport; response.log(statusReport); stateSave(); } if (indexAbsolute > takeCount) { return(true); } return(false); }
/// <summary> /// Initializes a new instance of the <see cref="lexiconConstructTaskState"/> class. /// </summary> /// <param name="task">The task.</param> public lexiconConstructTaskState(lexiconTaskBase task) { pathPrefix = task.taskTitle.getCleanFilePath(); /* * setPaths(); * * inputFileCheck(task); * connectWithFiles(); * stateSave();*/ }
/// <summary> /// Brise sve sto je imao snimljeno o stageu /// </summary> /// <param name="task">The task.</param> public void taskStateReset(lexiconTaskBase task) { taskInitDateTime = DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); taskSessionStarts = new List <string>(); pathPrefix = task.taskTitle.getCleanFilePath(); setPaths(); folder.deleteFiles(pathPrefix + "*.*"); inputFileCheck(task, true); File.Copy(inputPath, scheduledTasks_filepath); connectWithFiles(); stateSave(); }
private void inputFileCheck(lexiconTaskBase task, bool deleteFile = false) { inputPath = semanticLexiconManager.manager.constructor.projectFolderStructure.pathFor(task.taskInputPath); if (deleteFile) { File.Delete(inputPath); } string s_path = ""; if (task.taskSourcePathIsAppRoot) { s_path = task.taskSourcePath; } else { s_path = semanticLexiconManager.manager.constructor.projectFolderStructure.pathFor(task.taskSourcePath); } if (File.Exists(s_path)) { //corpusInputFilepath = projectDirectory.FullName.add("corpus_input.csv", "\\"); if (File.Exists(inputPath)) { semanticLexiconManager.manager.constructor.output.AppendLine("Corpus input file found: " + inputPath); } else { File.Copy(s_path, inputPath); semanticLexiconManager.manager.constructor.output.AppendLine("Corpus input file [" + s_path + "] copied: " + inputPath); } } FileInfo fi = new FileInfo(inputPath); if (fi.Exists) { inputFileSize = fi.Length; } }
/// <summary> /// Priprema ga za start nove sesije /// </summary> /// <param name="task">The task.</param> /// <param name="take">The take.</param> /// <param name="__savemodels">if set to <c>true</c> [savemodels].</param> /// <param name="__debug">if set to <c>true</c> [debug].</param> /// <param name="__verbose">if set to <c>true</c> [verbose].</param> /// <param name="response">The response.</param> public void taskStateStartSession(lexiconTaskBase task, int take, bool __savemodels, bool __debug, bool __verbose, ILogBuilder __response) { pathPrefix = task.taskTitle.getCleanFilePath(); setPaths(); debug = __debug; verbose = __verbose; saveModel = __savemodels; takeCount = take; taskSessionStarts.Add(DateTime.Now.ToShortDateString() + " " + DateTime.Now.ToShortTimeString()); index = 0; indexAbsolute = 0; lastSave = DateTime.Now; response = __response; timeSessionStart = DateTime.Now; connectWithFiles(); taskShadow.AddRange(failedTasks.TakeAll().getLineContentList()); stateSave(); }