allen hai 11 meses
pai
achega
30d0643bcb

+ 1 - 0
taais-admin/src/main/resources/application.yml

@@ -287,6 +287,7 @@ security:
     # 公共路径
     - /favicon.ico
     - /error
+    - /public/**
     # swagger 文档配置
     - /*/api-docs
     - /*/api-docs/**

+ 0 - 1
taais-modules/taais-biz/src/main/java/com/taais/biz/controller/AlgorithmConfigController.java

@@ -107,7 +107,6 @@ public class AlgorithmConfigController extends BaseController {
         return CommonResult.success();
     }
 
-    @SaCheckPermission("ag:config:list")
     @GetMapping("/getOption")
     public CommonResult<List> getOption() {
         return CommonResult.success(algorithmConfigService.getOption());

+ 14 - 4
taais-modules/taais-biz/src/main/java/com/taais/biz/controller/PublicController.java

@@ -4,7 +4,10 @@ import com.taais.biz.constant.BizConstant;
 import com.taais.biz.domain.dto.TaskResultDTO;
 import com.taais.biz.service.IAlgorithmBizProcessService;
 import com.taais.biz.service.IAlgorithmDataProcessService;
+import com.taais.biz.service.IAlgorithmTaskService;
 import com.taais.common.core.core.domain.CommonResult;
+import com.taais.common.log.annotation.Log;
+import com.taais.common.log.enums.BusinessType;
 import com.taais.common.web.core.BaseController;
 import jakarta.annotation.Resource;
 import lombok.RequiredArgsConstructor;
@@ -12,10 +15,7 @@ import org.apache.commons.lang3.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 /**
  * @author allen
@@ -31,6 +31,9 @@ public class PublicController extends BaseController {
     IAlgorithmDataProcessService dataProcessService;
     @Resource
     IAlgorithmBizProcessService bizProcessService;
+
+    @Resource
+    private IAlgorithmTaskService algorithmTaskService;
     @PostMapping("/taskResult")
     public CommonResult<Void> taskResult(@RequestBody TaskResultDTO resultDTO) {
         String errorMsg = checkDTO(resultDTO);
@@ -68,4 +71,11 @@ public class PublicController extends BaseController {
         }
         return null;
     }
+
+    @GetMapping("/taskRun")
+    public CommonResult<Void> taskRun() {
+        algorithmTaskService.taskRun();
+        return CommonResult.success();
+    }
+
 }

+ 17 - 15
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/AlgorithmSubtaskServiceImpl.java

@@ -160,22 +160,23 @@ public class AlgorithmSubtaskServiceImpl extends BaseServiceImpl<AlgorithmSubtas
     public void subtaskRun(Long taskId) {
         AlgorithmSubtask firstNeedProcessSubtask = algorithmSubtaskMapper.getFirstNeedProcessSubtask(taskId);
         if (firstNeedProcessSubtask != null) {
-            // 数据增强
-            if ("1".equals(firstNeedProcessSubtask.getType())) {
-                List<AlgorithmDataProcessVo> processVoList =  dataProcessService.getProcessBySubtaskId(firstNeedProcessSubtask.getId());
-                dateSetProcess(processVoList);
-            // 数据扩充
-            } else if ("2".equals(firstNeedProcessSubtask.getType())) {
-                List<AlgorithmDataProcessVo> processVoList =  dataProcessService.getProcessBySubtaskId(firstNeedProcessSubtask.getId());
-                dateSetProcess(processVoList);
-            // 算法调用
-            } else if ("3".equals(firstNeedProcessSubtask.getType())) {
+            // todo allen 现在的type是1是训练,2是验证,3是测试
+//            // 数据增强
+//            if ("1".equals(firstNeedProcessSubtask.getType())) {
+//                List<AlgorithmDataProcessVo> processVoList =  dataProcessService.getProcessBySubtaskId(firstNeedProcessSubtask.getId());
+//                dateSetProcess(processVoList);
+//            // 数据扩充
+//            } else if ("2".equals(firstNeedProcessSubtask.getType())) {
+//                List<AlgorithmDataProcessVo> processVoList =  dataProcessService.getProcessBySubtaskId(firstNeedProcessSubtask.getId());
+//                dateSetProcess(processVoList);
+//            // 算法调用
+//            } else if ("3".equals(firstNeedProcessSubtask.getType())) {
             // error branch
                 List<AlgorithmBizProcessVo> bizProcessVoList = bizProcessService.getProcessBySubtaskId(firstNeedProcessSubtask.getId());
                 bizProcess(bizProcessVoList);
-            } else {
-                log.warn("type is wrong, type: {}", firstNeedProcessSubtask.getType());
-            }
+//            } else {
+//                log.warn("type is wrong, type: {}", firstNeedProcessSubtask.getType());
+//            }
         } else {
             log.error("subtaskRun.getFirstNeedProcessSubtask is null, taskId:{}", taskId);
         }
@@ -219,17 +220,18 @@ public class AlgorithmSubtaskServiceImpl extends BaseServiceImpl<AlgorithmSubtas
             algorithmRequestDto.setBizId(bizProcessVo.getId());
             algorithmRequestDto.setSourcePath(preprocessPath);
             algorithmRequestDto.setResultPath(resultPath);
-            algorithmRequestDto.setResultPath(bizProcessVo.getLog());
+            algorithmRequestDto.setLogPath(bizProcessVo.getLog());
             Gson gson = new Gson();
             Type listType = new TypeToken<List<AlgorithmConfigParamDto>>() {}.getType();
             if (StringUtils.isNotEmpty(parameters)) {
                 List<AlgorithmConfigParamDto> paramDtoList = gson.fromJson(parameters, listType);
                 Map<String, String> otherParams = new HashMap<>(paramDtoList.size());
+                // todo allen 模型没加载进去
                 if (model == null) {
                     log.error("模型配置未找到!!!modelId:{}", modelId);
                     errorMsg.add("模型配置未找到!!!");
                 } else {
-                    otherParams.put("modelPath", model.getModelAddress());
+                    otherParams.put("pretrained_model", model.getModelAddress());
                 }
                 for (AlgorithmConfigParamDto algorithmConfigParamDto : paramDtoList) {
                     otherParams.put(algorithmConfigParamDto.getAgName(), StringUtils.isNotEmpty(algorithmConfigParamDto.getValue()) ? algorithmConfigParamDto.getValue() : algorithmConfigParamDto.getDefaultValue());

+ 18 - 18
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/AlgorithmTaskServiceImpl.java

@@ -291,9 +291,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
                 String resultPath = BizConstant.TASK_FOLDER_PATH_HEAD + algorithmTask.getId()
                     + BizConstant.TASK_FOLDER_PATH_MID_TEST + BizConstant.TASK_FOLDER_PATH_TRAIL_RESULT + algorithmBizProcessBo.getId() + "/";
                 resultPath = resultPath.replaceAll("//", "/");
-                String finallyParams = buildFinallyParams(dto.getParams(), testDataFolderPath, resultPath);
+//                String finallyParams = buildFinallyParams(dto.getParams(), testDataFolderPath, resultPath);
                 algorithmBizProcessBo.setResultPath(resultPath);
-                algorithmBizProcessBo.setParameters(finallyParams);
+                algorithmBizProcessBo.setParameters(dto.getParams());
                 algorithmBizProcessBo.setLog(resultPath+BizConstant.TASK_FOLDER_LOG_PATH);
                 bizProcessService.update(algorithmBizProcessBo);
                 index++;
@@ -321,9 +321,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
             String resultPath = BizConstant.TASK_FOLDER_PATH_HEAD + algorithmTask.getId()
                 + BizConstant.TASK_FOLDER_PATH_MID_TEST + BizConstant.TASK_FOLDER_PATH_TRAIL_EXPANSION + processBo.getId() + "/";
             resultPath = resultPath.replaceAll("//", "/");
-            String finallyParams = buildFinallyParams(taskDto.getTestDataExpansion().getParams(), testDataFolderPath, resultPath);
+//            String finallyParams = buildFinallyParams(taskDto.getTestDataExpansion().getParams(), testDataFolderPath, resultPath);
             processBo.setResultPath(resultPath);
-            processBo.setParameters(finallyParams);
+            processBo.setParameters(taskDto.getTestDataExpansion().getParams());
             processBo.setLog(resultPath+BizConstant.TASK_FOLDER_LOG_PATH);
             processService.update(processBo);
             returnList.add(resultPath);
@@ -354,9 +354,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
                 + BizConstant.TASK_FOLDER_PATH_MID_TEST + BizConstant.TASK_FOLDER_PATH_TRAIL_ENHANCEMENT + processBo.getId() + "/";
             resultPath = resultPath.replaceAll("//", "/");
             // create AlgorithmDataProcess 创建数据处理
-            String finallyParams = buildFinallyParams(taskDto.getTestDataEnhancement().getParams(), testDataFolderPath, resultPath);
+//            String finallyParams = buildFinallyParams(taskDto.getTestDataEnhancement().getParams(), testDataFolderPath, resultPath);
             processBo.setResultPath(resultPath);
-            processBo.setParameters(finallyParams);
+            processBo.setParameters(taskDto.getTestDataEnhancement().getParams());
             processBo.setLog(resultPath+BizConstant.TASK_FOLDER_LOG_PATH);
             processService.update(processBo);
             returnList.add(resultPath);
@@ -408,9 +408,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
                 String resultPath = BizConstant.TASK_FOLDER_PATH_HEAD + algorithmTask.getId()
                     + BizConstant.TASK_FOLDER_PATH_MID_REASONING + BizConstant.TASK_FOLDER_PATH_TRAIL_RESULT + algorithmBizProcessBo.getId() + "/";
                 resultPath = resultPath.replaceAll("//", "/");
-                String finallyParams = buildFinallyParams(dto.getParams(), reasoningDataFolderPath, resultPath);
+//                String finallyParams = buildFinallyParams(dto.getParams(), reasoningDataFolderPath, resultPath);
                 algorithmBizProcessBo.setResultPath(resultPath);
-                algorithmBizProcessBo.setParameters(finallyParams);
+                algorithmBizProcessBo.setParameters(dto.getParams());
                 algorithmBizProcessBo.setLog(resultPath+BizConstant.TASK_FOLDER_LOG_PATH);
                 bizProcessService.update(algorithmBizProcessBo);
                 index++;
@@ -438,9 +438,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
             String resultPath = BizConstant.TASK_FOLDER_PATH_HEAD + algorithmTask.getId()+"/"
                 + BizConstant.TASK_FOLDER_PATH_MID_REASONING + BizConstant.TASK_FOLDER_PATH_TRAIL_EXPANSION + processBo.getId() + "/";
             resultPath = resultPath.replaceAll("//", "/");
-            String finallyParams = buildFinallyParams(taskDto.getReasoningDataExpansion().getParams(), reasoningDataFolderPath, resultPath);
+//            String finallyParams = buildFinallyParams(taskDto.getReasoningDataExpansion().getParams(), reasoningDataFolderPath, resultPath);
             processBo.setResultPath(resultPath);
-            processBo.setParameters(finallyParams);
+            processBo.setParameters(taskDto.getReasoningDataExpansion().getParams());
             processBo.setLog(resultPath+BizConstant.TASK_FOLDER_LOG_PATH);
             processService.update(processBo);
             returnList.add(resultPath);
@@ -474,9 +474,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
                 + BizConstant.TASK_FOLDER_PATH_MID_REASONING + BizConstant.TASK_FOLDER_PATH_TRAIL_ENHANCEMENT + processBo.getId() + "/";
             resultPath = resultPath.replaceAll("//", "/");
             // create AlgorithmDataProcess 创建数据处理
-            String finallyParams = buildFinallyParams(taskDto.getReasoningDataEnhancement().getParams(), reasoningDataFolderPath, resultPath);
+//            String finallyParams = buildFinallyParams(taskDto.getReasoningDataEnhancement().getParams(), reasoningDataFolderPath, resultPath);
             processBo.setResultPath(resultPath);
-            processBo.setParameters(finallyParams);
+            processBo.setParameters(taskDto.getReasoningDataEnhancement().getParams());
             processBo.setLog(resultPath+BizConstant.TASK_FOLDER_LOG_PATH);
             processService.update(processBo);
             returnList.add(resultPath);
@@ -530,9 +530,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
                 + BizConstant.TASK_FOLDER_PATH_MID_TRAIN + BizConstant.TASK_FOLDER_PATH_TRAIL_ENHANCEMENT + processBo.getId() + "/";
             resultPath = resultPath.replaceAll("//", "/");
             // create AlgorithmDataProcess 创建数据处理
-            String finallyParams = buildFinallyParams(taskDto.getTrainDataEnhancement().getParams(), trainDataFolderPath, resultPath);
+//            String finallyParams = buildFinallyParams(taskDto.getTrainDataEnhancement().getParams(), trainDataFolderPath, resultPath);
             processBo.setResultPath(resultPath);
-            processBo.setParameters(finallyParams);
+            processBo.setParameters(taskDto.getTrainDataEnhancement().getParams());
             processBo.setLog(resultPath+BizConstant.TASK_FOLDER_LOG_PATH);
             processService.update(processBo);
             returnList.add(resultPath);
@@ -564,9 +564,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
                 String resultPath = BizConstant.TASK_FOLDER_PATH_HEAD + algorithmTask.getId()
                     + BizConstant.TASK_FOLDER_PATH_MID_TRAIN + BizConstant.TASK_FOLDER_PATH_TRAIL_RESULT + algorithmBizProcessBo.getId() + "/";
                 resultPath = resultPath.replaceAll("//", "/");
-                String finallyParams = buildFinallyParams(dto.getParams(), trainDataFolderPath, resultPath);
+//                String finallyParams = buildFinallyParams(dto.getParams(), trainDataFolderPath, resultPath);
                 algorithmBizProcessBo.setResultPath(resultPath);
-                algorithmBizProcessBo.setParameters(finallyParams);
+                algorithmBizProcessBo.setParameters(dto.getParams());
                 algorithmBizProcessBo.setLog(resultPath+BizConstant.TASK_FOLDER_LOG_PATH);
                 bizProcessService.update(algorithmBizProcessBo);
                 index++;
@@ -594,9 +594,9 @@ public class AlgorithmTaskServiceImpl extends BaseServiceImpl<AlgorithmTaskMappe
             String resultPath = BizConstant.TASK_FOLDER_PATH_HEAD + algorithmTask.getId()
                 + BizConstant.TASK_FOLDER_PATH_MID_TRAIN + BizConstant.TASK_FOLDER_PATH_TRAIL_EXPANSION + processBo.getId() + "/";
             resultPath = resultPath.replaceAll("//", "/");
-            String finallyParams = buildFinallyParams(taskDto.getTrainDataExpansion().getParams(), trainDataFolderPath, resultPath);
+//            String finallyParams = buildFinallyParams(taskDto.getTrainDataExpansion().getParams(), trainDataFolderPath, resultPath);
             processBo.setResultPath(resultPath);
-            processBo.setParameters(finallyParams);
+            processBo.setParameters(taskDto.getTrainDataExpansion().getParams());
             processBo.setLog(resultPath+BizConstant.TASK_FOLDER_LOG_PATH);
             processService.update(processBo);
             returnList.add(resultPath);

+ 1 - 1
taais-modules/taais-biz/src/main/resources/mapper/ag/AlgorithmConfigMapper.xml

@@ -4,7 +4,7 @@
     "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.taais.biz.mapper.AlgorithmConfigMapper">
 
-    <select id="getOption">
+    <select id="getOption" resultType="Map">
         select id, algorithm_name as name from algorithm_config
     </select>
 </mapper>

+ 1 - 1
taais-modules/taais-biz/src/main/resources/mapper/task/AlgorithmSubtaskMapper.xml

@@ -23,7 +23,7 @@
     </resultMap>
 
 <select id="getFirstNeedProcessSubtask" parameterType="Long" resultMap="AlgorithmSubtaskResultMap">
-    select * from algorithm_subtask t where t.task_id = #{id} and t.status = '1' order by t.index asc limit 1
+    select * from algorithm_subtask t where t.task_id = #{id} and t.status = '0' order by t.index asc limit 1
 </select>
 <select id="getSubtaskByTaskId" parameterType="Long" resultMap="AlgorithmSubtaskResultMap">
     select * from algorithm_subtask t where t.task_id = #{taskId} order by index asc

+ 1 - 1
taais-modules/taais-biz/src/main/resources/mapper/task/AlgorithmTaskMapper.xml

@@ -18,6 +18,6 @@
         <result property="remarks" column="remarks" />
     </resultMap>
 <select id="getLastTask" resultMap="AlgorithmTaskResultMap">
-    select * from algorithm_task t where t.status = "1" and order by t.id asc limit 1
+    select * from algorithm_task t where t.status = '0' order by t.id asc limit 1
 </select>
 </mapper>