This commit is contained in:
2024-11-29 16:33:46 +03:00
parent 01957b9fb3
commit b76aa24ae4
11 changed files with 46 additions and 27 deletions

View File

@@ -46,8 +46,8 @@ public abstract class LinuxLocalTaskSupervisor<T extends Task> extends LocalTask
@Override
public void WaitForTask() throws Exception {
if (isTaskActive()) {
if (task.PID.isEmpty())
throw new PassException("Ошибка при старте : идентификатор задачи не определен.");
// if (task.PID.isEmpty())
// throw new PassException("Ошибка при старте : идентификатор задачи не определен.");
task.StartDate = (new Date()).getTime();
pass.ShowMessage1("Задача активна, идентификатор " + Utils_.Brackets(task.PID));
RefreshProgress();

View File

@@ -30,7 +30,7 @@ public class RemoteCompilationSupervisor extends RemoteTaskSupervisor<Compilatio
}
@Override
protected void StartTask() throws Exception {
task.PID = pass.user.connection.startShellProcess(getRemoteProject(), "PID", getStartCommand());
pass.user.connection.startShellProcess(getRemoteProject(), "PID", getStartCommand());
task.state = TaskState.Running;
}
@Override

View File

@@ -1,7 +1,9 @@
package _VisualDVM.GlobalData.Tasks.Supervisor.Remote;
import Common.CommonConstants;
import Common.Passes.PassException;
import Common.Utils.Utils_;
import _VisualDVM.Constants;
import _VisualDVM.Global;
import _VisualDVM.GlobalData.RemoteFile.RemoteFile;
import _VisualDVM.GlobalData.Tasks.Supervisor.TaskSupervisor;
import _VisualDVM.GlobalData.Tasks.Task;
@@ -61,6 +63,16 @@ public abstract class RemoteTaskSupervisor<T extends Task> extends TaskSuperviso
}
@Override
protected void AbortTask() throws Exception {
//1 прочитать пид
if (task.PID.isEmpty()) {
RemoteFile PID = getPID();
if (pass.user.connection.Exists(PID)) {
task.PID = pass.user.connection.readFromFile(PID).replace("\n", "").replace("\r", "");
Global.mainModule.getDb().Update(task);
} else {
throw new PassException("файл PID не найден");
}
}
pass.user.connection.Command("kill -2 " + task.PID);
}
@Override

View File

@@ -18,8 +18,8 @@ public class ServerRunSupervisor extends RemoteTaskSupervisor<RunTask> {
String env = String.join(" ", MainModule_.instance.getDb().getTable(RunConfiguration.class).getUI().getCurrent().getEnvList());
if (!env.isEmpty()) res = env + " " + res;
//--
task.PID = pass.user.connection.startShellProcess(getRemoteProject(), "PID",
"ulimit -s unlimited", res);
// task.PID =
pass.user.connection.startShellProcess(getRemoteProject(), "PID", res);
task.state = TaskState.Running;
}
@Override

View File

@@ -114,10 +114,10 @@ public abstract class TaskSupervisor<T extends Task, P extends Pass> {
}
public void WaitForTask() throws Exception {
if (isTaskActive()) {
if (task.PID.isEmpty())
throw new PassException("Ошибка при старте : идентификатор задачи не определен.");
// if (task.PID.isEmpty())
// throw new PassException("Ошибка при старте : идентификатор задачи не определен.");
task.StartDate = (new Date()).getTime();
pass.ShowMessage1("Задача активна, идентификатор " + Utils_.Brackets(task.PID));
pass.ShowMessage1("Задача активна");//, идентификатор " + Utils_.Brackets(task.PID));
RefreshProgress();
do {
Thread.sleep(getTaskCheckPeriod() * 1000);

View File

@@ -61,7 +61,7 @@ public class Visualiser extends Component {
//http://www.seostella.com/ru/article/2012/02/05/formatirovanie-daty-v-java.html
@Override
public void GetVersionInfo() {
version = 1124;
version = 1126;
String pattern = "MMM dd yyyy HH:mm:ss";
DateFormat df = new SimpleDateFormat(pattern, Locale.ENGLISH);
date_text = df.format(getClassBuildTime());

View File

@@ -17,6 +17,7 @@ public class DVMCompilationTask extends DVMTask {
//--
public DVMCompilationTask(DVMConfiguration configuration, DVMSettings dvmSettings, Group group, Test test, int kernels_in) {
super(configuration, group, test, checkFlags(dvmSettings.flags));
maxtime = configuration.c_maxtime;
Vector<String> matrixes = dvmSettings.getMatrixes(test.max_dim);
String checkedEnvironments = checkEnvironments(dvmSettings.environments);
if (dvmSettings.flags.trim().equalsIgnoreCase("-s")) {

View File

@@ -488,7 +488,7 @@ public class UserConnection {
Utils_.sleep(1000);
}
}
public String startShellProcess(RemoteFile directory, String outFileName, String... commands) throws Exception {
public void 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) {
@@ -507,12 +507,20 @@ public class UserConnection {
RemoteFile outFile = new RemoteFile(directory, outFileName);
if (Exists(outFile))
sftpChannel.rm(outFile.full_name);
System.out.println("connecting shell");
ShellConnect();
System.out.println("done");
System.out.println("sending start command...");
pin.write(("nohup " + start_command + " &\r\n").getBytes());
System.out.println("done");
System.out.println("waiting for out file creation...");
waitForFileCreation(outFile);
waitForFileFree(outFile);
System.out.println("done");
// waitForFileFree(outFile);
System.out.println("disconnecting...");
ShellDisconnect();
return readFromFile(outFile).replace("\n", "").replace("\r", "");
System.out.println("done");
// return readFromFile(outFile).replace("\n", "").replace("\r", "");
}
//-- проверка существования рабочего пространства.
public void CheckUserInitialization(String email) throws Exception {

View File

@@ -188,11 +188,11 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
}
}
Print("сравнение завершено");
testingPackage.description += "\nРазличий с эталоном: " + testingPackage.mismatchesCount;
log.Writeln_("Различий с эталоном: " + testingPackage.mismatchesCount);
return;
} else {
Print("сравнение с эталоном невозможно");
testingPackage.description += ("\nCравнение с эталоном невозможно:\n" + log.text);
log.Writeln_("Cравнение с эталоном невозможно");
}
}
}