++
добивание живых задач, отключение лишней рассылки админам, настройка удаления или не удаления пакета на машине
This commit is contained in:
@@ -69,10 +69,6 @@ public class UserAccountsDBTable extends iDBTable<UserAccount> {
|
||||
if ((account.subscribe_active != 0) && !res.contains(account.email))
|
||||
res.add(account.email);
|
||||
}
|
||||
for (String admin_mail : Constants.admins_mails) {
|
||||
if (!res.contains(admin_mail))
|
||||
res.add(admin_mail);
|
||||
}
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ import Common.Utils.Vector_;
|
||||
|
||||
import java.util.Vector;
|
||||
public class Constants {
|
||||
public static final int version = 1209;
|
||||
public static final int planner_version = 21;
|
||||
public static final int version = 1210;
|
||||
public static final int planner_version = 24;
|
||||
public static final int testingMaxKernels = 64;
|
||||
//--
|
||||
public static final String ApplicationFileName = "VisualSapfor.jar";
|
||||
|
||||
@@ -76,6 +76,8 @@ public class NormalProperties extends VisualDVMProperties {
|
||||
public boolean CompleteCompilationOptions = true;
|
||||
@Expose
|
||||
public boolean CompleteRunEnvironments = true;
|
||||
@Expose
|
||||
public boolean ErasePackageWorkspace = true;
|
||||
//--
|
||||
@Expose
|
||||
public int lastMachineId = CommonConstants.Nan;
|
||||
@@ -119,6 +121,8 @@ public class NormalProperties extends VisualDVMProperties {
|
||||
@Override
|
||||
public String getFieldDescription(String fieldName) {
|
||||
switch (fieldName) {
|
||||
case "ErasePackageWorkspace":
|
||||
return "Очистка рабочего пространства пакета на целевой машине";
|
||||
case "CompleteCompilationOptions":
|
||||
return "Дополнение опций компиляции";
|
||||
case "CompleteRunEnvironments":
|
||||
|
||||
@@ -73,7 +73,8 @@ public class StartSelectedDVMConfigurations extends PublishServerObject<TestingS
|
||||
user,
|
||||
compiler,
|
||||
configurations,
|
||||
Global.normalProperties.EmailOnTestingProgress ? 1 : 0
|
||||
Global.normalProperties.EmailOnTestingProgress ? 1 : 0,
|
||||
Global.normalProperties.ErasePackageWorkspace ? 1 : 0
|
||||
);
|
||||
//----
|
||||
if (target.tasksCount == 0) {
|
||||
|
||||
@@ -18,7 +18,6 @@ public abstract class TestingPackage<J> extends riDBObject {
|
||||
//--
|
||||
public int kernels = 1;
|
||||
public int needsEmail = 0;
|
||||
//---
|
||||
public String version = ""; //версия тестируемого объекта
|
||||
public String drv = ""; //пусть к исполняемому файлы тестируемого объекта
|
||||
//--
|
||||
|
||||
@@ -107,9 +107,8 @@ public abstract class TestingPlanner<P extends TestingPackage> extends TestingCl
|
||||
message.subject = "Состояние пакета тестирования " + packageDescription() + " " +
|
||||
Utils_.Brackets(testingPackage.id) + " изменилось на " + Utils_.Brackets(testingPackage.state.getDescription());
|
||||
message.text = testingPackage.description;
|
||||
Vector<String> recipients = new Vector<>(Constants.admins_mails);
|
||||
if (!recipients.contains(testingPackage.sender_address))
|
||||
recipients.add(testingPackage.sender_address);
|
||||
Vector<String> recipients = new Vector<>();
|
||||
recipients.add(testingPackage.sender_address);
|
||||
//--
|
||||
for (String address : recipients)
|
||||
ServerCommand(ServerCode.Email, address, message);
|
||||
|
||||
@@ -19,6 +19,7 @@ import _VisualDVM.TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMSettings.DVMSettings;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMTasks.DVMCompilationTask;
|
||||
import _VisualDVM.TestingSystem.DVM.DVMTasks.DVMRunTask;
|
||||
import com.sun.org.glassfish.gmbal.Description;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.io.File;
|
||||
@@ -32,6 +33,9 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
|
||||
public String user_name = "";
|
||||
public String user_workspace;
|
||||
//---
|
||||
@Description("DEFAULT 1")
|
||||
public int eraseWorkspace = 1; //удалять рабочее пространство пакета на целевой машине.(отключать для отладки)
|
||||
//---
|
||||
public DVMPackage() {
|
||||
}
|
||||
public DVMPackage(UserAccount account,
|
||||
@@ -39,7 +43,7 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
|
||||
User user,
|
||||
Compiler compiler,
|
||||
Vector<DVMConfiguration> configurations,
|
||||
int neeedsEmail_in) {
|
||||
int neeedsEmail_in, int eraseWorkspace_in) {
|
||||
id = CommonConstants.Nan;
|
||||
//-
|
||||
sender_name = account.name;
|
||||
@@ -56,6 +60,7 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
|
||||
version = compiler.getVersionInfo();
|
||||
//-
|
||||
needsEmail = neeedsEmail_in;
|
||||
eraseWorkspace = eraseWorkspace_in;
|
||||
//--
|
||||
state = TasksPackageState.Queued;
|
||||
//--
|
||||
@@ -158,6 +163,7 @@ public class DVMPackage extends TestingPackage<DVMPackage_json> {
|
||||
machine_port = tasksPackage.machine_port;
|
||||
user_name = tasksPackage.user_name;
|
||||
user_workspace = tasksPackage.user_workspace;
|
||||
eraseWorkspace = tasksPackage.eraseWorkspace;
|
||||
}
|
||||
public Machine getMachine() {
|
||||
return new Machine(machine_name, machine_address, machine_port, MachineType.Server);
|
||||
|
||||
@@ -269,7 +269,7 @@ public class RemoteDVMTestingPlanner extends DVMTestingPlanner {
|
||||
UpdatePackageState(TasksPackageState.Analysis);
|
||||
}
|
||||
//---
|
||||
if (user.connection.Exists(packageRemoteWorkspace))
|
||||
if (testingPackage.eraseWorkspace!=0 && user.connection.Exists(packageRemoteWorkspace))
|
||||
user.connection.RMDIR(packageRemoteWorkspace.full_name);
|
||||
}
|
||||
@Override
|
||||
|
||||
@@ -107,8 +107,9 @@ public class MainUI extends UIModule_ {
|
||||
getMainWindow().getCallbackWindow().showNoBugReports();
|
||||
Global.normalProperties.setControlVisible("AutoBugReportsLoad", false);
|
||||
Global.normalProperties.setControlVisible("AutoTestsLoad", false);
|
||||
Global.normalProperties.setControlVisible("AddDefaultsToCompilationOptions", false);
|
||||
Global.normalProperties.setControlVisible("AddDefaultsToRunEnvironments", false);
|
||||
Global.normalProperties.setControlVisible("CompleteCompilationOptions", false);
|
||||
Global.normalProperties.setControlVisible("CompleteRunEnvironments", false);
|
||||
Global.normalProperties.setControlVisible("ErasePackageWorkspace", false);
|
||||
Global.normalProperties.AutoCheckTesting = false;
|
||||
Global.normalProperties.Update();
|
||||
}
|
||||
@@ -120,8 +121,9 @@ public class MainUI extends UIModule_ {
|
||||
getMainWindow().getCallbackWindow().showMyOnlyBugReports();
|
||||
Global.normalProperties.setControlVisible("AutoBugReportsLoad", true);
|
||||
Global.normalProperties.setControlVisible("AutoTestsLoad", false);
|
||||
Global.normalProperties.setControlVisible("AddDefaultsToCompilationOptions", false);
|
||||
Global.normalProperties.setControlVisible("AddDefaultsToRunEnvironments", false);
|
||||
Global.normalProperties.setControlVisible("CompleteCompilationOptions", false);
|
||||
Global.normalProperties.setControlVisible("CompleteRunEnvironments", false);
|
||||
Global.normalProperties.setControlVisible("ErasePackageWorkspace", false);
|
||||
Global.normalProperties.AutoCheckTesting = false;
|
||||
Global.normalProperties.Update();
|
||||
}
|
||||
@@ -133,8 +135,9 @@ public class MainUI extends UIModule_ {
|
||||
getMainWindow().getCallbackWindow().showAllBugreports();
|
||||
Global.normalProperties.setControlVisible("AutoBugReportsLoad", true);
|
||||
Global.normalProperties.setControlVisible("AutoTestsLoad", true);
|
||||
Global.normalProperties.setControlVisible("AddDefaultsToCompilationOptions", true);
|
||||
Global.normalProperties.setControlVisible("AddDefaultsToRunEnvironments", true);
|
||||
Global.normalProperties.setControlVisible("CompleteCompilationOptions", true);
|
||||
Global.normalProperties.setControlVisible("CompleteRunEnvironments", true);
|
||||
Global.normalProperties.setControlVisible("ErasePackageWorkspace", true);
|
||||
}
|
||||
void showAdminRights() {
|
||||
Global.mainModule.SetAdminPassesAccess();
|
||||
@@ -143,10 +146,10 @@ public class MainUI extends UIModule_ {
|
||||
getMainWindow().getCallbackWindow().showAllBugReportsAdmin(); //метод избыточный. возможно.
|
||||
Global.normalProperties.setControlVisible("AutoBugReportsLoad", true);
|
||||
Global.normalProperties.setControlVisible("AutoTestsLoad", true);
|
||||
Global.normalProperties.setControlVisible("AddDefaultsToCompilationOptions", true);
|
||||
Global.normalProperties.setControlVisible("AddDefaultsToRunEnvironments", true);
|
||||
}
|
||||
;
|
||||
Global.normalProperties.setControlVisible("CompleteCompilationOptions", true);
|
||||
Global.normalProperties.setControlVisible("CompleteRunEnvironments", true);
|
||||
Global.normalProperties.setControlVisible("ErasePackageWorkspace", true);
|
||||
};
|
||||
public void ShowAccount() {
|
||||
getMainWindow().getCallbackWindow().ShowAccountInfo();
|
||||
switch (Global.mainModule.getAccount().role) {
|
||||
|
||||
@@ -6,7 +6,8 @@ public class TestingMenu extends PropertiesSubmenu {
|
||||
super("Тестирование", null,
|
||||
Global.normalProperties,
|
||||
"CompleteCompilationOptions",
|
||||
"CompleteRunEnvironments"
|
||||
"CompleteRunEnvironments",
|
||||
"ErasePackageWorkspace"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,21 @@ public:
|
||||
ptr = NULL;
|
||||
}
|
||||
}
|
||||
String read() {
|
||||
int c;
|
||||
String res;
|
||||
do {
|
||||
c = fgetc(ptr);
|
||||
switch (c){
|
||||
case EOF:
|
||||
break;
|
||||
default:
|
||||
res.addChar(c);
|
||||
break;
|
||||
}
|
||||
} while (c!=EOF);
|
||||
return res;
|
||||
}
|
||||
Text* readLines() {
|
||||
Text* lines = new Text();
|
||||
int c;
|
||||
|
||||
@@ -236,7 +236,11 @@ public:
|
||||
// прошло больше 10 секунд, проверяем нужно ли завершиться
|
||||
if (Utils::getAbsoluteTime() - timer_killed > 10) {
|
||||
if (checkKilled()) {
|
||||
ToLog("killed");
|
||||
ToLog("killing active tasks...");
|
||||
ToLog("activeTasks="+ String((int)activeTasks)+";busyKernels="+String((int)busyKernels));
|
||||
killActiveTasks(activeTaskSet);
|
||||
ToLog("done");
|
||||
ToLog("waiting for active tasks...");
|
||||
while (busyKernels) {
|
||||
ToLog("activeTasks="+ String((int)activeTasks)+";busyKernels="+String((int)busyKernels));
|
||||
checkTasksFinish(activeTaskSet, toDel, activeTasks, done, busyKernels, buf);
|
||||
@@ -246,7 +250,7 @@ public:
|
||||
toDel.clear();
|
||||
Utils::Sleep(5);
|
||||
}
|
||||
ToLog("exit for main while");
|
||||
ToLog("exit of main while");
|
||||
killed = true;
|
||||
break;
|
||||
}
|
||||
@@ -262,7 +266,7 @@ public:
|
||||
File tmp(outFile, String(buf.c_str()));
|
||||
}
|
||||
else {
|
||||
//всегда финальное состояние.
|
||||
//всегда финальное состояние. даже если это компиляция.
|
||||
saveState("RunningEnd");
|
||||
ToLog("quit application");
|
||||
std::exit(0);
|
||||
@@ -289,6 +293,11 @@ public:
|
||||
bool checkKilled() const {
|
||||
return Utils::Exists("kill");
|
||||
}
|
||||
void killActiveTasks(const set<T*>& activeTaskSet) {
|
||||
for (auto& task : activeTaskSet){
|
||||
task->kill();
|
||||
}
|
||||
}
|
||||
void checkTasksFinish(const set<T*>& activeTaskSet, vector<T*>& toDel, size_t& activeTasks,
|
||||
size_t& done, int& busyKernels, string& buf) {
|
||||
// проверяем нет ли завершившихся задач
|
||||
@@ -299,10 +308,7 @@ public:
|
||||
activeTasks--;
|
||||
done += task->getKernels();
|
||||
busyKernels -= task->getKernels();
|
||||
printf(" done task with %d kernels and id %ld\n", task->getKernels(), task->getId());
|
||||
buf += to_string(task->getId()) + " " + string(task->printState().getCharArray()) + " " + to_string(task->getTotalTime()) + "\n";
|
||||
//copy after end of while
|
||||
//task->copyResults(pathRes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -202,4 +202,19 @@ public:
|
||||
Utils::Copy(workspace + "/err.txt", resultPath + "/err.txt");
|
||||
return resultPath;
|
||||
}
|
||||
void kill(){
|
||||
//--
|
||||
String("killing task "+id).println();
|
||||
String pid_path(workspace+"/PID");
|
||||
if (Utils::Exists(pid_path)){
|
||||
File pid_file(&pid_path);
|
||||
String pid = pid_file.read();
|
||||
if (!pid.isEmpty()){
|
||||
String kill_command = "kill -2 "+ pid;
|
||||
kill_command.println();
|
||||
system(kill_command.getCharArray());
|
||||
}
|
||||
}
|
||||
//--
|
||||
}
|
||||
};
|
||||
|
||||
@@ -28,6 +28,11 @@ int main(int argc, char ** argv){
|
||||
int pid = fork();
|
||||
if (pid == 0)
|
||||
execvp( argv[1],args);
|
||||
else {
|
||||
FILE * pid_file = fopen("PID","w");
|
||||
fprintf(pid_file,"%d", pid);
|
||||
fclose(pid_file);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
catch (const char * exception){
|
||||
|
||||
@@ -1 +1 @@
|
||||
21
|
||||
24
|
||||
Reference in New Issue
Block a user