обновление задач пакета одной операцией.

This commit is contained in:
2023-12-03 22:06:13 +03:00
parent db82187212
commit 7ac88bc689
4 changed files with 32 additions and 10 deletions

View File

@@ -80,6 +80,7 @@ public enum ServerCode {
GetActualSapforPackageData,
//--
PublishObject,
PublishObjects
PublishObjects,
UpdateTestTasks
// PublishTestProject
}

View File

@@ -36,14 +36,11 @@ import Visual_DVM_2021.Passes.Pass_2021;
import javafx.util.Pair;
import org.apache.commons.io.FileUtils;
import javax.swing.*;
import javax.swing.Timer;
import java.io.File;
import java.io.Serializable;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.Comparator;
import java.util.LinkedHashMap;
import java.util.Vector;
import java.util.*;
import static Common.Constants.tests_db_name;
public class TestingServer extends RepositoryServer<TestsDatabase> {
@@ -392,10 +389,29 @@ public class TestingServer extends RepositoryServer<TestsDatabase> {
RefreshDVMTests((Account) request.object, Integer.parseInt(request.arg));
break;
//--
case UpdateTestTasks:
Print("Обновить задачи на компиляцию и запуск");
SetCurrentAccountDB(request.arg);
UpdateTestTasks();
response = new ServerExchangeUnit_2021(ServerCode.OK);
break;
default:
throw new RepositoryRefuseException("Неподдерживаемый код: " + code);
}
}
public void UpdateTestTasks() throws Exception {
Vector<TestCompilationTask> compilationTasks = (Vector<TestCompilationTask>) request.object;
account_db.BeginTransaction();
for (TestCompilationTask compilationTask : compilationTasks) {
compilationTask.ChangeDate = new Date().getTime();
account_db.Update(compilationTask);
for (TestRunTask runTask : compilationTask.runTasks) {
compilationTask.ChangeDate = new Date().getTime();
account_db.Update(runTask);
}
}
account_db.Commit();
}
//->>
//->>
Pair<Group, Vector<File>> ConvertDirectoryToGroup(File src, LanguageName languageName, TestType

View File

@@ -226,7 +226,7 @@ public class TestsSupervisor_2022 {
for (TestCompilationTask testCompilationTask : compilationTasks) {
ct_count++;
if (CheckTask(testCompilationTask)) {
planner.UpdateTask(testCompilationTask);
// planner.UpdateTask(testCompilationTask);
for (TestRunTask testRunTask : testCompilationTask.runTasks) {
rt_count++;
testRunTask.compilation_state = testCompilationTask.state;
@@ -237,7 +237,7 @@ public class TestsSupervisor_2022 {
} else {
CheckTask(testRunTask);
}
planner.UpdateTask(testRunTask);
// planner.UpdateTask(testRunTask);
if (testRunTask.state.equals(TaskState.Finished)) {
//анализ задачи на запуск.
List<String> output_lines = Arrays.asList(testRunTask.output.split("\n"));
@@ -287,11 +287,14 @@ public class TestsSupervisor_2022 {
}
}
}
planner.UpdateTask(testRunTask);
//planner.UpdateTask(testRunTask);
}
}
}
System.out.println("ct_count=" + ct_count + " rt count=" + rt_count);
//теперь обновить их единым списком.
planner.ServerCommand(ServerCode.UpdateTestTasks, compilationTasks);
}
public boolean CheckTask(TestTask testTask) throws Exception {
if (testTask.state.equals(TaskState.ResultsDownloaded)) {