no message
This commit is contained in:
@@ -52,7 +52,7 @@ public class MachineProcess extends iDBObject {
|
||||
userWorkspace = p.userWorkspace;
|
||||
testingSystemRoot = p.testingSystemRoot;
|
||||
}
|
||||
public String getUniqueKey(){
|
||||
public String getUniqueKey() {
|
||||
Vector<String> res = new Vector<>();
|
||||
res.add(machineAddress);
|
||||
res.add(String.valueOf(machinePort));
|
||||
@@ -63,11 +63,22 @@ public class MachineProcess extends iDBObject {
|
||||
public File getWorkspace() {
|
||||
return new File(Global.MachinesDirectory, String.valueOf(id));
|
||||
}
|
||||
|
||||
public File getStartedFile() {
|
||||
return new File(getWorkspace(), Constants.STARTED);
|
||||
}
|
||||
public File getAbortedFile() {
|
||||
return new File(getWorkspace(), Constants.ABORTED);
|
||||
}
|
||||
//---
|
||||
public boolean isAborted() {
|
||||
File aborted = getAbortedFile();
|
||||
return aborted.exists();
|
||||
}
|
||||
public boolean isStarted() {
|
||||
File started = getStartedFile();
|
||||
return started.exists();
|
||||
}
|
||||
//--
|
||||
public void Start() {
|
||||
try {
|
||||
File workspace = getWorkspace();
|
||||
@@ -85,19 +96,15 @@ public class MachineProcess extends iDBObject {
|
||||
args.add(Utils.DQuotes(machinePort));
|
||||
args.add(Utils.DQuotes(userName));
|
||||
args.add(Utils.DQuotes(userPassword));
|
||||
args.add(Utils.DQuotes(userWorkspace));
|
||||
args.add(Utils.DQuotes(testingSystemRoot));
|
||||
//--
|
||||
//подготовка пакетного режима. Запустит его уже очередь.
|
||||
Utils.createScript(workspace, workspace,
|
||||
Utils.startScript(workspace, workspace,
|
||||
"start",
|
||||
"java -jar VisualSapfor.jar " + String.join(" ", args));
|
||||
//---
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
//---
|
||||
public boolean isAborted() {
|
||||
File aborted = getAbortedFile();
|
||||
return aborted.exists();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -163,23 +163,27 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Активные процессы: "+active_processes.size());
|
||||
for (String key : active_processes.keySet()){
|
||||
System.out.println("Активные процессы: " + active_processes.size());
|
||||
for (String key : active_processes.keySet()) {
|
||||
System.out.println(key);
|
||||
}
|
||||
System.out.println("-------------------");
|
||||
System.out.println("Ожидающие запуск процессы: "+processes_to_start.size());
|
||||
for (String key : processes_to_start.keySet()){
|
||||
System.out.println("Ожидающие запуск процессы: " + processes_to_start.size());
|
||||
for (String key : processes_to_start.keySet()) {
|
||||
System.out.println(key);
|
||||
}
|
||||
System.out.println("-------------------");
|
||||
//запуск.
|
||||
for (MachineProcess process: processes_to_start.values()){
|
||||
System.out.println("Запуск процесса "+process.getUniqueKey()+" ...");
|
||||
process.Start();
|
||||
process.state=MachineProcessState.Active;
|
||||
db.Insert(process);
|
||||
System.out.println("Выполнено");
|
||||
for (MachineProcess process : processes_to_start.values()) {
|
||||
System.out.println("Запуск процесса " + process.getUniqueKey() + " ...");
|
||||
process.Start();
|
||||
if (Utils.checkFileCreation(process.getStartedFile())) {
|
||||
process.state = MachineProcessState.Active;
|
||||
db.Insert(process);
|
||||
System.out.println("Выполнено");
|
||||
}else {
|
||||
System.out.println("Не удалось запустить процесс.");
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
@@ -76,6 +76,13 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
Print("local=" + local);
|
||||
Print("=====");
|
||||
//----
|
||||
File started = new File(supervisorHome, Constants.STARTED);
|
||||
try {
|
||||
FileUtils.writeStringToFile(started, "");
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
Finalize("Can not start");
|
||||
}
|
||||
}
|
||||
void CheckLocal() {
|
||||
local = false;
|
||||
@@ -125,7 +132,7 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
void Finalize(String reason){
|
||||
void Finalize(String reason) {
|
||||
File stateFile = new File(supervisorHome, Constants.ABORTED);
|
||||
try {
|
||||
FileUtils.writeStringToFile(stateFile, reason);
|
||||
@@ -447,12 +454,12 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
}
|
||||
@Override
|
||||
protected void MachineConnectionError() {
|
||||
Finalize("Количество безуспешных попыток соединения с машиной " +machine.getURL()+
|
||||
Finalize("Количество безуспешных попыток соединения с машиной " + machine.getURL() +
|
||||
" превысило 10");
|
||||
}
|
||||
@Override
|
||||
protected void ServerConnectionError(ServerCode code_in) throws Exception {
|
||||
Finalize("Не удалось выполнить команду " + code_in+ " на сервере тестирования");
|
||||
Finalize("Не удалось выполнить команду " + code_in + " на сервере тестирования");
|
||||
}
|
||||
@Override
|
||||
protected void Kill() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user