прогресс пакетов сапфор

This commit is contained in:
2024-02-16 23:49:04 +03:00
parent 0efd6ebb9b
commit cd2fefd099
3 changed files with 34 additions and 21 deletions

20
.idea/workspace.xml generated
View File

@@ -7,25 +7,9 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment=""> <list default="true" id="e42177c3-2328-4b27-8a01-35779b2beb99" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/src/icons/versions/Unknown.png" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/properties" beforeDir="false" afterPath="$PROJECT_DIR$/properties" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/TestingSystem/Common/ThreadsPlanner/ThreadsPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/ThreadsPlanner/ThreadsPlanner.java" 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/TestingSystem/SAPFOR/SapforTestingPlanner.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTestingPlanner.java" 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/GlobalProperties.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Common/GlobalProperties.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/GlobalData/Machine/Machine.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/GlobalData/Machine/Machine.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Repository/Component/Visualiser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Repository/Component/Visualiser.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/TestingSystem/Common/TestingServer.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/Common/TestingServer.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforPackage_json.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/Json/SapforPackage_json.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTask/SapforTask.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTask/SapforTask.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTasksPackage/UI/MatchesSummary.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTasksPackage/UI/MatchesSummary.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTasksPackage/UI/PackageSummary.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTasksPackage/UI/PackageSummary.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTasksPackage/UI/SapforPackageTreeNode.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/TestingSystem/SAPFOR/SapforTasksPackage/UI/SapforPackageTreeNode.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CheckAccount.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/All/CheckAccount.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/Server/RepositoryPass.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/Passes/Server/RepositoryPass.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/CallbackForm.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/Visual_DVM_2021/UI/Main/CallbackForm.java" afterDir="false" />
</list> </list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />

View File

@@ -1,7 +1,9 @@
package TestingSystem.Common.ThreadsPlanner; package TestingSystem.Common.ThreadsPlanner;
import Common.Global; import Common.Global;
import Common.Utils.InterruptThread; import Common.Utils.InterruptThread;
import org.apache.commons.io.FileUtils;
import java.io.File;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Vector; import java.util.Vector;
public abstract class ThreadsPlanner { public abstract class ThreadsPlanner {
@@ -20,6 +22,8 @@ public abstract class ThreadsPlanner {
//--- //---
protected int threadMaxId = 0; protected int threadMaxId = 0;
protected int wait_ms; protected int wait_ms;
protected int done_threads = 0;
protected int progress = 0;
protected LinkedHashMap<Integer, Thread> threads = new LinkedHashMap<>(); protected LinkedHashMap<Integer, Thread> threads = new LinkedHashMap<>();
protected Vector<Integer> activeThreads = new Vector<>(); protected Vector<Integer> activeThreads = new Vector<>();
protected Vector<Integer> waitingThreads = new Vector<>(); protected Vector<Integer> waitingThreads = new Vector<>();
@@ -74,10 +78,20 @@ public abstract class ThreadsPlanner {
if (!thread.isAlive()) { if (!thread.isAlive()) {
toExclude.add(i); toExclude.add(i);
kernels++; kernels++;
done_threads++;
} }
} }
activeThreads.removeAll(toExclude); activeThreads.removeAll(toExclude);
//-- //--
double progress = ((double)done_threads/threads.size())*100.0;
Global.Log.Print("done_threads="+done_threads+";all_threads="+threads.size()+";progress="+progress);
File progress_file = new File("progress");
try {
FileUtils.writeStringToFile(progress_file, String.valueOf(((int)progress)));
}
catch (Exception exception){
exception.printStackTrace();
}
} }
protected void tryStartThreads() throws Exception { protected void tryStartThreads() throws Exception {
Vector<Integer> toExclude = new Vector<>(); Vector<Integer> toExclude = new Vector<>();

View File

@@ -84,17 +84,32 @@ public class SapforTestingPlanner extends TestingPlanner<SapforPackage> {
} }
@Override @Override
protected boolean CheckNextState() throws Exception { protected boolean CheckNextState() throws Exception {
boolean progress_changed = false;
boolean state_changed = false;
//--
File workspace = testingPackage.getLocalWorkspace(); File workspace = testingPackage.getLocalWorkspace();
//--
File progress = new File(workspace, "progress");
if (progress.exists()) {
String s = FileUtils.readFileToString(progress);
int current_progress = Integer.parseInt(s);
if (current_progress != testingPackage.progress) {
Print("progress changed: " + current_progress);
testingPackage.progress = current_progress;
progress_changed = true;
}
}
//--
File done = new File(workspace, Constants.DONE); File done = new File(workspace, Constants.DONE);
File aborted = new File(workspace, Constants.ABORTED); File aborted = new File(workspace, Constants.ABORTED);
if (done.exists()) { if (done.exists()) {
testingPackage.state = TasksPackageState.Analysis; testingPackage.state = TasksPackageState.Analysis;
return true; state_changed = true;
} else if (aborted.exists()) { } else if (aborted.exists()) {
testingPackage.state = TasksPackageState.Aborted; testingPackage.state = TasksPackageState.Aborted;
return true; state_changed = true;
} }
return false; return progress_changed || state_changed;
} }
@Override @Override
protected void DownloadResults() throws Exception { protected void DownloadResults() throws Exception {