no message
This commit is contained in:
11
.idea/workspace.xml
generated
11
.idea/workspace.xml
generated
@@ -7,17 +7,18 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/Repository/RepositoryClient.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTestingChecker.java" afterDir="false" />
|
||||
<change afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/LocalMachineQueueSupervisor.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/GlobalProperties.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/GlobalProperties.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/Global.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Global.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Common/Utils/Utils.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Utils/Utils.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcess.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcess.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcessSet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/MachineProcess/MachineProcessSet.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Repository/Server/ServerCode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ServerCode.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingPlanner.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/DVMTestingPlanner.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/DVM/MachineQueueSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/DVM/MachineQueueSupervisor.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTestingPlanner.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Pass_2021.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Pass_2021.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -140,6 +140,7 @@ public class Global {
|
||||
Utils.CheckDirectory(DVMPackagesDirectory = Paths.get(Home, DVMPackages).toFile());
|
||||
Utils.CheckDirectory(SapforsDirectory = Paths.get(Home, "Sapfors").toFile());
|
||||
Utils.CheckDirectory(SapforPackagesDirectory = Paths.get(Home, "SapforPackages").toFile());
|
||||
//CheclAndClean через неделю
|
||||
Utils.CheckDirectory(MachinesDirectory = Paths.get(Home, "Machines").toFile());
|
||||
}
|
||||
public static void CreateLogAtComponentsPath() {
|
||||
|
||||
@@ -715,12 +715,6 @@ public class Utils {
|
||||
public static Process startScript(File scriptDirectory, File targetDirectory, String name, String scriptText, Map<String, String> envs) throws Exception {
|
||||
//->
|
||||
File scriptFile = createScript(scriptDirectory, targetDirectory, name, scriptText);
|
||||
/*
|
||||
File scriptFile=Paths.get(scriptDirectory.getAbsolutePath(), name + (Global.isWindows ? ".bat" : "")).toFile();
|
||||
FileUtils.write(scriptFile, "cd " + Utils.DQuotes(targetDirectory.getAbsolutePath()) + "\n" + scriptText);
|
||||
if (!scriptFile.setExecutable(true)) throw new PassException("Не удалось создать исполняемый файл для скрипта");
|
||||
*/
|
||||
//->>
|
||||
ProcessBuilder procBuilder = new ProcessBuilder(scriptFile.getAbsolutePath());
|
||||
procBuilder.directory(scriptDirectory);
|
||||
procBuilder.redirectErrorStream(true);
|
||||
|
||||
75
src/Repository/RepositoryClient.java
Normal file
75
src/Repository/RepositoryClient.java
Normal file
@@ -0,0 +1,75 @@
|
||||
package Repository;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public abstract class RepositoryClient {
|
||||
//--
|
||||
protected int getSleepMillis() {
|
||||
return 2000;
|
||||
}
|
||||
//---
|
||||
protected boolean isPrintOn() {
|
||||
return true;
|
||||
}
|
||||
protected void Print(String message) {
|
||||
try {
|
||||
if (isPrintOn()) {
|
||||
FileWriter testLog = new FileWriter(getClass().getSimpleName() + "_Log.txt", true);
|
||||
String dmessage = Utils.Brackets(new Date()) + " " + message;
|
||||
System.out.println(dmessage);
|
||||
testLog.write(dmessage + "\n");
|
||||
testLog.close();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
//--
|
||||
protected Object ServerCommand(ServerCode code_in, String arg, Serializable object_in) throws Exception {
|
||||
System.out.println("Команда серверу " + code_in.toString() + "arg=" + arg + " object=" + object_in);
|
||||
TestingSystemPass<Object> pass = new TestingSystemPass<Object>() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(code_in, arg, object_in));
|
||||
target = response.object;
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return Log.isEmpty();
|
||||
}
|
||||
};
|
||||
if (!pass.Do())
|
||||
ServerConnectionError(code_in, pass.Log.toString());
|
||||
return pass.target;
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in, Serializable object_in) throws Exception {
|
||||
return ServerCommand(code_in, "", object_in);
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in) throws Exception {
|
||||
return ServerCommand(code_in, "", null);
|
||||
}
|
||||
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
|
||||
throw new PassException("Ошибка взаимодействия с сервером " + code_in);
|
||||
}
|
||||
public abstract void perform() throws Exception;
|
||||
public void Perform(){
|
||||
try {
|
||||
perform();
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
Utils.sleep(getSleepMillis());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -84,6 +84,7 @@ public enum ServerCode {
|
||||
GetFirstsActiveDVMPackages,
|
||||
Ping,
|
||||
GetFirstActiveDVMPackageForMachineURL,
|
||||
GetServerName
|
||||
GetServerName,
|
||||
StartNecessaryMachines
|
||||
;
|
||||
}
|
||||
|
||||
@@ -3,67 +3,16 @@ import Common.Constants;
|
||||
import Common.Utils.Utils;
|
||||
import Repository.EmailMessage;
|
||||
import Repository.Server.ServerCode;
|
||||
import Repository.Server.ServerExchangeUnit_2021;
|
||||
import TestingSystem.Common.TestingPackage.TestingPackage;
|
||||
import TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
||||
import Repository.RepositoryClient;
|
||||
import Visual_DVM_2021.Passes.PassException;
|
||||
import Visual_DVM_2021.Passes.Server.TestingSystemPass;
|
||||
import javafx.util.Pair;
|
||||
|
||||
import java.io.FileWriter;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public abstract class TestingPlanner<P extends TestingPackage> {
|
||||
public abstract class TestingPlanner<P extends TestingPackage> extends RepositoryClient {
|
||||
protected P testingPackage;
|
||||
protected int getSleepMillis() {
|
||||
return 2000;
|
||||
}
|
||||
//---
|
||||
protected Object ServerCommand(ServerCode code_in, String arg, Serializable object_in) throws Exception {
|
||||
System.out.println("Команда серверу " + code_in.toString() + "arg=" + arg + " object=" + object_in);
|
||||
TestingSystemPass<Object> pass = new TestingSystemPass<Object>() {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "";
|
||||
}
|
||||
@Override
|
||||
protected void ServerAction() throws Exception {
|
||||
Command(new ServerExchangeUnit_2021(code_in, arg, object_in));
|
||||
target = response.object;
|
||||
}
|
||||
@Override
|
||||
protected boolean validate() {
|
||||
return Log.isEmpty();
|
||||
}
|
||||
};
|
||||
if (!pass.Do())
|
||||
ServerConnectionError(code_in, pass.Log.toString());
|
||||
return pass.target;
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in, Serializable object_in) throws Exception {
|
||||
return ServerCommand(code_in, "", object_in);
|
||||
}
|
||||
protected Object ServerCommand(ServerCode code_in) throws Exception {
|
||||
return ServerCommand(code_in, "", null);
|
||||
}
|
||||
//---
|
||||
protected boolean isPrintOn() {
|
||||
return true;
|
||||
}
|
||||
protected void Print(String message) {
|
||||
try {
|
||||
if (isPrintOn()) {
|
||||
FileWriter testLog = new FileWriter(getClass().getSimpleName() + "_Log.txt", true);
|
||||
String dmessage = Utils.Brackets(new Date()) + " " + message;
|
||||
System.out.println(dmessage);
|
||||
testLog.write(dmessage + "\n");
|
||||
testLog.close();
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
//---
|
||||
void UpdatePackageState(TasksPackageState state_in) throws Exception {
|
||||
testingPackage.state = state_in;
|
||||
@@ -111,9 +60,6 @@ public abstract class TestingPlanner<P extends TestingPackage> {
|
||||
}
|
||||
protected void MachineConnectionError() {
|
||||
}
|
||||
protected void ServerConnectionError(ServerCode code_in, String logText) throws Exception {
|
||||
throw new PassException("Ошибка взаимодействия с сервером " + code_in);
|
||||
}
|
||||
// ---
|
||||
protected void PerformPackage(TestingPackage package_in) throws Exception {
|
||||
testingPackage = (P) package_in;
|
||||
@@ -187,17 +133,11 @@ public abstract class TestingPlanner<P extends TestingPackage> {
|
||||
System.gc();
|
||||
//--
|
||||
}
|
||||
public void Perform() {
|
||||
try {
|
||||
testingPackage = null;
|
||||
Vector<P> activePackages = (Vector<P>) ServerCommand(getActivePackagesCode());
|
||||
// System.out.println(this.getClass().getSimpleName()+": found "+activePackages.size()+" active packages"); //Тесты:
|
||||
for (P activePackage : activePackages)
|
||||
PerformPackage(activePackage);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
} finally {
|
||||
Utils.sleep(getSleepMillis());
|
||||
}
|
||||
@Override
|
||||
public void perform() throws Exception {
|
||||
testingPackage = null;
|
||||
Vector<P> activePackages = (Vector<P>) ServerCommand(getActivePackagesCode());
|
||||
for (P activePackage : activePackages)
|
||||
PerformPackage(activePackage);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ import TestingSystem.Common.Test.TestType;
|
||||
import TestingSystem.Common.TestingPackageToKill.TestingPackageToKill;
|
||||
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
import TestingSystem.DVM.DVMPackage.DVMPackage_json;
|
||||
import TestingSystem.DVM.DVMTestingChecker;
|
||||
import TestingSystem.SAPFOR.Json.SapforPackage_json;
|
||||
import TestingSystem.SAPFOR.SapforConfiguration.SapforConfiguration;
|
||||
import TestingSystem.SAPFOR.SapforConfigurationCommand.SapforConfigurationCommand;
|
||||
@@ -118,55 +119,13 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
protected void startAdditionalThreads() {
|
||||
testingThread.start();
|
||||
}
|
||||
protected SapforTestingPlanner sapforTestingPlanner = new SapforTestingPlanner();
|
||||
//--
|
||||
void startNecessaryMachines() {
|
||||
//todo. когда БД машин будет перенесена только на сервер. просто идти по всем машинам.
|
||||
System.out.println("Проверка процессов машин...");
|
||||
try {
|
||||
Vector<String> aborted = new Vector<>();
|
||||
for (MachineProcess process : db.machinesProcesses.Data.values()) {
|
||||
if (process.isAborted()) {
|
||||
aborted.add(process.id);
|
||||
}
|
||||
}
|
||||
//---
|
||||
for (String key : aborted) {
|
||||
System.out.println(key + " остановлен");
|
||||
db.machinesProcesses.Data.remove(key);
|
||||
}
|
||||
//---
|
||||
System.out.println(db.machinesProcesses.size() + " активных процессов");
|
||||
//--
|
||||
LinkedHashMap<String, MachineProcess> processes_to_start = new LinkedHashMap<>();
|
||||
//1. Получить список всех пакетов, которые активны, и взять из них машины.
|
||||
for (DVMPackage dvmPackage : db.dvmPackages.Data.values()) {
|
||||
if (dvmPackage.state.isActive()) {
|
||||
//-
|
||||
if (!db.machinesProcesses.hasProcessForPackage(dvmPackage)) {
|
||||
MachineProcess new_process = new MachineProcess(dvmPackage);
|
||||
processes_to_start.put(new_process.getUniqueKey(), new_process);
|
||||
}
|
||||
}
|
||||
}
|
||||
System.out.println("Ожидающие запуск процессы: " + processes_to_start.size());
|
||||
//запуск.
|
||||
for (MachineProcess process : processes_to_start.values()) {
|
||||
process.Start();
|
||||
if (Utils.checkFileCreation(process.getStartedFile())) {
|
||||
db.machinesProcesses.Data.put(process.id, process);
|
||||
System.out.println(process.getUniqueKey()+" запущен");
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
DVMTestingChecker dvmTestingChecker = new DVMTestingChecker();
|
||||
SapforTestingPlanner sapforTestingPlanner = new SapforTestingPlanner();
|
||||
//--
|
||||
protected Thread testingThread = new Thread(() -> {
|
||||
while (true) {
|
||||
// DVMTestingPlanner.Perform();
|
||||
startNecessaryMachines();
|
||||
dvmTestingChecker.Perform();
|
||||
sapforTestingPlanner.Perform();
|
||||
System.out.println("sleep...");
|
||||
Utils.sleep(5000);
|
||||
@@ -267,10 +226,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Print("Получить информацию о задачах пакетов DVM");
|
||||
GetDVMPackagesJson();
|
||||
break;
|
||||
case GetFirstsActiveDVMPackages:
|
||||
Print("Получить первые активные пакеты задач DVM на машинах");
|
||||
GetFirstActiveDVMPackagesByMachines();
|
||||
break;
|
||||
case GetFirstActiveDVMPackageForMachineURL:
|
||||
Print("Получить первый активный пакет задач DVM на машине с адресом");
|
||||
GetFirstActiveDVMPackageForMachineURL();
|
||||
@@ -279,6 +234,10 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
Print("Получить имя сервера");
|
||||
GetServerName();
|
||||
break;
|
||||
case StartNecessaryMachines:
|
||||
Print("Проверка процессов машин");
|
||||
StartNecessaryMachines();
|
||||
break;
|
||||
default:
|
||||
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
|
||||
}
|
||||
@@ -359,11 +318,6 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
for (Pair<Group, Vector<File>> p : groups)
|
||||
db.RefreshGroup(account, sapfor, p);
|
||||
}
|
||||
private void GetFirstActiveDVMPackagesByMachines() {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = new Vector<>();
|
||||
// db.getFirstActiveDVMPackagesCopies(); //ЗАГЛУШКА. ЗА ПАКЕТЫ ДВМ ОТВЕЧАЕТ ОТДЕЛЬНЫЙ ПРОЦЕСС НА КАЖДУЮ МАШИНУ
|
||||
}
|
||||
private void GetFirstActiveSapforPackages() throws Exception {
|
||||
response = new ServerExchangeUnit_2021(ServerCode.OK);
|
||||
response.object = db.getFirstActiveSapforPackagesCopies();
|
||||
@@ -632,5 +586,46 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
|
||||
response.object = db.getFirstActiveDVMPackageCopyForMachineURL(request.arg);
|
||||
}
|
||||
//-----
|
||||
void StartNecessaryMachines() {
|
||||
Print("Проверка процессов машин...");
|
||||
try {
|
||||
Vector<String> aborted = new Vector<>();
|
||||
for (MachineProcess process : db.machinesProcesses.Data.values()) {
|
||||
if (process.isAborted()) {
|
||||
aborted.add(process.id);
|
||||
}
|
||||
}
|
||||
//---
|
||||
for (String key : aborted) {
|
||||
Print(key + " остановлен");
|
||||
db.machinesProcesses.Data.remove(key);
|
||||
}
|
||||
//---
|
||||
Print(db.machinesProcesses.size() + " активных процессов");
|
||||
//--
|
||||
LinkedHashMap<String, MachineProcess> processes_to_start = new LinkedHashMap<>();
|
||||
//1. Получить список всех пакетов, которые активны, и взять из них машины.
|
||||
for (DVMPackage dvmPackage : db.dvmPackages.Data.values()) {
|
||||
if (dvmPackage.state.isActive()) {
|
||||
//-
|
||||
if (!db.machinesProcesses.hasProcessForPackage(dvmPackage)) {
|
||||
MachineProcess new_process = new MachineProcess(dvmPackage);
|
||||
processes_to_start.put(new_process.getUniqueKey(), new_process);
|
||||
}
|
||||
}
|
||||
}
|
||||
Print("Ожидающие запуск процессы: " + processes_to_start.size());
|
||||
//запуск.
|
||||
for (MachineProcess process : processes_to_start.values()) {
|
||||
process.Start();
|
||||
if (Utils.checkFileCreation(process.getStartedFile())) {
|
||||
db.machinesProcesses.Data.put(process.id, process);
|
||||
Print(process.getUniqueKey()+" запущен");
|
||||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
9
src/TestingSystem/DVM/DVMTestingChecker.java
Normal file
9
src/TestingSystem/DVM/DVMTestingChecker.java
Normal file
@@ -0,0 +1,9 @@
|
||||
package TestingSystem.DVM;
|
||||
import Repository.RepositoryClient;
|
||||
import Repository.Server.ServerCode;
|
||||
public class DVMTestingChecker extends RepositoryClient {
|
||||
@Override
|
||||
public void perform() throws Exception {
|
||||
ServerCommand(ServerCode.StartNecessaryMachines);
|
||||
}
|
||||
}
|
||||
41
src/TestingSystem/DVM/LocalMachineQueueSupervisor.java
Normal file
41
src/TestingSystem/DVM/LocalMachineQueueSupervisor.java
Normal file
@@ -0,0 +1,41 @@
|
||||
package TestingSystem.DVM;
|
||||
import Repository.Server.ServerCode;
|
||||
import TestingSystem.Common.TasksPackageState;
|
||||
import TestingSystem.Common.TestingPlanner;
|
||||
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
public class LocalMachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
@Override
|
||||
protected ServerCode getActivePackagesCode() {
|
||||
return ServerCode.GetFirstActiveDVMPackageForMachineURL;
|
||||
}
|
||||
@Override
|
||||
protected ServerCode getCheckIfNeedsKillCode() {
|
||||
return ServerCode.DVMPackageNeedsKill;
|
||||
}
|
||||
@Override
|
||||
protected TasksPackageState getStateAfterStart() {
|
||||
return TasksPackageState.CompilationWorkspacesCreation;
|
||||
}
|
||||
@Override
|
||||
protected void TestsSynchronize() throws Exception {
|
||||
}
|
||||
@Override
|
||||
protected void PackageWorkspaceCreation() throws Exception {
|
||||
}
|
||||
@Override
|
||||
protected void AnalyseResults() throws Exception {
|
||||
}
|
||||
@Override
|
||||
protected void PackageStart() throws Exception {
|
||||
}
|
||||
@Override
|
||||
protected boolean CheckNextState() throws Exception {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
protected void DownloadResults() throws Exception {
|
||||
}
|
||||
@Override
|
||||
protected void Kill() throws Exception {
|
||||
}
|
||||
}
|
||||
@@ -129,7 +129,7 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
protected void Print(String message) {
|
||||
try {
|
||||
if (isPrintOn()) {
|
||||
// System.out.println(message);
|
||||
// System.out.println(message);
|
||||
Global.Log.Print(message);
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
@@ -140,7 +140,7 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
Print(reason);
|
||||
File stateFile = new File(supervisorHome, Constants.ABORTED);
|
||||
try {
|
||||
FileUtils.writeStringToFile(stateFile,reason);
|
||||
FileUtils.writeStringToFile(stateFile, reason);
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
@@ -477,30 +477,20 @@ public class MachineQueueSupervisor extends TestingPlanner<DVMPackage> {
|
||||
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());
|
||||
public void perform() throws Exception {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ import org.apache.commons.io.FileUtils;
|
||||
import java.io.File;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Date;
|
||||
import java.util.Vector;
|
||||
public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
|
||||
File workspace;
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user