2023-12-11 01:24:30 +03:00
|
|
|
package TestingSystem.DVM.DVMPackage;
|
2024-10-07 14:22:52 +03:00
|
|
|
import Common.CommonConstants;
|
2024-10-09 22:01:19 +03:00
|
|
|
import _VisualDVM.Current;
|
2024-10-07 00:58:29 +03:00
|
|
|
import Common.Database.Objects.DBObject;
|
|
|
|
|
import _VisualDVM.Global;
|
2024-10-08 23:45:06 +03:00
|
|
|
import _VisualDVM.ServerObjectsCache.DVMConfigurationCache;
|
|
|
|
|
import _VisualDVM.ServerObjectsCache.VisualCaches;
|
2024-09-15 01:36:19 +03:00
|
|
|
import GlobalData.Account.Account;
|
|
|
|
|
import GlobalData.Compiler.Compiler;
|
2023-12-14 18:45:41 +03:00
|
|
|
import GlobalData.Machine.Machine;
|
|
|
|
|
import GlobalData.Machine.MachineType;
|
|
|
|
|
import GlobalData.User.User;
|
2024-10-01 17:33:08 +03:00
|
|
|
import TestingSystem.Common.Group.Group;
|
2024-09-15 01:36:19 +03:00
|
|
|
import TestingSystem.Common.TasksPackageState;
|
2024-10-01 17:33:08 +03:00
|
|
|
import TestingSystem.Common.Test.Test;
|
2023-12-11 01:24:30 +03:00
|
|
|
import TestingSystem.Common.TestingPackage.TestingPackage;
|
2024-10-01 17:33:08 +03:00
|
|
|
import TestingSystem.DVM.DVMConfiguration.DVMConfiguration;
|
|
|
|
|
import TestingSystem.DVM.DVMSettings.DVMSettings;
|
2024-09-14 00:18:27 +03:00
|
|
|
import TestingSystem.DVM.DVMTasks.DVMCompilationTask;
|
2023-12-15 18:38:05 +03:00
|
|
|
|
|
|
|
|
import java.io.File;
|
2024-09-14 00:18:27 +03:00
|
|
|
import java.util.Vector;
|
2023-12-15 18:10:27 +03:00
|
|
|
public class DVMPackage extends TestingPackage<DVMPackage_json> {
|
2023-12-11 01:24:30 +03:00
|
|
|
//---
|
|
|
|
|
public String machine_name = "";
|
|
|
|
|
public String machine_address = "";
|
|
|
|
|
public int machine_port = 22;
|
|
|
|
|
//---
|
|
|
|
|
public String user_name = "";
|
|
|
|
|
public String user_password;
|
|
|
|
|
public String user_workspace;
|
|
|
|
|
//---
|
2023-12-15 18:10:27 +03:00
|
|
|
public DVMPackage() {
|
|
|
|
|
}
|
2024-10-01 17:33:08 +03:00
|
|
|
public DVMPackage(Account account,
|
|
|
|
|
Machine machine,
|
|
|
|
|
User user,
|
|
|
|
|
Compiler compiler,
|
|
|
|
|
Vector<DVMConfiguration> configurations,
|
|
|
|
|
int neeedsEmail_in) {
|
2024-10-07 14:22:52 +03:00
|
|
|
id = CommonConstants.Nan;
|
2024-09-15 01:36:19 +03:00
|
|
|
//-
|
|
|
|
|
sender_name = account.name;
|
|
|
|
|
sender_address = account.email;
|
|
|
|
|
//-
|
|
|
|
|
machine_name = machine.name;
|
|
|
|
|
machine_address = machine.address;
|
|
|
|
|
machine_port = machine.port;
|
|
|
|
|
//-
|
|
|
|
|
user_name = user.login;
|
|
|
|
|
user_password = user.password;
|
|
|
|
|
user_workspace = user.workspace;
|
|
|
|
|
//-
|
|
|
|
|
drv = compiler.call_command;
|
|
|
|
|
version = compiler.getVersionInfo();
|
|
|
|
|
//-
|
2024-10-01 17:33:08 +03:00
|
|
|
needsEmail = neeedsEmail_in;
|
2024-09-15 01:36:19 +03:00
|
|
|
//--
|
|
|
|
|
state = TasksPackageState.Queued;
|
2024-10-01 17:33:08 +03:00
|
|
|
//--
|
|
|
|
|
for (DVMConfiguration configuration : configurations)
|
|
|
|
|
kernels = Math.max(configuration.kernels, kernels);
|
|
|
|
|
//-
|
|
|
|
|
tasksCount = 0;
|
|
|
|
|
Vector<DVMCompilationTask> compilationTasks = new Vector<DVMCompilationTask>();
|
|
|
|
|
for (DVMConfiguration configuration : configurations) {
|
|
|
|
|
DVMConfigurationCache cache = (DVMConfigurationCache) VisualCaches.GetCache(configuration);
|
|
|
|
|
for (Group group : cache.getGroups()) {
|
|
|
|
|
for (Test test : cache.getGroupTests(group)) {
|
|
|
|
|
for (DVMSettings dvmSettings : cache.getSettings()) {
|
|
|
|
|
DVMCompilationTask compilationTask = new DVMCompilationTask(configuration, dvmSettings, group, test, kernels);
|
|
|
|
|
compilationTasks.add(compilationTask);
|
|
|
|
|
tasksCount += compilationTask.runTasks.size();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
package_json = new DVMPackage_json(compilationTasks);
|
|
|
|
|
saveConfigurationsAsJson(configurations);
|
2024-09-15 01:36:19 +03:00
|
|
|
}
|
2023-12-15 18:10:27 +03:00
|
|
|
@Override
|
|
|
|
|
public Class getJsonClass() {
|
|
|
|
|
return DVMPackage_json.class;
|
|
|
|
|
}
|
2023-12-15 18:38:05 +03:00
|
|
|
@Override
|
|
|
|
|
public File getHomeDirectory() {
|
2023-12-18 15:44:48 +03:00
|
|
|
return Global.DVMPackagesDirectory;
|
2023-12-15 18:38:05 +03:00
|
|
|
}
|
2023-12-15 14:02:12 +03:00
|
|
|
public DVMPackage(DVMPackage p) {
|
|
|
|
|
super(p);
|
|
|
|
|
this.SynchronizeFields(p);
|
|
|
|
|
}
|
2023-12-12 16:09:14 +03:00
|
|
|
//---
|
2023-12-11 01:24:30 +03:00
|
|
|
@Override
|
|
|
|
|
public void SynchronizeFields(DBObject src) {
|
|
|
|
|
super.SynchronizeFields(src);
|
|
|
|
|
DVMPackage tasksPackage = (DVMPackage) src;
|
|
|
|
|
machine_name = tasksPackage.machine_name;
|
|
|
|
|
machine_address = tasksPackage.machine_address;
|
|
|
|
|
machine_port = tasksPackage.machine_port;
|
|
|
|
|
user_name = tasksPackage.user_name;
|
|
|
|
|
user_workspace = tasksPackage.user_workspace;
|
|
|
|
|
user_password = tasksPackage.user_password;
|
|
|
|
|
}
|
2023-12-15 18:10:27 +03:00
|
|
|
public Machine getMachine() {
|
|
|
|
|
return new Machine(machine_name, machine_address, machine_port, MachineType.Server);
|
2023-12-14 18:45:41 +03:00
|
|
|
}
|
2023-12-15 18:10:27 +03:00
|
|
|
public User getUser() {
|
2023-12-14 18:45:41 +03:00
|
|
|
return new User(user_name, user_password, user_workspace);
|
|
|
|
|
}
|
2024-03-10 00:42:29 +03:00
|
|
|
@Override
|
|
|
|
|
public boolean isVisible() {
|
2024-10-01 17:33:08 +03:00
|
|
|
return (!DVMPackageDBTable.filterMyOnly || Current.getAccount().email.equals(sender_address)) &&
|
|
|
|
|
(!DVMPackageDBTable.filterActive || state.isActive());
|
2024-09-14 00:18:27 +03:00
|
|
|
}
|
2024-10-03 16:21:11 +03:00
|
|
|
@Override
|
|
|
|
|
public void checkFinishState() throws Exception {
|
|
|
|
|
|
|
|
|
|
}
|
2023-12-11 01:24:30 +03:00
|
|
|
}
|
2024-09-14 00:18:27 +03:00
|
|
|
|