From 019977ac923f30c3b0dddf7d2996be97434aeda6 Mon Sep 17 00:00:00 2001 From: 02090095 Date: Sun, 3 Dec 2023 17:44:32 +0300 Subject: [PATCH] no message --- Planner/File.h | 13 ++++++++----- Planner/RunSupervisor.h | 3 ++- Planner/Supervisor.h | 3 ++- Planner/Task.h | 14 +++++++++++--- 4 files changed, 23 insertions(+), 10 deletions(-) diff --git a/Planner/File.h b/Planner/File.h index 06c92ffc..21738214 100644 --- a/Planner/File.h +++ b/Planner/File.h @@ -14,11 +14,14 @@ public: fprintf(ptr, "%s\n", text.getCharArray()); } ~File() { - if (ptr != NULL) { - fclose(ptr); - ptr = NULL; - } - } + Close(); + } + void Close(){ + if (ptr != NULL) { + fclose(ptr); + ptr = NULL; + } + } Text* readLines(){ Text* lines = new Text(); int c; diff --git a/Planner/RunSupervisor.h b/Planner/RunSupervisor.h index e1105615..c543a601 100644 --- a/Planner/RunSupervisor.h +++ b/Planner/RunSupervisor.h @@ -20,12 +20,13 @@ public: virtual String getStatePrefix(){ return String("Running"); } + /* virtual void Finalize(){ this->state = Archivation; saveState(); printf("Archivation started\n"); Utils::ZipFolder(String("./"),String("archive.zip")); printf("Archivation ended\n"); - } + */ }; \ No newline at end of file diff --git a/Planner/Supervisor.h b/Planner/Supervisor.h index d991b301..3963941d 100644 --- a/Planner/Supervisor.h +++ b/Planner/Supervisor.h @@ -83,7 +83,8 @@ public: break; case Execution: if (task->getState()==WorkspaceReady){ - activeCount++; + activeCount++; + task->start_time=Utils::getAbsoluteTime(); task->Start(); }else if (task->getState()==Running){ activeCount++; diff --git a/Planner/Task.h b/Planner/Task.h index 19891b5d..8c95d128 100644 --- a/Planner/Task.h +++ b/Planner/Task.h @@ -35,12 +35,14 @@ enum TestType{ #pragma once class Task { protected: - long id; + long id; + int maxtime; int kernels; //получение зависит от типа задачи. String workspace; TaskState state; -public: +public: + long start_time; String printState(){ switch(state){ case Inactive: @@ -146,7 +148,13 @@ public: //todo определить по интервалу времени на всякий случай. }else if (Utils::Exists(workspace+"/INTERRUPT")){ state=AbortedByUser; - } + } else { + long now = Utils::getAbsoluteTime(); + long delta = now-start_time; + if (maxtime