planner_improve #1

Merged
M merged 10 commits from planner_improve into main 2023-12-03 16:20:11 +00:00
12 changed files with 765 additions and 744 deletions
Showing only changes of commit 6b7bde1471 - Show all commits

View File

@@ -1,7 +1,9 @@
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#pragma once
template <class T>
class Array {
protected:

View File

@@ -1,6 +1,8 @@
#pragma once
#include "Supervisor.h"
#include "CompilationTask.h"
#pragma once
class CompilationSupervisor : public Supervisor<CompilationTask> {
public:
CompilationSupervisor() {

View File

@@ -1,5 +1,8 @@
#include "Task.h"
#pragma once
#include "Task.h"
#include "Text.h"
class CompilationTask : public Task {
String test_id;
String makefile_text;

View File

@@ -1,5 +1,6 @@
#include "Text.h"
#pragma once
#include "Text.h"
class File {
FILE* ptr;
public:
@@ -40,7 +41,8 @@ public:
line->addChar((char)c);
break;
}
}else {
}
else {
switch (c) {
case '\r':
break;

View File

@@ -1,13 +1,10 @@
#pragma once
#include "String.h"
#pragma once
String userWorkspace;
#pragma once
String packageWorkspace;
#pragma once
int maxKernels;
#pragma once
int busyKernels;
#pragma once
int freeKernels;
#pragma once
String dvm_drv;

View File

@@ -1,6 +1,8 @@
#pragma once
#include "CompilationSupervisor.h"
#include "RunTask.h"
#pragma once
class RunSupervisor : public Supervisor<RunTask> {
public:
RunSupervisor(CompilationSupervisor* compilationSupervisor) {

View File

@@ -1,5 +1,7 @@
#include "CompilationTask.h"
#pragma once
#include "CompilationTask.h"
class RunTask : public Task {
long testcompilationtask_id;
String binary_name;

View File

@@ -1,8 +1,10 @@
#pragma once
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#pragma once
class String {
friend String operator+(const String& a, const String& b);
long length;
@@ -144,7 +146,8 @@ public:
if (k < s.length) {
if (body[i] == s.body[k]) {
k++;
}else {
}
else {
//обрыв поиска.
search_on = false;
k = 0;
@@ -155,7 +158,8 @@ public:
//printf("starts with %ld", start);
return true;
}
}else {
}
else {
if (body[i] == s.body[0]) {
k = 1;
start = i;
@@ -204,7 +208,6 @@ int main(void) {
return ( fclose(f) );
}
*/
};
String operator+(const String& a, const String& b) {

View File

@@ -1,8 +1,9 @@
#pragma once
#include <unistd.h>
#include "File.h"
#include "Task.h"
#include <unistd.h>
#pragma once
enum SupervisorState {
WorkspacesCreation, //0
Preparation, //1
@@ -10,7 +11,7 @@ enum SupervisorState {
Archivation, //3
End //4
};
#pragma once
template <class T>
class Supervisor : public Array <T> {
protected:
@@ -85,7 +86,8 @@ public:
if (task->getState() == WorkspaceReady) {
activeCount++;
task->Start();
}else if (task->getState()==Running){
}
else if (task->getState() == Running) {
activeCount++;
task->Check();
}

View File

@@ -1,8 +1,9 @@
#pragma once
#include "File.h"
#include "Utils.h"
#include "Global.h"
#pragma once
enum TaskState {
Inactive, //0
Waiting, //1
@@ -25,14 +26,13 @@ enum TaskState {
FailedToQueue, //18
AbortingByUser //19
};
#pragma once
enum TestType {
Default, //0
Correctness, //1
Performance, //2
};
#pragma once
class Task {
protected:
long id;
@@ -140,11 +140,13 @@ public:
virtual void Check() {
if (Utils::Exists(workspace + "/DONE")) {
analyseResults();
}else {
}
else {
if (Utils::Exists(workspace + "/TIMEOUT")) {
state = AbortedByTimeout;
//todo определить по интервалу времени на всякий случай.
}else if (Utils::Exists(workspace+"/INTERRUPT")){
}
else if (Utils::Exists(workspace + "/INTERRUPT")) {
state = AbortedByUser;
}
}

View File

@@ -1,6 +1,8 @@
#pragma once
#include "String.h"
#include "Array.h"
#pragma once
class Text : public Array<String> {
public:
void Print() {

View File

@@ -1,10 +1,12 @@
#pragma once
#include <sys/stat.h>
#include <sys/types.h>
#include <errno.h>
#include <unistd.h>
#include <time.h>
#include "String.h"
#pragma once
class Utils {
public:
static int max(int a, int b) {