Доделаны процессы для разных машин
This commit is contained in:
@@ -19,15 +19,12 @@ public class MachineProcess extends DBObject {
|
||||
public String userWorkspace = "";
|
||||
public String testingSystemRoot = "";
|
||||
public String serverName = "";
|
||||
public MachineProcessState state = MachineProcessState.Inactive; //0 неактивен
|
||||
//--
|
||||
public MachineProcess() {
|
||||
}
|
||||
public MachineProcess(MachineProcess p) {
|
||||
SynchronizeFields(p);
|
||||
}
|
||||
public MachineProcess(DVMPackage p) {
|
||||
id = Utils.getDateName("machine_process");
|
||||
machineAddress = p.machine_address;
|
||||
machinePort = p.machine_port;
|
||||
userName = p.user_name;
|
||||
@@ -35,6 +32,7 @@ public class MachineProcess extends DBObject {
|
||||
userWorkspace = p.user_workspace;
|
||||
testingSystemRoot = Global.Home;
|
||||
serverName = Global.testingServer.name;
|
||||
id = Utils.getDateName(machineAddress+"_"+machinePort+"_"+userName);
|
||||
}
|
||||
@Override
|
||||
public Object getPK() {
|
||||
@@ -88,9 +86,8 @@ public class MachineProcess extends DBObject {
|
||||
File supervisor = new File(workspace, "VisualSapfor.jar");
|
||||
FileUtils.copyFile(src, supervisor);
|
||||
//создание настроек
|
||||
GlobalProperties properties = new GlobalProperties();
|
||||
GlobalProperties properties = new GlobalProperties(Global.properties);
|
||||
properties.Mode = Current.Mode.MachineQueue;
|
||||
properties.TestingServerPort = 7996;
|
||||
Utils.jsonToFile(properties, new File(workspace, "properties"));
|
||||
Vector<String> args = new Vector<>();
|
||||
args.add(Utils.DQuotes(machineAddress));
|
||||
@@ -103,7 +100,8 @@ public class MachineProcess extends DBObject {
|
||||
//--
|
||||
Utils.startScript(workspace, workspace,
|
||||
"start",
|
||||
"java -jar VisualSapfor.jar " + String.join(" ", args)+" ");
|
||||
"java -jar VisualSapfor.jar " +
|
||||
String.join(" ", args)+" 1>out.txt 2>err.txt");
|
||||
//---
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package TestingSystem.Common.MachineProcess;
|
||||
import Common.Database.DataSet;
|
||||
import TestingSystem.DVM.DVMPackage.DVMPackage;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
public class MachineProcessSet extends DataSet<String, MachineProcess> {
|
||||
@@ -12,4 +13,17 @@ public class MachineProcessSet extends DataSet<String, MachineProcess> {
|
||||
res.put(process.getUniqueKey(), process);
|
||||
return res;
|
||||
}
|
||||
public boolean hasProcessForPackage(DVMPackage package_in) {
|
||||
for (MachineProcess process : Data.values()) {
|
||||
if (
|
||||
process.machineAddress.equals(package_in.machine_address) &&
|
||||
process.machinePort == package_in.machine_port &&
|
||||
process.userName.equals(package_in.user_name) &&
|
||||
process.userWorkspace.equals(package_in.user_workspace)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user