allen 10 miesięcy temu
rodzic
commit
b6e33d70c4

+ 56 - 0
script/nginx.conf

@@ -0,0 +1,56 @@
+worker_processes  1;
+
+events {
+    worker_connections  1024;
+}
+
+http {
+    include       mime.types;
+    default_type  application/octet-stream;
+    sendfile        on;
+    keepalive_timeout  65;
+
+    # 开启gzip压缩
+    gzip on;
+    # 不压缩临界值,大于1K的才压缩,一般不用改
+    gzip_min_length 1k;
+    # 压缩缓冲区
+    gzip_buffers 16 64K;
+    # 压缩版本(默认1.1,前端如果是squid2.5请使用1.0)
+    gzip_http_version 1.1;
+    # 压缩级别,1-10,数字越大压缩的越好,时间也越长
+    gzip_comp_level 5;
+    # 进行压缩的文件类型
+    gzip_types text/plain application/x-javascript text/css application/xml application/javascript;
+    # 跟Squid等缓存服务有关,on的话会在Header里增加"Vary: Accept-Encoding"
+    gzip_vary on;
+    # IE6对Gzip不怎么友好,不给它Gzip了
+    gzip_disable "MSIE [1-6]\.";
+    # 设置上传文件大小限制为100MB
+    client_max_body_size 4000M;
+
+    server {
+        listen       80;
+        server_name  localhost;
+		charset utf-8;
+
+		location / {
+            root   /home/zxt/soft/taais-ui/;
+			try_files $uri $uri/ /index.html;
+            index  index.html index.htm;
+        }
+
+		location /prod-api/ {
+			proxy_set_header Host $http_host;
+			proxy_set_header X-Real-IP $remote_addr;
+			proxy_set_header REMOTE-HOST $remote_addr;
+			proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+			proxy_pass http://localhost:9090/;
+		}
+
+        error_page   500 502 503 504  /50x.html;
+        location = /50x.html {
+            root   html;
+        }
+    }
+}

+ 50 - 10
taais-admin/src/main/resources/application-prod.yml

@@ -19,9 +19,9 @@ spring:
       keepaliveTime: 30000
 mybatis-flex:
   # sql审计
-  audit_enable: false
+  audit_enable: true
   # sql打印
-  sql_print: false
+  sql_print: true
   datasource:
     # 数据源-1
     ds1:
@@ -64,7 +64,7 @@ spring.data:
     # 数据库索引
     database: 0
     # 密码(如没有密码请注释掉)
-    # password:
+    password: CWwYsGjafmv8Sr7g
     # 连接超时时间
     timeout: 10s
     # 是否开启ssl
@@ -74,17 +74,17 @@ redisson:
   # redis key前缀
   keyPrefix: taais
   # 线程池数量
-  threads: 16
+  threads: 4
   # Netty线程池数量
-  nettyThreads: 32
+  nettyThreads: 8
   # 单节点配置
   singleServerConfig:
     # 客户端名称
     clientName: ${taais.name}
     # 最小空闲连接数
-    connectionMinimumIdleSize: 32
+    connectionMinimumIdleSize: 8
     # 连接池大小
-    connectionPoolSize: 64
+    connectionPoolSize: 32
     # 连接空闲超时,单位:毫秒
     idleConnectionTimeout: 10000
     # 命令等待超时,单位:毫秒
@@ -95,7 +95,7 @@ redisson:
 --- # 监控中心客户端配置
 spring.boot.admin.client:
   # 增加客户端开关
-  enabled: true
+  enabled: false
   url: http://localhost:9090/admin
   instance:
     service-host-type: IP
@@ -106,9 +106,9 @@ spring.boot.admin.client:
 powerjob:
   worker:
     # 如何开启调度中心请查看文档教程
-    enabled: true
+    enabled: false
     # 需要先在 powerjob 登录页执行应用注册后才能使用
-    app-name: taais-worker
+    app-name: taais
     # 28080 端口 随着主应用端口飘逸 避免集群冲突
     port: 2${server.port}
     protocol: http
@@ -117,3 +117,43 @@ powerjob:
     allow-lazy-connect-server: false
     max-appended-wf-context-length: 4096
     max-result-length: 4096
