|
@@ -62,7 +62,11 @@ import static com.taais.biz.service.impl.VideoStableServiceImpl.makeDir;
|
|
*/
|
|
*/
|
|
@Service
|
|
@Service
|
|
public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMapper, TrackSequence> implements ITrackSequenceService {
|
|
public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMapper, TrackSequence> implements ITrackSequenceService {
|
|
- @Value("${server.task_stop_url}")
|
|
|
|
|
|
+
|
|
|
|
+ private static final String MASC = "MASC";
|
|
|
|
+ private static final String CAT = "CAT";
|
|
|
|
+
|
|
|
|
+ @Value("${server.task_stop_url_cat}")
|
|
private String task_stop_url;
|
|
private String task_stop_url;
|
|
|
|
|
|
@Autowired
|
|
@Autowired
|
|
@@ -141,7 +145,6 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
|
|
if (ObjectUtil.isNotNull(model)) {
|
|
if (ObjectUtil.isNotNull(model)) {
|
|
entity.setModelName(model.getModelName());
|
|
entity.setModelName(model.getModelName());
|
|
}
|
|
}
|
|
-
|
|
|
|
}
|
|
}
|
|
if (algorithmId != null) {
|
|
if (algorithmId != null) {
|
|
AlgorithmConfigTrackVo config = algorithmConfigTrackService.selectById(algorithmId);
|
|
AlgorithmConfigTrackVo config = algorithmConfigTrackService.selectById(algorithmId);
|
|
@@ -151,6 +154,17 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
|
|
entity.setAlgorithmName(config.getAlgorithmName());
|
|
entity.setAlgorithmName(config.getAlgorithmName());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else {
|
|
|
|
+ AlgorithmModelTrackVo model = algorithmModelTrackService.selectById(modelId);
|
|
|
|
+ if (ObjectUtil.isNotNull(model)) {
|
|
|
|
+ AlgorithmConfigTrackVo config = algorithmConfigTrackService.selectById(model.getAlgorithmId());
|
|
|
|
+ if (ObjectUtil.isNotNull(config)) {
|
|
|
|
+ entity.setType(config.getType());
|
|
|
|
+ entity.setSubsystem(config.getSubsystem());
|
|
|
|
+ entity.setAlgorithmName(config.getAlgorithmName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
});
|
|
});
|
|
return PageResult.build(page);
|
|
return PageResult.build(page);
|
|
}
|
|
}
|
|
@@ -164,7 +178,7 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
|
|
@Override
|
|
@Override
|
|
public CommonResult insert(TrackSequenceBo trackSequenceBo) {
|
|
public CommonResult insert(TrackSequenceBo trackSequenceBo) {
|
|
// 检查任务名称
|
|
// 检查任务名称
|
|
- if (ObjectUtil.isEmpty(trackSequenceBo.getName()) || (!trackSequenceBo.getName().startsWith("MASC") && !trackSequenceBo.getName().startsWith("CAT"))) {
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(trackSequenceBo.getName()) || (!trackSequenceBo.getName().startsWith(MASC) && !trackSequenceBo.getName().startsWith(CAT))) {
|
|
return CommonResult.fail("任务命名错误,需以MASC或CAT开头!");
|
|
return CommonResult.fail("任务命名错误,需以MASC或CAT开头!");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -178,13 +192,15 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
|
|
return CommonResult.fail("找不到指定模型!");
|
|
return CommonResult.fail("找不到指定模型!");
|
|
}
|
|
}
|
|
|
|
|
|
- if (ObjectUtil.isEmpty(trackSequenceBo.getAlgorithmId())) {
|
|
|
|
- return CommonResult.fail("请指定算法!");
|
|
|
|
- }
|
|
|
|
|
|
+ if (trackSequenceBo.getName().startsWith(MASC)) {
|
|
|
|
+ if (ObjectUtil.isEmpty(trackSequenceBo.getAlgorithmId())) {
|
|
|
|
+ return CommonResult.fail("请指定算法!");
|
|
|
|
+ }
|
|
|
|
|
|
- AlgorithmConfigTrackVo config = algorithmConfigTrackService.selectById(trackSequenceBo.getAlgorithmId());
|
|
|
|
- if (ObjectUtil.isNull(config)) {
|
|
|
|
- return CommonResult.fail("找不到指定的算法!");
|
|
|
|
|
|
+ AlgorithmConfigTrackVo config = algorithmConfigTrackService.selectById(trackSequenceBo.getAlgorithmId());
|
|
|
|
+ if (ObjectUtil.isNull(config)) {
|
|
|
|
+ return CommonResult.fail("找不到指定的算法!");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
TrackSequence trackSequence = new TrackSequence();
|
|
TrackSequence trackSequence = new TrackSequence();
|
|
@@ -249,10 +265,16 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
|
|
public CommonResult start(Long id) {
|
|
public CommonResult start(Long id) {
|
|
TrackSequence entity = getById(id);
|
|
TrackSequence entity = getById(id);
|
|
AlgorithmModelTrack algorithmModelTrack = algorithmModelTrackService.getById(entity.getAlgorithmModelId());
|
|
AlgorithmModelTrack algorithmModelTrack = algorithmModelTrackService.getById(entity.getAlgorithmModelId());
|
|
- AlgorithmConfigTrack algorithmConfigTrack = algorithmConfigTrackService.getById(entity.getAlgorithmId());
|
|
|
|
|
|
+ AlgorithmConfigTrack algorithmConfigTrack = null;
|
|
|
|
+ try {
|
|
|
|
+ algorithmConfigTrack = algorithmConfigTrackService.getById(entity.getAlgorithmId());
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ algorithmConfigTrack = algorithmConfigTrackService.getById(algorithmModelTrack.getAlgorithmId());
|
|
|
|
+ }
|
|
|
|
+
|
|
StartTaskConfig startTaskConfig = new StartTaskConfig();
|
|
StartTaskConfig startTaskConfig = new StartTaskConfig();
|
|
|
|
|
|
- if (algorithmConfigTrack.getType().equals(BizConstant.AlgorithmType.TEST) && entity.getName().startsWith("MASC")) {
|
|
|
|
|
|
+ if (algorithmConfigTrack.getType().equals(BizConstant.AlgorithmType.TEST) && entity.getName().startsWith(MASC)) {
|
|
startTaskConfig.setBizType(BizConstant.BizType.TRACK_SEQUENCE);
|
|
startTaskConfig.setBizType(BizConstant.BizType.TRACK_SEQUENCE);
|
|
startTaskConfig.setBizId(entity.getId());
|
|
startTaskConfig.setBizId(entity.getId());
|
|
|
|
|
|
@@ -310,6 +332,15 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
|
|
// return CommonResult.fail("模型命名失败,请以MASC或CAT开头命名模型");
|
|
// return CommonResult.fail("模型命名失败,请以MASC或CAT开头命名模型");
|
|
// }
|
|
// }
|
|
}
|
|
}
|
|
|
|
+ else if(BizConstant.AlgorithmType.TRAIN.equals(algorithmConfigTrack.getType()) && entity.getName().startsWith(CAT)) {
|
|
|
|
+ File file________ = new File(startTaskConfig.getSource_dir());
|
|
|
|
+ if (!file________.exists()) {
|
|
|
|
+ return CommonResult.fail("数据集为空!");
|
|
|
|
+ }
|
|
|
|
+ if(file________.listFiles()!=null && file________.listFiles().length>0) {
|
|
|
|
+ startTaskConfig.setSource_dir(startTaskConfig.getSource_dir() + File.separator + file________.listFiles()[0].getName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
HttpResponseEntity responseEntity = sendPostMsg(algorithmConfigTrack.getAlgorithmAddress(), startTaskConfig);
|
|
HttpResponseEntity responseEntity = sendPostMsg(algorithmConfigTrack.getAlgorithmAddress(), startTaskConfig);
|
|
if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
|
|
if (ObjectUtil.isNotNull(responseEntity) && responseEntity.getStatus() == 200) {
|
|
@@ -445,25 +476,41 @@ public class TrackSequenceServiceImpl extends BaseServiceImpl<TrackSequenceMappe
|
|
@Override
|
|
@Override
|
|
public CommonResult getDetail(Long id) {
|
|
public CommonResult getDetail(Long id) {
|
|
TrackSequenceVo entity = selectById(id);
|
|
TrackSequenceVo entity = selectById(id);
|
|
|
|
+ if (entity.getName().startsWith(MASC)) {
|
|
|
|
+ AlgorithmModelTrack modelTrack = algorithmModelTrackService.getById(entity.getAlgorithmModelId());
|
|
|
|
+ AlgorithmConfigTrack algorithmConfigTrack = algorithmConfigTrackService.getById(entity.getAlgorithmId());
|
|
|
|
+
|
|
|
|
+ AlgorithmModelTrackVo res = new AlgorithmModelTrackVo();
|
|
|
|
+
|
|
|
|
+ BeanUtils.copyProperties(modelTrack, res);
|
|
|
|
+ BeanUtils.copyProperties(algorithmConfigTrack, res);
|
|
|
|
|
|
- AlgorithmModelTrack modelTrack = algorithmModelTrackService.getById(entity.getAlgorithmModelId());
|
|
|
|
- AlgorithmConfigTrack algorithmConfigTrack = algorithmConfigTrackService.getById(entity.getAlgorithmId());
|
|
|
|
|
|
+ res.setAlgorithmId(algorithmConfigTrack.getId());
|
|
|
|
+ res.setId(modelTrack.getId());
|
|
|
|
|
|
- AlgorithmModelTrackVo res = new AlgorithmModelTrackVo();
|
|
|
|
|
|
+ return CommonResult.success(res, "success");
|
|
|
|
+ } else if (entity.getName().startsWith(CAT)) {
|
|
|
|
+ AlgorithmModelTrack modelTrack = algorithmModelTrackService.getById(entity.getAlgorithmModelId());
|
|
|
|
+ AlgorithmConfigTrack algorithmConfigTrack = algorithmConfigTrackService.getById(modelTrack.getAlgorithmId());
|
|
|
|
|
|
- BeanUtils.copyProperties(modelTrack, res);
|
|
|
|
- BeanUtils.copyProperties(algorithmConfigTrack, res);
|
|
|
|
|
|
+ AlgorithmModelTrackVo res = new AlgorithmModelTrackVo();
|
|
|
|
|
|
- res.setAlgorithmId(algorithmConfigTrack.getId());
|
|
|
|
- res.setId(modelTrack.getId());
|
|
|
|
|
|
+ BeanUtils.copyProperties(modelTrack, res);
|
|
|
|
+ BeanUtils.copyProperties(algorithmConfigTrack, res);
|
|
|
|
|
|
- return CommonResult.success(res, "success");
|
|
|
|
|
|
+ res.setAlgorithmId(algorithmConfigTrack.getId());
|
|
|
|
+ res.setId(modelTrack.getId());
|
|
|
|
+
|
|
|
|
+ return CommonResult.success(res, "success");
|
|
|
|
+ } else {
|
|
|
|
+ return CommonResult.fail("命名错误!");
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public CommonResult addEvaluate(AddEvaluate addEvaluate) {
|
|
public CommonResult addEvaluate(AddEvaluate addEvaluate) {
|
|
// 检查任务名称
|
|
// 检查任务名称
|
|
- if (ObjectUtil.isEmpty(addEvaluate.getName()) || (!addEvaluate.getName().startsWith("MASC") && !addEvaluate.getName().startsWith("CAT"))) {
|
|
|
|
|
|
+ if (ObjectUtil.isEmpty(addEvaluate.getName()) || (!addEvaluate.getName().startsWith(MASC) && !addEvaluate.getName().startsWith(CAT))) {
|
|
return CommonResult.fail("任务命名错误,需以MASC或CAT开头!");
|
|
return CommonResult.fail("任务命名错误,需以MASC或CAT开头!");
|
|
}
|
|
}
|
|
|
|
|