Доделаны процессы для разных машин
This commit is contained in:
@@ -129,6 +129,7 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
protected void Print(String message) {
|
||||
try {
|
||||
if (isPrintOn()) {
|
||||
// System.out.println(message);
|
||||
Global.Log.Print(message);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -136,9 +137,10 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
}
|
||||
}
|
||||
void Finalize(String reason) {
|
||||
Print(reason);
|
||||
File stateFile = new File(supervisorHome, Constants.ABORTED);
|
||||
try {
|
||||
FileUtils.writeStringToFile(stateFile, reason);
|
||||
FileUtils.writeStringToFile(stateFile,reason);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@@ -457,14 +459,11 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
}
|
||||
@Override
|
||||
protected void MachineConnectionError() {
|
||||
System.out.println("MACHINE CONNECTION ERROR");
|
||||
Finalize("Количество безуспешных попыток соединения с машиной " + machine.getURL() +
|
||||
" превысило 10");
|
||||
Finalize("Количество безуспешных попыток соединения с машиной " + machine.getURL() + " превысило 10");
|
||||
}
|
||||
@Override
|
||||
protected void ServerConnectionError(ServerCode code_in) throws Exception {
|
||||
System.out.println("NO SERVER");
|
||||
Finalize("Не удалось выполнить команду " + code_in + " на сервере тестирования");
|
||||
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
|
||||
Finalize("Не удалось выполнить команду " + code_in + " на сервере тестирования\n" + logText);
|
||||
}
|
||||
@Override
|
||||
protected void Kill() throws Exception {
|
||||
@@ -473,28 +472,35 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void Perform() {
|
||||
try {
|
||||
String currentServerName = (String) ServerCommand(ServerCode.GetServerName);
|
||||
System.out.println("current serverName="+Utils.Brackets(currentServerName));
|
||||
System.out.println("serverName="+Utils.Brackets(serverName));
|
||||
if (!serverName.equals(currentServerName)){
|
||||
Finalize("Устаревшее имя сервера");
|
||||
}
|
||||
testingPackage = null;
|
||||
Vector<DVMPackage> activePackages = (Vector<DVMPackage>) ServerCommand(getActivePackagesCode(), machine.getURL(), null);
|
||||
// System.out.println(this.getClass().getSimpleName()+": found "+activePackages.size()+" active packages");
|
||||
for (DVMPackage activePackage : activePackages)
|
||||
PerformPackage(activePackage);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
Utils.sleep(getSleepMillis());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void InitSessionCredentials() {
|
||||
packageRemoteWorkspace = new RemoteFile(user.workspace + "/tests", String.valueOf(testingPackage.id), true);
|
||||
packageLocalWorkspace = new File(Global.DVMPackagesDirectory, String.valueOf(testingPackage.id));
|
||||
}
|
||||
@Override
|
||||
public void Perform() {
|
||||
try {
|
||||
Print("Проверка сервера...");
|
||||
String currentServerName = (String) ServerCommand(ServerCode.GetServerName);
|
||||
Print("имя текущего сервера " + Utils.Brackets(currentServerName));
|
||||
Print("имя сервера, создавшего нить " + Utils.Brackets(serverName));
|
||||
if (!serverName.equals(currentServerName)){
|
||||
Finalize("Несоответствующий сервер");
|
||||
}
|
||||
Print("Запрос активных пакетов для машины "+Utils.Brackets(machine.getURL()));
|
||||
testingPackage = null;
|
||||
Vector<DVMPackage> activePackages = (Vector<DVMPackage>) ServerCommand(getActivePackagesCode(), machine.getURL(), null);
|
||||
if (activePackages.isEmpty())
|
||||
Finalize("Не найдено активных пакетов для машины "+Utils.Brackets(machine.getURL()));
|
||||
for (DVMPackage activePackage : activePackages)
|
||||
PerformPackage(activePackage);
|
||||
|
||||
} catch (Exception ex) {
|
||||
Print("Exception occured");
|
||||
Print(ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
Print("sleep");
|
||||
Utils.sleep(getSleepMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user