+
+--- # sms 短信 支持 华为 阿里云 腾讯云 等等各式各样的短信服务商
+# https://sms4j.com/doc3/ 文档地址 各个厂商可同时使用
+sms:
+  # 标注从yml读取配置
+  config-type: yaml
+  is-print: true
+  blends:
+    # 自定义的标识,也就是configId这里可以是任意值(最好不要是中文)
+    tx1:
+      #厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
+      supplier: tencent
+      #您的accessKey
+      access-key-id: 您的accessKey
+      #您的accessKeySecret
+      access-key-secret: 您的accessKeySecret
+      #您的短信签名
+      signature: 您的短信签名
+      #模板ID 非必须配置,如果使用sendMessage的快速发送需此配置
+      template-id: xxxxxxxx
+      #短信自动重试间隔时间  默认五秒
+      retry-interval: 5
+      # 短信重试次数,默认0次不重试,如果你需要短信重试则根据自己的需求修改值即可
+      max-retries: 0
+      #您的sdkAppId
+      sdk-app-id: 您的sdkAppId
+    # 自定义的标识,也就是configId这里可以是任意值(最好不要是中文)
+    tx2:
+      #厂商标识,标定此配置是哪个厂商,详细请看厂商标识介绍部分
+      supplier: tencent
+      #您的accessKey
+      access-key-id: 您的accessKey
+      #您的accessKeySecret
+      access-key-secret: 您的accessKeySecret
+      #您的短信签名
+      signature: 您的短信签名
+      #模板ID 非必须配置,如果使用sendMessage的快速发送需此配置
+      template-id: xxxxxxxx
+      #您的sdkAppId
+      sdk-app-id: 您的sdkAppId

+ 2 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/mapper/AlgorithmBizProcessMapper.java

@@ -19,5 +19,7 @@ public interface AlgorithmBizProcessMapper extends BaseMapper<AlgorithmBizProces
 
     void updateTaskAndSubtask(@Param("bizId") Long bizId, @Param("bizType") String bizType);
 
+    List<AlgorithmBizProcessVo> getStatus0ProcessBySubtaskId(Long subtaskId);
+
     List<AlgorithmBizProcessVo> getProcessBySubtaskId(Long subtaskId);
 }

+ 4 - 0
taais-modules/taais-biz/src/main/java/com/taais/biz/service/IAlgorithmBizProcessService.java

@@ -67,6 +67,9 @@ public interface IAlgorithmBizProcessService extends IBaseService<AlgorithmBizPr
      */
     boolean deleteByIds(Long[] ids);
 
+    List<AlgorithmBizProcessVo> getStatus0ProcessBySubtaskId(Long subtaskId);
+
+
     List<AlgorithmBizProcessVo> getProcessBySubtaskId(Long subtaskId);
 
     String taskResult(TaskResultDTO resultDTO);
@@ -74,4 +77,5 @@ public interface IAlgorithmBizProcessService extends IBaseService<AlgorithmBizPr
     TranResultDto getTranResult(Long subtaskId);
 
     TestResultDto getTestResult(Long subtaskId) throws IOException;
+
 }

+ 4 - 2
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/AlgorithmBizProcessServiceImpl.java

@@ -2,7 +2,6 @@ package com.taais.biz.service.impl;
 
 import java.io.IOException;
 import java.util.*;
-import java.util.stream.Collector;
 
 import cn.hutool.core.util.ObjectUtil;
 import com.mybatisflex.core.paginate.Page;
@@ -151,7 +150,10 @@ public class AlgorithmBizProcessServiceImpl extends BaseServiceImpl<AlgorithmBiz
         return this.removeByIds(Arrays.asList(ids));
     }
 
-    @Override
+    public List<AlgorithmBizProcessVo> getStatus0ProcessBySubtaskId(Long subtaskId) {
+        return mapper.getStatus0ProcessBySubtaskId(subtaskId);
+    }
+
     public List<AlgorithmBizProcessVo> getProcessBySubtaskId(Long subtaskId) {
         return mapper.getProcessBySubtaskId(subtaskId);
     }

+ 12 - 8
taais-modules/taais-biz/src/main/java/com/taais/biz/service/impl/AlgorithmSubtaskServiceImpl.java

@@ -181,7 +181,7 @@ public class AlgorithmSubtaskServiceImpl extends BaseServiceImpl<AlgorithmSubtas
 //            // 算法调用
 //            } else if ("3".equals(firstNeedProcessSubtask.getType())) {
             // error branch
-                List<AlgorithmBizProcessVo> bizProcessVoList = bizProcessService.getProcessBySubtaskId(firstNeedProcessSubtask.getId());
+                List<AlgorithmBizProcessVo> bizProcessVoList = bizProcessService.getStatus0ProcessBySubtaskId(firstNeedProcessSubtask.getId());
                 bizProcess(bizProcessVoList);
 //            } else {
 //                log.warn("type is wrong, type: {}", firstNeedProcessSubtask.getType());
@@ -229,7 +229,7 @@ public class AlgorithmSubtaskServiceImpl extends BaseServiceImpl<AlgorithmSubtas
             algorithmRequestDto.setBizId(bizProcessVo.getId());
             algorithmRequestDto.setSourcePath(BizConstant.DOCKER_BASE_PATH + preprocessPath);
             algorithmRequestDto.setResultPath(BizConstant.DOCKER_BASE_PATH + resultPath);
