Browse Source

update tianshu-v3.0

tags/V3.0
enlin 2 years ago
parent
commit
a6b13eac78
100 changed files with 2270 additions and 191 deletions
  1. +3
    -1
      dubhe-server/.gitignore
  2. +2
    -2
      dubhe-server/README.md
  3. +3
    -3
      dubhe-server/admin/src/main/java/org/dubhe/admin/domain/dto/ResourceSpecsCreateDTO.java
  4. +3
    -3
      dubhe-server/admin/src/main/java/org/dubhe/admin/domain/dto/ResourceSpecsQueryDTO.java
  5. +3
    -3
      dubhe-server/admin/src/main/java/org/dubhe/admin/domain/dto/ResourceSpecsUpdateDTO.java
  6. +46
    -0
      dubhe-server/admin/src/main/java/org/dubhe/admin/rest/MinIoController.java
  7. +9
    -1
      dubhe-server/admin/src/main/java/org/dubhe/admin/rest/UserController.java
  8. +31
    -0
      dubhe-server/admin/src/main/java/org/dubhe/admin/service/MinIoService.java
  9. +3
    -0
      dubhe-server/admin/src/main/java/org/dubhe/admin/service/UserService.java
  10. +1
    -0
      dubhe-server/admin/src/main/java/org/dubhe/admin/service/impl/MenuServiceImpl.java
  11. +70
    -0
      dubhe-server/admin/src/main/java/org/dubhe/admin/service/impl/MinIoServiceImpl.java
  12. +24
    -0
      dubhe-server/admin/src/main/java/org/dubhe/admin/service/impl/UserServiceImpl.java
  13. +6
    -2
      dubhe-server/admin/src/main/resources/bootstrap.yml
  14. +17
    -0
      dubhe-server/admin/src/test/java/org/dubhe/admin/AdminApplicationTests.java
  15. +0
    -0
      dubhe-server/auth/src/main/java/org/dubhe/auth/exception/AuthenticationProviderImpl.java
  16. +0
    -0
      dubhe-server/auth/src/main/java/org/dubhe/auth/exception/CustomerOauthException.java
  17. +0
    -0
      dubhe-server/auth/src/main/java/org/dubhe/auth/exception/CustomerOauthExceptionSerializer.java
  18. +0
    -0
      dubhe-server/auth/src/main/java/org/dubhe/auth/exception/CustomerOauthWebResponseExceptionTranslator.java
  19. +2
    -2
      dubhe-server/auth/src/main/resources/bootstrap.yml
  20. +17
    -0
      dubhe-server/auth/src/test/java/org/dubhe/auth/AuthApplicationTests.java
  21. +13
    -0
      dubhe-server/common-biz/base/pom.xml
  22. +5
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/constant/ApplicationNameConst.java
  23. +2
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/constant/MagicNumConstant.java
  24. +1
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/constant/Permissions.java
  25. +7
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/constant/StringConstant.java
  26. +37
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/context/EncryptVisUser.java
  27. +36
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/PtImageIdDTO.java
  28. +36
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/PtImageIdsDTO.java
  29. +5
    -1
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/PtImageQueryUrlDTO.java
  30. +35
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/PtModelBranchQueryByIdsDTO.java
  31. +3
    -3
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/QueryResourceSpecsDTO.java
  32. +35
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/TrainAlgorithmSelectByNameDTO.java
  33. +9
    -1
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/enums/BizEnum.java
  34. +7
    -3
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/enums/ImageTypeEnum.java
  35. +79
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/BaseUtils.java
  36. +44
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/CommandUtil.java
  37. +101
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/EncryptUtils.java
  38. +39
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/MapUtil.java
  39. +2
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/PtModelUtil.java
  40. +178
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/RSAUtil.java
  41. +6
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/ResultUtil.java
  42. +10
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/DatasetVO.java
  43. +49
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/LabelGroupBaseVO.java
  44. +4
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/ProgressVO.java
  45. +50
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/PtImageVO.java
  46. +20
    -5
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/PtModelInfoQueryVO.java
  47. +5
    -0
      dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/TrainAlgorithmQureyVO.java
  48. +1
    -1
      dubhe-server/common-biz/data-permission/src/main/java/org/dubhe/biz/permission/interceptor/PaginationInterceptor.java
  49. +5
    -1
      dubhe-server/common-biz/log/src/main/java/org/dubhe/biz/log/enums/LogEnum.java
  50. +8
    -0
      dubhe-server/common-biz/redis/src/main/java/org/dubhe/biz/redis/utils/RedisUtils.java
  51. +0
    -0
      dubhe-server/common-cloud/auth-config/src/main/java/org/dubhe/cloud/authconfig/exception/handler/CustomerAccessDeniedHandler.java
  52. +0
    -0
      dubhe-server/common-cloud/auth-config/src/main/java/org/dubhe/cloud/authconfig/exception/handler/CustomerTokenExceptionEntryPoint.java
  53. +4
    -4
      dubhe-server/common-cloud/configuration/src/main/resources/bootstrap-cloud-dev.yml
  54. +4
    -4
      dubhe-server/common-cloud/configuration/src/main/resources/bootstrap-cloud-open-dev.yml
  55. +2
    -2
      dubhe-server/common-cloud/configuration/src/main/resources/bootstrap-cloud-test.yml
  56. +43
    -0
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/api/ModelServiceApi.java
  57. +207
    -0
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/api/impl/ModelServiceApiImpl.java
  58. +2
    -0
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/api/impl/ModelServingApiImpl.java
  59. +20
    -33
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/config/K8sConfig.java
  60. +2
    -0
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/constant/K8sParamConstants.java
  61. +97
    -0
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/domain/bo/ModelServiceBO.java
  62. +14
    -4
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/domain/bo/PrometheusMetricBO.java
  63. +3
    -0
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/domain/resource/BizContainerStatus.java
  64. +39
    -0
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/domain/vo/ModelServiceVO.java
  65. +9
    -1
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/enums/BusinessLabelServiceNameEnum.java
  66. +13
    -25
      dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/utils/K8sUtils.java
  67. +5
    -4
      dubhe-server/common-k8s/src/main/resources/kubeconfig_dev
  68. +4
    -4
      dubhe-server/common-k8s/src/main/resources/kubeconfig_pre
  69. +4
    -4
      dubhe-server/common-k8s/src/main/resources/kubeconfig_prod
  70. +4
    -4
      dubhe-server/common-k8s/src/main/resources/kubeconfig_test
  71. +4
    -0
      dubhe-server/common-recycle/src/main/java/org/dubhe/recycle/config/RecycleConfig.java
  72. +2
    -1
      dubhe-server/common-recycle/src/main/java/org/dubhe/recycle/enums/RecycleModuleEnum.java
  73. +10
    -2
      dubhe-server/common-recycle/src/main/java/org/dubhe/recycle/enums/RecycleResourceEnum.java
  74. +1
    -1
      dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/dao/PtTrainAlgorithmMapper.java
  75. +1
    -3
      dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/domain/dto/PtTrainAlgorithmCreateDTO.java
  76. +0
    -3
      dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/domain/dto/PtTrainAlgorithmQueryDTO.java
  77. +1
    -12
      dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/domain/entity/PtTrainAlgorithm.java
  78. +0
    -6
      dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/domain/vo/PtTrainAlgorithmQueryVO.java
  79. +24
    -5
      dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/rest/PtTrainAlgorithmController.java
  80. +25
    -0
      dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/service/PtTrainAlgorithmService.java
  81. +107
    -22
      dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/service/impl/PtTrainAlgorithmServiceImpl.java
  82. +6
    -2
      dubhe-server/dubhe-algorithm/src/main/resources/bootstrap.yml
  83. +6
    -1
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/constant/DcmConstant.java
  84. +16
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/dao/DataMedicineFileMapper.java
  85. +11
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/dao/DataMedicineMapper.java
  86. +15
    -1
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/domain/dto/MedicineAutoAnnotationDTO.java
  87. +4
    -4
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/domain/entity/DataMedicine.java
  88. +32
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/domain/vo/DataMedicineSmallVO.java
  89. +6
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/domain/vo/DataMedicineVO.java
  90. +11
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/enums/DcmDataStateEnum.java
  91. +24
    -3
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/enums/DcmFileStateEnum.java
  92. +14
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/state/specific/datamedicine/AnnotationCompleteDcmState.java
  93. +14
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/state/specific/datamedicine/AnnotationDataState.java
  94. +14
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/state/specific/datamedicine/AutoAnnotationCompleteDcmState.java
  95. +0
    -4
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/statemachine/DcmDataMedicineStateMachine.java
  96. +129
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/utils/DcmStateIdentifyUtil.java
  97. +67
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/utils/identify/data/DcmDataHub.java
  98. +56
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/utils/identify/setting/DcmStateIdentifySetting.java
  99. +106
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/utils/identify/setting/DcmStateSelect.java
  100. +16
    -0
      dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/rest/DataMedicineController.java

+ 3
- 1
dubhe-server/.gitignore View File

@@ -48,4 +48,6 @@ output/
.project
.classpath
logs/
*.log
*.log

kubeconfig_test

+ 2
- 2
dubhe-server/README.md View File

@@ -11,8 +11,8 @@ Nacos + Fegin + Gateway + (Spring Security + JWT + OAuth2)

初始化sql位置 /sql

**地址:** 127.0.0.1:3306
**用户名:** test **密码:** test
**地址:** 10.5.29.66:3306
**用户名:** test **密码:** zj12345678

### Nacos



+ 3
- 3
dubhe-server/admin/src/main/java/org/dubhe/admin/domain/dto/ResourceSpecsCreateDTO.java View File

@@ -42,10 +42,10 @@ public class ResourceSpecsCreateDTO implements Serializable {
@Pattern(regexp = StringConstant.REGEXP_SPECS, message = "规格名称支持字母、数字、汉字、英文横杠、下划线和空白字符")
private String specsName;

@ApiModelProperty(value = "所属业务场景(0:通用,1:dubhe-notebook,2:dubhe-train,3:dubhe-serving, 4:dubhe-tadl)", required = true)
@ApiModelProperty(value = "所属业务场景(0:通用,1:dubhe-notebook,2:dubhe-train,3:dubhe-serving, 4:dubhe-tadl, 5:dubhe-point-cloud,6:data-annotation,7:atlas)", required = true)
@NotNull(message = "所属业务场景不能为空")
@Min(value = MagicNumConstant.ZERO, message = "所属业务场景错误")
@Max(value = MagicNumConstant.FOUR, message = "所属业务场景错误")
@Max(value = MagicNumConstant.SEVEN, message = "所属业务场景错误")
private Integer module;

@ApiModelProperty(value = "CPU数量,单位:核", required = true)
@@ -71,4 +71,4 @@ public class ResourceSpecsCreateDTO implements Serializable {
@Min(value = MagicNumConstant.ZERO, message = "工作空间的存储配额不能小于0")
@Max(value = MagicNumConstant.TWO_BILLION, message = "工作空间的存储配额超限")
private Integer workspaceRequest;
}
}

+ 3
- 3
dubhe-server/admin/src/main/java/org/dubhe/admin/domain/dto/ResourceSpecsQueryDTO.java View File

@@ -47,8 +47,8 @@ public class ResourceSpecsQueryDTO extends PageQueryBase implements Serializable
@ApiModelProperty("规格类型(0为CPU, 1为GPU)")
private Boolean resourcesPoolType;

@ApiModelProperty("所属业务场景(0:通用,1:dubhe-notebook,2:dubhe-train,3:dubhe-serving,4:dubhe-tadl)")
@ApiModelProperty("所属业务场景(0:通用,1:dubhe-notebook,2:dubhe-train,3:dubhe-serving,4:dubhe-tadl,5:dubhe-point-cloud,6:data-annotation,7:atlas)")
@Min(value = MagicNumConstant.ZERO, message = "所属业务场景错误")
@Max(value = MagicNumConstant.FOUR, message = "所属业务场景错误")
@Max(value = MagicNumConstant.SEVEN, message = "所属业务场景错误")
private Integer module;
}
}

+ 3
- 3
dubhe-server/admin/src/main/java/org/dubhe/admin/domain/dto/ResourceSpecsUpdateDTO.java View File

@@ -49,10 +49,10 @@ public class ResourceSpecsUpdateDTO implements Serializable {
@Pattern(regexp = StringConstant.REGEXP_SPECS, message = "规格名称支持字母、数字、汉字、英文横杠、下划线和空白字符")
private String specsName;

@ApiModelProperty(value = "所属业务场景(0:通用,1:dubhe-notebook,2:dubhe-train,3:dubhe-serving, 4:dubhe-tadl)", required = true)
@ApiModelProperty(value = "所属业务场景(0:通用,1:dubhe-notebook,2:dubhe-train,3:dubhe-serving, 4:dubhe-tadl, 5:dubhe-point-cloud,6:data-annotation,7:atlas)", required = true)
@NotNull(message = "所属业务场景不能为空")
@Min(value = MagicNumConstant.ZERO, message = "所属业务场景错误")
@Max(value = MagicNumConstant.FOUR, message = "所属业务场景错误")
@Max(value = MagicNumConstant.SEVEN, message = "所属业务场景错误")
private Integer module;

@ApiModelProperty(value = "CPU数量,单位:核")
@@ -74,4 +74,4 @@ public class ResourceSpecsUpdateDTO implements Serializable {
@Min(value = MagicNumConstant.ZERO, message = "工作空间的存储配额不能小于0")
@Max(value = MagicNumConstant.TWO_BILLION, message = "工作空间的存储配额超限")
private Integer workspaceRequest;
}
}

+ 46
- 0
dubhe-server/admin/src/main/java/org/dubhe/admin/rest/MinIoController.java View File

@@ -0,0 +1,46 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.admin.rest;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.dubhe.admin.service.MinIoService;
import org.dubhe.biz.base.vo.DataResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
* @description minio 服务
* @date 2022-06-08
*/
@Api(tags = "系统:minio服务")
@RestController
@RequestMapping("/minio")
public class MinIoController {

@Autowired
private MinIoService minIoService;

@ApiOperation("获取MinIO相关信息")
@GetMapping(value = "/info")
public DataResponseBody getMinIOInfo() {
return new DataResponseBody(minIoService.getMinIOInfo());
}

}

+ 9
- 1
dubhe-server/admin/src/main/java/org/dubhe/admin/rest/UserController.java View File

