Запись информации о текущих задачах в лог.
This commit is contained in:
19
.idea/workspace.xml
generated
19
.idea/workspace.xml
generated
@@ -7,20 +7,13 @@
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
|
||||
<change afterPath="$PROJECT_DIR$/src/SapforTestingSystem/TaskThread.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/Constants.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/Constants.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Repository/Component/UI/PublishFields.form" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Component/UI/PublishFields.form" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Repository/Component/UI/PublishFields.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Component/UI/PublishFields.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Repository/RepositoryServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/RepositoryServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Repository/Server/ComponentsServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Server/ComponentsServer.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/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/TestingServer.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/InstallServerSapfor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/InstallServerSapfor.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishComponent.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/PublishComponent.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/SSH/ConnectionPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/SSH/ConnectionPass.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Interface/TestingWindow.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Interface/TestingWindow.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/MainForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/MainForm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/TestingForm.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/PackageModeSupervisor/PackageModeSupervisor.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/PackageModeSupervisor/PackageModeSupervisor.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/PerformSapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/PerformSapforTask.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTask/SapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/SapforTask/SapforTask.java" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/ThreadTask/ThreadTask.java" beforeDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/src/SapforTestingSystem/ThreadsPlanner/ThreadsPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/SapforTestingSystem/ThreadsPlanner/ThreadsPlanner.java" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
|
||||
@@ -6,8 +6,8 @@ import SapforTestingSystem.Json.SapforConfiguration_json;
|
||||
import SapforTestingSystem.Json.SapforTasksPackage_json;
|
||||
import SapforTestingSystem.Json.SapforTasksResults_json;
|
||||
import SapforTestingSystem.Json.SapforTest_json;
|
||||
import SapforTestingSystem.PerformSapforTask;
|
||||
import SapforTestingSystem.SapforTask.SapforTask;
|
||||
import SapforTestingSystem.TaskThread;
|
||||
import SapforTestingSystem.ThreadsPlanner.ThreadsPlanner;
|
||||
import Visual_DVM_2021.Passes.PassCode_2021;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
@@ -44,21 +44,17 @@ public class PackageModeSupervisor extends ThreadsPlanner {
|
||||
}
|
||||
task.codes = String.join(" ", codes_s);
|
||||
//---
|
||||
addThread(() -> {
|
||||
while (!task.state.isComplete()) {
|
||||
task.Reset();
|
||||
new PerformSapforTask().Do(
|
||||
sapfor_drv,
|
||||
sapforConfiguration_json,
|
||||
task
|
||||
);
|
||||
}
|
||||
});
|
||||
addThread(new TaskThread(task, sapfor_drv, sapforConfiguration_json));
|
||||
}
|
||||
}
|
||||
interruptThread.start();
|
||||
}
|
||||
@Override
|
||||
public String printThread(Integer id) {
|
||||
TaskThread taskThread = (TaskThread) threads.get(id);
|
||||
return taskThread.task.getSummary();
|
||||
}
|
||||
@Override
|
||||
protected void finalize() {
|
||||
results_json.EndDate = new Date().getTime();
|
||||
//записать результаты всех задач.
|
||||
|
||||
@@ -22,7 +22,8 @@ import static java.lang.Character.isDigit;
|
||||
public class PerformSapforTask extends Pass_2021<SapforTask> {
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return "Запуск задачи SAPFOR";
|
||||
return "";
|
||||
// "Запуск задачи SAPFOR"; Оставляем пустое описание чтобы не засорять журнал.
|
||||
}
|
||||
@Override
|
||||
protected boolean needsAnimation() {
|
||||
@@ -359,14 +360,4 @@ public class PerformSapforTask extends Pass_2021<SapforTask> {
|
||||
break;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
protected void performFinish() throws Exception {
|
||||
/*
|
||||
//теперь строим деревья версий. нельзя делать в body. так как могут быть исключения например неверный код процесса.
|
||||
for (SapforVersion_json version : target.versions)
|
||||
createVersionProjectData(version, true);
|
||||
for (SapforVersion_json version : target.variants)
|
||||
createVersionProjectData(version, false);
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,6 +58,14 @@ public class SapforTask extends DBObject {
|
||||
public String getUniqueKey() {
|
||||
return sapfor_configuration_id + "_" + group_description + "_" + test_description;
|
||||
}
|
||||
public String getSummary() {
|
||||
Vector<String> lines = new Vector<>();
|
||||
lines.add(group_description);
|
||||
lines.add(test_description);
|
||||
lines.add(codes);
|
||||
lines.add(flags);
|
||||
return String.join(" ", lines);
|
||||
}
|
||||
//-----------
|
||||
public SapforTask() {
|
||||
}
|
||||
|
||||
21
src/SapforTestingSystem/TaskThread.java
Normal file
21
src/SapforTestingSystem/TaskThread.java
Normal file
@@ -0,0 +1,21 @@
|
||||
package SapforTestingSystem;
|
||||
import SapforTestingSystem.Json.SapforConfiguration_json;
|
||||
import SapforTestingSystem.SapforTask.SapforTask;
|
||||
|
||||
import java.io.File;
|
||||
public class TaskThread extends Thread {
|
||||
public SapforTask task = null;
|
||||
public TaskThread(SapforTask task_, File sapfor_drv, SapforConfiguration_json sapforConfiguration_json) {
|
||||
super(() -> {
|
||||
while (!task_.state.isComplete()) {
|
||||
task_.Reset();
|
||||
new PerformSapforTask().Do(
|
||||
sapfor_drv,
|
||||
sapforConfiguration_json,
|
||||
task_
|
||||
);
|
||||
}
|
||||
});
|
||||
task = task_;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +0,0 @@
|
||||
package SapforTestingSystem.ThreadTask;
|
||||
import Common.Constants;
|
||||
public class ThreadTask {
|
||||
public int id = Constants.Nan;
|
||||
public Thread thread;
|
||||
public ThreadTask(int id_in, Runnable runnable){
|
||||
id = id_in;
|
||||
thread = new Thread(runnable);
|
||||
}
|
||||
}
|
||||
@@ -31,13 +31,27 @@ public abstract class ThreadsPlanner {
|
||||
maxKernels = maxKernels_in;
|
||||
kernels = maxKernels;
|
||||
}
|
||||
public String printThread(Integer id) {
|
||||
return "thread id = "+id;
|
||||
}
|
||||
public String getThreadsSummary() {
|
||||
Vector<String> lines = new Vector<>();
|
||||
lines.add("Planner summary:");
|
||||
lines.add("Waiting: " + waitingThreads.size());
|
||||
lines.add("Running: " + activeThreads.size());
|
||||
for (Integer id : activeThreads) {
|
||||
lines.add(printThread(id));
|
||||
}
|
||||
lines.add("");
|
||||
return String.join("\n", lines);
|
||||
}
|
||||
//--
|
||||
public void Start() {
|
||||
Global.Log.Print("Planner started");
|
||||
try {
|
||||
//--
|
||||
while (!waitingThreads.isEmpty() || !activeThreads.isEmpty()) {
|
||||
Global.Log.Print("Waiting: " + waitingThreads.size() + "; Running: " + activeThreads.size() + ".");
|
||||
Global.Log.Print(getThreadsSummary());
|
||||
checkActiveThreads();
|
||||
tryStartThreads();
|
||||
Thread.sleep(wait_ms);
|
||||
@@ -45,8 +59,7 @@ public abstract class ThreadsPlanner {
|
||||
//--
|
||||
} catch (Exception exception) {
|
||||
Global.Log.PrintException(exception);
|
||||
}
|
||||
finally {
|
||||
} finally {
|
||||
Global.Log.Print("Planner finished");
|
||||
finalize();
|
||||
}
|
||||
@@ -82,8 +95,7 @@ public abstract class ThreadsPlanner {
|
||||
}
|
||||
protected void finalize() {
|
||||
}
|
||||
protected void addThread(Runnable runnable) {
|
||||
Thread thread = new Thread(runnable);
|
||||
protected void addThread(Thread thread) {
|
||||
threads.put(threadMaxId, thread);
|
||||
waitingThreads.add(threadMaxId);
|
||||
threadMaxId++;
|
||||
|
||||
Reference in New Issue
Block a user