-            algorithmRequestDto.setLogPath(bizProcessVo.getLog());
+            algorithmRequestDto.setLogPath(BizConstant.DOCKER_BASE_PATH + bizProcessVo.getLog());
             Gson gson = new Gson();
             Type listType = new TypeToken<List<AlgorithmConfigParamDto>>() {}.getType();
             if (StringUtils.isNotEmpty(parameters)) {
@@ -238,14 +238,14 @@ public class AlgorithmSubtaskServiceImpl extends BaseServiceImpl<AlgorithmSubtas
                 if (model == null) {
                     log.error("模型配置未找到!!!modelId:{}", modelId);
                     errorMsg.add("模型配置未找到!!!");
-                } else {
-                    SysOssVo modelOss = ossService.getById(Long.valueOf(model.getModelAddress()));
-                    otherParams.put("pretrained_model", BizConstant.DOCKER_BASE_PATH + StringUtils.substringAfter(modelOss.getFileName(), Constants.RESOURCE_PREFIX));
                     // 找到训练的模型地址
                     String trainModelPath = mapper.getTrainModelPath(bizProcessVo.getId());
                     if (StringUtils.isNotEmpty(trainModelPath)){
                         otherParams.put("weight_path", BizConstant.DOCKER_BASE_PATH + trainModelPath + BizConstant.DOCKER_PT_PATH);
                     }
+                } else {
+                    SysOssVo modelOss = ossService.getById(Long.valueOf(model.getModelAddress()));
+                    otherParams.put("pretrained_model", BizConstant.DOCKER_BASE_PATH + StringUtils.substringAfter(modelOss.getFileName(), Constants.RESOURCE_PREFIX));
                 }
                 for (AlgorithmConfigParamDto algorithmConfigParamDto : paramDtoList) {
                     String value = StringUtils.isNotEmpty(algorithmConfigParamDto.getValue()) ? algorithmConfigParamDto.getValue() : algorithmConfigParamDto.getDefaultValue();
@@ -258,17 +258,17 @@ public class AlgorithmSubtaskServiceImpl extends BaseServiceImpl<AlgorithmSubtas
                 algorithmRequestDto.setOtherParams(otherParams);
             }
             String httpResult = null;
+            Mono<String> response = null;
             if (StringUtils.isEmpty(url)) {
                 errorMsg.add("url是空!!!");
             } else {
                 log.info("http post url:{},body:{}", url,algorithmRequestDto);
                 WebClient webClient = webClientBuilder.build();
-                Mono<String> response = webClient.post()
+                response = webClient.post()
                     .uri(url)
                     .bodyValue(algorithmRequestDto)
                     .retrieve()
                     .bodyToMono(String.class);
-                httpResult = response.block();
             }
             // process httpResult
             log.info("httpResult:{}", httpResult);
@@ -276,12 +276,16 @@ public class AlgorithmSubtaskServiceImpl extends BaseServiceImpl<AlgorithmSubtas
             AlgorithmBizProcess algorithmBizProcess = MapstructUtils.convert(bizProcessVo, AlgorithmBizProcess.class);
             if (errorMsg.length() != 0) {
                 algorithmBizProcess.setStatus(BizConstant.TASK_STATUS_FAILED);
-                algorithmBizProcess.setLog(errorMsg.toString());
+                algorithmBizProcess.setRemarks(errorMsg.toString());
             } else {
                 algorithmBizProcess.setStatus(BizConstant.TASK_STATUS_PROCESSING);
                 algorithmBizProcess.setStartTime(new Date());
             }
             bizProcessService.updateById(algorithmBizProcess);
+            if (response != null) {
+                httpResult = response.block();
+                log.info("bizProcess id: {} http response {}", bizProcessVo.getId(), httpResult);
+            }
         }
     }
 

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

@@ -29,7 +29,11 @@
         call update_task_and_subtask(#{bizId,jdbcType=INTEGER,mode=IN}, #{bizType,jdbcType=VARCHAR,mode=IN})
     </update>
 
-    <select id="getProcessBySubtaskId" resultMap="AlgorithmBizProcessResultMap">
+    <select id="getStatus0ProcessBySubtaskId" resultMap="AlgorithmBizProcessResultMap">
         select * from algorithm_biz_process where sub_task_id = #{value} and status = '0' order by index asc
     </select>
+
+    <select id="getProcessBySubtaskId" resultMap="AlgorithmBizProcessResultMap">
+        select * from algorithm_biz_process where sub_task_id = #{value} order by index asc
+    </select>
 </mapper>