|
@@ -32,7 +32,9 @@ import org.springframework.data.redis.core.StringRedisTemplate;
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.io.BufferedReader;
|
|
import java.io.File;
|
|
import java.io.File;
|
|
|
|
+import java.io.InputStreamReader;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
import java.util.concurrent.FutureTask;
|
|
import java.util.concurrent.FutureTask;
|
|
import java.util.concurrent.TimeUnit;
|
|
import java.util.concurrent.TimeUnit;
|
|
@@ -263,7 +265,16 @@ public class TaskManager {
|
|
MinioUtil.downloadToFile(minioClient, bucketName, result1OfMinio, result1OfLinux); // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
|
|
MinioUtil.downloadToFile(minioClient, bucketName, result1OfMinio, result1OfLinux); // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
|
|
MinioUtil.downloadToFile(minioClient, bucketName, result2OfMinio, result2OfLinux); // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
|
|
MinioUtil.downloadToFile(minioClient, bucketName, result2OfMinio, result2OfLinux); // 也可改成下载到指定ip的服务器上,需要保证和打分脚本在一台机器上。
|
|
log.info("TaskService--state 开始执行打分命令:" + scoreCommand);
|
|
log.info("TaskService--state 开始执行打分命令:" + scoreCommand);
|
|
- scoreResult = SshUtil.execute(session, scoreCommand);
|
|
|
|
|
|
+ Runtime r = Runtime.getRuntime();
|
|
|
|
+ Process p = r.exec(scoreCommand, null, new File(scoreDirectoryOfUser));
|
|
|
|
+ BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
|
+ String inline;
|
|
|
|
+ while (null != (inline = br.readLine())) {
|
|
|
|
+ sb.append(inline).append("\n");
|
|
|
|
+ }
|
|
|
|
+ scoreResult = sb.toString();
|
|
|
|
+// scoreResult = SshUtil.execute(session, scoreCommand);
|
|
log.info("TaskService--state 项目" + projectId + " 的任务 " + task2Id + " 打分结束,结果为:" + scoreResult);
|
|
log.info("TaskService--state 项目" + projectId + " 的任务 " + task2Id + " 打分结束,结果为:" + scoreResult);
|
|
String replace = StringUtil.replace(scoreResult, "'", "\"");
|
|
String replace = StringUtil.replace(scoreResult, "'", "\"");
|
|
try {
|
|
try {
|