|
@@ -6,6 +6,7 @@ import com.pdaaphm.biz.domain.SubAlgorithm;
|
|
import com.pdaaphm.biz.dto.RequestDTO;
|
|
import com.pdaaphm.biz.dto.RequestDTO;
|
|
import com.pdaaphm.biz.mapper.FileMapper;
|
|
import com.pdaaphm.biz.mapper.FileMapper;
|
|
import com.pdaaphm.biz.mapper.SubAlgorithmMapper;
|
|
import com.pdaaphm.biz.mapper.SubAlgorithmMapper;
|
|
|
|
+import com.pdaaphm.biz.service.IRedisLogService;
|
|
import com.pdaaphm.biz.service.RunAlgorithmService;
|
|
import com.pdaaphm.biz.service.RunAlgorithmService;
|
|
import com.pdaaphm.common.config.PadaphmConfig;
|
|
import com.pdaaphm.common.config.PadaphmConfig;
|
|
import com.pdaaphm.common.utils.DateUtils;
|
|
import com.pdaaphm.common.utils.DateUtils;
|
|
@@ -38,6 +39,9 @@ public class RunPythonImpl implements RunAlgorithmService {
|
|
@Autowired
|
|
@Autowired
|
|
private SubAlgorithmMapper subAlgorithmMapper;
|
|
private SubAlgorithmMapper subAlgorithmMapper;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IRedisLogService redisLogService;
|
|
|
|
+
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
private final Logger logger = LoggerFactory.getLogger(this.getClass());
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -49,6 +53,7 @@ public class RunPythonImpl implements RunAlgorithmService {
|
|
httpRequestFactory.setConnectTimeout(3000);
|
|
httpRequestFactory.setConnectTimeout(3000);
|
|
httpRequestFactory.setReadTimeout(3000);
|
|
httpRequestFactory.setReadTimeout(3000);
|
|
WebClient webClient = WebClient.create(url);
|
|
WebClient webClient = WebClient.create(url);
|
|
|
|
+ redisLogService.info("TASK-"+ id, "分析算法程序......");
|
|
// send post
|
|
// send post
|
|
Mono<BaseResponse> result = webClient.post() // 使用POST方法
|
|
Mono<BaseResponse> result = webClient.post() // 使用POST方法
|
|
.uri("/request") // 指定URI
|
|
.uri("/request") // 指定URI
|
|
@@ -68,7 +73,8 @@ public class RunPythonImpl implements RunAlgorithmService {
|
|
}); // 将响应体转换为String
|
|
}); // 将响应体转换为String
|
|
// get response
|
|
// get response
|
|
BaseResponse res = result.block();
|
|
BaseResponse res = result.block();
|
|
-
|
|
|
|
|
|
+ redisLogService.info("TASK-"+ id, "分析算法文件完成......");
|
|
|
|
+ redisLogService.info("TASK-"+ id, "执行算法......");
|
|
// save result path to subAlgorithm
|
|
// save result path to subAlgorithm
|
|
List<String> resultList = requestDto.getResultList();
|
|
List<String> resultList = requestDto.getResultList();
|
|
List<Map> subAlgorithmOutputList = subAlgorithmMapper.selectSubAlgorithmOutputList(id);
|
|
List<Map> subAlgorithmOutputList = subAlgorithmMapper.selectSubAlgorithmOutputList(id);
|
|
@@ -102,6 +108,7 @@ public class RunPythonImpl implements RunAlgorithmService {
|
|
subAlgorithm.setUploadId(resultFile.getId());
|
|
subAlgorithm.setUploadId(resultFile.getId());
|
|
subAlgorithm.setCreateTime(DateUtils.getNowDate());
|
|
subAlgorithm.setCreateTime(DateUtils.getNowDate());
|
|
subAlgorithmMapper.updateSubAlgorithm(subAlgorithm);
|
|
subAlgorithmMapper.updateSubAlgorithm(subAlgorithm);
|
|
|
|
+ redisLogService.info("TASK-"+ id, "执行算法完成......");
|
|
}
|
|
}
|
|
else {
|
|
else {
|
|
logger.error("输出文件未生成!");
|
|
logger.error("输出文件未生成!");
|