доделал отображение прогресса и актуализацию активных пакетов. пришлось заменить признак изменения с состояния на дату изменения.

This commit is contained in:
2023-12-15 14:55:16 +03:00
parent 54bab7f83d
commit bdf0f7f4eb
7 changed files with 49 additions and 43 deletions

View File

@@ -79,6 +79,7 @@ public:
}
void DoWithSchedule(int maxKernels) {
saveState();
saveProgress(0);
// подготовка тестов
while (this->state != Execution) {
for (auto& task : this->getElements()) {
@@ -193,11 +194,7 @@ public:
#endif
if ((done % step) == 0) {
size_t persentDone = (done / total) * 100.0;
FILE *f = fopen("progress", "w");
if (f) {
fprintf(f, "%lld\n", persentDone);
fclose(f);
}
saveProgress(persentDone);
}
}
}
@@ -208,8 +205,14 @@ public:
File tmp(outFile, String(buf.c_str()));
}
void saveState() {
Utils::Sleep(1); //чтобы не было одинаковых по дате файлов.
String stateFile = packageWorkspace + "/state/" + getStatePrefix() + printState();
File tmp(stateFile, Utils::getDate());
}
void saveProgress(long long persentDone) {
FILE *f = fopen("progress", "w");
if (f) {
fprintf(f, "%lld", persentDone);
fclose(f);
}
}
};