Compare commits
12 Commits
a70c93e66d
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fb726ef439 | ||
| f3b29d8d7e | |||
| 9dbf72ece2 | |||
| e6321cbdb6 | |||
| 8af5acbecd | |||
| bc24507487 | |||
|
|
a8b15d0eeb | ||
|
|
0e9404982f | ||
| 59060075e8 | |||
| d64f11e856 | |||
| b30f2b8eea | |||
|
|
96500475c0 |
10
.idea/workspace.xml
generated
10
.idea/workspace.xml
generated
@@ -7,17 +7,9 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/json/CompilationTask_json.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/json/DVMCompilationPackage_json.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/json/DVMPackage_json.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/json/DVMRunPackage_json.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/json/RunTask_json.java" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/json/Task_json.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/Constants.java" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/src/Common/Visual/Windows/Dialog/DialogWrapText.java" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/DVMPackage.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/DVMPackage/DVMPackage.java" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/RemoteDVMTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/_VisualDVM/TestingSystem/DVM/RemoteDVMTestingPlanner.java" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
|
|||||||
10
properties
10
properties
@@ -4,7 +4,7 @@
|
|||||||
"ServerUserPassword": "mprit_2011",
|
"ServerUserPassword": "mprit_2011",
|
||||||
"OfferRegistrationOnStart": true,
|
"OfferRegistrationOnStart": true,
|
||||||
"Workspace": "E:\\Tests",
|
"Workspace": "E:\\Tests",
|
||||||
"ProjectsSearchDirectory": "E:\\Tests\\Downloads\\1331\\EP\\v1\\v1\\v4",
|
"ProjectsSearchDirectory": "E:\\Tests",
|
||||||
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
|
"DocumentsDirectory": "C:\\Users\\misha\\Documents\\_testing_system",
|
||||||
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
"VisualiserPath": "C:\\Users\\misha\\Downloads",
|
||||||
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
"Sapfor_FPath": "E:\\_sapfor_x64\\Components\\Sapfor_F",
|
||||||
@@ -27,15 +27,15 @@
|
|||||||
"LocalMakePathWindows": "C:\\MinGW\\msys\\1.0\\bin\\make.exe",
|
"LocalMakePathWindows": "C:\\MinGW\\msys\\1.0\\bin\\make.exe",
|
||||||
"PrecompilationFlags": " ",
|
"PrecompilationFlags": " ",
|
||||||
"CheckTestingIntervalSeconds": 10,
|
"CheckTestingIntervalSeconds": 10,
|
||||||
"AutoCheckTesting": true,
|
"AutoCheckTesting": false,
|
||||||
"EmailOnTestingProgress": true,
|
"EmailOnTestingProgress": true,
|
||||||
"CompleteCompilationOptions": true,
|
"CompleteCompilationOptions": true,
|
||||||
"CompleteRunEnvironments": true,
|
"CompleteRunEnvironments": true,
|
||||||
"CreateEthalonTasks": true,
|
"CreateEthalonTasks": true,
|
||||||
"ErasePackageWorkspace": false,
|
"ErasePackageWorkspace": false,
|
||||||
"lastMachineId": 13,
|
"lastMachineId": 14,
|
||||||
"lastUserId": 24,
|
"lastUserId": 25,
|
||||||
"lastCompilerId": 52,
|
"lastCompilerId": 56,
|
||||||
"RegisterOn": false,
|
"RegisterOn": false,
|
||||||
"SpacesOn": false,
|
"SpacesOn": false,
|
||||||
"EmptyLinesOn": false,
|
"EmptyLinesOn": false,
|
||||||
|
|||||||
@@ -1,42 +0,0 @@
|
|||||||
package Common.Visual.Windows.Dialog;
|
|
||||||
import Common.MainModule_;
|
|
||||||
import Common.Visual.Fonts.VisualiserFonts;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
|
||||||
import java.awt.*;
|
|
||||||
public class DialogWrapText extends JTextPane implements DialogFields {
|
|
||||||
public DialogWrapText() {
|
|
||||||
setOpaque(true);
|
|
||||||
setBackground(Color.WHITE);
|
|
||||||
setFont(MainModule_.instance.getUI().getTheme().Fonts.get(VisualiserFonts.TreeBold));
|
|
||||||
setEditable(false);
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public Component getContent() {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
public void setTextW(String text_in){
|
|
||||||
String[] lines = text_in.split("\n");
|
|
||||||
String labelText = "";
|
|
||||||
if (lines.length == 1) {
|
|
||||||
labelText = text_in;
|
|
||||||
} else {
|
|
||||||
int i = 0;
|
|
||||||
for (String line : lines) {
|
|
||||||
String fline = "";
|
|
||||||
if (i == 0) {
|
|
||||||
fline = "<html><body>" + line + "<br>";
|
|
||||||
} else if (i == lines.length - 1) {
|
|
||||||
fline = line + "</body></html>";
|
|
||||||
} else {
|
|
||||||
fline = line + "<br>";
|
|
||||||
}
|
|
||||||
++i;
|
|
||||||
labelText += fline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
setText(labelText);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
|
||||||
@@ -13,7 +13,9 @@ public class Sapfor_F extends Sapfor {
|
|||||||
public String getAssemblyCommand() {
|
public String getAssemblyCommand() {
|
||||||
return "cd Repo/SAPFOR/install\n" +
|
return "cd Repo/SAPFOR/install\n" +
|
||||||
"cmake ../\n" +
|
"cmake ../\n" +
|
||||||
"make -j 4\n";
|
"make -j " +
|
||||||
|
Global.normalProperties.Kernels +
|
||||||
|
"\n";
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public File getAssemblyFile() {
|
public File getAssemblyFile() {
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import Common.Utils.Vector_;
|
|||||||
|
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
public class Constants {
|
public class Constants {
|
||||||
public static final int version = 1266;
|
public static final int version = 1267;
|
||||||
public static final int planner_version = 24;
|
public static final int planner_version = 27;
|
||||||
public static final int testingMaxKernels = 64;
|
public static final int testingMaxKernels = 64;
|
||||||
//--
|
//--
|
||||||
public static final String ApplicationFileName = "VisualSapfor.jar";
|
public static final String ApplicationFileName = "VisualSapfor.jar";
|
||||||
@@ -105,6 +105,7 @@ public class Constants {
|
|||||||
"starter.cpp",
|
"starter.cpp",
|
||||||
"launcher.cpp",
|
"launcher.cpp",
|
||||||
//--
|
//--
|
||||||
|
"json.hpp",
|
||||||
"Array.h",
|
"Array.h",
|
||||||
"CompilationSupervisor.h",
|
"CompilationSupervisor.h",
|
||||||
"CompilationTask.h",
|
"CompilationTask.h",
|
||||||
|
|||||||
@@ -36,12 +36,12 @@ public class DownloadRepositoryPass extends ProcessPass {
|
|||||||
if (pull) {
|
if (pull) {
|
||||||
System.out.println("PULL");
|
System.out.println("PULL");
|
||||||
scriptLines.add("cd " + dst.getAbsolutePath());
|
scriptLines.add("cd " + dst.getAbsolutePath());
|
||||||
scriptLines.add("git pull");
|
scriptLines.add("GIT_SSL_NO_VERIFY=true git pull");
|
||||||
} else {
|
} else {
|
||||||
Utils.CleanDirectory(dst);
|
Utils.CleanDirectory(dst);
|
||||||
System.out.println("CLONE");
|
System.out.println("CLONE");
|
||||||
scriptLines.add("cd " + Utils_.DQuotes(Global.RepoDirectory.getAbsolutePath()));
|
scriptLines.add("cd " + Utils_.DQuotes(Global.RepoDirectory.getAbsolutePath()));
|
||||||
scriptLines.add("git clone " + Utils_.DQuotes(url) + " " + Utils_.DQuotes(dst.getAbsolutePath()));
|
scriptLines.add("GIT_SSL_NO_VERIFY=true git clone " + Utils_.DQuotes(url) + " " + Utils_.DQuotes(dst.getAbsolutePath()));
|
||||||
}
|
}
|
||||||
if (hasSubmodules()) {
|
if (hasSubmodules()) {
|
||||||
scriptLines.add("cd " + Utils_.DQuotes(dst));
|
scriptLines.add("cd " + Utils_.DQuotes(dst));
|
||||||
|
|||||||
@@ -19,13 +19,4 @@ public class DVMCompilationTask extends DVMTask {
|
|||||||
maxtime = configuration.c_maxtime;
|
maxtime = configuration.c_maxtime;
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
@Override
|
|
||||||
public Vector<String> pack(Object arg) {
|
|
||||||
Vector<String> res = new Vector<>();
|
|
||||||
res.add(String.valueOf(id)); //1
|
|
||||||
res.add(String.valueOf(maxtime)); //2
|
|
||||||
res.add(String.valueOf(test_id)); //3
|
|
||||||
res.add(arg.toString().replace("\n", "|")); //4
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,19 +90,6 @@ public class DVMRunTask extends DVMTask {
|
|||||||
args = rt.args;
|
args = rt.args;
|
||||||
}
|
}
|
||||||
//-
|
//-
|
||||||
@Override
|
|
||||||
public Vector<String> pack(Object arg) {
|
|
||||||
Vector<String> res = new Vector<>();
|
|
||||||
res.add(String.valueOf(id)); //1
|
|
||||||
res.add(String.valueOf(maxtime)); //2
|
|
||||||
res.add(String.valueOf(dvmcompilationtask_id)); //3
|
|
||||||
res.add(matrix); //4
|
|
||||||
res.add(environments); //5
|
|
||||||
res.add(usr_par.replace("\n", "|")); //6
|
|
||||||
res.add(args); //7
|
|
||||||
res.add(String.valueOf(kernels)); //8
|
|
||||||
return res;
|
|
||||||
}
|
|
||||||
public String getEnvironments() {
|
public String getEnvironments() {
|
||||||
return environments.replace("\n", ";");
|
return environments.replace("\n", ";");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,9 +83,6 @@ public class DVMTask extends iDBObject {
|
|||||||
"results",
|
"results",
|
||||||
String.valueOf(id)).toFile();
|
String.valueOf(id)).toFile();
|
||||||
}
|
}
|
||||||
public Vector<String> pack(Object arg) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
public String getResultFile(File resultFile) {
|
public String getResultFile(File resultFile) {
|
||||||
String res = "";
|
String res = "";
|
||||||
if (dvm_package_id == CommonConstants.Nan) res = "задача ещё не выполнялась";
|
if (dvm_package_id == CommonConstants.Nan) res = "задача ещё не выполнялась";
|
||||||
|
|||||||
@@ -79,25 +79,16 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
|
|||||||
DVMCompilationPackage_json compilationPackage_json = new DVMCompilationPackage_json();
|
DVMCompilationPackage_json compilationPackage_json = new DVMCompilationPackage_json();
|
||||||
DVMRunPackage_json runPackage_json = new DVMRunPackage_json();
|
DVMRunPackage_json runPackage_json = new DVMRunPackage_json();
|
||||||
//положить туда запакованные тексты задач.
|
//положить туда запакованные тексты задач.
|
||||||
Vector<String> compilationLines_OLD = new Vector<>(); //старые. выкинуть.
|
|
||||||
Vector<String> runLines_OLD = new Vector<>(); //старые, выкинуть.
|
|
||||||
for (DVMCompilationTask compilationTask : testingPackage.package_json.compilationTasks) {
|
for (DVMCompilationTask compilationTask : testingPackage.package_json.compilationTasks) {
|
||||||
String makefileText = generateMakefile(tests.get(compilationTask.test_id), compilationTask.language, testingPackage.drv, compilationTask.flags);
|
String makefileText = generateMakefile(tests.get(compilationTask.test_id), compilationTask.language, testingPackage.drv, compilationTask.flags);
|
||||||
compilationLines_OLD.addAll(compilationTask.pack(makefileText)); //old
|
|
||||||
//--
|
//--
|
||||||
compilationPackage_json.tasks.add(new CompilationTask_json(compilationTask, makefileText));
|
compilationPackage_json.tasks.add(new CompilationTask_json(compilationTask, makefileText));
|
||||||
//--
|
//--
|
||||||
for (DVMRunTask runTask : compilationTask.runTasks) {
|
for (DVMRunTask runTask : compilationTask.runTasks) {
|
||||||
runLines_OLD.addAll(runTask.pack(null)); //оld
|
|
||||||
//--
|
//--
|
||||||
runPackage_json.tasks.add(new RunTask_json(runTask));
|
runPackage_json.tasks.add(new RunTask_json(runTask));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//упразднить
|
|
||||||
RemoteFile compilationFile_old = new RemoteFile(packageRemoteWorkspace, "compilationTasks");
|
|
||||||
RemoteFile runPackage_old = new RemoteFile(packageRemoteWorkspace, "runTasks");
|
|
||||||
user.connection.writeToFile(String.join("\n", compilationLines_OLD) + "\n", compilationFile_old);
|
|
||||||
user.connection.writeToFile(String.join("\n", runLines_OLD) + "\n", runPackage_old);
|
|
||||||
//--
|
//--
|
||||||
RemoteFile compilationFile_json = new RemoteFile(packageRemoteWorkspace, "compilationTasks.json");
|
RemoteFile compilationFile_json = new RemoteFile(packageRemoteWorkspace, "compilationTasks.json");
|
||||||
RemoteFile runFile_json = new RemoteFile(packageRemoteWorkspace, "runTasks.json");
|
RemoteFile runFile_json = new RemoteFile(packageRemoteWorkspace, "runTasks.json");
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import _VisualDVM.TestingSystem.DVM.DVMTasks.DVMRunTask;
|
|||||||
import com.google.gson.annotations.Expose;
|
import com.google.gson.annotations.Expose;
|
||||||
public class RunTask_json extends Task_json {
|
public class RunTask_json extends Task_json {
|
||||||
@Expose
|
@Expose
|
||||||
public int kernels;
|
public int cores;
|
||||||
@Expose
|
@Expose
|
||||||
public int compilation_task_id;
|
public int compilation_task_id;
|
||||||
@Expose
|
@Expose
|
||||||
@@ -16,7 +16,7 @@ public class RunTask_json extends Task_json {
|
|||||||
public String usr_par; //- usr_par.replace("\n", "|") todo в планировщике убрать шифровку.
|
public String usr_par; //- usr_par.replace("\n", "|") todo в планировщике убрать шифровку.
|
||||||
public RunTask_json(DVMRunTask task){
|
public RunTask_json(DVMRunTask task){
|
||||||
super(task);
|
super(task);
|
||||||
kernels = task.kernels;
|
cores = task.kernels;
|
||||||
compilation_task_id = task.dvmcompilationtask_id;
|
compilation_task_id = task.dvmcompilationtask_id;
|
||||||
matrix = task.matrix;
|
matrix = task.matrix;
|
||||||
args = task.args;
|
args = task.args;
|
||||||
|
|||||||
@@ -23,11 +23,11 @@ public:
|
|||||||
elements.push_back(new_line);
|
elements.push_back(new_line);
|
||||||
}
|
}
|
||||||
|
|
||||||
long getLength() const {
|
int getLength() const {
|
||||||
return (long)elements.size();
|
return (int)elements.size();
|
||||||
}
|
}
|
||||||
|
|
||||||
T* get(long i) {
|
T* get(int i) {
|
||||||
return elements[i];
|
return elements[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,11 +6,11 @@
|
|||||||
class CompilationSupervisor : public Supervisor<CompilationTask> {
|
class CompilationSupervisor : public Supervisor<CompilationTask> {
|
||||||
public:
|
public:
|
||||||
CompilationSupervisor() {
|
CompilationSupervisor() {
|
||||||
this->init("compilationTasks", 4);
|
this->init("compilationTasks.json");
|
||||||
}
|
}
|
||||||
|
|
||||||
CompilationTask* getTaskById(long task_id) {
|
CompilationTask* getTaskById(int task_id) {
|
||||||
for (long i = 0; i < getLength(); ++i) {
|
for (int i = 0; i < getLength(); ++i) {
|
||||||
CompilationTask* task = get(i);
|
CompilationTask* task = get(i);
|
||||||
if (task->getId() == task_id)
|
if (task->getId() == task_id)
|
||||||
return task;
|
return task;
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
#include "Task.h"
|
#include "Task.h"
|
||||||
#include "Text.h"
|
#include "Text.h"
|
||||||
|
#include "json.hpp"
|
||||||
|
|
||||||
class CompilationTask : public Task {
|
class CompilationTask : public Task {
|
||||||
String test_id;
|
String test_name;
|
||||||
String makefile_text;
|
String makefile_text;
|
||||||
public:
|
public:
|
||||||
void setTestId(String* test_id_in) {
|
void setTestName(String* test_name_in) {
|
||||||
test_id = String(test_id_in->getCharArray());
|
test_name = String(test_name_in->getCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
void setMakefileText(String* makefile_text_in) {
|
void setMakefileText(String* makefile_text_in) {
|
||||||
@@ -16,22 +17,30 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
virtual void print() const {
|
virtual void print() const {
|
||||||
printf("id=%ld; maxtime=%d; test_id=%s\n", id, maxtime, test_id.getCharArray());
|
printf("id=%ld; maxtime=%d; test_name=%s\n", id, maxtime, test_name.getCharArray());
|
||||||
printf("makefile_text=%s\n", makefile_text.getCharArray());
|
printf("makefile_text=%s\n", makefile_text.getCharArray());
|
||||||
}
|
}
|
||||||
|
|
||||||
CompilationTask(Text* lines, int offset) :Task(lines, offset) {
|
CompilationTask(Text* lines, int offset) : Task(lines, offset) {
|
||||||
setTestId(lines->get(offset + 2));
|
setTestName(lines->get(offset + 2));
|
||||||
setMakefileText(lines->get(offset + 3));
|
setMakefileText(lines->get(offset + 3));
|
||||||
setState(Waiting);
|
setState(Waiting);
|
||||||
kernels = 1;
|
kernels = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CompilationTask(const nlohmann::json& data) : Task(data) {
|
||||||
|
test_name = Utils::getValue<string>(data, "test_name");
|
||||||
|
makefile_text = Utils::getValue<string>(data, "makefile_text");
|
||||||
|
|
||||||
|
setState(Waiting);
|
||||||
|
kernels = 1;
|
||||||
|
}
|
||||||
|
|
||||||
virtual void prepareWorkspace() {
|
virtual void prepareWorkspace() {
|
||||||
String makeFilePath = String(id) + "/Makefile";
|
String makeFilePath = String(id) + "/Makefile";
|
||||||
File makeFileFile = File(makeFilePath, this->makefile_text);
|
File makeFileFile = File(makeFilePath, this->makefile_text);
|
||||||
String tests = userWorkspace + "/projects";
|
String tests = userWorkspace + "/projects";
|
||||||
String testPath = tests + "/" + test_id;
|
String testPath = tests + "/" + test_name;
|
||||||
Utils::CopyDirectory_L(testPath, workspace);
|
Utils::CopyDirectory_L(testPath, workspace);
|
||||||
}
|
}
|
||||||
virtual String getLaunchScriptText() {
|
virtual String getLaunchScriptText() {
|
||||||
|
|||||||
@@ -6,9 +6,10 @@
|
|||||||
class RunSupervisor : public Supervisor<RunTask> {
|
class RunSupervisor : public Supervisor<RunTask> {
|
||||||
public:
|
public:
|
||||||
RunSupervisor(CompilationSupervisor* compilationSupervisor) {
|
RunSupervisor(CompilationSupervisor* compilationSupervisor) {
|
||||||
this->init("runTasks", 8);
|
this->init("runTasks.json");
|
||||||
|
|
||||||
//проверить отмененные задачи.
|
//проверить отмененные задачи.
|
||||||
for (long i = 0; i < getLength(); ++i) {
|
for (int i = 0; i < getLength(); ++i) {
|
||||||
RunTask* task = this->get(i);
|
RunTask* task = this->get(i);
|
||||||
CompilationTask* parent = compilationSupervisor->getTaskById(task->getTestCompilationTaskId());
|
CompilationTask* parent = compilationSupervisor->getTaskById(task->getTestCompilationTaskId());
|
||||||
task->setState((parent->getState() == Done) ? Waiting : Canceled);
|
task->setState((parent->getState() == Done) ? Waiting : Canceled);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "CompilationTask.h"
|
#include "CompilationTask.h"
|
||||||
|
|
||||||
class RunTask : public Task {
|
class RunTask : public Task {
|
||||||
long testcompilationtask_id;
|
int testcompilationtask_id;
|
||||||
String binary_name;
|
String binary_name;
|
||||||
String matrix;
|
String matrix;
|
||||||
String environments;
|
String environments;
|
||||||
@@ -23,34 +23,23 @@ public:
|
|||||||
kernels
|
kernels
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
int setKernels(String* kernels_s) {
|
|
||||||
return kernels = atoi(kernels_s->getCharArray());
|
void setKernels(String* kernels_s) { kernels = atoi(kernels_s->getCharArray()); }
|
||||||
}
|
void setTestCompilationTaskId(String* id_s) { testcompilationtask_id = strtol(id_s->getCharArray(), NULL, 10); }
|
||||||
long setTestCompilationTaskId(String* id_s) {
|
|
||||||
return testcompilationtask_id = strtol(id_s->getCharArray(), NULL, 10);
|
int getTestCompilationTaskId() { return testcompilationtask_id; }
|
||||||
}
|
|
||||||
long getTestCompilationTaskId() {
|
void setMatrix(String* matrix_in) { matrix = String(matrix_in->getCharArray()); }
|
||||||
return testcompilationtask_id;
|
void setEnvironments(String* environments_in) { environments = String(environments_in->getCharArray()); }
|
||||||
}
|
void setUsrPar(String* usr_par_in) { usr_par = String(usr_par_in->getCharArray(), '|'); }
|
||||||
void setMatrix(String* matrix_in) {
|
void setArgs(String* args_in) { args = String(args_in->getCharArray()); }
|
||||||
matrix = String(matrix_in->getCharArray());
|
void setParent(CompilationTask* parent_in) {
|
||||||
}
|
|
||||||
void setEnvironments(String* environments_in) {
|
|
||||||
environments = String(environments_in->getCharArray());
|
|
||||||
}
|
|
||||||
void setUsrPar(String* usr_par_in) {
|
|
||||||
usr_par = String(usr_par_in->getCharArray(), '|');
|
|
||||||
}
|
|
||||||
void setArgs(String* args_in) {
|
|
||||||
args = String(args_in->getCharArray());
|
|
||||||
}
|
|
||||||
void setParent(CompilationTask* parent_in) {
|
|
||||||
parent = parent_in;
|
parent = parent_in;
|
||||||
binary_name = "spf_" + packageId+"_"+String(id) + "_" + matrix.Replace(' ', '_');
|
binary_name = "spf_" + packageId+"_"+String(id) + "_" + matrix.Replace(' ', '_');
|
||||||
}
|
}
|
||||||
CompilationTask* getParent() {
|
|
||||||
return parent;
|
CompilationTask* getParent() { return parent; }
|
||||||
}
|
|
||||||
RunTask(Text* lines, int offset) :Task(lines, offset) {
|
RunTask(Text* lines, int offset) :Task(lines, offset) {
|
||||||
setTestCompilationTaskId(lines->get(offset + 2));
|
setTestCompilationTaskId(lines->get(offset + 2));
|
||||||
setMatrix(lines->get(offset + 3));
|
setMatrix(lines->get(offset + 3));
|
||||||
@@ -61,6 +50,16 @@ public:
|
|||||||
//todo setStartCommand
|
//todo setStartCommand
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RunTask(const nlohmann::json& data) : Task(data) {
|
||||||
|
testcompilationtask_id = Utils::getValue<int>(data, "compilation_task_id");
|
||||||
|
matrix = Utils::getValue<string>(data, "matrix");
|
||||||
|
environments = Utils::getValue<string>(data, "environments");
|
||||||
|
usr_par = Utils::getValue<string>(data, "usr_par");
|
||||||
|
args = Utils::getValue<string>(data, "args");
|
||||||
|
kernels = Utils::getValue<int>(data, "cores");
|
||||||
|
//todo setStartCommand
|
||||||
|
}
|
||||||
|
|
||||||
String getLaunchScriptText() override {
|
String getLaunchScriptText() override {
|
||||||
String modules = userWorkspace + "/modules";
|
String modules = userWorkspace + "/modules";
|
||||||
String starterCall = modules + "/starter";
|
String starterCall = modules + "/starter";
|
||||||
|
|||||||
@@ -16,13 +16,11 @@ public:
|
|||||||
|
|
||||||
String(const char* s, char ps) {
|
String(const char* s, char ps) {
|
||||||
body = s;
|
body = s;
|
||||||
for (long i = 0; i < getLength(); ++i)
|
for (int i = 0; i < getLength(); ++i)
|
||||||
body[i] = (s[i] == ps) ? '\n' : s[i];
|
body[i] = (s[i] == ps) ? '\n' : s[i];
|
||||||
}
|
}
|
||||||
|
|
||||||
String(int s) { body = to_string(s); }
|
String(int s) { body = to_string(s); }
|
||||||
String(long s) { body = to_string(s); }
|
|
||||||
String(long long s) { body = to_string(s); }
|
|
||||||
String (string s){ body = s;}
|
String (string s){ body = s;}
|
||||||
|
|
||||||
void println() const { printf("[%s]\n", body.c_str()); }
|
void println() const { printf("[%s]\n", body.c_str()); }
|
||||||
|
|||||||
@@ -4,18 +4,22 @@
|
|||||||
#include <set>
|
#include <set>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include <time.h>
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
|
#include <sys/time.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "Task.h"
|
#include "Task.h"
|
||||||
#include "Array.h"
|
#include "Array.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
|
#include "json.hpp"
|
||||||
#ifndef _WIN32
|
|
||||||
#include <sys/time.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
#include <time.h>
|
|
||||||
|
|
||||||
enum SupervisorState {
|
enum SupervisorState {
|
||||||
WorkspacesCreation, //0
|
WorkspacesCreation, //0
|
||||||
@@ -58,12 +62,13 @@ public:
|
|||||||
for (auto& elem : this->getElements())
|
for (auto& elem : this->getElements())
|
||||||
elem->print();
|
elem->print();
|
||||||
}
|
}
|
||||||
|
|
||||||
void init(const char* fileName, int recordSize) {
|
void init(const char* fileName, int recordSize) {
|
||||||
state = WorkspacesCreation;
|
state = WorkspacesCreation;
|
||||||
File* packedTasks = new File(fileName);
|
File* packedTasks = new File(fileName);
|
||||||
Text* lines = packedTasks->readLines();
|
Text* lines = packedTasks->readLines();
|
||||||
|
|
||||||
const long length = lines->getLength() / recordSize;
|
const int length = lines->getLength() / recordSize;
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
for (int i = 0; i < length; ++i) {
|
for (int i = 0; i < length; ++i) {
|
||||||
this->add(new T(lines, offset));
|
this->add(new T(lines, offset));
|
||||||
@@ -72,6 +77,31 @@ public:
|
|||||||
delete packedTasks;
|
delete packedTasks;
|
||||||
delete lines;
|
delete lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void init(const char* fileName) {
|
||||||
|
state = WorkspacesCreation;
|
||||||
|
|
||||||
|
std::ifstream file(fileName);
|
||||||
|
if (!file.is_open()) {
|
||||||
|
printf("can not open file %s\n", fileName);
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
nlohmann::json data = nlohmann::json::parse(file);
|
||||||
|
file.close();
|
||||||
|
|
||||||
|
if (data.contains("tasks")) {
|
||||||
|
auto tasks = data["tasks"];
|
||||||
|
int length = tasks.size();
|
||||||
|
for (size_t i = 0; i < tasks.size(); ++i)
|
||||||
|
this->add(new T(tasks[i]));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("can not fine object 'tasks'\n");
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void changeState() {
|
void changeState() {
|
||||||
switch (this->state) {
|
switch (this->state) {
|
||||||
case WorkspacesCreation:
|
case WorkspacesCreation:
|
||||||
@@ -170,7 +200,7 @@ public:
|
|||||||
killed = false;
|
killed = false;
|
||||||
|
|
||||||
while (activeTasks) {
|
while (activeTasks) {
|
||||||
long oldActiveTasks = activeTasks;
|
int oldActiveTasks = activeTasks;
|
||||||
emptyKeys.clear();
|
emptyKeys.clear();
|
||||||
toDel.clear();
|
toDel.clear();
|
||||||
|
|
||||||
@@ -279,7 +309,7 @@ public:
|
|||||||
void saveState() {
|
void saveState() {
|
||||||
saveState(getStatePrefix() + printState());
|
saveState(getStatePrefix() + printState());
|
||||||
}
|
}
|
||||||
void saveProgress(long long persentDone) {
|
void saveProgress(size_t persentDone) {
|
||||||
FILE* f = fopen("progress", "w");
|
FILE* f = fopen("progress", "w");
|
||||||
if (f) {
|
if (f) {
|
||||||
fprintf(f, "%lld", persentDone);
|
fprintf(f, "%lld", persentDone);
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "File.h"
|
#include "File.h"
|
||||||
#include "Utils.h"
|
#include "Utils.h"
|
||||||
@@ -38,7 +40,7 @@ enum TestType {
|
|||||||
|
|
||||||
class Task {
|
class Task {
|
||||||
protected:
|
protected:
|
||||||
long id;
|
int id;
|
||||||
|
|
||||||
int maxtime;
|
int maxtime;
|
||||||
int kernels; //получение зависит от типа задачи.
|
int kernels; //получение зависит от типа задачи.
|
||||||
@@ -101,22 +103,32 @@ 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; }
|
double getTotalTime() const { return total_time; }
|
||||||
|
|
||||||
long getId() { return id; }
|
int getId() { return id; }
|
||||||
long setId(String* id_s) {
|
int setId(String* id_s) {
|
||||||
return id = strtol(id_s->getCharArray(), NULL, 10);
|
return id = strtol(id_s->getCharArray(), NULL, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
int getMaxtime() { return maxtime; }
|
int getMaxtime() { return maxtime; }
|
||||||
int setMaxtime(String* maxtime_s) {
|
int setMaxtime(String* maxtime_s) { return maxtime = atoi(maxtime_s->getCharArray()); }
|
||||||
return maxtime = atoi(maxtime_s->getCharArray());
|
|
||||||
}
|
|
||||||
const String& getWorkspace() { return workspace; }
|
const String& getWorkspace() { return workspace; }
|
||||||
|
|
||||||
TaskState getState() { return state; }
|
TaskState getState() { return state; }
|
||||||
TaskState setState(TaskState state_in) { return state = state_in; }
|
TaskState setState(TaskState state_in) { return state = state_in; }
|
||||||
|
|
||||||
Task(Text* lines, int offset) {
|
Task(Text* lines, int offset) {
|
||||||
setId(lines->get(offset));
|
setId(lines->get(offset));
|
||||||
setMaxtime(lines->get(offset + 1));
|
setMaxtime(lines->get(offset + 1));
|
||||||
workspace = packageWorkspace + "/" + String(id);
|
workspace = packageWorkspace + "/" + String(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Task(const nlohmann::json& data) {
|
||||||
|
this->id = Utils::getValue<int>(data, "id");
|
||||||
|
this->maxtime = Utils::getValue<int>(data, "maxtime");
|
||||||
|
|
||||||
|
workspace = packageWorkspace + "/" + String(id);
|
||||||
|
}
|
||||||
|
|
||||||
virtual void print() const = 0;
|
virtual void print() const = 0;
|
||||||
//-
|
//-
|
||||||
virtual void prepareWorkspace() {}
|
virtual void prepareWorkspace() {}
|
||||||
@@ -216,5 +228,5 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//--
|
//--
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ public:
|
|||||||
printf("text length=%ld\n", this->getLength());
|
printf("text length=%ld\n", this->getLength());
|
||||||
|
|
||||||
auto elems = this->getElements();
|
auto elems = this->getElements();
|
||||||
for (long i = 0; i < elems.size(); ++i) {
|
for (int i = 0; i < elems.size(); ++i) {
|
||||||
printf("i=%ld; [%s]\n", i, elems[i]->getCharArray());
|
printf("i=%ld; [%s]\n", i, elems[i]->getCharArray());
|
||||||
// elements[i]->println();
|
// elements[i]->println();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
#include "json.hpp"
|
||||||
|
|
||||||
#if __cplusplus >= 201703L
|
#if __cplusplus >= 201703L
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
@@ -112,11 +113,24 @@ public:
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
static String getFileName(const String& path){
|
static String getFileName(const String& path){
|
||||||
int start_i = path.getBody().find_last_of('/');
|
int start_i = path.getBody().find_last_of('/');
|
||||||
if (start_i != string::npos){
|
if (start_i != string::npos){
|
||||||
return String(path.getBody().substr(start_i+1));
|
return String(path.getBody().substr(start_i+1));
|
||||||
}
|
}
|
||||||
return String();
|
return String();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
static T getValue(const nlohmann::json& data, const string& obj) {
|
||||||
|
T retval;
|
||||||
|
if (data.contains(obj))
|
||||||
|
retval = data[obj];
|
||||||
|
else {
|
||||||
|
printf("can not fine object '%s'\n", obj.c_str());
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
22874
src/files/json.hpp
Normal file
22874
src/files/json.hpp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -115,7 +115,7 @@ int main(int argc, char ** argv)
|
|||||||
("PATH="+PATH).println();
|
("PATH="+PATH).println();
|
||||||
("LD_LIBRARY_PATH="+LD_LIBRARY_PATH).println();
|
("LD_LIBRARY_PATH="+LD_LIBRARY_PATH).println();
|
||||||
//--
|
//--
|
||||||
packageId =Utils::getFileName(packageWorkspace);
|
packageId = Utils::getFileName(packageWorkspace);
|
||||||
#if __cplusplus >= 201703L
|
#if __cplusplus >= 201703L
|
||||||
std::filesystem::current_path(packageWorkspace.getCharArray());
|
std::filesystem::current_path(packageWorkspace.getCharArray());
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
24
|
27
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user