Оптимизация команды Exists для SSH

This commit is contained in:
2023-12-04 14:42:36 +03:00
parent 1f8ebdc9a2
commit 163552d74f
13 changed files with 93 additions and 100 deletions

View File

@@ -37,7 +37,7 @@ public class RemoteCompilationSupervisor extends RemoteTaskSupervisor<Compilatio
}
@Override
protected void ValidateTaskResults() throws Exception {
if (pass.Exists(getRemoteProject().full_name, getBinary().name)) {
if (pass.Exists(getBinary())) {
RemoteFile renamed_binary = new RemoteFile(getRemoteProject().full_name, Utils.getDateName("spf_" + getBinary().name));
pass.sftpChannel.rename(getBinary().full_name, renamed_binary.full_name);
task.binary_name = renamed_binary.name;

View File

@@ -42,15 +42,17 @@ public abstract class RemoteTaskSupervisor<T extends Task> extends TaskSuperviso
}
@Override
protected void CheckTask() throws Exception {
if (pass.Exists(getRemoteProject().full_name, Constants.DONE))
RemoteFile DONE = new RemoteFile(getRemoteProject(), Constants.DONE);
RemoteFile TIMEOUT = new RemoteFile(getRemoteProject(), Constants.TIMEOUT);
if (pass.Exists(DONE))
task.state = TaskState.Finished;
else if (pass.Exists(getRemoteProject().full_name, Constants.TIMEOUT))
else if (pass.Exists(TIMEOUT))
task.state = TaskState.AbortedByTimeout;
}
@Override
protected void AchieveResults() throws Exception {
pass.tryGetSingleFile(getRemoteOutput(), task.getOutputFile(), 10240);
pass.tryGetSingleFile(getRemoteErrors(), task.getErrorsFile(), 10240);
pass.tryGetSingleFileWithMaxSize(getRemoteOutput(), task.getOutputFile(), 10240);
pass.tryGetSingleFileWithMaxSize(getRemoteErrors(), task.getErrorsFile(), 10240);
}
@Override
protected void AbortTask() throws Exception {
@@ -58,7 +60,7 @@ public abstract class RemoteTaskSupervisor<T extends Task> extends TaskSuperviso
}
@Override
protected void CalculatePerformanceTime() throws Exception {
if (pass.tryGetSingleFile(getRemoteTime(), task.getTimeFile(), 0))
if (pass.tryGetSingleFileWithMaxSize(getRemoteTime(), task.getTimeFile(), 0))
task.RefreshTime();
}
protected String getStartCommand() {

View File

@@ -71,7 +71,7 @@ public class ServerRunSupervisor extends RemoteTaskSupervisor<RunTask> {
}
if (!task.last_sts_name.isEmpty()) {
RemoteFile remote_sts = new RemoteFile(getRemoteProject().full_name, task.last_sts_name);
task.hasDvmSts = pass.tryGetSingleFile(remote_sts, task.getLocalStsFile(), 10240);
task.hasDvmSts = pass.tryGetSingleFileWithMaxSize(remote_sts, task.getLocalStsFile(), 10240);
}
}
}