@@ -30,7 +30,9 @@ import org.dubhe.biz.base.context.UserContext;
import org.dubhe.biz.base.dto.UserDTO;
import org.dubhe.biz.base.vo.DataResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.core.Authentication;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@@ -121,7 +123,7 @@ public class UserController {

@ApiOperation("根据用户昵称搜索用户列表")
@GetMapping(value = "/findByNickName")
public DataResponseBody<List<UserDTO>> findByNickName(@RequestParam(value = "nickName",required = false) String nickName) {
public DataResponseBody<List<UserDTO>> findByNickName(@RequestParam(value = "nickName", required = false) String nickName) {
return new DataResponseBody(userService.findByNickName(nickName));
}

@@ -130,4 +132,10 @@ public class UserController {
public DataResponseBody<List<UserDTO>> getUserList(@RequestParam(value = "ids") List<Long> ids) {
return new DataResponseBody(userService.getUserList(ids));
}

@ApiOperation("见微平台专用")
@GetMapping("/decryptVisUser")
public DataResponseBody<String> encryptVisUser(Authentication authentication) {
return new DataResponseBody<>(userService.encryptUserForVis(authentication));
}
}

+ 31
- 0
dubhe-server/admin/src/main/java/org/dubhe/admin/service/MinIoService.java View File

@@ -0,0 +1,31 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.admin.service;

import java.util.Map;

/**
* @description minIo服务 service
* @date 2022-6-8
**/
public interface MinIoService {
/**
* 对minio 的账户密码进行加密操作
* @return Map<String,String> minio账户密码加密map
*/
Map<String,String> getMinIOInfo();
}

+ 3
- 0
dubhe-server/admin/src/main/java/org/dubhe/admin/service/UserService.java View File

@@ -26,6 +26,7 @@ import org.dubhe.biz.base.dto.TeamDTO;
import org.dubhe.biz.base.dto.UserDTO;
import org.dubhe.biz.base.vo.DataResponseBody;
import org.dubhe.cloud.authconfig.service.AdminUserService;
import org.springframework.security.core.Authentication;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@@ -239,4 +240,6 @@ public interface UserService extends AdminUserService, IService<User> {
* @return org.dubhe.admin.domain.vo.UserConfigCreateVO 用户配置 VO
*/
UserConfigCreateVO createOrUpdateUserConfig(UserConfigDTO userConfigDTO);
String encryptUserForVis(Authentication authentication);
}

+ 1
- 0
dubhe-server/admin/src/main/java/org/dubhe/admin/service/impl/MenuServiceImpl.java View File

@@ -384,6 +384,7 @@ public class MenuServiceImpl implements MenuService {
menuVo1.setComponent(menuVo.getComponent());
} else {
menuVo1.setPath(menuDTO.getPath());
menuVo1.setName(menuDTO.getComponentName());
}
menuVo.setName(null);
menuVo.setMeta(null);


+ 70
- 0
dubhe-server/admin/src/main/java/org/dubhe/admin/service/impl/MinIoServiceImpl.java View File

@@ -0,0 +1,70 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.admin.service.impl;

import org.dubhe.admin.service.MinIoService;
import org.dubhe.biz.base.constant.MagicNumConstant;
import org.dubhe.biz.base.exception.BusinessException;
import org.dubhe.biz.base.utils.RsaEncrypt;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

/**
* @description minIo服务 实现类
* @date 2022-06-08
*/
@Service
public class MinIoServiceImpl implements MinIoService {

/**
* minIO公钥
*/
@Value("${minio.accessKey}")
private String accessKey;

/**
* minIO私钥
*/
@Value("${minio.secretKey}")
private String secretKey;

/**
* 加密字符串
*/
@Value("${minio.url}")
private String url;

@Override
public Map<String, String> getMinIOInfo() {
try {
Map<String, String> keyPair = RsaEncrypt.genKeyPair();
String publicKey = RsaEncrypt.getPublicKey(keyPair);
String privateKey = RsaEncrypt.getPrivateKey(keyPair);
return new HashMap<String, String>(MagicNumConstant.FOUR) {{
put("url", RsaEncrypt.encrypt(url, publicKey));
put("accessKey", RsaEncrypt.encrypt(accessKey, publicKey));
put("secretKey", RsaEncrypt.encrypt(secretKey, publicKey));
put("privateKey", privateKey);
}};
} catch (Exception e) {
throw new BusinessException("MinIo info empty");
}
}
}

+ 24
- 0
dubhe-server/admin/src/main/java/org/dubhe/admin/service/impl/UserServiceImpl.java View File

@@ -47,6 +47,7 @@ import org.dubhe.admin.service.convert.UserConvert;
import org.dubhe.biz.base.constant.AuthConst;
import org.dubhe.biz.base.constant.ResponseCode;
import org.dubhe.biz.base.constant.UserConstant;
import org.dubhe.biz.base.context.EncryptVisUser;
import org.dubhe.biz.base.context.UserContext;
import org.dubhe.biz.base.dto.*;
import org.dubhe.biz.base.enums.BaseErrorCodeEnum;
@@ -55,6 +56,7 @@ import org.dubhe.biz.base.exception.BusinessException;
import org.dubhe.biz.base.exception.CaptchaException;
import org.dubhe.biz.base.utils.DateUtil;
import org.dubhe.biz.base.utils.Md5Util;
import org.dubhe.biz.base.utils.RSAUtil;
import org.dubhe.biz.base.utils.RandomUtil;
import org.dubhe.biz.base.utils.RsaEncrypt;
import org.dubhe.biz.base.vo.DataResponseBody;
@@ -73,6 +75,7 @@ import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cglib.beans.BeanMap;
import org.springframework.security.core.Authentication;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -81,6 +84,8 @@ import org.springframework.util.CollectionUtils;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.security.spec.InvalidKeySpecException;
import java.util.*;
import java.util.stream.Collectors;

@@ -109,6 +114,9 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
@Value("${user.config.gpu-limit}")
private Integer gpuLimit;

@Value("${vis.public_key}")
private String visPublicKey;

@Autowired
private UserMapper userMapper;

@@ -783,6 +791,22 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
return userConfigCreateVO;
}

@Override
public String encryptUserForVis(Authentication authentication) {
String encodeStr = "";
try {
JwtUserDTO jwtUser = (JwtUserDTO) authentication.getPrincipal();
EncryptVisUser visUser = new EncryptVisUser();
BeanUtils.copyProperties(jwtUser.getUser(), visUser);
encodeStr = RSAUtil.publicEncrypt(JSONObject.toJSONString(visUser), RSAUtil.getPublicKey(visPublicKey));
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (InvalidKeySpecException e) {
e.printStackTrace();
}
return encodeStr;
}


/**
* 校验验证码


+ 6
- 2
dubhe-server/admin/src/main/resources/bootstrap.yml View File

@@ -11,7 +11,7 @@ spring:
config:
enabled: true
server-addr: 127.0.0.1:8848
namespace: dubhe-server-cloud-prod
namespace: dubhe-prod
shared-configs[0]:
data-id: common-biz.yaml
group: dubhe
@@ -29,9 +29,13 @@ spring:
data-id: admin.yaml
group: dubhe
refresh: true
shared-configs[4]:
data-id: kubeconfig.yaml
group: dubhe
refresh: true
discovery:
enabled: true
namespace: dubhe-server-cloud-dev
namespace: dubhe-prod
group: dubhe
server-addr: 127.0.0.1:8848


+ 17
- 0
dubhe-server/admin/src/test/java/org/dubhe/admin/AdminApplicationTests.java View File

@@ -1,3 +1,20 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/

package org.dubhe.admin;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;


+ 0
- 0
dubhe-server/auth/src/main/java/org/dubhe/auth/exception/AuthenticationProviderImpl.java View File


+ 0
- 0
dubhe-server/auth/src/main/java/org/dubhe/auth/exception/CustomerOauthException.java View File


+ 0
- 0
dubhe-server/auth/src/main/java/org/dubhe/auth/exception/CustomerOauthExceptionSerializer.java View File


+ 0
- 0
dubhe-server/auth/src/main/java/org/dubhe/auth/exception/CustomerOauthWebResponseExceptionTranslator.java View File


+ 2
- 2
dubhe-server/auth/src/main/resources/bootstrap.yml View File

@@ -12,7 +12,7 @@ spring:
config:
enabled: true
server-addr: 127.0.0.1:8848
namespace: dubhe-server-cloud-prod
namespace: dubhe-prod
shared-configs[0]:
data-id: common-biz.yaml
group: dubhe
@@ -23,7 +23,7 @@ spring:
refresh: true
discovery:
enabled: true
namespace: dubhe-server-cloud-dev
namespace: dubhe-prod
group: dubhe
server-addr: 127.0.0.1:8848


+ 17
- 0
dubhe-server/auth/src/test/java/org/dubhe/auth/AuthApplicationTests.java View File

@@ -1,3 +1,20 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/

package org.dubhe.auth;

import org.junit.jupiter.api.Test;


+ 13
- 0
dubhe-server/common-biz/base/pom.xml View File

@@ -63,6 +63,19 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>1.2.70</version>
</dependency>

</dependencies>



+ 5
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/constant/ApplicationNameConst.java View File

@@ -94,4 +94,9 @@ public class ApplicationNameConst {
* 专业版终端
*/
public final static String TERMINAL = "dubhe-terminal";

/**
* 点云服务
*/
public final static String SERVER_POINT_CLOUD ="dubhe-point-cloud";
}

+ 2
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/constant/MagicNumConstant.java View File

@@ -37,6 +37,8 @@ public final class MagicNumConstant {
public static final int TEN = 10;

public static final int ELEVEN = 11;

public static final int TWELVE = 12;
public static final int SIXTEEN = 16;
public static final int TWENTY = 20;
public static final int TWENTY_TWO = 22;


+ 1
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/constant/Permissions.java View File

@@ -113,6 +113,7 @@ public final class Permissions {
public static final String IMAGE_UPLOAD = "hasAuthority('ROLE_training:image:upload')";
public static final String IMAGE_EDIT = "hasAuthority('ROLE_training:image:edit')";
public static final String IMAGE_DELETE = "hasAuthority('ROLE_training:image:delete')";
public static final String IMAGE_EDIT_DEFAULT = "hasAuthority('ROLE_training:image:editDefault')";

/**
* 度量管理


+ 7
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/constant/StringConstant.java View File

@@ -127,6 +127,13 @@ public final class StringConstant {
public static final String CACHE_TASK_NAME ="task_name";


public static final String DEFAULT_IMAGE_PROJECT ="dubhe";

/**
* python命令行参数格式
*/
public static final String PYTHON_COMMAND_PATTERN = " --%s=%s";

private StringConstant() {
}
}

+ 37
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/context/EncryptVisUser.java View File

@@ -0,0 +1,37 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.context;

import lombok.Data;

import java.time.Instant;

/**
* @description 见微平台加密用户信息
* @date 2022-07-28
*/
@Data
public class EncryptVisUser {

private Long id;

private String username;

private String phone;

private long timestamp = Instant.now().toEpochMilli();
}

+ 36
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/PtImageIdDTO.java View File

@@ -0,0 +1,36 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.dto;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.io.Serializable;

@Data
@Accessors(chain = true)
@EqualsAndHashCode
public class PtImageIdDTO {

/**
* 镜像ID
*/
@NotNull(message = "镜像ID不能为空")
private Long id;
}

+ 36
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/PtImageIdsDTO.java View File

@@ -0,0 +1,36 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.dto;

import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;
import java.util.List;

@Data
@Accessors(chain = true)
@EqualsAndHashCode
public class PtImageIdsDTO {

/**
* 镜像ID
*/
@NotNull(message = "镜像ID不能为空")
private List<Long> ids;
}

+ 5
- 1
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/PtImageQueryUrlDTO.java View File

@@ -20,6 +20,8 @@ import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import java.util.List;

/**
* @description 查询镜像路径
* @date 2020-12-14
@@ -35,6 +37,8 @@ public class PtImageQueryUrlDTO {

private String imageTag;

private Integer projectType;
private Boolean isDefault;

private List<Integer> imageTypes;

}

+ 35
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/PtModelBranchQueryByIdsDTO.java View File

@@ -0,0 +1,35 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.dto;

import lombok.Data;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;

@Data
public class PtModelBranchQueryByIdsDTO implements Serializable {

private static final long serialVersionUID = 1L;

/**
* 模型版本ID
*/
@NotEmpty(message = "模型版本ID列表不能为空")
private List<Long> ids;
}

+ 3
- 3
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/QueryResourceSpecsDTO.java View File

@@ -45,10 +45,10 @@ public class QueryResourceSpecsDTO implements Serializable {
private String specsName;

/**
* 所属业务场景(0:通用,1:dubhe-notebook,2:dubhe-train,3:dubhe-serving,4:dubhe-tadl)
* 所属业务场景(0:通用,1:dubhe-notebook,2:dubhe-train,3:dubhe-serving,4:dubhe-tadl, 5:dubhe-point-cloud,6:data-annotation,7:atlas)
*/
@NotNull(message = "所属业务场景不能为空")
@Min(value = MagicNumConstant.ZERO, message = "所属业务场景错误")
@Max(value = MagicNumConstant.FOUR, message = "所属业务场景错误")
@Max(value = MagicNumConstant.SEVEN, message = "所属业务场景错误")
private Integer module;
}
}

+ 35
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/dto/TrainAlgorithmSelectByNameDTO.java View File

@@ -0,0 +1,35 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.dto;

import lombok.Data;
import org.dubhe.biz.base.constant.MagicNumConstant;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;


@Data
public class TrainAlgorithmSelectByNameDTO implements Serializable {

private static final long serialVersionUID = 1L;

@Length(max = MagicNumConstant.THIRTY_TWO, message = "算法名称有误")
@NotBlank
private String algorithmName;
}

+ 9
- 1
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/enums/BizEnum.java View File

