no message

This commit is contained in:
2023-12-03 17:44:32 +03:00
parent 74df6ffa7d
commit 019977ac92
4 changed files with 23 additions and 10 deletions

View File

@@ -14,6 +14,9 @@ public:
fprintf(ptr, "%s\n", text.getCharArray()); fprintf(ptr, "%s\n", text.getCharArray());
} }
~File() { ~File() {
Close();
}
void Close(){
if (ptr != NULL) { if (ptr != NULL) {
fclose(ptr); fclose(ptr);
ptr = NULL; ptr = NULL;

View File

@@ -20,12 +20,13 @@ public:
virtual String getStatePrefix(){ virtual String getStatePrefix(){
return String("Running"); return String("Running");
} }
/*
virtual void Finalize(){ virtual void Finalize(){
this->state = Archivation; this->state = Archivation;
saveState(); saveState();
printf("Archivation started\n"); printf("Archivation started\n");
Utils::ZipFolder(String("./"),String("archive.zip")); Utils::ZipFolder(String("./"),String("archive.zip"));
printf("Archivation ended\n"); printf("Archivation ended\n");
} }
*/
}; };

View File

@@ -84,6 +84,7 @@ public:
case Execution: case Execution:
if (task->getState()==WorkspaceReady){ if (task->getState()==WorkspaceReady){
activeCount++; activeCount++;
task->start_time=Utils::getAbsoluteTime();
task->Start(); task->Start();
}else if (task->getState()==Running){ }else if (task->getState()==Running){
activeCount++; activeCount++;

View File

@@ -36,11 +36,13 @@ enum TestType{
class Task { class Task {
protected: protected:
long id; long id;
int maxtime; int maxtime;
int kernels; //получение зависит от типа задачи. int kernels; //получение зависит от типа задачи.
String workspace; String workspace;
TaskState state; TaskState state;
public: public:
long start_time;
String printState(){ String printState(){
switch(state){ switch(state){
case Inactive: case Inactive:
@@ -146,6 +148,12 @@ public:
//todo определить по интервалу времени на всякий случай. //todo определить по интервалу времени на всякий случай.
}else if (Utils::Exists(workspace+"/INTERRUPT")){ }else if (Utils::Exists(workspace+"/INTERRUPT")){
state=AbortedByUser; state=AbortedByUser;
} else {
long now = Utils::getAbsoluteTime();
long delta = now-start_time;
if (maxtime<delta){
state=AbortedByTimeout;
}
} }
} }
if (state!=Running){ if (state!=Running){