2023-12-10 16:20:10 +03:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include "CompilationSupervisor.h"
|
|
|
|
|
#include "RunTask.h"
|
|
|
|
|
|
|
|
|
|
class RunSupervisor : public Supervisor<RunTask> {
|
|
|
|
|
public:
|
|
|
|
|
RunSupervisor(CompilationSupervisor* compilationSupervisor) {
|
|
|
|
|
this->init("runTasks", 8);
|
|
|
|
|
//проверить отмененные задачи.
|
|
|
|
|
for (long i = 0; i < getLength(); ++i) {
|
|
|
|
|
RunTask* task = this->get(i);
|
|
|
|
|
CompilationTask* parent = compilationSupervisor->getTaskById(task->getTestCompilationTaskId());
|
|
|
|
|
task->setState((parent->getState() == Done) ? Waiting : Canceled);
|
|
|
|
|
task->setParent(parent);
|
|
|
|
|
#if DEB
|
|
|
|
|
printf("id=%ld; parent_id = %ld; state=%s\n", task->getId(), task->getParent()->getId(), task->printState().getCharArray());
|
|
|
|
|
#endif
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String getStatePrefix() override {
|
|
|
|
|
return String("Running");
|
|
|
|
|
}
|
|
|
|
|
};
|