@@ -64,7 +64,15 @@ public enum BizEnum {
/**
* TADL
*/
TADL("TADL服务", "tadl", 8);
TADL("TADL服务", "tadl", 8),
/**
* POINT_CLOUD
*/
POINT_CLOUD("点云服务","pointcloud",9),
/**
* DATA
*/
DATA("数据服务","data",10);

/**
* 业务模块名称


+ 7
- 3
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/enums/ImageTypeEnum.java View File

@@ -47,7 +47,11 @@ public enum ImageTypeEnum {
/**
* terminal镜像
*/
TERMINAL("terminal镜像", "terminal", 3)
TERMINAL("terminal镜像", "terminal", 3),
/**
* 点云镜像
*/
POINT_CLOUD("点云镜像","pointCloud",4)
;

/**
@@ -59,7 +63,7 @@ public enum ImageTypeEnum {
*/
private String code;
/**
* 镜像项目类型
* 镜像用途
*/
private Integer type;

@@ -89,7 +93,7 @@ public enum ImageTypeEnum {
/**
* 根据type获取code
*
* @param type 镜像项目类型
* @param type 镜像用途
* @return String 镜像项目代码
*/
public static String getType(Integer type) {


+ 79
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/BaseUtils.java View File

@@ -0,0 +1,79 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.utils;

import com.google.common.collect.Lists;
import com.google.common.collect.Maps;

import javax.servlet.ServletRequest;
import java.util.Collections;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;

/**
* @description
* @date 2022-07-06
*/
public class BaseUtils {
/**
* 获取request 中的参数,以map形式返回
* @param request
* @return
*/
public static Map<String, Object> getParamMap(ServletRequest request) {
//Assert.notNull(request,"参数不能为空");
Map<String, Object> map = Maps.newHashMap();
Enumeration<String> en = request.getParameterNames();
while (en.hasMoreElements()) {
String name = en.nextElement();
String[] values = request.getParameterValues(name);
if (values == null || values.length == 0) {
continue;
}
String value = values[0];
if (value != null) {
map.put(name, value);
}
}
return map;
}

/**
* 把数组所有元素,按字母排序,然后按照“参数=参数值”的模式用“&”字符拼接成字符串
*
* @param param
* 需要签名的参数
* @return 签名的字符串
*/
public static String createLinkString(Map<String, Object> param) {
Map<String, Object> params = Maps.newHashMap();
params.putAll(param);
params.put("dev-name", "VMS");
params.put("project", "TIANSHU");
List<String> keys = Lists.newArrayList(params.keySet().iterator());
Collections.sort(keys);
StringBuilder signStr = new StringBuilder();
for (String key : keys) {
if (!StringUtils.isNotEmpty(params.get(key).toString())) {
continue;
}
signStr.append(key).append("=").append(params.get(key)).append("&");
}
return signStr.deleteCharAt(signStr.length() - 1).toString();
}
}

+ 44
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/CommandUtil.java View File

@@ -0,0 +1,44 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/

package org.dubhe.biz.base.utils;

import com.alibaba.fastjson.JSONObject;

import static org.dubhe.biz.base.constant.StringConstant.PYTHON_COMMAND_PATTERN;

/**
* @description 命令行工具类
* @date 2022-05-16
*/
public class CommandUtil {
/**
* 构造python运行命令
*
* @param runCommand
* @param runParams
* @return
*/
public static String buildPythonCommand(String runCommand, JSONObject runParams) {
StringBuilder sb = new StringBuilder();
sb.append(runCommand);
if (null != runParams && !runParams.isEmpty()) {
runParams.forEach((k, v) -> sb.append(String.format(PYTHON_COMMAND_PATTERN, k, v)));
}
return sb.toString();
}
}

+ 101
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/EncryptUtils.java View File

@@ -0,0 +1,101 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.utils;

import com.google.common.collect.Maps;

import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.IvParameterSpec;
import java.nio.charset.StandardCharsets;
import java.util.Map;

/**
* @description vms服务加解密工具类
* @date 2022-07-06
*/
public class EncryptUtils {
private static final String STR_PARAM = "Passw0rd";

private static Cipher cipher;

private static final IvParameterSpec IV = new IvParameterSpec(STR_PARAM.getBytes(StandardCharsets.UTF_8));

private static DESKeySpec getDesKeySpec(String source) throws Exception {
if (source == null || source.length() == 0) {
return null;
}
cipher = Cipher.getInstance("DES/CBC/PKCS5Padding");
String strKey = "Passw0rd";
return new DESKeySpec(strKey.getBytes(StandardCharsets.UTF_8));
}

/**
* 对称加密
*/
public static String desEncrypt(String source) throws Exception {
DESKeySpec desKeySpec = getDesKeySpec(source);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
cipher.init(Cipher.ENCRYPT_MODE, secretKey, IV);
return byte2hex(
cipher.doFinal(source.getBytes(StandardCharsets.UTF_8))).toUpperCase();
}

/**
* 对称解密
*/
public static String desDecrypt(String source) throws Exception {
byte[] src = hex2byte(source.getBytes(StandardCharsets.UTF_8));
DESKeySpec desKeySpec = getDesKeySpec(source);
SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
SecretKey secretKey = keyFactory.generateSecret(desKeySpec);
cipher.init(Cipher.DECRYPT_MODE, secretKey, IV);
byte[] retByte = cipher.doFinal(src);
return new String(retByte);
}

private static String byte2hex(byte[] inStr) {
String stmp;
StringBuilder out = new StringBuilder(inStr.length * 2);
for (byte b : inStr) {
stmp = Integer.toHexString(b & 0xFF);
if (stmp.length() == 1) {
// 如果是0至F的单位字符串,则添加0
out.append("0").append(stmp);
} else {
out.append(stmp);
}
}
return out.toString();
}

private static byte[] hex2byte(byte[] b) {
int size = 2;
if ((b.length % size) != 0) {
throw new IllegalArgumentException("长度不是偶数");
}
byte[] b2 = new byte[b.length / 2];
for (int n = 0; n < b.length; n += size) {
String item = new String(b, n, 2);
b2[n / 2] = (byte) Integer.parseInt(item, 16);
}
return b2;
}
}

+ 39
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/MapUtil.java View File

@@ -0,0 +1,39 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/


package org.dubhe.biz.base.utils;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;

import java.util.HashMap;
import java.util.Map;

/**
* @description Map工具类
* @date 2022-05-16
*/
public class MapUtil {
public static Map<String, String> convertJsonObject(JSONObject object) {
if (object == null) {
return new HashMap<>();
}
return JSONObject.parseObject(object.toJSONString(),
new TypeReference<Map<String, String>>(){});
}
}

+ 2
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/PtModelUtil.java View File

@@ -36,6 +36,8 @@ public class PtModelUtil {

public static final int NUMBER_EIGHT = 8;

public static final int NUMBER_THIRTY_TWO = 32;

public static final int NUMBER_ONE_HUNDRED_TWENTY_EIGHT = 128;

public static final int NUMBER_TWO_HUNDRED_FIFTY_FIVE = 255;


+ 178
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/RSAUtil.java View File

@@ -0,0 +1,178 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.utils;

import com.alibaba.fastjson.JSONObject;
import org.apache.commons.codec.binary.Base64;
import org.apache.commons.io.IOUtils;

import javax.crypto.Cipher;
import java.io.ByteArrayOutputStream;
import java.security.Key;
import java.security.KeyFactory;
import java.security.KeyPair;
import java.security.KeyPairGenerator;
import java.security.NoSuchAlgorithmException;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.time.Instant;
import java.util.HashMap;
import java.util.Map;


/**
* @Desc RSA 非对称加密
* @Author MrAshin
* @Date 2022-07-27
*/
public class RSAUtil {

public static final String CHARSET = "UTF-8";
public static final String RSA_ALGORITHM = "RSA";

/**
* 生成公钥和私钥
* @param keySize
* @return
*/
public static Map<String, String> createKeys(int keySize) {
//为RSA算法创建一个KeyPairGenerator对象
KeyPairGenerator kpg;
try {
kpg = KeyPairGenerator.getInstance(RSA_ALGORITHM);
} catch (NoSuchAlgorithmException e) {
throw new IllegalArgumentException("No such algorithm-->[" + RSA_ALGORITHM + "]");
}

//初始化KeyPairGenerator对象,密钥长度
kpg.initialize(keySize);
//生成密匙对
KeyPair keyPair = kpg.generateKeyPair();
//得到公钥
Key publicKey = keyPair.getPublic();
String publicKeyStr = Base64.encodeBase64URLSafeString(publicKey.getEncoded());
//得到私钥
Key privateKey = keyPair.getPrivate();
String privateKeyStr = Base64.encodeBase64URLSafeString(privateKey.getEncoded());
Map<String, String> keyPairMap = new HashMap<String, String>();
keyPairMap.put("publicKey", publicKeyStr);
keyPairMap.put("privateKey", privateKeyStr);

return keyPairMap;
}

/**
* 得到公钥
* @param publicKey 密钥字符串(经过base64编码)
* @throws Exception
*/
public static RSAPublicKey getPublicKey(String publicKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
//通过X509编码的Key指令获得公钥对象
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(Base64.decodeBase64(publicKey));
RSAPublicKey key = (RSAPublicKey) keyFactory.generatePublic(x509KeySpec);
return key;
}

/**
* 得到私钥
* @param privateKey 密钥字符串(经过base64编码)
* @throws Exception
*/
public static RSAPrivateKey getPrivateKey(String privateKey) throws NoSuchAlgorithmException, InvalidKeySpecException {
//通过PKCS#8编码的Key指令获得私钥对象
KeyFactory keyFactory = KeyFactory.getInstance(RSA_ALGORITHM);
PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(Base64.decodeBase64(privateKey));
RSAPrivateKey key = (RSAPrivateKey) keyFactory.generatePrivate(pkcs8KeySpec);
return key;
}

/**
* 公钥加密
* @param data
* @param publicKey
* @return
*/
public static String publicEncrypt(String data, RSAPublicKey publicKey) {
try {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.ENCRYPT_MODE, publicKey);
return Base64.encodeBase64URLSafeString(rsaSplitCodec(cipher, Cipher.ENCRYPT_MODE, data.getBytes(CHARSET), publicKey.getModulus().bitLength()));
} catch (Exception e) {
throw new RuntimeException("加密字符串[" + data + "]时遇到异常", e);
}
}

/**
* 私钥解密
* @param data
* @param privateKey
* @return
*/
public static String privateDecrypt(String data, RSAPrivateKey privateKey) {
try {
Cipher cipher = Cipher.getInstance(RSA_ALGORITHM);
cipher.init(Cipher.DECRYPT_MODE, privateKey);
return new String(rsaSplitCodec(cipher, Cipher.DECRYPT_MODE, Base64.decodeBase64(data), privateKey.getModulus().bitLength()), CHARSET);
} catch (Exception e) {
throw new RuntimeException("解密字符串[" + data + "]时遇到异常", e);
}
}


/**
* 分段加解密
* @param cipher
* @param opmode
* @param datas
* @param keySize
* @return
*/
private static byte[] rsaSplitCodec(Cipher cipher, int opmode, byte[] datas, int keySize) {
int maxBlock = 0;
if (opmode == Cipher.DECRYPT_MODE) {
maxBlock = keySize / 8;
} else {
maxBlock = keySize / 8 - 11;
}
ByteArrayOutputStream
out = new ByteArrayOutputStream();
int offSet = 0;
byte[] buff;
int i = 0;
try {
while (datas.length > offSet) {
if (datas.length - offSet > maxBlock) {
buff = cipher.doFinal(datas, offSet, maxBlock);
} else {
buff = cipher.doFinal(datas, offSet, datas.length - offSet);
}
out.write(buff, 0, buff.length);
i++;
offSet = i * maxBlock;
}
} catch (Exception e) {
throw new RuntimeException("加解密阀值为[" + maxBlock + "]的数据时发生异常", e);
}
byte[] resultDatas = out.toByteArray();
IOUtils.closeQuietly(out);
return resultDatas;
}
}

+ 6
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/utils/ResultUtil.java View File

@@ -57,4 +57,10 @@ public class ResultUtil {
throw new BusinessException(String.format(errorMessageTemplate, params));
}
}

public static void isTrue(Boolean object, String errorMessageTemplate, Object... params) {
if (!Boolean.TRUE.equals(object)) {
throw new BusinessException(String.format(errorMessageTemplate, params));
}
}
}

+ 10
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/DatasetVO.java View File

@@ -157,4 +157,14 @@ public class DatasetVO implements Serializable {
*/
private Integer fileCount;

/**
* 模板
*/
private Integer templateType;

/**
* 所属模块
*/
private Integer module;

}

+ 49
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/LabelGroupBaseVO.java View File

@@ -0,0 +1,49 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.vo;

import lombok.Data;

/**
* @description
* @date 2022/4/22
**/
@Data
public class LabelGroupBaseVO {
/**
* 标签组ID
*/
private Long id;

/**
* 标签组名称
*/
private String name;
/**
* 标签组类型:0: private 私有标签组, 1:public 公开标签组
*/
private Integer type;

/**
* 标签组描述
*/
private String remark;
/**
* 标签组类型
*/
private Integer labelGroupType;
}

+ 4
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/ProgressVO.java View File

@@ -47,5 +47,9 @@ public class ProgressVO implements Serializable {
private Long finishAutoTrack = MagicNumConstant.ZERO_LONG;
@Builder.Default
private Long annotationNotDistinguishFile = MagicNumConstant.ZERO_LONG;
@Builder.Default
private Long haveAnnotation = MagicNumConstant.ZERO_LONG;
@Builder.Default
private Long noAnnotation = MagicNumConstant.ZERO_LONG;

}

+ 50
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/PtImageVO.java View File

@@ -0,0 +1,50 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.biz.base.vo;

import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serializable;

@Data
@Accessors(chain = true)
public class PtImageVO implements Serializable {

private static final long serialVersionUID = 1L;

/**
* 镜像id
*/
private Long id;

/**
* 镜像名称
*/
private String name;

/**
* 镜像地址
*/
private String imageUrl;

/**
* 镜像版本
*/
private String tag;

}

+ 20
- 5
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/PtModelInfoQueryVO.java View File

@@ -55,11 +55,6 @@ public class PtModelInfoQueryVO implements Serializable {
*/
private String modelDescription;

/**
* 模型分类
*/
private String modelClassName;

/**
* 模型地址
*/
@@ -90,6 +85,11 @@ public class PtModelInfoQueryVO implements Serializable {
*/
private Long createUserId;

/**
* 创建人用户名
*/
private String createUserName;

/**
* 修改人ID
*/
@@ -124,4 +124,19 @@ public class PtModelInfoQueryVO implements Serializable {
* 是否能提供服务(true:能,false:否)
*/
private Boolean servingModel;

/**
* 炼制模型结构名称
*/
private String structName;

/**
* 炼制模型尺寸
*/
private Integer modelSize;

/**
* 模型分类(目标检测、目标分类)
*/
private String modelClassName;
}

+ 5
- 0
dubhe-server/common-biz/base/src/main/java/org/dubhe/biz/base/vo/TrainAlgorithmQureyVO.java View File

@@ -59,6 +59,11 @@ public class TrainAlgorithmQureyVO implements Serializable {
*/
private String imageName;

/**
* 环境镜像版本
*/
private String imageTag;

/**
* 代码目录
*/


+ 1
- 1
dubhe-server/common-biz/data-permission/src/main/java/org/dubhe/biz/permission/interceptor/PaginationInterceptor.java View File

@@ -87,7 +87,7 @@ public class PaginationInterceptor extends AbstractSqlParserHandler implements I
/**
* 单页限制 500 条,小于 0 如 -1 不受限制
*/
protected long limit = 500L;
protected long limit = -1L;
/**
* 数据类型
*/


+ 5
- 1
dubhe-server/common-biz/log/src/main/java/org/dubhe/biz/log/enums/LogEnum.java View File

@@ -78,10 +78,14 @@ public enum LogEnum {
MEASURE,
//云端Serving
SERVING,
//serving gateway
SERVING_GATEWAY,
//专业版终端
TERMINAL,
//tadl
TADL;
TADL,
//点云
POINT_CLOUD;

/**
* 判断日志类型不能为空


+ 8
- 0
dubhe-server/common-biz/redis/src/main/java/org/dubhe/biz/redis/utils/RedisUtils.java View File

@@ -52,6 +52,14 @@ public class RedisUtils {

// =============================common============================

/**
* 模糊删除 key
*/
public void del(String pattern){
Set<Object> keys = redisTemplate.keys(pattern);
redisTemplate.delete(keys);
}

/**
* 指定缓存失效时间
*


+ 0
- 0
dubhe-server/common-cloud/auth-config/src/main/java/org/dubhe/cloud/authconfig/exception/handler/CustomerAccessDeniedHandler.java View File


+ 0
- 0
dubhe-server/common-cloud/auth-config/src/main/java/org/dubhe/cloud/authconfig/exception/handler/CustomerTokenExceptionEntryPoint.java View File


+ 4
- 4
dubhe-server/common-cloud/configuration/src/main/resources/bootstrap-cloud-dev.yml View File

@@ -5,8 +5,8 @@ spring:
password: Tianshu
context-path: /nacos
config:
namespace: dubhe-server-cloud-dev
server-addr: 127.0.0.1:8848
namespace: dubhe-prod
server-addr: 10.105.1.132:8848
discovery:
namespace: dubhe-server-cloud-dev
server-addr: 127.0.0.1:8848
namespace: dubhe-prod
server-addr: 10.105.1.132:8848

+ 4
- 4
dubhe-server/common-cloud/configuration/src/main/resources/bootstrap-cloud-open-dev.yml View File

@@ -1,12 +1,12 @@
spring:
cloud:
nacos:
username: nacos
password: Tianshu
username: root
password: zjlab
context-path: /nacos
config:
namespace: dubhe-server-cloud-open-dev
server-addr: 10.105.1.132:8848
server-addr: 10.101.12.15:8848
discovery:
namespace: dubhe-server-cloud-open-dev
server-addr: 10.105.1.132:8848
server-addr: 10.101.12.15:8848

+ 2
- 2
dubhe-server/common-cloud/configuration/src/main/resources/bootstrap-cloud-test.yml View File

@@ -6,7 +6,7 @@ spring:
context-path: /nacos
config:
namespace: dubhe-server-cloud-test
server-addr: 127.0.0.1:8848
server-addr: 10.105.1.132:8848
discovery:
namespace: dubhe-server-cloud-test
server-addr: 127.0.0.1:8848
server-addr: 10.105.1.132:8848

+ 43
- 0
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/api/ModelServiceApi.java View File

@@ -0,0 +1,43 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.k8s.api;

import org.dubhe.k8s.domain.PtBaseResult;
import org.dubhe.k8s.domain.bo.ModelServiceBO;
import org.dubhe.k8s.domain.bo.ModelServingBO;
import org.dubhe.k8s.domain.resource.BizDeployment;
import org.dubhe.k8s.domain.vo.ModelServiceVO;
import org.dubhe.k8s.domain.vo.ModelServingVO;


public interface ModelServiceApi {

/**
* 创建
* @param bo
* @return
*/
ModelServiceVO create(ModelServiceBO bo);

/**
* 删除
* @param namespace 命名空间
* @param resourceName 资源名称
* @return PtBaseResult 基础结果类
*/
PtBaseResult delete(String namespace, String resourceName);
}

+ 207
- 0
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/api/impl/ModelServiceApiImpl.java View File

@@ -0,0 +1,207 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.k8s.api.impl;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.google.common.collect.Maps;
import io.fabric8.kubernetes.api.model.*;
import io.fabric8.kubernetes.api.model.apps.Deployment;
import io.fabric8.kubernetes.api.model.apps.DeploymentBuilder;
import io.fabric8.kubernetes.api.model.apps.DeploymentList;
import io.fabric8.kubernetes.client.KubernetesClient;
import io.fabric8.kubernetes.client.KubernetesClientException;
import org.apache.commons.compress.utils.Lists;
import org.dubhe.biz.base.constant.MagicNumConstant;
import org.dubhe.biz.base.constant.SymbolConstant;
import org.dubhe.biz.file.api.FileStoreApi;
import org.dubhe.biz.log.enums.LogEnum;
import org.dubhe.biz.log.utils.LogUtil;
import org.dubhe.k8s.api.ModelServiceApi;
import org.dubhe.k8s.api.ResourceIisolationApi;
import org.dubhe.k8s.api.ResourceQuotaApi;
import org.dubhe.k8s.api.VolumeApi;
import org.dubhe.k8s.constant.K8sParamConstants;
import org.dubhe.k8s.domain.PtBaseResult;
import org.dubhe.k8s.domain.bo.BuildFsVolumeBO;
import org.dubhe.k8s.domain.bo.ModelServiceBO;
import org.dubhe.k8s.domain.bo.ModelServingBO;
import org.dubhe.k8s.domain.resource.BizDeployment;
import org.dubhe.k8s.domain.vo.ModelServiceVO;
import org.dubhe.k8s.domain.vo.ModelServingVO;
import org.dubhe.k8s.domain.vo.VolumeVO;
import org.dubhe.k8s.enums.*;
import org.dubhe.k8s.utils.BizConvertUtils;
import org.dubhe.k8s.utils.K8sUtils;
import org.dubhe.k8s.utils.LabelUtils;
import org.dubhe.k8s.utils.YamlUtils;
import org.springframework.beans.factory.annotation.Autowired;

import javax.annotation.Resource;
import java.util.*;

public class ModelServiceApiImpl implements ModelServiceApi {

@Autowired
private ResourceQuotaApi resourceQuotaApi;

@Autowired
private ResourceIisolationApi resourceIisolationApi;

@Resource(name = "hostFileStoreApiImpl")
private FileStoreApi fileStoreApi;

@Autowired
private VolumeApi volumeApi;

private KubernetesClient client;
private K8sUtils k8sUtils;


public ModelServiceApiImpl(K8sUtils k8sUtils) {
this.k8sUtils = k8sUtils;
this.client = k8sUtils.getClient();
}


@Override
public ModelServiceVO create(ModelServiceBO bo) {
//资源配额校验
LimitsOfResourcesEnum limitsOfResources = resourceQuotaApi.reachLimitsOfResources(bo.getNamespace(), bo.getCpuNum(), bo.getMemNum(), bo.getGpuNum());
if (!LimitsOfResourcesEnum.ADEQUATE.equals(limitsOfResources)) {
return new ModelServiceVO().error(K8sResponseEnum.LACK_OF_RESOURCES.getCode(), limitsOfResources.getMessage());
}
LogUtil.info(LogEnum.BIZ_K8S, "Params of creating ModelServing--create:{}", bo);
if (!fileStoreApi.createDirs(bo.getDirList().toArray(new String[MagicNumConstant.ZERO]))) {
return new ModelServiceVO().error(K8sResponseEnum.INTERNAL_SERVER_ERROR.getCode(), K8sResponseEnum.INTERNAL_SERVER_ERROR.getMessage());
}
//存储卷构建
VolumeVO volumeVO = volumeApi.buildFsVolumes(new BuildFsVolumeBO(bo.getNamespace(), bo.getResourceName(), bo.getFsMounts()));
if (!K8sResponseEnum.SUCCESS.getCode().equals(volumeVO.getCode())) {
return new ModelServiceVO().error(volumeVO.getCode(), volumeVO.getMessage());
}

//名称生成
String deploymentName = StrUtil.format(K8sParamConstants.RESOURCE_NAME_TEMPLATE, bo.getResourceName(), RandomUtil.randomString(MagicNumConstant.EIGHT));

//部署deployment
Deployment deployment = buildDeployment(bo, volumeVO, deploymentName);
LogUtil.info(LogEnum.BIZ_K8S, "Ready to deploy {}, yaml信息为{}", deploymentName, YamlUtils.dumpAsYaml(deployment));
resourceIisolationApi.addIisolationInfo(deployment);
Deployment deploymentResult = client.apps().deployments().inNamespace(bo.getNamespace()).create(deployment);

return new ModelServiceVO(BizConvertUtils.toBizDeployment(deploymentResult));
}

/**
* 构建Deployment
*
* @return Deployment
*/
private Deployment buildDeployment(ModelServiceBO bo, VolumeVO volumeVO, String deploymentName) {
Map<String, String> childLabels = LabelUtils.getChildLabels(bo.getResourceName(), deploymentName,
K8sKindEnum.DEPLOYMENT.getKind(), bo.getBusinessLabel(), bo.getTaskIdentifyLabel());
LabelSelector labelSelector = new LabelSelector();
labelSelector.setMatchLabels(childLabels);
return new DeploymentBuilder()
.withNewMetadata()
.withName(deploymentName)
.addToLabels(LabelUtils.getBaseLabels(bo.getResourceName(), bo.getBusinessLabel()))
.withNamespace(bo.getNamespace())
.endMetadata()
.withNewSpec()
.withReplicas(bo.getReplicas())
.withSelector(labelSelector)
.withNewTemplate()
.withNewMetadata()
.withName(deploymentName)
.addToLabels(childLabels)
.withNamespace(bo.getNamespace())
.endMetadata()
.withNewSpec()
.addToNodeSelector(K8sUtils.gpuSelector(bo.getGpuNum()))
.addToContainers(buildContainer(bo, volumeVO, deploymentName))
.addToVolumes(volumeVO.getVolumes().toArray(new Volume[0]))
.withRestartPolicy(RestartPolicyEnum.ALWAYS.getRestartPolicy())
.endSpec()
.endTemplate()
.endSpec()
.build();
}

/**
* 构建 Container
* @param bo
* @param volumeVO
* @param name
* @return
*/
private Container buildContainer(ModelServiceBO bo, VolumeVO volumeVO, String name) {
Map<String, Quantity> resourcesLimitsMap = Maps.newHashMap();
Optional.ofNullable(bo.getCpuNum()).ifPresent(v -> resourcesLimitsMap.put(K8sParamConstants.QUANTITY_CPU_KEY, new Quantity(v.toString(), K8sParamConstants.CPU_UNIT)));
Optional.ofNullable(bo.getGpuNum()).ifPresent(v -> resourcesLimitsMap.put(K8sParamConstants.GPU_RESOURCE_KEY, new Quantity(v.toString())));
Optional.ofNullable(bo.getMemNum()).ifPresent(v -> resourcesLimitsMap.put(K8sParamConstants.QUANTITY_MEMORY_KEY, new Quantity(v.toString(), K8sParamConstants.MEM_UNIT)));
Container container = new ContainerBuilder()
.withNewName(name)
.withNewImage(bo.getImage())
.withNewImagePullPolicy(ImagePullPolicyEnum.IFNOTPRESENT.getPolicy())
.withVolumeMounts(volumeVO.getVolumeMounts())
.withNewResources().addToLimits(resourcesLimitsMap).endResources()
.build();
if (bo.getCmdLines() != null) {
container.setCommand(Arrays.asList(ShellCommandEnum.BIN_BANSH.getShell()));
container.setArgs(bo.getCmdLines());
}
Probe livenessProbe = new Probe();
ExecAction execAction = new ExecAction();
List<String> commands = Lists.newArrayList();
commands.add("test");
commands.add("-e");
commands.add("/tmp/.startup");
execAction.setCommand(commands);
livenessProbe.setExec(execAction);
livenessProbe.setPeriodSeconds(3);
livenessProbe.setSuccessThreshold(1);
livenessProbe.setFailureThreshold(10);
// container.setLivenessProbe(livenessProbe);
return container;
}

@Override
public PtBaseResult delete(String namespace, String resourceName) {
try {
LogUtil.info(LogEnum.BIZ_K8S, "delete model serving namespace:{} resourceName:{}",namespace,resourceName);
DeploymentList deploymentList = client.apps().deployments().inNamespace(namespace).withLabels(LabelUtils.withEnvResourceName(resourceName)).list();
if (deploymentList == null || deploymentList.getItems().size() == 0){
return new PtBaseResult();
}
Boolean res = client.extensions().ingresses().inNamespace(namespace).withLabels(LabelUtils.withEnvResourceName(resourceName)).delete()
&& client.services().inNamespace(namespace).withLabels(LabelUtils.withEnvResourceName(resourceName)).delete()
&& client.apps().deployments().inNamespace(namespace).withLabels(LabelUtils.withEnvResourceName(resourceName)).delete()
&& client.secrets().inNamespace(namespace).withLabels(LabelUtils.withEnvResourceName(resourceName)).delete();
if (res) {
return new PtBaseResult();
} else {
return K8sResponseEnum.REPEAT.toPtBaseResult();
}
} catch (KubernetesClientException e) {
LogUtil.error(LogEnum.BIZ_K8S, "delete error:", e);
return new PtBaseResult(String.valueOf(e.getCode()), e.getMessage());
}
}
}

+ 2
- 0
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/api/impl/ModelServingApiImpl.java View File

@@ -173,6 +173,8 @@ public class ModelServingApiImpl implements ModelServingApi {
if (StringUtils.isNotEmpty(buildIngressBO.getMaxUploadSize())) {
buildIngressBO.putAnnotation(K8sParamConstants.INGRESS_PROXY_BODY_SIZE_KEY, buildIngressBO.getMaxUploadSize());
}
buildIngressBO.putAnnotation(K8sParamConstants.INGRESS_READ_TIMEOUT_KEY, String.valueOf(MagicNumConstant.TEN));
buildIngressBO.putAnnotation(K8sParamConstants.INGRESS_NEXT_UPSTREAM_TIMEOUT_KEY, String.valueOf(MagicNumConstant.TEN));
if (bo.getHttpPort() != null) {
String httpHost = RandomUtil.randomString(MagicNumConstant.SIX) + SymbolConstant.DOT + servingHost;
buildIngressBO.addIngressRule(ResourceBuildUtils.buildIngressRule(httpHost, svcName, SymbolConstant.HTTP));


+ 20
- 33
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/config/K8sConfig.java View File

@@ -23,38 +23,8 @@ import org.apache.http.HttpHost;
import org.apache.http.client.config.RequestConfig;
import org.dubhe.biz.log.enums.LogEnum;
import org.dubhe.biz.log.utils.LogUtil;
import org.dubhe.k8s.api.DistributeTrainApi;
import org.dubhe.k8s.api.DubheDeploymentApi;
import org.dubhe.k8s.api.JupyterResourceApi;
import org.dubhe.k8s.api.LimitRangeApi;
import org.dubhe.k8s.api.LogMonitoringApi;
import org.dubhe.k8s.api.MetricsApi;
import org.dubhe.k8s.api.ModelOptJobApi;
import org.dubhe.k8s.api.ModelServingApi;
import org.dubhe.k8s.api.NamespaceApi;
import org.dubhe.k8s.api.NativeResourceApi;
import org.dubhe.k8s.api.NodeApi;
import org.dubhe.k8s.api.PersistentVolumeClaimApi;
import org.dubhe.k8s.api.PodApi;
import org.dubhe.k8s.api.ResourceQuotaApi;
import org.dubhe.k8s.api.TerminalApi;
import org.dubhe.k8s.api.TrainJobApi;
import org.dubhe.k8s.api.impl.DistributeTrainApiImpl;
import org.dubhe.k8s.api.impl.DubheDeploymentApiImpl;
import org.dubhe.k8s.api.impl.JupyterResourceApiImpl;
import org.dubhe.k8s.api.impl.LimitRangeApiImpl;
import org.dubhe.k8s.api.impl.LogMonitoringApiImpl;
import org.dubhe.k8s.api.impl.MetricsApiImpl;
import org.dubhe.k8s.api.impl.ModelOptJobApiImpl;
import org.dubhe.k8s.api.impl.ModelServingApiImpl;
import org.dubhe.k8s.api.impl.NamespaceApiImpl;
import org.dubhe.k8s.api.impl.NativeResourceApiImpl;
import org.dubhe.k8s.api.impl.NodeApiImpl;
import org.dubhe.k8s.api.impl.PersistentVolumeClaimApiImpl;
import org.dubhe.k8s.api.impl.PodApiImpl;
import org.dubhe.k8s.api.impl.ResourceQuotaApiImpl;
import org.dubhe.k8s.api.impl.TerminalApiImpl;
import org.dubhe.k8s.api.impl.TrainJobApiImpl;
import org.dubhe.k8s.api.*;
import org.dubhe.k8s.api.impl.*;
import org.dubhe.k8s.cache.ResourceCache;
import org.dubhe.k8s.properties.ClusterProperties;
import org.dubhe.k8s.utils.K8sUtils;
@@ -92,6 +62,19 @@ public class K8sConfig {
@Value("${k8s.elasticsearch.hostlist}")
private String hostlist;

@Value("${clusters[0].cluster.certificate-authority-data}")
private String certificateAuthorityData;

@Value("${clusters[0].cluster.server}")
private String server;

@Value("${users[0].user.client-certificate-data}")
private String clientCertificateData;

@Value("${users[0].user.client-key-data}")
private String clientKeyData;


@Bean
public K8sUtils k8sUtils() throws IOException {
LogUtil.debug(LogEnum.BIZ_K8S, "ClusterProperties======{}", JSONObject.toJSONString(clusterProperties));
@@ -105,7 +88,7 @@ public class K8sConfig {
if (StrUtil.isEmpty(url) && StrUtil.isEmpty(kubeconfig)) {
return null;
}
return new K8sUtils(clusterProperties);
return new K8sUtils(clusterProperties,certificateAuthorityData,server,clientCertificateData,clientKeyData);
}

@Bean
@@ -217,4 +200,8 @@ public class K8sConfig {
return new TerminalApiImpl(k8sUtils);
}

@Bean
public ModelServiceApi modelServiceApi(K8sUtils k8sUtils){
return new ModelServiceApiImpl(k8sUtils);
}
}

+ 2
- 0
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/constant/K8sParamConstants.java View File

@@ -67,6 +67,8 @@ public class K8sParamConstants {
public static final String INGRESS_CLASS_KEY = "kubernetes.io/ingress.class";
public static final String INGRESS_SSL_REDIRECT_KEY = "nginx.ingress.kubernetes.io/ssl-redirect";
public static final String INGRESS_BACKEND_PROTOCOL_KEY = "nginx.ingress.kubernetes.io/backend-protocol";
public static final String INGRESS_READ_TIMEOUT_KEY = "nginx.ingress.kubernetes.io/proxy-read-timeout";
public static final String INGRESS_NEXT_UPSTREAM_TIMEOUT_KEY = "nginx.ingress.kubernetes.io/proxy-next-upstream-timeout";
/**
* k8s资源对象名称校验正则表达式
*/


+ 97
- 0
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/domain/bo/ModelServiceBO.java View File

@@ -0,0 +1,97 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/

package org.dubhe.k8s.domain.bo;

import cn.hutool.core.collection.CollectionUtil;
import lombok.Data;
import lombok.experimental.Accessors;
import org.dubhe.k8s.annotation.K8sValidation;
import org.dubhe.k8s.enums.ValidationTypeEnum;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
* @description 模型服务部署 BO
*/
@Data
@Accessors(chain = true)
public class ModelServiceBO {

/**
* 命名空间
**/
@K8sValidation(ValidationTypeEnum.K8S_RESOURCE_NAME)
private String namespace;
/**
* 资源名称
**/
@K8sValidation(ValidationTypeEnum.K8S_RESOURCE_NAME)
private String resourceName;
/**
* Number of desired pods
*/
private Integer replicas;
/**
* GPU数量
**/
private Integer gpuNum;
/**
* 内存数量 单位Mi Gi
**/
private Integer memNum;
/**
* CPU数量
**/
private Integer cpuNum;
/**
* 镜像名称
**/
private String image;
/**
* 执行命令
**/
private List<String> cmdLines;
/**
* 文件存储服务挂载 key:pod内挂载路径 value:文件存储路径及配置
**/
private Map<String, PtMountDirBO> fsMounts;
/**
* 业务标签,用于标识业务模块
**/
@K8sValidation(ValidationTypeEnum.K8S_RESOURCE_NAME)
private String businessLabel;

/**
* 任务身份标签,用于标识任务唯一身份
**/
private String taskIdentifyLabel;

/**
* 获取nfs路径
* @return
*/
public List<String> getDirList(){
if (CollectionUtil.isNotEmpty(fsMounts)){
return fsMounts.values().stream().map(PtMountDirBO::getDir).collect(Collectors.toList());
}
return new ArrayList<>();
}
}

+ 14
- 4
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/domain/bo/PrometheusMetricBO.java View File

@@ -24,6 +24,7 @@ import org.dubhe.biz.base.functional.StringFormat;
import org.dubhe.k8s.domain.vo.GpuTotalMemResultVO;
import org.dubhe.k8s.domain.vo.MetricsDataResultValueVO;
import org.springframework.util.CollectionUtils;
import org.springframework.util.StringUtils;

import java.util.ArrayList;
import java.util.HashMap;
@@ -63,7 +64,7 @@ public class PrometheusMetricBO {
return gpuMemValueMap;
}
StringFormat memMetricsFormat = (value) -> {
return NumberUtil.isNumber(String.valueOf(value)) ? String.valueOf(Long.valueOf(String.valueOf(value)) / MagicNumConstant.BINARY_TEN_EXP) : String.valueOf(MagicNumConstant.ZERO);
return NumberUtil.isNumber(String.valueOf(value)) ? String.valueOf(Long.valueOf(String.valueOf(value)) * MagicNumConstant.BINARY_TEN_EXP) : String.valueOf(MagicNumConstant.ZERO);
};
for (MetricResult result : data.getResult()) {
gpuMemValueMap.put(result.getMetric().getAcc_id(), memMetricsFormat.format(result.getValue().get(1).toString()));
@@ -81,7 +82,7 @@ public class PrometheusMetricBO {
return gpuTotalMemValueVOList;
}
StringFormat memMetricsFormat = (value) -> {
return NumberUtil.isNumber(String.valueOf(value)) ? String.valueOf(Long.valueOf(String.valueOf(value)) / MagicNumConstant.BINARY_TEN_EXP) : String.valueOf(MagicNumConstant.ZERO);
return NumberUtil.isNumber(String.valueOf(value)) ? String.valueOf(Long.valueOf(String.valueOf(value)) * MagicNumConstant.BINARY_TEN_EXP) : String.valueOf(MagicNumConstant.ZERO);
};
for (MetricResult result : data.getResult()) {
gpuTotalMemValueVOList.add(new GpuTotalMemResultVO(result.getMetric().getAcc_id(), memMetricsFormat.format(result.getValue().get(1).toString())));
@@ -162,7 +163,7 @@ public class PrometheusMetricBO {
return map;
}
StringFormat memMetricsFormat = (value) -> {
return NumberUtil.isNumber(String.valueOf(value)) ? String.valueOf(Long.valueOf(String.valueOf(value)) / MagicNumConstant.BINARY_TEN_EXP) : String.valueOf(MagicNumConstant.ZERO);
return NumberUtil.isNumber(String.valueOf(value)) ? String.valueOf(Long.valueOf(String.valueOf(value)) * MagicNumConstant.BINARY_TEN_EXP) : String.valueOf(MagicNumConstant.ZERO);
};
for (MetricResult result : data.getResult()) {
map.put(result.getMetric().getAcc_id(), getFormatValues(result, memMetricsFormat));
@@ -195,7 +196,7 @@ public class PrometheusMetricBO {
return list;
}
StringFormat memMetricsFormat = (value) -> {
return NumberUtil.isNumber(String.valueOf(value)) ? String.valueOf(Long.valueOf(String.valueOf(value)) / MagicNumConstant.BINARY_TEN_EXP) : String.valueOf(MagicNumConstant.ZERO);
return NumberUtil.isNumber(String.valueOf(value)) ? String.valueOf(Long.valueOf(String.valueOf(value)) * MagicNumConstant.BINARY_TEN_EXP) : String.valueOf(MagicNumConstant.ZERO);
};
for (MetricResult result : data.getResult()) {
list.add(new GpuTotalMemResultVO(result.getMetric().getAcc_id(), getGpuTotalValues(result, memMetricsFormat)));
@@ -220,7 +221,16 @@ class MetricResult {

@Data
class Metric {
private String UUID;
private String acc_id;
private String pod;

public String getAcc_id(){
if (!StringUtils.isEmpty(acc_id)){
return acc_id;
}else {
return UUID;
}
}
}


+ 3
- 0
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/domain/resource/BizContainerStatus.java View File

@@ -41,4 +41,7 @@ public class BizContainerStatus {

@K8sField("containerID")
private String containerID;

@K8sField("ready")
private Boolean ready;
}

+ 39
- 0
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/domain/vo/ModelServiceVO.java View File

@@ -0,0 +1,39 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/

package org.dubhe.k8s.domain.vo;


import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.experimental.Accessors;
import org.dubhe.k8s.domain.PtBaseResult;
import org.dubhe.k8s.domain.resource.BizDeployment;
import org.dubhe.k8s.domain.resource.BizIngress;
import org.dubhe.k8s.domain.resource.BizSecret;
import org.dubhe.k8s.domain.resource.BizService;

@Data
@NoArgsConstructor
@Accessors(chain = true)
public class ModelServiceVO extends PtBaseResult<ModelServiceVO> {
private BizDeployment bizDeployment;

public ModelServiceVO( BizDeployment bizDeployment){
this.bizDeployment = bizDeployment;
}
}

+ 9
- 1
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/enums/BusinessLabelServiceNameEnum.java View File

@@ -55,7 +55,15 @@ public enum BusinessLabelServiceNameEnum {
/**
* TADL
*/
TADL(BizEnum.TADL.getBizCode(), ApplicationNameConst.SERVER_TADL);
TADL(BizEnum.TADL.getBizCode(), ApplicationNameConst.SERVER_TADL),
/**
* POINT_CLOUD
*/
POINT(BizEnum.POINT_CLOUD.getBizCode(),ApplicationNameConst.SERVER_POINT_CLOUD),
/**
* DATA
*/
DATA(BizEnum.DATA.getBizCode(),ApplicationNameConst.SERVER_DATA);
/**
* 业务标签
*/


+ 13
- 25
dubhe-server/common-k8s/src/main/java/org/dubhe/k8s/utils/K8sUtils.java View File

@@ -82,32 +82,20 @@ public class K8sUtils implements ApplicationContextAware {
* @param clusterProperties
* @throws IOException
*/
public K8sUtils(ClusterProperties clusterProperties) throws IOException{
public K8sUtils(ClusterProperties clusterProperties, String certificateAuthorityData, String server, String clientCertificateData, String clientKeyData) throws IOException{
String kubeConfig = clusterProperties.getKubeconfig();
if (StrUtil.isNotBlank(kubeConfig)) {
String kubeConfigFile = getKubeconfigFile(kubeConfig);
//修改环境变量,重新指定kubeconfig读取位置
System.setProperty(Config.KUBERNETES_KUBECONFIG_FILE, kubeConfigFile);
client = new DefaultKubernetesClient();
config = client.getConfiguration();

} else {
LogUtil.warn(LogEnum.BIZ_K8S, "can't find kubeconfig in classpath, ignoring");
String k8sUrl = clusterProperties.getUrl();
if (k8sUrl.startsWith(HTTPS_PREFIX)) {
config = new ConfigBuilder().withMasterUrl(k8sUrl)
.withTrustCerts(true)
.withCaCertData(IOUtils.toString(clusterProperties.getCaCrt().getInputStream(), "UTF-8"))
.withClientCertData(Base64.getEncoder().encodeToString(IOUtils.toByteArray(clusterProperties.getClientCrt().getInputStream())))
.withClientKeyData(IOUtils.toString(clusterProperties.getClientKey().getInputStream(), "UTF-8"))
.build();
} else {
config = new ConfigBuilder().withMasterUrl(k8sUrl).build();
}
LogUtil.info(LogEnum.BIZ_K8S, "config信息为{}", JSON.toJSONString(config));
client = new DefaultKubernetesClient(config);
LogUtil.info(LogEnum.BIZ_K8S, "client为{}", JSON.toJSONString(client));
}

LogUtil.warn(LogEnum.BIZ_K8S, "can't find kubeconfig in classpath, ignoring");
config = new ConfigBuilder().withMasterUrl(server)
.withCaCertData(certificateAuthorityData)
.withClientCertData(clientCertificateData)
.withClientKeyData(clientKeyData)
.build();

LogUtil.info(LogEnum.BIZ_K8S, "config信息为{}", JSON.toJSONString(config));
client = new DefaultKubernetesClient(config);
LogUtil.info(LogEnum.BIZ_K8S, "client为{}", JSON.toJSONString(client));


nfs = clusterProperties.getNfs();
host = clusterProperties.getHost();


+ 5
- 4
dubhe-server/common-k8s/src/main/resources/kubeconfig_dev View File

@@ -1,12 +1,13 @@
apiVersion: v1
clusters:
- cluster:
certificate-authority-data:
server: https://127.0.0.1:6443
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1URXlPVEE0TXpNeE4xb1hEVE14TVRFeU56QTRNek14TjFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTmpCCmxkVWhGQkdqSDNsYXIxTW9wVUgvMW8xNVUwbEhvcGQzZjgyL0tWMlEyOU9BKzhjMkhXYTd3R01QSzhxL1JmSVAKTjlnYXJJd0FqZXFwNHFSMWhEcVhka05WN2NOZUZ2OGdoMUVYSzMyTUxoaFZJdXhkTnF6OW9GVm85RDZqTzQ5awpEOWQrM215eU4zamxsT2wyTWVRMUY0STlHSTFabjFCOG5LQVZWVjFIZTBPTGZjVTIrZG5mU0g4ZFdqV2RPQlBhCkJmbGU4UFRLQy9tOFVmcTQvanArVU92R04yVEhIaXk0V2UyTWFEK0xxWDIzekE0T1FlK3NrdlY4bHlqK0ppVUQKVVRiM2xzazlhTDMxblMxUmpnVStkbVIyR2xHQ1BHWEhNc2Z3MlVCZzljZEM5ZzhKc2dFeTJDa04xMitjeWx3dApDbHFQQ3o0MlNlNEJMNWF1ZGJFQ0F3RUFBYU5DTUVBd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZCTmFSa0hpTzdvZDd2U3pUUm9qaHFTWStSNXpNQTBHQ1NxR1NJYjMKRFFFQkN3VUFBNElCQVFDVnZGRUg0ZEYzUTQrRDlOeHBZdDM4ZG9mb0ExYjlYOWNndU5YYktvbGxHK1lQeWl4NwpBcGlMWkp2WFlsbk0rUU5BYjMyOU84VmNkQUp0aDZ4MjVHSVNUVjFGbXBWWHFlRVIvUFJOZURsaHFybzVwYUlVCkV1YUQzYldxaitWb2p6b1AyVzZMU21RdzQwNUIzV0JKRlJtdm51bW9LYStyUWEySVoralRNMVQ5bDV5bXR2YloKS0lXNGZFZ0N2VEhPSmtRLzBGWDg3dEc0VlVJZ3hHRXZJU2lUUkJYc3hnQXdVK0I5SnN4bEZSS3NHYTJ4QkE2bQprZXR1VFVlZkswTGZRMFlMWVVKSVA5Y0RsNm5QSld5U0NTcWFZUGRoaGxERWxEYUt4d2JZeHdBVkI0ZzV1cWhNCnZrMkN0RVFHOWg0b2ZxZjQ4VDFLVlJVRGo5UzdBL2xtbEZxNgotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://10.5.26.91:6443
name: kubernetes
contexts:
- context:
cluster: kubernetes
namespace: default
user: kubernetes-admin
name: kubernetes-admin@kubernetes
current-context: kubernetes-admin@kubernetes
@@ -15,5 +16,5 @@ preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data:
client-key-data:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURFekNDQWZ1Z0F3SUJBZ0lJT21TandKODdaUWt3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGdzB5TVRFeE1qa3dPRE16TVRkYUZ3MHlNakV4TWprd09ETXpNVGhhTURReApGekFW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FZ6aDlWY3J1aHRrSEh5dFNUdzRXcXhwVmE3TDBzNDlBbGp2cDNybm41UGRucXhpK0h1TU5pCkdwTDRTd0tCZ1FET0hRZ1ZGeGV0eU5zVjRkSXd6UThzbVp2ZHF1QzRzRXZTakx4UXd6ZmZadU1aMHFBc1R6VkUKYkE2dk01WlNpQ3A5SUxTd3VKTUc1eGhqMXZUdGVDOHBCSmdsM3BmM1ArS0pXeGZ4S3lYRCtRai9STDN6V2lxcwpFaDd4SFN6UlFCcDJESjhqMWdtakd4em5IbnlDdnBNdFJlQzBzcGp2N0JVZzNqaFR4SVRRdFE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=

+ 4
- 4
dubhe-server/common-k8s/src/main/resources/kubeconfig_pre View File

@@ -1,8 +1,8 @@
apiVersion: v1
clusters:
- cluster:
certificate-authority-data:
server: https://127.0.0.1:6443
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1EY3hNekEzTlRNek5sb1hEVE14TURjeE1UQTNOVE16Tmxvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTEZlCmp5KzlwTjNybnJpYTlpbDhzOEp0WWZoekVMUU1LbXVmb0Y0VEhjTnFObGtOVDJiL2pTcUUzbGdRYTR2Zm9oL1AKUFVOaWVkZEZvczFoRGNxRnF0QmRpaXJ5QXhSNERPeTJsMWpjSWVpVHJNaHYyd1JZc09ZMG4yanZITFdGdENCaQphY0lEeXFmNmhHM01SV2ZNUEhPVVdDQ0JIUmxLRFlnYkNDZXp5NWxxUEF4QXpmcUpEalUxWkNUVmNNa2Z3R1FDCmFSYVZ4aTFiRHhRSk9Ud2dTTGlJdEJIUGhrdGtOcnY1MU1XZzRSWkVUbWF3azg5Y09oWExpSEg3ZExFZjFvK0oKVE80Q3J1K2pyb3lIRkNvQmo0bGpKZHd4N0ZRS25XZFpEbWZiOFFoZEdyTkRuK21WR3BRNnZSRGN5YzloSVJsMwpyM3U4bkM2TS9mZ29UTHhWaTFFQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFIbDZMYWpscFZLMk9PbG1JYzRVK3A4bTZoVGEKd2NCTW5MZjVJcExwME9CRmZ6M1hvVi9EVUlmTE1LU2k2bzY3a1Y0aFYzNDZMTnErU244elBUZEZkbDdjZUlvbQp2azc3YXE4c2VERk5xbTJMSytSUldmUWZQbFQrSGhiWFVpS1lOUUhmanlXdjh6QzFGaWpBQTBqaGVjWVBaSnU4ClpUb2JaenhPaS8yOGNwSmNOSFFDSW14OG16UkU2c3JTRjFsbE4yaWF0eTQ1cWhEZWwyZHpmSldaeTFzTXVwc2YKaTc4Z25qdlhFU3BYaGoweGZNbEdMNnA3QkVjdUw1YkgyN3Y3djJjelh2WVJnbk0vamhscGVzbVRsNzFiSE1KQQpnSzlpR2pqMHhoZ1Jnb3h2VHNQNVZLSUszTFZVbGxNNXJhNXYxTjdOOXpmQVZybnprRGRoaXNZQzZCUT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
server: https://10.105.0.29:6443
name: kubernetes
contexts:
- context:
@@ -15,5 +15,5 @@ preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data:
client-key-data:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJVjB5b2I4RnFSdGt3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVGd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VkeE9ITytLTlU0clp5dCs3Ty84RXFra0ZrRndrK1dHRFpCaXpRM3BwUUlOdERiamh6REZGWFM4M1d0eFFCCkp1Wlk4UFVDZ1lBOFlsZnNsQ2VmZktvTVBVK3pKZWF5SUlQNTR0M3NySkFwblNyc1BuNlNBSlB1WjU5ZkYrUTcKNGlvNk0weEw0dE5VckhPQ2ZpODJXSzlRQ29EbDRIYTJGZ0Y3YkNMTTQ1Qld5cVp5THg0b0JRYmFGNE5ybmVuTgpVUVVFbkU2V2ZyN1RFWWVBNngrOG10dXAvcDJzbTd2eWdkYngrRFB1OXYzV1JyZE1DZDBNWUE9PQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo=

+ 4
- 4
dubhe-server/common-k8s/src/main/resources/kubeconfig_prod View File

@@ -1,8 +1,8 @@
apiVersion: v1
clusters:
- cluster:
certificate-authority-data:
server: https://127.0.0.1:6443
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUN5RENDQWJDZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1EVXdOekE0TURFME9Gb1hEVE14TURVd05UQTRNREUwT0Zvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTXU2CmRJYWVmOWQzYXByK3lKK3BLY0EyaU5NQXlQVWFsbFgyZHBwelprd282T0R2TW9FYmgrRWFaY0Y1aEdMVnhSWDYKbnhtcUQvVFNCWXdENFNzY1E3c0YzcWtxeWxBLzJXaTg1NTJKbGJQcXFSQm5CaEUwV211ZE9EVXZYYVF0N3BnWApzR1JKcDROcFBsd0tLMUVpZmhsdkJIMmRVWHFjZDRENmZKbWRSSWgrNEpOS3ZOL09Hait4WjNKUG5Cc0pKOUlICms4TWFsc3NuTTYvaFpna0tKVlplc2YvcVorN2I3dXpJSVJteEd3L0RBcmtNaGgvL1VCZUUzVEFsd1lWWisxZWkKU293eldEN3EzYzFhU3NJYkdrbXJWaXNQcVVZTk9sUEplcHJLTVFJRUJKVEdPWUYzSzk0eHNKaEtBMkI0Z0VCRgpOdkJxTzVqZFZ4RkM0SFdxM1VFQ0F3RUFBYU1qTUNFd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0RRWUpLb1pJaHZjTkFRRUxCUUFEZ2dFQkFLV254YlZqTFRWZVVyZDB0Q004SE83ejk2QnQKQTBGS3pmclRSTkhtT0I2WVVSRnVRbWZJdE9GTkY4QnJoYVBCZVNKMFZrNVdNUXZBd1BkdnY2R2l1NU1VNU45TApHV3R2eXhsS0Z5aVkxR25RUy9sWjRjR1JaSE9kMmtMNFY3bVNLQmo3ZFpzcDN0dW42d3BQZWM3dUJ6Z1UvNzdxCjN1b3BGMGVzR21wY3ZFaVhNSlRrZUN1NTNhaTVFVHhSS0Q0V0xxUUFhbDViUlB4b0UwL3Mrams5SGI4b1JuNnQKa0RDaElpQnVjL3RDaHhwTmNFVWt6UUwyRjBHR2hRaVlQTFFQdkgzRml5S2tlWjBiYUNHdFdpODEvZG9lVVJKZQpOM21jU3pvZEM1SUhMc1Zta05HTzh3Y2pocjVZck0yVGxHS01sV1huRVk5QWFMUEl1blI0VmQ4ZU1iWT0KLS0tLS1FTkQgQ0VSVElGSUNBVEUtLS0tLQo=
server: https://10.105.0.1:6443
name: kubernetes
contexts:
- context:
@@ -15,5 +15,5 @@ preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data:
client-key-data:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM4akNDQWRxZ0F3SUJBZ0lJSDByc3FWMTBudUF3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2EzVmlaWEp1WlhSbGN6QWVG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Rrdm5uWmpmVXlSVEc4NTJqNWR2NnB1a2VpQTNGbkJWZVMrY3R1ZVVSNFBaeCtlCllEM2xBb0dBRWRId3VVa2ZBYWZJMFdkOXdlYXNDb1daTUlDTm1MK1ZDcXEzMEZyamVFMXg0cElTNjdFODJkU2UKKy9TbDNkWXpucHkxODJVdGJQNzlSYThoNXloOUVCTzVYMXlweGlCeCt3MmdwNWVJWG00aStOUWZxbjNOUm42awo2VW1RY1hCMXV4djNKWENuYWxVUk5tVWdudEFzaEQxaGd0Y1VvSzArS0NXT3VhUnFqSTQ9Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==

+ 4
- 4
dubhe-server/common-k8s/src/main/resources/kubeconfig_test View File

@@ -1,8 +1,8 @@
apiVersion: v1
clusters:
- cluster:
certificate-authority-data:
server: https://127.0.0.1:6443
certificate-authority-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSUM1ekNDQWMrZ0F3SUJBZ0lCQURBTkJna3Foa2lHOXcwQkFRc0ZBREFWTVJNd0VRWURWUVFERXdwcmRXSmwKY201bGRHVnpNQjRYRFRJeE1USXdPREE0TWpnd00xb1hEVE14TVRJd05qQTRNamd3TTFvd0ZURVRNQkVHQTFVRQpBeE1LYTNWaVpYSnVaWFJsY3pDQ0FTSXdEUVlKS29aSWh2Y05BUUVCQlFBRGdnRVBBRENDQVFvQ2dnRUJBTWVKCkRjTThQUHFlV0tHazE3S2JtN3kwbzkzTGtxb2w5dG1QbVN0YTVyUXZSWU9rOFJYK2QvVEpVaXE2S2c4NXFyMGUKZFZ3SG5vTjg3Q0VFbXhOK2o4OUhlcnY1dDFaRFBHMVRHS3U5N1l1WnV4RCt2R1hGQkhDZ2ViT0s0Zmc0am1iSgpwUmlJeCtUZmlyUjM4TlVhZTBkR1g5c1o1TWF2NkhiSVVEK2hNTm9VU2pyWUZ2bTcxbGtYdlhVWW9wd1FSR3FvCkZiWG5KTFFVakd3UFFRclRCQ0wycFE2c1dGbkpkQ0VBSHhXU0grTUN4cXV0L25SUHhORlFOWGFMZmU3clB3a3MKd3NrVlFlTzgyL205aFZkWnNnNUFnRDJtTS9jS2VybE9acVBGcWFEaFBoYnpkRzF4QjRtcVZmTGJVUUppa3I1SQpYQ1FhTWR2c2FRTnhPcmNPOHQwQ0F3RUFBYU5DTUVBd0RnWURWUjBQQVFIL0JBUURBZ0trTUE4R0ExVWRFd0VCCi93UUZNQU1CQWY4d0hRWURWUjBPQkJZRUZFek92OGhVUGtRYS90bGNhQTE0OERmcmF5TXRNQTBHQ1NxR1NJYjMKRFFFQkN3VUFBNElCQVFBMTFqcDR4V1hyZkRPNDJlblBpdm9HNXZxY3hqbysxaktZV1YxR1NIdHNVdlBNU1UzVAptdVFCQWU2VVRzM0JtSTgzMUQ4aFd4cDlka3BkMlhWbCt6OTZabFIvQ2Qrb3NSWWE1MUpZd2RvMUp4Z29hbUk2CmszOS9sNTRBQVpWMkFPWWNQU0pKNkNzdVcxZ2NTMDlaTlA0djlhK0NIKzY5OVpQMGlhUStEc0FPRFJzUnhRcVMKK08zNUU4K0RzRjBSOWZCYlhvbkxiK05VSHlTQ2pQSnVVT21lS0RYMFpQQm81blNscmh5cUIxbHVNZnhEaUltdgpIU3BscXB4M1duMzJnNEZYOCs3clZBNUZjWkIvNDg3bUZmdG1CTXc3aENidlFJeWY2Ymd6VTUycUdaeFZGTTVjCnUxeEZyRXlXaFA1eElJY09lY1M1RCtJa29ZOHUyT3ozQldEeQotLS0tLUVORCBDRVJUSUZJQ0FURS0tLS0tCg==
server: https://test-master:6443
name: kubernetes
contexts:
- context:
@@ -15,5 +15,5 @@ preferences: {}
users:
- name: kubernetes-admin
user:
client-certificate-data:
client-key-data:
client-certificate-data: LS0tLS1CRUdJTiBDRVJUSUZJQ0FURS0tLS0tCk1JSURFekNDQWZ1Z0F3SUJBZ0lJQjUxN3hkT3V2cnd3RFFZSktvWklodmNOQVFFTEJRQXdGVEVUTUJFR0ExVUUKQXhNS2Ez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YlBIVkF2VTVxNzIxWUZ5VjB0ejlnTWs0bDY3dVVsbUgrWmVVN3g1c1ZGYUVQN2ZtMm5jZXo2aG1EOQpVMUFlTzF5d0tTcmxrSWsvWFZuMEdKUVZaRllRUGhDbXEzLzM0Ry9nakNmTFVsalRYbDk4QlRtSU9RS3hVUUYyCllRREJBb0dBRTB5Q0NzcFE3Y1lYaVFyQnF4VVkxU2N5SjViVm1iaFN5cmgyb3FiUmRMRmxzWHFjUnBIK2tORjYKdXdjUzhZalJodmdQazgyZm1QcXlieE5ZWGxTYWoydGdzSFdpcGNETXZSM1dtSlQzTGpjeXZObDh6cUlkZDNBdQpJT1pNeG0vWWVMemNFOUdteDRsQkhmMnU5MkhiRjRiSCtqeVp3d3RWcHpRdmphaFF6dGs9Ci0tLS0tRU5EIFJTQSBQUklWQVRFIEtFWS0tLS0tCg==

+ 4
- 0
dubhe-server/common-recycle/src/main/java/org/dubhe/recycle/config/RecycleConfig.java View File

@@ -72,5 +72,9 @@ public class RecycleConfig {
* 用户删除tadl算法版本文件后,文件最大有效时长,以天为单位
*/
private Integer tadlValid;
/**
* 用户删除点云数据集文件后,文件最大有效时长,以天为单位
*/
private Integer pointCloudValid;

}

+ 2
- 1
dubhe-server/common-recycle/src/main/java/org/dubhe/recycle/enums/RecycleModuleEnum.java View File

@@ -40,7 +40,8 @@ public enum RecycleModuleEnum {
BIZ_DATAMEDICINE(8, "医学影像",SERVER_DATA_DCM),
BIZ_MEASURE(9, "度量管理",SERVER_MEASURE),
BIZ_SERVING(10, "云端部署", SERVER_SERVING),
BIZ_TADL(11,"自动机器学习",SERVER_TADL);
BIZ_TADL(11,"自动机器学习",SERVER_TADL),
BIZ_POINT_CLOUD(12,"3D点云",SERVER_POINT_CLOUD);

private Integer value;



+ 10
- 2
dubhe-server/common-recycle/src/main/java/org/dubhe/recycle/enums/RecycleResourceEnum.java View File

@@ -86,8 +86,16 @@ public enum RecycleResourceEnum {
/**
* 模型优化文件回收
*/
MODEL_OPT_RECYCLE_FILE("modelOptRecycleFile","模型优化文件回收"),
;
MODEL_OPT_RECYCLE_FILE("modelOptRecycleFile", "模型优化文件回收"),
/**
* 点云文件回收
*/
PC_DATASET_RECYCLE_FILE("pcDatasetRecycleFile", "点云数据集文件回收"),

/**
* 训练任务文件回收
*/
TRAIN_JOB_RECYCLE_FILE("trainJobRecycleFile", "训练任务文件回收");

private String className;



+ 1
- 1
dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/dao/PtTrainAlgorithmMapper.java View File

@@ -72,6 +72,6 @@ public interface PtTrainAlgorithmMapper extends BaseMapper<PtTrainAlgorithm> {
* 查询可推理预置算法
* @return List<PtTrainAlgorithmQueryVO> 返回可推理预置算法集合
*/
@Select("select * from pt_train_algorithm where deleted = 0 and inference=1 and algorithm_source=2 order by id desc")
@Select("select * from pt_train_algorithm where deleted = 0 and algorithm_source=2 order by id desc")
List<PtTrainAlgorithm> selectPreAlgorithm();
}

+ 1
- 3
dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/domain/dto/PtTrainAlgorithmCreateDTO.java View File

@@ -70,9 +70,6 @@ public class PtTrainAlgorithmCreateDTO implements Serializable {
@Length(max = MagicNumConstant.ONE_HUNDRED_TWENTY_EIGHT, message = "运行命令-输入长度不能超过128个字符")
private String runCommand;

@ApiModelProperty("运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数),管理员使用")
private JSONObject runParams;

@ApiModelProperty("算法来源(1为我的算法,2为预置算法),管理员使用")
private Integer algorithmSource;

@@ -80,6 +77,7 @@ public class PtTrainAlgorithmCreateDTO implements Serializable {
@Length(max = MagicNumConstant.ONE_HUNDRED_TWENTY_EIGHT, message = "算法用途-输入长度不能超过128个字符")
private String algorithmUsage;


@ApiModelProperty("是否输出训练结果,不填则默认为true")
private Boolean isTrainModelOut;



+ 0
- 3
dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/domain/dto/PtTrainAlgorithmQueryDTO.java View File

@@ -54,7 +54,4 @@ public class PtTrainAlgorithmQueryDTO extends PageQueryBase implements Serializa

@ApiModelProperty(value = "算法用途")
private String algorithmUsage;

@ApiModelProperty(value = "上传算法是否支持推理(true:可推理,false:不可推理)")
private Boolean inference;
}

+ 1
- 12
dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/domain/entity/PtTrainAlgorithm.java View File

@@ -85,18 +85,13 @@ public class PtTrainAlgorithm extends BaseEntity {
@TableField(value = "run_command")
private String runCommand;

/**
* 运行参数
*/
@TableField(value = "run_params", typeHandler = FastjsonTypeHandler.class)
private JSONObject runParams;

/**
* 算法用途
*/
@TableField(value = "algorithm_usage")
private String algorithmUsage;


/**
* 算法精度
*/
@@ -109,12 +104,6 @@ public class PtTrainAlgorithm extends BaseEntity {
@TableField(value = "p4_inference_speed")
private Integer p4InferenceSpeed;

/**
* 算法是否支持推理(1可推理,0不可推理)
*/
@TableField(value = "inference")
private Boolean inference;

/**
* 训练结果输出(1是,0否)
*/


+ 0
- 6
dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/domain/vo/PtTrainAlgorithmQueryVO.java View File

@@ -60,9 +60,6 @@ public class PtTrainAlgorithmQueryVO implements Serializable {
@ApiModelProperty(value = "运行命令")
private String runCommand;

@ApiModelProperty(value = "运行参数")
private JSONObject runParams;

@ApiModelProperty(value = "算法用途")
private String algorithmUsage;

@@ -81,9 +78,6 @@ public class PtTrainAlgorithmQueryVO implements Serializable {
@ApiModelProperty(value = "可视化日志(1是,0否)")
private Boolean isVisualizedLog;

@ApiModelProperty(value = "算法是否支持推理(1可推理,0不可推理)")
private Boolean inference;

@ApiModelProperty(value = "创建人")
private Long createUserId;



+ 24
- 5
dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/rest/PtTrainAlgorithmController.java View File

@@ -23,15 +23,13 @@ import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmCreateDTO;
import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmDeleteDTO;
import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmQueryDTO;
import org.dubhe.algorithm.domain.dto.PtTrainAlgorithmUpdateDTO;
import org.dubhe.algorithm.domain.vo.PtTrainAlgorithmQueryVO;
import org.dubhe.algorithm.service.PtTrainAlgorithmService;
import org.dubhe.biz.base.annotation.ApiVersion;
import org.dubhe.biz.base.constant.Permissions;
import org.dubhe.biz.base.dto.ModelOptAlgorithmCreateDTO;
import org.dubhe.biz.base.dto.TrainAlgorithmSelectAllBatchIdDTO;
import org.dubhe.biz.base.dto.TrainAlgorithmSelectAllByIdDTO;
import org.dubhe.biz.base.dto.TrainAlgorithmSelectByIdDTO;
import org.dubhe.biz.base.dto.*;
import org.dubhe.biz.base.vo.DataResponseBody;
import org.dubhe.biz.base.vo.TrainAlgorithmQureyVO;
import org.dubhe.biz.dataresponse.factory.DataResponseFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
@@ -121,4 +119,25 @@ public class PtTrainAlgorithmController {
public DataResponseBody getInferenceAlgorithm() {
return new DataResponseBody(ptTrainAlgorithmService.getInferenceAlgorithm());
}

@GetMapping("/listIdByName")
@ApiOperation("根据名称查询算法")
@PreAuthorize(Permissions.DEVELOPMENT_ALGORITHM)
public DataResponseBody listIdByName(@Validated TrainAlgorithmSelectByNameDTO trainAlgorithmSelectByNameDTO) {
return new DataResponseBody(ptTrainAlgorithmService.listIdByName(trainAlgorithmSelectByNameDTO.getAlgorithmName()));
}

@ApiOperation("根据名称获取算法信息")
@GetMapping("/findAlgorithmByName")
public DataResponseBody findAlgorithmByName(@RequestParam String name) {
return DataResponseFactory.success(ptTrainAlgorithmService.findAlgorithmByName(name));
}

@GetMapping("/getAll")
@ApiOperation("获取所有算法(我的算法和预置算法)")
@PreAuthorize(Permissions.DEVELOPMENT_ALGORITHM)
public DataResponseBody getAll(@RequestParam(required = false) String algorithmUsage) {
return DataResponseFactory.success(ptTrainAlgorithmService.getAll(algorithmUsage));
}

}

+ 25
- 0
dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/service/PtTrainAlgorithmService.java View File

@@ -118,4 +118,29 @@ public interface PtTrainAlgorithmService {
* @return List<PtTrainAlgorithmQueryVO> 返回可推理算法集合
*/
List<PtTrainAlgorithmQueryVO> getInferenceAlgorithm();

/**
* 根据算法名称获取算法id
*
* @param algorithmName 算法名称
* @return
*/
List<Long> listIdByName(String algorithmName);

/**
* 根据算法名称获取算法信息
*
* @param algorithmName 算法名称
* @return {@code TrainAlgorithmQureyVO} 算法对象
*/
TrainAlgorithmQureyVO findAlgorithmByName(String algorithmName);


/**
* 获取所有算法(预置算法和我的算法)
*
* @return
*/
List<PtTrainAlgorithmQueryVO> getAll(String algorithmUsage);

}

+ 107
- 22
dubhe-server/dubhe-algorithm/src/main/java/org/dubhe/algorithm/service/impl/PtTrainAlgorithmServiceImpl.java View File

@@ -1,12 +1,12 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* <p>
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
*
* <p>
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -17,11 +17,15 @@

package org.dubhe.algorithm.service.impl;

import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.map.HashedMap;
import org.dubhe.algorithm.async.TrainAlgorithmUploadAsync;
@@ -39,9 +43,11 @@ import org.dubhe.algorithm.domain.vo.PtTrainAlgorithmQueryVO;
import org.dubhe.algorithm.service.PtTrainAlgorithmService;
import org.dubhe.biz.base.constant.MagicNumConstant;
import org.dubhe.biz.base.constant.NumberConstant;
import org.dubhe.biz.base.constant.SymbolConstant;
import org.dubhe.biz.base.context.UserContext;
import org.dubhe.biz.base.dto.*;
import org.dubhe.biz.base.enums.AlgorithmSourceEnum;
import org.dubhe.biz.base.enums.AlgorithmStatusEnum;
import org.dubhe.biz.base.enums.DatasetTypeEnum;
import org.dubhe.biz.base.enums.ImageTypeEnum;
import org.dubhe.biz.base.exception.BusinessException;
@@ -149,10 +155,6 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {
if (ptTrainAlgorithmQueryDTO.getAlgorithmUsage() != null) {
wrapper.like("algorithm_usage", ptTrainAlgorithmQueryDTO.getAlgorithmUsage());
}
//根据算法是否可推理筛选
if (ptTrainAlgorithmQueryDTO.getInference() != null) {
wrapper.eq("inference", ptTrainAlgorithmQueryDTO.getInference());
}
if (!StringUtils.isEmpty(ptTrainAlgorithmQueryDTO.getAlgorithmName())) {
wrapper.and(qw -> qw.eq("id", ptTrainAlgorithmQueryDTO.getAlgorithmName()).or().like("algorithm_name",
ptTrainAlgorithmQueryDTO.getAlgorithmName()));
@@ -197,11 +199,10 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {
public List<Long> create(PtTrainAlgorithmCreateDTO ptTrainAlgorithmCreateDTO) {
//获取用户信息
UserContext user = userContext.getCurUser();
//获取镜像url
BaseImageDTO baseImageDTO = new BaseImageDTO();
BeanUtils.copyProperties(ptTrainAlgorithmCreateDTO, baseImageDTO);
if (StringUtils.isNotBlank(ptTrainAlgorithmCreateDTO.getImageName()) && StringUtils.isNotBlank(ptTrainAlgorithmCreateDTO.getImageTag())) {
ptTrainAlgorithmCreateDTO.setImageName(getImageUrl(baseImageDTO, user));
String imageName = ptTrainAlgorithmCreateDTO.getImageName();
String imageTag = ptTrainAlgorithmCreateDTO.getImageTag();
if (StringUtils.isNotBlank(imageName) && StringUtils.isNotBlank(imageTag)) {
ptTrainAlgorithmCreateDTO.setImageName(imageName + SymbolConstant.COLON + imageTag);
}
//创建算法校验DTO并设置默认值
setAlgorithmDtoDefault(ptTrainAlgorithmCreateDTO);
@@ -348,8 +349,6 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {
}
//算法路径
ptTrainAlgorithm.setCodeDir(targetPath);
//算法文件可推理
ptTrainAlgorithm.setInference(true);
}

/**
@@ -457,6 +456,7 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {

/**
* 根据Id查询所有数据(包含已被软删除的数据)
*
* @param trainAlgorithmSelectAllByIdDTO 算法id
* @return TrainAlgorithmQureyVO返回查询数据(包含已被软删除的数据)
*/
@@ -471,7 +471,8 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {

/**
* 根据Id查询
* @param trainAlgorithmSelectByIdDTO 算法id
*
* @param trainAlgorithmSelectByIdDTO 算法id
* @return TrainAlgorithmQureyVO 返回查询数据
*/
@Override
@@ -479,12 +480,15 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {
public TrainAlgorithmQureyVO selectById(TrainAlgorithmSelectByIdDTO trainAlgorithmSelectByIdDTO) {
PtTrainAlgorithm ptTrainAlgorithm = ptTrainAlgorithmMapper.selectById(trainAlgorithmSelectByIdDTO.getId());
TrainAlgorithmQureyVO trainAlgorithmQureyVO = new TrainAlgorithmQureyVO();
BeanUtils.copyProperties(ptTrainAlgorithm, trainAlgorithmQureyVO);
if (ptTrainAlgorithm != null) {
BeanUtils.copyProperties(ptTrainAlgorithm, trainAlgorithmQureyVO);
}
return trainAlgorithmQureyVO;
}

/**
* 根据Id批量查询
*
* @param trainAlgorithmSelectAllBatchIdDTO 算法ids
* @return List<TrainAlgorithmQureyVO> 返回查询数据
*/
@@ -507,9 +511,9 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {
* @param ptTrainAlgorithmQueryVO 镜像名称与版本
*/
private void getImageNameAndImageTag(PtTrainAlgorithm trainAlgorithm, PtTrainAlgorithmQueryVO ptTrainAlgorithmQueryVO) {
String image = trainAlgorithm.getImageName();
if (StringUtils.isNotBlank(trainAlgorithm.getImageName())) {
String imageNameSuffix = trainAlgorithm.getImageName().substring(trainAlgorithm.getImageName().lastIndexOf(StrUtil.SLASH) + MagicNumConstant.ONE);
String[] imageNameSuffixArray = imageNameSuffix.split(StrUtil.COLON);
String[] imageNameSuffixArray = image.split(StrUtil.COLON);
ptTrainAlgorithmQueryVO.setImageName(imageNameSuffixArray[0]);
ptTrainAlgorithmQueryVO.setImageTag(imageNameSuffixArray[1]);
}
@@ -556,7 +560,10 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {
PtImageQueryUrlDTO ptImageQueryUrlDTO = new PtImageQueryUrlDTO();
ptImageQueryUrlDTO.setImageTag(baseImageDto.getImageTag());
ptImageQueryUrlDTO.setImageName(baseImageDto.getImageName());
ptImageQueryUrlDTO.setProjectType(ImageTypeEnum.TRAIN.getType());
List<Integer> trainImageType = new ArrayList() {{
add(ImageTypeEnum.TRAIN.getType());
}};
ptImageQueryUrlDTO.setImageTypes(trainImageType);
DataResponseBody<String> dataResponseBody = imageClient.getImageUrl(ptImageQueryUrlDTO);
if (!dataResponseBody.succeed()) {
LogUtil.error(LogEnum.BIZ_TRAIN, " User {} gets image ,the imageName is {}, the imageTag is {}, and the result of dubhe-image service call failed", user.getUsername(), baseImageDto.getImageName(), baseImageDto.getImageTag());
@@ -572,14 +579,15 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {
}

/**
*
* @param modelOptAlgorithmCreateDTO 模型优化上传算法入参
* @return PtTrainAlgorithm 新增算法信息
*/
@Override
public ModelOptAlgorithmQureyVO modelOptimizationUploadAlgorithm(ModelOptAlgorithmCreateDTO modelOptAlgorithmCreateDTO) {
PtTrainAlgorithmCreateDTO ptTrainAlgorithmCreateDTO = new PtTrainAlgorithmCreateDTO();
ptTrainAlgorithmCreateDTO.setAlgorithmName(modelOptAlgorithmCreateDTO.getName()).setCodeDir(modelOptAlgorithmCreateDTO.getPath()).setAlgorithmUsage("模型优化").setIsTrainModelOut(false).setIsTrainOut(false).setIsVisualizedLog(false);
ptTrainAlgorithmCreateDTO.setAlgorithmName(modelOptAlgorithmCreateDTO.getName())
.setCodeDir(modelOptAlgorithmCreateDTO.getPath()).setAlgorithmUsage("5001")
.setIsTrainModelOut(false).setIsTrainOut(false).setIsVisualizedLog(false);
List<Long> ids = create(ptTrainAlgorithmCreateDTO);
PtTrainAlgorithm ptTrainAlgorithm = ptTrainAlgorithmMapper.selectById(ids.get(NumberConstant.NUMBER_0));
ModelOptAlgorithmQureyVO modelOptAlgorithmQureyVO = new ModelOptAlgorithmQureyVO();
@@ -589,6 +597,7 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {

/**
* 算法删除文件还原
*
* @param dto 还原实体
*/
@Override
@@ -616,6 +625,7 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {

/**
* 查询可推理算法
*
* @return List<PtTrainAlgorithmQueryVO> 返回可推理算法集合
*/
@Override
@@ -623,7 +633,6 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {
//获取用户信息
UserContext user = userContext.getCurUser();
QueryWrapper<PtTrainAlgorithm> wrapper = new QueryWrapper<>();
wrapper.eq("inference", true).orderByDesc("id");
List<PtTrainAlgorithm> ptTrainAlgorithms = ptTrainAlgorithmMapper.selectList(wrapper);
List<PtTrainAlgorithmQueryVO> ptTrainAlgorithmQueryResult = new ArrayList<>();
if (CollectionUtils.isNotEmpty(ptTrainAlgorithms)) {
@@ -653,4 +662,80 @@ public class PtTrainAlgorithmServiceImpl implements PtTrainAlgorithmService {
return ptTrainAlgorithmQueryResult;
}

@Override
public List<Long> listIdByName(String algorithmName) {
QueryWrapper<PtTrainAlgorithm> wrapper = new QueryWrapper<>();
wrapper.lambda()
.like(PtTrainAlgorithm::getAlgorithmName, algorithmName);
List<PtTrainAlgorithm> ptTrainAlgorithms = ptTrainAlgorithmMapper.selectList(wrapper);
List<Long> ids = Lists.newArrayList();
if (CollectionUtils.isEmpty(ptTrainAlgorithms)) {
return ids;
}
ids = ptTrainAlgorithms.stream()
.map(PtTrainAlgorithm::getId)
.collect(Collectors.toList());
return ids;
}

@Override
@DataPermissionMethod(dataType = DatasetTypeEnum.PUBLIC)
public TrainAlgorithmQureyVO findAlgorithmByName(String algorithmName) {

TrainAlgorithmQureyVO atlasTrainAlgorithmVO = new TrainAlgorithmQureyVO();
List<PtTrainAlgorithm> ptTrainAlgorithms = ptTrainAlgorithmMapper.selectList(new LambdaQueryWrapper<PtTrainAlgorithm>()
.eq(PtTrainAlgorithm::getAlgorithmName, algorithmName));
if (CollUtil.isNotEmpty(ptTrainAlgorithms)) {
BeanUtils.copyProperties(ptTrainAlgorithms.get(0), atlasTrainAlgorithmVO);
//获取镜像名称与版本
if (StrUtil.isNotBlank(ptTrainAlgorithms.get(0).getImageName())) {
String imageNameSuffix = ptTrainAlgorithms.get(0).getImageName().substring(ptTrainAlgorithms.get(0).getImageName().lastIndexOf(StrUtil.SLASH) + MagicNumConstant.ONE);
String[] imageNameSuffixArray = imageNameSuffix.split(StrUtil.COLON);
atlasTrainAlgorithmVO.setImageName(imageNameSuffixArray[0]);
atlasTrainAlgorithmVO.setImageTag(imageNameSuffixArray[1]);
}
}
return atlasTrainAlgorithmVO;
}

@Override
@DataPermissionMethod(dataType = DatasetTypeEnum.PUBLIC)
public List<PtTrainAlgorithmQueryVO> getAll(String algorithmUsage) {
List<PtTrainAlgorithmQueryVO> all = new ArrayList<>();
all.addAll(getAlgorithmListBySource(AlgorithmSourceEnum.MINE.getStatus(), algorithmUsage));
all.addAll(getAlgorithmListBySource(AlgorithmSourceEnum.PRE.getStatus(), algorithmUsage));
return all;
}

public List<PtTrainAlgorithmQueryVO> getAlgorithmListBySource(Integer algorithmSource, String algorithmUsage) {
List<PtTrainAlgorithmQueryVO> result = new ArrayList<>();
//获取用户信息
UserContext user = userContext.getCurUser();
// 获取我的算法
QueryWrapper<PtTrainAlgorithm> ptTrainAlgorithmQueryWrapper = new QueryWrapper<>();
//判断算法来源
if (AlgorithmSourceEnum.MINE.getStatus().equals(algorithmSource)) {
if (!BaseService.isAdmin(user)) {
ptTrainAlgorithmQueryWrapper.lambda().eq(PtTrainAlgorithm::getCreateUserId, userContext.getCurUserId());
}
}
if (StringUtils.isNotEmpty(algorithmUsage)) {
ptTrainAlgorithmQueryWrapper.lambda().eq(PtTrainAlgorithm::getAlgorithmUsage, algorithmUsage);
}
ptTrainAlgorithmQueryWrapper.lambda().eq(PtTrainAlgorithm::getAlgorithmStatus, AlgorithmStatusEnum.SUCCESS.getCode());
ptTrainAlgorithmQueryWrapper.lambda().eq(PtTrainAlgorithm::getAlgorithmSource, algorithmSource);
List<PtTrainAlgorithm> ptTrainAlgorithmList = ptTrainAlgorithmMapper.selectList(ptTrainAlgorithmQueryWrapper);
if (CollectionUtil.isNotEmpty(ptTrainAlgorithmList)) {
result = ptTrainAlgorithmList.stream().map(x -> {
PtTrainAlgorithmQueryVO ptTrainAlgorithmQueryVO = new PtTrainAlgorithmQueryVO();
BeanUtils.copyProperties(x, ptTrainAlgorithmQueryVO);
//获取镜像名称与版本
getImageNameAndImageTag(x, ptTrainAlgorithmQueryVO);
return ptTrainAlgorithmQueryVO;
}).collect(Collectors.toList());
}
return result;
}

}


+ 6
- 2
dubhe-server/dubhe-algorithm/src/main/resources/bootstrap.yml View File

@@ -10,7 +10,7 @@ spring:
nacos:
config:
enabled: true
namespace: dubhe-server-cloud-prod
namespace: dubhe-prod
server-addr: 127.0.0.1:8848
shared-configs[0]:
data-id: common-biz.yaml
@@ -29,9 +29,13 @@ spring:
data-id: dubhe-algorithm.yaml
group: dubhe
refresh: true
shared-configs[4]:
data-id: kubeconfig.yaml
group: dubhe
refresh: true
discovery:
enabled: true
namespace: dubhe-server-cloud-dev
namespace: dubhe-prod
group: dubhe
server-addr: 127.0.0.1:8848


+ 6
- 1
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/constant/DcmConstant.java View File

@@ -78,6 +78,11 @@ public class DcmConstant {
/**
* dcm文件上传
*/
public static final String DCM_UPLOAD = "ssh %s@%s \"docker run --rm -v %s:/nfs dcm4che/dcm4che-tools:5.10.5 storescu -c DCM4CHEE@%s:%s %s\"";
public static final String DCM_UPLOAD = "docker run --rm -v %s:/nfs dcm4che/dcm4che-tools:5.10.5 storescu -c DCM4CHEE@%s:%s %s";

/**
* dcm数据存储路径
*/
public static final String DCM_DATA_URL = "dataset/dcm/%s";

}

+ 16
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/dao/DataMedicineFileMapper.java View File

@@ -120,4 +120,20 @@ public interface DataMedicineFileMapper extends BaseMapper<DataMedicineFile> {
*/
@Delete("DELETE FROM data_medicine_file WHERE medicine_id= #{id} ")
void deleteByDatasetId(@Param("id") Long id);

/**
* 根据医学数据集id删除医学数据集文件数据
*
* @param datasetId 医学数据集ID
*/
List<Integer> getFileStatusListByDataset(@Param("datasetId") Long datasetId);

/**
* 清理所有已标注信息
*
* @param datasetId
*/
@Update("update data_medicine_file set `status` = 101 where medicine_id = #{datasetId}")
void cleanAnnotation(@Param("datasetId") Long datasetId);

}

+ 11
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/dao/DataMedicineMapper.java View File

@@ -23,6 +23,9 @@ import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.dubhe.biz.base.annotation.DataPermission;
import org.dubhe.dcm.domain.entity.DataMedicine;
import org.dubhe.dcm.domain.vo.DataMedicineSmallVO;

import java.util.List;

/**
* @description 医学数据集管理 Mapper 接口
@@ -86,4 +89,12 @@ public interface DataMedicineMapper extends BaseMapper<DataMedicine> {
*/
@Select("select * from data_medicine where id = #{id} and deleted = 1")
DataMedicine findDataMedicineByIdAndDeleteIsFalse(@Param("id") Long datasetId);

/**
* 获取医学数据集列表
*
* @return
*/
List<DataMedicineSmallVO> getList();

}

+ 15
- 1
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/domain/dto/MedicineAutoAnnotationDTO.java View File

@@ -21,7 +21,9 @@ import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import org.dubhe.biz.base.annotation.EnumValue;
import org.dubhe.data.constant.Constant;
import org.dubhe.data.constant.FileTypeEnum;
import javax.validation.constraints.NotNull;
import java.io.Serializable;

@@ -41,4 +43,16 @@ public class MedicineAutoAnnotationDTO implements Serializable {
@NotNull(message = "自动标注的数据集不能为空")
private Long medicalId;

@ApiModelProperty("模型服务ID")
@NotNull(message = "模型服务不能为空")
private Long modelServiceId;

/**
* 文件状态 400-全部 304-无标注 303-有标注
*/
@NotNull(message = "文件标注信息筛选不能空")
@EnumValue(enumClass = FileTypeEnum.class, enumMethod = "autoFileStatusIsValid",
message = Constant.ANNOTATE_FILE_TYPE_RULE)
private Integer fileStatus;

}

+ 4
- 4
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/domain/entity/DataMedicine.java View File

@@ -16,10 +16,7 @@
*/
package org.dubhe.dcm.domain.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@@ -77,6 +74,9 @@ public class DataMedicine extends BaseEntity implements Serializable {
@ApiModelProperty(value = "标注类型: 1001.器官分割 2001.病灶检测之肺结节检测")
private Integer annotateType;

@ApiModelProperty(value = "是否自动标注停止")
private Boolean stop;

public DataMedicine() {
}



+ 32
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/domain/vo/DataMedicineSmallVO.java View File

@@ -0,0 +1,32 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.dcm.domain.vo;

import lombok.Data;

/**
* @description 医学数据集完成标注文件VO
* @date 2022-05-18
*/
@Data
public class DataMedicineSmallVO {

private Long id;
private String name;
private String url;

}

+ 6
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/domain/vo/DataMedicineVO.java View File

@@ -68,6 +68,11 @@ public class DataMedicineVO implements Serializable {
@ApiModelProperty(value = "标注类型")
private Integer annotateType;

@ApiModelProperty(value = "是否自动标注停止")
private Boolean stop;



/**
* 医学数据集 转化 医学数据集详情VO 方法
*
@@ -88,6 +93,7 @@ public class DataMedicineVO implements Serializable {
dataMedicineVO.setName(dataMedicine.getName());
dataMedicineVO.setRemark(dataMedicine.getRemark());
dataMedicineVO.setAnnotateType(dataMedicine.getAnnotateType());
dataMedicineVO.setStop(dataMedicine.getStop());
return dataMedicineVO;
}
}

+ 11
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/enums/DcmDataStateEnum.java View File

@@ -18,6 +18,8 @@ package org.dubhe.dcm.machine.enums;

import org.dubhe.dcm.machine.constant.DcmDataStateCodeConstant;

import java.util.Arrays;

/**
* @description 数据集状态类
* @date 2020-08-28
@@ -121,4 +123,13 @@ public enum DcmDataStateEnum {
return null;
}

/**
* 检查当前状态是否可以自动标注
*
* @return
*/
public static boolean checkCurrentStatusWhetherToAutoLabel(Integer status) {
return !Arrays.asList(AUTOMATIC_LABELING_STATE.getCode()).contains(status);
}

}

+ 24
- 3
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/enums/DcmFileStateEnum.java View File

@@ -16,11 +16,10 @@
*/
package org.dubhe.dcm.machine.enums;

import org.dubhe.data.constant.FileTypeEnum;
import org.dubhe.dcm.machine.constant.DcmFileStateCodeConstant;

import java.util.HashSet;
import java.util.Set;
import java.util.*;


/**
@@ -135,4 +134,26 @@ public enum DcmFileStateEnum {
return null;
}

/**
* 自动标注中筛选条件对应文件状态集
*
* @return
*/
public static List<Integer> getFileStatusFromAutoLabelScreen(Integer status) {
List<Integer> noAnnotation = Arrays.asList(NOT_ANNOTATION_FILE_STATE.getCode());
List<Integer> hasAnnotation = Arrays.asList(ANNOTATION_FILE_STATE.getCode(),
AUTO_ANNOTATION_COMPLETE_FILE_STATE.getCode(), ANNOTATION_COMPLETE_FILE_STATE.getCode());
switch (status) {
case 304:
return noAnnotation;
case 303:
return hasAnnotation;
default:
List<Integer> result = new ArrayList<>();
result.addAll(noAnnotation);
result.addAll(hasAnnotation);
return result;
}
}

}

+ 14
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/state/specific/datamedicine/AnnotationCompleteDcmState.java View File

@@ -70,4 +70,18 @@ public class AnnotationCompleteDcmState extends AbstractDataMedicineState {
LogUtil.debug(LogEnum.STATE_MACHINE, " 【标注完成】 执行事件后内存状态机的切换: {}", dcmDataMedicineStateMachine.getMemoryDataMedicineState());
}

/**
* 数据集 未标注-->自动标注-->自动标注中
*
* @param medical 医学数据集对象
*/
@Override
public void autoAnnotationSaveEvent(DataMedicine medical) {
LogUtil.debug(LogEnum.STATE_MACHINE, " 【未标注】 执行事件前内存中状态机的状态 :{} ", dcmDataMedicineStateMachine.getMemoryDataMedicineState());
LogUtil.debug(LogEnum.STATE_MACHINE, " 接受参数: {} ", medical);
dataMedicineMapper.updateStatus(medical.getId(), DcmDataStateEnum.AUTOMATIC_LABELING_STATE.getCode());
dcmDataMedicineStateMachine.setMemoryDataMedicineState(dcmDataMedicineStateMachine.getAutomaticLabelingDcmState());
LogUtil.debug(LogEnum.STATE_MACHINE, " 【未标注】 执行事件后内存状态机的切换: {}", dcmDataMedicineStateMachine.getMemoryDataMedicineState());
}

}

+ 14
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/state/specific/datamedicine/AnnotationDataState.java View File

@@ -83,4 +83,18 @@ public class AnnotationDataState extends AbstractDataMedicineState {
LogUtil.debug(LogEnum.STATE_MACHINE, " 【标注中】 执行事件后内存状态机的切换: {}", dcmDataMedicineStateMachine.getMemoryDataMedicineState());
}

/**
* 数据集 标注中-->自动标注-->自动标注中
*
* @param medical 医学数据集对象
*/
@Override
public void autoAnnotationSaveEvent(DataMedicine medical) {
LogUtil.debug(LogEnum.STATE_MACHINE, " 【未标注】 执行事件前内存中状态机的状态 :{} ", dcmDataMedicineStateMachine.getMemoryDataMedicineState());
LogUtil.debug(LogEnum.STATE_MACHINE, " 接受参数: {} ", medical);
dataMedicineMapper.updateStatus(medical.getId(), DcmDataStateEnum.AUTOMATIC_LABELING_STATE.getCode());
dcmDataMedicineStateMachine.setMemoryDataMedicineState(dcmDataMedicineStateMachine.getAutomaticLabelingDcmState());
LogUtil.debug(LogEnum.STATE_MACHINE, " 【未标注】 执行事件后内存状态机的切换: {}", dcmDataMedicineStateMachine.getMemoryDataMedicineState());
}

}

+ 14
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/state/specific/datamedicine/AutoAnnotationCompleteDcmState.java View File

@@ -69,4 +69,18 @@ public class AutoAnnotationCompleteDcmState extends AbstractDataMedicineState {
LogUtil.debug(LogEnum.STATE_MACHINE, " 【自动标注完成】 执行事件后内存状态机的切换: {}", dcmDataMedicineStateMachine.getMemoryDataMedicineState());
}

/**
* 数据集 未标注-->自动标注-->自动标注中
*
* @param medical 医学数据集对象
*/
@Override
public void autoAnnotationSaveEvent(DataMedicine medical) {
LogUtil.debug(LogEnum.STATE_MACHINE, " 【未标注】 执行事件前内存中状态机的状态 :{} ", dcmDataMedicineStateMachine.getMemoryDataMedicineState());
LogUtil.debug(LogEnum.STATE_MACHINE, " 接受参数: {} ", medical);
dataMedicineMapper.updateStatus(medical.getId(), DcmDataStateEnum.AUTOMATIC_LABELING_STATE.getCode());
dcmDataMedicineStateMachine.setMemoryDataMedicineState(dcmDataMedicineStateMachine.getAutomaticLabelingDcmState());
LogUtil.debug(LogEnum.STATE_MACHINE, " 【未标注】 执行事件后内存状态机的切换: {}", dcmDataMedicineStateMachine.getMemoryDataMedicineState());
}

}

+ 0
- 4
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/statemachine/DcmDataMedicineStateMachine.java View File

@@ -139,10 +139,6 @@ public class DcmDataMedicineStateMachine extends AbstractDataMedicineState imple
@Override
public void autoAnnotationSaveEvent(DataMedicine medical) {
initMemoryDataState(medical);
if (memoryDataMedicineState != notAnnotationDcmState) {

throw new StateMachineException(ErrorMessageConstant.DATASET_CHANGE_ERR_MESSAGE);
}
memoryDataMedicineState.autoAnnotationSaveEvent(medical);
}



+ 129
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/utils/DcmStateIdentifyUtil.java View File

@@ -0,0 +1,129 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/

package org.dubhe.dcm.machine.utils;

import org.dubhe.data.domain.entity.Dataset;
import org.dubhe.data.machine.enums.DataStateEnum;
import org.dubhe.dcm.machine.enums.DcmDataStateEnum;
import org.dubhe.dcm.machine.utils.identify.data.DcmDataHub;
import org.dubhe.dcm.machine.utils.identify.setting.DcmStateIdentifySetting;
import org.dubhe.dcm.machine.utils.identify.setting.DcmStateSelect;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;

import java.lang.reflect.Method;
import java.util.List;
import java.util.Set;

/**
* @description 状态判断实现类
* @date 2020-09-24
*/
@Component
public class DcmStateIdentifyUtil {


/**
* 数据查询处理
*/
@Autowired
private DcmDataHub dataHub;

/**
* 状态判断类
*/
@Autowired
private DcmStateSelect stateSelect;

/**
* 状态判断中所有的自定义方法数组
*/
private final Method[] method = ReflectionUtils.getDeclaredMethods(DcmStateSelect.class);

/**
* 获取数据集状态(指定版本)
*
* @param datasetId 数据集id
* @param needFileStateDoIdentify 是否需要查询文件状态判断
* @return DatasetStatusEnum 数据集状态(指定版本)
*/
public DcmDataStateEnum getStatus(Long datasetId, boolean needFileStateDoIdentify) {
return needFileStateDoIdentify ?
new IdentifyDatasetStateByFileState(datasetId, DcmStateIdentifySetting.NEED_FILE_STATE_DO_IDENTIFY).getStatus()
: dataHub.getDatasetStatus(datasetId);
}

/**
* 获取数据集状态(未指定版本)
*
* @param dataset 数据集
* @param needFileStateDoIdentify 是否需要查询文件状态判断
* @return DatasetStatusEnum 数据集状态(指定版本)
*/
public DcmDataStateEnum getStatus(Dataset dataset, boolean needFileStateDoIdentify) {
return needFileStateDoIdentify ?
new IdentifyDatasetStateByFileState(dataset.getId(), DcmStateIdentifySetting.NEED_FILE_STATE_DO_IDENTIFY).getStatus()
: dataHub.getDatasetStatus(dataset.getId());
}

/**
* 获取数据集状态(自动标注/目标跟踪回滚使用)
*
* @param datasetId 数据集id
* @return DatasetStatusEnum 数据集状态(指定版本)
*/
public DcmDataStateEnum getStatusForRollback(Long datasetId) {
return new IdentifyDatasetStateByFileState(datasetId, DcmStateIdentifySetting.ROLL_BACK_FOR_STATE).getStatus();
}


class IdentifyDatasetStateByFileState {

/**
* 判断得到的数据集状态
*/
public DcmDataStateEnum state;

/**
* 会查询文件的状态去对数据集的状态做判断
*
* @param datasetId 数据集ID
*/
public IdentifyDatasetStateByFileState(Long datasetId, Set<DcmDataStateEnum> dataStateEnums) {
state = dataHub.getDatasetStatus(datasetId);
if (dataStateEnums.contains(state)) {
List<Integer> stateList = dataHub.getFileStatusListByDataset(datasetId);
if (stateList == null || stateList.isEmpty()) {
state = DcmDataStateEnum.NOT_ANNOTATION_STATE;
return;
}
for (Method stateSelectMethod : method) {
state = (DcmDataStateEnum) ReflectionUtils.invokeMethod(stateSelectMethod, stateSelect, new Object[]{stateList});
if (state != null) {
return;
}
}
}
}

DcmDataStateEnum getStatus() {
return this.state;
}
}
}

+ 67
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/utils/identify/data/DcmDataHub.java View File

@@ -0,0 +1,67 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/
package org.dubhe.dcm.machine.utils.identify.data;

import org.dubhe.data.machine.enums.DataStateEnum;
import org.dubhe.dcm.machine.enums.DcmDataStateEnum;
import org.dubhe.dcm.service.DataMedicineFileService;
import org.dubhe.dcm.service.DataMedicineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Component;

import java.util.List;

/**
* @description 数据查询/加工
* @date 2020-09-24
*/
@Component
public class DcmDataHub {

/**
* 数据集版本文件关系服务类
*/
@Autowired
private DataMedicineFileService medicineFileService;

/**
* 数据集服务类
*/
@Autowired
@Lazy
private DataMedicineService medicineService;

/**
* 获取数据集的状态
* @param datasetId 数据集ID
* @return 数据集状态枚举
*/
public DcmDataStateEnum getDatasetStatus(Long datasetId){
return DcmDataStateEnum.getState(medicineService.getOneById(datasetId).getStatus());
}

/**
* 获取数据集下文件的状态(数据经过去重处理)
* @param datasetId 数据集ID
* @return 数据集下文件状态的并集
*/
public List<Integer> getFileStatusListByDataset(Long datasetId) {
return medicineFileService.getFileStatusListByDataset(datasetId);
}

}

+ 56
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/utils/identify/setting/DcmStateIdentifySetting.java View File

@@ -0,0 +1,56 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/

package org.dubhe.dcm.machine.utils.identify.setting;

import org.dubhe.dcm.machine.enums.DcmDataStateEnum;
import org.springframework.stereotype.Component;

import java.util.HashSet;
import java.util.Set;

/**
* @description 状态判断设置类
* @date 2020-09-24
*/
@Component
public class DcmStateIdentifySetting {

/**
* 回退状态(自动标注失败/目标跟踪失败)使用
*/
public static final Set<DcmDataStateEnum> ROLL_BACK_FOR_STATE = new HashSet<DcmDataStateEnum>() {{
//自动标注中
add(DcmDataStateEnum.AUTOMATIC_LABELING_STATE);
}};


/**
* 数据集状态需要使用文件状态去判断的
*/
public static final Set<DcmDataStateEnum> NEED_FILE_STATE_DO_IDENTIFY = new HashSet<DcmDataStateEnum>() {{
//未标注
add(DcmDataStateEnum.NOT_ANNOTATION_STATE);
//手动标注中
add(DcmDataStateEnum.ANNOTATION_DATA_STATE);
//自动标注完成
add(DcmDataStateEnum.AUTO_ANNOTATION_COMPLETE_STATE);
//标注完成
add(DcmDataStateEnum.ANNOTATION_COMPLETE_STATE);
}};

}

+ 106
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/machine/utils/identify/setting/DcmStateSelect.java View File

@@ -0,0 +1,106 @@
/**
* Copyright 2020 Tianshu AI Platform. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* =============================================================
*/

package org.dubhe.dcm.machine.utils.identify.setting;

import org.dubhe.biz.base.constant.NumberConstant;
import org.dubhe.data.machine.constant.FileStateCodeConstant;
import org.dubhe.data.machine.enums.DataStateEnum;
import org.dubhe.dcm.machine.constant.DcmFileStateCodeConstant;
import org.dubhe.dcm.machine.enums.DcmDataStateEnum;
import org.springframework.stereotype.Component;

import java.util.HashSet;
import java.util.List;

/**
* @description 状态判断类
* @date 2020-09-24
*/
@Component
public class DcmStateSelect {


/**
* 手动标注中
*
* @param stateList 数据集下文件状态的并集
* @return 数据集状态枚举
*/
public DcmDataStateEnum isManualAnnotating(List<Integer> stateList) {
if (stateList.size() > 1 && stateList.contains(DcmFileStateCodeConstant.NOT_ANNOTATION_FILE_STATE)) {
return DcmDataStateEnum.ANNOTATION_DATA_STATE;
}
return stateList.contains(DcmFileStateCodeConstant.ANNOTATION_FILE_STATE) ? DcmDataStateEnum.ANNOTATION_DATA_STATE : null;
}

/**
* 自动标注完成
*
* @param stateList 数据集下文件状态的并集
* @return 数据集状态枚举
*/
public DcmDataStateEnum isAutoFinished(List<Integer> stateList) {
HashSet<Integer> states = new HashSet<Integer>() {{
add(DcmFileStateCodeConstant.AUTO_ANNOTATION_COMPLETE_FILE_STATE);
add(DcmFileStateCodeConstant.ANNOTATION_COMPLETE_FILE_STATE);
}};
switch (stateList.size()) {
case NumberConstant.NUMBER_1:
if (stateList.contains(DcmFileStateCodeConstant.AUTO_ANNOTATION_COMPLETE_FILE_STATE)){
return DcmDataStateEnum.AUTO_ANNOTATION_COMPLETE_STATE;
}
return null;
case NumberConstant.NUMBER_2:
case NumberConstant.NUMBER_3:
case NumberConstant.NUMBER_4:
for (Integer fileState : stateList) {
if (!states.contains(fileState)) {
return null;
};
}
return DcmDataStateEnum.AUTO_ANNOTATION_COMPLETE_STATE;
default:
return null;
}
}

/**
* 标注完成
*
* @param stateList 数据集下文件状态的并集
* @return 数据集状态枚举
*/
public DcmDataStateEnum isFinished(List<Integer> stateList) {
return stateList.contains(DcmFileStateCodeConstant.ANNOTATION_COMPLETE_FILE_STATE)&&stateList.size()==NumberConstant.NUMBER_1 ?
DcmDataStateEnum.ANNOTATION_COMPLETE_STATE : null;
}

/**
* 未标注
*
* @param stateList 数据集下文件状态的并集
* @return 数据集状态枚举
*/
public DcmDataStateEnum isInit(List<Integer> stateList) {
if (stateList.size() == NumberConstant.NUMBER_1 && stateList.contains(DcmFileStateCodeConstant.NOT_ANNOTATION_FILE_STATE)){
return DcmDataStateEnum.NOT_ANNOTATION_STATE;
}
return null;
}

}

+ 16
- 0
dubhe-server/dubhe-data-dcm/src/main/java/org/dubhe/dcm/rest/DataMedicineController.java View File

@@ -96,4 +96,20 @@ public class DataMedicineController {
public DataResponseBody getAuto(@PathVariable(name = "medicalId") Long medicalId) {
return new DataResponseBody(dataMedicineService.getAuto(medicalId));
}

@ApiOperation(value = "获取数据集列表")
@GetMapping("/list")
@PreAuthorize(Permissions.DATA)
public DataResponseBody list() {
return new DataResponseBody(dataMedicineService.getList());
}

@ApiOperation(value = "任务停止")
@PutMapping(value = "/task/{medicalId}/stop")
@PreAuthorize(Permissions.DATA)
public DataResponseBody taskStop(@PathVariable(name = "medicalId") Long medicalId) {
dataMedicineService.taskStop(medicalId);
return new DataResponseBody();
}

}

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save