fixed
This commit is contained in:
@@ -112,7 +112,6 @@ public:
|
||||
case Execution:
|
||||
if (task->getState() == WorkspaceReady) {
|
||||
activeCount++;
|
||||
task->start_time = Utils::getAbsoluteTime();
|
||||
task->Start();
|
||||
}
|
||||
else if (task->getState() == Running) {
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <chrono>
|
||||
|
||||
#include "File.h"
|
||||
#include "Utils.h"
|
||||
#include "Global.h"
|
||||
@@ -41,8 +43,9 @@ protected:
|
||||
int kernels; //получение зависит от типа задачи.
|
||||
String workspace;
|
||||
TaskState state;
|
||||
std::chrono::system_clock::time_point start_time;
|
||||
|
||||
public:
|
||||
long long start_time;
|
||||
String printState() {
|
||||
switch (state) {
|
||||
case Inactive:
|
||||
@@ -91,6 +94,8 @@ public:
|
||||
}
|
||||
|
||||
//-------------->>
|
||||
void setStart() { start_time = std::chrono::system_clock::now(); }
|
||||
|
||||
long getId() { return id; }
|
||||
long setId(String* id_s) {
|
||||
return id = strtol(id_s->getCharArray(), NULL, 10);
|
||||
@@ -129,9 +134,9 @@ public:
|
||||
|
||||
int getKernels() const { return kernels; }
|
||||
|
||||
virtual void Start(bool dontCheck = false) {
|
||||
|
||||
void Start(bool dontCheck = false) {
|
||||
if (kernels <= freeKernels || dontCheck) {
|
||||
setStart();
|
||||
system(getStartCommand().getCharArray());
|
||||
state = Running;
|
||||
//-
|
||||
@@ -149,16 +154,21 @@ public:
|
||||
if (Utils::Exists(workspace + "/TIMEOUT")) {
|
||||
state = AbortedByTimeout;
|
||||
//todo определить по интервалу времени на всякий случай.
|
||||
}else if (Utils::Exists(workspace+"/INTERRUPT")){
|
||||
}
|
||||
else if (Utils::Exists(workspace + "/INTERRUPT")) {
|
||||
state = AbortedByUser;
|
||||
} else {
|
||||
long long now = Utils::getAbsoluteTime();
|
||||
long long delta = now-start_time;
|
||||
if (maxtime<delta){
|
||||
}
|
||||
else {
|
||||
auto end_time = std::chrono::system_clock::now();
|
||||
std::chrono::duration<double> diff_time = end_time - start_time;
|
||||
|
||||
if (maxtime * 1.1 < diff_time.count()) {
|
||||
printf("SET STATUS ABORTED by timer to %ld with time %f sec / %f sec", id, diff_time.count(), maxtime * 1.1);
|
||||
state = AbortedByTimeout;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state != Running) {
|
||||
//-
|
||||
busyKernels = Utils::min(busyKernels - kernels, maxKernels);
|
||||
|
||||
Reference in New Issue
Block a user