no message

This commit is contained in:
2024-04-21 00:01:17 +03:00
parent 9bd90c7a4a
commit d7b559fd21
8 changed files with 82 additions and 37 deletions

View File

@@ -29,6 +29,7 @@ import java.nio.charset.Charset;
import java.nio.file.Paths;
import java.util.*;
public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
File supervisorHome = null;
Machine machine = null;
User user = null;
boolean local;
@@ -44,12 +45,12 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
String userPassword = args[3];
String userWorkspace = args[4];
String testingSystemRoot = args[5];
String supervisorHome = Global.Home; //при инициализации это текущая папка.
supervisorHome = new File(Global.Home); //при инициализации это текущая папка.
//---
Global.Log = new Loggable() {
@Override
public String getLogHomePath() {
return supervisorHome;
return supervisorHome.getAbsolutePath();
}
@Override
public String getLogName() {
@@ -114,6 +115,25 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
Print("Соединение c " + machine.getURL() + " " + user.login + " сброшено.");
}
}
@Override
protected void Print(String message) {
try {
if (isPrintOn()) {
Global.Log.Print(message);
}
} catch (Exception ex) {
ex.printStackTrace();
}
}
void Finalize(String reason){
File stateFile = new File(supervisorHome, Constants.ABORTED);
try {
FileUtils.writeStringToFile(stateFile, reason);
} catch (Exception ex) {
ex.printStackTrace();
}
System.exit(0);
}
//--
//Получить ид тестов и их папки на сервере.
LinkedHashMap<Integer, File> getTestsFromJson() {
@@ -365,7 +385,7 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
Print("PID not found");
Utils.sleep(1000);
}
testingPackage.PID = user.connection.readFromFile(PID).replace("\n","").replace("\r","");
testingPackage.PID = user.connection.readFromFile(PID).replace("\n", "").replace("\r", "");
//---
System.out.println("PID=" + Utils.Brackets(testingPackage.PID));
RemoteFile STARTED = new RemoteFile(packageRemoteWorkspace, "STARTED");
@@ -422,8 +442,17 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
unzipFolderPass.Do(results_archive.getAbsolutePath(), packageLocalWorkspace.getAbsolutePath(), false);
}
//---
// if (Global.properties.eraseTestingWorkspaces && user.connection.Exists(packageRemoteWorkspace))
// user.connection.RMDIR(packageRemoteWorkspace.full_name);
// if (Global.properties.eraseTestingWorkspaces && user.connection.Exists(packageRemoteWorkspace))
// user.connection.RMDIR(packageRemoteWorkspace.full_name);
}
@Override
protected void MachineConnectionError() {
Finalize("Количество безуспешных попыток соединения с машиной " +machine.getURL()+
" превысило 10");
}
@Override
protected void ServerConnectionError(ServerCode code_in) throws Exception {
Finalize("Не удалось выполнить команду " + code_in+ " на сервере тестирования");
}
@Override
protected void Kill() throws Exception {