improved
This commit is contained in:
@@ -93,4 +93,18 @@ public:
|
|||||||
printf("START %ld: %s\n", id, res.getCharArray());
|
printf("START %ld: %s\n", id, res.getCharArray());
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void copyResults(const String& pathRes) {
|
||||||
|
String resultPath(packageWorkspace + "/" + pathRes + "/" + getId());
|
||||||
|
|
||||||
|
Utils::Mkdir(resultPath);
|
||||||
|
|
||||||
|
Utils::Copy(workspace + "/out.txt", resultPath + "/out.txt");
|
||||||
|
Utils::Copy(workspace + "/err.txt", resultPath + "/err.txt");
|
||||||
|
|
||||||
|
if (Utils::Exists(workspace + "/sts.gz+")) {
|
||||||
|
String dvm_start = String::DQuotes(dvm_drv) + " pa " + String::DQuotes(String(getId()) + "/sts.gz+") + " " + String::DQuotes(resultPath + "/statistic.txt");
|
||||||
|
system(dvm_start.getCharArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -177,6 +177,10 @@ public:
|
|||||||
set<T*> activeTaskSet;
|
set<T*> activeTaskSet;
|
||||||
bool ignoreCheck = true;
|
bool ignoreCheck = true;
|
||||||
|
|
||||||
|
String pathRes("results");
|
||||||
|
Utils::Mkdir(pathRes);
|
||||||
|
string buf;
|
||||||
|
|
||||||
while (activeTasks) {
|
while (activeTasks) {
|
||||||
long oldActiveTasks = activeTasks;
|
long oldActiveTasks = activeTasks;
|
||||||
vector<int> emptyKeys;
|
vector<int> emptyKeys;
|
||||||
@@ -223,6 +227,8 @@ public:
|
|||||||
busyKernels -= task->getKernels();
|
busyKernels -= task->getKernels();
|
||||||
printf(" done task with %d kernels and id %ld\n", task->getKernels(), task->getId());
|
printf(" done task with %d kernels and id %ld\n", task->getKernels(), task->getId());
|
||||||
|
|
||||||
|
buf += to_string(task->getId()) + " " + string(task->printState().getCharArray()) + " " + to_string(task->getTotalTime()) + "\n";
|
||||||
|
task->copyResults(pathRes);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
it++;
|
it++;
|
||||||
@@ -233,6 +239,11 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
changeState();
|
changeState();
|
||||||
|
|
||||||
|
String outFile(pathRes + "/info.txt");
|
||||||
|
File tmp(outFile, String(buf.c_str()));
|
||||||
|
|
||||||
|
Utils::ZipFolder(pathRes, pathRes + ".zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void Finalize() { }
|
virtual void Finalize() { }
|
||||||
@@ -241,6 +252,6 @@ public:
|
|||||||
Utils::Sleep(1); //чтобы не было одинаковых по дате файлов.
|
Utils::Sleep(1); //чтобы не было одинаковых по дате файлов.
|
||||||
String stateFile = packageWorkspace + "/state/" + getStatePrefix() + printState();
|
String stateFile = packageWorkspace + "/state/" + getStatePrefix() + printState();
|
||||||
//printf("stateFile=<%s>\n", stateFile.getCharArray());
|
//printf("stateFile=<%s>\n", stateFile.getCharArray());
|
||||||
File(stateFile, Utils::getDate());
|
File tmp(stateFile, Utils::getDate());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -26,7 +26,8 @@ enum TaskState {
|
|||||||
Queued, //16
|
Queued, //16
|
||||||
NoSuchTask, //17
|
NoSuchTask, //17
|
||||||
FailedToQueue, //18
|
FailedToQueue, //18
|
||||||
AbortingByUser //19
|
AbortingByUser, //19
|
||||||
|
Unknown
|
||||||
};
|
};
|
||||||
|
|
||||||
enum TestType {
|
enum TestType {
|
||||||
@@ -42,8 +43,9 @@ protected:
|
|||||||
int maxtime;
|
int maxtime;
|
||||||
int kernels; //получение зависит от типа задачи.
|
int kernels; //получение зависит от типа задачи.
|
||||||
String workspace;
|
String workspace;
|
||||||
TaskState state;
|
TaskState state = Unknown;
|
||||||
std::chrono::system_clock::time_point start_time;
|
std::chrono::system_clock::time_point start_time;
|
||||||
|
double total_time;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
String printState() {
|
String printState() {
|
||||||
@@ -88,6 +90,8 @@ public:
|
|||||||
return String("FailedToQueue");
|
return String("FailedToQueue");
|
||||||
case AbortingByUser:
|
case AbortingByUser:
|
||||||
return String("AbortingByUser");
|
return String("AbortingByUser");
|
||||||
|
case Unknown:
|
||||||
|
return String("?");
|
||||||
default:
|
default:
|
||||||
return "?";
|
return "?";
|
||||||
}
|
}
|
||||||
@@ -95,6 +99,7 @@ public:
|
|||||||
|
|
||||||
//-------------->>
|
//-------------->>
|
||||||
void setStart() { start_time = std::chrono::system_clock::now(); }
|
void setStart() { start_time = std::chrono::system_clock::now(); }
|
||||||
|
double getTotalTime() const { return total_time; }
|
||||||
|
|
||||||
long getId() { return id; }
|
long getId() { return id; }
|
||||||
long setId(String* id_s) {
|
long setId(String* id_s) {
|
||||||
@@ -181,6 +186,10 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void analyseResults() {
|
virtual void analyseResults() {
|
||||||
|
auto end_time = std::chrono::system_clock::now();
|
||||||
|
std::chrono::duration<double> diff_time = end_time - start_time;
|
||||||
|
total_time = diff_time.count();
|
||||||
|
printf("%ld done with time %f\n", id, total_time);
|
||||||
state = Finished;
|
state = Finished;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,4 +197,6 @@ public:
|
|||||||
String stateFile = workspace + "/TaskState";
|
String stateFile = workspace + "/TaskState";
|
||||||
File tmp(stateFile, printState());
|
File tmp(stateFile, printState());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
virtual void copyResults(const String& path) { }
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user