v++
Исправление зависания кнопки запуска сервера
This commit is contained in:
@@ -134,7 +134,8 @@ public class GroupsDBTable extends iDBTable<Group> {
|
||||
}
|
||||
public Group getGroupByDescription(LanguageName language_in,String description_in) {
|
||||
for (Group group : Data.values()) {
|
||||
if (group.language.equals(language_in)&&group.description.equalsIgnoreCase(description_in))
|
||||
if (group.sender_address.equals("vmk-post@yandex.ru")&&
|
||||
group.language.equals(language_in)&&group.description.equalsIgnoreCase(description_in))
|
||||
return group;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -102,7 +102,8 @@ public class TestDBTable extends iDBTable<Test> {
|
||||
}
|
||||
public Test getTestByDescription(int group_id_in, String description_in) {
|
||||
for (Test test : Data.values()) {
|
||||
if ((test.group_id==group_id_in)&&(test.description.equalsIgnoreCase(description_in)))
|
||||
if (test.sender_address.equals("vmk-post@yandex.ru")&&
|
||||
(test.group_id==group_id_in)&&(test.description.equalsIgnoreCase(description_in)))
|
||||
return test;
|
||||
}
|
||||
return null;
|
||||
|
||||
@@ -188,7 +188,7 @@ public class DVMTestingPlanner extends TestingPlanner<DVMPackage> {
|
||||
Utils.DQuotes(testingPackage.kernels),
|
||||
Utils.DQuotes(testingPackage.drv));
|
||||
|
||||
testingPackage.PID = user.connection.startProcess(packageRemoteWorkspace,
|
||||
testingPackage.PID = user.connection.startShellProcess(packageRemoteWorkspace,"PID",
|
||||
"ulimit -s unlimited", plannerStartCommand);
|
||||
System.out.println("PID="+Utils.Brackets(testingPackage.PID));
|
||||
RemoteFile STARTED = new RemoteFile(packageRemoteWorkspace, "STARTED");
|
||||
|
||||
@@ -2,7 +2,6 @@ package TestingSystem.DVM;
|
||||
import Common.Constants;
|
||||
import Common.Global;
|
||||
import Common.Utils.Utils;
|
||||
import Common.Utils.Validators.ShellParser;
|
||||
import GlobalData.Machine.Machine;
|
||||
import GlobalData.RemoteFile.RemoteFile;
|
||||
import GlobalData.User.User;
|
||||
@@ -16,6 +15,7 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Vector;
|
||||
public class UserConnection {
|
||||
//http://www.jcraft.com/jsch/
|
||||
public int iterations = 0; //для тестирования
|
||||
//--
|
||||
public ChannelSftp sftpChannel = null;
|
||||
@@ -402,14 +402,6 @@ public class UserConnection {
|
||||
execChannel.disconnect();
|
||||
}
|
||||
}
|
||||
public void performScriptNoWait(RemoteFile directory, String... commands) throws Exception {
|
||||
RemoteFile script_file = new RemoteFile(directory, Constants.script);
|
||||
if (Exists(script_file))
|
||||
sftpChannel.rm(script_file.full_name);
|
||||
//--
|
||||
writeToFile("cd " + Utils.DQuotes(directory.full_name) + "\n" + String.join("\n", commands), script_file);
|
||||
CommandNoWait(Utils.DQuotes(script_file.full_name));
|
||||
}
|
||||
//-----
|
||||
public void ShellConnect() throws Exception {
|
||||
shellChannel = (ChannelShell) session.openChannel("shell");
|
||||
@@ -474,20 +466,13 @@ public class UserConnection {
|
||||
shellChannel = null;
|
||||
System.gc();
|
||||
}
|
||||
public void ShellCommandNoWait(String command) throws Exception {
|
||||
ShellConnect();
|
||||
pin.write(("nohup " + command + " &\r\n").getBytes());
|
||||
ShellParser.ReadCommand(command, fromServer); //команда
|
||||
System.out.println("+++++++++++++++++");
|
||||
ShellParser.ReadCommand(command, fromServer); //эхо
|
||||
ShellDisconnect();
|
||||
}
|
||||
public String startProcess(RemoteFile directory, String... commands) throws Exception {
|
||||
//возможно в дальнейшем обобщить чтобы вместо PID был файл вывода с задаваемым именем?
|
||||
public String startShellProcess(RemoteFile directory, String outFileName, String... commands) throws Exception {
|
||||
Vector<String> commands_ = new Vector<>();
|
||||
commands_.add("cd " + Utils.DQuotes(directory.full_name));
|
||||
for (int i = 0; i < commands.length; ++i) {
|
||||
if (i == commands.length - 1) {
|
||||
commands_.add(commands[i] + " 1>PID");
|
||||
commands_.add(commands[i] + " 1>"+Utils.DQuotes(outFileName));
|
||||
} else {
|
||||
commands_.add(commands[i]);
|
||||
}
|
||||
@@ -498,14 +483,14 @@ public class UserConnection {
|
||||
writeToFile(String.join("\n", commands_), script_file);
|
||||
String start_command = Utils.DQuotes(script_file.full_name);
|
||||
//--
|
||||
RemoteFile PID = new RemoteFile(directory, "PID");
|
||||
RemoteFile outFile = new RemoteFile(directory, outFileName);
|
||||
ShellConnect();
|
||||
pin.write(("nohup " + start_command + " &\r\n").getBytes());
|
||||
while (!Exists(PID)){
|
||||
System.out.println("PID NOT FOUND");
|
||||
while (!Exists(outFile)){
|
||||
System.out.println(outFileName +" NOT FOUND");
|
||||
Utils.sleep(1000);
|
||||
}
|
||||
ShellDisconnect();
|
||||
return readFromFile(PID).replace("\n","").replace("\r","");
|
||||
return readFromFile(outFile).replace("\n","").replace("\r","");
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user