|
@@ -271,11 +271,11 @@ public class algTrainController {
|
|
|
algTrainLogService.save(algTrainLog);
|
|
|
|
|
|
// 产生数据
|
|
|
- publisher.publishMessage(
|
|
|
- "1",
|
|
|
- "11",
|
|
|
- "算法结果" + algorithmTrainingLogContent
|
|
|
- );
|
|
|
+// publisher.publishMessage(
|
|
|
+// "1",
|
|
|
+// "11",
|
|
|
+// "算法结果" + algorithmTrainingLogContent
|
|
|
+// );
|
|
|
|
|
|
// System.out.println(algTrainLogService.selectByAlgTrainId(Long.parseLong(algorithmTrainingId)).getAlgorithmTrainingLogContent());
|
|
|
|
|
@@ -297,9 +297,6 @@ public class algTrainController {
|
|
|
@Async
|
|
|
@Scheduled(fixedRate = 6000)//每6秒执行一次,获取消息
|
|
|
public void checkAlgRequest() throws DockerException, InvalidBucketNameException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InterruptedException, InvalidResponseException, XmlParserException, InternalException {
|
|
|
- if(!publisher.isInitialized){
|
|
|
- return;
|
|
|
- }
|
|
|
if (subscriber.listener != null && subscriber.listener.isRequest == 0) {
|
|
|
publisher.publishMessage(
|
|
|
"4",
|
|
@@ -308,26 +305,40 @@ public class algTrainController {
|
|
|
);
|
|
|
}
|
|
|
publisher.publishMessage(
|
|
|
- "2",
|
|
|
+ "4",
|
|
|
"8",
|
|
|
- ""
|
|
|
+ "这是心跳信息"
|
|
|
);
|
|
|
- if(subscriber.listener.algMap != null) {
|
|
|
- for(Map.Entry<String, AlgTrain> map : subscriber.listener.algMap.entrySet()){
|
|
|
+
|
|
|
+ if(subscriber.listener != null && subscriber.listener.isRequest == 1) {
|
|
|
+ for(Map.Entry<String, String> map : subscriber.listener.algMap.entrySet()){
|
|
|
String key = map.getKey();
|
|
|
- AlgTrain algTrain = map.getValue();
|
|
|
- startTraining(String.valueOf(algTrain.getAlgorithmTrainingId()));
|
|
|
+ String missName = map.getValue();
|
|
|
+ AlgTrain algTrain = algTrainService.selectByMissName(missName);
|
|
|
+ Long algorithmTrainingId = algTrain.getAlgorithmTrainingId();
|
|
|
+ startTraining(String.valueOf(algorithmTrainingId));
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-// @PostConstruct
|
|
|
-// public void init() {
|
|
|
-// // 初始化 publisher 和 subscriber
|
|
|
-// publisher.initialize();
|
|
|
-// subscriber.initialize(); // 假设有初始化方法
|
|
|
-// initialized = true;
|
|
|
-// }
|
|
|
+ @PostConstruct
|
|
|
+ public void init() throws DockerException, InvalidBucketNameException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InterruptedException, InvalidResponseException, XmlParserException, InternalException {
|
|
|
+ // 初始化时运行
|
|
|
+ if (subscriber.listener.isRequest == 1) {
|
|
|
+ algRun(subscriber.listener.algMap);
|
|
|
+ }
|
|
|
+ subscriber.listener.isRequest = 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void algRun(Map<String, String> algMap) throws DockerException, InvalidBucketNameException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InterruptedException, InvalidResponseException, XmlParserException, InternalException {
|
|
|
+ for(Map.Entry<String, String> map : algMap.entrySet()){
|
|
|
+ String key = map.getKey();
|
|
|
+ String missName = map.getValue();
|
|
|
+ AlgTrain algTrain = algTrainService.selectByMissName(missName);
|
|
|
+ Long algorithmTrainingId = algTrain.getAlgorithmTrainingId();
|
|
|
+ startTraining(String.valueOf(algorithmTrainingId));
|
|
|
+ }
|
|
|
+ }
|
|
|
//
|
|
|
// private void resolverDDS(){
|
|
|
// subscriber.listener.algMap.get()
|