diff --git a/dubhe-server/.gitignore b/dubhe-server/.gitignore
index a103ef3..35a9b43 100644
--- a/dubhe-server/.gitignore
+++ b/dubhe-server/.gitignore
@@ -36,7 +36,7 @@ Thumbs.db
target/
output/
*.jar
-!/dubhe-dcm/lib/dcm4che-core-5.19.1.jar
+!/dubhe-data-dcm/lib/dcm4che-core-5.19.1.jar
!.mvn/wrapper/*
*.war
*.zip
@@ -48,6 +48,4 @@ output/
.project
.classpath
logs/
-/dubhe-k8s/src/main/resources/kubeconfig
-*.log
-/dubhe-admin/kubeconfig
\ No newline at end of file
+*.log
\ No newline at end of file
diff --git a/dubhe-server/.gitmessage b/dubhe-server/.gitmessage
index f893509..e07bb61 100644
--- a/dubhe-server/.gitmessage
+++ b/dubhe-server/.gitmessage
@@ -1,5 +1,4 @@
-# type: subject
# type:feat增加新功能;fix修复错误;docs修改文档;style修改样式;refactor代码重构;test增加测试模块,不涉及生产环境的代码;chore更新核心模块,包配置文件,不涉及生产环境的代码
# subject: 一两句话简述提交原因,与下方详细描述间隔一行
diff --git a/dubhe-server/Dockerfile b/dubhe-server/Dockerfile
index 09b4f13..4c58cf6 100644
--- a/dubhe-server/Dockerfile
+++ b/dubhe-server/Dockerfile
@@ -1,62 +1,5 @@
-FROM docker
+FROM harbor.dubhe.ai/dubhe/docker-in-docker-java8-ssh:v3
+RUN apk add ffmpeg
ENV LANG=C.UTF-8
-
-#更换为aliyun源
-RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/community" > /etc/apk/repositories
-RUN echo "http://mirrors.aliyun.com/alpine/latest-stable/main" >> /etc/apk/repositories
-#update apk bash vim wget curl net-tools sshpass
-RUN apk update \
- && apk upgrade \
- && apk --no-cache add ca-certificates \
- && apk add bash \
- bash-doc \
- bash-completion \
- vim \
- wget \
- curl \
- net-tools \
- sshpass \
- && rm -rf /var/cache/apk/* \
- && /bin/bash
-
-#setup glibc
-RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-2.32-r0.apk
-RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-bin-2.32-r0.apk
-RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.32-r0/glibc-i18n-2.32-r0.apk
-RUN apk add --no-cache --virtual=.build-dependencies wget ca-certificates && \
- echo \
- "-----BEGIN PUBLIC KEY-----\
- MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEApZ2u1KJKUu/fW4A25y9m\
- y70AGEa/J3Wi5ibNVGNn1gT1r0VfgeWd0pUybS4UmcHdiNzxJPgoWQhV2SSW1JYu\
- tOqKZF5QSN6X937PTUpNBjUvLtTQ1ve1fp39uf/lEXPpFpOPL88LKnDBgbh7wkCp\
- m2KzLVGChf83MS0ShL6G9EQIAUxLm99VpgRjwqTQ/KfzGtpke1wqws4au0Ab4qPY\
- KXvMLSPLUp7cfulWvhmZSegr5AdhNw5KNizPqCJT8ZrGvgHypXyiFvvAH5YRtSsc\
- Zvo9GI2e2MaZyo9/lvb+LbLEJZKEQckqRj4P26gmASrZEPStwc+yqy1ShHLA0j6m\
- 1QIDAQAB\
- -----END PUBLIC KEY-----" | sed 's/ */\n/g' > "/etc/apk/keys/sgerrand.rsa.pub"
-RUN apk add glibc-2.32-r0.apk
-RUN apk add glibc-bin-2.32-r0.apk
-RUN apk add glibc-i18n-2.32-r0.apk
-RUN rm -rf *.apk
-
-#setup date
-RUN apk add tzdata
-RUN cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
-
-#安装jdk
-RUN wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.tar.gz"
-RUN tar xzf jdk-8u141-linux-x64.tar.gz -C /usr/local/
-ENV JAVA_HOME /usr/local/jdk1.8.0_141
-ENV PATH ${PATH}:${JAVA_HOME}/bin
-ENV CLASSPATH $JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
-
-#设置到nfs-host-ip的免密登录
-RUN ssh-keygen -t rsa -P '' -f ~/.ssh/id_rsa >/dev/null 2>&1 && \
- #让连接新主机时,不进行公钥确认
- echo "StrictHostKeyChecking no">>/etc/ssh/ssh_config && \
- #发送公钥到目标服务器
- sshpass -p nfs-host-pwd ssh-copy-id -p 22 -i ~/.ssh/id_rsa.pub nfs-host-user@nfs-host-ip
-
-COPY dubhe-admin/target/dubhe-admin-1.0-exec.jar /dubhe/
-COPY dubhe-task/target/dubhe-task-1.0.jar /dubhe/
-COPY dubhe-serving-gateway/target/dubhe-serving-gateway.jar /dubhe/
\ No newline at end of file
+COPY */target/*-exec.jar /dubhe/
+CMD ["bash", "-c","exec java $JVM_PARAM -Dspring.security.strategy=MODE_INHERITABLETHREADLOCAL -jar -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005 /dubhe/$JAR_BALL"]
diff --git a/dubhe-server/LICENSE b/dubhe-server/LICENSE
deleted file mode 100644
index 87562c3..0000000
--- a/dubhe-server/LICENSE
+++ /dev/null
@@ -1,211 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- 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.
-
-Other dependencies and licenses:
-----------------------------------------------------------------------------------------
-
-Open Source Software Licensed Under the Apache License, Version 2.0:
-The below software in this distribution may have been modified.
-----------------------------------------------------------------------------------------
-1. EL-ADMIN
-Copyright 2019-2020 Zheng Jie
\ No newline at end of file
diff --git a/dubhe-server/README.md b/dubhe-server/README.md
index a2b4755..1f6a8ed 100644
--- a/dubhe-server/README.md
+++ b/dubhe-server/README.md
@@ -1,108 +1,64 @@
-# 之江天枢-服务端
+# Spring Cloud
+## 微服务框架核心组件
+Nacos + Fegin + Gateway + (Spring Security + JWT + OAuth2)
-**之江天枢一站式人工智能开源平台**(简称:**之江天枢**),包括海量数据处理、交互式模型构建(包含Notebook和模型可视化)、AI模型高效训练。多维度产品形态满足从开发者到大型企业的不同需求,将提升人工智能技术的研发效率、扩大算法模型的应用范围,进一步构建人工智能生态“朋友圈”。
+数据库连接池 Druid
-## 源码部署
+需要额外部署 Mysql Nacos
-### 准备环境
-安装如下软件环境。
-- OpenJDK:1.8+
-- Redis: 5.0+
-- Maven: 3.0+
-- MYSQL: 5.7.0+
+## 初始化配置
+### Mysql
-### 下载源码
-``` bash
-git clone https://codeup.teambition.com/zhejianglab/dubhe-server.git
-# 进入项目根目录
-cd dubhe-server
-```
+初始化sql位置 /sql
-### 创建DB
-在MySQL中依次执行如下sql文件
-```
-sql/v1/00-Dubhe-DB.sql
-sql/v1/01-Dubhe-DDL.sql
-sql/v1/02-Dubhe-DML.sql
-```
+**地址:** 127.0.0.1:3306
+**用户名:** test **密码:** test
-### 配置
-根据实际情况修改如下配置文件。
-```
-dubhe-admin/src/main/resources/config/application-prod.yml
-```
+### Nacos
-### 构建
-``` bash
-# 构建,生成的 jar 包位于 ./dubhe-admin/target/dubhe-admin-1.0.jar
-mvn clean compile package
-```
+**如何部署:** https://nacos.io/zh-cn/docs/quick-start.html
-### 启动
-``` bash
-# 指定启动环境为 prod
-## admin模块
-java -jar ./dubhe-admin/target/dubhe-admin-1.0-exec.jar --spring.profiles.active=prod
+配置中心配置参考 /yaml
-## task模块
-java -jar ./dubhe-task/target/dubhe-task-1.0.jar --spring.profiles.active=prod
+**配置规则:** ${prefix}-${spring.profiles.active}.${file-extension}
-## serving gateway模块
-java -jar ./dubhe-serving-gateway/target/dubhe-serving-gateway.jar --spring.profiles.active=prod
-```
+**详见:** https://nacos.io/zh-cn/docs/quick-start-spring-cloud.html
+
+**地址:** http://127.0.0.1:8848/nacos/#/login
+
+**用户名:** nacos **密码:** nacos
-## 本地开发
+开发人员进行开发自测时,请使用以自己名字命名的namespace进行测试,不要使用dev或者test
-### 必要条件:
- 导入maven项目,下载所需的依赖包
- mysql下创建数据库dubhe,初始化数据脚本
- 安装redis
-### 启动:
- mvn spring-boot:run
+### swagger
+默认开启,若需要关闭,手动配置swagger.enabled: false
-## 代码结构:
+**各模块swagger访问地址:** http://{IP}:{port}/doc.html
+
+**可通过swagger统一的网关访问地址:** http://{gateway IP}:{gateway port}/doc.html查看基于gateway路由配置的后台rest服务
+
+### OAuth2
+授权token获取样例:
+*POST* http://localhost:8866/oauth/token?grant_type=password&username=admin&client_id=dubhe-client&client_secret=dubhe-secret&password=123456&scope=all
+
+请求资源时在header添加:
+Authorization: 'Bearer '+${access_token}
+
+测试服务提供者配置中心动态获取配置样例:
+header 添加-> Authorization:'Bearer '+${access_token}
+*GET* http://localhost:8860/config/get
+
+刷新token样例:
+*POST* http://localhost:8866/oauth/token?grant_type=refresh_token&client_id=dubhe-client&client_secret=dubhe-secret&scope=all&refresh_token=${refresh_token}
+
+### Admin
+登录接口
+```$xslt
+url:
+*POST* http://localhost:8870/auth/login
+param:
+{"username":"admin","password":"RBb2Czac2HBI9XNj4ZLF1QcTytOe5pN1vHZHYuAVgSAPRcYbndn/4zGDxKdXS1j0sLsDsKZLUojEXFnYHpsKxA==","code":"jggg","uuid":"validate_codeea991a3cb8ea47cca05744a47ad17a37"}
```
-├── common 公共模块
-├── dubhe-admin 开发与训练模块
-│ ├── src
-│ │ └── main
-│ │ ├── java
-│ │ │ └── org
-│ │ │ └── dubhe
-│ │ │ ├── AppRun.java
-│ │ │ ├── domain 实体对象
-│ │ │ ├── repository 数据库层
-│ │ │ ├── rest 控制层
-│ │ │ └── service 服务层
-│ │ │ ├── dto 数据传输对象
-│ │ │ ├── impl 服务实现
-│ │ │ └── mapper 对象转化
-│ │ └── resources 配置文件
-├── dubhe-data 数据处理模块
-├── dubhe-model 模型管理模块
-├── dubhe-system 系统管理
-├── dubhe-task 定时任务模块
-├── dubhe-serving 云端serving模块
-├── dubhe-serving-gateway 云端serving gateway网关模块
-```
-
-## docker服务器
- 上传镜像功能依赖docker服务,harbor与dokcer的信任配置如下:
-### 1、对外开放端口
- vi /lib/systemd/system/docker.service
- ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375 -H unix://var/run/docker.sock
-### 2、信任harbor地址
- vi /etc/docker/daemon.json
- {
- "exec-opts": ["native.cgroupdriver=systemd"],
- "log-driver": "json-file",
- "insecure-registries":[harbor地址],
- "log-opts": {
- "max-size": "100m"
- }
- }
-### 3、重新启动
- systemctl daemon-reload
- service docker restart
- systemctl status docker
+
+
diff --git a/dubhe-server/common/pom.xml b/dubhe-server/common/pom.xml
deleted file mode 100644
index 008f43c..0000000
--- a/dubhe-server/common/pom.xml
+++ /dev/null
@@ -1,120 +0,0 @@
-
-
-
- dubheplatform
- zhejianglab
- 1.0
-
- 4.0.0
-
- 5.0.6
- 7.0.2
- 1.8.9
-
-
- common
- 公共模块
-
-
-
-
- cn.hutool
- hutool-all
- ${hutool.version}
-
-
- com.google.guava
- guava
- 21.0
-
-
-
- org.apache.shiro
- shiro-spring
- ${shiro.version}
-
-
- com.auth0
- java-jwt
- ${jwt.version}
-
-
- *
- *
-
-
-
-
- io.minio
- minio
- ${minio.version}
-
-
-
-
- org.aspectj
- aspectjweaver
- ${aspectjweaver.version}
-
-
-
- javax.xml.bind
- jaxb-api
- 2.3.0
-
-
- com.sun.xml.bind
- jaxb-impl
- 2.3.0
-
-
- com.sun.xml.bind
- jaxb-core
- 2.3.0
-
-
- commons-io
- commons-io
- 1.3.2
- compile
-
-
- net.lingala.zip4j
- zip4j
- 1.3.2
-
-
- org.apache.commons
- commons-compress
- 1.20
-
-
- com.github.whvcse
- easy-captcha
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- true
-
-
-
-
-
- true
- src/main/resources
-
-
-
-
diff --git a/dubhe-server/common/src/main/java/org/dubhe/annotation/ApiVersion.java b/dubhe-server/common/src/main/java/org/dubhe/annotation/ApiVersion.java
deleted file mode 100644
index f4193f9..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/annotation/ApiVersion.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.annotation;
-
-import java.lang.annotation.*;
-
-/**
- * @description API版本控制注解
- * @date 2020-04-06
- */
-@Target({ElementType.METHOD, ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface ApiVersion {
- //标识版本号
- int value() default 1;
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/annotation/DataPermission.java b/dubhe-server/common/src/main/java/org/dubhe/annotation/DataPermission.java
deleted file mode 100644
index 0ed9b97..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/annotation/DataPermission.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.annotation;
-
-/**
- * @description 数据权限注解
- * @date 2020-09-24
- */
-import java.lang.annotation.*;
-
-@Target({ElementType.METHOD, ElementType.TYPE})
-@Retention(RetentionPolicy.RUNTIME)
-@Documented
-public @interface DataPermission {
-
- /**
- * 只在类的注解上使用,代表方法的数据权限类型
- * @return
- */
- String permission() default "";
-
- /**
- * 不需要数据权限的方法名
- * @return
- */
- String[] ignoresMethod() default {};
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/annotation/DataPermissionMethod.java b/dubhe-server/common/src/main/java/org/dubhe/annotation/DataPermissionMethod.java
deleted file mode 100644
index a7ba413..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/annotation/DataPermissionMethod.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.annotation;
-
-import org.dubhe.enums.DatasetTypeEnum;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @description 数据权限方法注解
- * @date 2020-09-24
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface DataPermissionMethod {
-
- /**
- * 是否需要拦截标识 true: 不拦截 false: 拦截
- *
- * @return 拦截标识
- */
- boolean interceptFlag() default false;
-
- /**
- * 数据类型
- *
- * @return 数据集类型
- */
- DatasetTypeEnum dataType() default DatasetTypeEnum.PRIVATE;
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/annotation/EnumValue.java b/dubhe-server/common/src/main/java/org/dubhe/annotation/EnumValue.java
deleted file mode 100644
index ddff6b1..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/annotation/EnumValue.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * 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.annotation;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-import javax.validation.Payload;
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-import java.lang.reflect.InvocationTargetException;
-import java.lang.reflect.Method;
-
-/**
- * @description 接口枚举类检测标注类
- * @date 2020-05-21
- */
-@Target({ ElementType.METHOD, ElementType.FIELD, ElementType.ANNOTATION_TYPE })
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = EnumValue.Validator.class)
-public @interface EnumValue {
-
- String message() default "custom.value.invalid";
-
- Class>[] groups() default {};
-
- Class extends Payload>[] payload() default {};
-
- Class extends Enum>> enumClass();
-
- String enumMethod();
-
- class Validator implements ConstraintValidator {
-
- private Class extends Enum>> enumClass;
- private String enumMethod;
-
- @Override
- public void initialize(EnumValue enumValue) {
- enumMethod = enumValue.enumMethod();
- enumClass = enumValue.enumClass();
- }
-
- @Override
- public boolean isValid(Object value, ConstraintValidatorContext constraintValidatorContext) {
- if (value == null) {
- return Boolean.TRUE;
- }
-
- if (enumClass == null || enumMethod == null) {
- return Boolean.TRUE;
- }
- Class> valueClass = value.getClass();
-
- try {
- Method method = enumClass.getMethod(enumMethod, valueClass);
- if (!Boolean.TYPE.equals(method.getReturnType()) && !Boolean.class.equals(method.getReturnType())) {
- throw new RuntimeException(String.format("%s method return is not boolean type in the %s class", enumMethod, enumClass));
- }
-
- Boolean result = (Boolean)method.invoke(null, value);
- return result == null ? false : result;
- } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
- throw new RuntimeException(e);
- } catch (NoSuchMethodException | SecurityException e) {
- throw new RuntimeException(String.format("This %s(%s) method does not exist in the %s", enumMethod, valueClass, enumClass), e);
- }
- }
-
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/annotation/FlagValidator.java b/dubhe-server/common/src/main/java/org/dubhe/annotation/FlagValidator.java
deleted file mode 100644
index 8821c91..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/annotation/FlagValidator.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.annotation;
-
-import javax.validation.Constraint;
-import javax.validation.ConstraintValidator;
-import javax.validation.ConstraintValidatorContext;
-import javax.validation.Payload;
-import java.lang.annotation.*;
-import java.util.Arrays;
-
-/**
- * @description 自定义状态校验注解(传入值是否在指定状态范围内)
- * @date 2020-09-18
- */
-@Target({ElementType.FIELD, ElementType.PARAMETER})
-@Retention(RetentionPolicy.RUNTIME)
-@Constraint(validatedBy = FlagValidator.Validator.class)
-@Documented
-public @interface FlagValidator {
-
- String[] value() default {};
-
- String message() default "flag value is invalid";
-
- Class>[] groups() default {};
-
- Class extends Payload>[] payload() default {};
-
- /**
- * @description 校验传入值是否在默认值范围校验逻辑
- * @date 2020-09-18
- */
- class Validator implements ConstraintValidator {
-
- private String[] values;
-
- @Override
- public void initialize(FlagValidator flagValidator) {
- this.values = flagValidator.value();
- }
-
- @Override
- public boolean isValid(Integer value, ConstraintValidatorContext constraintValidatorContext) {
- if (value == null) {
- //当状态为空时,使用默认值
- return false;
- }
- return Arrays.stream(values).anyMatch(value::equals);
- }
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/annotation/Log.java b/dubhe-server/common/src/main/java/org/dubhe/annotation/Log.java
deleted file mode 100644
index 15714ae..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/annotation/Log.java
+++ /dev/null
@@ -1,23 +0,0 @@
- /**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.annotation;
-
-/**
- * @description 日志
- * @date 2020-03-15
- */
-public @interface Log {
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/annotation/Query.java b/dubhe-server/common/src/main/java/org/dubhe/annotation/Query.java
deleted file mode 100644
index 40e1b77..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/annotation/Query.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @description 构建Wrapper的注解
- * @date 2020-03-26
- */
-@Target(ElementType.FIELD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface Query {
-
-
- String propName() default "";
-
- Type type() default Type.EQ;
-
-
- String blurry() default "";
-
- enum Type {
- // 相等
- EQ
- // 不等于
- , NE
- // 大于
- , GT
- // 大于等于
- , GE
- // 小于
- , LT
- // 小于等于
- , LE,
- BETWEEN,
- NOT_BETWEEN,
- LIKE,
- NOT_LIKE,
- LIkE_LEFT,
- LIKE_RIGHT,
- IS_NULL,
- IS_NOT_NULL,
- IN,
- NOT_IN,
- INSQL,
- NOT_INSQL,
- ORDER_BY
- }
-
-}
-
diff --git a/dubhe-server/common/src/main/java/org/dubhe/annotation/RateLimit.java b/dubhe-server/common/src/main/java/org/dubhe/annotation/RateLimit.java
deleted file mode 100644
index 87001dc..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/annotation/RateLimit.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.annotation;
-
-import java.lang.annotation.ElementType;
-import java.lang.annotation.Retention;
-import java.lang.annotation.RetentionPolicy;
-import java.lang.annotation.Target;
-
-/**
- * @description 限流
- * @date 2020-03-15
- */
-@Target(ElementType.METHOD)
-@Retention(RetentionPolicy.RUNTIME)
-public @interface RateLimit {
- double limitNum() default 20;
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/aspect/LogAspect.java b/dubhe-server/common/src/main/java/org/dubhe/aspect/LogAspect.java
deleted file mode 100755
index 172eae2..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/aspect/LogAspect.java
+++ /dev/null
@@ -1,87 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.aspect;
-
-import lombok.extern.slf4j.Slf4j;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.utils.LogUtil;
-import org.slf4j.MDC;
-import org.springframework.stereotype.Component;
-import org.springframework.util.StringUtils;
-
-import java.util.UUID;
-
-/**
- * @description 日志切面
- * @date 2020-04-10
- */
-@Component
-@Aspect
-@Slf4j
-public class LogAspect {
-
- public static final String TRACE_ID = "traceId";
-
- @Pointcut("execution(* org.dubhe..service..*.*(..))) "
- + "and execution(* org.dubhe..schedule..*.*(..))) "
- + "and execution(* org.dubhe..util*..*.*(..)))")
- public void serviceAspect() {
- }
-
- @Pointcut("execution(* org.dubhe..rest..*.*(..))) ")
- public void restAspect() {
- }
-
- @Pointcut(" execution(* org.dubhe..task..*.*(..))) ")
- public void taskAspect() {
- }
-
- @Pointcut(" serviceAspect() ")
- public void aroundAspect() {
- }
-
- @Around("aroundAspect()")
- public Object around(JoinPoint joinPoint) throws Throwable {
- if (StringUtils.isEmpty(MDC.get(TRACE_ID))) {
- MDC.put(TRACE_ID, UUID.randomUUID().toString());
- }
- return combineLogInfo(joinPoint);
- }
-
- @Around("restAspect()")
- public Object aroundRest(JoinPoint joinPoint) throws Throwable {
- MDC.clear();
- MDC.put(TRACE_ID, UUID.randomUUID().toString());
- return combineLogInfo(joinPoint);
- }
-
- private Object combineLogInfo(JoinPoint joinPoint) throws Throwable {
- Object[] param = joinPoint.getArgs();
- LogUtil.info(LogEnum.LOG_ASPECT, "uri:{},input:{},==>begin", joinPoint.getSignature(), param);
- long start = System.currentTimeMillis();
- Object result = ((ProceedingJoinPoint) joinPoint).proceed();
- long end = System.currentTimeMillis();
- LogUtil.info(LogEnum.LOG_ASPECT, "uri:{},output:{},proc_time:{},<==end", joinPoint.getSignature().toString(),
- result, end - start);
- return result;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/aspect/PermissionAspect.java b/dubhe-server/common/src/main/java/org/dubhe/aspect/PermissionAspect.java
deleted file mode 100644
index c6c8ef6..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/aspect/PermissionAspect.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * 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.aspect;
-
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.Around;
-import org.aspectj.lang.annotation.Aspect;
-import org.aspectj.lang.annotation.Pointcut;
-import org.aspectj.lang.reflect.MethodSignature;
-import org.dubhe.annotation.DataPermissionMethod;
-import org.dubhe.base.BaseService;
-import org.dubhe.base.DataContext;
-import org.dubhe.domain.dto.CommonPermissionDataDTO;
-import org.dubhe.enums.DatasetTypeEnum;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.utils.JwtUtils;
-import org.dubhe.utils.LogUtil;
-import org.springframework.stereotype.Component;
-
-import java.lang.reflect.Method;
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * @description 数据权限切面
- * @date 2020-09-24
- */
-@Aspect
-@Component
-public class PermissionAspect {
-
- /**
- * 公共数据的有用户ID
- */
- public static final Long PUBLIC_DATA_USER_ID = 0L;
-
- /**
- * 基于注解的切面方法
- */
- @Pointcut("@annotation(org.dubhe.annotation.DataPermissionMethod)")
- private void cutMethod() {
-
- }
-
- /**
- *环绕通知
- * @param joinPoint 切入参数对象
- * @return 返回方法结果集
- * @throws Throwable
- */
- @Around("cutMethod()")
- public Object around(ProceedingJoinPoint joinPoint) throws Throwable {
- // 获取方法传入参数
- Object[] params = joinPoint.getArgs();
- DataPermissionMethod dataPermissionMethod = getDeclaredAnnotation(joinPoint);
-
- if (!Objects.isNull(JwtUtils.getCurrentUserDto()) && !Objects.isNull(dataPermissionMethod)) {
- Set ids = new HashSet<>();
- ids.add(JwtUtils.getCurrentUserDto().getId());
- CommonPermissionDataDTO commonPermissionDataDTO = CommonPermissionDataDTO.builder().type(dataPermissionMethod.interceptFlag()).resourceUserIds(ids).build();
- if (DatasetTypeEnum.PUBLIC.equals(dataPermissionMethod.dataType())) {
- ids.add(PUBLIC_DATA_USER_ID);
- commonPermissionDataDTO.setResourceUserIds(ids);
- }
- DataContext.set(commonPermissionDataDTO);
- }
- // 执行源方法
- try {
- return joinPoint.proceed(params);
- } finally {
- // 模拟进行验证
- BaseService.removeContext();
- }
- }
-
- /**
- * 获取方法中声明的注解
- *
- * @param joinPoint 切入参数对象
- * @return DataPermissionMethod 方法注解类型
- */
- public DataPermissionMethod getDeclaredAnnotation(ProceedingJoinPoint joinPoint){
- // 获取方法名
- String methodName = joinPoint.getSignature().getName();
- // 反射获取目标类
- Class> targetClass = joinPoint.getTarget().getClass();
- // 拿到方法对应的参数类型
- Class>[] parameterTypes = ((MethodSignature) joinPoint.getSignature()).getParameterTypes();
- // 根据类、方法、参数类型(重载)获取到方法的具体信息
- Method objMethod = null;
- try {
- objMethod = targetClass.getMethod(methodName, parameterTypes);
- } catch (NoSuchMethodException e) {
- LogUtil.error(LogEnum.BIZ_DATASET,"获取注解方法参数异常 error:{}",e);
- }
- // 拿到方法定义的注解信息
- DataPermissionMethod annotation = objMethod.getDeclaredAnnotation(DataPermissionMethod.class);
- // 返回
- return annotation;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/BaseConvert.java b/dubhe-server/common/src/main/java/org/dubhe/base/BaseConvert.java
deleted file mode 100644
index 4b75c40..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/BaseConvert.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.base;
-
-import java.util.List;
-
-/**
- * @description DTO Entity 转换
- * @date 2020-03-15
- */
-public interface BaseConvert {
-
- /**
- * DTO转Entity
- *
- * @param dto /
- * @return /
- */
- E toEntity(D dto);
-
- /**
- * Entity转DTO
- *
- * @param entity /
- * @return /
- */
- D toDto(E entity);
-
- /**
- * DTO集合转Entity集合
- *
- * @param dtoList /
- * @return /
- */
- List toEntity(List dtoList);
-
- /**
- * Entity集合转DTO集合
- *
- * @param entityList /
- * @return /
- */
- List toDto(List entityList);
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/BaseDTO.java b/dubhe-server/common/src/main/java/org/dubhe/base/BaseDTO.java
deleted file mode 100644
index e91a107..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/BaseDTO.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.base;
-
-import lombok.Getter;
-import lombok.Setter;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description DTO基础类
- * @date 2020-03-15
- */
-@Getter
-@Setter
-public class BaseDTO implements Serializable {
-
- private Boolean deleted;
-
- private Timestamp createTime;
-
- private Timestamp updateTime;
-
- @Override
- public String toString() {
- return "BaseDTO{" +
- "deleted=" + deleted +
- ", createTime=" + createTime +
- ", updateTime=" + updateTime +
- '}';
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/BaseEntity.java b/dubhe-server/common/src/main/java/org/dubhe/base/BaseEntity.java
deleted file mode 100644
index 6c949b4..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/BaseEntity.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * 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.base;
-
-import com.baomidou.mybatisplus.annotation.FieldFill;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableLogic;
-import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import java.io.Serializable;
-import java.lang.reflect.Field;
-import java.sql.Timestamp;
-
-/**
- * @description Entity基础类
- * @date 2020-03-15
- */
-@Data
-public class BaseEntity implements Serializable {
-
- private static final long serialVersionUID = 4936056317364745513L;
-
- /**
- * 删除标识
- **/
- @TableField(value = "deleted",fill = FieldFill.INSERT)
- @TableLogic
- private Boolean deleted = false;
-
- @TableField(value = "create_user_id",fill = FieldFill.INSERT)
- private Long createUserId;
-
- @TableField(value = "update_user_id",fill = FieldFill.INSERT_UPDATE)
- private Long updateUserId;
-
- @TableField(value = "create_time",fill = FieldFill.INSERT)
- private Timestamp createTime;
-
-
- @TableField(value = "update_time",fill = FieldFill.INSERT_UPDATE)
- private Timestamp updateTime;
-
- @Override
- public String toString() {
- ToStringBuilder builder = new ToStringBuilder(this);
- Field[] fields = this.getClass().getDeclaredFields();
- try {
- for (Field f : fields) {
- f.setAccessible(true);
- builder.append(f.getName(), f.get(this)).append("\n");
- }
- } catch (Exception e) {
- builder.append("toString builder encounter an error");
- }
- return builder.toString();
- }
-
- public @interface Update {
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/BaseImageDTO.java b/dubhe-server/common/src/main/java/org/dubhe/base/BaseImageDTO.java
deleted file mode 100644
index 57da55c..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/BaseImageDTO.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.base;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
-
-/**
- * @description 镜像基础类DTO
- * @date 2020-07-14
- */
-@Data
-@Accessors(chain = true)
-public class BaseImageDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "镜像版本", required = true)
- @NotBlank(message = "镜像版本不能为空")
- private String imageTag;
-
- @ApiModelProperty(value = "镜像名称", required = true)
- @NotBlank(message = "镜像名称不能为空")
- private String imageName;
-
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/BaseService.java b/dubhe-server/common/src/main/java/org/dubhe/base/BaseService.java
deleted file mode 100644
index 310b673..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/BaseService.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * 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.base;
-
-import org.dubhe.constant.PermissionConstant;
-import org.dubhe.domain.dto.UserDTO;
-import org.dubhe.domain.entity.Role;
-import org.dubhe.exception.BaseErrorCode;
-import org.dubhe.exception.BusinessException;
-import org.dubhe.utils.JwtUtils;
-import org.springframework.util.CollectionUtils;
-
-import java.util.List;
-import java.util.Objects;
-import java.util.stream.Collectors;
-
-/**
- * @description 服务层基础数据公共方法类
- * @date 2020-03-27
- */
-public class BaseService {
-
- private BaseService (){}
-
- /**
- * 校验是否具有管理员权限
- */
- public static void checkAdminPermission() {
- if(!isAdmin()){
- throw new BusinessException(BaseErrorCode.DATASET_ADMIN_PERMISSION_ERROR);
- }
- }
-
- /**
- * 校验是否是管理管理员
- *
- * @return 校验标识
- */
- public static Boolean isAdmin() {
- UserDTO currentUserDto = JwtUtils.getCurrentUserDto();
- if (currentUserDto != null && !CollectionUtils.isEmpty(currentUserDto.getRoles())) {
- List roles = currentUserDto.getRoles();
- List roleList = roles.stream().
- filter(a -> a.getId().compareTo(PermissionConstant.ADMIN_USER_ID) == 0)
- .collect(Collectors.toList());
- if (!CollectionUtils.isEmpty(roleList)) {
- return true;
- }
- }
- return false;
- }
-
-
- /**
- * 清除本地线程数据权限数据
- */
- public static void removeContext(){
- if( !Objects.isNull(DataContext.get())){
- DataContext.remove();
- }
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/BaseVO.java b/dubhe-server/common/src/main/java/org/dubhe/base/BaseVO.java
deleted file mode 100644
index c347515..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/BaseVO.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.base;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description VO基础类
- * @date 2020-05-22
- */
-@Data
-public class BaseVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("创建人")
- private Long createUserId;
-
- @ApiModelProperty("创建时间")
- private Timestamp createTime;
-
- @ApiModelProperty("修改人")
- private Long updateUserId;
-
- @ApiModelProperty("修改时间")
- private Timestamp updateTime;
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/DataContext.java b/dubhe-server/common/src/main/java/org/dubhe/base/DataContext.java
deleted file mode 100644
index 3223c90..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/DataContext.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.base;
-
-
-import org.dubhe.domain.dto.CommonPermissionDataDTO;
-
-/**
- * @description 共享上下文数据集信息
- * @date 2020-04-10
- */
-public class DataContext {
-
- /**
- * 私有化构造参数
- */
- private DataContext() {
- }
-
- private static final ThreadLocal CONTEXT = new ThreadLocal<>();
-
- /**
- * 存放数据集信息
- *
- * @param datasetVO
- */
- public static void set(CommonPermissionDataDTO datasetVO) {
- CONTEXT.set(datasetVO);
- }
-
- /**
- * 获取用户信息
- *
- * @return
- */
- public static CommonPermissionDataDTO get() {
- return CONTEXT.get();
- }
-
- /**
- * 清除当前线程内引用,防止内存泄漏
- */
- public static void remove() {
- CONTEXT.remove();
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/DataResponseBody.java b/dubhe-server/common/src/main/java/org/dubhe/base/DataResponseBody.java
deleted file mode 100644
index 6699252..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/DataResponseBody.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * 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.base;
-
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.slf4j.MDC;
-
-import java.io.Serializable;
-
-/**
- * @description 统一的公共响应体
- * @date 2020-03-16
- */
-@Data
-@ApiModel(description = "统一的公共响应体")
-public class DataResponseBody implements Serializable {
-
- /**
- * 返回状态码
- */
- @ApiModelProperty("返回状态码")
- private Integer code;
- /**
- * 返回信息
- */
- @ApiModelProperty("返回信息")
- private String msg;
- /**
- * 泛型数据
- */
- @ApiModelProperty("泛型数据")
- private T data;
- /**
- * 链路追踪ID
- */
- @ApiModelProperty("链路追踪ID")
- private String traceId;
-
- public DataResponseBody() {
- this(ResponseCode.SUCCESS, null);
- }
-
- public DataResponseBody(T data) {
- this(ResponseCode.SUCCESS, null, data);
- }
-
- public DataResponseBody(Integer code, String msg) {
- this(code, msg, null);
- }
-
- public DataResponseBody(Integer code, String msg, T data) {
- this.code = code;
- this.msg = msg;
- this.data = data;
- this.traceId = MDC.get("traceId");
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/MagicNumConstant.java b/dubhe-server/common/src/main/java/org/dubhe/base/MagicNumConstant.java
deleted file mode 100644
index 84e7c4a..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/MagicNumConstant.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * 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.base;
-
-/**
- * @description 常用常量类
- * @date 2020-05-14
- */
-public final class MagicNumConstant {
-
- public static final int NEGATIVE_ONE = -1;
- public static final int ZERO = 0;
- public static final int ONE = 1;
- public static final int TWO = 2;
- public static final int THREE = 3;
- public static final int FOUR = 4;
- public static final int FIVE = 5;
- public static final int SIX = 6;
- public static final int SEVEN = 7;
- public static final int EIGHT = 8;
- public static final int NINE = 9;
- public static final int TEN = 10;
-
- public static final int ELEVEN = 11;
- public static final int SIXTEEN = 16;
- public static final int TWENTY = 20;
- public static final int FIFTY = 50;
- public static final int SIXTY = 60;
- public static final int SIXTY_TWO = 62;
- public static final int SIXTY_FOUR = 64;
- public static final int INTEGER_TWO_HUNDRED_AND_FIFTY_FIVE = 255;
- public static final int ONE_HUNDRED = 100;
- public static final int ONE_HUNDRED_TWENTY_EIGHT = 128;
- public static final int TWO_HUNDRED = 200;
- public static final int FIVE_HUNDRED = 500;
- public static final int FIVE_HUNDRED_AND_SIXTEEN = 516;
- public static final int ONE_THOUSAND = 1000;
- public static final int BINARY_TEN_EXP = 1024;
- public static final int ONE_THOUSAND_ONE_HUNDRED = 1100;
- public static final int ONE_THOUSAND_ONE_HUNDRED_ONE = 1101;
- public static final int ONE_THOUSAND_TWO_HUNDRED = 1200;
- public static final int ONE_THOUSAND_TWO_HUNDRED_ONE = 1201;
- public static final int ONE_THOUSAND_TWENTY_FOUR = 1024;
- public static final int ONE_THOUSAND_THREE_HUNDRED = 1300;
- public static final int ONE_THOUSAND_THREE_HUNDRED_ONE = 1301;
- public static final int ONE_THOUSAND_THREE_HUNDRED_NINE = 1309;
- public static final int ONE_THOUSAND_FIVE_HUNDRED = 1500;
- public static final int TWO_THOUSAND = 2000;
- public static final int TWO_THOUSAND_TWENTY_EIGHT = 2048;
- public static final int THREE_THOUSAND = 3000;
- public static final int FOUR_THOUSAND = 4000;
- public static final int NINE_THOUSAND = 9000;
- public static final int NINE_THOUSAND_NINE_HUNDRED_NINTY_NINE = 9999;
- public static final int TEN_THOUSAND = 10000;
- public static final int FIFTEEN_THOUSAND = 15000;
- public static final int HUNDRED_THOUSAND = 100000;
- public static final int MILLION = 1000000;
- public static final int ONE_MINUTE = 60000;
-
- public static final long NEGATIVE_ONE__LONG = -1L;
- public static final long ZERO_LONG = 0L;
- public static final long ONE_LONG = 1L;
- public static final long TWO_LONG = 2L;
- public static final long THREE_LONG = 3L;
- public static final long FOUR_LONG = 4L;
- public static final long FIVE_LONG = 5L;
- public static final long SIX_LONG = 6L;
- public static final long SEVEN_LONG = 7L;
- public static final long EIGHT_LONG = 8L;
- public static final long NINE_LONG = 9L;
- public static final long TEN_LONG = 10L;
-
- public static final long TWELVE_LONG = 12L;
- public static final long SIXTY_LONG = 60L;
- public static final long THOUSAND_LONG = 1000L;
- public static final long TEN_THOUSAND_LONG = 10000L;
- public static final long ONE_ZERO_ONE_ZERO_ONE_ZERO_LONG = 101010L;
- public static final long NINE_ZERO_NINE_ZERO_NINE_ZERO_LONG = 909090L;
- public static final long ONE_YEAR_BEFORE_LONG = 1552579200000L;
-
- public static final int SIXITY_0XFF = 0xFF;
-
-
- private MagicNumConstant() {
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/PageQueryBase.java b/dubhe-server/common/src/main/java/org/dubhe/base/PageQueryBase.java
deleted file mode 100644
index ce56dd3..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/PageQueryBase.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.base;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.constant.NumberConstant;
-
-import javax.validation.constraints.Min;
-
-/**
- * @description 分页基类
- * @date 2020-05-08
- */
-@Data
-@Accessors(chain = true)
-public class PageQueryBase {
-
- @ApiModelProperty(value = "分页-当前页数")
- @Min(value = 1, message = "current不能小于1")
- private Integer current;
-
- @ApiModelProperty(value = "分页-每页展示数")
- @Min(value = 1, message = "size不能小于1")
- private Integer size;
-
-
- @ApiModelProperty(value = "排序字段")
- private String sort;
-
- @ApiModelProperty(value = "排序方式,asc | desc")
- private String order;
-
- public Page toPage() {
- Page page = new Page();
- if (this.current != null) {
- page.setCurrent(this.current);
- }
- if (this.size != null && this.size < NumberConstant.MAX_PAGE_SIZE) {
- page.setSize(this.size);
- }
- return page;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/ResponseCode.java b/dubhe-server/common/src/main/java/org/dubhe/base/ResponseCode.java
deleted file mode 100644
index 247a50a..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/ResponseCode.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.base;
-
-/**
- * @description 返回状态码
- * @date 2020-02-23
- */
-public class ResponseCode {
- public static Integer SUCCESS = 200;
- public static Integer UNAUTHORIZED = 401;
- public static Integer ERROR = 10000;
- public static Integer ENTITY_NOT_EXIST = 10001;
- public static Integer BADREQUEST = 10002;
- public static Integer SERVICE_ERROR = 10003;
- public static Integer DOCKER_ERROR = 10004;
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/base/ScheduleTaskHandler.java b/dubhe-server/common/src/main/java/org/dubhe/base/ScheduleTaskHandler.java
deleted file mode 100644
index a4ade6c..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/base/ScheduleTaskHandler.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.base;
-
-import org.dubhe.enums.LogEnum;
-import org.dubhe.utils.LogUtil;
-
-/**
- * @description 定时任务处理器, 主要做日志标识
- * @date 2020-08-13
- */
-public class ScheduleTaskHandler {
-
-
- public static void process(Handler handler) {
- LogUtil.startScheduleTrace();
- try {
- handler.run();
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_SYS, "There is something wrong in schedule task handler :{}", e);
- } finally {
- LogUtil.cleanTrace();
- }
- }
-
-
- public interface Handler {
- void run();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/GlobalCorsConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/GlobalCorsConfig.java
deleted file mode 100644
index 45a57c8..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/GlobalCorsConfig.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.config;
-
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.cors.CorsConfiguration;
-import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
-import org.springframework.web.filter.CorsFilter;
-
-/**
- * @description 允许跨域
- * @date 2020-02-23
- */
-@Configuration
-public class GlobalCorsConfig {
-
- @Bean
- public CorsFilter corsFilter() {
- //1.添加CORS配置信息
- CorsConfiguration config = new CorsConfiguration();
- //放行哪些原始域
- config.addAllowedOrigin("*");
- //是否发送Cookie信息
- config.setAllowCredentials(true);
- //放行哪些原始域(请求方式)
- config.addAllowedMethod("OPTIONS");
- config.addAllowedMethod("HEAD");
- config.addAllowedMethod("GET");
- config.addAllowedMethod("PUT");
- config.addAllowedMethod("POST");
- config.addAllowedMethod("DELETE");
- config.addAllowedMethod("PATCH");
- config.addAllowedHeader("*");
-
- //2.添加映射路径
- UrlBasedCorsConfigurationSource configSource = new UrlBasedCorsConfigurationSource();
- configSource.registerCorsConfiguration("/**", config);
-
- //3.返回新的CorsFilter.
- return new CorsFilter(configSource);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/K8sNameConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/K8sNameConfig.java
deleted file mode 100644
index de702d5..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/K8sNameConfig.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.config;
-
-import lombok.Getter;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-
-/**
- * @description k8s命名相关配置
- *
- * @date 2020-05-13
- */
-@Getter
-@Configuration
-public class K8sNameConfig {
-
- @Value("${k8s.nfs-root-path}")
- private String nfsRootPath;
-
- @Value("${k8s.namespace}")
- private String namespace;
-
- @Value("${minio.bucketName}")
- private String fileBucket;
-
- @Value("${train-job.docker-dataset-path}")
- private String datasetPath;
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/LocalDateTimeSerializerConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/LocalDateTimeSerializerConfig.java
deleted file mode 100644
index 8fba81e..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/LocalDateTimeSerializerConfig.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.config;
-
-import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-
-import java.time.LocalDateTime;
-import java.time.format.DateTimeFormatter;
-
-@Configuration
-public class LocalDateTimeSerializerConfig {
- @Value("${spring.jackson.date-format}")
- private String pattern;
-
- @Bean
- public LocalDateTimeSerializer localDateTimeDeserializer() {
- return new LocalDateTimeSerializer(DateTimeFormatter.ofPattern(pattern));
- }
-
- @Bean
- public Jackson2ObjectMapperBuilderCustomizer jackson2ObjectMapperBuilderCustomizer() {
- return builder -> builder.serializerByType(LocalDateTime.class, localDateTimeDeserializer());
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/MetaHandlerConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/MetaHandlerConfig.java
deleted file mode 100644
index 7202208..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/MetaHandlerConfig.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * 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.config;
-
-import com.baomidou.mybatisplus.core.handlers.MetaObjectHandler;
-import org.apache.ibatis.reflection.MetaObject;
-import org.dubhe.constant.StringConstant;
-import org.dubhe.domain.dto.UserDTO;
-import org.dubhe.enums.SwitchEnum;
-import org.dubhe.utils.DateUtil;
-import org.dubhe.utils.JwtUtils;
-import org.springframework.stereotype.Component;
-
-import java.util.Objects;
-
-/**
- * @description 处理新增和更新的基础数据填充,配合BaseEntity和MyBatisPlusConfig使用
- * @date 2020-06-10
- */
-@Component
-public class MetaHandlerConfig implements MetaObjectHandler {
-
-
- /**
- * 新增数据执行
- *
- * @param metaObject 基础数据
- */
- @Override
- public void insertFill(MetaObject metaObject) {
- if (Objects.isNull(getFieldValByName(StringConstant.CREATE_TIME, metaObject))) {
- this.setFieldValByName(StringConstant.CREATE_TIME, DateUtil.getCurrentTimestamp(), metaObject);
- }
- if (Objects.isNull(getFieldValByName(StringConstant.UPDATE_TIME, metaObject))) {
- this.setFieldValByName(StringConstant.UPDATE_TIME, DateUtil.getCurrentTimestamp(), metaObject);
- }
- if (Objects.isNull(getFieldValByName(StringConstant.UPDATE_USER_ID, metaObject))) {
- this.setFieldValByName(StringConstant.UPDATE_USER_ID, getUserId(), metaObject);
- }
- if (Objects.isNull(getFieldValByName(StringConstant.CREATE_USER_ID, metaObject))) {
- this.setFieldValByName(StringConstant.CREATE_USER_ID, getUserId(), metaObject);
- }
- if (Objects.isNull(getFieldValByName(StringConstant.ORIGIN_USER_ID, metaObject))) {
- this.setFieldValByName(StringConstant.ORIGIN_USER_ID, getUserId(), metaObject);
- }
- if (Objects.isNull(getFieldValByName(StringConstant.DELETED, metaObject))) {
- this.setFieldValByName(StringConstant.DELETED, SwitchEnum.getBooleanValue(SwitchEnum.OFF.getValue()), metaObject);
- }
- }
-
- /**
- * 更新数据执行
- *
- * @param metaObject 基础数据
- */
- @Override
- public void updateFill(MetaObject metaObject) {
- if (Objects.isNull(getFieldValByName(StringConstant.UPDATE_TIME, metaObject))) {
- this.setFieldValByName(StringConstant.UPDATE_TIME, DateUtil.getCurrentTimestamp(), metaObject);
- }
- if (Objects.isNull(getFieldValByName(StringConstant.UPDATE_USER_ID, metaObject))) {
- this.setFieldValByName(StringConstant.UPDATE_USER_ID, getUserId(), metaObject);
- }
-
- }
-
-
- /**
- * 获取用户ID
- *
- * @return
- */
- private Long getUserId() {
- UserDTO userDTO = JwtUtils.getCurrentUserDto();
- return Objects.isNull(userDTO) ? null : userDTO.getId();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/MybatisPlusConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/MybatisPlusConfig.java
deleted file mode 100644
index 0740c65..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/MybatisPlusConfig.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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.config;
-
-import org.dubhe.interceptor.PaginationInterceptor;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-/**
- * @description mybatis plus拦截器
- * @date 2020-06-10
- */
-@EnableTransactionManagement
-@Configuration
-public class MybatisPlusConfig {
-
- /**
- * 注入 MybatisPlus 分页拦截器
- *
- * @return 自定义MybatisPlus分页拦截器
- */
- @Bean
- public PaginationInterceptor paginationInterceptor() {
- PaginationInterceptor paginationInterceptor = new PaginationInterceptor();
- return paginationInterceptor;
- }
-}
-
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/NfsConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/NfsConfig.java
deleted file mode 100644
index 2881aa9..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/NfsConfig.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.config;
-
-import lombok.Data;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-/**
- * @description NFS config
- * @create 2020/5/13
- */
-@Data
-@Component
-public class NfsConfig {
-
- @Value("${k8s.nfs}")
- private String nfsIp;
-
- @Value("${k8s.nfs-root-path}")
- private String rootDir;
-
- @Value("/${minio.bucketName}/")
- private String bucket;
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/RecycleConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/RecycleConfig.java
deleted file mode 100644
index 1a54aef..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/RecycleConfig.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * @description 垃圾回收机制配置常量
- * @date 2020-09-21
- */
-@Data
-@Component
-@ConfigurationProperties(prefix = "recycle.timeout")
-public class RecycleConfig {
-
- /**
- * 回收无效文件的默认有效时长
- */
- private Integer date;
-
- /**
- * 用户上传文件至临时路径下后文件最大有效时长,以小时为单位
- */
- private Integer fileValid;
-
- /**
- * 用户删除某一算法后,其算法文件最大有效时长,以天为单位
- */
- private Integer algorithmValid;
-
- /**
- * 用户删除某一模型后,其模型文件最大有效时长,以天为单位
- */
- private Integer modelValid;
-
- /**
- * 用户删除训练任务后,其训练管理文件最大有效时长,以天为单位
- */
- private Integer trainValid;
-
- /**
- * 删除服务器无效文件(大文件)
- * 示例:rsync --delete-before -d /空目录 /需要回收的源目录
- */
- public static final String DEL_COMMAND = "ssh %s@%s \"mkdir -p %s; rsync --delete-before -d %s %s; rmdir %s %s\"";
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/RedisConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/RedisConfig.java
deleted file mode 100644
index f76f43d..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/RedisConfig.java
+++ /dev/null
@@ -1,214 +0,0 @@
-/**
- * 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.config;
-
-import cn.hutool.core.lang.Assert;
-import com.alibaba.fastjson.JSON;
-import com.alibaba.fastjson.parser.ParserConfig;
-import com.alibaba.fastjson.serializer.SerializerFeature;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.codec.digest.DigestUtils;
-import org.dubhe.utils.StringUtils;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
-import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
-import org.springframework.boot.autoconfigure.data.redis.RedisProperties;
-import org.springframework.boot.context.properties.EnableConfigurationProperties;
-import org.springframework.cache.Cache;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
-import org.springframework.cache.annotation.EnableCaching;
-import org.springframework.cache.interceptor.CacheErrorHandler;
-import org.springframework.cache.interceptor.KeyGenerator;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.data.redis.cache.RedisCacheConfiguration;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.core.RedisOperations;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.serializer.RedisSerializationContext;
-import org.springframework.data.redis.serializer.RedisSerializer;
-
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
-import java.time.Duration;
-import java.util.HashMap;
-import java.util.Map;
-/**
- * @description redis配置类
- * @date 2020-03-25
- */
-@Slf4j
-@Configuration
-@EnableCaching
-@ConditionalOnClass(RedisOperations.class)
-@EnableConfigurationProperties(RedisProperties.class)
-public class RedisConfig extends CachingConfigurerSupport {
-
- /**
- * 设置 redis 数据默认过期时间,默认2小时
- * 设置@cacheable 序列化方式
- */
- @Bean
- public RedisCacheConfiguration redisCacheConfiguration() {
- FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class);
- RedisCacheConfiguration configuration = RedisCacheConfiguration.defaultCacheConfig();
- configuration = configuration.serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(fastJsonRedisSerializer)).entryTtl(Duration.ofHours(2));
- return configuration;
- }
-
- @SuppressWarnings("all")
- @Bean(name = "redisTemplate")
- @ConditionalOnMissingBean(name = "redisTemplate")
- public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) {
- RedisTemplate template = new RedisTemplate<>();
- //序列化
- FastJsonRedisSerializer fastJsonRedisSerializer = new FastJsonRedisSerializer<>(Object.class);
- // value值的序列化采用fastJsonRedisSerializer
- template.setValueSerializer(fastJsonRedisSerializer);
- template.setHashValueSerializer(fastJsonRedisSerializer);
- // 全局开启AutoType,这里方便开发,使用全局的方式
- ParserConfig.getGlobalInstance().setAutoTypeSupport(true);
- // 建议使用这种方式,小范围指定白名单
- // ParserConfig.getGlobalInstance().addAccept("org.dubhe.domain");
- // key的序列化采用StringRedisSerializer
- template.setKeySerializer(new StringRedisSerializer());
- template.setHashKeySerializer(new StringRedisSerializer());
- template.setConnectionFactory(redisConnectionFactory);
- return template;
- }
-
- /**
- * 自定义缓存key生成策略,默认将使用该策略
- */
- @Bean
- @Override
- public KeyGenerator keyGenerator() {
- return (target, method, params) -> {
- Map container = new HashMap<>(3);
- Class> targetClassClass = target.getClass();
- // 类地址
- container.put("class", targetClassClass.toGenericString());
- // 方法名称
- container.put("methodName", method.getName());
- // 包名称
- container.put("package", targetClassClass.getPackage());
- // 参数列表
- for (int i = 0; i < params.length; i++) {
- container.put(String.valueOf(i), params[i]);
- }
- // 转为JSON字符串
- String jsonString = JSON.toJSONString(container);
- // 做SHA256 Hash计算,得到一个SHA256摘要作为Key
- return DigestUtils.sha256Hex(jsonString);
- };
- }
-
- @Bean
- @Override
- public CacheErrorHandler errorHandler() {
- // 异常处理,当Redis发生异常时,打印日志,但是程序正常走
- log.info("初始化 -> [{}]", "Redis CacheErrorHandler");
- return new CacheErrorHandler() {
- @Override
- public void handleCacheGetError(RuntimeException e, Cache cache, Object key) {
- log.error("Redis occur handleCacheGetError:key -> [{}]", key, e);
- }
-
- @Override
- public void handleCachePutError(RuntimeException e, Cache cache, Object key, Object value) {
- log.error("Redis occur handleCachePutError:key -> [{}];value -> [{}]", key, value, e);
- }
-
- @Override
- public void handleCacheEvictError(RuntimeException e, Cache cache, Object key) {
- log.error("Redis occur handleCacheEvictError:key -> [{}]", key, e);
- }
-
- @Override
- public void handleCacheClearError(RuntimeException e, Cache cache) {
- log.error("Redis occur handleCacheClearError:", e);
- }
- };
- }
-
-}
-
-/**
- * Value 序列化
- *
- * @param
- */
-class FastJsonRedisSerializer implements RedisSerializer {
-
- private Class clazz;
-
- FastJsonRedisSerializer(Class clazz) {
- super();
- this.clazz = clazz;
- }
-
- @Override
- public byte[] serialize(T t) {
- if (t == null) {
- return new byte[0];
- }
- return JSON.toJSONString(t, SerializerFeature.WriteClassName).getBytes(StandardCharsets.UTF_8);
- }
-
- @Override
- public T deserialize(byte[] bytes) {
- if (bytes == null || bytes.length <= 0) {
- return null;
- }
- String str = new String(bytes, StandardCharsets.UTF_8);
- return JSON.parseObject(str, clazz);
- }
-
-}
-
-/**
- * 重写序列化器
- *
- */
-class StringRedisSerializer implements RedisSerializer {
-
- private final Charset charset;
-
- StringRedisSerializer() {
- this(StandardCharsets.UTF_8);
- }
-
- private StringRedisSerializer(Charset charset) {
- Assert.notNull(charset, "Charset must not be null!");
- this.charset = charset;
- }
-
- @Override
- public String deserialize(byte[] bytes) {
- return (bytes == null ? null : new String(bytes, charset));
- }
-
- @Override
- public byte[] serialize(Object object) {
- String string = JSON.toJSONString(object);
- if (StringUtils.isBlank(string)) {
- return null;
- }
- string = string.replace("\"", "");
- return string.getBytes(charset);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/Resources.java b/dubhe-server/common/src/main/java/org/dubhe/config/Resources.java
deleted file mode 100644
index e926b95..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/Resources.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.config;
-
-import org.springframework.context.annotation.PropertySource;
-import org.springframework.context.i18n.LocaleContextHolder;
-
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.ResourceBundle;
-
-/**
- * @description 加载配置
- * @date 2020-03-15
- */
-@PropertySource(value = {"classpath:config/thirdParty.properties", "classpath:i18n/messages*.properties"})
-public final class Resources {
- /**
- * 第三方登录配置
- */
- public static final ResourceBundle THIRDPARTY = ResourceBundle.getBundle("config/thirdParty");
- /**
- * 国际化信息
- */
- private static final Map MESSAGES = new HashMap();
-
- /**
- * 国际化信息
- */
- public static String getMessage(String key, Object... params) {
- Locale locale = LocaleContextHolder.getLocale();
- ResourceBundle message = MESSAGES.get(locale.getLanguage());
- if (message == null) {
- synchronized (MESSAGES) {
- message = MESSAGES.get(locale.getLanguage());
- if (message == null) {
- message = ResourceBundle.getBundle("i18n/messages", locale);
- MESSAGES.put(locale.getLanguage(), message);
- }
- }
- }
- if (params != null && params.length > 0) {
- return String.format(message.getString(key), params);
- }
- return message.getString(key);
- }
-
- /**
- * 清除国际化信息
- */
- public static void flushMessage() {
- MESSAGES.clear();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/SecurityConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/SecurityConfig.java
deleted file mode 100644
index 5f8c817..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/SecurityConfig.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.config;
-
-import org.springframework.context.annotation.Configuration;
-import org.springframework.security.config.annotation.web.builders.HttpSecurity;
-import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
-
-/**
- * @description 关闭Security
- * @date 2020-03-25
- */
-@Configuration
-public class SecurityConfig extends WebSecurityConfigurerAdapter {
-
- @Override
- protected void configure(HttpSecurity http) throws Exception {
- http.authorizeRequests().antMatchers("/**").permitAll().and().csrf().disable();
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/SwaggerConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/SwaggerConfig.java
deleted file mode 100644
index e4a4ebd..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/SwaggerConfig.java
+++ /dev/null
@@ -1,138 +0,0 @@
-/**
- * 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.config;
-
-import com.fasterxml.classmate.TypeResolver;
-import com.google.common.base.Predicates;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.core.Ordered;
-import org.springframework.data.domain.Pageable;
-import springfox.documentation.builders.ApiInfoBuilder;
-import springfox.documentation.builders.ParameterBuilder;
-import springfox.documentation.builders.PathSelectors;
-import springfox.documentation.schema.AlternateTypeRule;
-import springfox.documentation.schema.AlternateTypeRuleConvention;
-import springfox.documentation.schema.ModelRef;
-import springfox.documentation.service.ApiInfo;
-import springfox.documentation.service.Parameter;
-import springfox.documentation.spi.DocumentationType;
-import springfox.documentation.spring.web.plugins.Docket;
-import springfox.documentation.swagger2.annotations.EnableSwagger2;
-
-import java.sql.Timestamp;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import static com.google.common.collect.Lists.newArrayList;
-import static springfox.documentation.schema.AlternateTypeRules.newRule;
-
-/**
- * @description api页面 /swagger-ui.html
- * @date 2020-03-25
- */
-
-@Configuration
-@EnableSwagger2
-public class SwaggerConfig {
-
- @Value("${jwt.header}")
- private String tokenHeader;
-
- @Value("${jwt.token-start-with}")
- private String tokenStartWith;
-
- @Value("${swagger.enabled}")
- private Boolean enabled;
-
- @Value("${server.rest-version}")
- private String restVersion;
-
- @Bean
- @SuppressWarnings("all")
- public Docket createRestApi() {
- List pars = new ArrayList<>();
- pars.add(new ParameterBuilder().name(tokenHeader).description("token")
- .modelRef(new ModelRef("string"))
- .parameterType("header")
- .defaultValue(tokenStartWith + " ")
- .required(true)
- .build());
- pars.add(new ParameterBuilder().name("version").description("版本")
- .modelRef(new ModelRef("string"))
- .parameterType("path")
- .defaultValue(restVersion)
- .required(false)
- .build());
- return new Docket(DocumentationType.SWAGGER_2)
- .enable(enabled)
- .apiInfo(apiInfo())
- .select()
- .paths(Predicates.not(PathSelectors.regex("/error.*")))
- .build().directModelSubstitute(Timestamp.class, Date.class)
- .globalOperationParameters(pars);
- }
-
- private ApiInfo apiInfo() {
- return new ApiInfoBuilder()
- .title("之江天枢一站式人工智能开源平台")
- .version("1.0")
- .build();
- }
-
-}
-
-/**
- * 将Pageable转换展示在swagger中
- */
-@Configuration
-class SwaggerDataConfig {
-
- @Bean
- public AlternateTypeRuleConvention pageableConvention(final TypeResolver resolver) {
- return new AlternateTypeRuleConvention() {
- @Override
- public int getOrder() {
- return Ordered.HIGHEST_PRECEDENCE;
- }
-
- @Override
- public List rules() {
- return newArrayList(newRule(resolver.resolve(Pageable.class), resolver.resolve(Page.class)));
- }
- };
- }
-
- @ApiModel
- @Data
- private static class Page {
- @ApiModelProperty("页码 (0..N)")
- private Integer page;
-
- @ApiModelProperty("每页显示的数目")
- private Integer size;
-
- @ApiModelProperty("以下列格式排序标准:property[,asc | desc]。 默认排序顺序为升序。 支持多种排序条件:如:id,asc")
- private List sort;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/TrainHarborConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/TrainHarborConfig.java
deleted file mode 100644
index cd4c9ea..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/TrainHarborConfig.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * @description harbor相关配置
- * @date 2020-07-17
- */
-@Data
-@Component
-@ConfigurationProperties(prefix = "harbor")
-public class TrainHarborConfig {
-
- private String address;
-
- private String username;
-
- private String password;
-
- private String modelName;
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/TrainJobConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/TrainJobConfig.java
deleted file mode 100644
index 0565cb1..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/TrainJobConfig.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * 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.config;
-
-import lombok.Data;
-import org.springframework.boot.context.properties.ConfigurationProperties;
-import org.springframework.stereotype.Component;
-
-/**
- * @description 训练常量
- * @date 2020-05-12
- */
-@Component
-@Data
-@ConfigurationProperties(prefix = "train-job")
-public class TrainJobConfig {
-
- private String namespace;
-
- private String versionLabel;
-
- private String separator;
-
- private String podName;
-
- private String pythonFormat;
-
- private String manage;
-
- private String outPath;
-
- private String logPath;
-
- private String visualizedLogPath;
-
- private String dockerDatasetPath;
-
- private String dockerTrainPath;
-
- private String dockerOutPath;
-
- private String dockerLogPath;
-
- private String dockerDataset;
-
- private String dockerModelPath;
-
- private String dockerTeacherModelPath;
-
- private String dockerTeacherModelKey;
-
- private String dockerStudentModelKey;
-
- private String dockerStudentModelPath;
-
- private String atlasAnaconda;
-
- private String atlasPythonioencoding;
-
- private String dockerValDatasetPath;
-
- private String loadValDatasetKey;
-
- private String dockerVisualizedLogPath;
-
- private String loadPath;
-
- private String loadKey;
-
- private String eight;
-
- private String plusEight;
-
- private String nodeIps;
-
- private String nodeNum;
-
- private String gpuNumPerNode;
-
- public static final String TRAIN_ID = "trainId";
-
- public static final String TRAIN_VERSION = "trainVersion";
-
- public static final String RUN_TIME = "runtime";
-
- public static final String TRAIN_STATUS = "trainStatus";
-
- public static final String CREATE_TIME = "createTime";
-
- public static final String ALGORITHM_NAME = "algorithmName";
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/TrainPoolConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/TrainPoolConfig.java
deleted file mode 100644
index 93a377e..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/TrainPoolConfig.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * 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.config;
-
-import org.dubhe.enums.LogEnum;
-import org.dubhe.utils.LogUtil;
-import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Bean;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.scheduling.annotation.AsyncConfigurer;
-import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
-
-import java.util.concurrent.Executor;
-import java.util.concurrent.ThreadPoolExecutor;
-
-/**
- * @description 线程池配置类
- * @date 2020-07-17
- */
-@Configuration
-public class TrainPoolConfig implements AsyncConfigurer {
-
- @Value("${basepool.corePoolSize:40}")
- private Integer corePoolSize;
- @Value("${basepool.maximumPoolSize:60}")
- private Integer maximumPoolSize;
- @Value("${basepool.keepAliveTime:120}")
- private Integer keepAliveTime;
- @Value("${basepool.blockQueueSize:20}")
- private Integer blockQueueSize;
-
- /**
- * 训练任务异步处理线程池
- * @return Executor 线程实例
- */
- @Bean("trainExecutor")
- @Override
- public Executor getAsyncExecutor() {
- ThreadPoolTaskExecutor taskExecutor = new ThreadPoolTaskExecutor();
- //核心线程数
- taskExecutor.setCorePoolSize(corePoolSize);
- taskExecutor.setAllowCoreThreadTimeOut(true);
- //最大线程数
- taskExecutor.setMaxPoolSize(maximumPoolSize);
- //超时时间
- taskExecutor.setKeepAliveSeconds(keepAliveTime);
- //配置队列大小
- taskExecutor.setQueueCapacity(blockQueueSize);
- //配置线程池前缀
- taskExecutor.setThreadNamePrefix("async-train-");
- //拒绝策略
- taskExecutor.setRejectedExecutionHandler(new ThreadPoolExecutor.AbortPolicy());
- taskExecutor.initialize();
- return taskExecutor;
- }
-
- @Override
- public AsyncUncaughtExceptionHandler getAsyncUncaughtExceptionHandler() {
- LogUtil.error(LogEnum.BIZ_TRAIN, "开始捕获训练管理异步任务异常信息-----》》》");
- return (ex, method, params) -> {
- LogUtil.error(LogEnum.BIZ_TRAIN, "训练管理方法名{}的异步任务执行失败,参数信息:{},异常信息:{}", method.getName(), params, ex);
- };
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/WebMvcConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/WebMvcConfig.java
deleted file mode 100644
index d8bb2a5..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/WebMvcConfig.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.config;
-
-import org.dubhe.interceptor.K8sCallBackPodInterceptor;
-import org.dubhe.utils.K8sCallBackTool;
-import org.springframework.context.annotation.Configuration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
-import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
-
-import javax.annotation.Resource;
-
-/**
- * @description Web Mvc Config
- *
- * @date 2020-05-28
- */
-@Configuration
-public class WebMvcConfig implements WebMvcConfigurer {
-
- @Resource
- private K8sCallBackPodInterceptor k8sCallBackPodInterceptor;
-
- @Override
- public void addInterceptors(InterceptorRegistry registry) {
- InterceptorRegistration registration = registry.addInterceptor(k8sCallBackPodInterceptor);
- // 拦截配置
- registration.addPathPatterns(K8sCallBackTool.getK8sCallbackPaths());
-
- }
-
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/config/WebMvcRegistrationsConfig.java b/dubhe-server/common/src/main/java/org/dubhe/config/WebMvcRegistrationsConfig.java
deleted file mode 100644
index 90f6a9e..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/config/WebMvcRegistrationsConfig.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.config;
-
-import org.dubhe.handle.CustomRequestMappingHandlerMapping;
-import org.springframework.boot.SpringBootConfiguration;
-import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
-import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
-
-/**
- * @description API版本控制
- * @date 2020-04-06
- */
-@SpringBootConfiguration
-public class WebMvcRegistrationsConfig implements WebMvcRegistrations {
- @Override
- public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
- return new CustomRequestMappingHandlerMapping();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/AlgorithmSourceEnum.java b/dubhe-server/common/src/main/java/org/dubhe/constant/AlgorithmSourceEnum.java
deleted file mode 100644
index bd95bce..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/AlgorithmSourceEnum.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.constant;
-
-import lombok.Getter;
-
-/**
- * @description 算法枚举类
- * @date 2020-05-12
- */
-@Getter
-public enum AlgorithmSourceEnum {
-
- /**
- * MINE 算法来源 我的算法
- */
- MINE(1, "MINE"),
- /**
- * PRE 算法来源 预置算法
- */
- PRE(2,"PRE");
-
- private Integer status;
-
- private String message;
-
- AlgorithmSourceEnum(Integer status, String message) {
- this.status = status;
- this.message = message;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/ErrorMessageConstant.java b/dubhe-server/common/src/main/java/org/dubhe/constant/ErrorMessageConstant.java
deleted file mode 100644
index 3b6209e..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/ErrorMessageConstant.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.constant;
-
-/**
- * @description 状态机异常量类
- * @date 2020-09-01
- */
-public class ErrorMessageConstant {
-
- private ErrorMessageConstant(){}
-
- /**
- * 数据状态异常信息
- */
- public static final String FILE_CHANGE_ERR_MESSAGE = "当前文件状态不可变更";
-
- /**
- * 数据状态异常信息
- */
- public static final String DATASET_CHANGE_ERR_MESSAGE = "当前数据集状态不可变更";
-
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/ModelOptConstant.java b/dubhe-server/common/src/main/java/org/dubhe/constant/ModelOptConstant.java
deleted file mode 100644
index b191317..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/ModelOptConstant.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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.constant;
-
-import lombok.Data;
-import org.springframework.stereotype.Component;
-
-/**
- * @description 模型优化常量
- * @date 2020-05-25
- */
-@Component
-@Data
-public class ModelOptConstant {
-
- /**
- * 模型优化任务结果字典
- */
- public static final String TASK_RESULT_DICT_NAME = "opt_result";
- /**
- * 数据集挂载路径
- */
- public static final String DATASET_MOUNT_PATH = "/usr/local/dataset";
- /**
- *算法挂载路径
- */
- public static final String ALGORITHM_MOUNT_PATH = "/usr/local/algorithm";
- /**
- *输入模型挂载路径
- */
- public static final String INPUT_MODEL_BEFORE_MOUNT_PATH = "/usr/local/input/model";
- /**
- *输出日志挂载路径
- */
- public static final String OUTPUT_LOG_MOUNT_PATH = "/usr/local/output/log";
- /**
- *压缩前评估结果挂载路径
- */
- public static final String OUTPUT_RESULT_BEFORE_MOUNT_PATH = "/usr/local/output/result/before";
- /**
- *输出模型挂载路径
- */
- public static final String OUTPUT_MODEL_MOUNT_PATH = "/usr/local/output/model";
- /**
- *压缩后评估结果挂载路径
- */
- public static final String OUTPUT_RESULT_AFTER_MOUNT_PATH = "/usr/local/output/result/after";
- /**
- * 使用的CPU配额
- */
- public static final int CPU_NUM = 2048;
- /**
- * 使用的GPU配额
- */
- public static final int GPU_NUM = 1;
- /**
- * 使用的内存配额
- */
- public static final int MEMORY_NUM = 8000;
- /**
- * CNN剪枝算法启动命令
- */
- public static final String OPT_START_SLIMMING_COMMAND = "cd /usr/local/algorithm && python run.py --prune_method=%s --model=%s --data_type=%s --dataset_dir=%s --model_save_dir=%s --log_dir=%s --before_result_dir=%s --after_result_dir=%s";
- /**
- * 量化算法启动命令
- */
- public static final String OPT_START_QUANTIFY_COMMAND = "cd /usr/local/algorithm && python3 of_cnn_evaluate.py --model=%s --model_load_dir=%s --val_data_dir=%s --log_dir=%s --result_dir=%s --use_tensorrt=False --use_int8_online=False && python3 of_cnn_evaluate.py --model=%s --model_load_dir=%s --val_data_dir=%s --log_dir=%s --result_dir=%s --use_tensorrt=True --use_int8_online=True";
- /**
- * 非内置运行命令
- */
- public static final String MY_OPT_COMMAND = "cd %s && %s";
- /**
- * 模型优化结果日志路径
- */
- public static final String OPTIMIZE_LOG = "/log";
- /**
- * 模型优化结果保存模型路径
- */
- public static final String OPTIMIZE_MODEL = "/model";
- /**
- * 模型优化结果保存优化前模型评估参数
- */
- public static final String OPTIMIZE_JSON_BEFORE = "/before";
- /**
- * 模型优化结果保存优化后模型评估参数
- */
- public static final String OPTIMIZE_JSON_AFTER = "/after";
- /**
- * 模型优化结果JSON文件名称
- */
- public static final String OPTIMIZE_JSON_NAME = "/results_eval.json";
- /**
- * 我的压缩算法根路径
- */
- public static final String MY_OPT_ALGORITHM_ROOT_PATH = "/model-opt/myAlgorithms/";
- /**
- * 我的数据集
- */
- public static final String MY_OPT_DATASET_ROOT_PATH = "/model-opt/myDataset/";
- /**
- * 算法准确度名称
- */
- public static final String ACCURACY = "accuracy";
- /**
- * 复制模型后缀文件夹名称
- */
- public static final String COPY_MODEL_POSTFIX = "/model";
- /**
- * 基于神经元权重剪枝
- */
- public static final String NEURONAL_PRUNING = "基于神经元权重剪枝";
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/ModelOptErrorEnum.java b/dubhe-server/common/src/main/java/org/dubhe/constant/ModelOptErrorEnum.java
deleted file mode 100644
index d16073b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/ModelOptErrorEnum.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * 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.constant;
-
-import lombok.Getter;
-import org.dubhe.exception.ErrorCode;
-
-/**
- * @description 模型优化错误码
- * @date 2020-05-22
- */
-@Getter
-public enum ModelOptErrorEnum implements ErrorCode {
-
- /**
- * 该模型优化任务不存在
- */
- MODEL_OPT_TASK_ABSENT(1400, "该模型优化任务不存在"),
- /**
- * 该模型优化任务实例不存在
- */
- MODEL_OPT_TASK_INSTANCE_ABSENT(1401, "该模型优化任务实例不存在"),
- /**
- * 模型优化任务实例创建失败
- */
- MODEL_OPT_TASK_INSTANCE_CREATE_FAILED(1402, "模型优化任务实例创建失败"),
- /**
- * 模型优化任务名称已存在
- */
- MODEL_OPT_TASK_NAME_EXIST(1403, "模型优化任务名称已存在"),
- /**
- * 该任务已存在等待或进行中的实例
- */
- MODEL_OPT_TASK_INSTANCE_EXIST(1404, "该任务已存在等待或进行中的实例"),
- /**
- * 请先取消等待或进行中的实例
- */
- MODEL_OPT_TASK_DELETE_ERROR(1405, "请先取消等待或进行中的实例"),
-
- /**
- * 请先添加模型优化结果字典
- */
- MODEL_OPT_TASK_RESULT_DICT_EMPTY(1406, "请先添加模型优化结果字典"),
-
- /**
- * 模型压缩算法不存在
- */
- MODEL_OPT_ALGORITHM_NOT_EXIST(1407, "模型压缩算法不存在"),
-
- /**
- * 任务未完成,不能下载
- */
- MODEL_OPT_TASK_UNFINISHED(1408, "任务未完成,不能下载"),
-
- /**
- * 数据集不存在,请选择正确的数据集
- */
- MODEL_OPT_DATASET_ABSENT(1409, "数据集不存在,请选择正确的数据集"),
-
- /**
- * 当前状态不能进行此操作
- */
- MODEL_OPT_TASK_INSTANCE_STATUS_ERROR(1410, "当前状态不能进行此操作"),
-
- /**
- * 模型不存在
- */
- MODEL_OPT_MODEL_NOT_EXIST(1411, "模型不存在"),
-
- /**
- * 请先登录
- */
- NO_USER_LOGGED_IN(1412, "请先登录"),
-
- /**
- * 当前用户无此操作权限
- */
- NO_PERMISSION(1413, "当前用户无此操作权限"),
-
- /**
- * 内部错误
- */
- INTERNAL_SERVER_ERROR(1414, "内部错误"),
-
- /**
- * 字典参数不存在,请先添加字典
- */
- PARAM_DICT_NOT_EXIST(1415, "字典参数不存在,请先添加字典"),
-
- /**
- * 无可用镜像,请先在字典中配置镜像
- */
- IMAGES_DICT_NOT_EXIST(1416, "无可用镜像,请先在字典中配置镜像"),
-
- /**
- * 容器启动失败
- */
- CONTAINER_START_FAILED(1417, "容器启动失败"),
-
- /**
- * 数据集名称已存在
- */
- DATASET_NAME_EXIST(1418, "数据集名称已存在");
-
- private Integer code;
- private String msg;
-
- ModelOptErrorEnum(Integer code, String msg) {
- this.code = code;
- this.msg = msg;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/ModelOptInstanceStatusEnum.java b/dubhe-server/common/src/main/java/org/dubhe/constant/ModelOptInstanceStatusEnum.java
deleted file mode 100644
index 235d74b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/ModelOptInstanceStatusEnum.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.constant;
-
-import lombok.Getter;
-
-/**
- * @description 模型优化常量
- * @date 2020-05-22
- */
-@Getter
-public enum ModelOptInstanceStatusEnum {
-
- /**
- * 模型优化任务状态
- */
- WAITING("-1", "等待中"),
- RUNNING("0", "进行中"),
- COMPLETED("1", "已完成"),
- CANCELED("2", "已取消"),
- EXEC_FAILED("3", "执行失败"),
-
- ;
- private String value;
- private String msg;
-
- ModelOptInstanceStatusEnum(String value, String msg) {
- this.value = value;
- this.msg = msg;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/NumberConstant.java b/dubhe-server/common/src/main/java/org/dubhe/constant/NumberConstant.java
deleted file mode 100644
index e7ee3d7..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/NumberConstant.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.constant;
-
-/**
- * @description 数字常量
- * @date 2020-06-09
- */
-public class NumberConstant {
-
- public final static int NUMBER_0 = 0;
- public final static int NUMBER_1 = 1;
- public final static int NUMBER_2 = 2;
- public final static int NUMBER_3 = 3;
- public final static int NUMBER_4 = 4;
- public final static int NUMBER_5 = 5;
- public final static int NUMBER_6 = 6;
- public final static int NUMBER_8 = 8;
- public final static int NUMBER_10 = 10;
- public final static int NUMBER_25 = 25;
- public final static int NUMBER_30 = 30;
- public final static int NUMBER_50 = 50;
- public final static int NUMBER_60 = 60;
- public final static int NUMBER_1024 = 1024;
- public final static int NUMBER_1000 = 1000;
- public final static int NUMBER_100 = 100;
- public final static int HOUR_SECOND = 60 * 60;
- public final static int DAY_SECOND = 60 * 60 * 24;
- public final static int WEEK_SECOND = 60 * 60 * 24 * 7;
- public final static int MAX_PAGE_SIZE = 2000;
- public final static int MAX_MESSAGE_LENGTH = 1024 * 1024 * 1024;
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/PermissionConstant.java b/dubhe-server/common/src/main/java/org/dubhe/constant/PermissionConstant.java
deleted file mode 100644
index 82a28e3..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/PermissionConstant.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.constant;
-
-import lombok.Data;
-import org.springframework.stereotype.Component;
-
-/**
- * @description 权限常量
- * @date 2020-05-25
- */
-@Component
-@Data
-public class PermissionConstant {
-
- /**
- * 超级用户
- */
- public static final long ADMIN_USER_ID = 1L;
-
- /**
- * 数据集模块类型
- */
- public static final Integer RESOURCE_DATA_MODEL = 1;
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/Permissions.java b/dubhe-server/common/src/main/java/org/dubhe/constant/Permissions.java
deleted file mode 100644
index 62b0e88..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/Permissions.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * 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.constant;
-
-/**
- * @description 权限标识,对应 menu 表中的 permission 字段
- * @date 2020-05-14
- */
-public final class Permissions {
-
- /**
- * 数据管理
- */
- public static final String DATA = "data";
- public static final String DATA_DATASET = "data:dataset";
-
- /**
- * 模型开发
- */
- public static final String DEVELOPMENT = "development";
- public static final String DEVELOPMENT_NOTEBOOK = "development:notebook";
- public static final String DEVELOPMENT_ALGORITHM = "development:algorithm";
-
- /**
- * 训练管理
- */
- public static final String TRAINING = "training";
- public static final String TRAINING_IMAGE = "training:image";
- public static final String TRAINING_JOB = "training:job";
-
- /**
- * 模型管理
- */
- public static final String MODEL = "model";
- public static final String MODEL_MODEL = "model:model";
- public static final String MODEL_OPTIMIZE = "model:optimize";
-
- /**
- * 控制台
- */
- public static final String SYSTEM = "system";
- public static final String SYSTEM_USER = "system:user";
- public static final String SYSTEM_ROLE = "system:role";
- public static final String SYSTEM_MENU = "system:menu";
- public static final String SYSTEM_DICT = "system:dict";
- public static final String SYSTEM_NODE = "system:node";
- public static final String SYSTEM_LOG = "system:log";
- public static final String SYSTEM_TEAM = "system:team";
-
- /**
- * 云端Serving
- */
- public static final String SERVING = "serving";
- public static final String SERVING_DEPLOYMENT = "serving:deployment";
- public static final String SERVING_BATCH = "serving:batch";
-
- private Permissions() {
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/RedisConstants.java b/dubhe-server/common/src/main/java/org/dubhe/constant/RedisConstants.java
deleted file mode 100644
index b9715eb..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/RedisConstants.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.constant;
-
-
-import org.dubhe.base.MagicNumConstant;
-
-/**
- * @description redis 常量
- * @date 2020-12-17
- */
-public class RedisConstants {
- /**
- * 分布式锁过期时间
- */
- public static final Long DELAY_CUD_RESOURCE_EXPIRE_TIME = MagicNumConstant.TEN_LONG;
- /**
- * 分布式锁
- */
- public static final String DELAY_CUD_RESOURCE_KEY = "k8sclient:task:k8s_delay_cud_resource";
- /**
- * 延时启动队列
- */
- public static final String DELAY_APPLY_ZSET_KEY = "k8sclient:task:delay_apply_zset";
- /**
- * 延时停止队列
- */
- public static final String DELAY_STOP_ZSET_KEY = "k8sclient:task:delay_stop_zset";
- /**
- * 延时队列值
- */
- public static final String DELAY_ZSET_VALUE = "%s__%s";
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/StringConstant.java b/dubhe-server/common/src/main/java/org/dubhe/constant/StringConstant.java
deleted file mode 100644
index b03bfb6..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/StringConstant.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/**
- * 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.constant;
-
-import java.util.regex.Pattern;
-
-/**
- * @description 字符串constant
- * @date 2020-05-14
- */
-public final class StringConstant {
-
- public static final String MSIE = "MSIE";
- public static final String MOZILLA = "Mozilla";
- public static final String REQUEST_METHOD_GET = "GET";
-
- /**
- * 字母、数字、英文横杠和下划线匹配
- */
- public static final String REGEXP = "^[a-zA-Z0-9\\-\\_\\u4e00-\\u9fa5]+$";
- /**
- * 整数匹配
- */
- public static final Pattern PATTERN_NUM = Pattern.compile("^[-\\+]?[\\d]*$");
-
-
- /**
- * 公共字段
- */
- public static final String CREATE_TIME = "createTime";
- public static final String UPDATE_TIME = "updateTime";
- public static final String UPDATE_USER_ID = "updateUserId";
- public static final String CREATE_USER_ID = "createUserId";
- public static final String ORIGIN_USER_ID = "originUserId";
- public static final String DELETED = "deleted";
- public static final String UTF8 = "utf-8";
- public static final String JSON_REQUEST = "application/json";
- public static final String K8S_CALLBACK_URI = "/api/k8s/callback/pod";
- public static final String K8S_CALLBACK_PATH_DEPLOYMENT = "/api/k8s/callback/deployment";
- public static final String MULTIPART = "multipart/form-data";
- /**
- * 分页内容
- */
- public static final String RESULT = "result";
- /**
- * 排序规则
- */
- public static final String SORT_ASC = "asc";
-
- public static final String SORT_DESC = "desc";
-
- public static final String QUERY = "query";
-
- public static final String NGINX_LOWERCASE = "nginx";
-
- public static final String TRUE_LOWERCASE = "true";
-
- public static final String GRPC_CAPITALIZE = "GRPC";
-
-
- /**
- * 测试环境
- */
- public static final String PROFILE_ACTIVE_TEST = "test";
-
- private StringConstant() {
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/SymbolConstant.java b/dubhe-server/common/src/main/java/org/dubhe/constant/SymbolConstant.java
deleted file mode 100644
index de5650a..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/SymbolConstant.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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.constant;
-
-/**
- * @description 符号常量
- * @date 2020-5-29
- */
-public class SymbolConstant {
- public static final String SLASH = "/";
- public static final String COMMA = ",";
- public static final String COLON = ":";
- public static final String LINEBREAK = "\n";
- public static final String BLANK = "";
- public static final String QUESTION = "?";
- public static final String ZERO = "0";
- public static final String DOT = ".";
- public static final String TOKEN = "token";
- public static final String GET = "get";
- public static final String SET = "set";
- public static final String HTTP = "http";
- public static final String GRPC = "grpc";
- public static final String BRACKETS = "{}";
- public static final String BACKSLASH = "\\";
- public static final String BACKSLASH_MARK= "\\\"";
- public static final String DOUBLE_MARK= "\"\"";
- public static final String MARK= "\"";
- public static final String FLAG_EQUAL = "=";
- public static final String LEFT_PARENTHESIS = "[";
- public static final String RIGHT_PARENTHESIS = "]";
- public static final String APOSTROPHE = "'";
- public static final String HYPHEN = "-";
- public static final String EVENT_SEPARATOR = "&&";
- public static final String POST = "POST";
-
- private SymbolConstant() {
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/TrainAlgorithmConstant.java b/dubhe-server/common/src/main/java/org/dubhe/constant/TrainAlgorithmConstant.java
deleted file mode 100644
index 1a85787..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/TrainAlgorithmConstant.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.constant;
-
-import lombok.Data;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-/**
- * @description 算法常量
- * @date 2020-06-02
- */
-@Data
-@Component
-public class TrainAlgorithmConstant {
-
- @Value("${train-algorithm.is-train-out}")
- private Boolean isTrainOut;
-
- @Value("${train-algorithm.is-train-log}")
- private Boolean isTrainLog;
-
- @Value("${train-algorithm.is-visualized-log}")
- private Boolean isVisualizedLog;
-
- @Value("${train-algorithm.algorithm-source}")
- private Integer algorithmSource;
-
- @Value("${train-algorithm.fork}")
- private Boolean fork;
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/constant/UserAuxiliaryInfoConstant.java b/dubhe-server/common/src/main/java/org/dubhe/constant/UserAuxiliaryInfoConstant.java
deleted file mode 100644
index 5364203..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/constant/UserAuxiliaryInfoConstant.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.constant;
-
-import lombok.Data;
-
-/**
- * @description 算法用途
- * @date 2020-06-23
- */
-@Data
-public class UserAuxiliaryInfoConstant {
-
-
-
- public static final String ALGORITHM_USAGE ="algorithem_usage";
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/dto/CommonPermissionDataDTO.java b/dubhe-server/common/src/main/java/org/dubhe/domain/dto/CommonPermissionDataDTO.java
deleted file mode 100644
index a0d6dc5..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/dto/CommonPermissionDataDTO.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.io.Serializable;
-import java.util.Set;
-
-/**
- * @description 公共权限信息DTO
- * @date 2020-09-24
- */
-@AllArgsConstructor
-@NoArgsConstructor
-@Builder
-@Data
-public class CommonPermissionDataDTO implements Serializable {
-
- /**
- * 资源拥有者ID
- */
- private Long id;
-
- /**
- * 公共类型
- */
- private Boolean type;
- /**
- * 资源所属用户ids
- */
- private Set resourceUserIds;
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/dto/UserDTO.java b/dubhe-server/common/src/main/java/org/dubhe/domain/dto/UserDTO.java
deleted file mode 100644
index cf506f5..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/dto/UserDTO.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.domain.dto;
-
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.dubhe.domain.entity.Role;
-import org.dubhe.domain.entity.UserAvatar;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @description 用户信息
- * @date 2020-06-29
- */
-@Data
-public class UserDTO implements Serializable {
-
- @ApiModelProperty(hidden = true)
- private Long id;
-
- private String username;
-
- private String nickName;
-
- private String sex;
-
- private String email;
-
- private String phone;
-
- private Boolean enabled;
-
- private String remark;
-
- @JsonIgnore
- private String password;
-
- private Date lastPasswordResetTime;
-
- private Timestamp createTime;
-
- private List roles;
-
- private UserAvatar userAvatar;
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/LogInfo.java b/dubhe-server/common/src/main/java/org/dubhe/domain/entity/LogInfo.java
deleted file mode 100644
index 1f42e5c..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/LogInfo.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * 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.domain.entity;
-
-import cn.hutool.core.date.DateUtil;
-import com.alibaba.fastjson.annotation.JSONField;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.base.MagicNumConstant;
-
-import java.io.Serializable;
-
-/**
- * @description 日志对象封装类
- * @date 2020-06-29
- */
-@Data
-@Accessors(chain = true)
-public class LogInfo implements Serializable {
-
- private static final long serialVersionUID = 5250395474667395607L;
-
- @JSONField(ordinal = MagicNumConstant.ONE)
- private String traceId;
-
- @JSONField(ordinal = MagicNumConstant.TWO)
- private String type;
-
- @JSONField(ordinal = MagicNumConstant.THREE)
- private String level;
-
- @JSONField(ordinal = MagicNumConstant.FOUR)
- private String location;
-
- @JSONField(ordinal = MagicNumConstant.FIVE)
- private String time = DateUtil.now();
-
- @JSONField(ordinal = MagicNumConstant.SIX)
- private Object info;
-
- public void setInfo(Object info) {
- this.info = info;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/Menu.java b/dubhe-server/common/src/main/java/org/dubhe/domain/entity/Menu.java
deleted file mode 100644
index 4136d11..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/Menu.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.dubhe.base.BaseEntity;
-
-import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
-import java.util.Objects;
-
-/**
- * @description 菜单实体
- * @date 2020-06-29
- */
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-@TableName("menu")
-public class Menu extends BaseEntity implements Serializable {
-
- private static final long serialVersionUID = 3100515433018008777L;
-
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @NotBlank
- private String name;
-
- @TableField(value = "sort")
- private Long sort = 999L;
-
- @TableField(value = "path")
- private String path;
-
- @TableField(value = "component")
- private String component;
-
- /**
- * 类型,目录、菜单、按钮
- */
- @TableField(value = "type")
- private Integer type;
-
- /**
- * 权限
- */
- @TableField(value = "permission")
- private String permission;
-
- @TableField(value = "component_name")
- private String componentName;
-
- @TableField(value = "icon")
- private String icon;
-
- /**
- * 布局类型
- */
- @TableField(value = "layout")
- private String layout;
-
- @TableField(value = "cache")
- private Boolean cache;
-
- @TableField(value = "hidden")
- private Boolean hidden;
-
- /**
- * 上级菜单ID
- */
- @TableField(value = "pid")
- private Long pid;
-
- @TableField(value = "deleted",fill = FieldFill.INSERT)
- private Boolean deleted;
-
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Menu menu = (Menu) o;
- return Objects.equals(id, menu.id);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id);
- }
-
- public @interface Update {
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/Role.java b/dubhe-server/common/src/main/java/org/dubhe/domain/entity/Role.java
deleted file mode 100644
index f50cd86..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/Role.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.dubhe.base.BaseEntity;
-import java.io.Serializable;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * @description 角色实体
- * @date 2020-06-29
- */
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-@TableName("role")
-public class Role extends BaseEntity implements Serializable {
-
- private static final long serialVersionUID = -812009584744832371L;
-
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @TableField(value = "name")
- private String name;
-
- /**
- * 权限
- */
- @TableField(value = "permission")
- private String permission;
-
- @TableField(value = "remark")
- private String remark;
-
- @TableField(exist = false)
- private Set menus;
-
- @TableField(value = "deleted",fill = FieldFill.INSERT)
- private Boolean deleted = false;
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Role role = (Role) o;
- return Objects.equals(id, role.id);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id);
- }
-
- public @interface Update {
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/RoleMenu.java b/dubhe-server/common/src/main/java/org/dubhe/domain/entity/RoleMenu.java
deleted file mode 100644
index 18715c5..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/RoleMenu.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.io.Serializable;
-
-
-/**
- * @description 角色菜单关系实体
- * @date 2020-06-29
- */
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-@TableName("roles_menus")
-public class RoleMenu implements Serializable {
-
- private static final long serialVersionUID = -6296866205797727963L;
-
- @TableField(value = "menu_id")
- private Long menuId;
-
- @TableField(value = "role_id")
- private Long roleId;
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/Team.java b/dubhe-server/common/src/main/java/org/dubhe/domain/entity/Team.java
deleted file mode 100644
index 71ad1ad..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/Team.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.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 lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.sql.Timestamp;
-import java.util.List;
-import java.util.Objects;
-
-/**
- * @description 团队实体
- * @date 2020-06-29
- */
-@TableName("team")
-@Data
-@Builder
-@NoArgsConstructor
-@AllArgsConstructor
-public class Team {
- @TableId(value = "id", type = IdType.AUTO)
- @NotNull(groups = Update.class)
- private Long id;
-
- @TableField(value = "name")
- @NotBlank
- private String name;
-
- @TableField(value = "enabled")
- @NotNull
- private Boolean enabled;
-
- /**
- * 团队成员
- */
- @TableField(exist = false)
- private List teamUserList;
-
- @TableField(value = "create_time")
- private Timestamp createTime;
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- Team dept = (Team) o;
- return Objects.equals(id, dept.id) &&
- Objects.equals(name, dept.name);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, name);
- }
-
- public @interface Update {
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/TeamUserRole.java b/dubhe-server/common/src/main/java/org/dubhe/domain/entity/TeamUserRole.java
deleted file mode 100644
index 59146f4..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/TeamUserRole.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.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 lombok.Data;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 团队用户关系实体
- * @date 2020-06-29
- */
-@Data
-@TableName("teams_users_roles")
-public class TeamUserRole implements Serializable {
-
- @TableId(value = "id", type = IdType.AUTO)
- @NotNull()
- private Long id;
-
- /**
- * 团队
- */
- @TableField(exist = false)
- private Team team;
-
- /**
- * 用户
- */
- @TableField(exist = false)
- private User user;
-
- /**
- * 角色
- */
- @TableField(exist = false)
- private Role role;
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/User.java b/dubhe-server/common/src/main/java/org/dubhe/domain/entity/User.java
deleted file mode 100644
index fdbe3f7..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/User.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.dubhe.base.BaseEntity;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.Date;
-import java.util.List;
-import java.util.Objects;
-
-
-/**
- * @description 用户实体
- * @date 2020-06-29
- */
-@Data
-@TableName("user")
-@Builder
-@NoArgsConstructor
-@AllArgsConstructor
-public class User extends BaseEntity implements Serializable {
-
- private static final long serialVersionUID = -3836401769559845765L;
-
- @TableId(value = "id", type = IdType.AUTO)
- @NotNull(groups = Update.class)
- private Long id;
-
- @NotBlank
- @TableField(value = "username")
- private String username;
-
- /**
- * 用户昵称
- */
- @TableField(value = "nick_name")
- @NotBlank
- private String nickName;
-
- /**
- * 性别
- */
- @TableField(value = "sex")
- private String sex;
-
- @NotBlank
- @TableField(value = "email")
- private String email;
-
- @NotBlank
- @TableField(value = "phone")
- private String phone;
-
- @NotNull
- @TableField(value = "enabled")
- private Boolean enabled;
-
- @TableField(value = "password")
- private String password;
-
- @TableField(value = "last_password_reset_time")
- private Date lastPasswordResetTime;
-
- @TableField(value = "remark")
- private String remark;
-
- @TableField(value = "avatar_id")
- private Long avatarId;
-
-
- @TableField(exist = false)
- private UserAvatar userAvatar;
-
-
- @NotEmpty
- @TableField(exist = false)
- private List roles;
-
- @TableField(value = "deleted",fill = FieldFill.INSERT)
- private Boolean deleted = false;
-
-
-
- @Override
- public boolean equals(Object o) {
- if (this == o) {
- return true;
- }
- if (o == null || getClass() != o.getClass()) {
- return false;
- }
- User user = (User) o;
- return Objects.equals(id, user.id) &&
- Objects.equals(username, user.username);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(id, username);
- }
-
- public @interface Update {
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/UserAvatar.java b/dubhe-server/common/src/main/java/org/dubhe/domain/entity/UserAvatar.java
deleted file mode 100644
index b46c67b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/UserAvatar.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.domain.entity;
-
-import cn.hutool.core.util.ObjectUtil;
-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 lombok.Data;
-import lombok.NoArgsConstructor;
-import org.dubhe.base.BaseEntity;
-
-import java.io.Serializable;
-
-
-/**
- * @description 用户头像实体
- * @date 2020-06-29
- */
-@Data
-@NoArgsConstructor
-@TableName("user_avatar")
-public class UserAvatar extends BaseEntity implements Serializable {
-
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- @TableField(value = "real_name")
- private String realName;
-
- @TableField(value = "path")
- private String path;
-
- @TableField(value = "size")
- private String size;
-
-
- public UserAvatar(UserAvatar userAvatar, String realName, String path, String size) {
- this.id = ObjectUtil.isNotEmpty(userAvatar) ? userAvatar.getId() : null;
- this.realName = realName;
- this.path = path;
- this.size = size;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/UserRole.java b/dubhe-server/common/src/main/java/org/dubhe/domain/entity/UserRole.java
deleted file mode 100644
index 756326b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/domain/entity/UserRole.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import java.io.Serializable;
-
-/**
- * @description 用户角色关系实体
- * @date 2020-06-29
- */
-@Data
-@Builder
-@AllArgsConstructor
-@NoArgsConstructor
-@TableName("users_roles")
-public class UserRole implements Serializable {
-
- private static final long serialVersionUID = -6296866205797727963L;
-
- @TableField(value = "user_id")
- private Long userId;
-
- @TableField(value = "role_id")
- private Long roleId;
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/GlobalRequestRecordDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/GlobalRequestRecordDTO.java
deleted file mode 100644
index e350450..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/GlobalRequestRecordDTO.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.dto;
-
-import lombok.Data;
-
-/**
- * @description 全局请求日志信息
- * @date 2020-08-13
- */
-@Data
-public class GlobalRequestRecordDTO {
- /**
- * 客户主机地址
- */
- private String clientHost;
- /**
- * 请求地址
- */
- private String uri;
- /**
- * 授权信息
- */
- private String authorization;
- /**
- * 用户名
- */
- private String username;
- /**
- * form参数
- */
- private String params;
- /**
- * 返回值类型
- */
- private String contentType;
- /**
- * 返回状态
- */
- private Integer status;
- /**
- * 时间耗费
- */
- private Long timeCost;
- /**
- * 请求方式
- */
- private String method;
- /**
- * 请求体body参数
- */
- private String requestBody;
- /**
- * 返回值json数据
- */
- private String responseBody;
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/StateChangeDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/StateChangeDTO.java
deleted file mode 100644
index 9db46cd..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/StateChangeDTO.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.dto;
-
-import lombok.*;
-import org.springframework.stereotype.Component;
-
-/**
- * @description 执行状态机切换请求体
- * @date 2020-08-27
- */
-@Component
-@Data
-@Builder
-@ToString
-@NoArgsConstructor
-@AllArgsConstructor
-public class StateChangeDTO {
-
- /**
- * 业务参数 eg: id
- */
- private Object[] objectParam;
-
- /**
- * 状态机类型 eg:dataStateMachine
- */
- private String stateMachineType;
-
- /**
- * 状态机执行事件
- */
- private String eventMethodName;
-
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/AlgorithmK8sPodCallbackCreateDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/callback/AlgorithmK8sPodCallbackCreateDTO.java
deleted file mode 100644
index 2daf37d..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/AlgorithmK8sPodCallbackCreateDTO.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.dto.callback;
-
-import io.swagger.annotations.ApiModel;
-import lombok.Data;
-
-/**
- * @descripton 个性化参数实现 与 个性化参数个性化校验
- *
- * @date 2020-05-28
- */
-@ApiModel(description = "k8s pod异步回调Algorithm")
-@Data
-public class AlgorithmK8sPodCallbackCreateDTO extends BaseK8sPodCallbackCreateDTO {
- @Override
- public String toString() {
- return super.toString();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/AllK8sPodCallbackCreateDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/callback/AllK8sPodCallbackCreateDTO.java
deleted file mode 100644
index 7d9601c..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/AllK8sPodCallbackCreateDTO.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.dto.callback;
-
-import io.swagger.annotations.ApiModel;
-import lombok.Data;
-
-/**
- * @descripton k8s方异步回调统一汇总类,即不管什么业务所有请求参数都放在这个类中
- *
- * @date 2020-05-28
- */
-@ApiModel(description = "k8s方 pod异步回调汇总类")
-@Data
-public class AllK8sPodCallbackCreateDTO extends BaseK8sPodCallbackCreateDTO{
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/BaseK8sDeploymentCallbackCreateDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/callback/BaseK8sDeploymentCallbackCreateDTO.java
deleted file mode 100644
index 6c9b13b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/BaseK8sDeploymentCallbackCreateDTO.java
+++ /dev/null
@@ -1,82 +0,0 @@
-/**
- * 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.dto.callback;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-
-/**
- * @descripton 统一通用参数实现与校验
- * @date 2020-11-26
- */
-@ApiModel(description = "k8s deployment异步回调基类")
-@Data
-public class BaseK8sDeploymentCallbackCreateDTO {
- @ApiModelProperty(required = true, value = "k8s namespace")
- @NotBlank(message = "namespace 不能为空!")
- private String namespace;
-
- @ApiModelProperty(required = true, value = "k8s resource name")
- @NotBlank(message = "resourceName 不能为空!")
- private String resourceName;
-
- @ApiModelProperty(required = true, value = "k8s deployment name")
- @NotBlank(message = "deployment 不能为空!")
- private String deploymentName;
-
- /**
- * deployment已 Running的pod数
- */
- @ApiModelProperty(required = true, value = "k8s deployment readyReplicas")
- @NotNull(message = "readyReplicas 不能为空!")
- private Integer readyReplicas;
-
- /**
- * deployment总pod数
- */
- @ApiModelProperty(required = true, value = "k8s deployment replicas")
- @NotNull(message = "replicas 不能为空!")
- private Integer replicas;
-
- public BaseK8sDeploymentCallbackCreateDTO() {
-
- }
-
- public BaseK8sDeploymentCallbackCreateDTO(String namespace, String resourceName, String deploymentName, Integer readyReplicas, Integer replicas) {
- this.namespace = namespace;
- this.resourceName = resourceName;
- this.deploymentName = deploymentName;
- this.readyReplicas = readyReplicas;
- this.replicas = replicas;
- }
-
- @Override
- public String toString() {
- return "BaseK8sDeploymentCallbackCreateDTO{" +
- "namespace='" + namespace + '\'' +
- ", resourceName='" + resourceName + '\'' +
- ", deploymentName='" + deploymentName + '\'' +
- ", readyReplicas='" + readyReplicas + '\'' +
- ", replicas='" + replicas + '\'' +
- '}';
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/BaseK8sPodCallbackCreateDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/callback/BaseK8sPodCallbackCreateDTO.java
deleted file mode 100644
index 82897de..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/BaseK8sPodCallbackCreateDTO.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * 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.dto.callback;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotEmpty;
-
-/**
- * @descripton 统一通用参数实现与校验
- *
- * @date 2020-05-28
- */
-@ApiModel(description = "k8s pod异步回调基类")
-@Data
-public class BaseK8sPodCallbackCreateDTO {
-
- @ApiModelProperty(required = true,value = "k8s namespace")
- @NotEmpty(message = "namespace 不能为空!")
- private String namespace;
-
- @ApiModelProperty(required = true,value = "k8s resource name")
- @NotEmpty(message = "resourceName 不能为空!")
- private String resourceName;
-
- @ApiModelProperty(required = true,value = "k8s pod name")
- @NotEmpty(message = "podName 不能为空!")
- private String podName;
-
- @ApiModelProperty(required = true,value = "k8s pod parent type")
- @NotEmpty(message = "podParentType 不能为空!")
- private String podParentType;
-
- @ApiModelProperty(required = true,value = "k8s pod parent name")
- @NotEmpty(message = "podParentName 不能为空!")
- private String podParentName;
-
- @ApiModelProperty(value = "k8s pod phase",notes = "对应PodPhaseEnum")
- @NotEmpty(message = "phase 不能为空!")
- private String phase;
-
- @ApiModelProperty(value = "k8s pod containerStatuses state")
- private String messages;
-
- public BaseK8sPodCallbackCreateDTO(){
-
- }
-
- public BaseK8sPodCallbackCreateDTO(String namespace,String resourceName,String podName,String podParentType,String podParentName,String phase,String messages){
- this.namespace = namespace;
- this.resourceName = resourceName;
- this.podName = podName;
- this.podParentType = podParentType;
- this.podParentName = podParentName;
- this.phase = phase;
- this.messages = messages;
- }
-
- @Override
- public String toString() {
- return "BaseK8sPodCallbackReq{" +
- "namespace='" + namespace + '\'' +
- ", resourceName='" + resourceName + '\'' +
- ", podName='" + podName + '\'' +
- ", podParentType='" + podParentType + '\'' +
- ", podParentName='" + podParentName + '\'' +
- ", phase='" + phase + '\'' +
- ", messages=" + messages +
- '}';
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/BatchServingK8sPodCallbackCreateDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/callback/BatchServingK8sPodCallbackCreateDTO.java
deleted file mode 100644
index 8d1e305..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/BatchServingK8sPodCallbackCreateDTO.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.dto.callback;
-
-import io.swagger.annotations.ApiModel;
-import lombok.Data;
-
-/**
- * @description k8s pod异步回调云端serving
- * @date 2020-11-27
- */
-@ApiModel(description = "k8s pod异步回调云端serving")
-@Data
-public class BatchServingK8sPodCallbackCreateDTO extends BaseK8sPodCallbackCreateDTO {
-
- @Override
- public String toString() {
- return super.toString();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/ModelOptK8sPodCallbackCreateDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/callback/ModelOptK8sPodCallbackCreateDTO.java
deleted file mode 100644
index 770f963..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/ModelOptK8sPodCallbackCreateDTO.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/**
- * 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.dto.callback;
-
-import io.swagger.annotations.ApiModel;
-import lombok.Data;
-
-/**
- * @description 模型优化自定义回调参数类
- * @date 2020-06-03
- */
-@ApiModel(description = "k8s pod异步回调Algorithm")
-@Data
-public class ModelOptK8sPodCallbackCreateDTO extends BaseK8sPodCallbackCreateDTO {
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/NotebookK8sPodCallbackCreateDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/callback/NotebookK8sPodCallbackCreateDTO.java
deleted file mode 100644
index 1378cdd..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/NotebookK8sPodCallbackCreateDTO.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.dto.callback;
-
-import io.swagger.annotations.ApiModel;
-import lombok.Data;
-
-/**
- * @descripton k8s pod异步回调Notebook
- *
- * @date 2020-05-28
- */
-@ApiModel(description = "k8s pod异步回调Notebook")
-@Data
-public class NotebookK8sPodCallbackCreateDTO extends BaseK8sPodCallbackCreateDTO {
-
- @Override
- public String toString() {
- return super.toString();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/ServingK8sDeploymentCallbackCreateDTO.java b/dubhe-server/common/src/main/java/org/dubhe/dto/callback/ServingK8sDeploymentCallbackCreateDTO.java
deleted file mode 100644
index 8611f62..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/dto/callback/ServingK8sDeploymentCallbackCreateDTO.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.dto.callback;
-
-import io.swagger.annotations.ApiModel;
-import lombok.Data;
-
-/**
- * @description k8s deployment异步回调云端serving
- * @date 2020-09-16
- */
-@ApiModel(description = "k8s deployment异步回调云端serving")
-@Data
-public class ServingK8sDeploymentCallbackCreateDTO extends BaseK8sDeploymentCallbackCreateDTO {
-
- @Override
- public String toString() {
- return super.toString();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/BizEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/BizEnum.java
deleted file mode 100644
index 4ce8332..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/BizEnum.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.enums;
-
-import lombok.Getter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @description 业务模块
- * @date 2020-05-25
- */
-@Getter
-public enum BizEnum {
-
- /**
- * 模型开发
- */
- NOTEBOOK("模型开发", "notebook", 0),
- /**
- * 算法管理
- */
- ALGORITHM("算法管理", "algorithm", 1),
- /**
- * 模型管理
- */
- MODEL("模型管理", "model", 2),
-
- /**
- * 训练管理
- */
- TRAIN("训练管理", "train", 3),
- /**
- * 云端Serving-在线服务
- */
- SERVING("云端Serving", "serving", 4),
- /**
- * 批量服务
- */
- BATCH_SERVING("批量服务", "batchserving", 5),
- /**
- * 模型优化
- */
- MODEL_OPT("模型优化管理","modelopt",6),
- ;
-
- /**
- * 业务模块名称
- */
- private String bizName;
- /**
- * 业务模块名称
- */
- private String bizCode;
- /**
- * 业务源代号
- */
- private Integer createResource;
-
- BizEnum(String bizName, String bizCode, Integer createResource) {
- this.createResource = createResource;
- this.bizName = bizName;
- this.bizCode = bizCode;
- }
-
- private static final Map RESOURCE_ENUM_MAP = new HashMap() {
- {
- for (BizEnum enums : BizEnum.values()) {
- put(enums.getCreateResource(), enums);
- }
- }
- };
-
- /**
- * 根据createResource获取BizEnum
- * @param createResource 业务源代号
- * @return 枚举对象
- */
- public static BizEnum getByCreateResource(int createResource) {
- return RESOURCE_ENUM_MAP.get(createResource);
- }
-
- /**
- * 根据createResource获取code
- *
- * @param createResource 业务源代号
- * @return String 业务模块名称
- */
- public static String getCodeByResource(Integer createResource) {
- for (BizEnum enums : BizEnum.values()) {
- if (enums.getCreateResource().equals(createResource)) {
- return enums.getBizCode();
- }
- }
- return null;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/BizNfsEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/BizNfsEnum.java
deleted file mode 100644
index 9c0af4f..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/BizNfsEnum.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/**
- * 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.enums;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @description 业务NFS路径枚举
- * @date 2020-05-13
- */
-public enum BizNfsEnum {
- /**
- * 模型开发 NFS 路径命名
- */
- NOTEBOOK(BizEnum.NOTEBOOK, "notebook"),
- /**
- * 算法管理 NFS 路径命名
- */
- ALGORITHM(BizEnum.ALGORITHM, "algorithm-manage"),
- /**
- * 模型管理 NFS 路径命名
- */
- MODEL(BizEnum.MODEL, "model"),
- /**
- * 模型优化 NFS 路径命名
- */
- MODEL_OPT(BizEnum.MODEL_OPT, "model-opt"),
- ;
-
- BizNfsEnum(BizEnum bizEnum, String bizNfsPath) {
- this.bizEnum = bizEnum;
- this.bizNfsPath = bizNfsPath;
- }
-
- /**
- * 业务模块
- */
- private BizEnum bizEnum;
- /**
- * 业务模块nfs路径
- */
- private String bizNfsPath;
-
-
- private static final Map RESOURCE_ENUM_MAP = new HashMap() {
- {
- for (BizNfsEnum enums : BizNfsEnum.values()) {
- put(enums.getCreateResource(), enums);
- }
- }
- };
-
- /**
- * 根据createResource获取BizNfsEnum
- *
- * @param createResource
- * @return
- */
- public static BizNfsEnum getByCreateResource(int createResource) {
- return RESOURCE_ENUM_MAP.get(createResource);
- }
-
-
- public String getBizName() {
- return bizEnum == null ? null : bizEnum.getBizName();
- }
-
- public Integer getCreateResource() {
- return bizEnum == null ? null : bizEnum.getCreateResource();
- }
-
- public String getBizNfsPath() {
- return bizNfsPath;
- }
-
- public BizEnum getBizEnum() {
- return bizEnum;
- }
-
- public String getBizCode() {
- return bizEnum == null ? null : bizEnum.getBizCode();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/DatasetTypeEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/DatasetTypeEnum.java
deleted file mode 100644
index 5c5953b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/DatasetTypeEnum.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.enums;
-
-import lombok.Getter;
-
-/**
- * @description 数据集类型
- * @date 2020-05-21
- */
-@Getter
-public enum DatasetTypeEnum {
-
- /**
- * 私有数据
- */
- PRIVATE(0, "私有数据"),
- /**
- * 团队数据
- */
- TEAM(1, "团队数据"),
- /**
- * 公开数据
- */
- PUBLIC(2, "公开数据");
-
- DatasetTypeEnum(Integer value, String msg) {
- this.value = value;
- this.msg = msg;
- }
-
- private Integer value;
- private String msg;
-
- /**
- * 数据集类型校验 用户web端接口调用时参数校验
- *
- * @param value 数据集类型
- * @return
- */
- public static boolean isValid(Integer value) {
- for (DatasetTypeEnum datasetTypeEnum : DatasetTypeEnum.values()) {
- if (datasetTypeEnum.value.equals(value)) {
- return true;
- }
- }
- return false;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/ImageSourceEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/ImageSourceEnum.java
deleted file mode 100644
index 7a1912b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/ImageSourceEnum.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.enums;
-
-/**
- * @description 镜像来源枚举类
- * @date 2020-07-15
- */
-public enum ImageSourceEnum {
- MINE(0, "我的镜像"),
- PRE(1, "预置镜像");
-
-
- /**
- * 编码
- */
- private Integer code;
-
- /**
- * 描述
- */
- private String description;
-
- ImageSourceEnum(int code, String description) {
- this.code = code;
- this.description = description;
- }
-
- public Integer getCode() {
- return code;
- }
-
- public String getDescription() {
- return description;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/ImageStateEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/ImageStateEnum.java
deleted file mode 100644
index fdc1414..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/ImageStateEnum.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.enums;
-
-/**
- * @description 镜像运行状态枚举
- * @date 2020-07-15
- **/
-public enum ImageStateEnum {
-
- MAKING(0, "制作中"),
- SUCCESS(1, "制作成功"),
- FAIL(2, "制作失败");
-
-
- /**
- * 编码
- */
- private Integer code;
-
- /**
- * 描述
- */
- private String description;
-
- ImageStateEnum(int code, String description) {
- this.code = code;
- this.description = description;
- }
-
- public Integer getCode() {
- return code;
- }
-
- public String getDescription() {
- return description;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/ImageTypeEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/ImageTypeEnum.java
deleted file mode 100644
index 18b881e..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/ImageTypeEnum.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * 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.enums;
-
-
-import lombok.Getter;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * @description 镜像项目枚举类
- * @date 2020-12-11
- */
-@Getter
-public enum ImageTypeEnum {
-
- /**
- * notebook镜像
- */
- NOTEBOOK("notebook镜像", "notebook", 0),
-
- /**
- * 训练镜像
- */
- TRAIN("训练镜像", "train", 1);
-
- /**
- * 镜像项目名称
- */
- private String name;
- /**
- * 镜像项目代码
- */
- private String code;
- /**
- * 镜像项目类型
- */
- private Integer type;
-
- ImageTypeEnum(String name, String code, Integer type) {
- this.name = name;
- this.code = code;
- this.type = type;
- }
-
- private static final Map RESOURCE_ENUM_MAP = new HashMap() {
- {
- for (ImageTypeEnum enums : ImageTypeEnum.values()) {
- put(enums.getType(), enums);
- }
- }
- };
-
- /**
- * 根据type获取ImageTypeEnum
- * @param type
- * @return 镜像项目枚举对象
- */
- public static ImageTypeEnum getType(int type) {
- return RESOURCE_ENUM_MAP.get(type);
- }
-
- /**
- * 根据type获取code
- *
- * @param type 镜像项目类型
- * @return String 镜像项目代码
- */
- public static String getType(Integer type) {
- for (ImageTypeEnum enums : ImageTypeEnum.values()) {
- if (enums.getType().equals(type)) {
- return enums.getCode();
- }
- }
- return null;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/LogEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/LogEnum.java
deleted file mode 100644
index a266177..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/LogEnum.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * 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.enums;
-
-import lombok.Getter;
-
-/**
- * @description 日志类型枚举类
- * @date 2020-06-23
- */
-@Getter
-public enum LogEnum {
-
- // 系统报错日志
- SYS_ERR,
- // 用户请求日志
- REST_REQ,
- //全局请求日志
- GLOBAL_REQ,
- // 训练模块
- BIZ_TRAIN,
- // 系统模块
- BIZ_SYS,
- // 模型模块
- BIZ_MODEL,
- // 模型优化
- MODEL_OPT,
- // 数据集模块
- BIZ_DATASET,
- // k8s模块
- BIZ_K8S,
- //note book
- NOTE_BOOK,
- //NFS UTILS
- NFS_UTIL,
- //localFileUtil
- LOCAL_FILE_UTIL,
- //FILE UTILS
- FILE_UTIL,
- // 云端Serving模块
- SERVING,
- //FILE UTILS
- UPLOAD_TEMP,
- //STATE MACHINE
- STATE_MACHINE,
- //全局垃圾回收
- GARBAGE_RECYCLE,
- //IO UTIL
- IO_UTIL,
- //DATA_SEQUENCE
- DATA_SEQUENCE,
- // 日志切面
- LOG_ASPECT,
- //镜像
- IMAGE,
- //度量
- MEASURE;
- ;
-
- /**
- * 判断日志类型不能为空
- *
- * @param logType 日志类型
- * @return boolean 返回类型
- */
- public static boolean isLogType(LogEnum logType) {
-
- if (logType != null) {
- return true;
- }
- return false;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/ModelResourceEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/ModelResourceEnum.java
deleted file mode 100644
index a4f0c55..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/ModelResourceEnum.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.enums;
-
-import lombok.Getter;
-
-/**
- * @description 模型资源枚举类
- * @date 2020-11-19
- */
-@Getter
-public enum ModelResourceEnum {
-
- /**
- * 我的模型
- */
- MINE(0, "我的模型"),
- /**
- * 预置模型
- */
- PRESET(1, "预置模型"),
- /**
- * 炼知模型
- */
- ATLAS(2, "炼知模型");
-
- private Integer type;
-
- private String description;
-
- ModelResourceEnum(Integer type, String description) {
- this.type = type;
- this.description = description;
- }
-
- /**
- * 根据类型获取枚举类对象
- *
- * @param type 类型
- * @return 枚举类对象
- */
- public static ModelResourceEnum getType(Integer type) {
- for (ModelResourceEnum modelResourceEnum : values()) {
- if (modelResourceEnum.getType().compareTo(type) == 0) {
- //获取指定的枚举
- return modelResourceEnum;
- }
- }
- return null;
- }
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/OperationTypeEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/OperationTypeEnum.java
deleted file mode 100644
index 7d911ad..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/OperationTypeEnum.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.enums;
-
-import lombok.Getter;
-import lombok.ToString;
-
-/**
- * @Description 操作类型枚举
- * @Date 2020-08-24
- */
-@ToString
-@Getter
-public enum OperationTypeEnum {
- /**
- * SELECT 查询类型
- */
- SELECT("select", "查询"),
-
- /**
- * UPDATE 修改类型
- */
- UPDATE("update", "修改"),
-
- /**
- * DELETE 删除类型
- */
- DELETE("delete", "删除"),
-
- /**
- * LIMIT 禁止操作类型
- */
- LIMIT("limit", "禁止操作"),
-
- /**
- * INSERT 新增类型
- */
- INSERT("insert", "新增类型"),
-
- ;
-
- /**
- * 操作类型值
- */
- private String type;
-
- /**
- * 操作类型备注
- */
- private String desc;
-
- OperationTypeEnum(String type, String desc) {
- this.type = type;
- this.desc = desc;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/RecycleResourceEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/RecycleResourceEnum.java
deleted file mode 100644
index 3639d35..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/RecycleResourceEnum.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.enums;
-
-import lombok.Getter;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @description 资源回收枚举类
- * @date 2020-10-10
- */
-@Getter
-public enum RecycleResourceEnum {
-
- /**
- * 数据集文件回收
- */
- DATASET_RECYCLE_FILE("datasetRecycleFile", "数据集文件回收"),
-
- /**
- * 医学数据集文件回收
- */
- DATAMEDICINE_RECYCLE_FILE("dataMedicineRecycleFile", "数据集文件回收"),
-
- /**
- * 数据集版本文件回收
- */
- DATASET_RECYCLE_VERSION_FILE("datasetRecycleVersionFile", "数据集版本文件回收"),
- /**
- * 云端Serving输入文件回收
- */
- SERVING_RECYCLE_FILE("servingRecycleFile", "云端Serving文件回收"),
-
- ;
-
- private String className;
-
- private String message;
-
- RecycleResourceEnum(String className, String message) {
- this.className = className;
- this.message = message;
- }
-
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/SwitchEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/SwitchEnum.java
deleted file mode 100644
index 35d5c4b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/SwitchEnum.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * 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.enums;
-
-/**
- * @Description 是否开关枚举
- * @Date 2020-06-01
- */
-public enum SwitchEnum {
- /**
- * OFF 否
- */
- OFF(0, "否"),
-
- /**
- * ON 否
- */
- ON(1, "是"),
-
- ;
-
- private Integer value;
-
- private String desc;
-
- SwitchEnum(Integer value, String desc) {
- this.value = value;
- this.desc = desc;
- }
-
- public Integer getValue() {
- return this.value;
- }
-
- public String getDesc() {
- return desc;
- }
-
- public void setDesc(String desc) {
- this.desc = desc;
- }
-
- public static SwitchEnum getEnumValue(Integer value) {
- switch (value) {
- case 0:
- return OFF;
- case 1:
- return ON;
- default:
- return OFF;
- }
- }
-
- public static Boolean getBooleanValue(Integer value) {
- switch (value) {
- case 1:
- return true;
- case 0:
- return false;
- default:
- return false;
- }
- }
-
- public static boolean isExist(Integer value) {
- for (SwitchEnum itm : SwitchEnum.values()) {
- if (value.compareTo(itm.getValue()) == 0) {
- return true;
- }
- }
- return false;
- }
-
-
- @Override
- public String toString() {
- return "[" + this.value + "]" + this.desc;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/enums/TrainJobStatusEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/TrainJobStatusEnum.java
deleted file mode 100644
index 024da9c..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/enums/TrainJobStatusEnum.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * 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.enums;
-
-import lombok.Getter;
-
-import java.util.HashSet;
-import java.util.Set;
-
-/**
- * @description 训练任务枚举类
- * @date 2020-04-27
- */
-@Getter
-public enum TrainJobStatusEnum {
-
- /**
- * PENDING
- */
- PENDING(0, "PENDING"),
- /**
- * RUNNING
- */
- RUNNING(1, "RUNNING"),
- /**
- * SUCCEEDED
- */
- SUCCEEDED(2, "SUCCEEDED"),
- /**
- * FAILED
- */
- FAILED(3, "FAILED"),
- /**
- * STOP
- */
- STOP(4, "STOP"),
- /**
- * UNKNOWN
- */
- UNKNOWN(5, "UNKNOWN"),
- /**
- * DELETED
- */
- DELETED(6, "DELETED"),
-
- /**
- * CREATE_FAILED
- */
- CREATE_FAILED(7, "CREATE_FAILED");
-
- private Integer status;
-
- private String message;
-
- TrainJobStatusEnum(Integer status, String message) {
- this.status = status;
- this.message = message;
- }
-
- /**
- * 根据信息获取枚举类对象
- *
- * @param msg 信息
- * @return 枚举类对象
- */
- public static TrainJobStatusEnum getByMessage(String msg) {
- for (TrainJobStatusEnum statusEnum : values()) {
- if (statusEnum.message.equalsIgnoreCase(msg)) {
- return statusEnum;
- }
- }
- return UNKNOWN;
- }
-
- /**
- * 回调状态转换 若是DELETED则转换为STOP,避免状态不统一
- * @param phase k8s pod phase
- * @return
- */
- public static TrainJobStatusEnum transferStatus(String phase) {
- TrainJobStatusEnum enums = getByMessage(phase);
- if (enums != DELETED) {
- return enums;
- }
- return STOP;
- }
-
- /**
- * 根据状态获取枚举类对象
- *
- * @param status 状态
- * @return 枚举类对象
- */
- public static TrainJobStatusEnum getByStatus(Integer status) {
- for (TrainJobStatusEnum statusEnum : values()) {
- if (statusEnum.status.equals(status)) {
- return statusEnum;
- }
- }
- return UNKNOWN;
- }
-
-
- /**
- * 结束状态枚举集合
- */
- public static final Set END_TRAIN_JOB_STATUS;
-
- static {
- END_TRAIN_JOB_STATUS = new HashSet<>();
- END_TRAIN_JOB_STATUS.add(SUCCEEDED);
- END_TRAIN_JOB_STATUS.add(FAILED);
- END_TRAIN_JOB_STATUS.add(STOP);
- END_TRAIN_JOB_STATUS.add(CREATE_FAILED);
- END_TRAIN_JOB_STATUS.add(DELETED);
- }
-
- public static boolean isEnd(String msg) {
- return END_TRAIN_JOB_STATUS.contains(getByMessage(msg));
- }
-
- public static boolean isEnd(Integer status) {
- return END_TRAIN_JOB_STATUS.contains(getByStatus(status));
- }
-
- public static boolean checkStopStatus(Integer num) {
- return isEnd(num);
- }
-
- public static boolean checkRunStatus(Integer num) {
- return PENDING.getStatus().equals(num) ||
- RUNNING.getStatus().equals(num);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/BaseErrorCode.java b/dubhe-server/common/src/main/java/org/dubhe/exception/BaseErrorCode.java
deleted file mode 100644
index 5bf674c..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/BaseErrorCode.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/**
- * 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.exception;
-
-import lombok.Getter;
-
-/**
- * @description 通用异常code
- * @date 2020-03-26
- */
-@Getter
-public enum BaseErrorCode implements ErrorCode {
-
- /**
- * undefined error
- */
- UNDEFINED(10000, "操作成功!"),
- ERROR(10001, "操作失败!"),
- ERROR_SYSTEM(10002, "系统繁忙!"),
- UNAUTHORIZED(401, "无权访问!"),
- /**
- * system 模块异常码
- */
- SYSTEM_USERNAME_ALREADY_EXISTS(20000, "账号已存在!"),
- SYSTEM_CODE_ALREADY_EXISTS(20001, "Code already exists!"),
- SYSTEM_USER_IS_NOT_EXISTS(20002, "用户不存在!"),
- SYSTEM_USER_ALREADY_REGISTER(20003, "账号已注册!"),
- SYSTEM_USER_REGISTER_EMAIL_INFO_EXPIRED(20004, "邮箱验证码已过期!"),
- SYSTEM_USER_EMAIL_ALREADY_EXISTS(20004, "该邮箱已被注册!"),
- SYSTEM_USER_EMAIL_PASSWORD_ERROR(20005, "邮件密码错误!"),
- SYSTEM_USER_EMAIL_CODE_CANNOT_EXCEED_TIMES(20006, "邮件发送不能超过三次!"),
- SYSTEM_USER_EMAIL_OR_CODE_ERROR(20007, "邮箱地址或验证码错误、请重新输入!"),
- SYSTEM_USER_IS_LOCKED(20008, "用户已锁定!"),
- SYSTEM_USER_USERNAME_OR_PASSWORD_ERROR(20009, "账号或密码不正确!"),
- SYSTEM_USER_USERNAME_IS_LOCKED(20010, "账号已锁定,6小时后解锁!"),
- SYSTEM_USER_CANNOT_UPDATE_ADMIN(20011, "仅超级管理员可操作!"),
- SYSTEM_USER_TOKEN_INFO_IS_NULL(20012, "登录信息不存在!"),
- SYSTEM_USER_EMAIL_NOT_EXISTS(20013, "该邮箱未注册!"),
- SYSTEM_USER_CANNOT_DELETE(20014, "系统默认用户不可删除!"),
- SYSTEM_ROLE_CANNOT_DELETE(20015, "系统默认角色不可删除!"),
-
- DATASET_ADMIN_PERMISSION_ERROR(1310,"无此权限,请联系管理员"),
-
- ;
-
-
- Integer code;
- String msg;
-
- BaseErrorCode(Integer code, String msg) {
- this.code = code;
- this.msg = msg;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/BusinessException.java b/dubhe-server/common/src/main/java/org/dubhe/exception/BusinessException.java
deleted file mode 100644
index cee727d..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/BusinessException.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/**
- * 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.exception;
-
-import lombok.Getter;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.base.ResponseCode;
-
-/**
- * @description 业务异常
- * @date 2020-03-13
- */
-@Getter
-public class BusinessException extends RuntimeException {
-
- private DataResponseBody responseBody;
-
- public BusinessException(String msg) {
- super(msg);
- this.responseBody = new DataResponseBody(ResponseCode.BADREQUEST, msg);
- }
-
- public BusinessException(String msg, Throwable cause) {
- super(msg,cause);
- this.responseBody = new DataResponseBody(ResponseCode.BADREQUEST, msg);
- }
-
- public BusinessException(Throwable cause) {
- super(cause);
- this.responseBody = new DataResponseBody(ResponseCode.BADREQUEST);
- }
-
- public BusinessException(Integer code, String msg, String info, Throwable cause) {
- super(msg,cause);
- if (info == null) {
- this.responseBody = new DataResponseBody(code, msg);
- } else {
- this.responseBody = new DataResponseBody(code, msg + ":" + info);
- }
- }
-
- public BusinessException(ErrorCode errorCode, Throwable cause) {
- this(errorCode.getCode(), errorCode.getMsg(), null, cause);
- }
-
- public BusinessException(ErrorCode errorCode, String info, Throwable cause) {
- this(errorCode.getCode(), errorCode.getMsg(), info, cause);
- }
-
- public BusinessException(ErrorCode errorCode) {
- this(errorCode, null);
- }
-
- public BusinessException(Integer code,String msg) {
- this.responseBody = new DataResponseBody(code, msg);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/CaptchaException.java b/dubhe-server/common/src/main/java/org/dubhe/exception/CaptchaException.java
deleted file mode 100644
index f2ec3e6..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/CaptchaException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.exception;
-
-import lombok.Getter;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.base.ResponseCode;
-
-/**
- * @description 验证码异常
- * @date 2020-02-23
- */
-@Getter
-public class CaptchaException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- private DataResponseBody responseBody;
- private Throwable cause;
-
- public CaptchaException(String msg) {
- this.responseBody = new DataResponseBody(ResponseCode.BADREQUEST, msg);
- }
-
- public CaptchaException(String msg, Throwable cause) {
- this.cause = cause;
- this.responseBody = new DataResponseBody(ResponseCode.BADREQUEST, msg);
- }
-
- public CaptchaException(Throwable cause) {
- this.cause = cause;
- this.responseBody = new DataResponseBody(ResponseCode.BADREQUEST);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/DataSequenceException.java b/dubhe-server/common/src/main/java/org/dubhe/exception/DataSequenceException.java
deleted file mode 100644
index b4790dd..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/DataSequenceException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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.exception;
-
-import lombok.Getter;
-
-/**
- * @description 获取序列异常
- * @date 2020-09-23
- */
-@Getter
-public class DataSequenceException extends BusinessException {
-
- private static final long serialVersionUID = 1L;
-
- public DataSequenceException(String msg) {
- super(msg);
- }
-
- public DataSequenceException(String msg, Throwable cause) {
- super(msg,cause);
- }
-
- public DataSequenceException(Throwable cause) {
- super(cause);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/DockerBizException.java b/dubhe-server/common/src/main/java/org/dubhe/exception/DockerBizException.java
deleted file mode 100644
index 94de0f3..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/DockerBizException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.exception;
-
-import lombok.Getter;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.base.ResponseCode;
-
-/**
- * @Description docker 异常
- * @Date 2020-6-6
- **/
-@Getter
-public class DockerBizException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- private DataResponseBody responseBody;
- private Throwable cause;
-
- public DockerBizException(String msg) {
- this.responseBody = new DataResponseBody(ResponseCode.DOCKER_ERROR, msg);
- }
-
- public DockerBizException(String msg, Throwable cause) {
- this.cause = cause;
- this.responseBody = new DataResponseBody(ResponseCode.DOCKER_ERROR, msg);
- }
-
- public DockerBizException(Throwable cause) {
- this.cause = cause;
- this.responseBody = new DataResponseBody(ResponseCode.DOCKER_ERROR);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/ErrorCode.java b/dubhe-server/common/src/main/java/org/dubhe/exception/ErrorCode.java
deleted file mode 100644
index b8d367c..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/ErrorCode.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.exception;
-
-
-/**
- * @description 异常code
- * @date 2020-03-26
- */
-public interface ErrorCode {
-
- /**
- * 错误码
- * @return code
- */
- Integer getCode();
-
- /**
- * error info
- * @return
- */
- String getMsg();
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/LoginException.java b/dubhe-server/common/src/main/java/org/dubhe/exception/LoginException.java
deleted file mode 100644
index 23668d9..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/LoginException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.exception;
-
-import lombok.Getter;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.base.ResponseCode;
-
-/**
- * @description 登录异常
- * @date 2020-02-23
- */
-@Getter
-public class LoginException extends RuntimeException {
- private DataResponseBody responseBody;
- private Throwable cause;
-
- public LoginException(String msg) {
- this.responseBody = new DataResponseBody(ResponseCode.BADREQUEST, msg);
- }
-
- public LoginException(String msg, Throwable cause) {
- this.cause = cause;
- this.responseBody = new DataResponseBody(ResponseCode.BADREQUEST, msg);
- }
-
- public LoginException(Throwable cause) {
- this.cause = cause;
- this.responseBody = new DataResponseBody(ResponseCode.BADREQUEST);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/NfsBizException.java b/dubhe-server/common/src/main/java/org/dubhe/exception/NfsBizException.java
deleted file mode 100644
index 2fa03d0..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/NfsBizException.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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.exception;
-
-import lombok.Getter;
-
-/**
- * Description : NFS utils 工具异常
- *
- * @date 15.06.2020
- */
-@Getter
-public class NfsBizException extends BusinessException {
-
- private static final long serialVersionUID = 1L;
-
-
- public NfsBizException(Throwable cause){
- super(cause);
- }
-
- public NfsBizException(String msg){
- super(msg);
- }
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/NotebookBizException.java b/dubhe-server/common/src/main/java/org/dubhe/exception/NotebookBizException.java
deleted file mode 100644
index 3f23953..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/NotebookBizException.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.exception;
-
-import lombok.Getter;
-
-/**
- * @description Notebook 业务处理异常
- * @date 2020.04.27
- */
-@Getter
-public class NotebookBizException extends BusinessException{
-
- private static final long serialVersionUID = 1L;
-
- public NotebookBizException(String msg) {
- super(msg);
- }
-
- public NotebookBizException(String msg, Throwable cause) {
- super(msg,cause);
- }
-
- public NotebookBizException(Throwable cause) {
- super(cause);
- }
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/StateMachineException.java b/dubhe-server/common/src/main/java/org/dubhe/exception/StateMachineException.java
deleted file mode 100644
index 774c9e2..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/StateMachineException.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.exception;
-
-import lombok.Getter;
-
-/**
- * @description 状态机异常类
- * @date 2020-08-27
- */
-@Getter
-public class StateMachineException extends BusinessException {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 自定义状态机异常(抛出异常堆栈信息)
- *
- * @param cause
- */
- public StateMachineException(Throwable cause){
- super(cause);
- }
-
- /**
- * 自定义状态机异常(抛出异常信息)
- *
- * @param msg
- */
- public StateMachineException(String msg){
- super(msg);
- }
-
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/UnauthorizedException.java b/dubhe-server/common/src/main/java/org/dubhe/exception/UnauthorizedException.java
deleted file mode 100644
index 54b4929..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/UnauthorizedException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.exception;
-
-import lombok.Getter;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.base.ResponseCode;
-
-/**
- * @description 权限异常
- * @date 2020-02-23
- */
-@Getter
-public class UnauthorizedException extends RuntimeException {
-
- private DataResponseBody responseBody;
- private Throwable cause;
-
- public UnauthorizedException(String msg) {
- this.responseBody = new DataResponseBody(ResponseCode.UNAUTHORIZED, msg);
- }
-
- public UnauthorizedException(String msg, Throwable cause) {
- this.cause = cause;
- this.responseBody = new DataResponseBody(ResponseCode.UNAUTHORIZED, msg);
- }
-
- public UnauthorizedException(Throwable cause) {
- this.cause = cause;
- this.responseBody = new DataResponseBody(ResponseCode.UNAUTHORIZED);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/exception/handler/GlobalExceptionHandler.java b/dubhe-server/common/src/main/java/org/dubhe/exception/handler/GlobalExceptionHandler.java
deleted file mode 100644
index 41367b7..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/exception/handler/GlobalExceptionHandler.java
+++ /dev/null
@@ -1,190 +0,0 @@
-/**
- * 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.exception.handler;
-
-import lombok.extern.slf4j.Slf4j;
-import org.apache.ibatis.exceptions.IbatisException;
-import org.apache.shiro.ShiroException;
-import org.apache.shiro.authc.AuthenticationException;
-import org.apache.shiro.authc.IncorrectCredentialsException;
-import org.apache.shiro.authc.LockedAccountException;
-import org.apache.shiro.authc.UnknownAccountException;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.base.ResponseCode;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.exception.*;
-import org.dubhe.utils.LogUtil;
-import org.springframework.http.HttpStatus;
-import org.springframework.http.ResponseEntity;
-import org.springframework.validation.BindException;
-import org.springframework.validation.ObjectError;
-import org.springframework.web.bind.MethodArgumentNotValidException;
-import org.springframework.web.bind.annotation.ExceptionHandler;
-import org.springframework.web.bind.annotation.RestControllerAdvice;
-
-import java.util.Objects;
-
-/**
- * @description 处理异常
- * @date 2020-02-23
- */
-@Slf4j
-@RestControllerAdvice
-public class GlobalExceptionHandler {
-
- /**
- * 处理所有不可知的异常
- */
- @ExceptionHandler(Throwable.class)
- public ResponseEntity handleException(Throwable e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- return buildResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR,
- new DataResponseBody(ResponseCode.ERROR, e.getMessage()));
- }
-
- /**
- * UnauthorizedException
- */
- @ExceptionHandler(UnauthorizedException.class)
- public ResponseEntity badCredentialsException(UnauthorizedException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- String message = "坏的凭证".equals(e.getMessage()) ? "用户名或密码不正确" : e.getMessage();
- return buildResponseEntity(HttpStatus.UNAUTHORIZED, new DataResponseBody(ResponseCode.ERROR, message));
- }
-
- /**
- * 处理自定义异常
- */
- @ExceptionHandler(value = BusinessException.class)
- public ResponseEntity badRequestException(BusinessException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- return buildResponseEntity(HttpStatus.OK, e.getResponseBody());
- }
-
- /**
- * 处理自定义异常
- */
- @ExceptionHandler(value = IbatisException.class)
- public ResponseEntity persistenceException(IbatisException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- return buildResponseEntity(HttpStatus.OK, new DataResponseBody(ResponseCode.ERROR, e.getMessage()));
- }
-
- /**
- * 处理自定义异常
- */
- @ExceptionHandler(value = AuthenticationException.class)
- public ResponseEntity badRequestException(AuthenticationException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- return buildResponseEntity(HttpStatus.OK, new DataResponseBody(ResponseCode.UNAUTHORIZED, "无权访问"));
- }
-
- /**
- * shiro 异常捕捉
- */
- @ExceptionHandler(value = ShiroException.class)
- public ResponseEntity accountException(ShiroException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- ResponseEntity responseEntity;
- if (e instanceof IncorrectCredentialsException) {
- responseEntity = buildResponseEntity(HttpStatus.OK, new DataResponseBody(ResponseCode.ERROR, "密码不正确"));
- } else if (e instanceof UnknownAccountException) {
- responseEntity = buildResponseEntity(HttpStatus.OK, new DataResponseBody(ResponseCode.ERROR, "此账户不存在"));
- } else if (e instanceof LockedAccountException) {
- responseEntity = buildResponseEntity(HttpStatus.OK, new DataResponseBody(ResponseCode.ERROR, "未知的账号"));
- } else if (e instanceof UnknownAccountException) {
- responseEntity = buildResponseEntity(HttpStatus.OK, new DataResponseBody(ResponseCode.ERROR, "账户已被禁用"));
- } else {
- responseEntity = buildResponseEntity(HttpStatus.OK,
- new DataResponseBody(ResponseCode.UNAUTHORIZED, "无权访问"));
- }
- return responseEntity;
- }
-
- /**
- * 处理自定义异常
- */
- @ExceptionHandler(value = LoginException.class)
- public ResponseEntity loginException(LoginException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- return buildResponseEntity(HttpStatus.UNAUTHORIZED, e.getResponseBody());
- }
-
- /**
- * 处理自定义异常
- */
- @ExceptionHandler(value = CaptchaException.class)
- public ResponseEntity captchaException(CaptchaException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- return buildResponseEntity(HttpStatus.OK, e.getResponseBody());
- }
-
- /**
- * 处理自定义异常
- */
- @ExceptionHandler(value = NotebookBizException.class)
- public ResponseEntity captchaException(NotebookBizException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- return buildResponseEntity(HttpStatus.OK, e.getResponseBody());
- }
-
- /**
- * 处理所有接口数据验证异常
- */
- @ExceptionHandler(MethodArgumentNotValidException.class)
- public ResponseEntity handleMethodArgumentNotValidException(MethodArgumentNotValidException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- String[] str = Objects.requireNonNull(e.getBindingResult().getAllErrors().get(0).getCodes())[1].split("\\.");
- String message = e.getBindingResult().getAllErrors().get(0).getDefaultMessage();
- String msg = "不能为空";
- if (msg.equals(message)) {
- message = str[1] + ":" + message;
- }
- return buildResponseEntity(HttpStatus.BAD_REQUEST, new DataResponseBody(ResponseCode.ERROR, message));
- }
-
- @ExceptionHandler(BindException.class)
- public ResponseEntity bindException(BindException e) {
- // 打印堆栈信息
- LogUtil.error(LogEnum.SYS_ERR, "引起异常的堆栈信息:{}", e);
- ObjectError error = e.getAllErrors().get(0);
- return buildResponseEntity(HttpStatus.BAD_REQUEST,
- new DataResponseBody(ResponseCode.ERROR, error.getDefaultMessage()));
- }
-
- /**
- * 统一返回
- *
- * @param httpStatus
- * @param responseBody
- * @return
- */
- private ResponseEntity buildResponseEntity(HttpStatus httpStatus, DataResponseBody responseBody) {
- return new ResponseEntity<>(responseBody, httpStatus);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/factory/DataResponseFactory.java b/dubhe-server/common/src/main/java/org/dubhe/factory/DataResponseFactory.java
deleted file mode 100644
index c0b717f..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/factory/DataResponseFactory.java
+++ /dev/null
@@ -1,121 +0,0 @@
-/**
- * Copyright 2019-2020 Zheng Jie
- *
- * 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.factory;
-
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.base.ResponseCode;
-
-
-/**
- * @description DataResponseBody 工厂类
- * @date 2020-03-16
- */
-public class DataResponseFactory {
-
- private DataResponseFactory(){
-
- }
-
- /**
- * 成功响应
- *
- * @param
- * @return
- */
- public static DataResponseBody success(){
- return success(null,null);
- }
-
- /**
- * 成功响应
- *
- * @param data
- * @param
- * @return
- */
- public static DataResponseBody success(T data){
- return success(null,data);
- }
-
- /**
- * 成功响应
- *
- * @param msg
- * @return
- */
- public static DataResponseBody successWithMsg(String msg){
- return success(msg,null);
- }
-
- /**
- * 成功响应
- *
- * @param msg
- * @param data
- * @param
- * @return
- */
- public static DataResponseBody success(String msg, T data){
- return new DataResponseBody(ResponseCode.SUCCESS,msg,data);
- }
-
- /**
- * 失败响应 msg
- *
- * @param msg
- * @return
- */
- public static DataResponseBody failed(String msg){
- return failed(ResponseCode.ERROR,msg,null);
- }
-
- /**
- * 失败响应
- *
- * @param failedCode
- * @param msg
- * @return
- */
- public static DataResponseBody failed(Integer failedCode,String msg){
- return failed(failedCode,msg,null);
- }
-
- /**
- * 失败响应
- *
- * @param failedCode
- * @return
- */
- public static DataResponseBody failed(Integer failedCode){
- return failed(failedCode,null,null);
- }
-
- /**
- * 失败响应
- *
- * @param failedCode
- * @param msg
- * @param data
- * @param
- * @return
- */
- public static DataResponseBody failed(Integer failedCode, String msg, T data){
- return new DataResponseBody(failedCode,msg,data);
- }
-
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/filter/BaseLogFilter.java b/dubhe-server/common/src/main/java/org/dubhe/filter/BaseLogFilter.java
deleted file mode 100644
index 08dc43b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/filter/BaseLogFilter.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * 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.filter;
-
-import ch.qos.logback.classic.Level;
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.filter.AbstractMatcherFilter;
-import ch.qos.logback.core.spi.FilterReply;
-import cn.hutool.core.util.StrUtil;
-import org.slf4j.Marker;
-
-/**
- * @description 自定义日志过滤器
- * @date 2020-07-21
- */
-public class BaseLogFilter extends AbstractMatcherFilter {
-
- Level level;
-
- /**
- * 重写decide方法
- *
- * @param iLoggingEvent event to decide upon.
- * @return FilterReply
- */
- @Override
- public FilterReply decide(ILoggingEvent iLoggingEvent) {
- if (!isStarted()) {
- return FilterReply.NEUTRAL;
- }
- final String msg = iLoggingEvent.getMessage();
- //自定义级别
- if (checkLevel(iLoggingEvent) && msg != null && msg.startsWith(StrUtil.DELIM_START) && msg.endsWith(StrUtil.DELIM_END)) {
- final Marker marker = iLoggingEvent.getMarker();
- if (marker != null && this.getName() != null && this.getName().contains(marker.getName())) {
- return onMatch;
- }
- }
-
- return onMismatch;
- }
-
- /**
- * 检测日志级别
- * @param iLoggingEvent 日志事件
- * @return true 过滤当前级别 false 不过滤当前级别
- */
- protected boolean checkLevel(ILoggingEvent iLoggingEvent) {
- return this.level != null
- && iLoggingEvent.getLevel() != null
- && iLoggingEvent.getLevel().toInt() == this.level.toInt();
- }
-
- public void setLevel(Level level) {
- this.level = level;
- }
-
- @Override
- public void start() {
- if (this.level != null) {
- super.start();
- }
- }
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/filter/ConsoleLogFilter.java b/dubhe-server/common/src/main/java/org/dubhe/filter/ConsoleLogFilter.java
deleted file mode 100644
index c442842..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/filter/ConsoleLogFilter.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.filter;
-
-import ch.qos.logback.classic.spi.ILoggingEvent;
-import ch.qos.logback.core.spi.FilterReply;
-import org.dubhe.utils.LogUtil;
-import org.slf4j.MarkerFactory;
-
-/**
- * @description 自定义日志过滤器
- * @date 2020-07-21
- */
-public class ConsoleLogFilter extends BaseLogFilter {
-
- @Override
- public FilterReply decide(ILoggingEvent iLoggingEvent) {
- if (!isStarted()) {
- return FilterReply.NEUTRAL;
- }
- return checkLevel(iLoggingEvent) ? onMatch : onMismatch;
- }
-
- protected boolean checkLevel(ILoggingEvent iLoggingEvent) {
-
-
- return this.level != null
- && iLoggingEvent.getLevel() != null
- && iLoggingEvent.getLevel().toInt() >= this.level.toInt()
- && !MarkerFactory.getMarker(LogUtil.K8S_CALLBACK_LEVEL).equals(iLoggingEvent.getMarker())
- && !MarkerFactory.getMarker(LogUtil.SCHEDULE_LEVEL).equals(iLoggingEvent.getMarker())
- && !"log4jdbc.log4j2".equals(iLoggingEvent.getLoggerName());
- }
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/filter/GlobalRequestLogFilter.java b/dubhe-server/common/src/main/java/org/dubhe/filter/GlobalRequestLogFilter.java
deleted file mode 100644
index 4e3f09b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/filter/GlobalRequestLogFilter.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * 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.filter;
-
-import ch.qos.logback.classic.spi.ILoggingEvent;
-
-/**
- * @description 全局请求 日志过滤器
- * @date 2020-08-13
- */
-public class GlobalRequestLogFilter extends BaseLogFilter {
-
-
- @Override
- public boolean checkLevel(ILoggingEvent iLoggingEvent) {
- return this.level != null;
- }
-
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/handle/ApiVersionCondition.java b/dubhe-server/common/src/main/java/org/dubhe/handle/ApiVersionCondition.java
deleted file mode 100644
index 6d928b1..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/handle/ApiVersionCondition.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/**
- * 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.handle;
-
-import org.springframework.web.servlet.mvc.condition.RequestCondition;
-
-import javax.servlet.http.HttpServletRequest;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @description API版本控制
- * @date 2020-04-06
- */
-public class ApiVersionCondition implements RequestCondition {
- /**
- * 路径中版本的前缀, 这里用 /v[1-9]/的形式
- */
- private final static Pattern VERSION_PREFIX_PATTERN = Pattern.compile("v(\\d+)/");
- private int apiVersion;
-
- public ApiVersionCondition(int apiVersion) {
- this.apiVersion = apiVersion;
- }
-
- @Override
- public ApiVersionCondition combine(ApiVersionCondition other) {
- // 采用最后定义优先原则,则方法上的定义覆盖类上面的定义
- return new ApiVersionCondition(other.getApiVersion());
- }
-
- @Override
- public ApiVersionCondition getMatchingCondition(HttpServletRequest request) {
- Matcher m = VERSION_PREFIX_PATTERN.matcher(request.getRequestURI());
- if (m.find()) {
- Integer version = Integer.valueOf(m.group(1));
- if (version >= this.apiVersion) {
- return this;
- }
- }
- return null;
- }
-
-
- @Override
- public int compareTo(ApiVersionCondition other, HttpServletRequest request) {
- // 优先匹配最新的版本号
- return other.getApiVersion() - this.apiVersion;
- }
- public int getApiVersion() {
- return apiVersion;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/handle/CustomRequestMappingHandlerMapping.java b/dubhe-server/common/src/main/java/org/dubhe/handle/CustomRequestMappingHandlerMapping.java
deleted file mode 100644
index 64be203..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/handle/CustomRequestMappingHandlerMapping.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.handle;
-
-import lombok.Data;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.annotation.ApiVersion;
-import org.springframework.core.annotation.AnnotationUtils;
-import org.springframework.stereotype.Component;
-import org.springframework.web.servlet.mvc.condition.RequestCondition;
-import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
-
-import java.lang.reflect.Method;
-import java.util.HashSet;
-import java.util.Set;
-/**
- * @description 权限注解收集
- * @date 2020-04-06
- */
-@Component
-@Data
-public class CustomRequestMappingHandlerMapping extends RequestMappingHandlerMapping {
- Set permissionsSet =new HashSet();
- @Override
- protected RequestCondition getCustomTypeCondition(Class> handlerType) {
- ApiVersion apiVersion = AnnotationUtils.findAnnotation(handlerType, ApiVersion.class);
- return createCondition(apiVersion);
- }
-
- @Override
- protected RequestCondition getCustomMethodCondition(Method method) {
- RequiresPermissions requiresPermissions = AnnotationUtils.findAnnotation(method, RequiresPermissions.class);
- if(requiresPermissions != null){
- if(requiresPermissions.value()!=null){
- for(int i=0;i createCondition(ApiVersion apiVersion) {
- return apiVersion == null ? null : new ApiVersionCondition(apiVersion.value());
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/interceptor/K8sCallBackPodInterceptor.java b/dubhe-server/common/src/main/java/org/dubhe/interceptor/K8sCallBackPodInterceptor.java
deleted file mode 100644
index 7b8d398..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/interceptor/K8sCallBackPodInterceptor.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.interceptor;
-
-import org.dubhe.enums.LogEnum;
-import org.dubhe.utils.K8sCallBackTool;
-import org.dubhe.utils.LogUtil;
-import org.dubhe.utils.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.servlet.handler.HandlerInterceptorAdapter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-/**
- * @description k8s pod 异步回调拦截器
- *
- * @date 2020-05-28
- */
-@Component
-public class K8sCallBackPodInterceptor extends HandlerInterceptorAdapter {
-
- @Autowired
- private K8sCallBackTool k8sCallBackTool;
-
- @Override
- public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
- String uri = request.getRequestURI();
- LogUtil.debug(LogEnum.BIZ_K8S,"接收到k8s异步请求,URI:{}",uri);
- String k8sCallbackToken = request.getHeader(K8sCallBackTool.K8S_CALLBACK_TOKEN);
- if (StringUtils.isBlank(k8sCallbackToken)){
- LogUtil.warn(LogEnum.BIZ_K8S,"k8s异步回调没有配置【{}】,URI:{}",K8sCallBackTool.K8S_CALLBACK_TOKEN,uri);
- return false;
- }
- boolean pass = k8sCallBackTool.validateToken(k8sCallbackToken);
- if (!pass){
- LogUtil.warn(LogEnum.BIZ_K8S,"k8s异步回调token:【{}】 验证不通过,URI:{}",k8sCallbackToken,uri);
- }
- return pass;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/interceptor/MySqlInterceptor.java b/dubhe-server/common/src/main/java/org/dubhe/interceptor/MySqlInterceptor.java
deleted file mode 100644
index 3654574..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/interceptor/MySqlInterceptor.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * 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.interceptor;
-
-import org.apache.ibatis.executor.statement.StatementHandler;
-import org.apache.ibatis.mapping.BoundSql;
-import org.apache.ibatis.mapping.MappedStatement;
-import org.apache.ibatis.plugin.*;
-import org.apache.ibatis.reflection.DefaultReflectorFactory;
-import org.apache.ibatis.reflection.MetaObject;
-import org.apache.ibatis.reflection.SystemMetaObject;
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.base.DataContext;
-import org.dubhe.domain.dto.UserDTO;
-import org.dubhe.enums.OperationTypeEnum;
-import org.dubhe.utils.JwtUtils;
-import org.dubhe.utils.SqlUtil;
-import org.springframework.stereotype.Component;
-
-import java.lang.reflect.Field;
-import java.sql.Connection;
-import java.util.Arrays;
-import java.util.Objects;
-import java.util.Properties;
-
-
-/**
- * @description mybatis拦截器
- * @date 2020-06-10
- */
-@Component
-@Intercepts({@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})})
-public class MySqlInterceptor implements Interceptor {
- @Override
- public Object intercept(Invocation invocation) throws Throwable {
-
- StatementHandler statementHandler = (StatementHandler) invocation.getTarget();
- MetaObject metaObject = MetaObject.forObject(statementHandler, SystemMetaObject.DEFAULT_OBJECT_FACTORY,
- SystemMetaObject.DEFAULT_OBJECT_WRAPPER_FACTORY, new DefaultReflectorFactory());
- /*
- * 先拦截到RoutingStatementHandler,里面有个StatementHandler类型的delegate变量,其实现类是BaseStatementHandler,
- * 然后就到BaseStatementHandler的成员变量mappedStatement
- */
- MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
- //id为执行的mapper方法的全路径名,如com.uv.dao.UserDao.selectPageVo
- String id = mappedStatement.getId();
- //sql语句类型 select、delete、insert、update
- String sqlCommandType = mappedStatement.getSqlCommandType().toString();
- BoundSql boundSql = statementHandler.getBoundSql();
-
- //获取到原始sql语句
- String sql = boundSql.getSql();
- String mSql = sql;
-
- //注解逻辑判断 添加注解了才拦截
- Class> classType = Class.forName(mappedStatement.getId().substring(0, mappedStatement.getId().lastIndexOf(".")));
- String mName = mappedStatement.getId().substring(mappedStatement.getId().lastIndexOf(".") + 1, mappedStatement.getId().length());
- UserDTO currentUserDto = JwtUtils.getCurrentUserDto();
-
- //获取类注解 获取需要忽略拦截的方法名称
- DataPermission dataAnnotation = classType.getAnnotation(DataPermission.class);
- if (!Objects.isNull(dataAnnotation)) {
-
- String[] ignores = dataAnnotation.ignoresMethod();
- //校验拦截忽略方法名 忽略新增方法 忽略回调/定时方法
- if ((!Objects.isNull(ignores) && Arrays.asList(ignores).contains(mName))
- || OperationTypeEnum.INSERT.getType().equals(sqlCommandType.toLowerCase())
- || Objects.isNull(currentUserDto)
- || (!Objects.isNull(DataContext.get()) && DataContext.get().getType())
- ) {
- return invocation.proceed();
- } else {
- //拦截所有sql操作类型
- mSql = SqlUtil.buildTargetSql(sql, SqlUtil.getResourceIds());
- }
- }
-
- //通过反射修改sql语句
- Field field = boundSql.getClass().getDeclaredField("sql");
- field.setAccessible(true);
- field.set(boundSql, mSql);
- return invocation.proceed();
- }
-
- @Override
- public Object plugin(Object target) {
- if (target instanceof StatementHandler) {
- return Plugin.wrap(target, this);
- } else {
- return target;
- }
- }
-
- @Override
- public void setProperties(Properties properties) {
-
- }
-
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/interceptor/PaginationInterceptor.java b/dubhe-server/common/src/main/java/org/dubhe/interceptor/PaginationInterceptor.java
deleted file mode 100644
index 5176942..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/interceptor/PaginationInterceptor.java
+++ /dev/null
@@ -1,457 +0,0 @@
-/**
- * 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.interceptor;
-
-import com.baomidou.mybatisplus.annotation.DbType;
-import com.baomidou.mybatisplus.core.MybatisDefaultParameterHandler;
-import com.baomidou.mybatisplus.core.metadata.IPage;
-import com.baomidou.mybatisplus.core.metadata.OrderItem;
-import com.baomidou.mybatisplus.core.parser.ISqlParser;
-import com.baomidou.mybatisplus.core.parser.SqlInfo;
-import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
-import com.baomidou.mybatisplus.core.toolkit.ExceptionUtils;
-import com.baomidou.mybatisplus.core.toolkit.PluginUtils;
-import com.baomidou.mybatisplus.core.toolkit.StringUtils;
-import com.baomidou.mybatisplus.extension.handlers.AbstractSqlParserHandler;
-import com.baomidou.mybatisplus.extension.plugins.pagination.DialectFactory;
-import com.baomidou.mybatisplus.extension.plugins.pagination.DialectModel;
-import com.baomidou.mybatisplus.extension.plugins.pagination.dialects.IDialect;
-import com.baomidou.mybatisplus.extension.toolkit.JdbcUtils;
-import com.baomidou.mybatisplus.extension.toolkit.SqlParserUtils;
-import net.sf.jsqlparser.JSQLParserException;
-import net.sf.jsqlparser.parser.CCJSqlParserUtil;
-import net.sf.jsqlparser.schema.Column;
-import net.sf.jsqlparser.statement.select.*;
-import org.apache.ibatis.executor.statement.StatementHandler;
-import org.apache.ibatis.logging.Log;
-import org.apache.ibatis.logging.LogFactory;
-import org.apache.ibatis.mapping.*;
-import org.apache.ibatis.plugin.*;
-import org.apache.ibatis.reflection.MetaObject;
-import org.apache.ibatis.reflection.SystemMetaObject;
-import org.apache.ibatis.scripting.defaults.DefaultParameterHandler;
-import org.apache.ibatis.session.Configuration;
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.base.DataContext;
-import org.dubhe.domain.dto.UserDTO;
-import org.dubhe.enums.OperationTypeEnum;
-import org.dubhe.utils.JwtUtils;
-import org.dubhe.utils.SqlUtil;
-
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.util.*;
-import java.util.stream.Collectors;
-
-/**
- * @description MybatisPlus 分页拦截器
- * @date 2020-10-09
- */
-@Intercepts({@Signature(
- type = StatementHandler.class,
- method = "prepare",
- args = {Connection.class, Integer.class}
-)})
-public class PaginationInterceptor extends AbstractSqlParserHandler implements Interceptor {
- protected static final Log logger = LogFactory.getLog(PaginationInterceptor.class);
-
- /**
- * COUNT SQL 解析
- */
- protected ISqlParser countSqlParser;
- /**
- * 溢出总页数,设置第一页
- */
- protected boolean overflow = false;
- /**
- * 单页限制 500 条,小于 0 如 -1 不受限制
- */
- protected long limit = 500L;
- /**
- * 数据类型
- */
- private DbType dbType;
- /**
- * 方言
- */
- private IDialect dialect;
- /**
- * 方言类型
- */
- @Deprecated
- protected String dialectType;
- /**
- * 方言实现类
- */
- @Deprecated
- protected String dialectClazz;
-
- public PaginationInterceptor() {
- }
-
- /**
- * 构建分页sql
- *
- * @param originalSql 原生sql
- * @param page 分页参数
- * @return 构建后 sql
- */
- public static String concatOrderBy(String originalSql, IPage> page) {
- if (CollectionUtils.isNotEmpty(page.orders())) {
- try {
- List orderList = page.orders();
- Select selectStatement = (Select) CCJSqlParserUtil.parse(originalSql);
- List orderByElements;
- List orderByElementsReturn;
- if (selectStatement.getSelectBody() instanceof PlainSelect) {
- PlainSelect plainSelect = (PlainSelect) selectStatement.getSelectBody();
- orderByElements = plainSelect.getOrderByElements();
- orderByElementsReturn = addOrderByElements(orderList, orderByElements);
- plainSelect.setOrderByElements(orderByElementsReturn);
- return plainSelect.toString();
- }
-
- if (selectStatement.getSelectBody() instanceof SetOperationList) {
- SetOperationList setOperationList = (SetOperationList) selectStatement.getSelectBody();
- orderByElements = setOperationList.getOrderByElements();
- orderByElementsReturn = addOrderByElements(orderList, orderByElements);
- setOperationList.setOrderByElements(orderByElementsReturn);
- return setOperationList.toString();
- }
-
- if (selectStatement.getSelectBody() instanceof WithItem) {
- return originalSql;
- }
-
- return originalSql;
- } catch (JSQLParserException var7) {
- logger.error("failed to concat orderBy from IPage, exception=", var7);
- }
- }
-
- return originalSql;
- }
-
- /**
- * 添加分页排序规则
- *
- * @param orderList 分页规则
- * @param orderByElements 分页排序元素
- * @return 分页规则
- */
- private static List addOrderByElements(List orderList, List orderByElements) {
- orderByElements = CollectionUtils.isEmpty(orderByElements) ? new ArrayList(orderList.size()) : orderByElements;
- List orderByElementList = (List) orderList.stream().filter((item) -> {
- return StringUtils.isNotBlank(item.getColumn());
- }).map((item) -> {
- OrderByElement element = new OrderByElement();
- element.setExpression(new Column(item.getColumn()));
- element.setAsc(item.isAsc());
- element.setAscDescPresent(true);
- return element;
- }).collect(Collectors.toList());
- ((List) orderByElements).addAll(orderByElementList);
- return (List) orderByElements;
- }
-
- /**
- * 执行sql查询逻辑
- *
- * @param invocation mybatis 调用类
- * @return
- * @throws Throwable
- */
- @Override
- public Object intercept(Invocation invocation) throws Throwable {
- StatementHandler statementHandler = (StatementHandler) PluginUtils.realTarget(invocation.getTarget());
- MetaObject metaObject = SystemMetaObject.forObject(statementHandler);
- this.sqlParser(metaObject);
- MappedStatement mappedStatement = (MappedStatement) metaObject.getValue("delegate.mappedStatement");
- if (SqlCommandType.SELECT == mappedStatement.getSqlCommandType() && StatementType.CALLABLE != mappedStatement.getStatementType()) {
- BoundSql boundSql = (BoundSql) metaObject.getValue("delegate.boundSql");
- Object paramObj = boundSql.getParameterObject();
- IPage> page = null;
- if (paramObj instanceof IPage) {
- page = (IPage) paramObj;
- } else if (paramObj instanceof Map) {
- Iterator var8 = ((Map) paramObj).values().iterator();
-
- while (var8.hasNext()) {
- Object arg = var8.next();
- if (arg instanceof IPage) {
- page = (IPage) arg;
- break;
- }
- }
- }
-
- if (null != page && page.getSize() >= 0L) {
- if (this.limit > 0L && this.limit <= page.getSize()) {
- this.handlerLimit(page);
- }
-
- String originalSql = boundSql.getSql();
-
- //注解逻辑判断 添加注解了才拦截
- Class> classType = Class.forName(mappedStatement.getId().substring(0, mappedStatement.getId().lastIndexOf(".")));
- String mName = mappedStatement.getId().substring(mappedStatement.getId().lastIndexOf(".") + 1, mappedStatement.getId().length());
- UserDTO currentUserDto = JwtUtils.getCurrentUserDto();
-
- String sqlCommandType = mappedStatement.getSqlCommandType().toString();
- //获取类注解 获取需要忽略拦截的方法名称
- DataPermission dataAnnotation = classType.getAnnotation(DataPermission.class);
- if (!Objects.isNull(dataAnnotation)) {
-
- String[] ignores = dataAnnotation.ignoresMethod();
- //校验拦截忽略方法名 忽略新增方法 忽略回调/定时方法
- if (!((!Objects.isNull(ignores) && Arrays.asList(ignores).contains(mName))
- || OperationTypeEnum.INSERT.getType().equals(sqlCommandType.toLowerCase())
- || Objects.isNull(currentUserDto)
- || (!Objects.isNull(DataContext.get()) && DataContext.get().getType()))
-
-
- ) {
- originalSql = SqlUtil.buildTargetSql(originalSql, SqlUtil.getResourceIds());
- }
- }
-
- Connection connection = (Connection) invocation.getArgs()[0];
- if (page.isSearchCount() && !page.isHitCount()) {
- SqlInfo sqlInfo = SqlParserUtils.getOptimizeCountSql(page.optimizeCountSql(), this.countSqlParser, originalSql);
- this.queryTotal(sqlInfo.getSql(), mappedStatement, boundSql, page, connection);
- if (page.getTotal() <= 0L) {
- return null;
- }
- }
-
- DbType dbType = Optional.ofNullable(this.dbType).orElse(JdbcUtils.getDbType(connection.getMetaData().getURL()));
- IDialect dialect = Optional.ofNullable(this.dialect).orElse(DialectFactory.getDialect(dbType));
- String buildSql = concatOrderBy(originalSql, page);
- DialectModel model = dialect.buildPaginationSql(buildSql, page.offset(), page.getSize());
- Configuration configuration = mappedStatement.getConfiguration();
- List mappings = new ArrayList(boundSql.getParameterMappings());
- Map additionalParameters = (Map) metaObject.getValue("delegate.boundSql.additionalParameters");
- model.consumers(mappings, configuration, additionalParameters);
- metaObject.setValue("delegate.boundSql.sql", model.getDialectSql());
- metaObject.setValue("delegate.boundSql.parameterMappings", mappings);
- return invocation.proceed();
- } else {
- return invocation.proceed();
- }
- } else {
- return invocation.proceed();
- }
- }
-
- /**
- * 处理分页数量
- *
- * @param page 分页参数
- */
- protected void handlerLimit(IPage> page) {
- page.setSize(this.limit);
- }
-
- /**
- * 查询总数量
- *
- * @param sql sql语句
- * @param mappedStatement 映射语句包装类
- * @param boundSql sql包装类
- * @param page 分页参数
- * @param connection JDBC连接包装类
- */
- protected void queryTotal(String sql, MappedStatement mappedStatement, BoundSql boundSql, IPage> page, Connection connection) {
- try {
- PreparedStatement statement = connection.prepareStatement(sql);
- Throwable var7 = null;
-
- try {
- DefaultParameterHandler parameterHandler = new MybatisDefaultParameterHandler(mappedStatement, boundSql.getParameterObject(), boundSql);
- parameterHandler.setParameters(statement);
- long total = 0L;
- ResultSet resultSet = statement.executeQuery();
- Throwable var12 = null;
-
- try {
- if (resultSet.next()) {
- total = resultSet.getLong(1);
- }
- } catch (Throwable var37) {
- var12 = var37;
- throw var37;
- } finally {
- if (resultSet != null) {
- if (var12 != null) {
- try {
- resultSet.close();
- } catch (Throwable var36) {
- var12.addSuppressed(var36);
- }
- } else {
- resultSet.close();
- }
- }
-
- }
-
- page.setTotal(total);
- if (this.overflow && page.getCurrent() > page.getPages()) {
- this.handlerOverflow(page);
- }
- } catch (Throwable var39) {
- var7 = var39;
- throw var39;
- } finally {
- if (statement != null) {
- if (var7 != null) {
- try {
- statement.close();
- } catch (Throwable var35) {
- var7.addSuppressed(var35);
- }
- } else {
- statement.close();
- }
- }
-
- }
-
- } catch (Exception var41) {
- throw ExceptionUtils.mpe("Error: Method queryTotal execution error of sql : \n %s \n", var41, new Object[]{sql});
- }
- }
-
- /**
- * 设置默认当前页
- *
- * @param page 分页参数
- */
- protected void handlerOverflow(IPage> page) {
- page.setCurrent(1L);
- }
-
- /**
- * MybatisPlus拦截器实现自定义插件
- *
- * @param target 拦截目标对象
- * @return
- */
- @Override
- public Object plugin(Object target) {
- return target instanceof StatementHandler ? Plugin.wrap(target, this) : target;
- }
-
- /**
- * MybatisPlus拦截器实现自定义属性设置
- *
- * @param prop 属性参数
- */
- @Override
- public void setProperties(Properties prop) {
- String dialectType = prop.getProperty("dialectType");
- String dialectClazz = prop.getProperty("dialectClazz");
- if (StringUtils.isNotBlank(dialectType)) {
- this.setDialectType(dialectType);
- }
-
- if (StringUtils.isNotBlank(dialectClazz)) {
- this.setDialectClazz(dialectClazz);
- }
-
- }
-
- /**
- * 设置数据源类型
- *
- * @param dialectType 数据源类型
- */
- @Deprecated
- public void setDialectType(String dialectType) {
- this.setDbType(DbType.getDbType(dialectType));
- }
-
-
- /**
- * 设置方言实现类配置
- *
- * @param dialectClazz 方言实现类
- */
- @Deprecated
- public void setDialectClazz(String dialectClazz) {
- this.setDialect(DialectFactory.getDialect(dialectClazz));
- }
-
- /**
- * 设置获取总数的sql解析器
- *
- * @param countSqlParser 总数的sql解析器
- * @return 自定义MybatisPlus拦截器
- */
- public PaginationInterceptor setCountSqlParser(final ISqlParser countSqlParser) {
- this.countSqlParser = countSqlParser;
- return this;
- }
-
- /**
- * 溢出总页数,设置第一页
- *
- * @param overflow 溢出总页数
- * @return 自定义MybatisPlus拦截器
- */
- public PaginationInterceptor setOverflow(final boolean overflow) {
- this.overflow = overflow;
- return this;
- }
-
- /**
- * 设置分页规则
- *
- * @param limit 分页数量
- * @return 自定义MybatisPlus拦截器
- */
- public PaginationInterceptor setLimit(final long limit) {
- this.limit = limit;
- return this;
- }
-
- /**
- * 设置数据类型
- *
- * @param dbType 数据类型
- * @return 自定义MybatisPlus拦截器
- */
- public PaginationInterceptor setDbType(final DbType dbType) {
- this.dbType = dbType;
- return this;
- }
-
- /**
- * 设置方言
- *
- * @param dialect 方言
- * @return 自定义MybatisPlus拦截器
- */
- public PaginationInterceptor setDialect(final IDialect dialect) {
- this.dialect = dialect;
- return this;
- }
-
-
-}
-
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/AesUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/AesUtil.java
deleted file mode 100644
index 5399f7c..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/AesUtil.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * 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.utils;
-
-import cn.hutool.core.util.HexUtil;
-import org.dubhe.enums.LogEnum;
-
-import javax.crypto.Cipher;
-import javax.crypto.NoSuchPaddingException;
-import javax.crypto.spec.SecretKeySpec;
-import java.nio.charset.StandardCharsets;
-import java.security.InvalidKeyException;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
-
-/**
- * @description AES加解密工具
- * @date 2020-06-01
- */
-public class AesUtil {
-
- private static final String AES = "AES";
-
-
- private AesUtil(){
-
- }
-
-
- /**
- *
- * @param mode Cipher mode
- * @param key 秘钥
- * @return Cipher
- * @throws NoSuchAlgorithmException
- * @throws NoSuchPaddingException
- * @throws InvalidKeyException
- */
- private static Cipher getCipher(int mode,String key) throws NoSuchAlgorithmException, NoSuchPaddingException, InvalidKeyException {
- MessageDigest md5Digest = MessageDigest.getInstance("MD5");
- SecretKeySpec secretKeySpec = new SecretKeySpec(md5Digest.digest(key.getBytes(StandardCharsets.UTF_8)), AES);
- Cipher cipher = Cipher.getInstance(AES);
- cipher.init(mode, secretKeySpec);
- return cipher;
- }
-
- /**
- * 加密
- *
- * @param data 原文
- * @param key 秘钥
- * @return String 密文
- */
- public static String encrypt(String data, String key) {
- try {
- Cipher cipher = getCipher(Cipher.ENCRYPT_MODE,key);
- byte[] content = data.getBytes(StandardCharsets.UTF_8);
- return new String(HexUtil.encodeHex(cipher.doFinal(content), false));
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_SYS,"Md5Util 加密失败 ",e);
- return null;
- }
- }
-
- /**
- * 解密
- * @param hexData 十六进制密文
- * @param key 秘钥
- * @return String 密文
- */
- public static String decrypt(String hexData, String key) {
- try {
- Cipher cipher = getCipher(Cipher.DECRYPT_MODE,key);
- byte[] content = HexUtil.decodeHex(hexData);
- return new String(cipher.doFinal(content), StandardCharsets.UTF_8);
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_SYS,"Md5Util 解密失败 ",e);
- return null;
- }
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/DateUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/DateUtil.java
deleted file mode 100644
index e55822e..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/DateUtil.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/**
- * 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.utils;
-
-import java.sql.Timestamp;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.time.*;
-import java.util.Date;
-
-/**
- * @description 日期工具类
- * @date 2020-06-10
- */
-public class DateUtil {
-
- private DateUtil(){
-
- }
-
-
- /**
- * 获取当前时间戳
- *
- * @return
- */
- public static Timestamp getCurrentTimestamp() {
- return Timestamp.valueOf(LocalDateTime.now());
- }
-
-
-
- /**
- * 获取六小时后时间
- * @return
- */
- public static long getAfterSixHourTime(){
- long l1 = getTimestampOfDateTime(LocalDateTime.now());
- long milli = getTimestampOfDateTime(LocalDateTime.now().plusHours(6));
- return (milli-l1);
- }
-
-
- /**
- * LocalDateTime -> long
- * @param localDateTime
- * @return
- */
- public static long getTimestampOfDateTime(LocalDateTime localDateTime) {
- ZoneId zone = ZoneId.systemDefault();
- Instant instant = localDateTime.atZone(zone).toInstant();
- return instant.toEpochMilli();
- }
-
- /**
- * 获取第二天凌晨时间
- * @return
- */
- public static long getSecondTime(){
- LocalDateTime localDateTime = LocalDateTime.now();
- long l1 = localDateTime.atZone(ZoneId.of("Asia/Shanghai")).toInstant().toEpochMilli();
-
- LocalDate localDate = LocalDate.now();
- LocalDate localDate1 = localDate.plusDays(1);
- LocalDateTime localDateTime1 = localDate1.atStartOfDay();
- long milli = localDateTime1.atZone(ZoneId.of("Asia/Shanghai")).toInstant().toEpochMilli();
- System.out.println("当前时间到第二天凌晨的毫秒数"+(milli-l1));
- return (milli-l1);
- }
-
- /**
- * @return 当前字符串时间yyyy-MM-dd HH:mm:ss SSS
- */
- public static String getCurrentTimeStr(){
- Date date = new Date();
- DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss SSS");
- return dateFormat.format(date);
- }
-
- /**
- *
- * @return 当前字符串时间yyyyMMddHHmmss
- */
- public static String getTimestampStr() {
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmssSSS");
- return df.format(System.currentTimeMillis());
- }
-
- /**
- * 获取当前时间与目标时间相差秒数
- * @param timestamp 目标时间
- * @return
- */
- public static long getSeconds(Timestamp timestamp) {
- LocalDateTime time = timestamp.toLocalDateTime();
- LocalDateTime now = LocalDateTime.now();
- Duration duration = Duration.between(time, now);
- return duration.abs().getSeconds();
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/DubheDateUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/DubheDateUtil.java
deleted file mode 100644
index b9f77f0..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/DubheDateUtil.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.utils;
-
-/**
- * @description 日期工具类
- * @date 2020-5-29
- **/
-public class DubheDateUtil {
-
- private static final int SIXTY = 60;
-
- /**
- * 将时间 秒 转为 小时
- *
- * @param second 秒数
- * @return
- */
- public static String convert2Str(Long second) {
- if (null == second || second < 1) {
- return "";
- }
- Long hh = second / (SIXTY * SIXTY);
- second = second % (SIXTY * SIXTY);
- Long mm = second / SIXTY;
- Long ss = second % SIXTY;
-
- StringBuilder sb = new StringBuilder();
- sb.append(String.format("%02d", hh)).append(":").append(String.format("%02d", mm)).append(":").append(String.format("%02d", ss));
- return sb.toString();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/EncryptUtils.java b/dubhe-server/common/src/main/java/org/dubhe/utils/EncryptUtils.java
deleted file mode 100644
index f05cbb1..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/EncryptUtils.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 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.utils;
-
-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;
-
-/**
- * @description 加密
- * @date 2020-03-13
- */
-public class EncryptUtils {
-
- private static String strParam = "Passw0rd";
-
- private static Cipher cipher;
-
- private static IvParameterSpec iv = new IvParameterSpec(strParam.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());
- 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;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/FileUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/FileUtil.java
deleted file mode 100644
index fe3a3b1..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/FileUtil.java
+++ /dev/null
@@ -1,409 +0,0 @@
-/**
- * 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.utils;
-
-import cn.hutool.core.codec.Base64;
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.core.util.CharsetUtil;
-import cn.hutool.core.util.IdUtil;
-import cn.hutool.poi.excel.BigExcelWriter;
-import cn.hutool.poi.excel.ExcelUtil;
-import org.apache.poi.util.IOUtils;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.exception.BusinessException;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.*;
-import java.security.MessageDigest;
-import java.text.DecimalFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-/**
- * @description File工具类,扩展 hutool 工具包
- * @date 2020-03-14
- */
-public class FileUtil extends cn.hutool.core.io.FileUtil {
-
- /**
- * 定义GB的计算常量
- */
- private static final int GB = 1024 * 1024 * 1024;
- /**
- * 定义MB的计算常量
- */
- private static final int MB = 1024 * 1024;
- /**
- * 定义KB的计算常量
- */
- private static final int KB = 1024;
-
- /**
- * 格式化小数
- */
- private static final DecimalFormat DF = new DecimalFormat("0.00");
-
- /**
- * MultipartFile转File
- */
- public static File toFile(MultipartFile multipartFile) {
- // 获取文件名
- String fileName = multipartFile.getOriginalFilename();
- // 获取文件后缀
- String prefix = "." + getExtensionName(fileName);
- File file = null;
- try {
- // 用uuid作为文件名,防止生成的临时文件重复
- file = File.createTempFile(IdUtil.simpleUUID(), prefix);
- // MultipartFile to File
- multipartFile.transferTo(file);
- } catch (IOException e) {
- e.printStackTrace();
- }
- return file;
- }
-
- /**
- * 获取文件扩展名,不带 .
- */
- public static String getExtensionName(String filename) {
- if ((filename != null) && (filename.length() > 0)) {
- int dot = filename.lastIndexOf('.');
- if ((dot > -1) && (dot < (filename.length() - 1))) {
- return filename.substring(dot + 1);
- }
- }
- return filename;
- }
-
- /**
- * Java文件操作 获取不带扩展名的文件名
- */
- public static String getFileNameNoEx(String filename) {
- if ((filename != null) && (filename.length() > 0)) {
- int dot = filename.lastIndexOf('.');
- if ((dot > -1) && (dot < (filename.length()))) {
- return filename.substring(0, dot);
- }
- }
- return filename;
- }
-
- /**
- * 文件大小转换
- */
- public static String getSize(long size) {
- String resultSize;
- if (size / GB >= 1) {
- //如果当前Byte的值大于等于1GB
- resultSize = DF.format(size / (float) GB) + "GB ";
- } else if (size / MB >= 1) {
- //如果当前Byte的值大于等于1MB
- resultSize = DF.format(size / (float) MB) + "MB ";
- } else if (size / KB >= 1) {
- //如果当前Byte的值大于等于1KB
- resultSize = DF.format(size / (float) KB) + "KB ";
- } else {
- resultSize = size + "B ";
- }
- return resultSize;
- }
-
- /**
- * inputStream 转 File
- */
- static File inputStreamToFile(InputStream ins, String name) throws Exception {
- File file = new File(System.getProperty("java.io.tmpdir") + File.separator + name);
- if (file.exists()) {
- return file;
- }
- OutputStream os = new FileOutputStream(file);
- int bytesRead;
- int len = 8192;
- byte[] buffer = new byte[len];
- while ((bytesRead = ins.read(buffer, 0, len)) != -1) {
- os.write(buffer, 0, bytesRead);
- }
- os.close();
- ins.close();
- return file;
- }
-
- /**
- * 将文件名解析成文件的上传路径
- */
- public static File upload(MultipartFile file, String filePath) {
- Date date = new Date();
- SimpleDateFormat format = new SimpleDateFormat("yyyyMMddhhmmssS");
- String name = getFileNameNoEx(file.getOriginalFilename());
- String suffix = getExtensionName(file.getOriginalFilename());
- String nowStr = "-" + format.format(date);
- try {
- String fileName = name + nowStr + "." + suffix;
- String path = filePath + fileName;
- // getCanonicalFile 可解析正确各种路径
- File dest = new File(path).getCanonicalFile();
- // 检测是否存在目录
- if (!dest.getParentFile().exists()) {
- dest.getParentFile().mkdirs();
- }
- // 文件写入
- file.transferTo(dest);
- return dest;
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- public static String fileToBase64(File file) throws Exception {
- FileInputStream inputFile = new FileInputStream(file);
- String base64;
- byte[] buffer = new byte[(int) file.length()];
- inputFile.read(buffer);
- inputFile.close();
- base64 = Base64.encode(buffer);
- return base64.replaceAll("[\\s*\t\n\r]", "");
- }
-
- /**
- * 导出excel
- */
- public static void downloadExcel(List> list, HttpServletResponse response) throws IOException {
- String tempPath = System.getProperty("java.io.tmpdir") + IdUtil.fastSimpleUUID() + ".xlsx";
- File file = new File(tempPath);
- BigExcelWriter writer = ExcelUtil.getBigWriter(file);
- // 一次性写出内容,使用默认样式,强制输出标题
- writer.write(list, true);
- //response为HttpServletResponse对象
- response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8");
- //test.xls是弹出下载对话框的文件名,不能为中文,中文请自行编码
- response.setHeader("Content-Disposition", "attachment;filename=file.xlsx");
- ServletOutputStream out = response.getOutputStream();
- // 终止后删除临时文件
- file.deleteOnExit();
- writer.flush(out, true);
- //此处记得关闭输出Servlet流
- IoUtil.close(out);
- }
-
- /**
- * 下载文件
- */
- public static void download(String path, HttpServletResponse response) {
- if (path == null) {
- return;
- }
- FileInputStream fis = null;
- ServletOutputStream out = null;
- try {
- File file = new File(path);
- fis = new FileInputStream(file);
- out = response.getOutputStream();
- IOUtils.copy(fis, out);
- response.flushBuffer();
- } catch (IOException e) {
- e.printStackTrace();
- } finally {
- if (fis != null) {
- try {
- fis.close();
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- //此处记得关闭输出Servlet流
- IoUtil.close(out);
- }
- }
-
- public static String getFileType(String type) {
- String documents = "txt doc pdf ppt pps xlsx xls docx";
- String music = "mp3 wav wma mpa ram ra aac aif m4a";
- String video = "avi mpg mpe mpeg asf wmv mov qt rm mp4 flv m4v webm ogv ogg";
- String image = "bmp dib pcp dif wmf gif jpg tif eps psd cdr iff tga pcd mpt png jpeg";
- if (image.contains(type)) {
- return "图片";
- } else if (documents.contains(type)) {
- return "文档";
- } else if (music.contains(type)) {
- return "音乐";
- } else if (video.contains(type)) {
- return "视频";
- } else {
- return "其他";
- }
- }
-
- public static void checkSize(long maxSize, long size) {
- // 1M
- int len = 1024 * 1024;
- if (size > (maxSize * len)) {
- throw new BusinessException("文件超出规定大小");
- }
- }
-
- /**
- * 判断两个文件是否相同
- */
- public static boolean check(File file1, File file2) {
- String img1Md5 = getMd5(file1);
- String img2Md5 = getMd5(file2);
- return img1Md5.equals(img2Md5);
- }
-
- /**
- * 判断两个文件是否相同
- */
- public static boolean check(String file1Md5, String file2Md5) {
- return file1Md5.equals(file2Md5);
- }
-
- private static byte[] getByte(File file) {
- // 得到文件长度
- byte[] b = new byte[(int) file.length()];
- try {
- InputStream in = new FileInputStream(file);
- try {
- in.read(b);
- } catch (IOException e) {
- e.printStackTrace();
- }
- } catch (FileNotFoundException e) {
- e.printStackTrace();
- return null;
- }
- return b;
- }
-
- private static String getMd5(byte[] bytes) {
- // 16进制字符
- char[] hexDigits = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'};
- try {
- MessageDigest mdTemp = MessageDigest.getInstance("MD5");
- mdTemp.update(bytes);
- byte[] md = mdTemp.digest();
- int j = md.length;
- char[] str = new char[j * 2];
- int k = 0;
- // 移位 输出字符串
- for (byte byte0 : md) {
- str[k++] = hexDigits[byte0 >>> 4 & 0xf];
- str[k++] = hexDigits[byte0 & 0xf];
- }
- return new String(str);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return null;
- }
-
- /**
- * 下载文件
- *
- * @param request /
- * @param response /
- * @param file /
- */
- public static void downloadFile(HttpServletRequest request, HttpServletResponse response, File file, boolean deleteOnExit) {
- response.setCharacterEncoding(request.getCharacterEncoding());
- response.setContentType("application/octet-stream");
- FileInputStream fis = null;
- try {
- fis = new FileInputStream(file);
- response.setHeader("Content-Disposition", "attachment; filename=" + file.getName());
- IOUtils.copy(fis, response.getOutputStream());
- response.flushBuffer();
- } catch (Exception e) {
- e.printStackTrace();
- } finally {
- if (fis != null) {
- try {
- fis.close();
- if (deleteOnExit) {
- file.deleteOnExit();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
- }
- }
-
- public static String getMd5(File file) {
- return getMd5(getByte(file));
- }
-
-
- /**
- * 生成文件
- * @param filePath 文件绝对路径
- * @param content 文件内容
- * @param append 文件是否是追加
- * @return
- */
- public static boolean generateFile(String filePath,String content,boolean append){
- File file = new File(filePath);
- FileOutputStream outputStream = null;
- try {
- if (!file.exists()){
- file.createNewFile();
- }
- outputStream = new FileOutputStream(file,append);
- outputStream.write(content.getBytes(CharsetUtil.defaultCharset()));
- outputStream.flush();
- }catch (IOException e) {
- LogUtil.error(LogEnum.FILE_UTIL,e);
- return false;
- }finally {
- if (outputStream != null){
- try {
- outputStream.close();
- } catch (IOException e) {
- LogUtil.error(LogEnum.FILE_UTIL,e);
- }
- }
- }
- return true;
- }
-
-
- /**
- * 压缩文件目录
- *
- * @param zipDir 待压缩文件夹路径
- * @param zipFile 压缩完成zip文件绝对路径
- * @return
- */
- public static boolean zipPath(String zipDir,String zipFile) {
- if (zipDir == null) {
- return false;
- }
- File zip = new File(zipFile);
- cn.hutool.core.util.ZipUtil.zip(zip, CharsetUtil.defaultCharset(), true,
- (f) -> !f.isDirectory(),
- new File(zipDir).listFiles());
- return true;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/HttpClientUtils.java b/dubhe-server/common/src/main/java/org/dubhe/utils/HttpClientUtils.java
deleted file mode 100644
index 9e09cb1..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/HttpClientUtils.java
+++ /dev/null
@@ -1,169 +0,0 @@
-/**
- * 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.utils;
-import org.apache.commons.io.IOUtils;
-import org.dubhe.enums.LogEnum;
-
-
-
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.URL;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import org.apache.commons.codec.binary.Base64;
-import static org.dubhe.constant.StringConstant.UTF8;
-import static org.dubhe.constant.SymbolConstant.BLANK;
-
-/**
- * @description httpClient工具类,不校验SSL证书
- * @date 2020-05-21
- */
-public class HttpClientUtils {
-
- public static String sendHttps(String path) {
- InputStream inputStream = null;
- BufferedReader bufferedReader = null;
- InputStreamReader inputStreamReader = null;
- StringBuilder stringBuilder = new StringBuilder();
- String result = BLANK;
- HttpsURLConnection con = null;
- try {
- con = getConnection(path);
- con.connect();
-
- /**将返回的输入流转换成字符串**/
- inputStream = con.getInputStream();
- inputStreamReader = new InputStreamReader(inputStream, UTF8);
- bufferedReader = new BufferedReader(inputStreamReader);
-
- String str = null;
- while ((str = bufferedReader.readLine()) != null) {
- stringBuilder.append(str);
- }
-
- result = stringBuilder.toString();
- LogUtil.info(LogEnum.BIZ_SYS,"Request path:{}, SUCCESS, result:{}", path, result);
-
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_SYS,"Request path:{}, ERROR, exception:{}", path, e);
- return result;
- } finally {
- closeResource(bufferedReader,inputStreamReader,inputStream,con);
- }
-
- return result;
- }
- public static String sendHttpsDelete(String path,String username,String password) {
- InputStream inputStream = null;
- BufferedReader bufferedReader = null;
- InputStreamReader inputStreamReader = null;
- StringBuilder stringBuilder = new StringBuilder();
- String result = BLANK;
- HttpsURLConnection con = null;
- try {
- con = getConnection(path);
- String input =username+ ":" +password;
- String encoding=Base64.encodeBase64String(input.getBytes());
- con.setRequestProperty(JwtUtils.AUTH_HEADER, "Basic " + encoding);
- con.setRequestMethod("DELETE");
- con.connect();
- /**将返回的输入流转换成字符串**/
- inputStream = con.getInputStream();
- inputStreamReader = new InputStreamReader(inputStream, UTF8);
- bufferedReader = new BufferedReader(inputStreamReader);
-
- String str = null;
- while ((str = bufferedReader.readLine()) != null) {
- stringBuilder.append(str);
- }
-
- result = stringBuilder.toString();
- LogUtil.info(LogEnum.BIZ_SYS,"Request path:{}, SUCCESS, result:{}", path, result);
-
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_SYS,"Request path:{}, ERROR, exception:{}", path, e);
- return result;
- } finally {
- closeResource(bufferedReader,inputStreamReader,inputStream,con);
- }
-
- return result;
- }
-
- private static void closeResource(BufferedReader bufferedReader,InputStreamReader inputStreamReader,InputStream inputStream,HttpsURLConnection con) {
- if (inputStream != null) {
- IOUtils.closeQuietly(inputStream);
- }
-
- if (inputStreamReader != null) {
- IOUtils.closeQuietly(inputStreamReader);
- }
- if (bufferedReader != null) {
- IOUtils.closeQuietly(bufferedReader);
- }
- if (con != null) {
- con.disconnect();
- }
- }
-
-
- private static HttpsURLConnection getConnection(String path){
- HttpsURLConnection con = null;
- try {
- /**创建并初始化SSLContext对象**/
- TrustManager[] trustManagers = {new X509TrustManager() {
- @Override
- public void checkClientTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] x509Certificates, String s) throws CertificateException {
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return null;
- }
- }};
- SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
- sslContext.init(null, trustManagers, new java.security.SecureRandom());
-
- /**得到SSLSocketFactory对象**/
- SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();
-
- URL url = new URL(path);
- con = (HttpsURLConnection) url.openConnection();
- con.setSSLSocketFactory(sslSocketFactory);
- con.setUseCaches(false);
- }catch (Exception e){
- LogUtil.error(LogEnum.BIZ_SYS,"Request path:{}, error, exception:{}", path, e);
- }
- return con;
-
- }
-
-}
-
-
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/HttpUtils.java b/dubhe-server/common/src/main/java/org/dubhe/utils/HttpUtils.java
deleted file mode 100644
index cb31df0..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/HttpUtils.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.utils;
-
-import lombok.extern.slf4j.Slf4j;
-
-/**
- * @description HttpUtil
- * @date 2020-04-30
- */
-@Slf4j
-public class HttpUtils {
-
- private HttpUtils() {
-
- }
-
- /**
- * 判断http请求是否成功
- *
- * @param httpCode
- * 1XX Informational(信息性状态码)
- * 2XX Success(成功状态码)
- * 3XX Redirection(重定向状态码)
- * 4XX Client Error(客户端错误状态码)
- * 5XX Server Error(服务器错误状态码)
- * @return
- */
- public static boolean isSuccess(String httpCode){
- if (StringUtils.isBlank(httpCode)){
- return false;
- }
- return httpCode.length() == 3 && httpCode.startsWith("2");
- }
-
- /**
- * 判断http请求是否成功
- *
- * @param httpCode
- * 1XX Informational(信息性状态码)
- * 2XX Success(成功状态码)
- * 3XX Redirection(重定向状态码)
- * 4XX Client Error(客户端错误状态码)
- * 5XX Server Error(服务器错误状态码)
- * @return
- */
- public static boolean isSuccess(int httpCode) {
- return isSuccess(String.valueOf(httpCode));
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/IOUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/IOUtil.java
deleted file mode 100644
index e82e0be..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/IOUtil.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.utils;
-
-import org.dubhe.enums.LogEnum;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-/**
- * @description IO流操作工具类
- * @date 2020-10-14
- */
-public class IOUtil {
-
- /**
- * 循环的依次关闭流
- *
- * @param closeableList 要被关闭的流集合
- */
- public static void close(Closeable... closeableList) {
- for (Closeable closeable : closeableList) {
- try {
- if (closeable != null) {
- closeable.close();
- }
- } catch (IOException e) {
- LogUtil.error(LogEnum.IO_UTIL, "关闭流异常,异常信息:{}", e);
- }
- }
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/JwcConfig.java b/dubhe-server/common/src/main/java/org/dubhe/utils/JwcConfig.java
deleted file mode 100644
index a69eb78..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/JwcConfig.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.utils;
-
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.context.annotation.Configuration;
-/**
- * @description JWT配置类
- * @date 2020-04-15
- */
-@Configuration
-public class JwcConfig {
- @Value("${jwt.online-key}")
- public String onlineKey;
- @Autowired
- public RedisUtils redisUtils;
- @Value("${jwt.token-validity-in-seconds}")
- public Long jwtExpiration;
- @Value("${jwt.base64-secret}")
- public String secret;
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/JwtUtils.java b/dubhe-server/common/src/main/java/org/dubhe/utils/JwtUtils.java
deleted file mode 100644
index 032f70a..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/JwtUtils.java
+++ /dev/null
@@ -1,203 +0,0 @@
-/**
- * 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.utils;
-
-import com.auth0.jwt.JWT;
-import com.auth0.jwt.JWTCreator.Builder;
-import com.auth0.jwt.JWTVerifier;
-import com.auth0.jwt.algorithms.Algorithm;
-import com.auth0.jwt.exceptions.JWTDecodeException;
-import com.auth0.jwt.interfaces.Claim;
-import com.auth0.jwt.interfaces.DecodedJWT;
-import org.apache.shiro.SecurityUtils;
-import org.apache.shiro.crypto.SecureRandomNumberGenerator;
-import org.apache.shiro.mgt.SecurityManager;
-import org.apache.shiro.util.ThreadContext;
-import org.dubhe.domain.dto.UserDTO;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.io.UnsupportedEncodingException;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @description JWT
- * @date 2020-03-14
- */
-@Component
-public class JwtUtils {
-
-
- /**
- * 请求头
- */
- public static final String AUTH_HEADER = "Authorization";
- /**
- * 过期时间20分钟
- */
- private static final long EXPIRE_TIME = 20 * 60 * 1000;
- private static final String FIELD_NAME = "USER_NAME";
- private static JwcConfig jwcConfig;
- private static RedisUtils redisUtils;
-
-
- @Autowired
- public void setJwcConfig(JwcConfig mtJwcConfig) {
- jwcConfig = mtJwcConfig;
- }
-
- @Autowired
- public void setRedisUtils(RedisUtils myredisUtils) {
- redisUtils = myredisUtils;
- }
-
- /**
- * 验证token是否正确
- */
- public static boolean verify(String token, String username) {
- try {
- Algorithm algorithm = null;
- algorithm = Algorithm.HMAC256(jwcConfig.secret);
- JWTVerifier verifier = JWT.require(algorithm).withClaim(FIELD_NAME, username).build();
- verifier.verify(token);
- return true;
- } catch (UnsupportedEncodingException exception) {
- return false;
- }
- }
-
- /**
- * 获得token中的自定义信息,无需secret解密也能获得
- */
- public static String getClaimFiled(String token, String filed) {
- try {
- DecodedJWT jwt = JWT.decode(token);
- return jwt.getClaim(filed).asString();
- } catch (JWTDecodeException e) {
- return null;
- }
- }
-
- /**
- * 生成签名
- */
- public static String sign(String userName) {
- try {
- Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
- Algorithm algorithm = Algorithm.HMAC256(jwcConfig.secret);
- // 附带username,
- String token = JWT.create().withClaim(FIELD_NAME, userName).withExpiresAt(date).sign(algorithm);
- saveToken(userName, token);
- return token;
- } catch (UnsupportedEncodingException e) {
- return null;
- }
- }
-
- /**
- * 获取用户名
- */
- public static String getUserName(String token) {
- return getClaimFiled(token, FIELD_NAME);
- }
-
- /**
- * 获取 token的签发时间
- */
- public static Date getIssuedAt(String token) {
- try {
- DecodedJWT jwt = JWT.decode(token);
- return jwt.getIssuedAt();
- } catch (JWTDecodeException e) {
- return null;
- }
- }
-
- /**
- * 验证 token是否过期
- */
- public static boolean isTokenExpired(String token) {
- Date now = Calendar.getInstance().getTime();
- DecodedJWT jwt = JWT.decode(token);
- return jwt.getExpiresAt() == null || jwt.getExpiresAt().before(now);
- }
-
- /**
- * 刷新 token的过期时间
- */
- public static String refreshTokenExpired(String token) {
- DecodedJWT jwt = JWT.decode(token);
- Map claims = jwt.getClaims();
- try {
- Date date = new Date(System.currentTimeMillis() + EXPIRE_TIME);
- Algorithm algorithm = Algorithm.HMAC256(jwcConfig.secret);
- Builder builer = JWT.create().withExpiresAt(date);
- for (Entry entry : claims.entrySet()) {
- builer.withClaim(entry.getKey(), entry.getValue().asString());
- }
- String newToken = builer.sign(algorithm);
- String userName = claims.get(FIELD_NAME).asString();
- String tokenKey = getUserTokenKey(userName);
- if (redisUtils.get(tokenKey) == null) {
- return null;
- }
- saveToken(userName, newToken);
- return newToken;
- } catch (UnsupportedEncodingException e) {
- return null;
- }
- }
-
- /**
- * 生成16位随机盐
- */
- public static String generateSalt() {
- SecureRandomNumberGenerator secureRandom = new SecureRandomNumberGenerator();
- String hex = secureRandom.nextBytes(16).toHex();
- return hex;
- }
-
- /**
- * 获取当前用户
- */
- public static UserDTO getCurrentUserDto() {
- Object principal = null;
- SecurityManager manager = ThreadContext.getSecurityManager();
- if (!Objects.isNull(manager)) {
- principal = SecurityUtils.getSubject().getPrincipal();
- }
- return Objects.isNull(principal) ? null : (UserDTO) principal;
- }
-
- /**
- * 获取用户token key
- */
- private static String getUserTokenKey(String userName) {
- return jwcConfig.onlineKey + userName;
- }
-
- private static void saveToken(String userName, String token) {
- String tokenKey = getUserTokenKey(userName);
- redisUtils.set(tokenKey, token, jwcConfig.jwtExpiration, TimeUnit.MINUTES);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/K8sCallBackTool.java b/dubhe-server/common/src/main/java/org/dubhe/utils/K8sCallBackTool.java
deleted file mode 100644
index 7dc31b9..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/K8sCallBackTool.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/**
- * 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.utils;
-
-import cn.hutool.core.date.DateField;
-import cn.hutool.core.date.DatePattern;
-import cn.hutool.core.date.DateUtil;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-/**
- * @description k8s命名相关工具类 token使用MD5加密,并设置超时时间
- * @date 2020-05-28
- */
-@Component
-public class K8sCallBackTool {
-
- /**
- * k8s 回调 token秘钥
- */
- @Value("${k8s.callback.token.secret-key}")
- private String secretKey;
- /**
- * k8s 回调token超时时间
- */
- @Value("${k8s.callback.token.expire-seconds}")
- private Integer expireSeconds;
- /**
- * k8s 回调域名或IP:Port
- */
- @Value("${k8s.callback.url}")
- private String url;
-
- /**
- * k8s 回调token key
- */
- public static final String K8S_CALLBACK_TOKEN = "k8sCallbackToken";
- /**
- * 失败重试次数
- */
- private static final int RETRY_COUNT = 3;
-
- /**
- * k8s 回调匹配地址
- */
- private static final List K8S_CALLBACK_PATH;
- /**
- * k8s 回调路径
- */
- private static final String K8S_CALLBACK_PATH_POD = "/api/k8s/callback/pod/";
- private static final String K8S_CALLBACK_PATH_DEPLOYMENT = "/api/k8s/callback/deployment/";
-
- static {
- K8S_CALLBACK_PATH = new ArrayList<>();
- // 添加需要token权限校验的地址(Shiro匿名访问的地址)
- K8S_CALLBACK_PATH.add(K8S_CALLBACK_PATH_POD + "**");
- K8S_CALLBACK_PATH.add(K8S_CALLBACK_PATH_DEPLOYMENT + "**");
- }
-
- /**
- * 获取 k8s 回调匹配地址
- *
- * @return List
- */
- public static List getK8sCallbackPaths() {
- return new ArrayList<>(K8S_CALLBACK_PATH);
- }
-
-
- /**
- * 生成k8s回调
- *
- * @return String
- */
- public String generateToken() {
- String expireTime = DateUtil.format(
- DateUtil.offset(new Date(), DateField.SECOND, expireSeconds),
- DatePattern.PURE_DATETIME_PATTERN
- );
- return AesUtil.encrypt(expireTime, secretKey);
- }
-
- /**
- * 验证token
- *
- * @param token
- * @return boolean
- */
- public boolean validateToken(String token) {
- String expireTime = AesUtil.decrypt(token, secretKey);
- String nowTime = DateUtil.format(
- new Date(),
- DatePattern.PURE_DATETIME_PATTERN
- );
- return expireTime.compareTo(nowTime) > 0;
- }
-
-
- /**
- * 判断当前是否可以再次重试
- *
- * @param retryTimes 第n次试图重试
- * @return boolean
- */
- public boolean continueRetry(int retryTimes) {
- return retryTimes <= RETRY_COUNT;
- }
-
- /**
- * 获取回调地址
- *
- * @param podLabel
- * @return String
- */
- public String getPodCallbackUrl(String podLabel) {
- return url + K8S_CALLBACK_PATH_POD + podLabel;
- }
-
- /**
- * 获取回调地址
- *
- * @param businessLabel
- * @return String
- */
- public String getDeploymentCallbackUrl(String businessLabel) {
- return url + K8S_CALLBACK_PATH_DEPLOYMENT + businessLabel;
- }
-
-
- /**
- * 获取超时时间秒
- *
- * @param timeoutSecond 超时秒数
- * @return Long
- */
- public static Long getTimeoutSecondLong(int timeoutSecond) {
- return Long.valueOf(
- DateUtil.format(
- DateUtil.offset(
- new Date(), DateField.SECOND, timeoutSecond
- ),
- DatePattern.PURE_DATETIME_PATTERN
- )
- );
- }
-
- /**
- * 获取当前秒数
- *
- * @return Long
- */
- public static Long getCurrentSecondLong() {
- return Long.valueOf(
- DateUtil.format(
- new Date(),
- DatePattern.PURE_DATETIME_PATTERN
- )
- );
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/K8sNameTool.java b/dubhe-server/common/src/main/java/org/dubhe/utils/K8sNameTool.java
deleted file mode 100644
index de3b916..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/K8sNameTool.java
+++ /dev/null
@@ -1,255 +0,0 @@
-/**
- * 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.utils;
-
-import cn.hutool.core.date.DatePattern;
-import cn.hutool.core.date.DateUtil;
-import cn.hutool.core.util.RandomUtil;
-import org.dubhe.config.K8sNameConfig;
-import org.dubhe.constant.SymbolConstant;
-import org.dubhe.enums.BizEnum;
-import org.dubhe.enums.BizNfsEnum;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.apache.commons.lang3.StringUtils;
-
-import java.util.Date;
-
-/**
- * @description k8s命名相关工具类
- * @date 2020-05-13
- */
-@Component
-public class K8sNameTool {
- @Autowired
- private K8sNameConfig k8sNameConfig;
- /**
- * 命名分隔符
- */
- private static final char SEPARATOR = '-';
- /**
- * 文件分隔符
- */
- private static final String K8S_FILE_SEPARATOR = "/";
- /**
- * 资源名称前缀
- */
- private static final String RESOURCE_NAME = "rn";
- /**
- * 随机长度值
- */
- private static final int RANDOM_LENGTH = 4;
-
- /**
- * 生成 ResourceName
- *
- * @param bizEnum 业务枚举
- * @param resourceInfo 资源备注信息(保证同业务下唯一并且命名规范)
- * @return String
- */
- public String generateResourceName(BizEnum bizEnum, String resourceInfo) {
- return bizEnum.getBizCode() + SEPARATOR + RESOURCE_NAME + SEPARATOR + resourceInfo;
- }
-
- /**
- * 生成 Notebook的Namespace
- *
- * @param userId
- * @return namespace
- */
- public String generateNamespace(long userId) {
- return this.k8sNameConfig.getNamespace() + SEPARATOR + userId;
- }
-
- /**
- * 从resourceName中获取资源信息
- *
- * @param bizEnum 业务枚举
- * @param resourceName
- * @return resourceInfo
- */
- public String getResourceInfoFromResourceName(BizEnum bizEnum, String resourceName) {
- if (StringUtils.isEmpty(resourceName) || !resourceName.contains(bizEnum.getBizCode() + SEPARATOR)) {
- return null;
- }
- return resourceName.replace(bizEnum.getBizCode() + SEPARATOR + RESOURCE_NAME + SEPARATOR, SymbolConstant.BLANK);
- }
-
- /**
- * 从namespace 获取使用者ID
- *
- * @param namespace
- * @return Long
- */
- public Long getUserIdFromNamespace(String namespace) {
- if (StringUtils.isEmpty(namespace) || !namespace.contains(this.k8sNameConfig.getNamespace() + SEPARATOR)) {
- return null;
- }
- return Long.valueOf(namespace.replace(this.k8sNameConfig.getNamespace() + SEPARATOR, ""));
- }
-
-
- /**
- * 生成业务模块相对路径
- *
- * @param bizNfsEnum 业务NFS路径枚举
- * @return String 例如: /{biz}/{userId}/{YYYYMMDDhhmmssSSS+四位随机数}/
- */
- public String getNfsPath(BizNfsEnum bizNfsEnum, long userId) {
- if (bizNfsEnum == null) {
- return null;
- }
- return optimizationPath(K8S_FILE_SEPARATOR
- + bizNfsEnum.getBizNfsPath()
- + K8S_FILE_SEPARATOR
- + userId
- + K8S_FILE_SEPARATOR
- + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_FORMAT) + RandomUtil.randomString(RANDOM_LENGTH)
- + K8S_FILE_SEPARATOR);
- }
-
- /**
- * 去除NFS根路径
- *
- * @param nfsPath
- * @return String
- */
- public String removeNfsRootPath(String nfsPath) {
- if (StringUtils.isBlank(nfsPath) || !nfsPath.startsWith(k8sNameConfig.getNfsRootPath())) {
- return nfsPath;
- }
- return optimizationPath(K8S_FILE_SEPARATOR + nfsPath.replace(k8sNameConfig.getNfsRootPath(), ""));
- }
-
- /**
- * 路径添加bucket
- *
- * @param nfsPath
- * @return String
- */
- public String appendBucket(String nfsPath) {
- return optimizationPath(K8S_FILE_SEPARATOR
- + k8sNameConfig.getFileBucket()
- + K8S_FILE_SEPARATOR
- + nfsPath);
- }
-
- /**
- * 路径添加时间戳随机数
- *
- * @param nfsPath
- * @return String
- */
- public String appendTimeStampAndRandomNum(String nfsPath) {
- return optimizationPath(nfsPath
- + DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_FORMAT) + RandomUtil.randomString(RANDOM_LENGTH)
- + K8S_FILE_SEPARATOR);
- }
-
- /**
- * nfs路径根据业务转换
- *
- * @param nfsPath
- * @param sourceBizNfsEnum 源业务 NFS Path
- * @param targetBizNfsEnum 目标业务 NFS Path
- * @return String
- */
- public String convertNfsPath(String nfsPath, BizNfsEnum sourceBizNfsEnum, BizNfsEnum targetBizNfsEnum) {
- if (!validateBizNfsPath(nfsPath, sourceBizNfsEnum) || targetBizNfsEnum == null) {
- return nfsPath;
- }
- return optimizationPath(nfsPath.replace(K8S_FILE_SEPARATOR + sourceBizNfsEnum.getBizNfsPath() + K8S_FILE_SEPARATOR
- , K8S_FILE_SEPARATOR + targetBizNfsEnum.getBizNfsPath() + K8S_FILE_SEPARATOR));
- }
-
- /**
- * 获取NFS绝对路径
- *
- * @param nfsPath
- * @return String
- */
- public String getAbsoluteNfsPath(String nfsPath) {
- if (StringUtils.isBlank(nfsPath)) {
- return nfsPath;
- }
- return optimizationPath(k8sNameConfig.getNfsRootPath()
- + K8S_FILE_SEPARATOR
- + k8sNameConfig.getFileBucket()
- + K8S_FILE_SEPARATOR
- + nfsPath);
- }
-
- /**
- * 验证 nfsPath 是否是所属业务路径
- *
- * @param nfsPath
- * @param bizNfsEnum
- * @return boolean
- */
- public boolean validateBizNfsPath(String nfsPath, BizNfsEnum bizNfsEnum) {
- return org.apache.commons.lang3.StringUtils.isNotBlank(nfsPath)
- && bizNfsEnum != null
- && nfsPath.contains(bizNfsEnum.getBizNfsPath())
- && !nfsPath.contains(K8S_FILE_SEPARATOR + k8sNameConfig.getFileBucket() + K8S_FILE_SEPARATOR)
- && !nfsPath.contains(K8S_FILE_SEPARATOR + k8sNameConfig.getNfsRootPath() + K8S_FILE_SEPARATOR);
- }
-
- /**
- * 路径优化
- *
- * @param path
- * @return String
- */
- private String optimizationPath(String path) {
- if (StringUtils.isBlank(path)) {
- return path;
- }
- return path.replaceAll("///*", K8S_FILE_SEPARATOR);
- }
-
- /**
- * 获取k8s pod标签
- *
- * @param bizEnum
- * @return String
- */
- public String getPodLabel(BizEnum bizEnum) {
- return bizEnum == null ? null : bizEnum.getBizCode();
- }
-
- /**
- * 获取数据集在镜像中路径
- *
- * @return String
- */
- public String getDatasetPath() {
- return k8sNameConfig.getDatasetPath();
- }
-
-
- /**
- * 自送生成K8S名称,供K8S使用
- *
- * @return String
- */
- public String getK8sName() {
- return DateUtil.format(new Date(), DatePattern.PURE_DATETIME_MS_FORMAT)
- + RandomUtil.randomString(RANDOM_LENGTH);
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/KeyUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/KeyUtil.java
deleted file mode 100644
index f3dcb62..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/KeyUtil.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.utils;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-
-/**
- * @description Key生成工具类
- * @date 2020-06-08
- */
-public class KeyUtil {
-
- /**
- * 生成训练任务的key,目前规则为:train-{user_id}-{time}
- * @param userId 用户id
- * @return 训练任务的key
- */
- public static String generateTrainKey(long userId) {
- Calendar calendar = Calendar.getInstance();
- SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
- return "train-" + userId + '-' + dateFormat.format(calendar.getTime());
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/LocalFileUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/LocalFileUtil.java
deleted file mode 100644
index 5e77bc5..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/LocalFileUtil.java
+++ /dev/null
@@ -1,402 +0,0 @@
-/**
- * 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.utils;
-
-import cn.hutool.core.util.StrUtil;
-import lombok.Getter;
-import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
-import org.apache.commons.compress.archivers.zip.ZipFile;
-import org.apache.commons.io.IOUtils;
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.config.NfsConfig;
-import org.dubhe.enums.LogEnum;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Component;
-import org.springframework.util.FileCopyUtils;
-
-import java.io.*;
-import java.util.Enumeration;
-import java.util.Objects;
-import java.util.zip.ZipEntry;
-
-/**
- * @description 本地文件操作工具类
- * @date 2020-08-19
- */
-@Component
-@Getter
-public class LocalFileUtil {
-
- @Autowired
- private NfsConfig nfsConfig;
-
- private static final String FILE_SEPARATOR = File.separator;
-
- private static final String ZIP = ".zip";
-
- private static final String CHARACTER_GBK = "GBK";
-
- private static final String OS_NAME = "os.name";
-
- private static final String WINDOWS = "Windows";
-
- /**
- * nfs服务暴露的IP地址
- */
- @Value("${k8s.nfs}")
- private String nfsIp;
-
- /**
- * 文件存储服务器用户名
- */
- @Value("${data.server.userName}")
- private String userName;
-
- /**
- * 拷贝文件命令
- */
- public static final String COPY_COMMAND = "ssh %s@%s \"mkdir -p %s && cp -r %s %s && echo success\"";
- /**
- * 拷贝文件夹下文件命令
- */
- public static final String COPY_DIR_COMMAND = "ssh %s@%s \"mkdir -p %s && cp -rf %s* %s && echo success\"";
-
- @Value("${k8s.nfs-root-path}")
- private String nfsRootPath;
-
- @Value("${k8s.nfs-root-windows-path}")
- private String nfsRootWindowsPath;
-
- /**
- * windows 与 linux 的路径兼容
- *
- * @param path linux下的路径
- * @return path 兼容windows后的路径
- */
- private String compatiblePath(String path) {
- if (path == null) {
- return null;
- }
- if (System.getProperties().getProperty(OS_NAME).contains(WINDOWS)) {
- path = path.replace(nfsRootPath, StrUtil.SLASH);
- path = path.replace(StrUtil.SLASH, FILE_SEPARATOR);
- path = nfsRootWindowsPath + path;
- }
- return path;
- }
-
-
- /**
- * 本地解压zip包并删除压缩文件
- *
- * @param sourcePath zip源文件 例如:/abc/z.zip
- * @param targetPath 解压后的目标文件夹 例如:/abc/
- * @return boolean
- */
- public boolean unzipLocalPath(String sourcePath, String targetPath) {
- if (StringUtils.isEmpty(sourcePath) || StringUtils.isEmpty(targetPath)) {
- return false;
- }
- if (!sourcePath.toLowerCase().endsWith(ZIP)) {
- return false;
- }
- //绝对路径
- String sourceAbsolutePath = nfsConfig.getRootDir() + sourcePath;
- String targetPathAbsolutePath = nfsConfig.getRootDir() + targetPath;
- ZipFile zipFile = null;
- InputStream in = null;
- OutputStream out = null;
- File sourceFile = new File(compatiblePath(sourceAbsolutePath));
- File targetFileDir = new File(compatiblePath(targetPathAbsolutePath));
- if (!targetFileDir.exists()) {
- boolean targetMkdir = targetFileDir.mkdirs();
- if (!targetMkdir) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "{}failed to create target folder before decompression", sourceAbsolutePath);
- }
- }
- try {
- zipFile = new ZipFile(sourceFile);
- //判断压缩文件编码方式,并重新获取文件对象
- try {
- zipFile.close();
- zipFile = new ZipFile(sourceFile, CHARACTER_GBK);
- } catch (Exception e) {
- zipFile.close();
- zipFile = new ZipFile(sourceFile);
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "{}the encoding mode of decompressed compressed file is changed to UTF-8:{}", sourceAbsolutePath, e);
- }
- ZipEntry entry;
- Enumeration enumeration = zipFile.getEntries();
- while (enumeration.hasMoreElements()) {
- entry = (ZipEntry) enumeration.nextElement();
- String entryName = entry.getName();
- File fileDir;
- if (entry.isDirectory()) {
- fileDir = new File(targetPathAbsolutePath + entry.getName());
- if (!fileDir.exists()) {
- boolean fileMkdir = fileDir.mkdirs();
- if (!fileMkdir) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "failed to create folder {} while decompressing {}", fileDir, sourceAbsolutePath);
- }
- }
- } else {
- //若文件夹未创建则创建文件夹
- if (entryName.contains(FILE_SEPARATOR)) {
- String zipDirName = entryName.substring(MagicNumConstant.ZERO, entryName.lastIndexOf(FILE_SEPARATOR));
- fileDir = new File(targetPathAbsolutePath + zipDirName);
- if (!fileDir.exists()) {
- boolean fileMkdir = fileDir.mkdirs();
- if (!fileMkdir) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "failed to create folder {} while decompressing {}", fileDir, sourceAbsolutePath);
- }
- }
- }
- in = zipFile.getInputStream((ZipArchiveEntry) entry);
- out = new FileOutputStream(new File(targetPathAbsolutePath, entryName));
- IOUtils.copyLarge(in, out);
- in.close();
- out.close();
- }
- }
- boolean deleteZipFile = sourceFile.delete();
- if (!deleteZipFile) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "{}compressed file deletion failed after decompression", sourceAbsolutePath);
- }
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "{}decompression failed: {}", sourceAbsolutePath, e);
- return false;
- } finally {
- //关闭未关闭的io流
- closeIoFlow(sourceAbsolutePath, zipFile, in, out);
- }
-
- }
-
- /**
- * 关闭未关闭的io流
- *
- * @param sourceAbsolutePath 源路径
- * @param zipFile 压缩文件对象
- * @param in 输入流
- * @param out 输出流
- */
- private void closeIoFlow(String sourceAbsolutePath, ZipFile zipFile, InputStream in, OutputStream out) {
- if (in != null) {
- try {
- in.close();
- } catch (IOException e) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "{}input stream shutdown failed: {}", sourceAbsolutePath, e);
- }
- }
- if (out != null) {
- try {
- out.close();
- } catch (IOException e) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "{}output stream shutdown failed: {}", sourceAbsolutePath, e);
- }
- }
- if (zipFile != null) {
- try {
- zipFile.close();
- } catch (IOException e) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "{}input stream shutdown failed: {}", sourceAbsolutePath, e);
- }
- }
- }
-
-
- /**
- * 复制单个文件到指定目录下 单个文件
- *
- * @param sourcePath 需要复制的文件 例如:/abc/def/cc.txt
- * @param targetPath 需要放置的目标目录 例如:/abc/dd
- * @return boolean
- */
- private boolean copyLocalFile(String sourcePath, String targetPath) {
- if (StringUtils.isEmpty(sourcePath) || StringUtils.isEmpty(targetPath)) {
- return false;
- }
- sourcePath = formatPath(sourcePath);
- targetPath = formatPath(targetPath);
- try (InputStream input = new FileInputStream(sourcePath);
- FileOutputStream output = new FileOutputStream(targetPath)) {
- FileCopyUtils.copy(input, output);
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, " failed to copy file original path: {} ,target path: {} ,copyLocalFile:{} ", sourcePath, targetPath, e);
- return false;
- }
- }
-
- /**
- * NFS 复制目录到指定目录下 多个文件 包含目录与文件并存情况
- *
- * 通过本地文件复制方式
- *
- * @param sourcePath 需要复制的文件目录 例如:/abc/def
- * @param targetPath 需要放置的目标目录 例如:/abc/dd
- * @return boolean
- */
- public boolean copyPath(String sourcePath, String targetPath) {
- if (StringUtils.isEmpty(sourcePath) || StringUtils.isEmpty(targetPath)) {
- return false;
- }
- sourcePath = formatPath(sourcePath);
- targetPath = formatPath(targetPath);
- try {
- return copyLocalPath(nfsConfig.getRootDir() + sourcePath, nfsConfig.getRootDir() + targetPath);
- } catch (Exception e) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, " failed to Copy file original path: {} ,target path: {} ,copyPath: {}", sourcePath, targetPath, e);
- return false;
- }
- }
-
- /**
- * 复制文件 到指定目录下 多个文件 包含目录与文件并存情况
- *
- * @param sourcePath 需要复制的文件目录 例如:/abc/def
- * @param targetPath 需要放置的目标目录 例如:/abc/dd
- * @return boolean
- */
- private boolean copyLocalPath(String sourcePath, String targetPath) {
- if (!StringUtils.isEmpty(sourcePath) && !StringUtils.isEmpty(targetPath)) {
- sourcePath = formatPath(sourcePath);
- if (sourcePath.endsWith(FILE_SEPARATOR)) {
- sourcePath = sourcePath.substring(MagicNumConstant.ZERO, sourcePath.lastIndexOf(FILE_SEPARATOR));
- }
- targetPath = formatPath(targetPath);
- File sourceFile = new File(sourcePath);
- if (sourceFile.exists()) {
- File[] files = sourceFile.listFiles();
- if (files != null && files.length != 0) {
- for (File file : files) {
- try {
- if (file.isDirectory()) {
- File fileDir = new File(targetPath + FILE_SEPARATOR + file.getName());
- if (!fileDir.exists()) {
- fileDir.mkdirs();
- }
- copyLocalPath(sourcePath + FILE_SEPARATOR + file.getName(), targetPath + FILE_SEPARATOR + file.getName());
- }
- if (file.isFile()) {
- File fileTargetPath = new File(targetPath);
- if (!fileTargetPath.exists()) {
- fileTargetPath.mkdirs();
- }
- copyLocalFile(file.getAbsolutePath(), targetPath + FILE_SEPARATOR + file.getName());
- }
- } catch (Exception e) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "failed to copy folder original path: {} , target path : {} ,copyLocalPath: {}", sourcePath, targetPath, e);
- return false;
- }
- }
- }
- return true;
- }
- }
- return false;
- }
-
- /**
- * 替换路径中多余的 "/"
- *
- * @param path
- * @return String
- */
- public String formatPath(String path) {
- if (!StringUtils.isEmpty(path)) {
- return path.replaceAll("///*", FILE_SEPARATOR);
- }
- return path;
- }
-
- /**
- * 拷贝文件
- *
- * @param sourcePath 需要复制的文件 例如:/abc/def/cc.txt
- * @param targetPath 需要放置的目标目录 例如:/abc/dd
- * @return
- */
- public boolean copyFile(String sourcePath, String targetPath) {
- //绝对路径
- String sourceAbsolutePath = formatPath(nfsConfig.getRootDir() + sourcePath);
- String targetPathAbsolutePath = formatPath(nfsConfig.getRootDir() + targetPath);
- String[] command = new String[]{"/bin/sh", "-c", String.format(COPY_COMMAND, userName, nfsIp, targetPathAbsolutePath, sourceAbsolutePath, targetPathAbsolutePath)};
- boolean flag = false;
- Process process;
- try {
- process = Runtime.getRuntime().exec(command);
- if (isCopySuccess(process)) {
- flag = true;
- }
- } catch (IOException e) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "copy file failed, filePath:{}, targetPath:{}", sourcePath, targetPath, e);
- }
- return flag;
- }
-
- /**
- * 拷贝文件夹下内容
- * @param sourcePath 需要复制的文件目录 例如:/abc/dd
- * @param targetPath 需要放置的目标目录 例如:/abc/dd
- * @return
- */
- public boolean copyDir(String sourcePath, String targetPath) {
- //绝对路径
- String sourceAbsolutePath = formatPath(nfsConfig.getRootDir() + sourcePath);
- String targetPathAbsolutePath = formatPath(nfsConfig.getRootDir() + targetPath);
- String[] command = new String[]{"/bin/sh", "-c", String.format(COPY_DIR_COMMAND, userName, nfsIp, targetPathAbsolutePath, sourceAbsolutePath, targetPathAbsolutePath)};
- boolean flag = false;
- Process process;
- try {
- process = Runtime.getRuntime().exec(command);
- if (isCopySuccess(process)) {
- flag = true;
- }
- } catch (IOException e) {
- LogUtil.error(LogEnum.LOCAL_FILE_UTIL, "copy file failed, filePath:{}, targetPath:{}", sourcePath, targetPath, e);
- }
- return flag;
- }
-
- /**
- * 判断拷贝结果
- *
- * @param process
- * @return
- */
- public boolean isCopySuccess(Process process) {
- boolean flag = false;
- try (InputStream stream = process.getInputStream();
- InputStreamReader iReader = new InputStreamReader(stream);
- BufferedReader bReader = new BufferedReader(iReader)) {
- String line;
- while (Objects.nonNull(line = bReader.readLine())) {
- boolean temp = line.contains("success");
- if (temp) {
- flag = true;
- }
- }
- } catch (Exception e) {
- LogUtil.error(LogEnum.SERVING, "Read stream failed : {}", e);
- }
- return flag;
- }
-
-}
\ No newline at end of file
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/LogUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/LogUtil.java
deleted file mode 100644
index cc336cc..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/LogUtil.java
+++ /dev/null
@@ -1,320 +0,0 @@
-/**
- * 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.utils;
-
-import ch.qos.logback.classic.Level;
-import com.alibaba.fastjson.JSON;
-import lombok.extern.slf4j.Slf4j;
-import org.apache.commons.lang3.exception.ExceptionUtils;
-import org.dubhe.aspect.LogAspect;
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.domain.entity.LogInfo;
-import org.dubhe.enums.LogEnum;
-import org.slf4j.MDC;
-import org.slf4j.MarkerFactory;
-import org.slf4j.helpers.MessageFormatter;
-
-import java.util.Arrays;
-import java.util.UUID;
-
-/**
- * @description 日志工具类
- * @date 2020-06-29
- */
-@Slf4j
-public class LogUtil {
-
- private static final String TRACE_TYPE = "TRACE_TYPE";
-
- public static final String SCHEDULE_LEVEL = "SCHEDULE";
-
- public static final String K8S_CALLBACK_LEVEL = "K8S_CALLBACK";
-
- private static final String GLOBAL_REQUEST_LEVEL = "GLOBAL_REQUEST";
-
- private static final String TRACE_LEVEL = "TRACE";
-
- private static final String DEBUG_LEVEL = "DEBUG";
-
- private static final String INFO_LEVEL = "INFO";
-
- private static final String WARN_LEVEL = "WARN";
-
- private static final String ERROR_LEVEL = "ERROR";
-
-
- public static void startScheduleTrace() {
- MDC.put(TRACE_TYPE, SCHEDULE_LEVEL);
- }
-
- public static void startK8sCallbackTrace() {
- MDC.put(TRACE_TYPE, K8S_CALLBACK_LEVEL);
- }
-
- public static void cleanTrace() {
- MDC.clear();
- }
-
- /**
- * info级别的日志
- *
- * @param logType 日志类型
- * @param object 打印的日志参数
- * @return void
- */
-
- public static void info(LogEnum logType, Object... object) {
-
- logHandle(logType, Level.INFO, object);
- }
-
- /**
- * debug级别的日志
- *
- * @param logType 日志类型
- * @param object 打印的日志参数
- * @return void
- */
- public static void debug(LogEnum logType, Object... object) {
- logHandle(logType, Level.DEBUG, object);
- }
-
- /**
- * error级别的日志
- *
- * @param logType 日志类型
- * @param object 打印的日志参数
- * @return void
- */
- public static void error(LogEnum logType, Object... object) {
- errorObjectHandle(object);
- logHandle(logType, Level.ERROR, object);
- }
-
- /**
- * warn级别的日志
- *
- * @param logType 日志类型
- * @param object 打印的日志参数
- * @return void
- */
- public static void warn(LogEnum logType, Object... object) {
- logHandle(logType, Level.WARN, object);
- }
-
- /**
- * trace级别的日志
- *
- * @param logType 日志类型
- * @param object 打印的日志参数
- * @return void
- */
- public static void trace(LogEnum logType, Object... object) {
- logHandle(logType, Level.TRACE, object);
- }
-
- /**
- * 日志处理
- *
- * @param logType 日志类型
- * @param level 日志级别
- * @param object 打印的日志参数
- * @return void
- */
- private static void logHandle(LogEnum logType, Level level, Object[] object) {
-
- LogInfo logInfo = generateLogInfo(logType, level, object);
-
- switch (logInfo.getLevel()) {
- case TRACE_LEVEL:
- log.trace(MarkerFactory.getMarker(TRACE_LEVEL), logJsonStringLengthLimit(logInfo));
- break;
- case DEBUG_LEVEL:
- log.debug(MarkerFactory.getMarker(DEBUG_LEVEL), logJsonStringLengthLimit(logInfo));
- break;
- case GLOBAL_REQUEST_LEVEL:
- logInfo.setLevel(null);
- logInfo.setType(null);
- logInfo.setLocation(null);
- log.info(MarkerFactory.getMarker(GLOBAL_REQUEST_LEVEL), logJsonStringLengthLimit(logInfo));
- break;
- case SCHEDULE_LEVEL:
- log.info(MarkerFactory.getMarker(SCHEDULE_LEVEL), logJsonStringLengthLimit(logInfo));
- break;
- case K8S_CALLBACK_LEVEL:
- log.info(MarkerFactory.getMarker(K8S_CALLBACK_LEVEL), logJsonStringLengthLimit(logInfo));
- break;
- case INFO_LEVEL:
- log.info(MarkerFactory.getMarker(INFO_LEVEL), logJsonStringLengthLimit(logInfo));
- break;
- case WARN_LEVEL:
- log.warn(MarkerFactory.getMarker(WARN_LEVEL), logJsonStringLengthLimit(logInfo));
- break;
- case ERROR_LEVEL:
- log.error(MarkerFactory.getMarker(ERROR_LEVEL), logJsonStringLengthLimit(logInfo));
- break;
- default:
- }
-
- }
-
-
- /**
- * 日志信息组装的内部方法
- *
- * @param logType 日志类型
- * @param level 日志级别
- * @param object 打印的日志参数
- * @return LogInfo
- */
- private static LogInfo generateLogInfo(LogEnum logType, Level level, Object[] object) {
-
-
- LogInfo logInfo = new LogInfo();
- // 日志类型检测
- if (!LogEnum.isLogType(logType)) {
- level = Level.ERROR;
- object = new Object[MagicNumConstant.ONE];
- object[MagicNumConstant.ZERO] = "日志类型【".concat(String.valueOf(logType)).concat("】不正确!");
- logType = LogEnum.SYS_ERR;
- }
-
- // 获取trace_id
- if (StringUtils.isEmpty(MDC.get(LogAspect.TRACE_ID))) {
- MDC.put(LogAspect.TRACE_ID, UUID.randomUUID().toString());
- }
- // 设置logInfo的level,type,traceId属性
- logInfo.setLevel(level.levelStr)
- .setType(logType.toString())
- .setTraceId(MDC.get(LogAspect.TRACE_ID));
-
-
- //自定义日志级别
- //LogEnum、 MDC中的 TRACE_TYPE 做日志分流标识
- if (Level.INFO.toInt() == level.toInt()) {
- if (LogEnum.GLOBAL_REQ.equals(logType)) {
- //info全局请求
- logInfo.setLevel(GLOBAL_REQUEST_LEVEL);
- } else if (LogEnum.BIZ_K8S.equals(logType)) {
- logInfo.setLevel(K8S_CALLBACK_LEVEL);
- } else {
- //schedule定时等 链路记录
- String traceType = MDC.get(TRACE_TYPE);
- if (StringUtils.isNotBlank(traceType)) {
- logInfo.setLevel(traceType);
- }
- }
- }
-
- // 设置logInfo的堆栈信息
- setLogStackInfo(logInfo);
- // 设置logInfo的info信息
- setLogInfo(logInfo, object);
- // 截取logInfo的长度并转换成json字符串
- return logInfo;
- }
-
- /**
- * 设置loginfo的堆栈信息
- *
- * @param logInfo 日志对象
- * @return void
- */
- private static void setLogStackInfo(LogInfo logInfo) {
- StackTraceElement[] elements = Thread.currentThread().getStackTrace();
- if (elements.length >= MagicNumConstant.SIX) {
- StackTraceElement element = elements[MagicNumConstant.FIVE];
- logInfo.setLocation(String.format("%s#%s:%s", element.getClassName(), element.getMethodName(), element.getLineNumber()));
- }
- }
-
- /**
- * 限制log日志的长度并转换成json
- *
- * @param logInfo 日志对象
- * @return String
- */
- private static String logJsonStringLengthLimit(LogInfo logInfo) {
- try {
-
- String jsonString = JSON.toJSONString(logInfo);
- if (StringUtils.isBlank(jsonString)) {
- return "";
- }
- if (jsonString.length() > MagicNumConstant.TEN_THOUSAND) {
- String trunk = logInfo.getInfo().toString().substring(MagicNumConstant.ZERO, MagicNumConstant.NINE_THOUSAND);
- logInfo.setInfo(trunk);
- jsonString = JSON.toJSONString(logInfo);
- }
- return jsonString;
-
- } catch (Exception e) {
- logInfo.setLevel(Level.ERROR.levelStr).setType(LogEnum.SYS_ERR.toString())
- .setInfo("cannot serialize exception: " + ExceptionUtils.getStackTrace(e));
- return JSON.toJSONString(logInfo);
- }
- }
-
- /**
- * 设置日志对象的info信息
- *
- * @param logInfo 日志对象
- * @param object 打印的日志参数
- * @return void
- */
- private static void setLogInfo(LogInfo logInfo, Object[] object) {
-
- if (object.length > MagicNumConstant.ONE) {
- logInfo.setInfo(MessageFormatter.arrayFormat(object[MagicNumConstant.ZERO].toString(),
- Arrays.copyOfRange(object, MagicNumConstant.ONE, object.length)).getMessage());
-
- } else if (object.length == MagicNumConstant.ONE && object[MagicNumConstant.ZERO] instanceof Exception) {
- logInfo.setInfo((ExceptionUtils.getStackTrace((Exception) object[MagicNumConstant.ZERO])));
- log.error((ExceptionUtils.getStackTrace((Exception) object[MagicNumConstant.ZERO])));
- } else if (object.length == MagicNumConstant.ONE) {
- logInfo.setInfo(object[MagicNumConstant.ZERO] == null ? "" : object[MagicNumConstant.ZERO]);
- } else {
- logInfo.setInfo("");
- }
-
- }
-
- /**
- * 处理Exception的情况
- *
- * @param object 打印的日志参数
- * @return void
- */
- private static void errorObjectHandle(Object[] object) {
-
- if (object.length == MagicNumConstant.TWO && object[MagicNumConstant.ONE] instanceof Exception) {
- log.error(String.valueOf(object[MagicNumConstant.ZERO]), (Exception) object[MagicNumConstant.ONE]);
- object[MagicNumConstant.ONE] = ExceptionUtils.getStackTrace((Exception) object[MagicNumConstant.ONE]);
-
- } else if (object.length >= MagicNumConstant.THREE) {
- log.error(String.valueOf(object[MagicNumConstant.ZERO]),
- Arrays.copyOfRange(object, MagicNumConstant.ONE, object.length));
- for (int i = 0; i < object.length; i++) {
- if (object[i] instanceof Exception) {
- object[i] = ExceptionUtils.getStackTrace((Exception) object[i]);
- }
-
- }
- }
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/MathUtils.java b/dubhe-server/common/src/main/java/org/dubhe/utils/MathUtils.java
deleted file mode 100644
index cf97b0f..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/MathUtils.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.utils;
-
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.constant.NumberConstant;
-
-/**
- * @description 计算工具类
- * @date 2020-06-04
- */
-public class MathUtils {
-
- private static String FLOAT_DIVISION_FORMATE = "%1$0";
-
- /**
- * 字符串整数加法
- * num1+num2
- * @param num1
- * @param num2
- * @return
- */
- public static String add(String num1, String num2) {
- return String.valueOf((!RegexUtil.isDigits(num1) ? MagicNumConstant.ZERO : Integer.valueOf(num1)) + (!RegexUtil.isDigits(num2) ? MagicNumConstant.ZERO : Integer.valueOf(num2)));
- }
-
- /**
- * 字符串整数减法
- * num1 - num2
- * @param num1
- * @param num2
- * @return
- */
- public static String reduce(String num1, String num2) {
- return String.valueOf((!RegexUtil.isDigits(num1) ? MagicNumConstant.ZERO : Integer.valueOf(num1)) - (!RegexUtil.isDigits(num2) ? MagicNumConstant.ZERO : Integer.valueOf(num2)));
- }
-
- /**
- *
- * 浮点数除法 num1/num2
- * @param num1
- * @param num2
- * @param decimal 结果小数位数
- * @return
- */
- public static Float floatDivision(String num1, String num2, Integer decimal) {
- if (!RegexUtil.isFloat(num1) || !RegexUtil.isFloat(num2)) {
- return null;
- }
- if (Float.valueOf(num2).equals(0f)) {
- return null;
- }
- if (decimal != null && decimal > NumberConstant.NUMBER_0) {
- Integer d = Integer.valueOf(MagicNumConstant.ONE + String.format(FLOAT_DIVISION_FORMATE + decimal + "d", NumberConstant.NUMBER_0));
- return (float) (Math.round((Float.valueOf(num1) / Float.valueOf(num2)) * d)) / d;
- } else {
- return Float.valueOf(num1) / Float.valueOf(num2);
- }
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/MinioUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/MinioUtil.java
deleted file mode 100644
index 4461288..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/MinioUtil.java
+++ /dev/null
@@ -1,343 +0,0 @@
-/**
- * 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.utils;
-
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.http.HttpRequest;
-import com.alibaba.fastjson.JSONObject;
-import io.minio.CopyConditions;
-import io.minio.MinioClient;
-import io.minio.PutObjectOptions;
-import io.minio.Result;
-import io.minio.errors.*;
-import io.minio.messages.DeleteError;
-import io.minio.messages.Item;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.apache.commons.lang.StringUtils;
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.constant.NumberConstant;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.exception.BusinessException;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.stereotype.Service;
-
-import javax.annotation.PostConstruct;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.charset.Charset;
-import java.util.*;
-
-/**
- * @description Minio工具类
- * @date 2020-05-09
- */
-@Service
-public class MinioUtil {
-
- @Value("${minio.url}")
- private String url;
- @Value("${minio.accessKey}")
- private String accessKey;
- @Value("${minio.secretKey}")
- private String secretKey;
-
- private MinioClient client;
-
- @PostConstruct
- public void init() {
- try {
- client = new MinioClient(url, accessKey, secretKey);
- } catch (InvalidEndpointException e) {
- LogUtil.warn(LogEnum.BIZ_DATASET, "MinIO endpoint invalid. e, {}", e);
- } catch (InvalidPortException e) {
- LogUtil.warn(LogEnum.BIZ_DATASET, "MinIO endpoint port invalid. e, {}", e);
- }
- }
-
- /**
- * 写文件
- *
- * @param bucket 桶名称
- * @param fullFilePath 文件存储的全路径,包括文件名,非'/'开头. e.g. dataset/12/annotation/test.txt
- * @param content file content. can not be null
- */
- public void writeString(String bucket, String fullFilePath, String content) throws Exception {
- boolean isExist = client.bucketExists(bucket);
- if (!isExist) {
- client.makeBucket(bucket);
- }
- InputStream inputStream = IoUtil.toUtf8Stream(content);
- PutObjectOptions options = new PutObjectOptions(inputStream.available(), MagicNumConstant.NEGATIVE_ONE);
- client.putObject(bucket, fullFilePath, inputStream, options);
- }
-
- /**
- * 写文件
- *
- * @param bucket 桶名称
- * @param fullFilePath 文件存储的全路径,包括文件名,非'/'开头. e.g. dataset/12/annotation/test.txt
- * @param inputStream file inputStream. can not be null
- */
- public void writeInputStream(String bucket, String fullFilePath, InputStream inputStream) throws Exception {
- boolean isExist = client.bucketExists(bucket);
- if (!isExist) {
- client.makeBucket(bucket);
- }
- PutObjectOptions options = new PutObjectOptions(inputStream.available(), MagicNumConstant.NEGATIVE_ONE);
- client.putObject(bucket, fullFilePath, inputStream, options);
- }
-
- /**
- * 读取文件
- *
- * @param bucket 桶
- * @param fullFilePath 文件存储的全路径,包括文件名,非'/'开头. e.g. dataset/12/annotation/test.txt
- * @return String
- */
- public String readString(String bucket, String fullFilePath) throws Exception {
- try (InputStream is = client.getObject(bucket, fullFilePath)) {
- return IoUtil.read(is, Charset.defaultCharset());
- }
- }
-
- /**
- * 文件删除
- *
- * @param bucket 桶
- * @param fullFilePath 文件存储的全路径,包括文件名,非'/'开头. e.g. dataset/12/annotation/test.txt
- */
- public void del(String bucket, String fullFilePath) throws Exception {
- Iterable> items = client.listObjects(bucket, fullFilePath);
- Set files = new HashSet<>();
- for (Result- item : items) {
- files.add(item.get().objectName());
- }
- Iterable
> results = client.removeObjects(bucket, files);
- for (Result result : results) {
- result.get();
- }
- }
-
- /**
- * 批量删除文件
- *
- * @param bucket 桶
- * @param objectNames 对象名称
- */
- public void delFiles(String bucket, List objectNames) throws Exception {
- Iterable> results = client.removeObjects(bucket, objectNames);
- for (Result result : results) {
- result.get();
- }
- }
-
- /**
- * 获取对象名称
- *
- * @param bucketName 桶名称
- * @param prefix 前缀
- * @return List 对象名称列表
- * @throws Exception
- */
- public List getObjects(String bucketName, String prefix) throws Exception {
- List fileNames = new ArrayList<>();
- Iterable> results = client.listObjects(bucketName, prefix);
- for (Result- result : results) {
- Item item = result.get();
- fileNames.add(item.objectName());
- }
- return fileNames;
- }
-
- /**
- * 获取路径下文件数量
- *
- * @param bucketName 桶名称
- * @param prefix 前缀
- * @return InputStream 文件流
- * @throws Exception
- */
- public int getCount(String bucketName, String prefix) throws Exception {
- int count = NumberConstant.NUMBER_0;
- Iterable
> results = client.listObjects(bucketName, prefix);
- for (Result- result : results) {
- count++;
- }
- return count;
- }
-
- /**
- * 获取文件流
- *
- * @param bucket 桶
- * @param objectName 对象名称
- * @return InputStream 文件流
- * @throws Exception
- */
- public InputStream getObjectInputStream(String bucket, String objectName) throws Exception {
- return client.getObject(bucket, objectName);
- }
-
- /**
- * 文件夹复制
- *
- * @param bucket 桶
- * @param sourceFiles 源文件
- * @param targetDir 目标文件夹
- */
- public void copyDir(String bucket, List
sourceFiles, String targetDir) {
- sourceFiles.forEach(sourceFile -> {
- InputStream inputStream = null;
- try {
- String sourceObjectName = sourceFile;
- String targetObjectName = targetDir + "/" + StringUtils.substringAfterLast(sourceObjectName, "/");
- inputStream = client.getObject(bucket, sourceObjectName);
- byte[] buf = new byte[512];
- int bytesRead;
- int count = MagicNumConstant.ZERO;
- while ((bytesRead = inputStream.read(buf, MagicNumConstant.ZERO, buf.length)) >= MagicNumConstant.ZERO) {
- count += bytesRead;
- }
- PutObjectOptions options = new PutObjectOptions(count, MagicNumConstant.ZERO);
- client.putObject(bucket, targetObjectName, client.getObject(bucket, sourceObjectName), options);
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_DATASET, "MinIO file copy exception, {}", e);
- } finally {
- try {
- if (inputStream != null) {
- inputStream.close();
- }
- } catch (IOException e) {
- LogUtil.error(LogEnum.BIZ_DATASET, "MinIO file read stream closed failed, {}", e);
- }
- }
- });
- }
-
- /**
- * minio拷贝操作
- *
- * @Param bucket 桶名
- * @Param sourceFiles 需要复制的标注文件名
- * @Param targetDir 目标文件夹路径
- */
- public void copyObject(String bucket, List sourceFiles, String targetDir) {
- CopyConditions copyConditions = new CopyConditions();
- sourceFiles.forEach(sourceFile -> {
- try {
- String targetName = targetDir + "/" + org.dubhe.utils.StringUtils.substringAfterLast(sourceFile, "/");
- client.copyObject(bucket, targetName, null, null, bucket, sourceFile, null, copyConditions);
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_DATASET, "MinIO file copy failed, {}", e);
- }
- });
- }
-
- @Data
- @Service
- public class MinioWebTokenBody {
-
- @Value("${minioweb.GetToken.url}")
- private String tokenUrl;
- @Value("${minioweb.GetToken.param.id}")
- private int id;
- @Value("${minioweb.GetToken.param.jsonrpc}")
- private String jsonrpc;
- @Value("${minioweb.GetToken.param.method}")
- private String method;
- @Value("${minioweb.zip.url}")
- private String zipUrl;
-
- /**
- * 生成文件下载请求参数方法
- *
- * @param bucketName 桶名称
- * @param prefix 前缀
- * @param objects 对象名称
- * @return MinioDownloadDto 下载请求参数
- */
- public MinioDownloadDto getDownloadParam(String bucketName, String prefix, List objects, String zipName) {
- String paramTemplate = "{\"id\":%d,\"jsonrpc\":\"%s\",\"params\":{\"username\":\"%s\",\"password\":\"%s\"},\"method\":\"%s\"}";
- String downloadBodyTemplate = "{\"bucketName\":\"%s\",\"prefix\":\"%s\",\"objects\":[%s]}";
- String param = String.format(paramTemplate, id, jsonrpc, accessKey, secretKey, method);
- String result = HttpRequest.post(url + tokenUrl).contentType("application/json").body(param).execute().body();
- String token = JSONObject.parseObject(result).getJSONObject("result").getString("token");
- return new MinioDownloadDto(token, String.format(downloadBodyTemplate, bucketName, prefix, getStrFromList(objects)), zipName);
- }
-
- public String getStrFromList(List objects) {
- List result = new ArrayList<>();
- objects.stream().forEach(s -> {
- result.add("\"" + s + "\"");
- });
- return StringUtils.join(result, ",");
- }
-
- }
-
- @ApiModel
- @Data
- public class MinioDownloadDto {
- @ApiModelProperty("下载压缩包请求token")
- private String token;
- @ApiModelProperty("下载压缩包请求参数")
- private String body;
- @ApiModelProperty("下载压缩包请求需要的header")
- private Map headers;
- @ApiModelProperty("下载压缩包文件名称")
- private String zipName;
-
- public MinioDownloadDto() {
- }
-
- public MinioDownloadDto(String token, String body, String zipName) {
- this.token = token;
- this.body = body;
- this.zipName = zipName;
- Map headers = new HashMap<>();
- headers.put("Content-Type", "text/plain;charset=UTF-8");
- this.headers = headers;
- }
-
- }
-
-
- /**
- * 生成一个给HTTP PUT请求用的presigned URL。浏览器/移动端的客户端可以用这个URL进行上传,
- * 即使其所在的存储桶是私有的。这个presigned URL可以设置一个失效时间,默认值是7天
- *
- * @param bucketName 存储桶名称
- * @param objectName 存储桶里的对象名称
- * @param expires 失效时间(以秒为单位),默认是7天,不得大于七天
- * @return String
- */
- public String getEncryptedPutUrl(String bucketName, String objectName, Integer expires) {
- if (StringUtils.isEmpty(objectName)) {
- throw new BusinessException("object name cannot be empty");
- }
- try {
- return client.presignedPutObject(bucketName, objectName, expires);
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_DATASET, e.getMessage());
- throw new BusinessException("MinIO an error occurred, please contact the administrator");
- }
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/NfsFactory.java b/dubhe-server/common/src/main/java/org/dubhe/utils/NfsFactory.java
deleted file mode 100644
index f47f304..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/NfsFactory.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * 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.utils;
-
-import com.emc.ecs.nfsclient.nfs.nfs3.Nfs3;
-import com.emc.ecs.nfsclient.rpc.CredentialUnix;
-import org.apache.commons.pool2.PooledObject;
-import org.apache.commons.pool2.PooledObjectFactory;
-import org.apache.commons.pool2.impl.DefaultPooledObject;
-import org.dubhe.config.NfsConfig;
-import org.dubhe.enums.LogEnum;
-import org.springframework.stereotype.Component;
-
-import java.io.IOException;
-
-/**
- * @description NFS工厂类
- * @date 2020-05-13
- */
-@Component
-public class NfsFactory implements PooledObjectFactory {
-
- private final NfsConfig nfsConfig;
-
- public NfsFactory(NfsConfig nfsConfig) {
- this.nfsConfig = nfsConfig;
- }
-
- @Override
- public PooledObject makeObject() {
- Nfs3 nfs3 = null;
- try {
- nfs3 = new Nfs3(nfsConfig.getNfsIp(), nfsConfig.getRootDir(), new CredentialUnix(0, 0, null), 3);
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "创建NFS对象失败: ", e);
- }
- return new DefaultPooledObject<>(nfs3);
- }
-
- @Override
- public void destroyObject(PooledObject pooledObject) {
- LogUtil.info(LogEnum.NFS_UTIL, "销毁NFS对象: ", pooledObject.getObject());
- }
-
- @Override
- public boolean validateObject(PooledObject pooledObject) {
- LogUtil.info(LogEnum.NFS_UTIL, "验证NFS对象: ", pooledObject.getObject());
- return true;
- }
-
- @Override
- public void activateObject(PooledObject pooledObject) {
- LogUtil.info(LogEnum.NFS_UTIL, "激活NFS对象: ", pooledObject.getObject());
-
- }
-
- @Override
- public void passivateObject(PooledObject pooledObject) {
- LogUtil.info(LogEnum.NFS_UTIL, "钝化NFS对象: ", pooledObject.getObject());
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/NfsPool.java b/dubhe-server/common/src/main/java/org/dubhe/utils/NfsPool.java
deleted file mode 100644
index d6e031d..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/NfsPool.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * 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.utils;
-
-import com.emc.ecs.nfsclient.nfs.nfs3.Nfs3;
-import org.apache.commons.pool2.impl.GenericObjectPool;
-import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
-import org.dubhe.enums.LogEnum;
-import org.springframework.stereotype.Component;
-
-/**
- * @description NFS3 连接池
- * @date 2020-05-18
- */
-@Component
-public class NfsPool {
- /**
- * NFS工厂对象
- */
- private NfsFactory nfsFactory;
- /**
- * GenericObjectPool对象
- */
- private final GenericObjectPool genericObjectPool;
- /**
- * 最大总共连接数
- */
- public static final int MAX_TOTAL = 300;
- /**
- * 最小连接数
- */
- public static final int MIN = 20;
- /**
- * 最大连接数
- */
- public static final int MAX = 300;
- /**
- * 最大等待时间 单位毫秒
- */
- public static final int MAX_WAIT_TIME = 3000;
-
- /**
- * 初始化连接池
- *
- * @param nfsFactory
- */
- public NfsPool(NfsFactory nfsFactory) {
- this.nfsFactory = nfsFactory;
- GenericObjectPoolConfig poolConfig = new GenericObjectPoolConfig();
- poolConfig.setMaxTotal(MAX_TOTAL);
- poolConfig.setMinIdle(MIN);
- poolConfig.setMaxIdle(MAX);
- poolConfig.setMaxWaitMillis(MAX_WAIT_TIME);
- this.genericObjectPool = new GenericObjectPool<>(nfsFactory, poolConfig);
- }
-
- /**
- * 从连接池中取连接
- *
- * @return nfs3
- */
- public Nfs3 getNfs() {
- try {
- LogUtil.info(LogEnum.NFS_UTIL,"NFS线程 活跃数量:{} ,空闲数量: {} , 等待队列数量 : {}",genericObjectPool.getNumActive(),genericObjectPool.getNumIdle(),genericObjectPool.getNumWaiters());
- return genericObjectPool.borrowObject();
- } catch (Exception e) {
- LogUtil.error(LogEnum.NFS_UTIL, "获取NFS连接失败: {} ", e);
- return null;
- }
- }
-
- /**
- * 释放连接到连接池
- *
- * @param nfs3
- */
- public void revertNfs(Nfs3 nfs3) {
- try {
- if(nfs3 != null){
- LogUtil.info(LogEnum.NFS_UTIL,"成功释放对象 : {} ", nfs3);
- genericObjectPool.returnObject(nfs3);
- }
- } catch (Exception e) {
- LogUtil.error(LogEnum.NFS_UTIL, " 释放NFS连接失败: ", e);
- }
- }
-
- /**
- * 销毁公共池
- */
- public void destroyPool() {
- try {
- genericObjectPool.close();
- } catch (Exception e) {
- LogUtil.error(LogEnum.NFS_UTIL, "销毁NFS连接失败: ", e);
- }
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/NfsUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/NfsUtil.java
deleted file mode 100644
index 459b11b..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/NfsUtil.java
+++ /dev/null
@@ -1,776 +0,0 @@
-/**
- * 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.utils;
-
-import cn.hutool.core.util.StrUtil;
-import com.emc.ecs.nfsclient.nfs.io.Nfs3File;
-import com.emc.ecs.nfsclient.nfs.io.NfsFileInputStream;
-import com.emc.ecs.nfsclient.nfs.io.NfsFileOutputStream;
-import lombok.Getter;
-import org.apache.commons.compress.archivers.ArchiveInputStream;
-import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
-import org.apache.commons.io.IOUtils;
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.config.NfsConfig;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.exception.NfsBizException;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
-
-import java.io.*;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-import java.util.zip.ZipOutputStream;
-
-/**
- * @description NFS Util
- * !!!注意: 使用NFSFile 对象 业务上自行需要关闭 NFS 对象
- * @date 2020-05-12
- */
-@Component
-@Getter
-public class NfsUtil {
-
- private final NfsConfig nfsConfig;
-
- private static final String FILE_SEPARATOR = "/";
-
- private static final String ZIP = ".zip";
-
- private static final String CHARACTER_GBK = "GBK";
-
- private static final String CHARACTER_UTF_8 = "UTF-8";
-
- private static final String UNDER_LINE = "_";
-
- @Autowired
- private NfsPool nfsPool;
-
-
- public NfsUtil(NfsConfig nfsConfig) {
- this.nfsConfig = nfsConfig;
- }
-
- private String getReplaceRootPathRegex() {
- String rootPath = nfsConfig.getRootDir();
- return "^" + rootPath.substring(MagicNumConstant.ZERO, rootPath.length() - MagicNumConstant.ONE);
- }
-
- /**
- * 获取NFS3File 对象
- *
- * @param path
- * @return Nfs3File
- */
- public Nfs3File getNfs3File(String path) {
- if (StringUtils.isEmpty(formatPath(path))) {
- LogUtil.error(LogEnum.NFS_UTIL, "传入的NFS3初始化路径 {} ,无法初始化NFS3 ", path);
- throw new NfsBizException("初始化路径:" + path + " 不合法");
- }
- Nfs3File nfs3File;
- try {
- nfs3File = new Nfs3File(nfsPool.getNfs(), path);
- LogUtil.info(LogEnum.NFS_UTIL, "成功获取NFS3File对象 : {} ", nfs3File.getName());
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "获取NFS3File对象失败 :", e);
- throw new NfsBizException("未获取到NFS连接或者NFS连接池已满" + e.getMessage());
- }
- return nfs3File;
- }
-
- /**
- * 获取NFS3File 对象文件的输入流
- *
- * @param nfs3File
- * @return BufferedInputStream
- */
- public BufferedInputStream getInputStream(Nfs3File nfs3File) {
- BufferedInputStream stream = null;
- try {
- if (!nfs3File.isFile()) {
- throw new NfsBizException("此路径下查找到的对象不是文件类型,请检查文件类型是否正确!");
- }
- stream = new BufferedInputStream(new NfsFileInputStream(nfs3File));
- } catch (IOException e) {
- throw new NfsBizException("nfs获取对象输出流失败!");
- } finally {
- nfsPool.revertNfs(nfs3File.getNfs());
- }
- return stream;
-
- }
-
- /**
- * 获取NFS3File 对象文件的输入流
- *
- * @param path
- * @return BufferedInputStream
- */
- public BufferedInputStream getInputStream(String path) {
- Nfs3File nfs3File = getNfs3File(formatPath(path));
- if (nfs3File == null) {
- throw new NfsBizException("此路径" + path + "下没有文件可以加载!");
- }
- return getInputStream(nfs3File);
- }
-
- /**
- * 校验文件或文件夹是否不存在
- *
- * @param path 文件路径
- * @return boolean
- */
- public boolean fileOrDirIsEmpty(String path) {
- if (!StringUtils.isEmpty(path)) {
- path = formatPath(path.startsWith(nfsConfig.getRootDir()) ? path.replaceFirst(nfsConfig.getRootDir(), StrUtil.SLASH) : path);
- Nfs3File nfs3File = getNfs3File(path);
- try {
- if (nfs3File.exists()) {
- return false;
- }
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "判断NFS File异常: ", e);
- return true;
- } finally {
- nfsPool.revertNfs(nfs3File.getNfs());
- }
- }
- return true;
-
- }
-
-
- /**
- * 创建指定NFS目录
- *
- * @param dir 需要创建的目录 例如:/abc/def
- * @return boolean
- */
- public boolean createDir(String dir) {
- if (!StringUtils.isEmpty(dir)) {
- dir = formatPath(dir);
- String[] paths = dir.substring(MagicNumConstant.ONE).split(FILE_SEPARATOR);
- StringBuilder sbPath = new StringBuilder();
- for (String path : paths) {
- sbPath.append(FILE_SEPARATOR).append(path);
- Nfs3File nfs3File = getNfs3File(sbPath.toString());
- try {
- if (!nfs3File.exists()) {
- nfs3File.mkdirs();
- }
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "创建NFS目录失败:", e);
- return false;
- } finally {
- nfsPool.revertNfs(nfs3File.getNfs());
- }
- }
- return true;
- }
- return false;
- }
-
- /**
- * 创建多个指定目录
- *
- * @param removeNfsRootPath
- * @param paths
- * @return boolean
- */
- private boolean createDir(boolean removeNfsRootPath, String... paths) {
- for (String path : paths) {
- if (path == null) {
- continue;
- }
- String formatPath = path;
- if (removeNfsRootPath) {
- formatPath = formatPath.replaceAll(this.getReplaceRootPathRegex(), "");
- }
- boolean res = createDir(formatPath);
- if (!res) {
- return false;
- }
- }
- return true;
- }
-
-
- /**
- * 创建指定NFS目录
- *
- * @param paths 路径 例如:/nfs/abc/def/ /abc/def/
- * @param nfsRootPath 是否包含nfs根目录 true:包含 false:不包含
- * @return boolean
- */
- public boolean createDirs(boolean nfsRootPath, String... paths) {
- if (null == paths || paths.length < MagicNumConstant.ONE) {
- return true;
- }
- for (String path : paths) {
- if (path == null) {
- continue;
- }
- String formatPath = path;
- if (nfsRootPath) {
- formatPath = formatPath.replaceAll(this.getReplaceRootPathRegex(), "");
- }
- if (!createDir(formatPath)) {
- return false;
- }
- }
- return true;
- }
-
- /**
- * 指定目录NFS中创建文件
- *
- * @param dir 需要创建的目录 例如:/abc/def
- * @param fileName 需要创建的文件 例如:dd.txt
- * @return boolean
- */
- public boolean createFile(String dir, String fileName) {
- if (!StringUtils.isEmpty(dir) && !StringUtils.isEmpty(fileName)) {
- dir = formatPath(dir);
- Nfs3File nfs3File = getNfs3File(dir + FILE_SEPARATOR + fileName);
- try {
- if (!nfs3File.exists()) {
- nfs3File.mkdirs();
- }
- nfs3File.createNewFile();
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "创建NFS文件失败: ", e);
- } finally {
- nfsPool.revertNfs(nfs3File.getNfs());
- }
- }
- return false;
- }
-
- /**
- * 删除NFS目录 或者文件
- *
- * @param dirOrFile 需要删除的目录 或者文件 例如:/abc/def 或者 /abc/def/dd.txt
- * @return boolean
- */
- public boolean deleteDirOrFile(String dirOrFile) {
- if (!StringUtils.isEmpty(dirOrFile)) {
- dirOrFile = formatPath(dirOrFile);
- try {
- List nfs3FileList = getNfs3File(dirOrFile).listFiles();
- //删除目录下的子文件
- if (!CollectionUtils.isEmpty(nfs3FileList)) {
- for (Nfs3File nfs3File : nfs3FileList) {
- if (nfs3File.isDirectory()) {
- deleteDirOrFile(nfs3File.getPath());
- } else if (nfs3File.isFile()) {
- try {
- nfs3File.delete();
- } finally {
- nfsPool.revertNfs(nfs3File.getNfs());
- }
- }
- }
- }
- Nfs3File sourceNfsFile = getNfs3File(dirOrFile);
- try {
- sourceNfsFile.delete();
- } finally {
- nfsPool.revertNfs(sourceNfsFile.getNfs());
- }
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.NFS_UTIL, "删除NFS目录失败:", e);
- }
- }
- return false;
- }
-
-
- /**
- * 上传文件到 NFS 指定目录
- *
- * @param sourceFile 本地文件 包含路径 例如:/abc/def/gg.txt
- * @param targetDir 指定目录 例如:/abc/def
- * @return boolean
- */
- public boolean uploadFileToNfs(String sourceFile, String targetDir) {
- if (StringUtils.isEmpty(sourceFile) || StringUtils.isEmpty(targetDir)) {
- return false;
- }
- sourceFile = formatPath(sourceFile);
- targetDir = formatPath(targetDir);
- //本地文件对象
- File localFile = new File(sourceFile);
- Nfs3File nfs3File = getNfs3File(targetDir + FILE_SEPARATOR + localFile.getName());
- try (BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(localFile));
- BufferedOutputStream outputStream = new BufferedOutputStream(new NfsFileOutputStream(nfs3File))) {
- IOUtils.copyLarge(inputStream, outputStream);
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "上传失败: ", e);
- } finally {
- nfsPool.revertNfs(nfs3File.getNfs());
- }
- return false;
- }
-
- /**
- * 下载NFS文件到本地目录
- *
- * @param sourceFile 指定文件 例如:/abc/def/dd.txt
- * @param targetPath 目标目录 例如: /abc/dd
- * @return boolean
- */
- public boolean downFileFormNfs(String sourceFile, String targetPath) {
- if (StringUtils.isEmpty(sourceFile) || StringUtils.isEmpty(targetPath)) {
- return false;
- }
- sourceFile = formatPath(sourceFile);
- targetPath = formatPath(targetPath);
- Nfs3File nfsFile = getNfs3File(sourceFile);
- if (nfsFile != null) {
- try (InputStream inputStream = new BufferedInputStream(new NfsFileInputStream(nfsFile));
- OutputStream outputStream = new BufferedOutputStream(new FileOutputStream(new File(targetPath + FILE_SEPARATOR + nfsFile.getName())))) {
- IOUtils.copyLarge(inputStream, outputStream);
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "下载失败:", e);
- } finally {
- nfsPool.revertNfs(nfsFile.getNfs());
- }
- }
- return false;
- }
-
-
- /**
- * NFS 复制文件 到指定目录下 单个文件
- *
- * @param sourceFile 需要复制的文件 例如:/abc/def/dd.txt
- * @param targetPath 需要放置的目标目录 例如:/abc/dd
- * @return boolean
- */
- public boolean copyFile(String sourceFile, String targetPath) {
- if (StringUtils.isEmpty(sourceFile) || StringUtils.isEmpty(targetPath)) {
- return false;
- }
- sourceFile = formatPath(sourceFile);
- targetPath = formatPath(targetPath);
- Nfs3File sourceNfsFile = null;
- Nfs3File targetNfsFileNew = null;
- try {
- sourceNfsFile = getNfs3File(sourceFile);
- targetNfsFileNew = getNfs3File(targetPath + FILE_SEPARATOR + sourceNfsFile.getName());
- if (!targetNfsFileNew.exists()) {
- createDir(targetPath);
- }
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "创建目标文件失败: ", e);
- }
- try (InputStream inputStream = new BufferedInputStream(new NfsFileInputStream(sourceNfsFile));
- OutputStream outputStream = new BufferedOutputStream(new NfsFileOutputStream(targetNfsFileNew))) {
- targetNfsFileNew.createNewFile();
- IOUtils.copyLarge(inputStream, outputStream);
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "复制失败:", e);
- return false;
- } finally {
- nfsPool.revertNfs(sourceNfsFile.getNfs());
- nfsPool.revertNfs(targetNfsFileNew.getNfs());
- }
- }
-
-
- /**
- * NFS 复制目录到指定目录下 多个文件 包含目录与文件并存情况
- *
- * 通过NFS文件复制方式 可能存在NFS RPC协议超时情况
- *
- * @param sourcePath 需要复制的文件目录 例如:/abc/def
- * @param targetPath 需要放置的目标目录 例如:/abc/dd
- * @return boolean
- */
- public boolean copyNfsPath(String sourcePath, String targetPath) {
- if (StringUtils.isEmpty(sourcePath) || StringUtils.isEmpty(targetPath)) {
- return false;
- }
- sourcePath = formatPath(sourcePath);
- targetPath = formatPath(targetPath);
- try {
- Nfs3File sourceNfsFile = getNfs3File(sourcePath);
- List nfs3FileList = sourceNfsFile.listFiles();
- if (CollectionUtils.isEmpty(nfs3FileList)) {
- createDir(targetPath + sourcePath.substring(sourcePath.lastIndexOf(FILE_SEPARATOR)));
- } else {
- for (Nfs3File nfs3File : nfs3FileList) {
- if (nfs3File.isDirectory()) {
- String newTargetPath = nfs3File.getPath().substring(nfs3File.getPath().lastIndexOf(FILE_SEPARATOR));
- Nfs3File newNfs3File = getNfs3File(newTargetPath);
- try {
- if (!newNfs3File.exists()) {
- createDir(targetPath + newTargetPath);
- }
- copyNfsPath(nfs3File.getPath(), targetPath + newTargetPath);
- } finally {
- nfsPool.revertNfs(newNfs3File.getNfs());
- }
- }
- if (nfs3File.isFile()) {
- copyFile(sourcePath + FILE_SEPARATOR + nfs3File.getName(), targetPath);
- }
- }
- }
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "复制失败: ", e);
- return false;
- }
- }
-
- /**
- * zip解压并删除压缩文件
- * 当压缩包文件较多时,可能会因为RPC超时而解压失败
- * 该方法已废弃,请使用org.dubhe.utils.LocalFileUtil类的unzipLocalPath方法来替代
- * @param sourcePath zip源文件 例如:/abc/z.zip
- * @param targetPath 解压后的目标文件夹 例如:/abc/
- * @return boolean
- */
- @Deprecated
- public boolean unzip(String sourcePath, String targetPath) {
- if (StringUtils.isEmpty(sourcePath) || StringUtils.isEmpty(targetPath)) {
- return false;
- }
- sourcePath = formatPath(sourcePath);
- targetPath = formatPath(targetPath);
- if (!sourcePath.toLowerCase().endsWith(ZIP)) {
- return false;
- }
- ArchiveInputStream zIn = null;
- Nfs3File sourceNfsFile = getNfs3File(sourcePath);
- try {
- zIn = new ZipArchiveInputStream(new BufferedInputStream(new NfsFileInputStream(sourceNfsFile)), CHARACTER_GBK, false, true);
- //判断压缩文件编码方式,并重新获取NFS对象流
- try {
- zIn.getNextEntry();
- zIn.close();
- zIn = new ZipArchiveInputStream(new BufferedInputStream(new NfsFileInputStream(sourceNfsFile)), CHARACTER_GBK, false, true);
- } catch (Exception e) {
- zIn.close();
- zIn = new ZipArchiveInputStream(new BufferedInputStream(new NfsFileInputStream(sourceNfsFile)), CHARACTER_UTF_8, false, true);
- }
- ZipEntry entry;
- while ((entry = (ZipEntry) zIn.getNextEntry()) != null) {
- if (entry.isDirectory()) {
- createDir(targetPath + FILE_SEPARATOR + entry.getName());
- } else {
- //若文件夹未创建则创建文件夹
- if (entry.getName().contains(FILE_SEPARATOR)) {
- String entryName = entry.getName();
- String zipDirName = entryName.substring(MagicNumConstant.ZERO, entryName.lastIndexOf(FILE_SEPARATOR));
- createDir(targetPath + FILE_SEPARATOR + zipDirName);
- }
- Nfs3File nfs3File = getNfs3File(targetPath + FILE_SEPARATOR + entry.getName());
- try {
- if (!nfs3File.exists()) {
- nfs3File.createNewFile();
- }
- BufferedOutputStream bos = new BufferedOutputStream(new NfsFileOutputStream(nfs3File));
- IOUtils.copyLarge(zIn, bos);
- bos.flush();
- bos.close();
- } finally {
- nfsPool.revertNfs(nfs3File.getNfs());
- }
- }
- }
- sourceNfsFile.delete();
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "解压失败: ", e);
- return false;
- } finally {
- nfsPool.revertNfs(sourceNfsFile.getNfs());
- if (zIn != null) {
- try {
- zIn.close();
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "输入流关闭失败: ", e);
- }
- }
- }
-
- }
-
- /**
- * NFS 解压压缩包 包含目录与子目录
- *
- * @param sourcePath 需要复制的文件 例如:/abc/def/aaa.rar
- * @return boolean
- */
- public boolean unZip(String sourcePath) {
- sourcePath = formatPath(sourcePath);
- if (StringUtils.isEmpty(sourcePath)) {
- return false;
- }
- String fileDir = sourcePath.substring(MagicNumConstant.ZERO, sourcePath.lastIndexOf(FILE_SEPARATOR));
- ZipEntry zipEntry = null;
- try (ZipInputStream zipInputStream = new ZipInputStream(new NfsFileInputStream(getNfs3File(sourcePath)))) {
- while ((zipEntry = zipInputStream.getNextEntry()) != null) {
- if (zipEntry.isDirectory()) {
- createDir(fileDir + FILE_SEPARATOR + zipEntry.getName());
- continue;
- }
- Nfs3File targetNfsFileNew = getNfs3File(fileDir + FILE_SEPARATOR + zipEntry.getName());
- try (BufferedOutputStream bufferedOutputStream = new BufferedOutputStream(new NfsFileOutputStream(targetNfsFileNew))) {
- targetNfsFileNew.createNewFile();
- IOUtils.copyLarge(zipInputStream, bufferedOutputStream);
- } finally {
- nfsPool.revertNfs(targetNfsFileNew.getNfs());
- }
- }
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "解压文件失败 : ", e);
- return false;
- }
- }
-
- /**
- * 压缩NFS 目录 或者文件 到压缩包
- *
- * @param dirOrFile 目录或者文件 例如: /abc/def/aaa.txt , /abc/def
- * @param zipName 压缩包名称 例如: aa,bb,cc
- * @return boolean
- */
- public boolean zipDirOrFile(String dirOrFile, String zipName) {
- Nfs3File nfs3File = getNfs3File(formatPath(dirOrFile));
- try (ZipOutputStream zipOutputStream = getFileZipOutputStream(getNfsFilePath(formatPath(dirOrFile)), zipName)) {
- zipFiles(zipOutputStream, nfs3File);
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "压缩文件失败 : ", e);
- return false;
- } finally {
- nfsPool.revertNfs(nfs3File.getNfs());
- }
- }
-
- /**
- * 获取NFS 文件压缩目录
- *
- * @param dirOrFile
- * @return String
- */
- private String getNfsFilePath(String dirOrFile) throws IOException {
- Nfs3File nfs3File = getNfs3File(formatPath(dirOrFile));
- if (nfs3File.isFile()) {
- nfsPool.revertNfs(nfs3File.getNfs());
- return dirOrFile.substring(MagicNumConstant.ZERO, dirOrFile.lastIndexOf(FILE_SEPARATOR));
- }
- return dirOrFile;
- }
-
- /**
- * 根据文件路劲 获取Zip文件流
- *
- * @param dirOrFile
- * @param zipName
- * @return ZipOutputStream
- */
- private ZipOutputStream getFileZipOutputStream(String dirOrFile, String zipName) throws IOException {
- Nfs3File targetNfsFileNew = getNfs3File(getNfsFilePath(formatPath(dirOrFile)) + FILE_SEPARATOR + zipName + ZIP);
- targetNfsFileNew.createNewFile();
- return new ZipOutputStream(new NfsFileOutputStream(targetNfsFileNew));
- }
-
- /**
- * 压缩文件和文件夹
- *
- * @param zipOutputStream
- * @param nfs3File
- * @return boolean
- */
- public boolean zipFiles(ZipOutputStream zipOutputStream, Nfs3File nfs3File) {
- try {
- if (nfs3File.isFile()) {
- compressZip(zipOutputStream, nfs3File, "");
- } else {
- List nfs3FileList = nfs3File.listFiles();
- if (!CollectionUtils.isEmpty(nfs3FileList)) {
- for (Nfs3File nfs3FileChildren : nfs3FileList) {
- zipFiles(zipOutputStream, nfs3FileChildren);
- }
- }
- }
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "压缩文件失败 : ", e);
- return false;
- }
- }
-
- /**
- * 单个文件压缩
- *
- * @param zipOutputStream
- * @param nfs3File
- */
- public void compressZip(ZipOutputStream zipOutputStream, Nfs3File nfs3File, String childPath) {
- try (InputStream inputStream = new BufferedInputStream(new NfsFileInputStream(nfs3File))) {
- if (StringUtils.isEmpty(childPath)) {
- zipOutputStream.putNextEntry(new ZipEntry(nfs3File.getName()));
- } else {
- zipOutputStream.putNextEntry(new ZipEntry(childPath + FILE_SEPARATOR + nfs3File.getName()));
- }
- byte[] buffer = new byte[1024 * 10];
- int length;
- while ((length = inputStream.read(buffer, MagicNumConstant.ZERO, buffer.length)) != -1) {
- zipOutputStream.write(buffer, MagicNumConstant.ZERO, length);
- }
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "解压单个文件异常: ", e);
- } finally {
- nfsPool.revertNfs(nfs3File.getNfs());
- }
- }
-
- /**
- * 复制文件夹(或文件)到另一个文件夹
- *
- * @param sourcePath 复制文件夹 /abc/def 复制文件:/abc/def/dd.txt
- * @param targetPath /abc/dd/def
- * @return boolean
- */
- public boolean copyDirs(String sourcePath, String targetPath) {
- Nfs3File sourceNfsFile = getNfs3File(formatPath(sourcePath));
- try {
- if (!sourceNfsFile.exists()) {
- LogUtil.error(LogEnum.NFS_UTIL, "sourcePath不存在, 如下{} ", sourcePath);
- return false;
- }
- if (sourceNfsFile.isFile()) {
- return copyFile(sourcePath, targetPath);
- } else if (sourceNfsFile.isDirectory()) {
- targetPath = targetPath + FILE_SEPARATOR + sourceNfsFile.getName();
- boolean bool = createDir(formatPath(targetPath));
- if (!bool) {
- LogUtil.error(LogEnum.NFS_UTIL, "{}文件夹创建失败... ", targetPath);
- return false;
- }
- List files = sourceNfsFile.listFiles();
- for (Nfs3File file : files) {
- copyDirs(file.getPath(), targetPath);
- }
- }
- return true;
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "copyDirs失败, sourcePath为 , targetPath为 , 失败原因 ", sourcePath, targetPath, e);
- } finally {
- nfsPool.revertNfs(sourceNfsFile.getNfs());
- }
- return false;
- }
-
- /**
- * 找到倒数第二新的文件夹
- *
- * @param parentPath 父文件夹
- * @return
- */
- public String find2ndNewDir(String parentPath) {
- Nfs3File parentNfsFile = getNfs3File(formatPath(parentPath));
- try {
- if (!parentNfsFile.exists() || parentNfsFile.isFile()) {
- LogUtil.error(LogEnum.NFS_UTIL, "sourcePath不存在, 如下{} ", parentPath);
- return "";
- }
- List files = parentNfsFile.listFiles();
- List dirs = new ArrayList<>();
- for (Nfs3File file : files) {
- if (file.isDirectory()) {
- dirs.add(file);
- }
- }
- if (dirs.size() < MagicNumConstant.TWO) {
- return "";
- }
- dirs.sort((o1, o2) -> {
- try {
- return (int) (o2.lastModified() - o1.lastModified());
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "执行异常: {} ", e);
- return MagicNumConstant.ZERO;
- }
- });
- return dirs.get(MagicNumConstant.ONE).getName();
-
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "findSecNewDir失败, parentPath为{}, 失败原因{}", parentPath, e);
- } finally {
- nfsPool.revertNfs(parentNfsFile.getNfs());
- }
- return "";
- }
-
- /**
- * 重命名文件夹
- *
- * @param sourcePath 原文件夹
- * @param targetPath 目标文件夹
- * @return
- */
- public void renameDir(String sourcePath, String targetPath) {
- Nfs3File sourceNfsFile = getNfs3File(formatPath(sourcePath));
- Nfs3File targetNfsFile = getNfs3File(formatPath(targetPath));
- try {
- if (!sourceNfsFile.exists()) {
- LogUtil.error(LogEnum.NFS_UTIL, "sourcePath不存在, 如下{} ", sourcePath);
- }
- sourceNfsFile.rename(targetNfsFile);
- } catch (IOException e) {
- LogUtil.error(LogEnum.NFS_UTIL, "renameDir失败, sourcePath为{}, targetPath为{}, 失败原因{}", sourcePath, targetPath, e);
- } finally {
- nfsPool.revertNfs(sourceNfsFile.getNfs());
- nfsPool.revertNfs(targetNfsFile.getNfs());
- }
- }
-
-
- /**
- * 替换路劲中多余的 "/"
- *
- * @param path
- * @return String
- */
- public String formatPath(String path) {
- if (!StringUtils.isEmpty(path)) {
- return path.replaceAll("///*", FILE_SEPARATOR);
- }
- return path;
- }
-
- public String getAbsolutePath(String relativePath) {
- return nfsConfig.getRootDir() + nfsConfig.getBucket() + relativePath;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/NumberUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/NumberUtil.java
deleted file mode 100644
index 00365d6..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/NumberUtil.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.utils;
-
-import org.dubhe.exception.NotebookBizException;
-
-import java.util.regex.Pattern;
-
-/**
- * @description 数字验证工具
- * @date 2020-05-18
- */
-public class NumberUtil {
-
- private static final String REGEX = "^[0-9]*$";
-
- private NumberUtil() {
-
- }
-
- /**
- * 判断是否为数字格式不限制位数
- *
- * @param object 待校验参数
- */
- public static void isNumber(Object object) {
- if (!((Pattern.compile(REGEX)).matcher(String.valueOf(object)).matches())) {
- throw new NotebookBizException("parameter is incorrect");
- }
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/PageUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/PageUtil.java
deleted file mode 100644
index 7a2cb7c..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/PageUtil.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * 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.utils;
-
-import com.baomidou.mybatisplus.core.metadata.IPage;
-
-import java.util.*;
-import java.util.function.Function;
-
-/**
- * @description 分页工具
- * @date 2020-03-13
- */
-public class PageUtil extends cn.hutool.core.util.PageUtil {
-
- /**
- * List 分页
- */
- public static List toPage(int page, int size, List list) {
- int fromIndex = page * size;
- int toIndex = page * size + size;
- if (fromIndex > list.size()) {
- return new ArrayList();
- } else if (toIndex >= list.size()) {
- return list.subList(fromIndex, list.size());
- } else {
- return list.subList(fromIndex, toIndex);
- }
- }
-
- /**
- * Page 数据处理,预防redis反序列化报错
- */
- public static Map toPage(IPage page) {
- return toPage(page, page.getRecords());
- }
-
- /**
- * 自定义分页
- */
- public static Map toPage(IPage page, Function super List, ? extends List> function) {
- return toPage(page, function.apply(page.getRecords()));
- }
-
- /**
- * 自定义分页
- */
- public static Map toPage(IPage page, Collection data) {
- Map map = new LinkedHashMap<>(2);
- map.put("result", data);
- map.put("page", buildPagination(page));
- return map;
- }
-
- private static Map buildPagination(IPage page) {
- Map map = new HashMap<>(2);
- map.put("current", page.getCurrent());
- map.put("size", page.getSize());
- map.put("total", page.getTotal());
- return map;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/ReadFile.java b/dubhe-server/common/src/main/java/org/dubhe/utils/ReadFile.java
deleted file mode 100644
index fe29ab3..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/ReadFile.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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.utils;
-
-import java.io.BufferedReader;
-import java.io.FileReader;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @description 读文件工具类
- * @date 2020-5-6
- */
-public class ReadFile {
-
- public static List read(String path, Integer start, Integer length){
- if (start < 0) {
- start = 0;
- }
- List ansList = new ArrayList<>();
- try (BufferedReader br = new BufferedReader(new FileReader(path))){
- for (int i = 0; i < start+length; i++) {
- String line = br.readLine();
- if (line == null) {
- break;
- }
- if (start <= i && i < start+length) {
- ansList.add(line);
- }
- }
- } catch (IOException ex) {
- ex.printStackTrace();
- return ansList;
- }
- return ansList;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/RedisUtils.java b/dubhe-server/common/src/main/java/org/dubhe/utils/RedisUtils.java
deleted file mode 100644
index d7f59d5..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/RedisUtils.java
+++ /dev/null
@@ -1,847 +0,0 @@
-/**
- * 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.utils;
-
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.enums.LogEnum;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.data.redis.connection.RedisConnection;
-import org.springframework.data.redis.connection.RedisConnectionFactory;
-import org.springframework.data.redis.core.Cursor;
-import org.springframework.data.redis.core.RedisConnectionUtils;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.data.redis.core.ScanOptions;
-import org.springframework.data.redis.core.script.DefaultRedisScript;
-import org.springframework.data.redis.core.script.RedisScript;
-import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer;
-import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
-
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-
-/**
- * @description redis工具类
- * @date 2020-03-13
- */
-@Component
-@SuppressWarnings({"unchecked", "all"})
-public class RedisUtils {
-
- private RedisTemplate redisTemplate;
- @Value("${jwt.online-key}")
- private String onlineKey;
-
- public RedisUtils(RedisTemplate redisTemplate) {
- this.redisTemplate = redisTemplate;
- }
-
- // =============================common============================
-
- /**
- * 指定缓存失效时间
- *
- * @param key 键
- * @param time 时间(秒)
- */
- public boolean expire(String key, long time) {
- try {
- if (time > 0) {
- redisTemplate.expire(key, time, TimeUnit.SECONDS);
- }
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils expire key {} time {} error:{}", key, time, e.getMessage(), e);
- return false;
- }
- return true;
- }
-
- /**
- * 根据 key 获取过期时间
- *
- * @param key 键 不能为null
- * @return 时间(秒) 返回0代表为永久有效
- */
- public long getExpire(Object key) {
- return redisTemplate.getExpire(key, TimeUnit.SECONDS);
- }
-
- /**
- * 查找匹配key
- *
- * @param pattern key
- * @return List 匹配的key集合
- */
- public List scan(String pattern) {
- ScanOptions options = ScanOptions.scanOptions().match(pattern).build();
- RedisConnectionFactory factory = redisTemplate.getConnectionFactory();
- RedisConnection rc = Objects.requireNonNull(factory).getConnection();
- Cursor cursor = rc.scan(options);
- List result = new ArrayList<>();
- while (cursor.hasNext()) {
- result.add(new String(cursor.next()));
- }
- try {
- RedisConnectionUtils.releaseConnection(rc, factory, true);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils scan pattern {} error:{}", pattern, e.getMessage(), e);
- }
- return result;
- }
-
- /**
- * 分页查询 key
- *
- * @param patternKey key
- * @param page 页码
- * @param size 每页数目
- * @return 匹配到的key集合
- */
- public List findKeysForPage(String patternKey, int page, int size) {
- ScanOptions options = ScanOptions.scanOptions().match(patternKey).build();
- RedisConnectionFactory factory = redisTemplate.getConnectionFactory();
- RedisConnection rc = Objects.requireNonNull(factory).getConnection();
- Cursor cursor = rc.scan(options);
- List result = new ArrayList<>(size);
- int tmpIndex = 0;
- int fromIndex = page * size;
- int toIndex = page * size + size;
- while (cursor.hasNext()) {
- if (tmpIndex >= fromIndex && tmpIndex < toIndex) {
- result.add(new String(cursor.next()));
- tmpIndex++;
- continue;
- }
- // 获取到满足条件的数据后,就可以退出了
- if (tmpIndex >= toIndex) {
- break;
- }
- tmpIndex++;
- cursor.next();
- }
- try {
- RedisConnectionUtils.releaseConnection(rc, factory, true);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils findKeysForPage patternKey {} page {} size {} error:{}", patternKey, page, size, e.getMessage(), e);
- }
- return result;
- }
-
- /**
- * 判断key是否存在
- *
- * @param key 键
- * @return true 存在 false不存在
- */
- public boolean hasKey(String key) {
- try {
- return redisTemplate.hasKey(key);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils hasKey key {} error:{}", key, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 删除缓存
- *
- * @param key 可以传一个值 或多个
- */
- public void del(String... key) {
- if (key != null && key.length > 0) {
- if (key.length == 1) {
- redisTemplate.delete(key[0]);
- } else {
- redisTemplate.delete(CollectionUtils.arrayToList(key));
- }
- }
- }
-
- /**
- *
- * @param script 脚本字符串
- * @param key 键
- * @param args 脚本其他参数
- * @return
- */
- public Object executeRedisScript(String script, String key, Object... args) {
- try {
- RedisScript redisScript = new DefaultRedisScript<>(script, Long.class);
- redisTemplate.setValueSerializer(new Jackson2JsonRedisSerializer<>(Object.class));
- return redisTemplate.execute(redisScript, Collections.singletonList(key), args);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "executeRedisScript script {} key {} expireTime {} args {} error:{}", script, key, args, e);
- return MagicNumConstant.ZERO_LONG;
- }
- }
-
- /**
- *
- * @param script 脚本字符串
- * @param key 键
- * @param args 脚本其他参数
- * @return
- */
- public Object executeRedisObjectScript(String script, String key, Object... args) {
- try {
- RedisScript redisScript = new DefaultRedisScript<>(script, Object.class);
- redisTemplate.setValueSerializer(new Jackson2JsonRedisSerializer<>(Object.class));
- return redisTemplate.execute(redisScript, Collections.singletonList(key), args);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "executeRedisObjectScript script {} key {} expireTime {} args {} error:{}", script, key, args, e);
- return null;
- }
- }
-
- // ============================String=============================
-
- /**
- * 普通缓存获取
- *
- * @param key 键
- * @return key对应的value值
- */
- public Object get(String key) {
-
- return key == null ? null : redisTemplate.opsForValue().get(key);
- }
-
- /**
- * 批量获取
- *
- * @param keys key集合
- * @return key集合对应的value集合
- */
- public List multiGet(List keys) {
- Object obj = redisTemplate.opsForValue().multiGet(Collections.singleton(keys));
- return null;
- }
-
- /**
- * 普通缓存放入
- *
- * @param key 键
- * @param value 值
- * @return true成功 false失败
- */
- public boolean set(String key, Object value) {
- try {
- redisTemplate.opsForValue().set(key, value);
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils set key {} value {} error:{}", key, value, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 普通缓存放入并设置时间
- *
- * @param key 键
- * @param value 值
- * @param time 时间(秒) time要大于0 如果time小于等于0 将设置无限期
- * @return true成功 false 失败
- */
- public boolean set(String key, Object value, long time) {
- try {
- if (time > 0) {
- redisTemplate.opsForValue().set(key, value, time, TimeUnit.SECONDS);
- } else {
- set(key, value);
- }
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils set key {} value {} time {} error:{}", key, value, time, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 普通缓存放入并设置时间
- *
- * @param key 键
- * @param value 值
- * @param time 时间
- * @param timeUnit 类型
- * @return true成功 false 失败
- */
- public boolean set(String key, Object value, long time, TimeUnit timeUnit) {
- try {
- if (time > 0) {
- redisTemplate.opsForValue().set(key, value, time, timeUnit);
- } else {
- set(key, value);
- }
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils set key {} value {} time {} timeUnit {} error:{}", key, value, time, timeUnit, e.getMessage(), e);
- return false;
- }
- }
-
- //===============================Lock=================================
-
- /**
- * 加锁
- * @param key 键
- * @param requestId 请求id用以释放锁
- * @param expireTime 超时时间(秒)
- * @return
- */
- public boolean getDistributedLock(String key, String requestId, long expireTime) {
- String script = "if redis.call('setNx',KEYS[1],ARGV[1]) == 1 then if redis.call('get',KEYS[1]) == ARGV[1] then return redis.call('expire',KEYS[1],ARGV[2]) else return 0 end else return 0 end";
- Object result = executeRedisScript(script, key, requestId, expireTime);
- return result != null && result.equals(MagicNumConstant.ONE_LONG);
- }
-
- /**
- * 释放锁
- * @param key 键
- * @param requestId 请求id用以释放锁
- * @return
- */
- public boolean releaseDistributedLock(String key, String requestId) {
- String script = "if redis.call('get', KEYS[1]) == ARGV[1] then return redis.call('del', KEYS[1]) else return 0 end";
- Object result = executeRedisScript(script, key, requestId);
- return result != null && result.equals(MagicNumConstant.ONE_LONG);
- }
-
- // ================================Map=================================
-
- /**
- * HashGet
- *
- * @param key 键 不能为null
- * @param item 项 不能为null
- * @return 值
- */
- public Object hget(String key, String item) {
- return redisTemplate.opsForHash().get(key, item);
- }
-
- /**
- * 获取hashKey对应的所有键值
- *
- * @param key 键
- * @return 对应的多个键值
- */
- public Map hmget(String key) {
- return redisTemplate.opsForHash().entries(key);
-
- }
-
- /**
- * HashSet
- *
- * @param key 键
- * @param map 对应多个键值
- * @return true 成功 false 失败
- */
- public boolean hmset(String key, Map map) {
- try {
- redisTemplate.opsForHash().putAll(key, map);
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils hmset key {} map {} error:{}", key, map, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * HashSet 并设置时间
- *
- * @param key 键
- * @param map 对应多个键值
- * @param time 时间(秒)
- * @return true成功 false失败
- */
- public boolean hmset(String key, Map map, long time) {
- try {
- redisTemplate.opsForHash().putAll(key, map);
- if (time > 0) {
- expire(key, time);
- }
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils hmset key {} map {} time {} error:{}", key, map, time, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 向一张hash表中放入数据,如果不存在将创建
- *
- * @param key 键
- * @param item 项
- * @param value 值
- * @return true 成功 false失败
- */
- public boolean hset(String key, String item, Object value) {
- try {
- redisTemplate.opsForHash().put(key, item, value);
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils hset key {} item {} value {} error:{}", key, item, value, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 向一张hash表中放入数据,如果不存在将创建
- *
- * @param key 键
- * @param item 项
- * @param value 值
- * @param time 时间(秒) 注意:如果已存在的hash表有时间,这里将会替换原有的时间
- * @return true 成功 false失败
- */
- public boolean hset(String key, String item, Object value, long time) {
- try {
- redisTemplate.opsForHash().put(key, item, value);
- if (time > 0) {
- expire(key, time);
- }
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils hset key {} item {} value {} time {} error:{}", key, item, value, time, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 删除hash表中的值
- *
- * @param key 键 不能为null
- * @param item 项 可以使多个 不能为null
- */
- public void hdel(String key, Object... item) {
- redisTemplate.opsForHash().delete(key, item);
- }
-
- /**
- * 判断hash表中是否有该项的值
- *
- * @param key 键 不能为null
- * @param item 项 不能为null
- * @return true 存在 false不存在
- */
- public boolean hHasKey(String key, String item) {
- return redisTemplate.opsForHash().hasKey(key, item);
- }
-
- /**
- * hash递增 如果不存在,就会创建一个 并把新增后的值返回
- *
- * @param key 键
- * @param item 项
- * @param by 要增加几(大于0)
- * @return
- */
- public double hincr(String key, String item, double by) {
- return redisTemplate.opsForHash().increment(key, item, by);
- }
-
- /**
- * hash递减
- *
- * @param key 键
- * @param item 项
- * @param by 要减少记(小于0)
- * @return
- */
- public double hdecr(String key, String item, double by) {
- return redisTemplate.opsForHash().increment(key, item, -by);
- }
-
- // ============================set=============================
-
- /**
- * 根据key获取Set中的所有值
- *
- * @param key 键
- * @return
- */
- public Set sGet(String key) {
- try {
- return redisTemplate.opsForSet().members(key);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils sGet key {} error:{}", key, e.getMessage(), e);
- return null;
- }
- }
-
- /**
- * 根据value从一个set中查询,是否存在
- *
- * @param key 键
- * @param value 值
- * @return true 存在 false不存在
- */
- public boolean sHasKey(String key, Object value) {
- try {
- return redisTemplate.opsForSet().isMember(key, value);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils sHasKey key {} value {} error:{}", key, value, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 将数据放入set缓存
- *
- * @param key 键
- * @param values 值 可以是多个
- * @return 成功个数
- */
- public long sSet(String key, Object... values) {
- try {
- return redisTemplate.opsForSet().add(key, values);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils sSet key {} values {} error:{}", key, values, e.getMessage(), e);
- return 0;
- }
- }
-
- /**
- * 将set数据放入缓存
- *
- * @param key 键
- * @param time 时间(秒)
- * @param values 值 可以是多个
- * @return 成功个数
- */
- public long sSetAndTime(String key, long time, Object... values) {
- try {
- Long count = redisTemplate.opsForSet().add(key, values);
- if (time > 0) {
- expire(key, time);
- }
- return count;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils sSetAndTime key {} time {} values {} error:{}", key, time, values, e.getMessage(), e);
- return 0;
- }
- }
-
- /**
- * 获取set缓存的长度
- *
- * @param key 键
- * @return
- */
- public long sGetSetSize(String key) {
- try {
- return redisTemplate.opsForSet().size(key);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils sGetSetSize key {} error:{}", key, e.getMessage(), e);
- return 0;
- }
- }
-
- /**
- * 移除值为value的
- *
- * @param key 键
- * @param values 值 可以是多个
- * @return 移除的个数
- */
- public long setRemove(String key, Object... values) {
- try {
- Long count = redisTemplate.opsForSet().remove(key, values);
- return count;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils setRemove key {} values {} error:{}", key, values, e.getMessage(), e);
- return 0;
- }
- }
-
- // ===============================sorted set=================================
-
- /**
- * 将zSet数据放入缓存
- *
- * @param key
- * @param time
- * @param values
- * @return Boolean
- */
- public Boolean zSet(String key, long time, Object value) {
- try {
- Boolean success = redisTemplate.opsForZSet().add(key, value, System.currentTimeMillis());
- if (success) {
- expire(key, time);
- }
- return success;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils zSet key {} time {} value {} error:{}", key, time, value, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 将zSet数据放入缓存
- * @param key 健
- * @param score 分数
- * @param value 值
- * @return
- */
- public Boolean zAdd(String key,Long score,Object value){
- try{
- if (StringUtils.isEmpty(key) || score == null || value == null){
- return false;
- }
- return redisTemplate.opsForZSet().add(key, value, score);
- }catch (Exception e){
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils zAdd key {} score {} value {} error:{}", key, score, value, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 返回有序集合所有成员,从大到小排序
- *
- * @param key
- * @return Set
- */
- public Set zGet(String key) {
- try {
- return redisTemplate.opsForZSet().reverseRange(key, Long.MIN_VALUE, Long.MAX_VALUE);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils zGet key {} error:{}", key, e.getMessage(), e);
- return null;
- }
- }
-
- /**
- * 弹出有序集合 score 在 [min,max] 内由小到大从 offset 取 count 个
- * @param key 健
- * @param min score最小值
- * @param max score最大值
- * @param offset 起始下标
- * @param count 偏移量
- * @return
- */
- public List zRangeByScorePop(String key,double min,double max,long offset,long count){
- try{
- String script = "local elementSet = redis.call('ZRANGEBYSCORE',KEYS[1],ARGV[1],ARGV[2],'LIMIT',ARGV[3],ARGV[4]) if elementSet ~= false and #elementSet ~= 0 then redis.call('ZREM' , KEYS[1] , elementSet[1]) end return elementSet";
- Object result = executeRedisObjectScript(script, key, min, max,offset,count);
- return (List) result;
- }catch (Exception e){
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils zRangeByScorePop key {} min {} max {} offset {} count {} error:{}", key,min, max, offset, count, e.getMessage(), e);
- return new ArrayList<>();
- }
- }
-
- /**
- * 弹出有序集合 score 在 [min,max] 内由小到大从 0 取 1 个
- * @param key 健
- * @param min score最小值
- * @param max score最大值
- * @return
- */
- public List zRangeByScorePop(String key,double min, double max){
- return zRangeByScorePop( key,min, max,0,1);
- }
-
- /**
- * 弹出有序集合 score 在 [0,max] 内由小到大从 offset 取 count 个
- * @param key 健
- * @param max score最大值
- * @return
- */
- public List zRangeByScorePop(String key,double max){
- return zRangeByScorePop( key,0, max,0,1);
- }
-
-
- // ===============================list=================================
-
- /**
- * 获取list缓存的内容
- *
- * @param key 键
- * @param start 开始
- * @param end 结束 0 到 -1代表所有值
- * @return
- */
- public List lGet(String key, long start, long end) {
- try {
- return redisTemplate.opsForList().range(key, start, end);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lGetIndex key {} start {} end {} error:{}", key, start, end, e.getMessage(), e);
- return null;
- }
- }
-
- /**
- * 获取list缓存的长度
- *
- * @param key 键
- * @return
- */
- public long lGetListSize(String key) {
- try {
- return redisTemplate.opsForList().size(key);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lGetListSize key {} error:{}", key, e.getMessage(), e);
- return 0;
- }
- }
-
- /**
- * 通过索引 获取list中的值
- *
- * @param key 键
- * @param index 索引 index>=0时, 0 表头,1 第二个元素,依次类推;index<0时,-1,表尾,-2倒数第二个元素,依次类推
- * @return
- */
- public Object lGetIndex(String key, long index) {
- try {
- return redisTemplate.opsForList().index(key, index);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lGetIndex key {} index {} error:{}", key, index, e.getMessage(), e);
- return null;
- }
- }
-
- /**
- * 将list放入缓存
- *
- * @param key 键
- * @param value 值
- * @return
- */
- public boolean lSet(String key, Object value) {
- try {
- redisTemplate.opsForList().rightPush(key, value);
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lSet key {} value {} error:{}", key, value, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 将list放入缓存
- *
- * @param key 键
- * @param value 值
- * @param time 时间(秒)
- * @return 是否存储成功
- */
- public boolean lSet(String key, Object value, long time) {
- try {
- redisTemplate.opsForList().rightPush(key, value);
- if (time > 0) {
- expire(key, time);
- }
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lSet key {} value {} time {} error:{}", key, value, time, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 将list放入缓存
- *
- * @param key 键
- * @param value 值
- * @return 是否存储成功
- */
- public boolean lSet(String key, List value) {
- try {
- redisTemplate.opsForList().rightPushAll(key, value);
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lSet key {} value {} error:{}", key, value, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 将list放入缓存
- *
- * @param key 键
- * @param value 值
- * @param time 时间(秒)
- * @return 是否存储成功
- */
- public boolean lSet(String key, List value, long time) {
- try {
- redisTemplate.opsForList().rightPushAll(key, value);
- if (time > 0) {
- expire(key, time);
- }
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lSet key {} value {} time {} error:{}", key, value, time, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 根据索引修改list中的某条数据
- *
- * @param key 键
- * @param index 索引
- * @param value 值
- * @return 更新数据标识
- */
- public boolean lUpdateIndex(String key, long index, Object value) {
- try {
- redisTemplate.opsForList().set(key, index, value);
- return true;
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lUpdateIndex key {} index {} value {} error:{}", key, index, value, e.getMessage(), e);
- return false;
- }
- }
-
- /**
- * 移除N个值为value
- *
- * @param key 键
- * @param count 移除多少个
- * @param value 值
- * @return 移除的个数
- */
- public long lRemove(String key, long count, Object value) {
- try {
- return redisTemplate.opsForList().remove(key, count, value);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lRemove key {} count {} value {} error:{}", key, count, value, e.getMessage(), e);
- return 0;
- }
- }
-
- /**
- * 队列从左弹出数据
- *
- * @param key
- * @return key对应的value值
- */
- public Object lpop(String key) {
- try {
- return redisTemplate.opsForList().leftPop(key);
- } catch (Exception e) {
- LogUtil.error(LogEnum.SYS_ERR, "RedisUtils lRemove key {} error:{}", key, e.getMessage(), e);
- return null;
- }
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/ReflectionUtils.java b/dubhe-server/common/src/main/java/org/dubhe/utils/ReflectionUtils.java
deleted file mode 100644
index 3f0aeae..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/ReflectionUtils.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.utils;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @description 反射工具类
- * @date 2020-05-29
- **/
-public class ReflectionUtils {
-
- /**
- * 获取所有字段集合
- *
- * @param clazz 反射对象
- * @return List 字段集合
- **/
- public static List getFieldNames(Class clazz) {
- Field[] fields = clazz.getDeclaredFields();
- List fieldNameList = new ArrayList<>();
- for (Field field : fields) {
- fieldNameList.add(field.getName());
- }
- return fieldNameList;
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/RegexUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/RegexUtil.java
deleted file mode 100644
index a85034e..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/RegexUtil.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/**
- * 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.utils;
-
-import lombok.extern.slf4j.Slf4j;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @description 正则匹配工具类
- * @date 2020-04-23
- */
-@Slf4j
-public class RegexUtil {
- private static final String DIGIT = "^[0-9]*$";
- private static final String FLOAT = "^[-+]?[0-9]*\\.?[0-9]+$";
-
- /**
- * 字符串匹配
- *
- * @param str 待匹配文本
- * @param regex 正则表达式
- * @return 返回str中匹配regex的第一个子串
- */
- public static String getMatcher(String str, String regex) {
- try {
- if (StringUtils.isEmpty(str) || StringUtils.isEmpty(regex)) {
- return "";
- }
- Pattern p = Pattern.compile(regex, Pattern.CASE_INSENSITIVE);
- Matcher matcher = p.matcher(str);
- matcher.find();
- return matcher.group();
- } catch (IllegalStateException e) {
- log.error(e.getMessage(), e);
- return "";
- }
- }
-
- /**
- * 数字匹配
- *
- * @param str
- * @return
- */
- public static boolean isDigits(String str) {
- if (StringUtils.isEmpty(str)) {
- return false;
- }
- return str.matches(DIGIT);
- }
-
- /**
- * 浮点数匹配
- *
- * @param str
- * @return
- */
- public static boolean isFloat(String str) {
- if (StringUtils.isEmpty(str)) {
- return false;
- }
- return str.matches(FLOAT);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/SpringContextHolder.java b/dubhe-server/common/src/main/java/org/dubhe/utils/SpringContextHolder.java
deleted file mode 100644
index 501f555..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/SpringContextHolder.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * 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.utils;
-
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.DisposableBean;
-import org.springframework.context.ApplicationContext;
-import org.springframework.context.ApplicationContextAware;
-/**
- * @description 上下文工具类
- * @date 2020-03-25
- */
-@Slf4j
-public class SpringContextHolder implements ApplicationContextAware, DisposableBean {
-
- private static ApplicationContext applicationContext = null;
-
- /**
- * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
- */
- @SuppressWarnings("unchecked")
- public static T getBean(String name) {
- assertContextInjected();
- return (T) applicationContext.getBean(name);
- }
-
- /**
- * 从静态变量applicationContext中取得Bean, 自动转型为所赋值对象的类型.
- */
- public static T getBean(Class requiredType) {
- assertContextInjected();
- return applicationContext.getBean(requiredType);
- }
-
- /**
- * 检查ApplicationContext不为空.
- */
- private static void assertContextInjected() {
- if (applicationContext == null) {
- throw new IllegalStateException("applicaitonContext属性未注入, 请在applicationContext" +
- ".xml中定义SpringContextHolder或在SpringBoot启动类中注册SpringContextHolder.");
- }
- }
-
- /**
- * 清除SpringContextHolder中的ApplicationContext为Null.
- */
- private static void clearHolder() {
- log.debug("清除SpringContextHolder中的ApplicationContext:"
- + applicationContext);
- applicationContext = null;
- }
-
- @Override
- public void destroy() {
- SpringContextHolder.clearHolder();
- }
-
- @Override
- public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
- if (SpringContextHolder.applicationContext != null) {
- log.warn("SpringContextHolder中的ApplicationContext被覆盖, 原有ApplicationContext为:" + SpringContextHolder.applicationContext);
- }
- SpringContextHolder.applicationContext = applicationContext;
- }
-
- /**
- * 获取当前环境
- *
- * @return
- */
- public static String getActiveProfile(){
- return applicationContext.getEnvironment().getActiveProfiles()[0];
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/SqlUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/SqlUtil.java
deleted file mode 100644
index cbee763..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/SqlUtil.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * 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.utils;
-
-import org.dubhe.base.BaseService;
-import org.dubhe.base.DataContext;
-
-import java.util.HashSet;
-import java.util.Objects;
-import java.util.Set;
-
-/**
- * @description sql语句转换的工具类
- * @date 2020-07-06
- */
-
-public class SqlUtil {
-
- /**
- * 将数组转换成in('1','2')的形式
- *
- * @param objs
- * @return
- */
- public static String integerlistToString(Integer[] objs) {
-
- if (objs != null && objs.length > 0) {
- StringBuilder sb = new StringBuilder("(");
- for (Object obj : objs) {
- if (obj != null) {
- sb.append("'" + obj.toString() + "',");
- }
- }
- sb.deleteCharAt(sb.length() - 1);
- sb.append(")");
- return sb.toString();
- }
- return "";
- }
-
-
- /**
- * 获取资源拥有着ID
- *
- * @return 资源拥有者id集合
- */
- public static Set getResourceIds() {
- if (!Objects.isNull(DataContext.get())) {
- return DataContext.get().getResourceUserIds();
- }
- Set ids = new HashSet<>();
- Long id = JwtUtils.getCurrentUserDto().getId();
- ids.add(id);
- return ids;
-
- }
-
-
- /**
- * 构建目标sql语句
- *
- * @param originSql 原生sql
- * @param resourceUserIds 所属资源用户ids
- * @return 目标sql
- */
- public static String buildTargetSql(String originSql, Set resourceUserIds) {
- if (BaseService.isAdmin()) {
- return originSql;
- }
- String sqlWhereBefore = org.dubhe.utils.StringUtils.substringBefore(originSql.toLowerCase(), "where");
- String sqlWhereAfter = org.dubhe.utils.StringUtils.substringAfter(originSql.toLowerCase(), "where");
- StringBuffer buffer = new StringBuffer();
- //操作的sql拼接
- String targetSql = buffer.append(sqlWhereBefore).append(" where ").append(" origin_user_id in (")
- .append(org.dubhe.utils.StringUtils.join(resourceUserIds, ",")).append(") and ").append(sqlWhereAfter).toString();
-
- return targetSql;
- }
-
-
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/StateMachineProxyUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/StateMachineProxyUtil.java
deleted file mode 100644
index cd04585..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/StateMachineProxyUtil.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * 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.utils;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.apache.commons.lang3.StringUtils;
-import org.apache.poi.ss.formula.functions.T;
-import org.dubhe.dto.StateChangeDTO;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.exception.StateMachineException;
-import org.springframework.stereotype.Component;
-import org.springframework.util.CollectionUtils;
-import org.springframework.util.ReflectionUtils;
-
-/**
- * @description 代理执行状态机
- * @date 2020-08-27
- */
-@Component
-public class StateMachineProxyUtil {
-
- /**
- * 代理执行单个状态机的状态切换
- *
- * @param stateChangeDTO 数据集状态切换信息
- * @param objectService 服务类
- */
- public static void proxyExecutionSingleState(StateChangeDTO stateChangeDTO,Object objectService) {
- checkSingleParam(stateChangeDTO);
- //获取全局状态机中的指定状态机
- Field field = ReflectionUtils.findField(objectService.getClass(), stateChangeDTO.getStateMachineType());
- if (field == null) {
- throw new StateMachineException("在全局状态机中未找到指定状态机");
- }
- //获取需要执行的状态机对象
- Object stateMachineObject = SpringContextHolder.getBean(field.getName());
- try {
- //获取目标执行方法的参数类型
- List> paramTypesList = getMethodParamTypes(stateMachineObject, stateChangeDTO.getEventMethodName());
- //构造目标执行方法
- Method method = ReflectionUtils.findMethod(stateMachineObject.getClass(), stateChangeDTO.getEventMethodName(), paramTypesList.toArray(new Class[paramTypesList.size()]));
- if (stateChangeDTO.getObjectParam().length != paramTypesList.size()) {
- LogUtil.error(LogEnum.STATE_MACHINE, " 目标执行方法参数 {} 与传入的数量不一致 {} ", paramTypesList.size(), stateChangeDTO.getObjectParam().length);
- } else {
- ReflectionUtils.invokeMethod(method, stateMachineObject, stateChangeDTO.getObjectParam());
- }
- } catch (ClassNotFoundException e) {
- LogUtil.error(LogEnum.STATE_MACHINE, "未找到指定类: {} ", e);
- }
- }
-
- /**
- * 代理执行多个状态机的状态切换
- *
- * @param stateChangeDTOList 多个状态机切换信息
- * @param objectService 服务类
- */
- public static void proxyExecutionRelationState(List stateChangeDTOList,Object objectService) {
- if (!CollectionUtils.isEmpty(stateChangeDTOList)) {
- for (StateChangeDTO stateChangeDTO : stateChangeDTOList) {
- proxyExecutionSingleState(stateChangeDTO,objectService);
- }
- }
- }
-
- /**
- * 校验参数是否正常
- *
- * @param stateChangeDTO 数据集状态切换信息
- */
- public static void checkSingleParam(StateChangeDTO stateChangeDTO) {
- if (StringUtils.isEmpty(stateChangeDTO.getStateMachineType())) {
- throw new StateMachineException("未指定状态机类");
- }
- if (StringUtils.isEmpty(stateChangeDTO.getEventMethodName())) {
- throw new StateMachineException("未指定状态机需要执行事件");
- }
- }
-
- /**
- * 根据方法名获取所有参数的类型
- *
- * @param classInstance 类实例
- * @param methodName 方法名
- * @return List> 对象集合
- * @throws ClassNotFoundException
- */
- public static List> getMethodParamTypes(Object classInstance, String methodName) throws ClassNotFoundException {
- List> paramTypes = new ArrayList<>();
- Method[] methods = classInstance.getClass().getMethods();
- for (Method method : methods) {
- if (method.getName().equals(methodName)) {
- Class>[] params = method.getParameterTypes();
- for (Class> classParamType : params) {
- paramTypes.addAll(Collections.singleton((Class) Class.forName(classParamType.getName())));
- }
- break;
- }
- }
- return paramTypes;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/StringUtils.java b/dubhe-server/common/src/main/java/org/dubhe/utils/StringUtils.java
deleted file mode 100644
index 28c8b87..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/StringUtils.java
+++ /dev/null
@@ -1,348 +0,0 @@
-/**
- * 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.utils;
-
-import eu.bitwalker.useragentutils.Browser;
-import eu.bitwalker.useragentutils.UserAgent;
-import org.apache.commons.lang.RandomStringUtils;
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.constant.NumberConstant;
-import org.dubhe.constant.SymbolConstant;
-
-import javax.servlet.http.HttpServletRequest;
-import java.net.InetAddress;
-import java.net.UnknownHostException;
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.UUID;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-/**
- * @description 字符串工具类, 继承org.apache.commons.lang3.StringUtils类
- * @date 2020-03-25
- */
-public class StringUtils extends org.apache.commons.lang3.StringUtils {
-
- private static final char SEPARATOR = '_';
-
- private static final String UNKNOWN = "unknown";
-
- private static Pattern linePattern = Pattern.compile("_(\\w)");
-
-
- /**
- * 驼峰命名法工具
- *
- * @return toCamelCase(" hello_world ") == "helloWorld"
- * toCapitalizeCamelCase("hello_world") == "HelloWorld"
- * toUnderScoreCase("helloWorld") = "hello_world"
- */
- public static String toCamelCase(String s) {
- if (s == null) {
- return null;
- }
-
- s = s.toLowerCase();
-
- StringBuilder sb = new StringBuilder(s.length());
- boolean upperCase = false;
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
-
- if (c == SEPARATOR) {
- upperCase = true;
- } else if (upperCase) {
- sb.append(Character.toUpperCase(c));
- upperCase = false;
- } else {
- sb.append(c);
- }
- }
-
- return sb.toString();
- }
-
- /**
- * 驼峰命名法工具
- *
- * @return toCamelCase(" hello_world ") == "helloWorld"
- * toCapitalizeCamelCase("hello_world") == "HelloWorld"
- * toUnderScoreCase("helloWorld") = "hello_world"
- */
- public static String toCapitalizeCamelCase(String s) {
- if (s == null) {
- return null;
- }
- s = toCamelCase(s);
- return s.substring(0, 1).toUpperCase() + s.substring(1);
- }
-
- /**
- * 驼峰命名法工具
- *
- * @return toCamelCase(" hello_world ") == "helloWorld"
- * toCapitalizeCamelCase("hello_world") == "HelloWorld"
- * toUnderScoreCase("helloWorld") = "hello_world"
- */
- static String toUnderScoreCase(String s) {
- if (s == null) {
- return null;
- }
-
- StringBuilder sb = new StringBuilder();
- boolean upperCase = false;
- for (int i = 0; i < s.length(); i++) {
- char c = s.charAt(i);
-
- boolean nextUpperCase = true;
-
- if (i < (s.length() - 1)) {
- nextUpperCase = Character.isUpperCase(s.charAt(i + 1));
- }
-
- if ((i > 0) && Character.isUpperCase(c)) {
- if (!upperCase || !nextUpperCase) {
- sb.append(SEPARATOR);
- }
- upperCase = true;
- } else {
- upperCase = false;
- }
-
- sb.append(Character.toLowerCase(c));
- }
-
- return sb.toString();
- }
-
-
- /**
- * 获取ip地址
- *
- * @param request
- * @return
- */
- public static String getIp(HttpServletRequest request) {
- String ip = request.getHeader("x-forwarded-for");
- if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
- ip = request.getHeader("Proxy-Client-IP");
- }
- if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
- ip = request.getHeader("WL-Proxy-Client-IP");
- }
- if (ip == null || ip.length() == 0 || UNKNOWN.equalsIgnoreCase(ip)) {
- ip = request.getRemoteAddr();
- }
- String comma = ",";
- String localhost = "127.0.0.1";
- if (ip.contains(comma)) {
- ip = ip.split(",")[0];
- }
- if (localhost.equals(ip)) {
- // 获取本机真正的ip地址
- try {
- ip = InetAddress.getLocalHost().getHostAddress();
- } catch (UnknownHostException e) {
- e.printStackTrace();
- }
- }
- return ip;
- }
-
- public static String getBrowser(HttpServletRequest request) {
- UserAgent userAgent = UserAgent.parseUserAgentString(request.getHeader("User-Agent"));
- Browser browser = userAgent.getBrowser();
- return browser.getName();
- }
-
-
- /**
- * 获得当天是周几
- */
- public static String getWeekDay() {
- String[] weekDays = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"};
- Calendar cal = Calendar.getInstance();
- cal.setTime(new Date());
-
- int w = cal.get(Calendar.DAY_OF_WEEK) - 1;
- if (w < 0) {
- w = 0;
- }
- return weekDays[w];
- }
-
- /**
- * 字符串匹配工具类(正则表达式)
- *
- * @param str
- * @param regexp
- * @return
- */
- public static boolean stringMatch(String str, String regexp) {
- Pattern pattern = Pattern.compile(regexp);
- return pattern.matcher(str).find();
- }
-
- /**
- * 字符串长度不够补位
- *
- * @param sourceStr 源字符串
- * @param length 最终长度
- * @param type 补位方式 0:左边 1:右边
- * @return
- */
- public static String stringFillIn(String sourceStr, int length, int type) {
- if (sourceStr.length() > length) {
- return sourceStr;
- }
- StringBuilder stringBuilder = new StringBuilder("");
- for (int i = 0; i < length - sourceStr.length(); i++) {
- stringBuilder.append("0");
- }
-
- if (type == MagicNumConstant.ZERO) {
- return stringBuilder.toString() + sourceStr;
- } else {
- return sourceStr + stringBuilder.toString();
- }
- }
-
-
- /**
- * 从头截取string字符串
- *
- * @param str 被截取字符串
- * @param truncationIndex 0 -> 截取长度
- * @return
- */
- public static String truncationString(String str, int truncationIndex) {
- if (str == null) {
- return SymbolConstant.BLANK;
- } else if (truncationIndex < 1
- || str.length() <= truncationIndex) {
- return str;
- }
- return str.substring(0, truncationIndex);
- }
-
- /**
- * 字符串驼峰转下划线
- *
- * @param str 被转字符串
- * @return
- */
- public static String humpToLine(String str) {
- StringBuilder stringBuilder = new StringBuilder();
- char[] chars = str.toCharArray();
- for (char charactor : chars) {
- if (Character.isUpperCase(charactor)) {
- stringBuilder.append("_");
- charactor = Character.toLowerCase(charactor);
- }
- stringBuilder.append(charactor);
- }
- return stringBuilder.toString();
- }
-
- /**
- * 字符串下划线转驼峰
- *
- * @param str 被转字符串
- * @return
- */
- public static String lineToHump(String str) {
- str = str.toLowerCase();
- Matcher matcher = linePattern.matcher(str);
- StringBuffer sb = new StringBuffer();
- while (matcher.find()) {
- matcher.appendReplacement(sb, matcher.group(1).toUpperCase());
- }
- matcher.appendTail(sb);
- return sb.toString();
- }
-
-
- /**
- * 字符串截取前
- *
- * @param str
- * @return
- */
- public static String substringBefore(String str, String separator) {
-
- if (!isEmpty(str) && separator != null) {
- if (separator.isEmpty()) {
- return "";
- } else {
- int pos = str.indexOf(separator);
- return pos == -1 ? str : str.substring(0, pos);
- }
- } else {
- return str;
- }
- }
-
- /**
- * 字符串截取后
- *
- * @param str
- * @return
- */
- public static String substringAfter(String str, String separator) {
-
- if (isEmpty(str)) {
- return str;
- } else if (separator == null) {
- return "";
- } else {
- int pos = str.indexOf(separator);
- return pos == -1 ? "" : str.substring(pos + separator.length());
- }
- }
-
- /**
- * 获取UUID字符串
- *
- * @return
- */
- public static String getUUID() {
- return UUID.randomUUID().toString().replace(SymbolConstant.HYPHEN, SymbolConstant.BLANK);
- }
-
- /**
- * 生成4位随机[a-z]字符串
- *
- * @return
- */
- public static String getRandomString() {
- return RandomStringUtils.randomAlphabetic(NumberConstant.NUMBER_4).toLowerCase();
- }
-
- /**
- * 生成时间戳 + 4位随机数
- *
- * @return
- */
- public static String getTimestamp() {
- SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss");
- String dateStr = df.format(System.currentTimeMillis());
- return dateStr + getRandomString();
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/TimeTransferUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/TimeTransferUtil.java
deleted file mode 100644
index 6cb0344..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/TimeTransferUtil.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.utils;
-
-import java.text.SimpleDateFormat;
-import java.util.Calendar;
-import java.util.Date;
-
-import static org.dubhe.base.MagicNumConstant.EIGHT;
-
-/**
- * @description 时间格式转换工具类
- * @date 2020-05-20
- */
-public class TimeTransferUtil {
-
- private static final String UTC_FORMAT = "yyyy-MM-dd'T'HH:mm:ss.sss'Z'";
-
- /**
- * Date转换为UTC时间
- *
- * @param date
- * @return utcTime
- */
- public static String dateTransferToUtc(Date date){
- Calendar calendar = Calendar.getInstance();
- calendar.setTime(date);
- /**UTC时间与CST时间相差8小时**/
- calendar.set(Calendar.HOUR,calendar.get(Calendar.HOUR) - EIGHT);
- SimpleDateFormat utcSimpleDateFormat = new SimpleDateFormat(UTC_FORMAT);
- Date utcDate = calendar.getTime();
- return utcSimpleDateFormat.format(utcDate);
- }
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/UniqueKeyGenerator.java b/dubhe-server/common/src/main/java/org/dubhe/utils/UniqueKeyGenerator.java
deleted file mode 100644
index 465fe04..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/UniqueKeyGenerator.java
+++ /dev/null
@@ -1,130 +0,0 @@
-/**
- * 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.utils;
-
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.atomic.AtomicInteger;
-
-/**
- * @description 唯一码生成器 (依赖时间轴)
- * @date 2020-05-08
- */
-public class UniqueKeyGenerator {
-
- private UniqueKeyGenerator(){
-
- }
-
- /**
- * 累加上限
- */
- private static final int ACCUMULATOR_MAX = 1000;
-
- /**
- * 累加器 format
- */
- private static final String ACCUMULATOR_FORMAT = "%0" + (ACCUMULATOR_MAX+"").length() + "d";
-
- /**
- * 时钟 format
- */
- private static final String DATE_FORMAT = "yyMMddHHmmssSSS";
-
- /**
- * 累加计数器仓库
- *
- * key:prefix
- * value:累加计数器
- */
- private static Map prefixAccumulatorStorage = new ConcurrentHashMap<>();
-
- /**
- * 时间点仓库
- *
- * key:prefix
- * value:DATE_FORMAT 时钟
- */
- private static Map prefixDateStorage = new ConcurrentHashMap<>();
-
- private static String getCurDateStr(){
- DateFormat df = new SimpleDateFormat(DATE_FORMAT);
- return df.format(new Date());
- }
-
- /**
- * 数字前位自动补0
- *
- * @param atomicInteger
- * @return
- */
- private static String getAccumulatorStr(AtomicInteger atomicInteger){
- return String.format(ACCUMULATOR_FORMAT,atomicInteger.intValue());
- }
-
- private static String generateKey(String prefix,String curDateStr,AtomicInteger accumulator){
- return prefix + curDateStr + getAccumulatorStr(accumulator);
- }
-
- /**
- * 生成唯一key
- *
- * @param prefix
- * @return
- */
- public static String generateKey(final String prefix){
- if (prefix == null){
- return null;
- }
- synchronized(prefix){
- String curDateStr = getCurDateStr();
- String prevDateStr = prefixDateStorage.get(prefix);
- if (curDateStr.equals(prevDateStr)){
- AtomicInteger accumulator = prefixAccumulatorStorage.get(prefix);
- if (accumulator.incrementAndGet() >= ACCUMULATOR_MAX){
- return generateKey(prefix);
- }else {
- updateStorage(prefix,curDateStr,accumulator);
- return generateKey(prefix,curDateStr,accumulator);
- }
- }else {
- AtomicInteger accumulator = new AtomicInteger(0);
- updateStorage(prefix,curDateStr,accumulator);
- return generateKey(prefix,curDateStr,accumulator);
- }
- }
- }
-
-
- /**
- * 更新仓库
- *
- * @param prefix
- * @param curDateStr
- * @param accumulator
- */
- private static void updateStorage(String prefix, String curDateStr, AtomicInteger accumulator) {
- prefixAccumulatorStorage.put(prefix,accumulator);
- prefixDateStorage.put(prefix,curDateStr);
- }
-
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/WrapperHelp.java b/dubhe-server/common/src/main/java/org/dubhe/utils/WrapperHelp.java
deleted file mode 100644
index c6fa6f2..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/WrapperHelp.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * 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.utils;
-
-import cn.hutool.core.util.ObjectUtil;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import lombok.extern.slf4j.Slf4j;
-import org.dubhe.annotation.Query;
-
-import java.lang.reflect.Field;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.List;
-
-/**
- * @description 构建Wrapper
- * @date 2020-03-15
- */
-@Slf4j
-public class WrapperHelp {
-
- public static QueryWrapper getWrapper(T query) {
- QueryWrapper queryWrapper = new QueryWrapper<>();
- if (query == null) {
- return queryWrapper;
- }
- try {
- List fields = getAllFields(query.getClass(), new ArrayList<>());
- for (Field field : fields) {
- field.setAccessible(true);
- Query q = field.getAnnotation(Query.class);
- if (q != null) {
- String propName = q.propName();
- String attributeName = isBlank(propName) ? field.getName() : propName;
- Object val = field.get(query);
- if (val == null) {
- continue;
- }
- // 模糊多字段
- String blurry = q.blurry();
- if (ObjectUtil.isNotEmpty(blurry)) {
- String[] blurrys = blurry.split(",");
- queryWrapper.and(qw -> {
- for (int i = 0; i < blurrys.length; i++) {
- if (i == 0) {
- qw.like(blurrys[i], val);
- } else {
- qw.or().like(blurrys[i], val);
- }
- }
- });
- continue;
- }
- switch (q.type()) {
- case EQ:
- queryWrapper = queryWrapper.eq(attributeName, val);
- break;
- case NE:
- queryWrapper = queryWrapper.ne(attributeName, val);
- break;
- case GE:
- queryWrapper = queryWrapper.ge(attributeName, val);
- break;
- case GT:
- queryWrapper = queryWrapper.gt(attributeName, val);
- break;
- case LT:
- queryWrapper = queryWrapper.lt(attributeName, val);
- break;
- case LE:
- queryWrapper = queryWrapper.le(attributeName, val);
- break;
- case BETWEEN:
- List between = new ArrayList<>((List) val);
- queryWrapper = queryWrapper.between(attributeName, between.get(0), between.get(1));
- break;
- case NOT_BETWEEN:
- List notBetween = new ArrayList<>((List) val);
- queryWrapper = queryWrapper.notBetween(attributeName, notBetween.get(0), notBetween.get(1));
- break;
- case LIKE:
- queryWrapper = queryWrapper.like(attributeName, val);
- break;
- case NOT_LIKE:
- queryWrapper = queryWrapper.notLike(attributeName, val);
- break;
- case LIkE_LEFT:
- queryWrapper = queryWrapper.likeLeft(attributeName, val);
- break;
- case LIKE_RIGHT:
- queryWrapper = queryWrapper.likeRight(attributeName, val);
- break;
- case IS_NULL:
- queryWrapper = queryWrapper.isNull(attributeName);
- break;
- case IS_NOT_NULL:
- queryWrapper = queryWrapper.isNotNull(attributeName);
- break;
- case IN:
- queryWrapper = queryWrapper.in(attributeName, (Collection) val);
- break;
- case NOT_IN:
- queryWrapper = queryWrapper.notIn(attributeName, (Collection) val);
- break;
- case INSQL:
- queryWrapper = queryWrapper.inSql(attributeName, String.valueOf(val));
- break;
- case NOT_INSQL:
- queryWrapper = queryWrapper.notInSql(attributeName, String.valueOf(val));
- break;
- case ORDER_BY:
- queryWrapper = queryWrapper.last(" ORDER BY " + val);
- break;
- default:
- break;
- }
- }
- }
- } catch (Exception e) {
- log.error(e.getMessage(), e);
- }
- return queryWrapper;
- }
-
- private static boolean isBlank(final CharSequence cs) {
- int strLen;
- if (cs == null || (strLen = cs.length()) == 0) {
- return true;
- }
- for (int i = 0; i < strLen; i++) {
- if (!Character.isWhitespace(cs.charAt(i))) {
- return false;
- }
- }
- return true;
- }
-
- private static List getAllFields(Class clazz, List fields) {
- if (clazz != null) {
- fields.addAll(Arrays.asList(clazz.getDeclaredFields()));
- getAllFields(clazz.getSuperclass(), fields);
- }
- return fields;
- }
-
-}
diff --git a/dubhe-server/common/src/main/java/org/dubhe/utils/ZipCommonUtil.java b/dubhe-server/common/src/main/java/org/dubhe/utils/ZipCommonUtil.java
deleted file mode 100644
index 2a31df0..0000000
--- a/dubhe-server/common/src/main/java/org/dubhe/utils/ZipCommonUtil.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/**
- * 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.utils;
-
-import net.lingala.zip4j.core.ZipFile;
-import net.lingala.zip4j.exception.ZipException;
-import org.dubhe.enums.LogEnum;
-import org.springframework.stereotype.Component;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.regex.Pattern;
-
-/**
- * @description zip Util
- * @date 2020-5-22
- */
-@Component
-public class ZipCommonUtil {
- public static boolean unzipLocal(String source) {
- if (source == null) {
- return false;
- }
- String[] sourceArr = source.split(Pattern.quote(File.separator));
- int length = sourceArr.length;
- if (length <= 1) {
- return false;
- }
- List destList = new ArrayList<>(Arrays.asList(sourceArr).subList(0, length - 1));
- String destination = String.join(File.separator, destList);
-
- try {
- ZipFile zipFile = new ZipFile(source);
- zipFile.extractAll(destination);
- } catch (ZipException e) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "解压失败: ", e);
- return false;
- }
- return true;
- }
-}
diff --git a/dubhe-server/common/src/main/resources/i18n/messages_en.properties b/dubhe-server/common/src/main/resources/i18n/messages_en.properties
deleted file mode 100644
index a26af0d..0000000
--- a/dubhe-server/common/src/main/resources/i18n/messages_en.properties
+++ /dev/null
@@ -1,51 +0,0 @@
-#\u56fd\u9645\u5316\u4fe1\u606f
-HTTPCODE_207=Your operation frequency is too fast, Please try again later!
-HTTPCODE_200=Http request succeed
-HTTPCODE_303=Login failed
-HTTPCODE_400=Request parameter error
-HTTPCODE_401=Unauthorized, please login
-HTTPCODE_403=Forbidden
-HTTPCODE_404=Page not found
-HTTPCODE_408=Request timeout
-HTTPCODE_409=Conflict
-HTTPCODE_410=Gone
-HTTPCODE_423=Locked
-HTTPCODE_500=Server error
-EMAIL.SET_HOST=Setting system property: mail.smtp.host={}
-EMAIL.PRE_TALK=Ready to get email session object
-EMAIL.ERROR_TALK=Error occurred during getting email session object
-EMAIL.PRE_MIME=Ready to create MIME email object
-EMAIL.ERROR_MIME=Create MIME email object failed
-EMAIL.SET_AUTH=Setting smtp authorization :mail.smtp.auth={}
-EMAIL.SET_SUBJECT=Setting email subject[{}]!
-EMAIL.ERROR_SUBJECT=Error occurred while setting email subject
-EMAIL.ERROR_BODY=Error occured while setting email body
-EMAIL.ADD_ATTEND=Add attach [{}]!
-EMAIL.SET_TO=Setting sendto : [{}]!
-EMAIL.SET_COPYTO=Setting copyto [{}]!
-EMAIL.SENDING=Email is sending...
-EMAIL.SEND_SUCC=Email send succeed
-EMAIL.SEND_ERR=Email send error
-THIRDPARTY.LOGIN.NOTOKEN=Thirdparty token : %s get failed
-IDCARD_ILLEGAL=Idcard is illegal
-EMAIL_ILLEGAL=Email is illegal
-MOBILE_ILLEGAL=Mobile is illegal
-TASKID_IS_NULL=TaskId is null
-LOGIN_FAIL=Incorrect username or password.
-ACCOUNT_IS_NULL=Account is null
-ACCOUNT_LENGTH=Account allowed length: {}-{}.
-PASSWORD_IS_NULL=Password is null
-USER_ID_IS_NULL=UserId is null
-USER_IS_NULL=UserId[%1$s]error.
-ID_IS_NULL=Id is null
-TASKGROUP_IS_NULL=Taskgroup is null
-TASKNAME_IS_NULL=Taskname is null
-KEY_IS_NULL=Key is null
-MENUID_IS_NULL=Menuid is null
-NULL_POINTER_EXCEPTION_HAPPENS_IN_SERVICE_CALL=NULL POINTER EXCEPTION HAPPENS IN SERVICE CALL
-SYS.EIXST_ROLE_CODE=ROLE CODE ALREADY EXISTS
-DELETE_ROLE_ERROR=This role has user, delete failed
-DEPARTMENT_ALREADY_EXIST=Department already exist
-EXIST_SUBDEPARTMENT_OF_THIS_DEPARTMENT=Exist subdeptment of this department
-EXIST_USER_OF_THIS_DEPARTMENT=Exist user of this department
-HAS_SUB_LOCATIONS=Exist subLocation of this location
diff --git a/dubhe-server/common/src/main/resources/i18n/messages_zh.properties b/dubhe-server/common/src/main/resources/i18n/messages_zh.properties
deleted file mode 100644
index 0980220..0000000
--- a/dubhe-server/common/src/main/resources/i18n/messages_zh.properties
+++ /dev/null
@@ -1,51 +0,0 @@
-#\u56fd\u9645\u5316\u4fe1\u606f
-HTTPCODE_207=\u60a8\u7684\u64cd\u4f5c\u9891\u7387\u8fc7\u5feb\uff0c\u8bf7\u7a0d\u540e\u518d\u8bd5!
-HTTPCODE_200=\u8bf7\u6c42\u6210\u529f
-HTTPCODE_303=\u767b\u5f55\u5931\u8d25
-HTTPCODE_400=\u8bf7\u6c42\u53c2\u6570\u51fa\u9519
-HTTPCODE_401=\u6ca1\u6709\u767b\u5f55
-HTTPCODE_403=\u6ca1\u6709\u6743\u9650
-HTTPCODE_404=\u627e\u4e0d\u5230\u9875\u9762
-HTTPCODE_408=\u8bf7\u6c42\u8d85\u65f6
-HTTPCODE_409=\u53d1\u751f\u51b2\u7a81
-HTTPCODE_410=\u5df2\u88ab\u5220\u9664
-HTTPCODE_423=\u5df2\u88ab\u9501\u5b9a
-HTTPCODE_500=\u670d\u52a1\u5668\u51fa\u9519
-EMAIL.SET_HOST=\u8bbe\u7f6e\u7cfb\u7edf\u5c5e\u6027\uff1amail.smtp.host={}
-EMAIL.PRE_TALK=\u51c6\u5907\u83b7\u53d6\u90ae\u4ef6\u4f1a\u8bdd\u5bf9\u8c61\uff01
-EMAIL.ERROR_TALK=\u83b7\u53d6\u90ae\u4ef6\u4f1a\u8bdd\u5bf9\u8c61\u65f6\u53d1\u751f\u9519\u8bef\uff01
-EMAIL.PRE_MIME=\u51c6\u5907\u521b\u5efaMIME\u90ae\u4ef6\u5bf9\u8c61\uff01
-EMAIL.ERROR_MIME=\u521b\u5efaMIME\u90ae\u4ef6\u5bf9\u8c61\u5931\u8d25\uff01
-EMAIL.SET_AUTH=\u8bbe\u7f6esmtp\u8eab\u4efd\u8ba4\u8bc1\uff1amail.smtp.auth={}
-EMAIL.SET_SUBJECT=\u8bbe\u7f6e\u90ae\u4ef6\u4e3b\u9898[{}]\uff01
-EMAIL.ERROR_SUBJECT=\u8bbe\u7f6e\u90ae\u4ef6\u4e3b\u9898\u53d1\u751f\u9519\u8bef\uff01
-EMAIL.ERROR_BODY=\u8bbe\u7f6e\u90ae\u4ef6\u6b63\u6587\u65f6\u53d1\u751f\u9519\u8bef\uff01
-EMAIL.ADD_ATTEND=\u589e\u52a0\u90ae\u4ef6\u9644\u4ef6[{}]\uff01
-EMAIL.SET_TO=\u8bbe\u7f6e\u6536\u4fe1\u4eba[{}]\uff01
-EMAIL.SET_COPYTO=\u8bbe\u7f6e\u6284\u9001\u4eba[{}]\uff01
-EMAIL.SENDING=\u6b63\u5728\u53d1\u9001\u90ae\u4ef6....
-EMAIL.SEND_SUCC=\u53d1\u9001\u90ae\u4ef6\u6210\u529f\uff01
-EMAIL.SEND_ERR=\u90ae\u4ef6\u53d1\u9001\u5931\u8d25\uff01
-THIRDPARTY.LOGIN.NOTOKEN=\u672a\u83b7\u53d6\u5230%s\u767b\u5f55\u4ee4\u724c\uff01
-IDCARD_ILLEGAL=\u8eab\u4efd\u8bc1\u53f7\u7801\u9519\u8bef.
-EMAIL_ILLEGAL=\u90ae\u7bb1\u683c\u5f0f\u9519\u8bef.
-MOBILE_ILLEGAL=\u624b\u673a\u53f7\u683c\u5f0f\u9519\u8bef.
-TASKID_IS_NULL=\u5b9a\u65f6\u4efb\u52a1Id\u4e0d\u80fd\u4e3a\u7a7a.
-LOGIN_FAIL=\u7528\u6237\u540d\u6216\u5bc6\u7801\u9519\u8bef.
-ACCOUNT_IS_NULL=\u5e10\u53f7\u4e0d\u80fd\u4e3a\u7a7a.
-ACCOUNT_LENGTH=\u5e10\u53f7\u5141\u8bb8\u957f\u5ea6\u8303\u56f4{}-{}.
-PASSWORD_IS_NULL=\u5bc6\u7801\u4e0d\u80fd\u4e3a\u7a7a.
-USER_ID_IS_NULL=\u7528\u6237ID\u4e0d\u80fd\u4e3a\u7a7a.
-USER_IS_NULL=\u7528\u6237Id[%1$s]\u9519\u8bef.
-ID_IS_NULL=Id\u4e0d\u80fd\u4e3a\u7a7a.
-TASKGROUP_IS_NULL=\u4efb\u52a1\u7ec4\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a.
-TASKNAME_IS_NULL=\u4efb\u52a1\u540d\u79f0\u4e0d\u80fd\u4e3a\u7a7a.
-KEY_IS_NULL=\u952e\u503c\u4e3a\u7a7a
-MENUID_IS_NULL=\u6b63\u5728\u64cd\u4f5c\u83dc\u5355id\u4e0d\u80fd\u4e3a\u7a7a
-DELETE_ROLE_ERROR=\u8be5\u89d2\u8272\u5df2\u88ab\u7528\u6237\u5173\u8054\u4e0d\u652f\u6301\u5220\u9664
-NULL_POINTER_EXCEPTION_HAPPENS_IN_SERVICE_CALL=\u670d\u52a1\u8c03\u7528\u53d1\u751f\u7a7a\u6307\u9488\u5f02\u5e38
-SYS.EIXST_ROLE_CODE=\u89d2\u8272\u7f16\u7801\u91cd\u590d
-DEPARTMENT_ALREADY_EXIST=\u90e8\u95e8\u5df2\u5b58\u5728
-EXIST_SUBDEPARTMENT_OF_THIS_DEPARTMENT=\u8be5\u90e8\u95e8\u4e0b\u5b58\u5728\u5b50\u90e8\u95e8
-EXIST_USER_OF_THIS_DEPARTMENT=\u8be5\u90e8\u95e8\u4e0b\u5b58\u5728\u7528\u6237
-HAS_SUB_LOCATIONS=\u8be5\u5730\u70b9\u4e0b\u542b\u6709\u5b50\u8282\u70b9
diff --git a/dubhe-server/common/src/test/java/org/dubhe/EncryptUtilsTest.java b/dubhe-server/common/src/test/java/org/dubhe/EncryptUtilsTest.java
deleted file mode 100644
index c6f5c9f..0000000
--- a/dubhe-server/common/src/test/java/org/dubhe/EncryptUtilsTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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;
-
-import org.junit.Test;
-
-import static org.dubhe.utils.EncryptUtils.desDecrypt;
-import static org.dubhe.utils.EncryptUtils.desEncrypt;
-import static org.junit.Assert.assertEquals;
-/**
- * @description 对称加密|解密
- * @date 2020-03-25
- */
-public class EncryptUtilsTest {
-
- /**
- * 对称加密
- */
- @Test
- public void testDesEncrypt() {
- try {
- assertEquals("7772841DC6099402", desEncrypt("123456"));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- /**
- * 对称解密
- */
- @Test
- public void testDesDecrypt() {
- try {
- assertEquals("123456", desDecrypt("7772841DC6099402"));
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-}
diff --git a/dubhe-server/common/src/test/java/org/dubhe/FileUtilTest.java b/dubhe-server/common/src/test/java/org/dubhe/FileUtilTest.java
deleted file mode 100644
index 61119be..0000000
--- a/dubhe-server/common/src/test/java/org/dubhe/FileUtilTest.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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;
-
-import org.junit.Test;
-import org.springframework.mock.web.MockMultipartFile;
-
-import static org.dubhe.utils.FileUtil.*;
-import static org.junit.Assert.assertEquals;
-/**
- * @description 测试类
- * @date 2020-03-25
- */
-public class FileUtilTest {
-
- @Test
- public void testToFile() {
- long retval = toFile(new MockMultipartFile("foo", (byte[]) null)).getTotalSpace();
- assertEquals(500695072768L, retval);
- }
-
- @Test
- public void testGetExtensionName() {
- assertEquals("foo", getExtensionName("foo"));
- assertEquals("exe", getExtensionName("bar.exe"));
- }
-
- @Test
- public void testGetFileNameNoEx() {
- assertEquals("foo", getFileNameNoEx("foo"));
- assertEquals("bar", getFileNameNoEx("bar.txt"));
- }
-
- @Test
- public void testGetSize() {
- assertEquals("1000B ", getSize(1000));
- assertEquals("1.00KB ", getSize(1024));
- assertEquals("1.00MB ", getSize(1048576));
- assertEquals("1.00GB ", getSize(1073741824));
- }
-}
diff --git a/dubhe-server/common/src/test/java/org/dubhe/HttpUtilsTest.java b/dubhe-server/common/src/test/java/org/dubhe/HttpUtilsTest.java
deleted file mode 100644
index 40be6b7..0000000
--- a/dubhe-server/common/src/test/java/org/dubhe/HttpUtilsTest.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-import static org.dubhe.utils.HttpUtils.isSuccess;
-
-/**
- * @description HttpUtil
- * @date 2020-04-30
- */
-public class HttpUtilsTest {
-
- @Test
- public void testIsSuccess() {
- Assert.assertTrue(isSuccess("200"));
- Assert.assertFalse(isSuccess("2020"));
- Assert.assertFalse(isSuccess("401"));
- Assert.assertFalse(isSuccess(null));
- Assert.assertFalse(isSuccess(""));
- Assert.assertTrue(isSuccess(200));
- }
-
-
-}
diff --git a/dubhe-server/common/src/test/java/org/dubhe/StringUtilsTest.java b/dubhe-server/common/src/test/java/org/dubhe/StringUtilsTest.java
deleted file mode 100644
index 5264e93..0000000
--- a/dubhe-server/common/src/test/java/org/dubhe/StringUtilsTest.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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;
-
-import org.dubhe.utils.StringUtils;
-import org.junit.Test;
-import org.springframework.mock.web.MockHttpServletRequest;
-
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import static org.dubhe.utils.StringUtils.*;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-/**
- * @description 测试类
- * @date 2020-03-25
- */
-public class StringUtilsTest {
-
- @Test
- public void testToCamelCase() {
- assertNull(toCamelCase(null));
- }
-
- @Test
- public void testToCapitalizeCamelCase() {
- assertNull(StringUtils.toCapitalizeCamelCase(null));
- assertEquals("HelloWorld", toCapitalizeCamelCase("hello_world"));
- }
-
- @Test
- public void testGetWeekDay() {
- SimpleDateFormat simpleDateformat = new SimpleDateFormat("E");
- assertEquals(simpleDateformat.format(new Date()), getWeekDay());
- }
-
- @Test
- public void testGetIp() {
- assertEquals("127.0.0.1", getIp(new MockHttpServletRequest()));
- }
-
- @Test
- public void truncationString() {
- assertEquals("", StringUtils.truncationString(null,6));
- assertEquals("012345", StringUtils.truncationString("012345",0));
- assertEquals("0", StringUtils.truncationString("012345",1));
- assertEquals("012345", StringUtils.truncationString("012345",6));
- }
-}
diff --git a/dubhe-server/common/src/test/java/org/dubhe/utils/AesUtilTest.java b/dubhe-server/common/src/test/java/org/dubhe/utils/AesUtilTest.java
deleted file mode 100644
index b308dcc..0000000
--- a/dubhe-server/common/src/test/java/org/dubhe/utils/AesUtilTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.utils;
-
-import org.junit.Assert;
-import org.junit.Test;
-
-/**
- * @desc
- * @date 2020.06.01
- */
-public class AesUtilTest {
-
- @Test
- public void encryptAndDecrypt(){
- String data = "20200601163000";
- String key = "123412asdsad";
- String val = AesUtil.encrypt(data,key);
- System.out.println(val);
- Assert.assertEquals(data, AesUtil.decrypt(val,key));
- }
-}
diff --git a/dubhe-server/common/src/test/java/org/dubhe/utils/NotebookBizExceptionTest.java b/dubhe-server/common/src/test/java/org/dubhe/utils/NotebookBizExceptionTest.java
deleted file mode 100644
index b667dd5..0000000
--- a/dubhe-server/common/src/test/java/org/dubhe/utils/NotebookBizExceptionTest.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.utils;
-
-import com.alibaba.fastjson.JSON;
-import lombok.extern.slf4j.Slf4j;
-import org.dubhe.exception.NotebookBizException;
-import org.junit.Test;
-
-/**
- * @desc
- * @date 2020.06.16
- */
-@Slf4j
-public class NotebookBizExceptionTest {
-
- @Test
- public void toStringTest() {
- try {
- throw new NotebookBizException("NotebookBizException toString Test");
- }catch (NotebookBizException e){
- log.error("{}", e);
- }
- }
-}
diff --git a/dubhe-server/common/src/test/java/org/dubhe/utils/ReadFileTest.java b/dubhe-server/common/src/test/java/org/dubhe/utils/ReadFileTest.java
deleted file mode 100644
index a7369e2..0000000
--- a/dubhe-server/common/src/test/java/org/dubhe/utils/ReadFileTest.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * 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.utils;
-
-import org.junit.Test;
-
-import java.util.Arrays;
-import java.util.List;
-
-import static org.junit.Assert.assertEquals;
-
-/**
- * @description
- * @create: 2020-05-07
- */
-public class ReadFileTest {
-
- @Test
- public void testRead(){
- String path = "/Users/lizhe/hello2.log";
- List ans = Arrays.asList("lin1", "l2", "l3", "l4");
- List ans2 = ans.subList(1, 3);
- assertEquals(ans, ReadFile.read(path,-2, 10));
- assertEquals(ans2, ReadFile.read(path, 1, 2));
- }
-}
diff --git a/dubhe-server/common/src/test/java/org/dubhe/utils/ZipUtilTest.java b/dubhe-server/common/src/test/java/org/dubhe/utils/ZipUtilTest.java
deleted file mode 100644
index 9ff3c93..0000000
--- a/dubhe-server/common/src/test/java/org/dubhe/utils/ZipUtilTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.utils;
-
-import org.junit.Test;
-/**
- * @description
- * @date 2020-05-25
- */
-public class ZipUtilTest {
- @Test
- public void testUnzip(){
- ZipCommonUtil.unzipLocal("Z:\\dubhe-dev\\undefined\\a1.zip");
- }
-}
-
diff --git a/dubhe-server/deploy-docker.sh b/dubhe-server/deploy-docker.sh
deleted file mode 100644
index 6ae01a9..0000000
--- a/dubhe-server/deploy-docker.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-#环境,用以区分部署的命名空间,日志路径
-ENV=$1
-
-SOURCE_CODE_PATH=$(cd $(dirname ${BASH_SOURCE[0]}); pwd )
-#harbor 地址
-HARBOR_URL=harbor.dubhe.ai
-#harbor 用户名
-HARBOR_USERNAME=admin
-#harbor 密码
-HARBOR_PWD=123456
-#nfs 地址
-NFS_ADDRESS=127.0.0.1
-#nfs 服务器 root权限用户名
-NFS_HOST_USER=root
-#nfs 服务器 root权限用户密码
-NFS_HOST_PWD=123456
-#nfs 共享目录
-NFS_PATH=/nfs
-#容器日志路径
-CONTAINER_LOG_PATH=/logs
-#宿主机日志路径
-HOST_LOG_PATH=/logs/dubhe-${ENV}
-#admin模块端口
-ADMIN_PORT=8000
-#serving-gateway模块端口
-GATEWAY_PORT=8081
-
-#挂载nfs
-mount_nfs() {
- mkdir ${NFS_PATH}
- mount -t nfs ${NFS_ADDRESS}:${NFS_PATH} ${NFS_PATH}
-}
-
-update_dockerfile() {
- cd ${SOURCE_CODE_PATH} && sed -i "s#nfs-host-pwd#${NFS_HOST_PWD}#g;s#nfs-host-user#${NFS_HOST_USER}#g;s#nfs-host-ip#${NFS_ADDRESS}#g" Dockerfile
-}
-mvn_build() {
- cd ${SOURCE_CODE_PATH} && mvn clean compile package
- cd ${SOURCE_CODE_PATH}/dubhe-serving-gateway && mvn clean compile package
-}
-#删除镜像
-delete_old_image() {
- docker rmi -f ${HARBOR_URL}/dubhe/dubhe-spring:${ENV}
-}
-#构建镜像
-build_image() {
- cd ${SOURCE_CODE_PATH} && docker build -t ${HARBOR_URL}/dubhe/dubhe-spring:${ENV} .
-}
-
-#运行admin模块
-run_admin() {
- docker run -d -v ${HOST_LOG_PATH}:${CONTAINER_LOG_PATH} -v ${NFS_PATH}:${NFS_PATH} -v /var/run/docker.sock:/var/run/docker.sock -p ${ADMIN_PORT}:${ADMIN_PORT} ${HARBOR_URL}/dubhe/dubhe-spring:${ENV} java -jar /dubhe/dubhe-admin-1.0-exec.jar --spring.profiles.active=${ENV} 2>&1 > /dev/null
-}
-#运行task模块
-run_task() {
- docker run -d -v ${HOST_LOG_PATH}:${CONTAINER_LOG_PATH} -v ${NFS_PATH}:${NFS_PATH} -v /var/run/docker.sock:/var/run/docker.sock ${HARBOR_URL}/dubhe/dubhe-spring:${ENV} java -jar /dubhe/dubhe-task-1.0.jar --spring.profiles.active=${ENV} 2>&1 > /dev/null
-}
-#运行serving-gateway模块
-run_gateway() {
- docker run -d -v ${HOST_LOG_PATH}:${CONTAINER_LOG_PATH} -v ${NFS_PATH}:${NFS_PATH} -v /var/run/docker.sock:/var/run/docker.sock -p ${GATEWAY_PORT}:${GATEWAY_PORT} ${HARBOR_URL}/dubhe/dubhe-spring:${ENV} java -jar /dubhe/dubhe-serving-gateway.jar --spring.profiles.active=${ENV} 2>&1 > /dev/null
-}
-
-mount_nfs
-update_dockerfile
-mvn_build
-delete_old_image
-build_image
-run_admin
-run_task
-run_gateway
diff --git a/dubhe-server/deploy.sh b/dubhe-server/deploy.sh
deleted file mode 100644
index 89d6d9b..0000000
--- a/dubhe-server/deploy.sh
+++ /dev/null
@@ -1,71 +0,0 @@
-#!/bin/bash
-
-PROG_NAME=$0
-ACTION=$1
-ENV=$2
-APP_HOME=$3
-
-APP_NAME=dubhe-${ENV}
-
-APP_HOME=$APP_HOME/${APP_NAME} # 从package.tgz中解压出来的jar包放到这个目录下
-JAR_NAME=${APP_HOME}/dubhe-admin/target/dubhe-admin-1.0-exec.jar # jar包的名字
-JAVA_OUT=/dev/null
-
-# 创建出相关目录
-mkdir -p ${APP_HOME}
-mkdir -p ${APP_HOME}/logs
-
-usage() {
- echo "Usage: $PROG_NAME {start|stop|restart} {dev|test|prod}"
- exit 2
-}
-
-start_application() {
- echo "starting java process"
- echo "nohup java -Dfile.encoding=utf-8 -jar ${JAR_NAME} > ${JAVA_OUT} --spring.profiles.active=${ENV} 2>&1 &"
- nohup java -Dfile.encoding=utf-8 -jar ${JAR_NAME} > ${JAVA_OUT} --spring.profiles.active=${ENV} 2>&1 &
- echo "started java process"
-}
-
-stop_application() {
- checkjavapid=`ps -ef | grep java | grep ${APP_NAME} | grep -v grep |grep -v 'deploy.sh'| awk '{print$2}'`
-
- if [ -z $checkjavapid ];then
- echo -e "\rno java process "$checkjavapid
- return
- fi
-
- echo "stop java process"
- times=60
- for e in $(seq 60)
- do
- sleep 1
- COSTTIME=$(($times - $e ))
- checkjavapid=`ps -ef | grep java | grep ${APP_NAME} | grep -v grep |grep -v 'deploy.sh'| awk '{print$2}'`
- if [ "$checkjavapid" != "" ];then
- echo "kill "$checkjavapid
- kill -9 $checkjavapid
- echo -e "\r -- stopping java lasts `expr $COSTTIME` seconds."
- else
- echo -e "\rjava process has exited"
- break;
- fi
- done
- echo ""
-}
-
-case "$ACTION" in
- start)
- start_application
- ;;
- stop)
- stop_application
- ;;
- restart)
- stop_application
- start_application
- ;;
- *)
- usage
- ;;
-esac
diff --git a/dubhe-server/dubhe-admin/pom.xml b/dubhe-server/dubhe-admin/pom.xml
deleted file mode 100644
index 8a4c76e..0000000
--- a/dubhe-server/dubhe-admin/pom.xml
+++ /dev/null
@@ -1,102 +0,0 @@
-
-
-
- dubheplatform
- zhejianglab
- 1.0
-
- 4.0.0
-
- dubhe-admin
- 平台管理
-
- 0.10.6
- dubhe
-
-
-
- zhejianglab
- common
- 1.0
-
-
- zhejianglab
- dubhe-system
- 1.0
-
-
- zhejianglab
- common
-
-
-
-
- zhejianglab
- dubhe-model
- 1.0
-
-
- zhejianglab
- common
-
-
-
-
- zhejianglab
- dubhe-k8s
- 1.0
-
-
- zhejianglab
- common
-
-
-
-
- zhejianglab
- dubhe-dcm
- 1.0
-
-
- zhejianglab
- common
-
-
-
-
- zhejianglab
- dubhe-serving
- 1.0
-
-
- zhejianglab
- common
-
-
-
-
-
-
-
-
- org.springframework.boot
- spring-boot-maven-plugin
-
- false
- true
- exec
-
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
- true
-
-
-
-
-
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/AppRun.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/AppRun.java
deleted file mode 100644
index 58e3188..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/AppRun.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/**
- * 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;
-
-import org.dubhe.utils.SpringContextHolder;
-import org.mybatis.spring.annotation.MapperScan;
-import org.springframework.boot.SpringApplication;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
-import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
-import org.springframework.context.annotation.Bean;
-import org.springframework.scheduling.annotation.EnableAsync;
-import org.springframework.scheduling.annotation.EnableScheduling;
-import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
-import org.springframework.transaction.annotation.EnableTransactionManagement;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @description 访问首页提示
- * @date 2020-03-05
- */
-@EnableAsync
-@RestController
-@SpringBootApplication
-@EnableTransactionManagement
-@EnableScheduling
-@MapperScan("org.dubhe.**.dao")
-public class AppRun {
-
- public static void main(String[] args) {
- SpringApplication.run(AppRun.class, args);
- }
-
- @Bean
- public SpringContextHolder springContextHolder() {
- return new SpringContextHolder();
- }
-
- @Bean
- public ServletWebServerFactory webServerFactory() {
- TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();
- fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}"));
- return fa;
- }
-
- @Bean
- public BCryptPasswordEncoder passwordEncoder() {
- return new BCryptPasswordEncoder();
- }
-
- /**
- * 访问首页提示
- *
- * @return /
- */
- @GetMapping("/")
- public String index() {
- return "Backend service started successfully";
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/HarborImagePushAsync.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/HarborImagePushAsync.java
deleted file mode 100644
index eae4676..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/HarborImagePushAsync.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * 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.async;
-
-import cn.hutool.core.util.StrUtil;
-import org.dubhe.base.ResponseCode;
-import org.dubhe.config.TrainHarborConfig;
-import org.dubhe.dao.PtImageMapper;
-import org.dubhe.domain.entity.PtImage;
-import org.dubhe.enums.ImageStateEnum;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.exception.BusinessException;
-import org.dubhe.harbor.api.HarborApi;
-import org.dubhe.utils.IOUtil;
-import org.dubhe.utils.LogUtil;
-import org.dubhe.utils.StringUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-
-/**
- * @description 异步推送镜像到harbor
- * @date 2020-07-10
- */
-@Component
-public class HarborImagePushAsync {
-
- @Autowired
- private TrainHarborConfig trainHarborConfig;
-
- @Autowired
- private HarborApi harborApi;
-
- @Autowired
- private PtImageMapper ptImageMapper;
-
- /**
- * 组装shell脚本执行命令
- *
- * @param imagePath
- * @param imageNameandTag
- **/
- @Async
- public void execShell(String imagePath, String imageNameandTag, PtImage ptImage) {
- try {
- String imageResource = trainHarborConfig.getAddress() + StrUtil.SLASH + ptImage.getProjectName()
- + StrUtil.SLASH + imageNameandTag;
- String cmdStr = "docker login --username=" + trainHarborConfig.getUsername() + " " + trainHarborConfig.getAddress() + " --password=" + trainHarborConfig.getPassword() + " ; docker " +
- "load < " + imagePath + " |awk '{print $3}' |xargs -I str docker tag str " + imageResource + " ; docker push " + imageResource + "; docker rmi " + imageResource;
- String[] cmd = {"/bin/bash", "-c", cmdStr};
- LogUtil.info(LogEnum.BIZ_TRAIN, "镜像上传执行脚本参数:{}", cmd);
-
- Process process = Runtime.getRuntime().exec(cmd);
- if (checkImagePushIsOk(ptImage, process)) {
- updateImageStatus(ptImage, ImageStateEnum.SUCCESS.getCode());
- } else {
- updateImageStatus(ptImage, ImageStateEnum.FAIL.getCode());
- }
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "上传镜像异常:{}", e);
- updateImageStatus(ptImage, ImageStateEnum.FAIL.getCode());
- throw new BusinessException("上传镜像异常!");
-
- }
- }
-
- /**
- * 更新镜像上传状态
- *
- * @param ptImage
- * @param status
- * @return java.lang.Integer
- **/
- public Integer updateImageStatus(PtImage ptImage, Integer status) {
- ptImage.setImageStatus(status);
- ptImageMapper.updateById(ptImage);
- return ResponseCode.SUCCESS;
- }
-
-
- /**
- * 校验镜像是否上传成功
- *
- * @param ptImage 镜像信息
- * @param process process对象
- * @return 是否上传成功
- */
- public boolean checkImagePushIsOk(PtImage ptImage, Process process) {
- //读取标准输出流
- BufferedReader brOut = new BufferedReader(new InputStreamReader(process.getInputStream()));
- //读取标准错误流
- BufferedReader brErr = new BufferedReader(new InputStreamReader(process.getErrorStream()));
- String line;
- StringBuilder outMessage = new StringBuilder();
- StringBuilder errMessage = new StringBuilder();
- boolean isPushOk = true;
- try {
- while ((line = brOut.readLine()) != null) {
- outMessage.append(line);
- }
- if (StringUtils.isNotEmpty(outMessage)) {
- LogUtil.info(LogEnum.BIZ_TRAIN, "shell上传镜像输出信息:{}", outMessage.toString());
- }
- while ((line = brErr.readLine()) != null) {
- errMessage.append(line);
- }
- if (StringUtils.isNotEmpty(errMessage)) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "shell上传镜像异常信息:{}", errMessage.toString());
- }
- Integer status = process.waitFor();
- LogUtil.info(LogEnum.BIZ_TRAIN, "上传镜像状态:{}", status);
- if (status == null) {
- if (!harborApi.isExistImage(ptImage.getImageUrl())) {
- isPushOk = false;
- }
- } else if (status != 0) {
- isPushOk = false;
- }
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "上传镜像异常:{}", e);
- return false;
- } finally {
- IOUtil.close(brErr, brOut);
- }
- return isPushOk;
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/StopTrainJobAsync.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/StopTrainJobAsync.java
deleted file mode 100644
index 3bd6783..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/StopTrainJobAsync.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/**
- * 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.async;
-
-import org.dubhe.config.TrainJobConfig;
-import org.dubhe.dao.PtTrainJobMapper;
-import org.dubhe.domain.dto.UserDTO;
-import org.dubhe.domain.entity.PtTrainJob;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.enums.TrainJobStatusEnum;
-import org.dubhe.enums.TrainTypeEnum;
-import org.dubhe.k8s.api.DistributeTrainApi;
-import org.dubhe.k8s.api.PodApi;
-import org.dubhe.k8s.api.TrainJobApi;
-import org.dubhe.k8s.domain.resource.BizPod;
-import org.dubhe.utils.*;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-
-import java.time.LocalDateTime;
-import java.time.ZoneOffset;
-import java.time.format.DateTimeFormatter;
-import java.util.List;
-import java.util.function.Consumer;
-
-/**
- * @description 停止训练任务异步处理
- * @date 2020-08-13
- */
-@Component
-public class StopTrainJobAsync {
-
- @Autowired
- private K8sNameTool k8sNameTool;
-
- @Autowired
- private PodApi podApi;
-
- @Autowired
- private TrainJobApi trainJobApi;
-
- @Autowired
- private TrainJobConfig trainJobConfig;
-
- @Autowired
- private DistributeTrainApi distributeTrainApi;
-
- @Autowired
- private PtTrainJobMapper ptTrainJobMapper;
-
- /**
- * 停止任务
- *
- * @param currentUser 用户
- * @param jobList 任务集合
- */
- @Async("trainExecutor")
- public void stopJobs(UserDTO currentUser, List jobList) {
- String namespace = k8sNameTool.generateNamespace(currentUser.getId());
- jobList.forEach(job -> {
- BizPod bizPod = podApi.getWithResourceName(namespace, job.getJobName());
- if (!bizPod.isSuccess()) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "User {} stops training Job return code:{},message:{}", currentUser.getUsername(), Integer.valueOf(bizPod.getCode()), bizPod.getMessage());
- }
- boolean bool = TrainTypeEnum.isDistributeTrain(job.getTrainType()) ?
- distributeTrainApi.deleteByResourceName(namespace, job.getJobName()).isSuccess() :
- trainJobApi.delete(namespace, job.getJobName());
- if (!bool) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "User {} stops training Job and K8S fails in the stop process, namespace为{}, resourceName为{}",
- currentUser.getUsername(), namespace, job.getJobName());
- }
- //更新训练状态
- job.setRuntime(calculateRuntime(bizPod))
- .setTrainStatus(TrainJobStatusEnum.STOP.getStatus());
- ptTrainJobMapper.updateById(job);
-
- });
- }
-
-
- /**
- * 计算job训练时长
- *
- * @param bizPod pod信息
- * @return String 训练时长
- */
- private String calculateRuntime(BizPod bizPod) {
- return calculateRuntime(bizPod, (x) -> {
- });
- }
-
-
- /**
- * 计算job训练时长
- *
- * @param bizPod
- * @param consumer pod已经完成状态的回调函数
- * @return res 返回训练时长
- */
- private String calculateRuntime(BizPod bizPod, Consumer consumer) {
- Long completedTime;
- if (StringUtils.isBlank(bizPod.getStartTime())) {
- return TrainUtil.INIT_RUNTIME;
- }
- Long startTime = transformTime(bizPod.getStartTime());
- boolean hasCompleted = StringUtils.isNotBlank(bizPod.getCompletedTime());
- completedTime = hasCompleted ? transformTime(bizPod.getCompletedTime()) : LocalDateTime.now().toEpochSecond(ZoneOffset.of(trainJobConfig.getPlusEight()));
- Long time = completedTime - startTime;
- String res = DubheDateUtil.convert2Str(time);
- if (hasCompleted) {
- consumer.accept(res);
- }
- return res;
- }
-
-
- /**
- * 时间转换
- *
- * @param time 时间
- * @return Long 时间戳
- */
- private Long transformTime(String time) {
- LocalDateTime localDateTime = LocalDateTime.parse(time, DateTimeFormatter.ISO_OFFSET_DATE_TIME);
- //没有根据时区做处理, 默认当前为东八区
- localDateTime = localDateTime.plusHours(Long.valueOf(trainJobConfig.getEight()));
- return localDateTime.toEpochSecond(ZoneOffset.of(trainJobConfig.getPlusEight()));
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/TrainAlgorithmUploadAsync.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/TrainAlgorithmUploadAsync.java
deleted file mode 100644
index 843ad9a..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/TrainAlgorithmUploadAsync.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * 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.async;
-
-import org.dubhe.config.NfsConfig;
-import org.dubhe.dao.PtTrainAlgorithmMapper;
-import org.dubhe.domain.dto.PtTrainAlgorithmCreateDTO;
-import org.dubhe.domain.dto.UserDTO;
-import org.dubhe.domain.entity.PtTrainAlgorithm;
-import org.dubhe.enums.AlgorithmStatusEnum;
-import org.dubhe.enums.BizNfsEnum;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.exception.BusinessException;
-import org.dubhe.service.NoteBookService;
-import org.dubhe.utils.K8sNameTool;
-import org.dubhe.utils.LocalFileUtil;
-import org.dubhe.utils.LogUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.scheduling.annotation.Async;
-import org.springframework.stereotype.Component;
-
-/**
- * @description 异步上传算法
- * @date 2020-08-10
- */
-@Component
-public class TrainAlgorithmUploadAsync {
-
- @Autowired
- private LocalFileUtil localFileUtil;
-
- @Autowired
- private NfsConfig nfsConfig;
-
- @Autowired
- private K8sNameTool k8sNameTool;
-
- @Autowired
- private NoteBookService noteBookService;
-
- @Autowired
- private PtTrainAlgorithmMapper trainAlgorithmMapper;
-
- /**
- * 异步任务创建算法
- *
- * @param user 当前登录用户信息
- * @param ptTrainAlgorithm 算法信息
- * @param trainAlgorithmCreateDTO 创建算法条件
- */
- @Async("trainExecutor")
- public void createTrainAlgorithm(UserDTO user, PtTrainAlgorithm ptTrainAlgorithm, PtTrainAlgorithmCreateDTO trainAlgorithmCreateDTO) {
- String path = nfsConfig.getBucket() + trainAlgorithmCreateDTO.getCodeDir();
- //校验创建算法来源(true:由fork创建算法,false:其它创建算法方式),若为true则拷贝预置算法文件至新路径
- if (trainAlgorithmCreateDTO.getFork()) {
- //生成算法相对路径
- String algorithmPath = k8sNameTool.getNfsPath(BizNfsEnum.ALGORITHM, user.getId());
- //拷贝预置算法文件夹
- boolean copyResult = localFileUtil.copyPath(path, nfsConfig.getBucket() + algorithmPath);
- if (!copyResult) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "The user {} copied the preset algorithm path {} successfully", user.getUsername(), path);
- updateTrainAlgorithm(ptTrainAlgorithm, trainAlgorithmCreateDTO, false);
- throw new BusinessException("内部错误");
- }
-
- ptTrainAlgorithm.setCodeDir(algorithmPath);
-
- //修改算法上传状态
- updateTrainAlgorithm(ptTrainAlgorithm, trainAlgorithmCreateDTO, true);
-
- } else {
- updateTrainAlgorithm(ptTrainAlgorithm, trainAlgorithmCreateDTO, true);
- }
- }
-
-
- /**
- * 更新上传算法状态
- *
- * @param ptTrainAlgorithm 算法信息
- * @param trainAlgorithmCreateDTO 创建算法的条件
- * @param flag 创建算法是否成功(true:成功,false:失败)
- */
- public void updateTrainAlgorithm(PtTrainAlgorithm ptTrainAlgorithm, PtTrainAlgorithmCreateDTO trainAlgorithmCreateDTO, boolean flag) {
-
- LogUtil.info(LogEnum.BIZ_TRAIN, "async update algorithmPath by algorithmId:{} and update noteBook by noteBookId:{}", ptTrainAlgorithm.getId(), trainAlgorithmCreateDTO.getNoteBookId());
- if (flag) {
- ptTrainAlgorithm.setAlgorithmStatus(AlgorithmStatusEnum.SUCCESS.getCode());
- //更新fork算法新路径
- trainAlgorithmMapper.updateById(ptTrainAlgorithm);
- //保存算法根据notbookId更新算法id
- if (trainAlgorithmCreateDTO.getNoteBookId() != null) {
- LogUtil.info(LogEnum.BIZ_TRAIN, "Save algorithm Update algorithm ID :{} according to notBookId:{}", trainAlgorithmCreateDTO.getNoteBookId(), ptTrainAlgorithm.getId());
- noteBookService.updateTrainIdByNoteBookId(trainAlgorithmCreateDTO.getNoteBookId(), ptTrainAlgorithm.getId());
- }
- } else {
- ptTrainAlgorithm.setAlgorithmStatus(AlgorithmStatusEnum.FAIL.getCode());
- trainAlgorithmMapper.updateById(ptTrainAlgorithm);
- }
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/TrainJobAsync.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/TrainJobAsync.java
deleted file mode 100644
index c7952e2..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/TrainJobAsync.java
+++ /dev/null
@@ -1,511 +0,0 @@
-/**
- * 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.async;
-
-import cn.hutool.core.util.StrUtil;
-import com.alibaba.fastjson.JSONObject;
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.config.TrainJobConfig;
-import org.dubhe.constant.SymbolConstant;
-import org.dubhe.dao.PtTrainJobMapper;
-import org.dubhe.domain.dto.BaseTrainJobDTO;
-import org.dubhe.domain.dto.UserDTO;
-import org.dubhe.domain.entity.PtTrainJob;
-import org.dubhe.domain.vo.PtImageAndAlgorithmVO;
-import org.dubhe.enums.BizEnum;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.enums.ModelResourceEnum;
-import org.dubhe.enums.ResourcesPoolTypeEnum;
-import org.dubhe.enums.TrainJobStatusEnum;
-import org.dubhe.exception.BusinessException;
-import org.dubhe.k8s.api.DistributeTrainApi;
-import org.dubhe.k8s.api.NamespaceApi;
-import org.dubhe.k8s.api.TrainJobApi;
-import org.dubhe.k8s.domain.bo.DistributeTrainBO;
-import org.dubhe.k8s.domain.bo.PtJupyterJobBO;
-import org.dubhe.k8s.domain.resource.BizDistributeTrain;
-import org.dubhe.k8s.domain.resource.BizNamespace;
-import org.dubhe.k8s.domain.vo.PtJupyterJobVO;
-import org.dubhe.utils.K8sNameTool;
-import org.dubhe.utils.LocalFileUtil;
-import org.dubhe.utils.LogUtil;
-import org.dubhe.utils.NfsUtil;
-import org.dubhe.utils.StringUtils;
-import org.dubhe.utils.TrainUtil;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @description 提交训练任务
- * @date 2020-07-17
- */
-@Component
-public class TrainJobAsync {
-
- @Autowired
- private K8sNameTool k8sNameTool;
-
- @Autowired
- private NamespaceApi namespaceApi;
-
- @Autowired
- private TrainJobConfig trainJobConfig;
-
- @Autowired
- private NfsUtil nfsUtil;
-
- @Autowired
- private LocalFileUtil localFileUtil;
-
- @Autowired
- private PtTrainJobMapper ptTrainJobMapper;
-
- @Autowired
- private TrainJobApi trainJobApi;
-
- @Autowired
- private DistributeTrainApi distributeTrainApi;
-
- public static final String DATASET_VOLUME_MOUNTS = "/dataset";
-
- public static final String WORKSPACE_VOLUME_MOUNTS = "/workspace";
-
- public static final String MODEL_VOLUME_MOUNTS = "/model";
-
-
- /**
- * 提交分布式训练
- *
- * @param baseTrainJobDTO 训练任务信息
- * @param currentUser 用户
- * @param ptImageAndAlgorithmVO 镜像和算法信息
- * @param ptTrainJob 训练任务实体信息
- */
- public void doDistributedJob(BaseTrainJobDTO baseTrainJobDTO, UserDTO currentUser, PtImageAndAlgorithmVO ptImageAndAlgorithmVO, PtTrainJob ptTrainJob) {
- try {
- //判断是否存在相应的namespace,如果没有则创建
- String namespace = getNamespace(currentUser);
- // 构建DistributeTrainBO
- DistributeTrainBO bo = buildDistributeTrainBO(baseTrainJobDTO, currentUser, ptImageAndAlgorithmVO, ptTrainJob, namespace);
- if (null == bo) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "user{}create TrainJob,Encapsulating ptjupyterjobbo object is empty,the received parameters namespace:{}", currentUser.getId(), namespace);
- updateTrainStatus(currentUser, ptTrainJob, baseTrainJobDTO, "", false);
- return;
- }
- // 调度K8s
- BizDistributeTrain bizDistributeTrain = distributeTrainApi.create(bo);
- if (bizDistributeTrain.isSuccess()) {
- // 调度成功
- updateTrainStatus(currentUser, ptTrainJob, baseTrainJobDTO, bizDistributeTrain.getName(), true);
- } else {
- // 调度失败
- LogUtil.error(LogEnum.BIZ_TRAIN, "distributeTrainApi.create FAILED! {}", bizDistributeTrain);
- updateTrainStatus(currentUser, ptTrainJob, baseTrainJobDTO, bizDistributeTrain.getName(), false);
- }
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "doDistributedJob ERROR!{} ", e);
- updateTrainStatus(currentUser, ptTrainJob, baseTrainJobDTO, "", false);
- }
- }
-
- /**
- * 构造分布式训练DistributeTrainBO(炼知模型暂不支持)
- *
- * @param baseTrainJobDTO 训练任务信息
- * @param currentUser 用户
- * @param ptImageAndAlgorithmVO 镜像和算法信息
- * @param ptTrainJob 训练任务实体信息
- * @param namespace 命名空间
- * @return DistributeTrainBO
- */
- private DistributeTrainBO buildDistributeTrainBO(BaseTrainJobDTO baseTrainJobDTO, UserDTO currentUser, PtImageAndAlgorithmVO ptImageAndAlgorithmVO, PtTrainJob ptTrainJob, String namespace) {
- //绝对路径
- String basePath = nfsUtil.getNfsConfig().getBucket() + trainJobConfig.getManage() + StrUtil.SLASH
- + currentUser.getId() + StrUtil.SLASH + baseTrainJobDTO.getJobName();
- //相对路径
- String relativePath = StrUtil.SLASH + trainJobConfig.getManage() + StrUtil.SLASH
- + currentUser.getId() + StrUtil.SLASH + baseTrainJobDTO.getJobName();
- String[] codeDirArray = ptImageAndAlgorithmVO.getCodeDir().split(StrUtil.SLASH);
- String workspaceDir = codeDirArray[codeDirArray.length - 1];
- // 算法路径待拷贝的地址
- String sourcePath = nfsUtil.getNfsConfig().getBucket() + ptImageAndAlgorithmVO.getCodeDir().substring(1);
- String trainDir = basePath.substring(1) + StrUtil.SLASH + workspaceDir;
-
- if (!localFileUtil.copyPath(sourcePath, trainDir)) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "buildDistributeTrainBO copyPath failed ! sourcePath:{},basePath:{},trainDir:{}", sourcePath, basePath, trainDir);
- return null;
- }
- // 参数前缀
- String paramPrefix = trainJobConfig.getPythonFormat();
- // 初始化固定头命令,获取分布式节点IP
- StringBuilder sb = new StringBuilder("export NODE_IPS=`cat /home/hostfile.json |jq -r \".[]|.ip\"|paste -d \",\" -s` ");
- // 切换到算法路径下
- sb.append(" && cd ").append(trainJobConfig.getDockerTrainPath()).append(StrUtil.SLASH).append(workspaceDir).append(" && ");
- // 拼接用户自定义python启动命令
- sb.append(ptImageAndAlgorithmVO.getRunCommand());
- // 拼接python固定参数 节点IP
- sb.append(paramPrefix).append(trainJobConfig.getNodeIps()).append("=\"$NODE_IPS\" ");
- // 拼接python固定参数 节点数量
- sb.append(paramPrefix).append(trainJobConfig.getNodeNum()).append(SymbolConstant.FLAG_EQUAL).append(ptTrainJob.getResourcesPoolNode()).append(StrUtil.SPACE);
- if (ptImageAndAlgorithmVO.getIsTrainOut()) {
- // 拼接 out
- nfsUtil.createDir(basePath + StrUtil.SLASH + trainJobConfig.getOutPath());
- baseTrainJobDTO.setOutPath(relativePath + StrUtil.SLASH + trainJobConfig.getOutPath());
- sb.append(paramPrefix).append(trainJobConfig.getDockerOutPath());
- }
- if (ptImageAndAlgorithmVO.getIsTrainLog()) {
- // 拼接 输出日志
- nfsUtil.createDir(basePath + StrUtil.SLASH + trainJobConfig.getLogPath());
- baseTrainJobDTO.setLogPath(relativePath + StrUtil.SLASH + trainJobConfig.getLogPath());
- sb.append(paramPrefix).append(trainJobConfig.getDockerLogPath());
- }
- if (ptImageAndAlgorithmVO.getIsVisualizedLog()) {
- // 拼接 输出可视化日志
- nfsUtil.createDir(basePath + StrUtil.SLASH + trainJobConfig.getVisualizedLogPath());
- baseTrainJobDTO.setVisualizedLogPath(relativePath + StrUtil.SLASH + trainJobConfig.getVisualizedLogPath());
- sb.append(paramPrefix).append(trainJobConfig.getDockerVisualizedLogPath());
- }
- // 拼接python固定参数 数据集
- sb.append(paramPrefix).append(trainJobConfig.getDockerDataset());
-
- // 模型路径挂载及其参数拼接
- DistributeTrainBO distributeTrainBO = new DistributeTrainBO();
- buildBoAboutModel(baseTrainJobDTO, distributeTrainBO, sb);
-
- JSONObject runParams = baseTrainJobDTO.getRunParams();
- if (null != runParams && !runParams.isEmpty()) {
- // 拼接用户自定义参数
- runParams.entrySet().forEach(entry ->
- sb.append(paramPrefix).append(entry.getKey()).append(SymbolConstant.FLAG_EQUAL).append(entry.getValue()).append(StrUtil.SPACE)
- );
- }
- // 在用户自定以参数拼接晚后拼接固定参数,防止被用户自定义参数覆盖
- if (ResourcesPoolTypeEnum.isGpuCode(baseTrainJobDTO.getPtTrainJobSpecs().getResourcesPoolType())) {
- // 需要GPU
- sb.append(paramPrefix).append(trainJobConfig.getGpuNumPerNode()).append(SymbolConstant.FLAG_EQUAL).append(baseTrainJobDTO.getGpuNumPerNode()).append(StrUtil.SPACE);
- }
- String mainCommand = sb.toString();
- // 拼接辅助日志打印
- String wholeCommand = " echo 'Distribute training mission begins... "
- + mainCommand
- + " ' && "
- + mainCommand
- + " && echo 'Distribute training mission is over' ";
- distributeTrainBO
- .setNamespace(namespace)
- .setName(baseTrainJobDTO.getJobName())
- .setSize(ptTrainJob.getResourcesPoolNode())
- .setImage(ptImageAndAlgorithmVO.getImageName())
- .setMasterCmd(wholeCommand)
- .setMemNum(baseTrainJobDTO.getMenNum())
- .setCpuNum(baseTrainJobDTO.getCpuNum())
- .putNfsMounts(DATASET_VOLUME_MOUNTS,k8sNameTool.getAbsoluteNfsPath(baseTrainJobDTO.getDataSourcePath()))
- .putNfsMounts(WORKSPACE_VOLUME_MOUNTS,localFileUtil.formatPath(nfsUtil.getNfsConfig().getRootDir() + basePath))
- .putNfsMounts(MODEL_VOLUME_MOUNTS,k8sNameTool.getAbsoluteNfsPath(relativePath + StrUtil.SLASH + trainJobConfig.getOutPath()))
- .setBusinessLabel(k8sNameTool.getPodLabel(BizEnum.ALGORITHM));
- //延时启动,单位为分钟
- if (baseTrainJobDTO.getDelayCreateTime() != null && baseTrainJobDTO.getDelayCreateTime() > 0) {
- distributeTrainBO.setDelayCreateTime(baseTrainJobDTO.getDelayCreateTime() * MagicNumConstant.SIXTY);
- }
- //定时停止,单位为分钟
- if (baseTrainJobDTO.getDelayDeleteTime() != null && baseTrainJobDTO.getDelayDeleteTime() > 0) {
- distributeTrainBO.setDelayDeleteTime(baseTrainJobDTO.getDelayDeleteTime() * MagicNumConstant.SIXTY);
- }
- if (ResourcesPoolTypeEnum.isGpuCode(baseTrainJobDTO.getPtTrainJobSpecs().getResourcesPoolType())) {
- // 需要GPU
- distributeTrainBO.setGpuNum(baseTrainJobDTO.getGpuNumPerNode());
- }
- // 主从一致
- distributeTrainBO.setSlaveCmd(distributeTrainBO.getMasterCmd());
- return distributeTrainBO;
- }
-
-
- /**
- * 提交job
- *
- * @param baseTrainJobDTO 训练任务信息
- * @param currentUser 用户
- * @param ptImageAndAlgorithmVO 镜像和算法信息
- */
- public void doJob(BaseTrainJobDTO baseTrainJobDTO, UserDTO currentUser, PtImageAndAlgorithmVO ptImageAndAlgorithmVO, PtTrainJob ptTrainJob) {
- PtJupyterJobBO jobBo = null;
- String k8sJobName = "";
- try {
- //判断是否存在相应的namespace,如果没有则创建
- String namespace = getNamespace(currentUser);
-
- //封装PtJupyterJobBO对象,调用创建训练任务接口
- jobBo = pkgPtJupyterJobBo(baseTrainJobDTO, currentUser, ptImageAndAlgorithmVO, namespace);
- if (null == jobBo) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "user {} create TrainJob,Encapsulating ptjupyterjobbo object is empty,the received parameters namespace:{}", currentUser.getId(), namespace);
- updateTrainStatus(currentUser, ptTrainJob, baseTrainJobDTO, k8sJobName, false);
- }
- PtJupyterJobVO ptJupyterJobResult = trainJobApi.create(jobBo);
- if (!ptJupyterJobResult.isSuccess()) {
- String message = null == ptJupyterJobResult.getMessage() ? "未知的错误" : ptJupyterJobResult.getMessage();
- LogUtil.error(LogEnum.BIZ_TRAIN, "user {} create TrainJob, K8s creation failed, the received parameters are {}, the wrong information is{}", currentUser.getUsername(), jobBo, message);
- ptTrainJob.setTrainMsg(message);
- updateTrainStatus(currentUser, ptTrainJob, baseTrainJobDTO, k8sJobName, false);
- }
- k8sJobName = ptJupyterJobResult.getName();
- //更新训练任务状态
- updateTrainStatus(currentUser, ptTrainJob, baseTrainJobDTO, k8sJobName, true);
- } catch (Exception e) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "user {} create TrainJob, K8s creation failed, the received parameters are {}, the wrong information is{}", currentUser.getUsername(),
- jobBo, e);
- ptTrainJob.setTrainMsg("内部错误");
- updateTrainStatus(currentUser, ptTrainJob, baseTrainJobDTO, k8sJobName, false);
- }
- }
-
-
- /**
- * 获取namespace
- *
- * @param currentUser 用户
- * @return String 命名空间
- */
- private String getNamespace(UserDTO currentUser) {
- String namespaceStr = k8sNameTool.generateNamespace(currentUser.getId());
- BizNamespace bizNamespace = namespaceApi.get(namespaceStr);
- if (null == bizNamespace) {
- BizNamespace namespace = namespaceApi.create(namespaceStr, null);
- if (null == namespace || !namespace.isSuccess()) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "User {} failed to create namespace during training job...");
- throw new BusinessException("内部错误");
- }
- }
- return namespaceStr;
- }
-
- /**
- * 封装出创建job所需的BO
- *
- * @param baseTrainJobDTO 训练任务信息
- * @param ptImageAndAlgorithmVO 镜像和算法信息
- * @param namespace 命名空间
- * @return PtJupyterJobBO jupyter任务BO
- */
- private PtJupyterJobBO pkgPtJupyterJobBo(BaseTrainJobDTO baseTrainJobDTO, UserDTO currentUser,
- PtImageAndAlgorithmVO ptImageAndAlgorithmVO, String namespace) {
-
- //绝对路径
- String commonPath = nfsUtil.getNfsConfig().getBucket() + trainJobConfig.getManage() + StrUtil.SLASH
- + currentUser.getId() + StrUtil.SLASH + baseTrainJobDTO.getJobName();
- //相对路径
- String relativeCommonPath = StrUtil.SLASH + trainJobConfig.getManage() + StrUtil.SLASH
- + currentUser.getId() + StrUtil.SLASH + baseTrainJobDTO.getJobName();
- String[] codeDirArray = ptImageAndAlgorithmVO.getCodeDir().split(StrUtil.SLASH);
- String workspaceDir = codeDirArray[codeDirArray.length - 1];
- // 算法路径待拷贝的地址
- String sourcePath = nfsUtil.getNfsConfig().getBucket() + ptImageAndAlgorithmVO.getCodeDir().substring(1);
- String trainDir = commonPath.substring(1) + StrUtil.SLASH + workspaceDir;
- LogUtil.info(LogEnum.BIZ_TRAIN, "Algorithm path copy::sourcePath:{},commonPath:{},trainDir:{}", sourcePath, commonPath, trainDir);
- boolean bool = localFileUtil.copyPath(sourcePath.substring(1), trainDir);
- if (!bool) {
- LogUtil.error(LogEnum.BIZ_TRAIN, "During the process of user {} creating training Job and encapsulating k8s creating job interface parameters, it failed to copy algorithm directory {} to the specified directory {}", currentUser.getUsername(), sourcePath.substring(1),
- trainDir);
- return null;
- }
-
- List list = new ArrayList<>();
- PtJupyterJobBO jobBo = new PtJupyterJobBO();
- JSONObject runParams = baseTrainJobDTO.getRunParams();
-
- StringBuilder sb = new StringBuilder();
- sb.append(ptImageAndAlgorithmVO.getRunCommand());
- // 拼接out,log和dataset
- String pattern = trainJobConfig.getPythonFormat();
- if (ptImageAndAlgorithmVO.getIsTrainOut()) {
- nfsUtil.createDir(commonPath + StrUtil.SLASH + trainJobConfig.getOutPath());
- baseTrainJobDTO.setOutPath(relativeCommonPath + StrUtil.SLASH + trainJobConfig.getOutPath());
- sb.append(pattern).append(trainJobConfig.getDockerOutPath());
- }
- if (ptImageAndAlgorithmVO.getIsTrainLog()) {
- nfsUtil.createDir(commonPath + StrUtil.SLASH + trainJobConfig.getLogPath());
- baseTrainJobDTO.setLogPath(relativeCommonPath + StrUtil.SLASH + trainJobConfig.getLogPath());
- sb.append(pattern).append(trainJobConfig.getDockerLogPath());
- }
- if (ptImageAndAlgorithmVO.getIsVisualizedLog()) {
- nfsUtil.createDir(commonPath + StrUtil.SLASH + trainJobConfig.getVisualizedLogPath());
- baseTrainJobDTO.setVisualizedLogPath(relativeCommonPath + StrUtil.SLASH + trainJobConfig.getVisualizedLogPath());
- sb.append(pattern).append(trainJobConfig.getDockerVisualizedLogPath());
- }
- sb.append(pattern).append(trainJobConfig.getDockerDataset());
-
- String valDataSourcePath = baseTrainJobDTO.getValDataSourcePath();
- if (StringUtils.isNotBlank(valDataSourcePath)) {
- sb.append(pattern).append(trainJobConfig.getLoadValDatasetKey()).append(SymbolConstant.FLAG_EQUAL).append(trainJobConfig.getDockerValDatasetPath());
- }
- //模型路径挂载及其参数拼接
- buildBoAboutModel(baseTrainJobDTO, jobBo, sb);
-
- if (null != runParams && !runParams.isEmpty()) {
- runParams.forEach((k, v) ->
- sb.append(pattern).append(k).append(SymbolConstant.FLAG_EQUAL).append(v).append(StrUtil.SPACE)
- );
- }
- // 在用户自定以参数拼接晚后拼接固定参数,防止被用户自定义参数覆盖
- if (ResourcesPoolTypeEnum.isGpuCode(baseTrainJobDTO.getPtTrainJobSpecs().getResourcesPoolType())) {
- // 需要GPU
- sb.append(pattern).append(trainJobConfig.getGpuNumPerNode()).append(SymbolConstant.FLAG_EQUAL).append(baseTrainJobDTO.getGpuNumPerNode()).append(StrUtil.SPACE);
- }
- String executeCmd = sb.toString();
- list.add("-c");
-
- String workPath = trainJobConfig.getDockerTrainPath() + StrUtil.SLASH + workspaceDir;
- String command;
- Integer modelResource = baseTrainJobDTO.getModelResource();
- if(null != modelResource && modelResource.intValue() == ModelResourceEnum.ATLAS.getType().intValue()) {
- command = "&& " + trainJobConfig.getAtlasAnaconda() +
- " && cd " + workPath +
- " && " + trainJobConfig.getAtlasPythonioencoding() + executeCmd;
- } else {
- command = " && cd " + workPath + " && " + executeCmd;
- }
- command = "echo 'training mission begins... " + executeCmd + "\r\n '" + command + " && echo 'the training mission is over' ";
-
- list.add(command);
-
- jobBo.setNamespace(namespace)
- .setName(baseTrainJobDTO.getJobName())
- .setImage(ptImageAndAlgorithmVO.getImageName())
- .putNfsMounts(trainJobConfig.getDockerDatasetPath(), nfsUtil.getNfsConfig().getRootDir() + nfsUtil.getNfsConfig().getBucket().substring(1) + baseTrainJobDTO.getDataSourcePath())
- .setCmdLines(list)
- .putNfsMounts(trainJobConfig.getDockerTrainPath(), nfsUtil.getNfsConfig().getRootDir() + commonPath.substring(1))
- .putNfsMounts(trainJobConfig.getDockerValDatasetPath(), nfsUtil.formatPath(nfsUtil.getAbsolutePath(valDataSourcePath)))
- .setBusinessLabel(k8sNameTool.getPodLabel(BizEnum.ALGORITHM));
- //延时启动,单位为分钟
- if (baseTrainJobDTO.getDelayCreateTime() != null && baseTrainJobDTO.getDelayCreateTime() > 0) {
- jobBo.setDelayCreateTime(baseTrainJobDTO.getDelayCreateTime() * MagicNumConstant.SIXTY);
- }
- //自动停止,单位为分钟
- if (baseTrainJobDTO.getDelayDeleteTime() != null && baseTrainJobDTO.getDelayDeleteTime() > 0) {
- jobBo.setDelayDeleteTime(baseTrainJobDTO.getDelayDeleteTime() * MagicNumConstant.SIXTY);
- }
- jobBo.setCpuNum(baseTrainJobDTO.getCpuNum()).setMemNum(baseTrainJobDTO.getMenNum());
- if (ResourcesPoolTypeEnum.isGpuCode(baseTrainJobDTO.getPtTrainJobSpecs().getResourcesPoolType())) {
- jobBo.setUseGpu(true).setGpuNum(baseTrainJobDTO.getGpuNumPerNode());
- } else {
- jobBo.setUseGpu(false);
- }
- return jobBo;
- }
-
- /**
- * 模型路径挂载及其参数拼接
- *
- * @param baseTrainJobDTO 训练任务基本信息
- * @param jobBo 训练任务实体
- * @param sb 训练命令参数
- */
- private void buildBoAboutModel(BaseTrainJobDTO baseTrainJobDTO, Object jobBo, StringBuilder sb) {
- if(null == baseTrainJobDTO.getModelResource()) {
- return;
- }
- String modelLoadPathDir = baseTrainJobDTO.getModelLoadPathDir();
- //非炼知模型
- if (StringUtils.isNotBlank(modelLoadPathDir)) {
- //将模型路径model_load_dir路径
- sb.append(trainJobConfig.getPythonFormat()).append(trainJobConfig.getLoadKey()).append(SymbolConstant.FLAG_EQUAL).append(trainJobConfig.getDockerModelPath());
- if(jobBo instanceof PtJupyterJobBO) {
- PtJupyterJobBO ptJupyterJobBO = (PtJupyterJobBO)jobBo;
- ptJupyterJobBO.putNfsMounts(trainJobConfig.getDockerModelPath(), nfsUtil.formatPath(nfsUtil.getAbsolutePath(modelLoadPathDir)));
- } else if(jobBo instanceof DistributeTrainBO) {
- DistributeTrainBO distributeTrainBO = (DistributeTrainBO)jobBo;
- distributeTrainBO.putNfsMounts(trainJobConfig.getDockerModelPath(), nfsUtil.formatPath(nfsUtil.getAbsolutePath(modelLoadPathDir)));
- }
- return;
- }
- //炼知模型中的教师模型
- appendAtlasModelPath(baseTrainJobDTO.getTeacherModelPathList(), jobBo, sb, true);
- //炼知模型中的学生模型
- appendAtlasModelPath(baseTrainJobDTO.getStudentModelPathList(), jobBo, sb, false);
- }
-
- /**
- * 炼知模型路径挂载及其参数拼接
- *
- * @param modelPathList 模型路径集合
- * @param jobBo 训练任务实体
- * @param sb 训练命令参数
- * @param isTeacher 是否教师模型
- */
- private void appendAtlasModelPath(List modelPathList, Object jobBo, StringBuilder sb, boolean isTeacher) {
- if(null == modelPathList || modelPathList.isEmpty()) {
- return;
- }
- StringBuilder appendModelPath = new StringBuilder();
- String preModelKey;
- String preModelPath;
- if(isTeacher){
- preModelKey = trainJobConfig.getDockerTeacherModelKey();
- preModelPath = trainJobConfig.getDockerTeacherModelPath();
- } else {
- preModelKey = trainJobConfig.getDockerStudentModelKey();
- preModelPath = trainJobConfig.getDockerStudentModelPath();
- }
- modelPathList.stream()
- .forEach(modelPath -> {
- String[] urlArray = modelPath.split(SymbolConstant.SLASH);
- String dockerModelPath = urlArray[urlArray.length - TrainUtil.NUMBER_ONE];
- String mountPath = preModelPath + SymbolConstant.SLASH + dockerModelPath;
- appendModelPath.append(mountPath).append(SymbolConstant.COMMA);
- if(jobBo instanceof PtJupyterJobBO) {
- PtJupyterJobBO ptJupyterJobBO = (PtJupyterJobBO)jobBo;
- ptJupyterJobBO.putNfsMounts(mountPath, nfsUtil.formatPath(nfsUtil.getAbsolutePath(modelPath)));
- } else if(jobBo instanceof DistributeTrainBO) {
- DistributeTrainBO distributeTrainBO = (DistributeTrainBO)jobBo;
- distributeTrainBO.putNfsMounts(mountPath, nfsUtil.formatPath(nfsUtil.getAbsolutePath(modelPath)));
- }
- });
- String resultPath = SymbolConstant.MARK +
- appendModelPath.toString().substring(TrainUtil.NUMBER_ZERO, appendModelPath.toString().length() - TrainUtil.NUMBER_ONE) +
- SymbolConstant.MARK;
-
- sb.append(trainJobConfig.getPythonFormat()).append(preModelKey).append(SymbolConstant.FLAG_EQUAL).append(resultPath);
- }
-
- /**
- * 训练任务异步处理更新训练状态
- *
- * @param user 用户
- * @param ptTrainJob 训练任务
- * @param baseTrainJobDTO 训练任务信息
- * @param k8sJobName k8s创建的job名称,或者分布式训练名称
- * @param flag 创建训练任务是否异常(true:正常,false:失败)
- **/
- private void updateTrainStatus(UserDTO user, PtTrainJob ptTrainJob, BaseTrainJobDTO baseTrainJobDTO, String k8sJobName, boolean flag) {
-
- ptTrainJob.setK8sJobName(k8sJobName)
- .setOutPath(baseTrainJobDTO.getOutPath())
- .setLogPath(baseTrainJobDTO.getLogPath())
- .setVisualizedLogPath(baseTrainJobDTO.getVisualizedLogPath());
- LogUtil.info(LogEnum.BIZ_TRAIN, "user {} training tasks are processed asynchronously to update training status,receiving parameters:{}", user.getId(), ptTrainJob);
- if (flag) {
- ptTrainJobMapper.updateById(ptTrainJob);
- } else {
- ptTrainJob.setTrainStatus(TrainJobStatusEnum.CREATE_FAILED.getStatus());
- //训练任务创建失败
- ptTrainJobMapper.updateById(ptTrainJob);
- }
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/TransactionAsyncManager.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/TransactionAsyncManager.java
deleted file mode 100644
index b7e4fa5..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/async/TransactionAsyncManager.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/**
- * 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.async;
-
-import org.dubhe.aspect.LogAspect;
-import org.dubhe.base.DataContext;
-import org.dubhe.domain.dto.BaseTrainJobDTO;
-import org.dubhe.domain.dto.CommonPermissionDataDTO;
-import org.dubhe.domain.dto.UserDTO;
-import org.dubhe.domain.entity.PtTrainJob;
-import org.dubhe.domain.vo.PtImageAndAlgorithmVO;
-import org.dubhe.enums.TrainTypeEnum;
-import org.slf4j.MDC;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.transaction.support.TransactionSynchronizationAdapter;
-import org.springframework.transaction.support.TransactionSynchronizationManager;
-
-import javax.annotation.Resource;
-import java.util.concurrent.Executor;
-
-/**
- * @description 事务提交后触发异步操作
- * @date 2020-07-17
- */
-@Component
-public class TransactionAsyncManager {
-
- @Autowired
- private TrainJobAsync trainJobAsync;
-
- @Resource(name = "trainExecutor")
- private Executor trainExecutor;
-
- public void execute(BaseTrainJobDTO baseTrainJobDTO, UserDTO currentUser, PtImageAndAlgorithmVO ptImageAndAlgorithmVO, PtTrainJob ptTrainJob) {
- String traceId = MDC.get(LogAspect.TRACE_ID);
- CommonPermissionDataDTO commonPermissionDataDTO = DataContext.get();
- TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronizationAdapter() {
- @Override
- public void afterCommit() {
-
- trainExecutor.execute(() -> {
- MDC.put(LogAspect.TRACE_ID, traceId);
- DataContext.set(commonPermissionDataDTO);
-
- if (TrainTypeEnum.isDistributeTrain(ptTrainJob.getTrainType())) {
- // 分布式训练
- trainJobAsync.doDistributedJob(baseTrainJobDTO, currentUser, ptImageAndAlgorithmVO, ptTrainJob);
- } else {
- // 普通训练
- trainJobAsync.doJob(baseTrainJobDTO, currentUser, ptImageAndAlgorithmVO, ptTrainJob);
- }
- MDC.remove(LogAspect.TRACE_ID);
- DataContext.remove();
- });
- }
- });
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/GlobalFilter.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/GlobalFilter.java
deleted file mode 100644
index 9d14108..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/GlobalFilter.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
- * 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.config;
-
-import com.alibaba.fastjson.JSON;
-import org.dubhe.constant.StringConstant;
-import org.dubhe.constatnts.UserConstant;
-import org.dubhe.dto.GlobalRequestRecordDTO;
-import org.dubhe.enums.LogEnum;
-import org.dubhe.utils.JwtUtils;
-import org.dubhe.utils.LogUtil;
-import org.dubhe.utils.StringUtils;
-import org.springframework.core.annotation.Order;
-import org.springframework.stereotype.Component;
-
-import javax.servlet.*;
-import javax.servlet.annotation.WebFilter;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-
-import static org.dubhe.constant.StringConstant.K8S_CALLBACK_URI;
-
-/**
- * @description 全局请求拦截器 用于日志收集
- * @date 2020-08-13
- */
-@Order(1)
-@Component
-@WebFilter(filterName = "GlobalFilter", urlPatterns = "/**")
-public class GlobalFilter implements Filter {
- @Override
- public void init(FilterConfig filterConfig) throws ServletException {
-
- }
-
- @Override
- public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain chain) throws IOException, ServletException {
-
- long start = System.currentTimeMillis();
- HttpServletRequest request = ((HttpServletRequest) servletRequest);
- HttpServletResponse response = ((HttpServletResponse) servletResponse);
-
- GlobalRequestRecordDTO dto = new GlobalRequestRecordDTO();
-
- try {
- if (StringUtils.isNotBlank(request.getContentType()) && request.getContentType().contains(StringConstant.MULTIPART)) {
- chain.doFilter(request, response);
- } else {
- checkScheduleRequest(request);
- checkK8sCallback(request);
-
- RequestBodyWrapper requestBodyWrapper = new RequestBodyWrapper(request);
- ResponseBodyWrapper responseBodyWrapper = new ResponseBodyWrapper(response);
- dto.setRequestBody(requestBodyWrapper.getBodyString());
- chain.doFilter(requestBodyWrapper, responseBodyWrapper);
-
- if (StringConstant.JSON_REQUEST.equals(responseBodyWrapper.getContentType())) {
- final String responseBody = responseBodyWrapper.getResponseBody();
- dto.setResponseBody(responseBody);
- } else {
- responseBodyWrapper.flush();
- }
- }
- } catch (Exception e) {
- LogUtil.error(LogEnum.GLOBAL_REQ, "Global request record error : {}", e);
- throw e;
- } finally {
- buildGlobalRequestDTO(dto, request, response);
- dto.setTimeCost(System.currentTimeMillis() - start);
- LogUtil.info(LogEnum.GLOBAL_REQ, "Global request record: {}", dto);
- LogUtil.cleanTrace();
- }
- }
-
- /**
- * 构建全局请求对象
- *
- * @param dto
- * @param request
- * @param response
- */
- private void buildGlobalRequestDTO(GlobalRequestRecordDTO dto, HttpServletRequest request, HttpServletResponse response) {
- dto.setClientHost(request.getRemoteHost());
- dto.setParams(JSON.toJSONString(request.getParameterMap()));
- dto.setMethod(request.getMethod());
- dto.setUri(request.getRequestURI());
- //身份认证信息
- String token = request.getHeader(UserConstant.USER_TOKEN_KEY);
- dto.setAuthorization(token);
- if (token != null) {
- String userName = JwtUtils.getUserName(token);
- dto.setUsername(userName);
- }
- dto.setContentType(response.getContentType());
- dto.setStatus(response.getStatus());
- }
-
- /**
- * 检查是否是前端的定时请求
- *
- * @param request 请求信息
- * @return 是否是前端的定时请求
- */
- private boolean checkScheduleRequest(HttpServletRequest request) {
-
- if (StringConstant.REQUEST_METHOD_GET.equals(request.getMethod())
- && StringUtils.isNotBlank(request.getParameter(LogUtil.SCHEDULE_LEVEL))) {
- LogUtil.startScheduleTrace();
- return true;
- }
-
- return false;
- }
-
- /**
- * 校验请求是否为k8s回调
- * @param request 请求信息
- * @return 是否为k8s回调
- */
- private boolean checkK8sCallback(HttpServletRequest request) {
- if (request.getRequestURI() != null && request.getRequestURI().contains(K8S_CALLBACK_URI)) {
- LogUtil.startK8sCallbackTrace();
- return true;
- }
- return false;
- }
-
- @Override
- public void destroy() {
-
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/RequestBodyWrapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/RequestBodyWrapper.java
deleted file mode 100644
index 954f620..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/RequestBodyWrapper.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/**
- * 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.config;
-
-import org.dubhe.enums.LogEnum;
-import org.dubhe.utils.LogUtil;
-
-import javax.servlet.ReadListener;
-import javax.servlet.ServletInputStream;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletRequestWrapper;
-import java.io.BufferedReader;
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStreamReader;
-
-/**
- * @description 用于获取请求body参数的包装类
- * @date 2020-08-20
- */
-public class RequestBodyWrapper extends HttpServletRequestWrapper {
-
- private ByteArrayInputStream byteArrayInputStream;
-
- private String bodyString;
-
- public RequestBodyWrapper(HttpServletRequest request)
- throws IOException {
- super(request);
- try (BufferedReader reader = request.getReader()) {
- StringBuilder sb = new StringBuilder();
- String line = null;
- while ((line = reader.readLine()) != null) {
- sb.append(line);
- }
- if (sb.length() > 0) {
- bodyString = sb.toString();
- } else {
- bodyString = "";
- }
- byteArrayInputStream = new ByteArrayInputStream(bodyString.getBytes());
- } catch (Exception e) {
- LogUtil.error(LogEnum.GLOBAL_REQ, "request get reader error : {}", e);
- throw e;
- }
-
- }
-
- /**
- * 获取请求体的json数据
- *
- * @return
- */
- public String getBodyString() {
- return bodyString;
- }
-
- @Override
- public BufferedReader getReader() throws IOException {
- return new BufferedReader(new InputStreamReader(getInputStream()));
- }
-
- @Override
- public ServletInputStream getInputStream() throws IOException {
- return new ServletInputStream() {
- @Override
- public boolean isFinished() {
- return false;
- }
-
- @Override
- public boolean isReady() {
- return false;
- }
-
- @Override
- public void setReadListener(ReadListener readListener) {
- }
-
- @Override
- public int read() throws IOException {
- return byteArrayInputStream.read();
- }
- };
- }
-}
\ No newline at end of file
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/ResponseBodyWrapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/ResponseBodyWrapper.java
deleted file mode 100644
index 6dc8eba..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/ResponseBodyWrapper.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/**
- * 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.config;
-
-import org.dubhe.enums.LogEnum;
-import org.dubhe.utils.LogUtil;
-
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.OutputStreamWriter;
-import java.io.PrintWriter;
-import java.io.UnsupportedEncodingException;
-
-import javax.servlet.ServletOutputStream;
-import javax.servlet.WriteListener;
-import javax.servlet.http.HttpServletResponse;
-import javax.servlet.http.HttpServletResponseWrapper;
-
-/**
- * @description 用于获取response 的 json 返回值
- * @date 2020-08-19
- */
-public class ResponseBodyWrapper extends HttpServletResponseWrapper {
-
- private ByteArrayOutputStream byteArrayOutputStream = null;
-
- private ServletOutputStream servletOutputStream = null;
-
- private PrintWriter printWriter = null;
-
- private HttpServletResponse response;
-
- public ResponseBodyWrapper(HttpServletResponse response) throws IOException {
- super(response);
- this.response = response;
- byteArrayOutputStream = new ByteArrayOutputStream();
- printWriter = new PrintWriter(new OutputStreamWriter(byteArrayOutputStream, "UTF-8"));
- servletOutputStream = new ServletOutputStream() {
-
- @Override
- public void write(int b) throws IOException {
- byteArrayOutputStream.write(b);
- }
-
- @Override
- public boolean isReady() {
- return false;
- }
-
- @Override
- public void setWriteListener(WriteListener writeListener) {
- }
- };
- }
-
- @Override
- public ServletOutputStream getOutputStream() throws IOException {
- return servletOutputStream;
- }
-
- @Override
- public PrintWriter getWriter() throws IOException {
- return printWriter;
- }
-
- @Override
- public void flushBuffer() throws IOException {
- if (servletOutputStream != null) {
- servletOutputStream.flush();
- }
- if (printWriter != null) {
- printWriter.flush();
- }
- }
-
- @Override
- public void reset() {
- byteArrayOutputStream.reset();
- }
-
- /**
- * 获取json返回值
- * @return
- * @throws IOException
- */
- public String getResponseBody() throws IOException {
- //清空response的流,之后再添加进去
- flushBuffer();
- byte[] bytes = byteArrayOutputStream.toByteArray();
- try {
- return new String(bytes, "UTF-8");
- } catch (UnsupportedEncodingException e) {
- LogUtil.error(LogEnum.GLOBAL_REQ, e);
- } finally {
- response.getOutputStream().write(bytes);
- }
- return "";
- }
-
- /**
- * 清掉缓冲
- * @throws IOException
- */
- public void flush() throws IOException {
- //清空response的流,之后再添加进去
- flushBuffer();
- byte[] bytes = byteArrayOutputStream.toByteArray();
- response.getOutputStream().write(bytes);
- }
-
-}
\ No newline at end of file
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/TimestampConverter.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/TimestampConverter.java
deleted file mode 100644
index 679a027..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/config/TimestampConverter.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.config;
-
-import org.apache.commons.lang3.StringUtils;
-import org.springframework.core.convert.converter.Converter;
-import org.springframework.stereotype.Component;
-
-import java.sql.Timestamp;
-
-/**
- * @description 转换时间戳类型
- * @date 2020-05-22
- */
-@Component
-public class TimestampConverter implements Converter {
-
- /**
- * Convert string to Timestamp type
- * @param timeStr
- * @return
- */
- @Override
- public Timestamp convert(String timeStr) {
-
- Timestamp timestamp = null;
- if (StringUtils.isNotBlank(timeStr)) {
- long time = Long.valueOf(timeStr);
- timestamp = new Timestamp(time);
- }
-
- return timestamp;
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptBuiltInMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptBuiltInMapper.java
deleted file mode 100644
index 3afe75b..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptBuiltInMapper.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Param;
-import org.dubhe.domain.entity.ModelOptBuiltIn;
-import org.dubhe.domain.vo.ModelOptAlgorithmQueryVO;
-import org.dubhe.domain.vo.ModelOptDatasetQueryVO;
-import org.dubhe.domain.vo.ModelOptModelQueryVO;
-
-import java.util.List;
-
-/**
- * @description 内置模型
- * @date 2020-05-22
- */
-public interface ModelOptBuiltInMapper extends BaseMapper {
- /**
- * 获取模型优化数据集
- * @param type 算法类型
- * @return 模型优化数据集列表
- */
- List getDataset(@Param("type") Integer type, @Param("model") String model, @Param("algorithm") String algorithm);
-
- /**
- * 获取模型优化教师模型
- * @param type
- * @return
- */
- List getModel(@Param("type") Integer type, @Param("dataset") String dataset, @Param("algorithm") String algorithm);
-
- /**
- * 获取模型优化算法
- * @param type
- * @return
- */
- List getAlgorithm(@Param("type") Integer type, @Param("model") String model, @Param("dataset") String dataset);
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptDatasetMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptDatasetMapper.java
deleted file mode 100644
index 9537712..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptDatasetMapper.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Select;
-import org.dubhe.domain.entity.ModelOptDataset;
-
-import java.util.List;
-
-/**
- * @description 模型优化数据集
- * @date 2021-01-06
- */
-public interface ModelOptDatasetMapper extends BaseMapper {
-
- @Select("select id, name, path from model_opt_dataset where deleted = 0 order by id desc")
- List getAllDataset();
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptTaskInstanceMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptTaskInstanceMapper.java
deleted file mode 100644
index 2ec4961..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptTaskInstanceMapper.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Select;
-import org.apache.ibatis.annotations.Update;
-import org.dubhe.domain.entity.ModelOptTaskInstance;
-
-import java.util.List;
-
-/**
- * @description 模型优化实例
- * @date 2020-05-22
- */
-public interface ModelOptTaskInstanceMapper extends BaseMapper {
-
- /**
- * 将实例状态标记为执行失败
- *
- * @param instId 实例id
- * @return 更新行数
- */
- @Update("update model_opt_task_instance set status = '3' where id = #{instId} and status in ('-1','0')")
- Integer markInstanceExecFailed(Long instId);
-
- /**
- * 获取5分钟以前状态仍为等待中的实例
- *
- * @return 实例列表
- */
- @Select("select * from model_opt_task_instance where status = '-1' and create_time < date_sub(now(), interval 5 minute)")
- List selectWaitingFor5MinutesInstances();
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptTaskMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptTaskMapper.java
deleted file mode 100644
index 66c5648..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/ModelOptTaskMapper.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.dubhe.domain.entity.ModelOptTask;
-
-/**
- * @description 模型优化任务
- * @date 2020-05-22
- */
-public interface ModelOptTaskMapper extends BaseMapper {
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/NoteBookMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/NoteBookMapper.java
deleted file mode 100644
index 5c1d1a6..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/NoteBookMapper.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.domain.entity.NoteBook;
-
-import java.util.List;
-
-/**
- * @description notebook mapper
- * @date 2020-04-28
- */
-@DataPermission(ignoresMethod = {"insert","findByNamespaceAndResourceName","selectRunNotUrlList"})
-public interface NoteBookMapper extends BaseMapper {
-
- /**
- * 根据名称查询
- *
- * @param name
- * @param status
- * @return NoteBook
- */
- @Select("select * from notebook where notebook_name = #{name} and status != #{status} and deleted = 0 limit 1")
- NoteBook findByNameAndStatus(@Param("name") String name, @Param("status") Integer status);
-
- /**
- * 查询正在运行的notebook数量
- *
- * @param status
- * @return int
- */
- @Select("select count(1) from notebook where status = #{status} and deleted = 0")
- int selectRunNoteBookNum( @Param("status") Integer status);
-
- /**
- * 根据namespace + resourceName查询
- *
- * @param namespace
- * @param resourceName
- * @param status
- * @return NoteBook
- */
- @Select("select * from notebook where k8s_namespace = #{namespace} and k8s_resource_name = #{resourceName} and status != #{status} and deleted = 0 limit 1")
- NoteBook findByNamespaceAndResourceName(@Param("namespace") String namespace, @Param("resourceName") String resourceName, @Param("status") Integer status);
-
- /**
- * 查询已经运行并且没有URL的notebook
- *
- * @param page
- * @param status
- * @return List
- */
- @Select("select * from notebook where deleted = 0 and status = #{status} and (url is null or url = '')")
- List selectRunNotUrlList(@Param("page") Page page, @Param("status") Integer status);
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/NoteBookModelMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/NoteBookModelMapper.java
deleted file mode 100644
index 280f68b..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/NoteBookModelMapper.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Select;
-import org.dubhe.domain.entity.NoteBookModel;
-
-import java.util.List;
-
-/**
- * @description : notebook 模板 Mapper
- * @date 2020-06-01
- */
-public interface NoteBookModelMapper extends BaseMapper {
-
- /**
- * 根据名称查询
- *
- * @return NoteBookModel
- */
- @Select("select * from notebook_model where deleted = 0 order by model_type")
- List selectAllNoteBookModel();
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtImageMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtImageMapper.java
deleted file mode 100644
index 0136d8e..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtImageMapper.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.dao;
-
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Select;
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.domain.entity.PtImage;
-
-import java.util.List;
-
-/**
- * @description 镜像 Mapper 接口
- * @date 2020-04-27
- */
-@DataPermission(ignoresMethod = {"insert"})
-public interface PtImageMapper extends BaseMapper {
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtJobParamMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtJobParamMapper.java
deleted file mode 100644
index 094b95e..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtJobParamMapper.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.dao;
-
-import org.dubhe.domain.entity.PtJobParam;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * @description job运行参数及结果
- * @date 2020-04-27
- */
-public interface PtJobParamMapper extends BaseMapper {
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtMeasureMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtMeasureMapper.java
deleted file mode 100644
index b716125..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtMeasureMapper.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.dao;
-
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.domain.entity.PtMeasure;
-
-/**
- * @description 度量 Mapper 接口
- * @date 2020-11-16
- */
-@DataPermission(ignoresMethod = {"insert"})
-public interface PtMeasureMapper extends BaseMapper {
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainAlgorithmMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainAlgorithmMapper.java
deleted file mode 100644
index d22ce96..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainAlgorithmMapper.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.domain.entity.PtTrainAlgorithm;
-
-import java.util.List;
-
-/**
- * @description 训练算法Mapper
- * @date 2020-04-27
- */
-@DataPermission(ignoresMethod = {"insert"})
-public interface PtTrainAlgorithmMapper extends BaseMapper {
-
- /**
- * 根据算法id查询算法信息
- * @param id 算法id
- * @return PtTrainAlgorithm 算法信息
- */
- @Select("select * from pt_train_algorithm where id= #{id}")
- PtTrainAlgorithm selectAllById(@Param("id") Long id);
-
- /**
- * 根据算法id集合查询对应的算法信息
- * @param ids 算法集合id
- * @return List 算法信息集合
- */
- @Select({
- ""
- })
- List selectAllBatchIds(@Param("ids") List ids);
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainAlgorithmUsageMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainAlgorithmUsageMapper.java
deleted file mode 100644
index fa7d656..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainAlgorithmUsageMapper.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.dao;
-
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.domain.entity.PtTrainAlgorithmUsage;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- *
- * @description 用户辅助信息Mapper 接口
- * @date 2020-06-23
- */
-@DataPermission(ignoresMethod = "insert")
-public interface PtTrainAlgorithmUsageMapper extends BaseMapper {
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainJobMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainJobMapper.java
deleted file mode 100644
index 290db66..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainJobMapper.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import org.apache.ibatis.annotations.Param;
-import org.apache.ibatis.annotations.Select;
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.domain.entity.PtTrainJob;
-import org.dubhe.domain.vo.PtTrainVO;
-
-/**
- * @description 训练作业job Mapper 接口
- * @date 2020-04-27
- */
-@DataPermission(ignoresMethod = {"insert","selectCountByStatus","getPageTrain"})
-public interface PtTrainJobMapper extends BaseMapper {
-
- /**
- * 获取训练列表,并进行分页。
- *
- * @param page 页
- * @param createUserId 用户id
- * @param trainStatus 训练状态
- * @param trainName 训练名称
- * @param sort 排序字段
- * @param order 排序方式
- *
- * @return PtTrainVO
- */
- Page getPageTrain(Page page, @Param("createUserId") Long createUserId,
- @Param("trainStatus") Integer trainStatus, @Param("trainName") String trainName, @Param("sort") String sort,
- @Param("order") String order);
-
- /**
- * 根据状态进行统计数量
- *
- * @param userId 当前用户id
- * @param param sql片段
- * @return 统计的数量
- */
- @Select("select count(1) from pt_train_job t1 inner join pt_train t2 on t1.train_id = t2.id where t1.create_user_id= #{userId} and t1.train_status in ${param} and t1.deleted= 0 and t2.deleted = 0 ")
- Integer selectCountByStatus(@Param("userId") Long userId, @Param("param") String param);
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainJobSpecsMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainJobSpecsMapper.java
deleted file mode 100644
index a5dd5ec..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainJobSpecsMapper.java
+++ /dev/null
@@ -1,29 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.dubhe.domain.entity.PtTrainJobSpecs;
-
-/**
- * @description 训练作业规格 Mapper 接口
- * @date 2020-05-06
- */
-public interface PtTrainJobSpecsMapper extends BaseMapper {
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainMapper.java
deleted file mode 100644
index 7e043d4..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainMapper.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.dao;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.domain.entity.PtTrain;
-
-/**
- * @description 训练作业主 Mapper 接口
- * @date 2020-04-27
- */
-@DataPermission(ignoresMethod = {"insert"})
-public interface PtTrainMapper extends BaseMapper {
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainParamMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainParamMapper.java
deleted file mode 100644
index 2a9efd1..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtTrainParamMapper.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- * 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.dao;
-
-import org.dubhe.annotation.DataPermission;
-import org.dubhe.domain.entity.PtTrainParam;
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-
-/**
- * @description 任务参数 Mapper 接口
- * @date 2020-04-27
- */
-@DataPermission(ignoresMethod = "insert")
-public interface PtTrainParamMapper extends BaseMapper {
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/BaseTrainJobDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/BaseTrainJobDTO.java
deleted file mode 100644
index 354c8e9..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/BaseTrainJobDTO.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * 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.domain.dto;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.domain.entity.PtTrainJobSpecs;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @description 创建训练任务的数据包
- * @date 2020-07-15
- */
-@Data
-@Accessors(chain = true)
-public class BaseTrainJobDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private JSONObject runParams;
- private String jobName;
- private String dataSourcePath;
- private PtTrainJobSpecs ptTrainJobSpecs;
- private String outPath;
- private String logPath;
- private String visualizedLogPath;
- private Integer delayCreateTime;
- private Integer delayDeleteTime;
- private String modelPath;
- private List teacherModelPathList;
- private List studentModelPathList;
- private Long modelId;
- private Long modelBranchId;
- private Integer modelResource;
- private String teacherModelIds;
- private String studentModelIds;
-
- /**
- * @return 每个节点的GPU数量
- */
- public Integer getGpuNumPerNode(){
- return getPtTrainJobSpecs().getSpecsInfo().getInteger("gpuNum");
- }
-
- /**
- * @return cpu数量
- */
- public Integer getCpuNum(){
- return getPtTrainJobSpecs().getSpecsInfo().getInteger("cpuNum");
- }
-
- /**
- * @return memNum
- */
- public Integer getMenNum(){
- return getPtTrainJobSpecs().getSpecsInfo().getInteger("memNum");
- }
- /**
- * "验证数据来源名称"
- */
- private String valDataSourceName;
-
- /**
- * 验证数据来源路径
- */
- private String valDataSourcePath;
- /**
- * 模型路径
- */
- private String modelLoadPathDir;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/BaseTrainParamDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/BaseTrainParamDTO.java
deleted file mode 100644
index a3fb87e..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/BaseTrainParamDTO.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * @description 创建训练模板的数据包
- * @date 2020-07-15
- */
-@Data
-@Accessors(chain = true)
-public class BaseTrainParamDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- private Long modelId;
- private Long modelBranchId;
- private Integer modelResource;
- private String teacherModelIds;
- private String studentModelIds;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptDatasetCreateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptDatasetCreateDTO.java
deleted file mode 100644
index 1a5e6e8..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptDatasetCreateDTO.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package org.dubhe.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotEmpty;
-import java.io.Serializable;
-
-/**
- * @description 模型优化模块我的数据集创建参数
- * @date 2021-01-06
- */
-@Data
-public class ModelOptDatasetCreateDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "名称", required = true)
- @NotEmpty(message = "数据集名称不能为空")
- private String name;
-
- @ApiModelProperty(value = "路径", required = true)
- @NotEmpty(message = "数据集路径不能为空")
- private String path;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptLogQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptLogQueryDTO.java
deleted file mode 100644
index 53caa33..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptLogQueryDTO.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-
-/**
- * @description 模型优化日志查询参数
- * @date 2020-05-29
- */
-@Data
-public class ModelOptLogQueryDTO {
-
- @ApiModelProperty("模型优化实例ID")
- @NotNull(message = "模型优化实例ID")
- private Long instId;
-
- @ApiModelProperty(value = "起始行")
- @Min(value = 0, message = "startLine不能小于0")
- private Integer startLine;
-
- @ApiModelProperty(value = "行数")
- @Min(value = 1, message = "lines不能小于1")
- @Max(value = 1000, message = "lines不能大于1000")
- private Integer lines;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskCreateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskCreateDTO.java
deleted file mode 100644
index 8e7e9cd..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskCreateDTO.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * 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.domain.dto;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
-import java.io.Serializable;
-
-/**
- * @description 创建模型优化任务
- * @date 2020-05-22
- */
-@Data
-@Accessors(chain = true)
-public class ModelOptTaskCreateDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "任务名称", required = true)
- @NotEmpty(message = "任务名称不能为空")
- @Size(max = 32, message = "任务名称长度不能超过32")
- @Pattern(regexp = TrainUtil.REGEXP, message = "任务名称仅支持字母、数字、汉字、英文横杠和下划线")
- private String name;
-
- @ApiModelProperty(value = "任务描述")
- @Size(max = 500, message = "任务描述长度不能超过500")
- private String description;
-
- @ApiModelProperty(value = "是否内置", required = true)
- @NotNull(message = "请选择是否内置")
- private Boolean isBuiltIn;
-
- @ApiModelProperty(value = "数据集id")
- private Long datasetId;
-
- @ApiModelProperty(value = "数据集名称", required = true)
- @NotEmpty(message = "数据集不能为空")
- private String datasetName;
-
- @ApiModelProperty(value = "数据集路径", required = true)
- @NotEmpty(message = "数据集路径为空")
- private String datasetPath;
-
- @ApiModelProperty(value = "模型id")
- private Long modelId;
-
- @ApiModelProperty(value = "模型名称")
- private String modelName;
-
- @ApiModelProperty(value = "模型路径")
- private String modelAddress;
-
- @ApiModelProperty(value = "优化算法类别")
- private Integer algorithmType;
-
- @ApiModelProperty(value = "优化算法id")
- private Long algorithmId;
-
- @ApiModelProperty(value = "是否编辑")
- private Boolean editAlgorithm ;
-
- @ApiModelProperty(value = "优化算法", required = true)
- @NotEmpty(message = "请选择优化算法")
- private String algorithmName;
-
- @ApiModelProperty(value = "算法路径", required = true)
- @NotEmpty(message = "算法路径不能为空")
- private String algorithmPath;
-
- @ApiModelProperty(value = "运行命令")
- private String command;
-
- @ApiModelProperty(value = "运行参数")
- private JSONObject params;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskDeleteDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskDeleteDTO.java
deleted file mode 100644
index 18de210..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskDeleteDTO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 删除模型优化任务参数
- * @date 2020-05-22
- */
-@Data
-public class ModelOptTaskDeleteDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为空")
- private Long id;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceCancelDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceCancelDTO.java
deleted file mode 100644
index 4145e2d..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceCancelDTO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 取消模型优化任务参数
- * @date 2020-06-29
- */
-@Data
-public class ModelOptTaskInstanceCancelDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "实例id不能为空")
- private Long id;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceDeleteDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceDeleteDTO.java
deleted file mode 100644
index 3ff1574..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceDeleteDTO.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 删除任务实例对象
- * @date 2021-01-07
- */
-@Data
-public class ModelOptTaskInstanceDeleteDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "实例ID")
- @NotNull(message = "实例ID不能为空")
- private Long id;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceDetailDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceDetailDTO.java
deleted file mode 100644
index 9f6bee3..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceDetailDTO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 查看任务实例详情参数
- * @date 2020-06-29
- */
-@Data
-public class ModelOptTaskInstanceDetailDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "实例id不能为空")
- private Long id;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceQueryDTO.java
deleted file mode 100644
index e1abeed..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceQueryDTO.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.dubhe.annotation.Query;
-import org.dubhe.base.PageQueryBase;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.List;
-
-/**
- * @description 模型优化任务实例查询条件
- * @date 2020-05-22
- */
-@Data
-public class ModelOptTaskInstanceQueryDTO extends PageQueryBase implements Serializable {
- @ApiModelProperty("任务ID")
- @Query(propName = "task_id")
- private Long taskId;
- /**
- * 任务状态
- */
- @ApiModelProperty("任务状态")
- @Query
- private String status;
- /**
- * 优化算法
- */
- @ApiModelProperty("优化算法")
- @Query(propName = "algorithm_name")
- private String algorithmName;
- /**
- * 提交时间
- */
- @ApiModelProperty("提交时间")
- @Query(propName = "create_time", type = Query.Type.BETWEEN)
- private List createTime;
- /**
- * 完成时间
- */
- @ApiModelProperty("完成时间")
- @Query(propName = "end_time", type = Query.Type.BETWEEN)
- private List endTime;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceResubmitDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceResubmitDTO.java
deleted file mode 100644
index ebac902..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskInstanceResubmitDTO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 重新提交任务实例参数
- * @date 2020-05-22
- */
-@Data
-public class ModelOptTaskInstanceResubmitDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "实例id不能为空")
- private Long id;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskQueryDTO.java
deleted file mode 100644
index 82cda7a..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskQueryDTO.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.annotation.Query;
-import org.dubhe.base.PageQueryBase;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-import java.util.List;
-
-/**
- * @description 模型优化任务查询条件
- * @date 2020-05-22
- */
-@Data
-@Accessors(chain = true)
-public class ModelOptTaskQueryDTO extends PageQueryBase implements Serializable {
- @ApiModelProperty("任务id")
- @Query(propName = "id")
- private Long id;
-
- @Query(type = Query.Type.LIKE)
- @ApiModelProperty("任务名称或id")
- private String name;
-
- @ApiModelProperty("更新时间")
- @Query(type = Query.Type.BETWEEN, propName = "update_time")
- private List updateTime;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskRunParamDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskRunParamDTO.java
deleted file mode 100644
index 0417029..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskRunParamDTO.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-/**
- * @description 模型优化创建资源运行的参数类
- * @date 2020-05-25
- */
-@Data
-@Accessors(chain = true)
-public class ModelOptTaskRunParamDTO {
-
- /**
- * 实例id
- **/
- private Long instId;
- /**
- * 使用的镜像
- **/
- private String imageUrl;
- /**
- * 输入目录
- **/
- private String inputDir;
- /**
- * 输出目录
- **/
- private String outputDir;
- /**
- * 算法目录
- **/
- private String algorithmDir;
- /**
- * 日志目录
- **/
- private String logDir;
- /**
- * 数据集路径
- **/
- private String datasetDir;
- /**
- * 压缩前结果json目录
- **/
- private String resultJsonBeforeDir;
- /**
- * 压缩后结果json目录
- **/
- private String resultJsonAfterDir;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskSubmitDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskSubmitDTO.java
deleted file mode 100644
index 2ff55da..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskSubmitDTO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 模型优化任务提交参数
- * @date 2020-05-22
- */
-@Data
-public class ModelOptTaskSubmitDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为空")
- private Long id;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskUpdateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskUpdateDTO.java
deleted file mode 100644
index cffc132..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelOptTaskUpdateDTO.java
+++ /dev/null
@@ -1,100 +0,0 @@
-/**
- * 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.domain.dto;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotEmpty;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import javax.validation.constraints.Size;
-import java.io.Serializable;
-
-/**
- * @description 修改模型优化任务
- * @date 2020-05-22
- */
-@Data
-@Accessors(chain = true)
-public class ModelOptTaskUpdateDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为空")
- private Long id;
-
- @ApiModelProperty(value = "任务名称", required = true)
- @NotEmpty(message = "任务名称不能为空")
- @Size(max = 32, message = "任务名称长度不能超过32")
- @Pattern(regexp = "^[a-zA-Z0-9\\-\\_\\u4e00-\\u9fa5]+$", message = "任务名称仅支持字母、数字、汉字、英文横杠和下划线")
- private String name;
-
- @ApiModelProperty(value = "任务描述")
- @Size(max = 500, message = "任务描述长度不能超过500")
- private String description;
-
- @ApiModelProperty(value = "是否内置", required = true)
- @NotNull(message = "请选择是否内置")
- private Boolean isBuiltIn;
-
- @ApiModelProperty(value = "数据集id")
- private Long datasetId;
-
- @ApiModelProperty(value = "数据集名称", required = true)
- @NotEmpty(message = "数据集不能为空")
- private String datasetName;
-
- @ApiModelProperty(value = "数据集路径", required = true)
- @NotEmpty(message = "数据集路径为空")
- private String datasetPath;
-
- @ApiModelProperty(value = "模型id")
- private Long modelId;
-
- @ApiModelProperty(value = "模型名称")
- private String modelName;
-
- @ApiModelProperty(value = "模型路径")
- private String modelAddress;
-
- @ApiModelProperty(value = "优化算法类型")
- private Integer algorithmType;
-
- @ApiModelProperty(value = "优化算法id")
- private Long algorithmId;
-
- @ApiModelProperty(value = "优化算法", required = true)
- @NotEmpty(message = "请选择优化算法")
- private String algorithmName;
-
- @ApiModelProperty(value = "算法路径", required = true)
- @NotEmpty(message = "算法路径不能为空")
- private String algorithmPath;
-
- @ApiModelProperty(value = "是否编辑")
- private Boolean editAlgorithm ;
-
- @ApiModelProperty(value = "运行命令")
- private String command;
-
- @ApiModelProperty(value = "运行参数")
- private JSONObject params;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelQueryDTO.java
deleted file mode 100644
index c03e128..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/ModelQueryDTO.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.domain.dto;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-/**
- * @description model 查询dto
- * @date 2020-10-09
- */
-@Data
-@ApiModel("模型查询")
-public class ModelQueryDTO {
- @ApiModelProperty(value = "模型类型")
- private Integer modelResource;
- @ApiModelProperty(value = "模型名称")
- private String name;
- @ApiModelProperty(value = "模型版本")
- private String version;
- @ApiModelProperty(value = "模型id")
- private Integer id;
- @ApiModelProperty(value = "模型路径")
- private String modelPath;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookCreateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookCreateDTO.java
deleted file mode 100644
index 0f38743..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookCreateDTO.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.dubhe.utils.NotebookUtil;
-
-import javax.validation.constraints.*;
-
-/**
- * @description 创建notebook请求体
- * @date 2020-06-28
- */
-@Data
-public class NoteBookCreateDTO {
-
- @NotBlank
- @Pattern(regexp = NotebookUtil.K8S_NOTEBOOK_REGEX, message = "Notebook 名称仅支持字母、数字、汉字、英文横杠和下划线")
- @Size(max = 30, message = "名称内容超长")
- @ApiModelProperty(value = "notebook 名称")
- private String noteBookName;
-
- @Size(max = 255, message = "描述内容超长")
- @ApiModelProperty(value = "notebook 描述")
- private String description;
-
- @ApiModelProperty(hidden = true)
- private String url;
-
- @ApiModelProperty(hidden = true)
- private Integer totalRunMin;
-
- @NotNull
- @Min(value = NotebookUtil.CPU_MIN_NUMBER, message = "最少需要一个CPU")
- @Max(value = NotebookUtil.CPU_MAX_NUMBER, message = "CPU数量超过限制,不可大于8")
- @ApiModelProperty(value = "cpu数量")
- private Integer cpuNum;
-
- @Min(value = NotebookUtil.GPU_MIN_NUMBER, message = "最少需要一个GPU")
- @Max(value = NotebookUtil.GPU_MAX_NUMBER, message = "GPU数量超过限制,不可大于4")
- @ApiModelProperty(value = "gpu数量")
- private Integer gpuNum;
-
- @NotNull
- @Min(value = NotebookUtil.MEMORY_MIN_NUMBER, message = "最少需要1G内存")
- @Max(value = NotebookUtil.MEMORY_MAX_NUMBER, message = "内存超出限制,不可大于8")
- @ApiModelProperty(value = "内存大小")
- private Integer memNum;
-
- @NotNull
- @Min(value = NotebookUtil.DISK_MEMORY_MIN_NUMBER, message = "至少需要1G硬盘内存")
- @Max(value = NotebookUtil.DISK_MEMORY_MAX_NUMBER, message = "硬盘内存超出限制,不可大于1024")
- @ApiModelProperty(value = "硬盘内存大小")
- private Integer diskMemNum;
-
- @ApiModelProperty("镜像名称")
- @NotNull(message = "请选择镜像")
- private String k8sImageName;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookListQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookListQueryDTO.java
deleted file mode 100644
index 05457b5..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookListQueryDTO.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.dubhe.annotation.Query;
-
-import java.io.Serializable;
-
-/**
- * @description 查询请求体
- * @date 2020-06-28
- */
-@Data
-public class NoteBookListQueryDTO implements Serializable {
-
- @ApiModelProperty("0运行中,1停止, 2删除, 3启动中,4停止中,5删除中,6运行异常(暂未启用)")
- private Integer status;
-
- @Query(propName = "notebook_name", type = Query.Type.LIKE)
- @ApiModelProperty("notebook名称")
- private String noteBookName;
-
- @Query(propName = "origin_user_id", type = Query.Type.EQ)
- @ApiModelProperty(value = "所属用户ID", hidden = true)
- private Long userId;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookQueryDTO.java
deleted file mode 100644
index 2543fb8..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookQueryDTO.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.Data;
-import org.dubhe.annotation.Query;
-import org.dubhe.enums.NoteBookStatusEnum;
-import org.dubhe.utils.K8sCallBackTool;
-
-import java.io.Serializable;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @description 查询notebook请求体
- * @date 2020-04-28
- */
-@Data
-public class NoteBookQueryDTO implements Serializable {
-
- @Query(propName = "status", type = Query.Type.NE)
- private Integer neStatus;
-
- @Query(propName = "status", type = Query.Type.IN)
- private List statusList;
-
- @Query(propName = "k8s_pvc_path", type = Query.Type.EQ)
- private String k8sPvcPath;
-
- @Query(propName = "origin_user_id", type = Query.Type.EQ)
- private Long userId;
-
- @Query(propName = "last_operation_timeout", type = Query.Type.LT)
- private Long lastOperationTimeout;
-
-
- private static final NoteBookQueryDTO QUERY_CRITERIA;
-
- public NoteBookQueryDTO() {
- }
-
- public NoteBookQueryDTO(Integer neStatus, String k8sPvcPath, Long userId) {
- this.neStatus = neStatus;
- this.k8sPvcPath = k8sPvcPath;
- this.userId = userId;
- }
-
- static {
- QUERY_CRITERIA = new NoteBookQueryDTO();
- QUERY_CRITERIA.setNeStatus(NoteBookStatusEnum.DELETE.getCode());
- }
-
- /**
- * 获取需要刷新状态的查询条件
- *
- * @return
- */
- public static NoteBookQueryDTO getToRefreshCriteria() {
- NoteBookQueryDTO refreshCriteria = new NoteBookQueryDTO();
- refreshCriteria.setStatusList(Arrays.asList(
- NoteBookStatusEnum.STARTING.getCode()
- , NoteBookStatusEnum.STOPPING.getCode()
- , NoteBookStatusEnum.DELETING.getCode()));
- refreshCriteria.setLastOperationTimeout(K8sCallBackTool.getCurrentSecondLong());
- return refreshCriteria;
- }
-
- /**
- * 获取查询列表需要的查询条件
- *
- * @return
- */
- public static NoteBookQueryDTO getListCriteria() {
- return QUERY_CRITERIA;
- }
-
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookStatusDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookStatusDTO.java
deleted file mode 100644
index 228a01e..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/NoteBookStatusDTO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description note book status
- * @date 2020-05-14
- */
-@Data
-public class NoteBookStatusDTO implements Serializable {
-
- @ApiModelProperty("状态编码")
- private Integer statusCode;
-
- @ApiModelProperty("状态名称")
- private String statusName;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetDTO.java
deleted file mode 100644
index 36fe478..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetDTO.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description 数据集
- * @date 2020-03-17
- */
-@Data
-public class PtDatasetDTO implements Serializable {
- private Long id;
- private String name;
- private String remark;
- private String type;
- private TeamSmallDTO team;
- /**
- * 创建用户
- */
- private UserSmallDTO createUser;
- private Timestamp createTime;
- private Timestamp updateTime;
- private Boolean deleted;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetSmallDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetSmallDTO.java
deleted file mode 100644
index 397579c..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetSmallDTO.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 数据集
- * @date 2020-03-17
- */
-@Data
-public class PtDatasetSmallDTO implements Serializable {
- private Long id;
- private String name;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDevEnvsDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDevEnvsDTO.java
deleted file mode 100644
index 3309b18..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDevEnvsDTO.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description 开发环境
- * @date 2020-03-17
- */
-@Data
-public class PtDevEnvsDTO implements Serializable {
-
- private Long id;
- private String name;
- private String remark;
- private String type;
- private Integer podNum;
- private Integer gpuNum;
- private Integer memNum;
- private Integer cpuNum;
- private Integer duration;
- private Timestamp startTime;
- private Timestamp closeTime;
- private PtDatasetSmallDTO dataset;
- private PtImageSmallDTO image;
- private PtStorageSmallDTO storage;
- private TeamSmallDTO team;
- private UserSmallDTO createUser;
- private Timestamp createTime;
- private Timestamp updateTime;
- private Boolean deleted;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDevEnvsQueryCriteria.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDevEnvsQueryCriteria.java
deleted file mode 100644
index 3d7f1bf..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDevEnvsQueryCriteria.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.Data;
-
-/**
- * @description 开发环境查询条件
- * @date 2020-03-17
- */
-@Data
-public class PtDevEnvsQueryCriteria {
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageDTO.java
deleted file mode 100644
index 3856980..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageDTO.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.dubhe.domain.entity.Team;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description: 镜像
- * @date 2020-03-17
- */
-@Data
-public class PtImageDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("镜像ID")
- private Long id;
-
- @ApiModelProperty("镜像名称")
- private String name;
-
- @ApiModelProperty("镜像描述")
- private String remark;
-
- @ApiModelProperty("类型")
- private String type;
-
- @ApiModelProperty("标签")
- private String label;
-
- @ApiModelProperty("地址")
- private String uri;
-
- @ApiModelProperty("团队")
- private Team team;
-
- @ApiModelProperty("创建人")
- private UserSmallDTO createUser;
-
- @ApiModelProperty("创建时间")
- private Timestamp createTime;
-
- @ApiModelProperty("更新时间")
- private Timestamp updateTime;
-
- @ApiModelProperty("删除(0正常,1已删除)")
- private Boolean deleted;
-
- @ApiModelProperty("资源拥有者ID")
- private Long originUserId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageDeleteDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageDeleteDTO.java
deleted file mode 100644
index 6faa8d8..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageDeleteDTO.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @description 训练镜像删除DTO
- * @date 2020-08-13
- */
-@Data
-@Accessors(chain = true)
-public class PtImageDeleteDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "镜像id不能为空")
- private List ids;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageQueryDTO.java
deleted file mode 100644
index a413e01..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageQueryDTO.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.annotation.FlagValidator;
-import org.dubhe.base.PageQueryBase;
-
-import java.io.Serializable;
-
-/**
- * @description 镜像查询
- * @date 2020-05-09
- */
-@Data
-@Accessors(chain = true)
-public class PtImageQueryDTO extends PageQueryBase implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
-
- @ApiModelProperty(value = "镜像来源(0为我的镜像, 1为预置镜像)")
- private Integer imageResource;
-
- @ApiModelProperty(value = "镜像状态,0为制作中,1位制作成功,2位制作失败")
- private Integer imageStatus;
-
- @ApiModelProperty(value = "镜像名称或id")
- private String imageNameOrId;
-
- @ApiModelProperty(value = "镜像项目类型(0:notebook , 1:train)")
- @FlagValidator(value = {"0", "1"}, message = "镜像项目类型不支持")
- private Integer projectType;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageQueryUrlDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageQueryUrlDTO.java
deleted file mode 100644
index 6e46601..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageQueryUrlDTO.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.annotation.FlagValidator;
-
-/**
- * @description 查询镜像路径
- * @date 2020-12-14
- */
-@Data
-@Accessors(chain = true)
-@EqualsAndHashCode
-public class PtImageQueryUrlDTO {
-
- @ApiModelProperty(value = "镜像来源(0为我的镜像, 1为预置镜像)")
- private Integer imageResource;
-
- @ApiModelProperty(value = "镜像名称")
- private String imageName;
-
- @ApiModelProperty(value = "镜像标签")
- private String iamgeTag;
-
- @ApiModelProperty(value = "镜像项目类型(0:notebook , 1:train)")
- @FlagValidator(value = {"0", "1"}, message = "镜像项目类型不支持")
- private Integer projectType;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageSmallDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageSmallDTO.java
deleted file mode 100644
index 7aaa3d9..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageSmallDTO.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description: 镜像
- * @date 2020-03-17
- */
-@Data
-public class PtImageSmallDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("镜像ID")
- private Long id;
-
- @ApiModelProperty("镜像名称")
- private String name;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageUpdateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageUpdateDTO.java
deleted file mode 100644
index 047168e..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageUpdateDTO.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @description 训练镜像信息修改DTO
- * @date 2020-08-13
- */
-@Data
-@Accessors(chain = true)
-public class PtImageUpdateDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "镜像id不能为空")
- private List ids;
-
- @ApiModelProperty("镜像描述")
- @Length(max = TrainUtil.NUMBER_ONE_THOUSAND_AND_TWENTY_FOUR, message = "镜像描述-输入长度不能超过1024个字符")
- private String remark;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageUploadDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageUploadDTO.java
deleted file mode 100644
index f7ccb0f..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtImageUploadDTO.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.io.Serializable;
-
-
-/**
- * @description 上传镜像
- * @date 2020-06-11
- */
-@Data
-@Accessors(chain = true)
-public class PtImageUploadDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "镜像项目类型", required = true)
- @NotNull(message = "镜像项目类型不能为空")
- private Integer projectType;
-
- @ApiModelProperty(value = "镜像文件路径", required = true)
- @NotBlank(message = "镜像文件路径不能为空")
- private String imagePath;
-
- @ApiModelProperty(value = "镜像名称", required = true)
- @NotBlank(message = "源镜像名称不能为空")
- @Length(min = TrainUtil.NUMBER_ONE, max = TrainUtil.NUMBER_SIXTY_FOUR, message = "镜像名称长度在1-64个字符")
- @Pattern(regexp = TrainUtil.REGEXP_NAME, message = "镜像名称支持字母、数字、英文横杠和下划线")
- private String imageName;
-
- @ApiModelProperty(value = "镜像版本号", required = true)
- @NotBlank(message = "镜像版本号不能为空")
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "镜像版本号长度在1-32个字符")
- @Pattern(regexp = TrainUtil.REGEXP_TAG, message = "镜像版本号支持字母、数字、英文横杠、英文.号和下划线")
- private String imageTag;
-
- @ApiModelProperty("镜像描述")
- @Length(max = TrainUtil.NUMBER_ONE_THOUSAND_AND_TWENTY_FOUR, message = "镜像描述-输入长度不能超过1024个字符")
- private String remark;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureDTO.java
deleted file mode 100644
index 83d1e57..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureDTO.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import javax.validation.constraints.NotBlank;
-import java.io.Serializable;
-
-/**
- * @description 度量管理入参DTO
- * @date 2020-11-16
- */
-@Data
-@Builder
-@NoArgsConstructor
-@AllArgsConstructor
-public class PtMeasureDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "度量名称", required = true)
- @NotBlank(message = "度量名称不能为空")
- private String name;
-
- @ApiModelProperty("度量描述(选填)")
- private String description;
-
- @ApiModelProperty(value = "度量文件路径", required = true)
- @NotBlank(message = "度量文件路径不能为空")
- private String url;
-
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureDeleteDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureDeleteDTO.java
deleted file mode 100644
index 843891c..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureDeleteDTO.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.Set;
-
-/**
- * @description 删除度量信息入参DTO
- * @date 2020-11-16
- */
-@Data
-@Builder
-@NoArgsConstructor
-@AllArgsConstructor
-public class PtMeasureDeleteDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "参数id,参数id不能小于1", required = true)
- @NotNull(message = "度量id不能为空")
- private Set ids;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureQueryDTO.java
deleted file mode 100644
index 0ba9e35..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureQueryDTO.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.dubhe.base.PageQueryBase;
-
-import java.io.Serializable;
-
-/**
- * @description 度量管理查询接口入参DTO
- * @date 2020-11-16
- */
-@Data
-public class PtMeasureQueryDTO extends PageQueryBase implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "度量名称", required = true)
- private String nameOrId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureUpdateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureUpdateDTO.java
deleted file mode 100644
index 6b41b2e..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtMeasureUpdateDTO.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Builder;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.dubhe.utils.TrainUtil;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 修改度量信息入参DTO
- * @date 2020-11-16
- */
-@Data
-@Builder
-@NoArgsConstructor
-@AllArgsConstructor
-public class PtMeasureUpdateDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "参数id,参数id不能小于1", required = true)
- @NotNull(message = "度量id不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "度量参数id不能小于1")
- private Long id;
-
- @ApiModelProperty(value = "度量名称", required = true)
- @NotBlank(message = "度量名称不能为空")
- private String name;
-
- @ApiModelProperty("度量描述(选填)")
- private String description;
-
- @ApiModelProperty(value = "度量文件路径", required = true)
- @NotBlank(message = "度量文件路径不能为空")
- private String url;
-
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtModelAlgorithmCreateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtModelAlgorithmCreateDTO.java
deleted file mode 100644
index faf6f78..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtModelAlgorithmCreateDTO.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Pattern;
-import java.io.Serializable;
-
-/**
- * @description 模型优化上传算法入参
- * @date 2021-01-06
- */
-@Data
-@Accessors(chain = true)
-public class PtModelAlgorithmCreateDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "算法名称,输入长度不能超过32个字符", required = true)
- @NotBlank(message = "算法名称不能为空")
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "算法名称-输入长度不能超过32个字符")
- @Pattern(regexp = TrainUtil.REGEXP, message = "算法名称支持字母、数字、汉字、英文横杠和下划线")
- private String name;
-
- @ApiModelProperty(value = "代码目录(路径规则:/algorithm-manage/{userId}/{YYYYMMDDhhmmssSSS+四位随机数}/用户上传的算法具体文件(zip文件)名称或从notebook跳转时为/notebook/{userId}/{YYYYMMDDhhmmssSSS+四位随机数}/)", required = true)
- @NotBlank(message = "代码目录不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "代码目录-输入长度不能超过128个字符")
- private String path;
-
-}
\ No newline at end of file
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageSmallDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageSmallDTO.java
deleted file mode 100644
index d6f4b66..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageSmallDTO.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 存储
- * @date 2020-03-17
- */
-@Data
-public class PtStorageSmallDTO implements Serializable {
- private Long id;
- private String name;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmCreateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmCreateDTO.java
deleted file mode 100644
index d9f6eea..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmCreateDTO.java
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * 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.domain.dto;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Pattern;
-import java.io.Serializable;
-
-/**
- * @desciption 创建算法条件
- * @date 2020-04-29
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainAlgorithmCreateDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "算法名称,输入长度不能超过32个字符", required = true)
- @NotBlank(message = "算法名称不能为空")
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "算法名称-输入长度不能超过32个字符")
- @Pattern(regexp = TrainUtil.REGEXP, message = "算法名称支持字母、数字、汉字、英文横杠和下划线")
- private String algorithmName;
-
- @ApiModelProperty("算法描述,输入长度不能超过256个字符")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "算法描述-输入长度不能超过256个字符")
- private String description;
-
- @ApiModelProperty(value = "镜像版本")
- private String imageTag;
-
- @ApiModelProperty(value = "镜像名称")
- private String imageName;
-
- @ApiModelProperty(value = "创建算法来源(true:由fork创建算法,false:其它创建算法方式)")
- private Boolean fork;
-
- @ApiModelProperty(value = "代码目录(路径规则:/algorithm-manage/{userId}/{YYYYMMDDhhmmssSSS+四位随机数}/用户上传的算法具体文件(zip文件)名称或从notebook跳转时为/notebook/{userId}/{YYYYMMDDhhmmssSSS+四位随机数}/)", required = true)
- @NotBlank(message = "代码目录不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "代码目录-输入长度不能超过128个字符")
- private String codeDir;
-
- @ApiModelProperty(value = "运行命令")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "运行命令-输入长度不能超过128个字符")
- private String runCommand;
-
- @ApiModelProperty("运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)")
- private JSONObject runParams;
-
- @ApiModelProperty("算法用途,输入长度不能超过128个字符")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "算法用途-输入长度不能超过128个字符")
- private String algorithmUsage;
-
- @ApiModelProperty("是否输出训练结果,不填则默认为true")
- private Boolean isTrainOut;
-
- @ApiModelProperty("是否输出训练日志,不填则默认为true")
- private Boolean isTrainLog;
-
- @ApiModelProperty("是否输出可视化日志,不填则默认为false")
- private Boolean isVisualizedLog;
-
- @ApiModelProperty("noteBookId")
- private Long noteBookId;
-
- @ApiModelProperty("资源拥有者ID")
- private Long originUserId;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmDeleteDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmDeleteDTO.java
deleted file mode 100644
index 8768150..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmDeleteDTO.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.Set;
-
-/**
- * @description 算法删除
- * @date 2020-07-02
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainAlgorithmDeleteDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为空")
- private Set ids;
-
-}
\ No newline at end of file
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmQueryDTO.java
deleted file mode 100644
index 8f00024..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmQueryDTO.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.annotation.Query;
-import org.dubhe.base.PageQueryBase;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import java.io.Serializable;
-
-/**
- * @description 查询算法条件
- * @date 2020-04-29
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-public class PtTrainAlgorithmQueryDTO extends PageQueryBase implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "算法来源(1为我的算法, 2为预置算法)")
- @Min(value = TrainUtil.NUMBER_ONE, message = "算法来源错误")
- @Max(value = TrainUtil.NUMBER_TWO, message = "算法来源错误")
- @Query(propName = "algorithm_source", type = Query.Type.EQ)
- private Integer algorithmSource;
-
- @ApiModelProperty(value = "算法名称或者id")
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "算法名称或者id有误")
- private String algorithmName;
-
- @ApiModelProperty(value = "算法用途")
- private String algorithmUsage;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUpdateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUpdateDTO.java
deleted file mode 100644
index 06785dc..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUpdateDTO.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.io.Serializable;
-
-/**
- * @description 修改算法
- * @date 2020-06-19
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainAlgorithmUpdateDTO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为null")
- @Min(value = TrainUtil.NUMBER_ONE, message = "id必须大于1")
- private Long id;
-
- @ApiModelProperty(value = "算法名称,输入长度不能超过32个字符")
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "算法名称-输入长度不能超过32个字符")
- @Pattern(regexp = TrainUtil.REGEXP, message = "算法名称支持字母、数字、汉字、英文横杠和下划线")
- private String algorithmName;
-
- @ApiModelProperty("算法描述,输入长度不能超过256个字符")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "算法描述-输入长度不能超过256个字符")
- private String description;
-
- @ApiModelProperty("算法用途,输入长度不能超过128个字符")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "算法用途-输入长度不能超过128个字符")
- private String algorithmUsage;
-
- @ApiModelProperty("是否输出训练日志")
- private Boolean isTrainLog;
-
- @ApiModelProperty("是否输出可视化日志")
- private Boolean isVisualizedLog;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageCreateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageCreateDTO.java
deleted file mode 100644
index aff4a97..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageCreateDTO.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.Pattern;
-import java.io.Serializable;
-
-/**
- * @description 创建算法用途条件
- * @date 2020-06-23
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainAlgorithmUsageCreateDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "名称输入长度不能超过32个字符", required = true)
- @NotBlank(message = "名称不能为空")
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "名称-输入长度不能超过32个字符")
- @Pattern(regexp = TrainUtil.REGEXP, message = "名称支持字母、数字、汉字、英文横杠和下划线")
- private String auxInfo;
-
- @ApiModelProperty(value = "类型", hidden = true)
- private String type;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageDeleteDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageDeleteDTO.java
deleted file mode 100644
index 3d96b15..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageDeleteDTO.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 算法用途删除
- * @date 2020/7/2
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainAlgorithmUsageDeleteDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为空")
- private Long[] ids;
-
-}
\ No newline at end of file
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageQueryDTO.java
deleted file mode 100644
index f85cd22..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageQueryDTO.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-
-import org.dubhe.base.PageQueryBase;
-
-/**
- * @description 查询算法用途条件
- * @date 2020-06-23
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-public class PtTrainAlgorithmUsageQueryDTO extends PageQueryBase {
-
- @ApiModelProperty(value = "类型", hidden = true)
- private String type;
-
- @ApiModelProperty(value = "是否包含默认值 0:不包含 1包含", required = true)
- @NotNull
- private Boolean isContainDefault;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageUpdateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageUpdateDTO.java
deleted file mode 100644
index 2b8b19a..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainAlgorithmUsageUpdateDTO.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 算法用途修改
- * @date 2020-06-23
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainAlgorithmUsageUpdateDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为null")
- @Min(value = TrainUtil.NUMBER_ONE, message = "id必须大于1")
- private Long id;
-
- @ApiModelProperty("描述, 长度不能超过20个字符")
- @Length(max = TrainUtil.NUMBER_TWENTY, message = "名称长度不能超过20个字符")
- private String auxInfo;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainDataSourceStatusQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainDataSourceStatusQueryDTO.java
deleted file mode 100644
index d586e04..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainDataSourceStatusQueryDTO.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @description 查询数据集对应训练状态查询条件
- * @date 2020-05-21
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainDataSourceStatusQueryDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("数据集路径")
- private List dataSourcePath;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobCreateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobCreateDTO.java
deleted file mode 100644
index f7c85a4..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobCreateDTO.java
+++ /dev/null
@@ -1,163 +0,0 @@
-/**
- * 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.domain.dto;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseImageDTO;
-import org.dubhe.utils.PtModelUtil;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-
-/**
- * @description 创建训练任务
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-public class PtTrainJobCreateDTO extends BaseImageDTO {
-
- @ApiModelProperty(value = "训练作业名, 长度在1-32个字符", required = true)
- @NotNull(message = "训练作业名不能为空")
- @Length(min = TrainUtil.NUMBER_ONE, max = TrainUtil.NUMBER_THIRTY_TWO, message = "训练作业名长度在1-32个字符")
- @Pattern(regexp = TrainUtil.REGEXP, message = "训练作业名称支持字母、数字、汉字、英文横杠和下划线")
- private String trainName;
-
- @ApiModelProperty("描述, 长度不能超过255个字符")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "描述长度不能超过255个字符")
- private String description;
-
- @ApiModelProperty(value = "算法来源id", required = true)
- @NotNull(message = "algorithmId不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "algorithmId必须不小于1")
- private Long algorithmId;
-
- @ApiModelProperty(value = "运行命令,输入长度不能超过128个字符", required = true)
- @NotBlank(message = "运行命令不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "运行命令-输入长度不能超过128个字符")
- private String runCommand;
-
- @ApiModelProperty(value = "数据来源名称, 长度在1-127个字符", required = true)
- @NotNull(message = "数据来源名称不能为空")
- @Length(min = TrainUtil.NUMBER_ONE, max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_SEVEN, message = "数据来源名称长度在1-127个字符")
- private String dataSourceName;
-
- @ApiModelProperty(value = "数据来源路径, 长度在1-127个字符", required = true)
- @NotNull(message = "数据来源路径不能为空")
- @Length(min = TrainUtil.NUMBER_ONE, max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_SEVEN, message = "数据来源路径长度在1-127个字符")
- private String dataSourcePath;
-
- @ApiModelProperty("运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)")
- private JSONObject runParams;
-
- @ApiModelProperty(value = "类型(0为CPU,1为GPU)", required = true)
- @Min(value = TrainUtil.NUMBER_ZERO, message = "类型错误")
- @Max(value = TrainUtil.NUMBER_ONE, message = "类型错误")
- @NotNull(message = "类型(0为CPU,1为GPU)不能为空")
- private Integer resourcesPoolType;
-
- @ApiModelProperty(value = "规格名称", required = true)
- @NotNull(message = "规格名称不能为空")
- private String trainJobSpecsName;
-
- @ApiModelProperty(value = "规格信息", required = true)
- @NotNull(message = "规格信息不能为空")
- private String trainJobSpecsInfo;
-
- @ApiModelProperty("true代表保存作业参数")
- private Boolean saveParams;
-
- @ApiModelProperty("作业参数名称,当saveParams为true的时候传递, 输入长度不能超过32个字符")
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "作业参数名称-输入长度不能超过32个字符")
- @Pattern(regexp = TrainUtil.REGEXP, message = "作业参数名称支持字母、数字、汉字、英文横杠和下划线")
- private String trainParamName;
-
- @ApiModelProperty("作业参数描述,当saveParams为true的时候传递, 长度不能超过255个字符")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "作业参数描述-输入长度不能超过255个字符")
- private String trainParamDesc;
-
- @ApiModelProperty(value = "训练类型 0:普通训练,1:分布式训练", required = true)
- @Min(value = TrainUtil.NUMBER_ZERO, message = "训练类型错误")
- @Max(value = TrainUtil.NUMBER_ONE, message = "训练类型错误")
- @NotNull(message = "训练类型(0为普通训练,1为分布式训练)不能为空")
- private Integer trainType;
-
- @ApiModelProperty(value = "节点个数", required = true)
- @Min(value = TrainUtil.NUMBER_ONE, message = "节点个数至少1个")
- @NotNull(message = "节点个数")
- private Integer resourcesPoolNode;
-
- @ApiModelProperty("验证数据来源名称")
- private String valDataSourceName;
-
- @ApiModelProperty("验证数据来源路径")
- private String valDataSourcePath;
-
- @ApiModelProperty("是否验证数据集")
- private Integer valType;
-
- @ApiModelProperty(value = "训练延时启动时长,单位为小时")
- @Min(value = TrainUtil.NUMBER_ZERO, message = "训练延时启动时长不能小于0小时")
- @Max(value = TrainUtil.NUMBER_ONE_HUNDRED_AND_SIXTY_EIGHT, message = "训练延时启动时长不能大于168小时即时长不能超过一周(7*24小时)")
- private Integer delayCreateTime;
-
- @ApiModelProperty(value = "训练自动停止时长,单位为小时")
- @Min(value = TrainUtil.NUMBER_ZERO, message = "训练自动停止时长不能小于0小时")
- @Max(value = TrainUtil.NUMBER_ONE_HUNDRED_AND_SIXTY_EIGHT, message = "训练自动停止时长不能大于168小时即时长不能超过一周(7*24小时)")
- private Integer delayDeleteTime;
-
- @ApiModelProperty("资源拥有者ID")
- private Long originUserId;
-
- @ApiModelProperty(value = "训练信息(失败信息)")
- private String trainMsg;
-
- @ApiModelProperty(value = "模型类型(0我的模型1预置模型2炼知模型)" +
- "当值为0和1的时候,需要传递ModelId, 当值为2的时候传递teacherModelIds和studentModelIds")
- @Min(value = PtModelUtil.NUMBER_ZERO, message = "模型来源错误")
- @Max(value = PtModelUtil.NUMBER_TWO, message = "模型来源错误")
- private Integer modelResource;
-
- @ApiModelProperty(value = "模型id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "模型id必须大于1")
- private Long modelId;
-
- @ApiModelProperty(value = "我的模型版本对应的id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "模型版本对应的id必须大于1")
- private Long modelBranchId;
-
- @ApiModelProperty(value = "教师模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "教师模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "教师模型ids参数格式不正确")
- private String teacherModelIds;
-
- @ApiModelProperty(value = "学生模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "学生模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "学生模型ids参数格式不正确")
- private String studentModelIds;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobDTO.java
deleted file mode 100644
index 5ce65f6..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobDTO.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/**
- * 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.domain.dto;
-
-import lombok.Data;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description: 训练任务
- * @date 2020-03-17
- */
-@Data
-public class PtTrainJobDTO implements Serializable {
- private Long id;
- private String name;
- private String remark;
- private PtDatasetSmallDTO dataset;
- private PtImageSmallDTO image;
- private PtStorageSmallDTO storage;
- private TeamSmallDTO team;
- private String selectorLabel;
- private Integer podNum;
- private Integer gpuNum;
- private Integer memNum;
- private Integer cpuNum;
- private Integer level;
- private Timestamp startTime;
- private Timestamp closeTime;
- private String cmd;
- private String status;
- private UserSmallDTO confirmUser;
- private UserSmallDTO createUser;
- private Timestamp createTime;
- private Timestamp updateTime;
- private Boolean deleted;
- private Long originUserId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobDeleteDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobDeleteDTO.java
deleted file mode 100644
index 371060b..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobDeleteDTO.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 删除训练任务
- * @date 2020-04-27
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainJobDeleteDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "trainId,如果只传递trainId,代表删除该trainId下的所有job", required = true)
- @NotNull(message = "trainId不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "trainId数值不合法")
- private Long trainId;
-
- @ApiModelProperty(value = "jobId")
- @Min(value = TrainUtil.NUMBER_ONE, message = "jobId数值不合法")
- private Long id;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobDetailQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobDetailQueryDTO.java
deleted file mode 100644
index fba7474..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobDetailQueryDTO.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 根据jobId查询训练任务详情查询条件
- * @date 2020-06-12
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainJobDetailQueryDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为null")
- @Min(value = TrainUtil.NUMBER_ONE, message = "id必须大于1")
- private Long id;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobResumeDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobResumeDTO.java
deleted file mode 100644
index a494745..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobResumeDTO.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 恢复训练
- * @date 2020-04-27
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainJobResumeDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "id数值不合法")
- private Long id;
-
- @ApiModelProperty(value = "path", required = true)
- @NotNull(message = "path不能为空")
- private String path;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobSpecsQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobSpecsQueryDTO.java
deleted file mode 100644
index d041954..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobSpecsQueryDTO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description: 训练作业规格查询
- * @date 2020-05-06
- */
-@Data
-public class PtTrainJobSpecsQueryDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "规格类型(0为CPU, 1为GPU)")
- private Integer resourcesPoolType;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobStopDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobStopDTO.java
deleted file mode 100644
index 4b52592..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobStopDTO.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 停止训练
- * @date 2020-04-27
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainJobStopDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "trainId,如果只传递trainId,代表删除该trainId下的所有job", required = true)
- @NotNull(message = "trainId不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "trainId数值不合法")
- private Long trainId;
-
- @ApiModelProperty(value = "jobId")
- @Min(value = TrainUtil.NUMBER_ONE, message = "jobId数值不合法")
- private Long id;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobUpdateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobUpdateDTO.java
deleted file mode 100644
index f7570dc..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobUpdateDTO.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/**
- * 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.domain.dto;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseImageDTO;
-import org.dubhe.utils.PtModelUtil;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-
-/**
- * @description 训练任务修改
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-public class PtTrainJobUpdateDTO extends BaseImageDTO {
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为null")
- @Min(value = TrainUtil.NUMBER_ONE, message = "id必须大于1")
- private Long id;
-
- @ApiModelProperty("描述, 长度不能超过255个字符")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "描述长度不能超过255个字符")
- private String description;
-
- @ApiModelProperty("算法id")
- @NotNull(message = "algorithmId不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "algorithmId必须大于1")
- private Long algorithmId;
-
- @ApiModelProperty(value = "运行命令,输入长度不能超过128个字符", required = true)
- @NotBlank(message = "运行命令不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "运行命令-输入长度不能超过128个字符")
- private String runCommand;
-
- @ApiModelProperty(value = "数据集来源路径,输入长度不能超过127个字符", required = true)
- @NotBlank(message = "数据集来源路径不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_SEVEN, message = "数据集来源路径-输入长度不能超过127个字符")
- private String dataSourcePath;
-
- @ApiModelProperty(value = "数据集来源名称,输入长度不能超过127个字符", required = true)
- @NotBlank(message = "数据集来源名称不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_SEVEN, message = "数据集来源名称-输入长度不能超过127个字符")
- private String dataSourceName;
-
- @ApiModelProperty("运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)")
- private JSONObject runParams;
-
- @ApiModelProperty(value = "类型(0为CPU,1为GPU)", required = true)
- @Min(value = TrainUtil.NUMBER_ZERO, message = "类型错误")
- @Max(value = TrainUtil.NUMBER_ONE, message = "类型错误")
- @NotNull(message = "类型(0为CPU,1为GPU)不能为空")
- private Integer resourcesPoolType;
-
- @ApiModelProperty(value = "规格名称", required = true)
- @NotNull(message = "规格名称不能为空")
- private String trainJobSpecsName;
-
- @ApiModelProperty(value = "规格信息", required = true)
- @NotNull(message = "规格信息不能为空")
- private String trainJobSpecsInfo;
-
- @ApiModelProperty(value = "训练类型 0:普通训练,1:分布式训练", required = true)
- @Min(value = TrainUtil.NUMBER_ZERO, message = "训练类型错误")
- @Max(value = TrainUtil.NUMBER_ONE, message = "训练类型错误")
- @NotNull(message = "训练类型(0为普通训练,1为分布式训练)不能为空")
- private Integer trainType;
-
- @ApiModelProperty(value = "节点个数", required = true)
- @Min(value = TrainUtil.NUMBER_ONE, message = "节点个数在1~8之间")
- @Max(value = TrainUtil.NUMBER_EIGHT, message = "节点个数在1~8之间")
- @NotNull(message = "节点个数")
- private Integer resourcesPoolNode;
-
- @ApiModelProperty("验证数据来源名称")
- private String valDataSourceName;
-
- @ApiModelProperty("验证数据来源路径")
- private String valDataSourcePath;
-
- @ApiModelProperty("是否验证数据集")
- private Integer valType;
-
- @ApiModelProperty(value = "训练延时启动时长,单位为小时")
- @Min(value = TrainUtil.NUMBER_ZERO, message = "训练延时启动时长不能小于0小时")
- @Max(value = TrainUtil.NUMBER_ONE_HUNDRED_AND_SIXTY_EIGHT, message = "训练延时启动时长不能大于168小时即时长不能超过一周(7*24小时)")
- private Integer delayCreateTime;
-
- @ApiModelProperty(value = "训练自动停止时长,单位为小时")
- @Min(value = TrainUtil.NUMBER_ZERO, message = "训练自动停止时长必须不能小于0小时")
- @Max(value = TrainUtil.NUMBER_ONE_HUNDRED_AND_SIXTY_EIGHT, message = "训练自动停止时长不能大于168小时即时长不能超过一周(7*24小时)")
- private Integer delayDeleteTime;
-
- @ApiModelProperty(value = "模型类型(0我的模型1预置模型2炼知模型)" +
- "当值为0和1的时候,需要传递ModelId, 当值为2的时候传递teacherModelIds和studentModelIds")
- @Min(value = PtModelUtil.NUMBER_ZERO, message = "模型来源错误")
- @Max(value = PtModelUtil.NUMBER_TWO, message = "模型来源错误")
- private Integer modelResource;
-
- @ApiModelProperty(value = "模型id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "id必须大于1")
- private Long modelId;
-
- @ApiModelProperty(value = "我的模型版本对应的id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "模型版本对应的id必须大于1")
- private Long modelBranchId;
-
- @ApiModelProperty(value = "教师模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "教师模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "教师模型ids参数格式不正确")
- private String teacherModelIds;
-
- @ApiModelProperty(value = "学生模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "学生模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "学生模型ids参数格式不正确")
- private String studentModelIds;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobVersionQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobVersionQueryDTO.java
deleted file mode 100644
index d3e93b1..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainJobVersionQueryDTO.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.base.PageQueryBase;
-import org.dubhe.utils.TrainUtil;
-
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 训练任务版本查询
- * @date 2020-06-30
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainJobVersionQueryDTO extends PageQueryBase implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "训练作业id", required = true)
- @NotNull(message = "训练作业id不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "训练作业id必须不小于1")
- private Long trainId;
-
- @ApiModelProperty("训练作业job状态, 0为待处理,1为运行中,2为运行完成,3为失败,4为停止,5为未知,6为删除,7为创建失败")
- private Integer trainStatus;
-
-}
\ No newline at end of file
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainLogQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainLogQueryDTO.java
deleted file mode 100644
index 776a75d..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainLogQueryDTO.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.TrainUtil;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 训练日志 查询DTO
- * @date 2020-05-08
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainLogQueryDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("训练job的id")
- @NotNull(message = "训练job的id不能为空")
- private Integer jobId;
-
- @ApiModelProperty(value = "起始行")
- @Min(value = TrainUtil.NUMBER_ZERO, message = "startLine不能小于0")
- private Integer startLine;
-
- @ApiModelProperty(value = "行数")
- @Min(value = TrainUtil.NUMBER_ONE, message = "lines不能小于1")
- @Max(value = TrainUtil.NUMBER_ONE_THOUSAND, message = "lines不能大于1000")
- private Integer lines;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainModelDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainModelDTO.java
deleted file mode 100644
index 56e1b31..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainModelDTO.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.utils.PtModelUtil;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-import java.io.Serializable;
-
-/**
- * @description 训练使用模型
- * @date 2020-11-23
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainModelDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("非炼知模型id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "模型id必须大于1")
- private Long modelId;
-
- @ApiModelProperty(value = "我的模型版本对应的id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "模型版本对应的id必须大于1")
- private Long modelBranchId;
-
- @ApiModelProperty("模型是否为预置模型(0默认模型,1预置模型, 2炼知模型" +
- "当值为0和1的时候,需要传递ModelId, 当值为2的时候传递teacherModelIds和studentModelIds")
- @NotNull(message = "模型类型不能为空")
- @Min(value = PtModelUtil.NUMBER_ZERO, message = "模型来源错误")
- @Max(value = PtModelUtil.NUMBER_TWO, message = "模型来源错误")
- private Integer modelResource;
-
- @ApiModelProperty(value = "教师模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "教师模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "教师模型ids参数格式不正确")
- private String teacherModelIds;
-
- @ApiModelProperty(value = "学生模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "学生模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "学生模型ids参数格式不正确")
- private String studentModelIds;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamCreateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamCreateDTO.java
deleted file mode 100644
index 0169e00..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamCreateDTO.java
+++ /dev/null
@@ -1,133 +0,0 @@
-/**
- * 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.domain.dto;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseImageDTO;
-import org.dubhe.utils.PtModelUtil;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-
-/**
- * @description 任务参数创建条件
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-public class PtTrainParamCreateDTO extends BaseImageDTO {
-
- @ApiModelProperty(value = "任务参数名称,输入长度不能超过32个字符", required = true)
- @NotBlank(message = "任务参数名称不能为空")
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "任务参数名称-输入长度不能超过32个字符")
- @Pattern(regexp = TrainUtil.REGEXP, message = "任务参数名称支持字母、数字、汉字、英文横杠和下划线")
- private String paramName;
-
- @ApiModelProperty("描述,输入长度不能超过256个字符")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "任务参数描述-输入长度不能超过256个字符")
- private String description;
-
- @ApiModelProperty(value = "算法id,算法id不能小于1", required = true)
- @NotNull(message = "算法id不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "算法id不能小于1")
- private Long algorithmId;
-
- @ApiModelProperty(value = "运行命令,输入长度不能超过128个字符", required = true)
- @NotBlank(message = "运行命令不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "运行命令-输入长度不能超过128个字符")
- private String runCommand;
-
- @ApiModelProperty(value = "数据集来源路径,输入长度不能超过127个字符", required = true)
- @NotBlank(message = "数据集来源路径不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_SEVEN, message = "数据集来源路径-输入长度不能超过127个字符")
- private String dataSourcePath;
-
- @ApiModelProperty(value = "数据集来源名称,输入长度不能超过127个字符", required = true)
- @NotBlank(message = "数据集来源名称不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_SEVEN, message = "数据集来源名称-输入长度不能超过127个字符")
- private String dataSourceName;
-
- @ApiModelProperty("运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)")
- private JSONObject runParams;
-
- @ApiModelProperty(value = "类型(0为CPU,1为GPU)", required = true)
- @Min(value = TrainUtil.NUMBER_ZERO, message = "类型错误")
- @Max(value = TrainUtil.NUMBER_ONE, message = "类型错误")
- @NotNull(message = "类型(0为CPU,1为GPU)不能为空")
- private Integer resourcesPoolType;
-
- @ApiModelProperty(value = "规格名称", required = true)
- @NotNull(message = "规格名称不能为空")
- private String trainJobSpecsName;
-
- @ApiModelProperty("验证数据来源名称")
- private String valDataSourceName;
-
- @ApiModelProperty("验证数据来源路径")
- private String valDataSourcePath;
-
- @ApiModelProperty("是否验证数据集")
- private Integer valType;
-
- @ApiModelProperty(value = "训练类型 0:普通训练,1:分布式训练", required = true)
- @Min(value = TrainUtil.NUMBER_ZERO, message = "训练类型错误")
- @Max(value = TrainUtil.NUMBER_ONE, message = "训练类型错误")
- @NotNull(message = "训练类型(0为普通训练,1为分布式训练)不能为空")
- private Integer trainType;
-
- @ApiModelProperty(value = "节点个数", required = true)
- @Min(value = TrainUtil.NUMBER_ONE, message = "节点个数在1~8之间")
- @Max(value = TrainUtil.NUMBER_EIGHT, message = "节点个数在1~8之间")
- @NotNull(message = "节点个数")
- private Integer resourcesPoolNode;
-
- @ApiModelProperty(value = "模型类型(0我的模型1预置模型2炼知模型)" +
- "当值为0和1的时候,需要传递ModelId, 当值为2的时候传递teacherModelIds和studentModelIds")
- @Min(value = PtModelUtil.NUMBER_ZERO, message = "模型来源错误")
- @Max(value = PtModelUtil.NUMBER_TWO, message = "模型来源错误")
- private Integer modelResource;
-
- @ApiModelProperty(value = "模型id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "id必须大于1")
- private Long modelId;
-
- @ApiModelProperty(value = "我的模型版本对应的id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "模型版本对应的id必须大于1")
- private Long modelBranchId;
-
- @ApiModelProperty(value = "教师模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "教师模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "教师模型ids参数格式不正确")
- private String teacherModelIds;
-
- @ApiModelProperty(value = "学生模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "学生模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "学生模型ids参数格式不正确")
- private String studentModelIds;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamDeleteDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamDeleteDTO.java
deleted file mode 100644
index edb82e7..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamDeleteDTO.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-import java.util.Set;
-
-/**
- * @description 训练模板删除
- * @date 2020-07-02
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainParamDeleteDTO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "id", required = true)
- @NotNull(message = "id不能为空")
- private Set ids;
-
-}
\ No newline at end of file
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamQueryDTO.java
deleted file mode 100644
index 4a3cf22..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamQueryDTO.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.base.PageQueryBase;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import java.io.Serializable;
-
-/**
- * @description 任务参数查询条件
- * @date 2020-4-27
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainParamQueryDTO extends PageQueryBase implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("任务参数名称,输入长度不能超过128个字符")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "任务参数名称-输入长度不能超过128个字符")
- private String paramName;
-
- @ApiModelProperty(value = "规格类型(0为CPU, 1为GPU)")
- private Integer resourcesPoolType;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamUpdateDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamUpdateDTO.java
deleted file mode 100644
index 87a56ca..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainParamUpdateDTO.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/**
- * 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.domain.dto;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseImageDTO;
-import org.dubhe.utils.PtModelUtil;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Pattern;
-
-/**
- * @description 任务参数修改条件
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-public class PtTrainParamUpdateDTO extends BaseImageDTO {
-
- @ApiModelProperty(value = "任务参数id,任务参数id不能小于1", required = true)
- @NotNull(message = "任务参数id不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "任务参数id不能小于1")
- private Long id;
-
- @ApiModelProperty(value = "任务参数名称,输入长度不能超过32个字符", required = true)
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "任务参数名称-输入长度不能超过32个字符")
- @NotBlank(message = "任务参数名称不能为空")
- @Pattern(regexp = TrainUtil.REGEXP, message = "任务参数名称支持字母、数字、汉字、英文横杠和下划线")
- private String paramName;
-
- @ApiModelProperty("描述,输入长度不能超过256个字符")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "任务参数描述-输入长度不能超过256个字符")
- private String description;
-
- @ApiModelProperty(value = "算法id,算法id不能小于1", required = true)
- @NotNull(message = "算法id不能为空")
- @Min(value = TrainUtil.NUMBER_ONE, message = "算法id不能小于1")
- private Long algorithmId;
-
- @ApiModelProperty(value = "运行命令,输入长度不能超过128个字符", required = true)
- @NotBlank(message = "运行命令不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_EIGHT, message = "运行命令-输入长度不能超过128个字符")
- private String runCommand;
-
- @ApiModelProperty(value = "数据集来源路径,输入长度不能超过127个字符", required = true)
- @NotBlank(message = "数据集来源路径不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_SEVEN, message = "数据集来源路径-输入长度不能超过127个字符")
- private String dataSourcePath;
-
- @ApiModelProperty(value = "数据集来源名称,输入长度不能超过127个字符", required = true)
- @NotBlank(message = "数据集来源名称不能为空")
- @Length(max = TrainUtil.NUMBER_ONE_HUNDRED_AND_TWENTY_SEVEN, message = "数据集来源名称-输入长度不能超过127个字符")
- private String dataSourceName;
-
- @ApiModelProperty("运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)")
- private JSONObject runParams;
-
- @ApiModelProperty(value = "类型(0为CPU,1为GPU)", required = true)
- @Min(value = TrainUtil.NUMBER_ZERO, message = "类型错误")
- @Max(value = TrainUtil.NUMBER_ONE, message = "类型错误")
- @NotNull(message = "类型(0为CPU,1为GPU)不能为空")
- private Integer resourcesPoolType;
-
- @ApiModelProperty(value = "规格名称", required = true)
- @NotNull(message = "规格名称不能为空")
- private String trainJobSpecsName;
-
- @ApiModelProperty("验证数据来源名称")
- private String valDataSourceName;
-
- @ApiModelProperty("验证数据来源路径")
- private String valDataSourcePath;
-
- @ApiModelProperty("是否验证数据集")
- private Integer valType;
-
- @ApiModelProperty(value = "训练类型 0:普通训练,1:分布式训练")
- @Min(value = TrainUtil.NUMBER_ZERO, message = "训练类型错误")
- @Max(value = TrainUtil.NUMBER_ONE, message = "训练类型错误")
- private Integer trainType;
-
- @ApiModelProperty(value = "节点个数")
- @Min(value = TrainUtil.NUMBER_ONE, message = "节点个数在1~8之间")
- @Max(value = TrainUtil.NUMBER_EIGHT, message = "节点个数在1~8之间")
- private Integer resourcesPoolNode;
-
- @ApiModelProperty(value = "模型类型(0我的模型1预置模型2炼知模型)" +
- "当值为0和1的时候,需要传递ModelId, 当值为2的时候传递teacherModelIds和studentModelIds")
- @Min(value = PtModelUtil.NUMBER_ZERO, message = "模型来源错误")
- @Max(value = PtModelUtil.NUMBER_TWO, message = "模型来源错误")
- private Integer modelResource;
-
- @ApiModelProperty(value = "模型id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "id必须大于1")
- private Long modelId;
-
- @ApiModelProperty(value = "我的模型版本对应的id")
- @Min(value = TrainUtil.NUMBER_ONE, message = "模型版本对应的id必须大于1")
- private Long modelBranchId;
-
- @ApiModelProperty(value = "教师模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "教师模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "教师模型ids参数格式不正确")
- private String teacherModelIds;
-
- @ApiModelProperty(value = "学生模型ids,多个id之前用','隔开")
- @Length(max = TrainUtil.NUMBER_TWO_HUNDRED_AND_FIFTY_FIVE, message = "学生模型长度不能超过255个字符")
- @Pattern(regexp = "^([1-9][0-9]*,)*[1-9][0-9]*$", message = "学生模型ids参数格式不正确")
- private String studentModelIds;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainQueryDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainQueryDTO.java
deleted file mode 100644
index f1016ad..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtTrainQueryDTO.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.base.PageQueryBase;
-import org.dubhe.utils.TrainUtil;
-import org.hibernate.validator.constraints.Length;
-
-import javax.validation.constraints.Max;
-import javax.validation.constraints.Min;
-import java.io.Serializable;
-
-/**
- * @description 查询训练
- * @date 2020-04-27
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainQueryDTO extends PageQueryBase implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("训练作业名称或者id")
- @Length(max = TrainUtil.NUMBER_THIRTY_TWO, message = "训练作业名称或者id有误")
- private String trainName;
-
- @ApiModelProperty("训练作业job状态, 0为待处理,1为运行中,2为运行完成,3为失败,4为停止,5为未知,6为删除,7为创建失败")
- @Min(value = TrainUtil.NUMBER_ZERO, message = "trainStatus错误")
- @Max(value = TrainUtil.NUMBER_SEVEN, message = "trainStatus错误")
- private Integer trainStatus;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/SourceNoteBookDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/SourceNoteBookDTO.java
deleted file mode 100644
index a966041..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/SourceNoteBookDTO.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.domain.dto;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import javax.validation.constraints.NotBlank;
-import javax.validation.constraints.NotNull;
-import java.io.Serializable;
-
-/**
- * @description 第三方创建NoteBook请求对象
- *
- * @date 2020.05.15
- */
-@Data
-public class SourceNoteBookDTO implements Serializable {
-
- @ApiModelProperty("第三方源主键")
- @NotNull
- private Long sourceId;
-
- @ApiModelProperty("第三方源资源路径")
- @NotBlank
- private String sourceFilePath;
-
- @ApiModelProperty(value = "当前登录人", hidden = true)
- private Long curUserId;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptBuiltIn.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptBuiltIn.java
deleted file mode 100644
index 0aa61d6..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptBuiltIn.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/**
- * 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.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 lombok.Data;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @description 内置模型
- * @date 2020-05-22
- */
-@Data
-@TableName("model_opt_built_in")
-public class ModelOptBuiltIn extends BaseEntity {
- /**
- * 主键
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
- /**
- * 算法类型:0-剪枝,1-蒸馏,2-量化
- */
- @TableField("type")
- private Integer type;
- /**
- * 算法名称
- */
- @TableField("algorithm")
- private String algorithm;
- /**
- * 算法路径
- */
- @TableField("algorithm_path")
- private String algorithmPath;
- /**
- * 数据集名称
- */
- @TableField("dataset")
- private String dataset;
- /**
- * 数据集路径
- */
- @TableField("dataset_path")
- private String datasetPath;
- /**
- * 模型名称
- */
- @TableField("model")
- private String model;
- /**
- * 模型路径
- */
- @TableField(value = "model_address")
- private String modelAddress;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptDataset.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptDataset.java
deleted file mode 100644
index d42d737..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptDataset.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * 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.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 lombok.Data;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @description 模型优化数据集
- * @date 2021-01-06
- */
-@Data
-@TableName("model_opt_dataset")
-public class ModelOptDataset extends BaseEntity {
-
- /**
- * 主键
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 数据集名称
- */
- @TableField(value = "name")
- private String name;
-
- /**
- * 数据集路径
- */
- @TableField(value = "path")
- private String path;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptTask.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptTask.java
deleted file mode 100644
index e426469..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptTask.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/**
- * 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.domain.entity;
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.bean.copier.CopyOptions;
-import com.alibaba.fastjson.JSONObject;
-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.extension.handlers.FastjsonTypeHandler;
-import lombok.Data;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @description 模型优化任务
- * @date 2020-05-22
- */
-@Data
-@TableName(value = "model_opt_task", autoResultMap = true)
-public class ModelOptTask extends BaseEntity {
-
- /**
- * 主键
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
- /**
- * 任务名称
- */
- @TableField(value = "name")
- private String name;
- /**
- * 任务描述
- */
- @TableField(value = "description")
- private String description;
- /**
- * 是否内置
- */
- @TableField(value = "is_built_in")
- private Boolean isBuiltIn;
- /**
- * 模型名称
- */
- @TableField(value = "model_name")
- private String modelName;
- /**
- * 模型id
- */
- @TableField(value = "model_id")
- private Long modelId;
- /**
- * 模型路径
- */
- @TableField(value = "model_address")
- private String modelAddress;
- /**
- * 算法选择类型
- */
- @TableField(value = "algorithm_type")
- private Integer algorithmType;
- /**
- * 优化算法id
- */
- @TableField(value = "algorithm_id")
- private Long algorithmId;
- /**
- * 优化算法
- */
- @TableField(value = "algorithm_name")
- private String algorithmName;
- /**
- * 算法路径
- */
- @TableField(value = "algorithm_path")
- private String algorithmPath;
- /**
- * 数据集id
- */
- @TableField(value = "dataset_id")
- private Long datasetId;
- /**
- * 数据集名称
- */
- @TableField(value = "dataset_name")
- private String datasetName;
- /**
- * 数据集路径
- */
- @TableField(value = "dataset_path")
- private String datasetPath;
- /**
- * 运行命令
- */
- @TableField(value = "command")
- private String command;
- /**
- * 运行参数
- */
- @TableField(value = "params", typeHandler = FastjsonTypeHandler.class)
- private JSONObject params;
-
- public void copy(ModelOptTask source) {
- BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptTaskInstance.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptTaskInstance.java
deleted file mode 100644
index 239a9d9..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelOptTaskInstance.java
+++ /dev/null
@@ -1,173 +0,0 @@
-/**
- * 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.domain.entity;
-
-import cn.hutool.core.bean.BeanUtil;
-import cn.hutool.core.bean.copier.CopyOptions;
-import com.alibaba.fastjson.JSONObject;
-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.extension.handlers.FastjsonTypeHandler;
-import lombok.Data;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseEntity;
-
-import java.sql.Timestamp;
-
-/**
- * @description 模型优化任务实例
- * @date 2020-05-22
- */
-@Data
-@TableName(value = "model_opt_task_instance", autoResultMap = true)
-@Accessors(chain = true)
-public class ModelOptTaskInstance extends BaseEntity {
- /**
- * 主键
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
- /**
- * 任务id
- */
- @TableField(value = "task_id")
- private Long taskId;
- /**
- * 任务名称
- */
- @TableField(value = "task_name")
- private String taskName;
- /**
- * 是否内置
- */
- @TableField(value = "is_built_in")
- private Boolean isBuiltIn;
- /**
- * 模型id
- */
- @TableField(value = "model_id")
- private Long modelId;
- /**
- * 模型名称
- */
- @TableField(value = "model_name")
- private String modelName;
- /**
- * 模型路径
- */
- @TableField(value = "model_address")
- private String modelAddress;
-
- /**
- * 算法选择类型
- */
- @TableField(value = "algorithm_type")
- private Integer algorithmType;
- /**
- * 优化算法id
- */
- @TableField(value = "algorithm_id")
- private Long algorithmId;
- /**
- * 优化算法
- */
- @TableField(value = "algorithm_name")
- private String algorithmName;
- /**
- * 算法路径
- */
- @TableField(value = "algorithm_path")
- private String algorithmPath;
- /**
- * 提交时间
- */
- @TableField(value = "start_time")
- private Timestamp startTime;
- /**
- * 完成时间
- */
- @TableField(value = "end_time")
- private Timestamp endTime;
- /**
- * 输出模型路径
- */
- @TableField(value = "output_model_dir")
- private String outputModelDir;
- /**
- * 日志路径
- */
- @TableField(value = "log_path")
- private String logPath;
- /**
- * 任务状态
- */
- @TableField(value = "status")
- private String status;
- /**
- * 数据集id
- */
- @TableField(value = "dataset_id")
- private Long datasetId;
- /**
- * 数据集名称
- */
- @TableField(value = "dataset_name")
- private String datasetName;
- /**
- * 数据集路径
- */
- @TableField(value = "dataset_path")
- private String datasetPath;
- /**
- * 运行命令
- */
- @TableField(value = "command")
- private String command;
- /**
- * 运行参数
- */
- @TableField(value = "params", typeHandler = FastjsonTypeHandler.class)
- private JSONObject params;
- /**
- * 优化前性能参数
- */
- @TableField(value = "opt_result_before")
- private String optResultBefore;
- /**
- * 优化后性能参数
- */
- @TableField(value = "opt_result_after")
- private String optResultAfter;
-
- /**
- * 模型优化前性能参数json文件路径
- */
- @TableField(value = "opt_result_json_path_before")
- private String optResultJsonPathBefore;
- /**
- * 模型优化后性能参数json文件路径
- */
- @TableField(value = "opt_result_json_path_after")
- private String optResultJsonPathAfter;
-
- public void copy(ModelOptTaskInstance source) {
- BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true));
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelQuery.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelQuery.java
deleted file mode 100644
index ea52708..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelQuery.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/**
- * 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.domain.entity;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-/**
- * @description model详情
- * @date 2020-10-09
- */
-@Data
-@TableName("pt_model_info")
-public class ModelQuery {
- @TableField(value = "model_resource")
- @ApiModelProperty(value = "模型类型")
- private Integer modelResource;
- @TableField(value = "name")
- @ApiModelProperty(value = "模型名称")
- private String name;
- @TableField(value = "model_version")
- @ApiModelProperty(value = "模型版本")
- private String modelVersion;
- @TableField(value = "id")
- @ApiModelProperty(value = "模型id")
- private Integer id;
- @TableField(value = "url")
- @ApiModelProperty(value = "模型路径")
- private String url;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelQueryBrance.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelQueryBrance.java
deleted file mode 100644
index dadbb1e..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/ModelQueryBrance.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.domain.entity;
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-/**
- * @description model 模型版本
- * @date 2020-10-09
- */
-@Data
-@TableName("pt_model_branch")
-public class ModelQueryBrance {
- @TableField(value = "model_resource")
- @ApiModelProperty(value = "模型类型")
- private Integer modelResource;
- @TableField(value = "name")
- @ApiModelProperty(value = "模型名称")
- private String name;
- @TableField(value = "version")
- @ApiModelProperty(value = "模型版本")
- private String version;
- @TableField(value = "id")
- @ApiModelProperty(value = "模型id")
- private Integer id;
- @TableField(value = "url")
- @ApiModelProperty(value = "模型路径")
- private String url;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/NoteBook.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/NoteBook.java
deleted file mode 100644
index b32d5d9..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/NoteBook.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.dubhe.base.BaseEntity;
-
-import javax.validation.constraints.NotNull;
-import javax.validation.constraints.Size;
-import java.util.Date;
-
-/**
- * @description note book 实体
- * @date 2020-04-28
- */
-@Data
-@TableName("notebook")
-public class NoteBook extends BaseEntity {
-
- @TableId(value = "id", type = IdType.AUTO)
- @ApiModelProperty(hidden = true)
- private Long id;
-
- @TableField(value = "origin_user_id",fill = FieldFill.INSERT)
- @ApiModelProperty(hidden = true)
- private Long userId;
-
- @TableField(value = "name")
- @JsonIgnore
- private String name;
-
- @TableField(value = "notebook_name")
- private String noteBookName;
-
- @TableField(value = "description")
- private String description;
-
- public final static String COLUMN_URL = "url";
- @TableField(value = COLUMN_URL)
- @ApiModelProperty(hidden = true)
- private String url;
-
- @TableField(value = "total_run_min")
- @ApiModelProperty(hidden = true)
- private Integer totalRunMin;
-
- @TableField(value = "cpu_num")
- @ApiModelProperty(value = "cpu数量")
- private Integer cpuNum;
-
- @TableField(value = "gpu_num")
- @ApiModelProperty(value = "gpu数量")
- private Integer gpuNum;
-
- @TableField(value = "mem_num")
- @ApiModelProperty(value = "内存大小")
- private Integer memNum;
-
- @TableField(value = "disk_mem_num")
- @ApiModelProperty(value = "硬盘内存大小")
- private Integer diskMemNum;
-
-
- public final static String COLUMN_STATUS = "status";
- /**
- * 0运行中,1停止, 2删除, 3启动中,4停止中,5删除中,6运行异常(暂未启用)
- */
- @TableField(value = COLUMN_STATUS)
- @ApiModelProperty(hidden = true)
- private Integer status;
-
- @TableField(value = "last_start_time")
- @ApiModelProperty(hidden = true)
- private Date lastStartTime;
-
- @TableField(value = "last_operation_timeout")
- @ApiModelProperty(hidden = true)
- private Long lastOperationTimeout;
-
- /**
- * 0 - notebook 创建 1- 其它系统创建
- */
- @TableField(value = "create_resource")
- @ApiModelProperty(hidden = true)
- private Integer createResource;
-
- @TableField(value = "k8s_status_code")
- @ApiModelProperty(hidden = true)
- private String k8sStatusCode;
-
- @TableField(value = "k8s_status_info")
- @ApiModelProperty(hidden = true)
- private String k8sStatusInfo;
-
- @TableField(value = "k8s_namespace")
- @ApiModelProperty(hidden = true)
- private String k8sNamespace;
-
- @TableField(value = "k8s_resource_name")
- @ApiModelProperty(hidden = true)
- private String k8sResourceName;
-
- @TableField(value = "k8s_image_name")
- @ApiModelProperty("镜像名称")
- @NotNull(message = "请选择镜像")
- private String k8sImageName;
-
- @TableField(value = "k8s_mount_path")
- @ApiModelProperty(hidden = true)
- private String k8sMountPath;
-
- @TableField(value = "k8s_pvc_path")
- @ApiModelProperty(hidden = true)
- private String k8sPvcPath;
-
- @TableField(value = "data_source_name")
- @ApiModelProperty(hidden = true)
- @Size(max = 255, message = "数据集名称超长")
- private String dataSourceName;
-
- @TableField(value = "data_source_path")
- @Size(max = 255, message = "数据集路径超长")
- @ApiModelProperty(hidden = true)
- private String dataSourcePath;
-
- @TableField(value = "algorithm_id")
- @ApiModelProperty(hidden = true)
- private Long algorithmId;
-
- @Override
- public String toString() {
- return "NoteBook{" +
- "id=" + id +
- ", userId=" + userId +
- ", name='" + name + '\'' +
- ", noteBookName='" + noteBookName + '\'' +
- ", description='" + description + '\'' +
- ", url='" + url + '\'' +
- ", totalRunMin=" + totalRunMin +
- ", cpuNum=" + cpuNum +
- ", gpuNum=" + gpuNum +
- ", memNum=" + memNum +
- ", diskMemNum=" + diskMemNum +
- ", status=" + status +
- ", lastStartTime=" + lastStartTime +
- ", lastOperationTimeout=" + lastOperationTimeout +
- ", createResource=" + createResource +
- ", k8sStatusCode='" + k8sStatusCode + '\'' +
- ", k8sStatusInfo='" + k8sStatusInfo + '\'' +
- ", k8sNamespace='" + k8sNamespace + '\'' +
- ", k8sResourceName='" + k8sResourceName + '\'' +
- ", k8sImageName='" + k8sImageName + '\'' +
- ", k8sMountPath='" + k8sMountPath + '\'' +
- ", k8sPvcPath='" + k8sPvcPath + '\'' +
- ", dataSourceName='" + dataSourceName + '\'' +
- ", dataSourcePath='" + dataSourcePath + '\'' +
- ", algorithmId=" + algorithmId +
- '}';
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/NoteBookModel.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/NoteBookModel.java
deleted file mode 100644
index 46a6f08..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/NoteBookModel.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableName;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @description notebook 模板
- * @date 2020-06-01
- */
-@Data
-@TableName("notebook_model")
-public class NoteBookModel extends BaseEntity {
-
- @TableField(value = "model_type")
- private String modelType;
-
- @TableField(value = "cpu_num")
- @ApiModelProperty("cpu数量")
- private Integer cpuNum;
-
- @TableField(value = "gpu_num")
- @ApiModelProperty("gpu数量")
- private Integer gpuNum;
-
- @TableField(value = "mem_num")
- @ApiModelProperty("内存大小")
- private Integer memNum;
-
- @TableField(value = "spec")
- @ApiModelProperty("GPU规格")
- private String spec;
-
- @TableField(value = "disk_mem_num")
- @ApiModelProperty("硬盘内存大小")
- private Integer diskMemNum;
-
- @TableField(value = "default_status")
- @ApiModelProperty("默认值状态 0 - 非默认 1- 默认")
- private Integer defaultStatus;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtImage.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtImage.java
deleted file mode 100644
index 460aa1f..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtImage.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @description 镜像
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-@TableName(value = "pt_image", autoResultMap = true)
-public class PtImage extends BaseEntity {
-
- /**
- * 主键
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 镜像名称
- */
- @TableField(value = "image_name")
- private String imageName;
-
- /**
- * 镜像地址
- */
- @TableField(value = "image_url")
- private String imageUrl;
-
- /**
- * 镜像版本
- */
- @TableField(value = "image_tag")
- private String imageTag;
-
- /**
- * 镜像描述
- */
- @TableField(value = "remark")
- private String remark;
-
- /**
- * projectName
- */
- @TableField(value = "project_name")
- private String projectName;
-
- /**
- * 镜像来源
- */
- @TableField(value = "image_resource")
- private Integer imageResource;
-
-
- /**
- * 镜像状态
- */
- @TableField(value = "image_status")
- private Integer imageStatus;
-
- /**
- * 资源拥有者ID
- */
- @TableField(value = "origin_user_id", fill = FieldFill.INSERT)
- private Long originUserId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtJobParam.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtJobParam.java
deleted file mode 100644
index 769b730..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtJobParam.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.alibaba.fastjson.JSONObject;
-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.extension.handlers.FastjsonTypeHandler;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseEntity;
-
-import java.sql.Timestamp;
-
-/**
- * @description job运行参数及结果
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-@TableName(value = "pt_job_param", autoResultMap = true)
-public class PtJobParam extends BaseEntity {
-
- /**
- * 主键id
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 训练作业jobId
- */
- @TableField(value = "train_job_id")
- private Long trainJobId;
-
- /**
- * 算法来源id
- */
- @TableField(value = "algorithm_id")
- private Long algorithmId;
-
- /**
- * 运行命令
- */
- @TableField(value = "run_command")
- private String runCommand;
-
- /**
- * 镜像名称
- */
- @TableField(value = "image_name")
- private String imageName;
-
- /**
- * 运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)
- */
- @TableField(value = "run_params", typeHandler = FastjsonTypeHandler.class)
- private JSONObject runParams;
-
- /**
- * F1值
- */
- @TableField(value = "param_f1")
- private String paramF1;
-
- /**
- * 召回率
- */
- @TableField(value = "param_callback")
- private String paramCallback;
-
- /**
- * 精确率
- */
- @TableField(value = "param_precise")
- private String paramPrecise;
-
- /**
- * 准确率
- */
- @TableField(value = "param_accuracy")
- private String paramAccuracy;
-
- /**
- *训练延时启动时间
- */
- @TableField(value = "delay_create_time")
- private Timestamp delayCreateTime;
-
- /**
- *训练自动停止时间
- */
- @TableField(value = "delay_delete_time")
- private Timestamp delayDeleteTime;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtMeasure.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtMeasure.java
deleted file mode 100644
index 192ed80..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtMeasure.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.*;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @description 度量管理实体类
- * @date 2020-11-16
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Builder
-@TableName("pt_measure")
-@NoArgsConstructor
-@AllArgsConstructor
-public class PtMeasure extends BaseEntity {
-
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 度量名称
- */
- @TableField("name")
- private String name;
-
- /**
- * 度量文件路径
- */
- @TableField("url")
- private String url;
-
- /**
- * 资源拥有者ID
- */
- @TableField(value = "origin_user_id", fill = FieldFill.INSERT)
- private Long originUserId;
-
- /**
- * 度量描述信息
- */
- @TableField("description")
- private String description;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrain.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrain.java
deleted file mode 100644
index ee675ac..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrain.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @description 训练作业主
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-@TableName("pt_train")
-public class PtTrain extends BaseEntity {
-
- /**
- * 主键id
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 训练作业名
- */
- @TableField(value = "train_name")
- private String trainName;
-
- /**
- * 训练作业名
- */
- @TableField(value = "train_key")
- private String trainKey;
-
- /**
- * 训练作业有效job版本数量
- */
- @TableField(value = "version_num")
- private Integer versionNum;
-
- /**
- * 训练作业job总版本数量
- */
- @TableField(value = "total_num")
- private Integer totalNum;
-
- /**
- * 资源拥有者ID
- */
- @TableField(value = "origin_user_id",fill = FieldFill.INSERT)
- private Long originUserId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainAlgorithm.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainAlgorithm.java
deleted file mode 100644
index 82bf3eb..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainAlgorithm.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.annotation.*;
-import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseEntity;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @description 算法
- * @date 2020-04-29
- */
-
-@EqualsAndHashCode(callSuper = true)
-@Data
-@TableName(value = "pt_train_algorithm", autoResultMap = true)
-@Accessors(chain = true)
-public class PtTrainAlgorithm extends BaseEntity {
-
- /**
- * 主键
- */
- @TableId(value = "id", type = IdType.AUTO)
- @NotNull(groups = {Update.class})
- private Long id;
-
- /**
- * 算法名称
- */
- @TableField(value = "algorithm_name")
- private String algorithmName;
-
- /**
- * 算法描述
- */
- @TableField(value = "description")
- private String description;
-
- /**
- * 算法来源(1为我的算法,2为预置算法)
- */
- @TableField(value = "algorithm_source")
- private Integer algorithmSource;
-
- /**
- * 环境镜像名称
- */
- @TableField(value = "image_name")
- private String imageName;
-
- /**
- * 代码目录
- */
- @TableField(value = "code_dir")
- private String codeDir;
-
- /**
- * 运行命令
- */
- @TableField(value = "run_command")
- private String runCommand;
-
- /**
- * 运行参数
- */
- @TableField(value = "run_params", typeHandler = FastjsonTypeHandler.class)
- private JSONObject runParams;
-
- /**
- * 算法用途
- */
- @TableField(value = "algorithm_usage")
- private String algorithmUsage;
-
- /**
- * 算法精度
- */
- @TableField(value = "accuracy")
- private String accuracy;
-
- /**
- * P4推理速度(ms)
- */
- @TableField(value = "p4_inference_speed")
- private Integer p4InferenceSpeed;
-
- /**
- * 输出结果(1是,0否)
- */
- @TableField(value = "is_train_out")
- private Boolean isTrainOut;
-
- /**
- * 输出日志(1是,0否)
- */
- @TableField(value = "is_train_log")
- private Boolean isTrainLog;
-
- /**
- * 可视化日志(1是,0否)
- */
- @TableField(value = "is_visualized_log")
- private Boolean isVisualizedLog;
-
- /**
- * 算法状态
- */
- @TableField(value = "algorithm_status")
- private Integer algorithmStatus;
-
- /**
- * 资源拥有者ID
- */
- @TableField(value = "origin_user_id",fill = FieldFill.INSERT)
- private Long originUserId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainAlgorithmUsage.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainAlgorithmUsage.java
deleted file mode 100644
index f7cc715..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainAlgorithmUsage.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseEntity;
-
-import javax.validation.constraints.NotNull;
-
-/**
- * @description 算法
- * @date 2020-06-23
- */
-
-@EqualsAndHashCode(callSuper = true)
-@Data
-@TableName("pt_auxiliary_info")
-@Accessors(chain = true)
-public class PtTrainAlgorithmUsage extends BaseEntity {
-
- /**
- * 主键
- */
- @TableId(value = "id", type = IdType.AUTO)
- @NotNull(groups = {Update.class})
- private Long id;
-
- /**
- * 用户id
- */
- @TableField(value = "origin_user_id",fill = FieldFill.INSERT)
- private Long originUserId;
-
- /**
- * 类型
- */
- @TableField(value = "type")
- private String type;
-
- /**
- * 算法来源(1为我的算法,2为预置算法)
- */
- @TableField(value = "aux_info")
- private String auxInfo;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainJob.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainJob.java
deleted file mode 100644
index 6a1b6a9..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainJob.java
+++ /dev/null
@@ -1,205 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.baomidou.mybatisplus.annotation.*;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @description 训练作业job
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-@TableName(value = "pt_train_job", autoResultMap = true)
-public class PtTrainJob extends BaseEntity {
-
- /**
- * 主键id
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 训练作业id
- */
- @TableField(value = "train_id")
- private Long trainId;
-
- /**
- * job版本
- */
- @TableField(value = "train_version")
- private String trainVersion;
-
- /**
- * job父版本
- */
- @TableField(value = "parent_train_version")
- private String parentTrainVersion;
-
- /**
- * 任务名称
- */
- @TableField(value = "job_name")
- private String jobName;
-
- /**
- * 描述
- */
- @TableField(value = "description")
- private String description;
-
- /**
- * 数据来源路径
- */
- @TableField(value = "data_source_path")
- private String dataSourcePath;
-
-
- /**
- * 数据来源名称
- */
- @TableField(value = "data_source_name")
- private String dataSourceName;
-
- /**
- * 训练时长
- */
- @TableField(value = "runtime")
- private String runtime;
-
- /**
- * 训练输出位置
- */
- @TableField(value = "out_path")
- private String outPath;
-
- /**
- * 作业日志路径
- */
- @TableField(value = "log_path")
- private String logPath;
-
- /**
- * 规格名称
- */
- @TableField(value = "train_job_specs_name")
- private String trainJobSpecsName;
-
- /**
- * 类型(0为CPU,1为GPU)
- */
- @TableField(value = "resources_pool_type")
- private Integer resourcesPoolType;
-
- /**
- * 规格
- */
- @TableField(value = "resources_pool_specs")
- private String resourcesPoolSpecs;
-
- /**
- * 节点个数
- */
- @TableField(value = "resources_pool_node")
- private Integer resourcesPoolNode;
-
- /**
- * 训练作业job状态, 0为待处理,1为运行中,2为运行完成,3为失败,4为停止,5为未知,6为删除,7为创建失败
- */
- @TableField(value = "train_status")
- private Integer trainStatus;
-
- /**
- * 可视化日志路径
- */
- @TableField(value = "visualized_log_path")
- private String visualizedLogPath;
-
- /**
- * k8s返回的job名称
- */
- @TableField(value = "k8s_job_name")
- private String k8sJobName;
-
- /**
- * 训练类型,0:普通训练,1:分布式训练
- */
- @TableField(value = "train_type")
- private Integer trainType;
-
- /**
- * 验证数据集来源名称
- */
- @TableField(value = "val_data_source_name")
- private String valDataSourceName;
-
- /**
- * 验证数据集来源路径
- */
- @TableField(value = "val_data_source_path")
- private String valDataSourcePath;
-
- /**
- * 是否验证数据集
- */
- @TableField(value = "val_type")
- private Integer valType;
-
- /**
- * 资源拥有者ID
- */
- @TableField(value = "origin_user_id",fill = FieldFill.INSERT)
- private Long originUserId;
-
- /**
- * 模型来源
- */
- @TableField(value = "model_resource")
- private Integer modelResource;
-
- /**
- * 模型id
- */
- @TableField(value = "model_id")
- private Long modelId;
-
- /**
- * 模型对应版本id
- */
- @TableField(value = "model_branch_id")
- private Long modelBranchId;
-
- /**
- * 训练信息(失败信息)
- */
- @TableField(value = "train_msg")
- private String trainMsg;
-
- @TableField(value = "teacher_model_ids")
- private String teacherModelIds;
-
- @TableField(value = "student_model_ids")
- private String studentModelIds;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainJobSpecs.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainJobSpecs.java
deleted file mode 100644
index c282bb9..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainJobSpecs.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.alibaba.fastjson.JSONObject;
-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.extension.handlers.FastjsonTypeHandler;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @decription 训练作业规格
- * @date 2020-05-06
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-@TableName(value = "pt_train_job_specs", autoResultMap = true)
-public class PtTrainJobSpecs extends BaseEntity {
-
- /**
- * 主键id
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Integer id;
-
- /**
- * 规格名称
- */
- @TableField(value = "specs_name")
- private String specsName;
-
- /**
- * 规格信息
- */
- @TableField(value = "specs_info", typeHandler = FastjsonTypeHandler.class)
- private JSONObject specsInfo;
-
- /**
- * 规格类型
- */
- @TableField(value = "resources_pool_type")
- private Integer resourcesPoolType;
-
-}
\ No newline at end of file
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainParam.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainParam.java
deleted file mode 100644
index 9024159..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/entity/PtTrainParam.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
- * 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.domain.entity;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.annotation.*;
-import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import lombok.experimental.Accessors;
-import org.dubhe.base.BaseEntity;
-
-/**
- * @descrption 任务参数
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-@Accessors(chain = true)
-@TableName(value = "pt_train_param", autoResultMap = true)
-public class PtTrainParam extends BaseEntity {
-
- /**
- * 主键
- */
- @TableId(value = "id", type = IdType.AUTO)
- private Long id;
-
- /**
- * 任务参数名称
- */
- @TableField(value = "param_name")
- private String paramName;
-
- /**
- * 描述
- */
- @TableField(value = "description")
- private String description;
-
- /**
- * 算法id
- */
- @TableField(value = "algorithm_id")
- private Long algorithmId;
-
- /**
- * 运行命令
- */
- @TableField(value = "run_command")
- private String runCommand;
-
- /**
- * 镜像名称
- */
- @TableField(value = "image_name")
- private String imageName;
-
- /**
- * 数据集来源名称
- */
- @TableField(value = "data_source_name")
- private String dataSourceName;
-
- /**
- * 数据集来源路径
- */
- @TableField(value = "data_source_path")
- private String dataSourcePath;
-
- /**
- * 输出路径
- */
- @TableField(value = "out_path")
- private String outPath;
-
- /**
- * 运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)
- */
- @TableField(value = "run_params", typeHandler = FastjsonTypeHandler.class)
- private JSONObject runParams;
-
- /**
- * 算法来源(1为我的算法,2为预置算法)
- */
- @TableField(value = "algorithm_source")
- private Integer algorithmSource;
-
- /**
- * 日志输出路径
- */
- @TableField(value = "log_path")
- private String logPath;
-
- /**
- * 规格名称
- */
- @TableField(value = "train_job_specs_name")
- private String trainJobSpecsName;
-
- /**
- * 类型(0为CPU,1为GPU)
- */
- @TableField(value = "resources_pool_type")
- private Integer resourcesPoolType;
-
- /**
- * 节点个数
- */
- @TableField(value = "resources_pool_node")
- private Integer resourcesPoolNode;
-
- /**
- * 验证数据集来源名称
- */
- @TableField(value = "val_data_source_name")
- private String valDataSourceName;
-
- /**
- * 验证数据集来源路径
- */
- @TableField(value = "val_data_source_path")
- private String valDataSourcePath;
-
- /**
- * 是否验证数据集
- */
- @TableField(value = "val_type")
- private Integer valType;
-
- /**
- * 模型id
- */
- @TableField(value = "model_id")
- private Long modelId;
-
- /**
- * 模型版本对应id
- */
- @TableField(value = "model_branch_id")
- private Long modelBranchId;
-
- /**
- * 模型来源
- */
- @TableField(value = "model_resource")
- private Integer modelResource;
-
- /**
- * 训练类型,0:普通训练,1:分布式训练
- */
- @TableField(value = "train_type")
- private Integer trainType;
-
- /**
- * 资源拥有者ID
- */
- @TableField(value = "origin_user_id",fill = FieldFill.INSERT)
- private Long originUserId;
-
- @TableField(value = "teacher_model_ids")
- private String teacherModelIds;
-
- @TableField(value = "student_model_ids")
- private String studentModelIds;
-
-}
-
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptAlgorithmQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptAlgorithmQueryVO.java
deleted file mode 100644
index 4ab46a2..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptAlgorithmQueryVO.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 模型优化算法返回
- * @date 2021-01-05
- */
-@Data
-public class ModelOptAlgorithmQueryVO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("算法类型")
- private Integer type;
-
- @ApiModelProperty("算法名称")
- private String algorithm;
-
- @ApiModelProperty("算法路径")
- private String algorithmPath;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptCreateVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptCreateVO.java
deleted file mode 100644
index 9ec1a69..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptCreateVO.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 模型优化任务创建返回
- * @date 2021-01-07
- */
-@Data
-@AllArgsConstructor
-public class ModelOptCreateVO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("算法id")
- private Long algorithmId;
-
- @ApiModelProperty("算法路径")
- private String algorithmPath;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptDatasetQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptDatasetQueryVO.java
deleted file mode 100644
index 8f5fb53..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptDatasetQueryVO.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 模型优化数据集查询返回
- * @date 2021-01-05
- */
-@Data
-public class ModelOptDatasetQueryVO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("数据集名称")
- private String dataset;
- @ApiModelProperty("数据集路径")
- private String datasetPath;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptDatasetVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptDatasetVO.java
deleted file mode 100644
index 50b358e..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptDatasetVO.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-import lombok.NoArgsConstructor;
-import org.dubhe.domain.entity.ModelOptDataset;
-
-import java.io.Serializable;
-
-/**
- * @description 模型优化模块我的数据集查询
- * @date 2021-01-06
- */
-@Data
-@NoArgsConstructor
-@AllArgsConstructor
-public class ModelOptDatasetVO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("主键")
- private Long id;
-
- @ApiModelProperty("名称")
- private String name;
-
- @ApiModelProperty("路径")
- private String path;
-
- public ModelOptDatasetVO(ModelOptDataset modelOptDataset) {
- this.id = modelOptDataset.getId();
- this.name = modelOptDataset.getName();
- this.path = modelOptDataset.getPath();
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptModelQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptModelQueryVO.java
deleted file mode 100644
index e9db090..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptModelQueryVO.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 模型优化内置模型查询
- * @date 2021-01-06
- */
-@Data
-public class ModelOptModelQueryVO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("模型名称")
- private String model;
-
- @ApiModelProperty("模型路径")
- private String modelPath;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptResultQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptResultQueryVO.java
deleted file mode 100644
index b4b085b..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptResultQueryVO.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.domain.vo;
-
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 模型优化结果对象
- * @date 2020-05-22
- */
-@Data
-public class ModelOptResultQueryVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- /**
- * 参数名称
- */
- private String name;
-
- /**
- * 结果对比
- */
- private String positive;
-
- /**
- * 优化后值
- */
- private Float after;
-
- /**
- * 优化前值
- */
- private Float before;
-
- /**
- * 参数单位
- */
- private String unit;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptTaskInstanceQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptTaskInstanceQueryVO.java
deleted file mode 100644
index d4c22fa..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptTaskInstanceQueryVO.java
+++ /dev/null
@@ -1,128 +0,0 @@
-/**
- * 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.domain.vo;
-
-import com.alibaba.fastjson.JSONObject;
-import lombok.Data;
-import org.dubhe.base.BaseVO;
-
-import java.sql.Timestamp;
-import java.util.List;
-
-/**
- * @description 模型优化任务实例
- * @date 2020-05-22
- */
-@Data
-public class ModelOptTaskInstanceQueryVO extends BaseVO {
- /**
- * 主键
- */
- private Long id;
- /**
- * 任务id
- */
- private Long taskId;
- /**
- * 任务名称
- */
- private String taskName;
-
- /**
- * 是否内置
- */
- private Boolean isBuiltIn;
-
- /**
- * 模型id
- */
- private Long modelId;
- /**
- * 模型名称
- */
- private String modelName;
- /**
- * 模型路径
- */
- private String modelAddress;
- /**
- * 算法选择类型
- */
- private Integer algorithmType;
- /**
- * 优化算法
- */
- private String algorithmName;
- /**
- * 优化算法id
- */
- private Long algorithmId;
- /**
- * 优化算法路径
- */
- private String algorithmPath;
- /**
- * 提交时间
- */
- private Timestamp startTime;
- /**
- * 完成时间
- */
- private Timestamp endTime;
- /**
- * 日志路径
- */
- private String logPath;
- /**
- * 任务状态
- */
- private String status;
- /**
- * 数据集id
- */
- private Long datasetId;
- /**
- * 数据集名称
- */
- private String datasetName;
- /**
- * 数据集路径
- */
- private String datasetPath;
- /**
- * 运行命令
- */
- private String command;
- /**
- * 运行参数
- */
- private JSONObject params;
- /**
- * 容器名称
- */
- private String podName;
- /**
- * 模型输出路径
- */
- private String outputModelDir;
- /**
- * 优化结果
- */
- private List optResult;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptTaskQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptTaskQueryVO.java
deleted file mode 100644
index c3ba79d..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptTaskQueryVO.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * 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.domain.vo;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import org.dubhe.base.BaseVO;
-
-/**
- * @description 查询模型优化任务返回结果
- * @date 2020-05-22
- */
-@Data
-public class ModelOptTaskQueryVO extends BaseVO {
-
- @ApiModelProperty("ID")
- private Long id;
-
- @ApiModelProperty("任务名称")
- private String name;
-
- @ApiModelProperty("任务描述")
- private String description;
-
- @ApiModelProperty(value = "数据集id")
- private Long datasetId;
-
- @ApiModelProperty("数据集名称")
- private String datasetName;
-
- @ApiModelProperty("数据集路径")
- private String datasetPath;
-
- @ApiModelProperty("是否内置")
- private Boolean isBuiltIn;
-
- @ApiModelProperty("模型id")
- private Long modelId;
-
- @ApiModelProperty("模型名称")
- private String modelName;
-
- @ApiModelProperty("模型路径")
- private String modelAddress;
-
- @ApiModelProperty("优化算法类型")
- private Integer algorithmType;
-
- @ApiModelProperty("优化算法")
- private String algorithmName;
-
- @ApiModelProperty("优化算法id")
- private Long algorithmId;
-
- @ApiModelProperty("优化算法路径")
- private String algorithmPath;
-
- @ApiModelProperty(value = "运行命令")
- private String command;
-
- @ApiModelProperty(value = "运行参数")
- private JSONObject params;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptUpdateVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptUpdateVO.java
deleted file mode 100644
index 7ab2e56..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelOptUpdateVO.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 模型优化任务修改返回
- * @date 2021-01-08
- */
-@Data
-@AllArgsConstructor
-public class ModelOptUpdateVO implements Serializable {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("算法id")
- private Long algorithmId;
-
- @ApiModelProperty("算法路径")
- private String algorithmPath;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelVO.java
deleted file mode 100644
index c69b72c..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/ModelVO.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.AllArgsConstructor;
-import lombok.Data;
-
-/**
- * @description 模型返回结果
- * @date 2021-01-14
- */
-@Data
-@AllArgsConstructor
-public class ModelVO {
-
- @ApiModelProperty("模型名称")
- private String name;
-
- @ApiModelProperty("模型版本")
- private String modelVersion;
-
- @ApiModelProperty("模型地址")
- private String modelUrl;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/NoteBookVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/NoteBookVO.java
deleted file mode 100644
index d67ae3b..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/NoteBookVO.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/**
- * 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.domain.vo;
-
-import cn.hutool.core.date.DatePattern;
-import com.fasterxml.jackson.annotation.JsonFormat;
-import com.fasterxml.jackson.annotation.JsonIgnore;
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.Date;
-
-/**
- * @description 返回前端请求体
- * @create 2020/4/28
- */
-@Data
-@ApiModel("NoteBookDTO 响应")
-public class NoteBookVO implements Serializable {
-
- @ApiModelProperty("ID")
- private Long id;
-
- @ApiModelProperty("所属用户")
- private Long userId;
-
- @ApiModelProperty("NoteBook 名称")
- @JsonIgnore
- private String name;
-
- @ApiModelProperty("NoteBook 名称")
- private String noteBookName;
-
- @ApiModelProperty("备注描述")
- private String description;
-
- @ApiModelProperty("可访问jupyter地址")
- private String url;
-
- @JsonIgnore
- private Integer totalRunMin;
-
- @ApiModelProperty("CPU数量")
- private Integer cpuNum;
-
- @ApiModelProperty("GPU数量")
- private Integer gpuNum;
-
- @ApiModelProperty("内存大小(G)")
- private Integer memNum;
-
- @ApiModelProperty("硬盘内存大小(G)")
- private Integer diskMemNum;
-
- @ApiModelProperty("0运行,1停止, 2删除, 3启动中,4停止中,5删除中,6运行异常(暂未启用)")
- private Integer status;
-
- @ApiModelProperty("k8s响应状态码")
- private String k8sStatusCode;
-
- @ApiModelProperty("k8s响应状态信息")
- private String k8sStatusInfo;
-
- @JsonIgnore
- private String k8sNamespace;
-
- @JsonIgnore
- private String k8sResourceName;
-
- private String k8sImageName;
-
- @ApiModelProperty("k8s中pvc存储路径")
- private String k8sPvcPath;
-
- @JsonFormat(pattern = DatePattern.NORM_DATETIME_MS_PATTERN)
- private Date createTime;
-
- @JsonIgnore
- private Long createUserId;
-
- @JsonFormat(pattern = DatePattern.NORM_DATETIME_MS_PATTERN)
- private Date updateTime;
-
- @JsonIgnore
- private Long updateUserId;
-
- @ApiModelProperty("数据集名称")
- private String dataSourceName;
-
- @ApiModelProperty("数据集路径")
- private String dataSourcePath;
-
- @ApiModelProperty("算法ID")
- private Long algorithmId;
-
- @ApiModelProperty("资源拥有者ID")
- private Long originUserId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtDoJobResultVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtDoJobResultVO.java
deleted file mode 100644
index 55e94da..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtDoJobResultVO.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.domain.vo;
-
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-/**
- * @description doJob返回封装
- * @date 2020-07-03
- */
-@Data
-@Accessors(chain = true)
-public class PtDoJobResultVO {
- /**
- * 返回是否成功
- */
- private Boolean isSuccess;
-
- /**
- * 返回k8s返回的JobName
- */
- private String k8sJobName;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtImageAndAlgorithmVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtImageAndAlgorithmVO.java
deleted file mode 100644
index 0800505..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtImageAndAlgorithmVO.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * @description 镜像
- * @date 2020-04-27
- */
-@Data
-@Accessors(chain = true)
-public class PtImageAndAlgorithmVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("镜像名称")
- private String imageName;
-
- @ApiModelProperty("镜像地址")
- private String imageUrl;
-
- @ApiModelProperty("代码目录")
- private String codeDir;
-
- @ApiModelProperty("运行命令")
- private String runCommand;
-
- @ApiModelProperty("输出目录")
- private Boolean isTrainOut;
-
- @ApiModelProperty("输出日志")
- private Boolean isTrainLog;
-
- @ApiModelProperty("输出可视化日志")
- private Boolean isVisualizedLog;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtImageQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtImageQueryVO.java
deleted file mode 100644
index 31c3ed7..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtImageQueryVO.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description 返回镜像查询结果
- * @date 2020-04-27
- */
-@Data
-public class PtImageQueryVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
- @ApiModelProperty("镜像ID")
- private Long id;
-
- @ApiModelProperty("镜像项目名")
- private String projectName;
-
- @ApiModelProperty("镜像名称")
- private String imageName;
-
- @ApiModelProperty("镜像版本")
- private String imageTag;
-
- @ApiModelProperty("镜像状态(0:上传中,1:上传成功,2:上传失败)")
- private Integer imageStatus;
-
- @ApiModelProperty("备注")
- private String remark;
-
- @ApiModelProperty("创建时间")
- private Timestamp createTime;
-
- @ApiModelProperty("资源拥有者ID")
- private Long originUserId;
-
- @ApiModelProperty("镜像来源")
- private Integer imageResource;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtJobMetricsGrafanaVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtJobMetricsGrafanaVO.java
deleted file mode 100644
index dff8f4b..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtJobMetricsGrafanaVO.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * @description Pod Metrics Grafana url
- * @date 2020-06-30
- */
-@Data
-@Accessors(chain = true)
-public class PtJobMetricsGrafanaVO implements Serializable {
-
- @ApiModelProperty("job监控地址")
- private String jobMetricsGrafanaUrl;
-
- @ApiModelProperty("job对应k8s中的podName")
- private String jobPodName;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtMeasureQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtMeasureQueryVO.java
deleted file mode 100644
index 00ad5ca..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtMeasureQueryVO.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description 返回度量查询结果
- * @date 2020-11-16
- */
-@Data
-public class PtMeasureQueryVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("id")
- private Long id;
-
- @ApiModelProperty("度量名称")
- private String name;
-
- @ApiModelProperty("度量文件url")
- private String url;
-
- @ApiModelProperty("度量描述")
- private String description;
-
- @ApiModelProperty("创建时间")
- private Timestamp createTime;
-
- @ApiModelProperty("资源拥有者ID")
- private Long originUserId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainAlgorithmQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainAlgorithmQueryVO.java
deleted file mode 100644
index aed416f..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainAlgorithmQueryVO.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/**
- * 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.domain.vo;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description 训练算法返回列表
- * @date 2020-04-27
- */
-@Data
-public class PtTrainAlgorithmQueryVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "算法ID")
- private Long id;
-
- @ApiModelProperty(value = "算法名称")
- private String algorithmName;
-
- @ApiModelProperty(value = "描述信息")
- private String description;
-
- @ApiModelProperty(value = "算法来源")
- private Integer algorithmSource;
-
- @ApiModelProperty(value = "镜像名称")
- private String imageName;
-
- @ApiModelProperty(value = "算法文件大小")
- private String algorithmFileSize;
-
- @ApiModelProperty(value = "镜像版本")
- private String imageTag;
-
- @ApiModelProperty(value = "代码目录")
- private String codeDir;
-
- @ApiModelProperty(value = "运行命令")
- private String runCommand;
-
- @ApiModelProperty(value = "运行参数")
- private JSONObject runParams;
-
- @ApiModelProperty(value = "算法用途")
- private String algorithmUsage;
-
- @ApiModelProperty(value = "精度")
- private String accuracy;
-
- @ApiModelProperty(value = "P4推理速度")
- private Integer p4InferenceSpeed;
-
- @ApiModelProperty(value = "创建时间")
- private Timestamp createTime;
-
- @ApiModelProperty(value = "输出结果(1是,0否)")
- private Boolean isTrainOut;
-
- @ApiModelProperty(value = "输出日志(1是,0否)")
- private Boolean isTrainLog;
-
- @ApiModelProperty(value = "可视化日志(1是,0否)")
- private Boolean isVisualizedLog;
-
- @ApiModelProperty("资源拥有者ID")
- private Long originUserId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainAlgorithmUsageQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainAlgorithmUsageQueryVO.java
deleted file mode 100644
index ef7e38d..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainAlgorithmUsageQueryVO.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description 算法用途返回列表
- * @date 2020-06-23
- */
-@Data
-public class PtTrainAlgorithmUsageQueryVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty(value = "ID")
- private Long id;
-
- @ApiModelProperty(value = "类型")
- private String type;
-
- @ApiModelProperty(value = "辅助信息")
- private String auxInfo;
-
- @ApiModelProperty(value = "创建时间")
- private Timestamp createTime;
-
- @ApiModelProperty(value = "更新时间")
- private Timestamp updateTime;
-
- @ApiModelProperty(value = "是否为默认值")
- private Boolean isDefault;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainDataSourceStatusQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainDataSourceStatusQueryVO.java
deleted file mode 100644
index 8c62602..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainDataSourceStatusQueryVO.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.Setter;
-
-import java.io.Serializable;
-
-/**
- * @description 查询数据集状态查询结果
- * @date 2020-05-21
- */
-@Data
-@Setter
-public class PtTrainDataSourceStatusQueryVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("数据集名称")
- private String dataSourceName;
-
- @ApiModelProperty("数据集路径")
- private String dataSourcePath;
-
- @ApiModelProperty("数据集状态(true为当前没有训练在使用,可以删除;false为有训练使用,不可以删除)")
- private Boolean status;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobDeleteVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobDeleteVO.java
deleted file mode 100644
index 9156b58..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobDeleteVO.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 返回删除训练任务结果
- * @date 2020-04-28
- */
-@Data
-public class PtTrainJobDeleteVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("trainID,如果只传递trainID,代表删除该trainID下的所有job")
- private Long trainId;
-
- @ApiModelProperty("训练作业jobID")
- private Long id;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobDetailQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobDetailQueryVO.java
deleted file mode 100644
index 48c8a78..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobDetailQueryVO.java
+++ /dev/null
@@ -1,178 +0,0 @@
-/**
- * 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.domain.vo;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description 根据jobId查询训练任务详情返回结果
- * @date 2020-06-12
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainJobDetailQueryVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("训练作业名")
- private String trainName;
-
- @ApiModelProperty("jobID")
- private Long id;
-
- @ApiModelProperty("训练作业ID")
- private Long trainId;
-
- @ApiModelProperty("训练作业job版本")
- private String trainVersion;
-
- @ApiModelProperty("训练作业job父版本")
- private String parentTrainVersion;
-
- @ApiModelProperty("训练作业jobName")
- private String jobName;
-
- @ApiModelProperty("描述信息")
- private String description;
-
- @ApiModelProperty("数据集名称")
- private String dataSourceName;
-
- @ApiModelProperty("数据集路径")
- private String dataSourcePath;
-
- @ApiModelProperty("训练时长")
- private String runtime;
-
- @ApiModelProperty("训练输出位置")
- private String outPath;
-
- @ApiModelProperty("日志输出路径")
- private String logPath;
-
- @ApiModelProperty("可视化日志路径")
- private String visualizedLogPath;
-
- @ApiModelProperty("规格名称")
- private String trainJobSpecsName;
-
- @ApiModelProperty("类型(0为CPU,1为GPU)")
- private Integer resourcesPoolType;
-
- @ApiModelProperty("节点个数")
- private Integer resourcesPoolNode;
-
- @ApiModelProperty("训练作业job状态, 0为待处理,1为运行中,2为运行完成,3为失败,4为停止,5为未知,6为删除,7为创建失败")
- private Integer trainStatus;
-
- @ApiModelProperty("创建时间")
- private Timestamp createTime;
-
- @ApiModelProperty("算法ID")
- private Long algorithmId;
-
- @ApiModelProperty("镜像名称")
- private String imageName;
-
- @ApiModelProperty(value = "镜像Project")
- private String imageNameProject;
-
- @ApiModelProperty(value = "镜像版本")
- private String imageTag;
-
- @ApiModelProperty("运行命令,输入长度不能超过128个字符")
- private String runCommand;
-
- @ApiModelProperty("运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)")
- private JSONObject runParams;
-
- @ApiModelProperty("F1值")
- private String paramF1;
-
- @ApiModelProperty("召回率")
- private String paramCallback;
-
- @ApiModelProperty("精确率")
- private String paramPrecise;
-
- @ApiModelProperty("准确率")
- private String paramAccuracy;
-
- @ApiModelProperty("算法名称")
- private String algorithmName;
-
- @ApiModelProperty("算法来源(1为我的算法,2为预置算法)")
- private Integer algorithmSource;
-
- @ApiModelProperty("算法用途")
- private String algorithmUsage;
-
- @ApiModelProperty("算法精度")
- private String accuracy;
-
- @ApiModelProperty("P4推理速度(ms)")
- private Integer p4InferenceSpeed;
-
- @ApiModelProperty(value = "算法文件路径")
- private String algorithmCodeDir;
-
- @ApiModelProperty("训练类型 0:普通训练,1:分布式训练")
- private Integer trainType;
-
- @ApiModelProperty("验证数据来源名称")
- private String valDataSourceName;
-
- @ApiModelProperty("验证数据来源路径")
- private String valDataSourcePath;
-
- @ApiModelProperty("是否验证数据集")
- private Integer valType;
-
- @ApiModelProperty("训练延时启动倒计时,单位:分钟")
- private Integer delayCreateCountDown;
-
- @ApiModelProperty("训练自动停止倒计时,单位:分钟")
- private Integer delayDeleteCountDown;
-
- @ApiModelProperty("资源拥有者ID")
- private Long originUserId;
-
- @ApiModelProperty("训练信息(失败信息)")
- private String trainMsg;
-
- @ApiModelProperty(value = "模型类型(0我的模型1预置模型2炼知模型)")
- private Integer modelResource;
-
- @ApiModelProperty(value = "非炼知模型id")
- private Long modelId;
-
- @ApiModelProperty(value = "我的模型版本对应的id")
- private Long modelBranchId;
-
- @ApiModelProperty(value = "炼知教师模型ids,多个id之前用','隔开")
- private String teacherModelIds;
-
- @ApiModelProperty(value = "炼知学生模型ids,多个id之前用','隔开")
- private String studentModelIds;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobDetailVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobDetailVO.java
deleted file mode 100644
index c023b51..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobDetailVO.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/**
- * 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.domain.vo;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description 返回训练版本查询详情
- * @date 2020-04-27
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainJobDetailVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("训练作业名")
- private String trainName;
-
- @ApiModelProperty("jobID")
- private Long id;
-
- @ApiModelProperty("训练作业ID")
- private Long trainId;
-
- @ApiModelProperty("训练作业job版本")
- private String trainVersion;
-
- @ApiModelProperty("训练作业job父版本")
- private String parentTrainVersion;
-
- @ApiModelProperty("训练作业jobName")
- private String jobName;
-
- @ApiModelProperty("描述信息")
- private String description;
-
- @ApiModelProperty("数据集名称")
- private String dataSourceName;
-
- @ApiModelProperty("数据集路径")
- private String dataSourcePath;
-
- @ApiModelProperty("训练时长")
- private String runtime;
-
- @ApiModelProperty("训练输出位置")
- private String outPath;
-
- @ApiModelProperty("日志输出路径")
- private String logPath;
-
- @ApiModelProperty("可视化日志路径")
- private String visualizedLogPath;
-
- @ApiModelProperty("规格名称")
- private String trainJobSpecsName;
-
- @ApiModelProperty("类型(0为CPU,1为GPU)")
- private Integer resourcesPoolType;
-
- @ApiModelProperty("节点个数")
- private Integer resourcesPoolNode;
-
- @ApiModelProperty("训练作业job状态, 0为待处理,1为运行中,2为运行完成,3为失败,4为停止,5为未知,6为删除,7为创建失败")
- private Integer trainStatus;
-
- @ApiModelProperty("创建时间")
- private Timestamp createTime;
-
- @ApiModelProperty("算法ID")
- private Long algorithmId;
-
- @ApiModelProperty("镜像名称")
- private String imageName;
-
- @ApiModelProperty(value = "镜像Project")
- private String imageNameProject;
-
- @ApiModelProperty(value = "镜像版本")
- private String imageTag;
-
- @ApiModelProperty("运行命令,输入长度不能超过128个字符")
- private String runCommand;
-
- @ApiModelProperty("运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)")
- private JSONObject runParams;
-
- @ApiModelProperty("F1值")
- private String paramF1;
-
- @ApiModelProperty("召回率")
- private String paramCallback;
-
- @ApiModelProperty("精确率")
- private String paramPrecise;
-
- @ApiModelProperty("准确率")
- private String paramAccuracy;
-
- @ApiModelProperty("算法名称")
- private String algorithmName;
-
- @ApiModelProperty("算法来源(1为我的算法,2为预置算法)")
- private Integer algorithmSource;
-
- @ApiModelProperty("算法用途")
- private String algorithmUsage;
-
- @ApiModelProperty("算法精度")
- private String accuracy;
-
- @ApiModelProperty("P4推理速度(ms)")
- private Integer p4InferenceSpeed;
-
- @ApiModelProperty(value = "算法文件路径")
- private String algorithmCodeDir;
-
- @ApiModelProperty("训练类型")
- private Integer trainType;
-
- @ApiModelProperty("验证数据来源名称")
- private String valDataSourceName;
-
- @ApiModelProperty("验证数据来源路径")
- private String valDataSourcePath;
-
- @ApiModelProperty("是否验证数据集")
- private Integer valType;
-
- @ApiModelProperty("训练延时启动倒计时,单位:分钟")
- private Integer delayCreateCountDown;
-
- @ApiModelProperty("训练自动停止倒计时,单位:分钟")
- private Integer delayDeleteCountDown;
-
- @ApiModelProperty(value = "模型类型(0我的模型1预置模型2炼知模型)")
- private Integer modelResource;
-
- @ApiModelProperty(value = "非炼知模型id")
- private Long modelId;
-
- @ApiModelProperty(value = "我的模型版本对应的id")
- private Long modelBranchId;
-
- @ApiModelProperty(value = "训练信息(失败信息)")
- private String trainMsg;
-
- @ApiModelProperty(value = "炼知教师模型ids,多个id之前用','隔开")
- private String teacherModelIds;
-
- @ApiModelProperty(value = "炼知学生模型ids,多个id之前用','隔开")
- private String studentModelIds;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobModelVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobModelVO.java
deleted file mode 100644
index d92b1e1..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobModelVO.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-import java.util.List;
-
-/**
- * @description 返回停止训练任务结果
- * @date 2020-04-28
- */
-@Data
-public class PtTrainJobModelVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("非炼知模型信息")
- private List modelList;
-
- @ApiModelProperty("炼知教师模型信息")
- private List teacherModelList;
-
- @ApiModelProperty("炼知学生模型信息")
- private List studentModelList;
-}
\ No newline at end of file
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobSpecsQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobSpecsQueryVO.java
deleted file mode 100644
index d7237ef..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobSpecsQueryVO.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/**
- * 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.domain.vo;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-
-/**
- * @description 训练作业规格
- * @date 2020-05-06
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainJobSpecsQueryVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("训练作业规格ID")
- private Integer id;
-
- @ApiModelProperty("训练作业规格名称")
- private String specsName;
-
- @ApiModelProperty(value = "规格类型(0为CPU, 1为GPU)")
- private Integer resourcesPoolType;
-
- @ApiModelProperty(value = "规格信息")
- private JSONObject specsInfo;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobStatisticsMineVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobStatisticsMineVO.java
deleted file mode 100644
index 8ef03be..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobStatisticsMineVO.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModel;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 我的训练任务统计
- * @date 2020-07-15
- */
-@Data
-@ApiModel(description = "我的训练任务统计结果")
-public class PtTrainJobStatisticsMineVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("运行中的任务")
- private Integer runJobCount;
-
- @ApiModelProperty("已经完成的任务")
- private Integer finishJobCount;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobStopVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobStopVO.java
deleted file mode 100644
index 6a30cde..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainJobStopVO.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-
-import java.io.Serializable;
-
-/**
- * @description 返回停止训练任务结果
- * @date 2020-04-28
- */
-@Data
-public class PtTrainJobStopVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("trainID,如果只传递trainID,代表停止该trainID下的所有job")
- private Long trainId;
-
- @ApiModelProperty("训练作业jobID")
- private Long id;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainLogQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainLogQueryVO.java
deleted file mode 100644
index 1435eb0..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainLogQueryVO.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.util.List;
-
-/**
- * @description 训练日志 查询VO
- * @date 2020-05-08
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainLogQueryVO {
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("log内容")
- private List content;
-
- @ApiModelProperty(value = "任务名称")
- private String jobName;
-
- @ApiModelProperty(value = "起始行")
- private Integer startLine;
-
- @ApiModelProperty(value = "结束行")
- private Integer endLine;
-
- @ApiModelProperty(value = "查询行数")
- private Integer lines;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainParamQueryVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainParamQueryVO.java
deleted file mode 100644
index bbf3226..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainParamQueryVO.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * 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.domain.vo;
-
-import com.alibaba.fastjson.JSONObject;
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.EqualsAndHashCode;
-import org.dubhe.base.BaseVO;
-
-import java.io.Serializable;
-
-/**
- * @description 任务参数查询返回查询结果
- * @date 2020-04-27
- */
-@EqualsAndHashCode(callSuper = true)
-@Data
-public class PtTrainParamQueryVO extends BaseVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("任务参数ID")
- private Long id;
-
- @ApiModelProperty("任务参数名称")
- private String paramName;
-
- @ApiModelProperty("描述")
- private String description;
-
- @ApiModelProperty("镜像名称")
- private String imageName;
-
- @ApiModelProperty(value = "镜像Project")
- private String imageNameProject;
-
- @ApiModelProperty(value = "镜像版本")
- private String imageTag;
-
- @ApiModelProperty("算法ID")
- private Long algorithmId;
-
- @ApiModelProperty("运行命令,输入长度不能超过128个字符")
- private String runCommand;
-
- @ApiModelProperty("算法名称")
- private String algorithmName;
-
- @ApiModelProperty("算法来源(1为我的算法,2为预置算法)")
- private Integer algorithmSource;
-
- @ApiModelProperty("数据来源路径")
- private String dataSourcePath;
-
- @ApiModelProperty("数据来源名称")
- private String dataSourceName;
-
- @ApiModelProperty("运行参数(算法来源为我的算法时为调优参数,算法来源为预置算法时为运行参数)")
- private JSONObject runParams;
-
- @ApiModelProperty("规格名称")
- private String trainJobSpecsName;
-
- @ApiModelProperty("类型(0为CPU,1为GPU)")
- private Integer resourcesPoolType;
-
- @ApiModelProperty("训练类型")
- private Integer trainType;
-
- @ApiModelProperty("节点个数")
- private Integer resourcesPoolNode;
-
- @ApiModelProperty("验证数据来源名称")
- private String valDataSourceName;
-
- @ApiModelProperty("验证数据来源路径")
- private String valDataSourcePath;
-
- @ApiModelProperty("是否验证数据集")
- private Integer valType;
-
- @ApiModelProperty(value = "模型类型(0我的模型1预置模型2炼知模型)")
- private Integer modelResource;
-
- @ApiModelProperty(value = "模型id")
- private Long modelId;
-
- @ApiModelProperty(value = "我的模型版本对应的id")
- private Long modelBranchId;
-
- @ApiModelProperty(value = "炼知教师模型ids,多个id之前用','隔开")
- private String teacherModelIds;
-
- @ApiModelProperty(value = "炼知学生模型ids,多个id之前用','隔开")
- private String studentModelIds;
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainVO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainVO.java
deleted file mode 100644
index 8281c15..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/vo/PtTrainVO.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/**
- * 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.domain.vo;
-
-import io.swagger.annotations.ApiModelProperty;
-import lombok.Data;
-import lombok.experimental.Accessors;
-
-import java.io.Serializable;
-import java.sql.Timestamp;
-
-/**
- * @description 训练查询结果
- * @date 2020-04-27
- */
-@Data
-@Accessors(chain = true)
-public class PtTrainVO implements Serializable {
-
- private static final long serialVersionUID = 1L;
-
- @ApiModelProperty("训练作业jobID")
- private Long jobId;
-
- @ApiModelProperty("训练作业ID")
- private Long trainId;
-
- @ApiModelProperty("训练作业名")
- private String trainName;
-
- @ApiModelProperty("训练作业jobName")
- private String jobName;
-
- @ApiModelProperty("训练作业版本数")
- private Integer versionNum;
-
- @ApiModelProperty("训练时长")
- private String runtime;
-
- @ApiModelProperty("训练作业job状态, 0为待处理,1为运行中,2为运行完成,3为失败,4为停止,5为未知,6为删除,7为创建失败")
- private Integer trainStatus;
-
- @ApiModelProperty("创建时间")
- private Timestamp createTime;
-
- @ApiModelProperty("数据来源路径")
- private String dataSourcePath;
-
- @ApiModelProperty("数据来源名称")
- private String dataSourceName;
-
- @ApiModelProperty("资源拥有者ID")
- private Long originUserId;
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/AlgorithmStatusEnum.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/AlgorithmStatusEnum.java
deleted file mode 100644
index 11ac292..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/AlgorithmStatusEnum.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/**
- * 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.enums;
-
-/**
- * @description 算法状态枚举
- * @date 2020-08-19
- */
-public enum AlgorithmStatusEnum {
-
-
- /**
- * 创建中
- */
- MAKING(0, "创建中"),
- /**
- * 创建成功
- */
- SUCCESS(1, "创建成功"),
- /**
- * 创建失败
- */
- FAIL(2, "创建失败");
-
-
- /**
- * 编码
- */
- private Integer code;
-
- /**
- * 描述
- */
- private String description;
-
- AlgorithmStatusEnum(int code, String description) {
- this.code = code;
- this.description = description;
- }
-
- public Integer getCode() {
- return code;
- }
-
- public String getDescription() {
- return description;
- }
-}
-
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/DistillCommandEnum.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/DistillCommandEnum.java
deleted file mode 100644
index 3e085e5..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/DistillCommandEnum.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/**
- * 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.enums;
-
-/**
- * @description 蒸馏算法命令行枚举
- * @date 2021-01-05
- */
-public enum DistillCommandEnum {
-
- /**
- * 软标签蒸馏
- */
- KD("KD", "cd /usr/local/algorithm && bash run_train_teacher.sh %s %s %s %s %s && bash run_train_student_kd.sh %s %s %s %s %s"),
- /**
- * 软标签蒸馏,将BERT蒸馏到BiLSTM
- */
- BILSTM("Distilled-BiLSTM", "cd /usr/local/algorithm && bash run_train_teacher.sh %s %s %s %s %s && bash run_train_student_distilled_lstm.sh %s %s %s %s %s"),
- /**
- * 软标签蒸馏+层与层蒸馏
- */
- PKD("BERT-PKD", "cd /usr/local/algorithm && bash run_train_teacher.sh %s %s %s %s %s && bash run_train_student_bert_pkd.sh %s %s %s %s %s"),
- /**
- * 软标签蒸馏+层与层蒸馏+注意力蒸馏
- */
- TINY("TinyBERT", "cd /usr/local/algorithm && bash run_train_teacher.sh %s %s %s %s %s && bash run_train_student_tinybert.sh %s %s %s %s %s"),
- /**
- * 依照概率替换原有的BERT模块和Theseus的模块组成新的模型来训练
- */
- THESEUS("BERT-Theseus", "cd /usr/local/algorithm && bash run_train_teacher.sh %s %s %s %s %s && bash run_train_theseus.sh %s %s %s %s %s");
-
-
- /**
- * 算法名
- */
- private String name;
-
- /**
- * 命令行
- */
- private String command;
-
- DistillCommandEnum(String name, String command) {
- this.name = name;
- this.command = command;
- }
-
- /**
- * 根据名称获取命令行
- * @param name 蒸馏算法名称
- * @return 返回命令行
- */
- public static String getCommandByName(String name) {
- for (DistillCommandEnum commandEnum : DistillCommandEnum.values()) {
- if (commandEnum.getName().equals(name)) {
- return commandEnum.getCommand();
- }
- }
- return "";
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getCommand() {
- return command;
- }
-
- public void setCommand(String command) {
- this.command = command;
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/NoteBookStatusEnum.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/NoteBookStatusEnum.java
deleted file mode 100644
index e3a80a8..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/NoteBookStatusEnum.java
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * 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.enums;
-
-
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.k8s.enums.PodPhaseEnum;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * @description notebook 状态枚举
- * @create 2020-4-28
- */
-public enum NoteBookStatusEnum {
- /**
- * 运行
- */
- RUN(0, "运行中", 0),
- /**
- * 停止
- */
- STOP(1, "停止", 0),
- /**
- * 删除
- */
- DELETE(2, "删除", 0),
- /**
- * 启动中
- */
- STARTING(3, "启动中", 1),
- /**
- * 停止中
- */
- STOPPING(4, "停止中", 1),
- /**
- * 删除中
- */
- DELETING(5, "删除中", 1),
- /**
- * 运行异常
- */
- ERROR(6, "运行异常", 0);
- /**
- * 编码
- */
- private Integer code;
- /**
- * 描述
- */
- private String description;
- /**
- * 删除标识
- */
- private Integer deleteType;
-
- public Integer getCode() {
- return code;
- }
-
- public void setCode(Integer code) {
- this.code = code;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public Integer getDeleteType() {
- return deleteType;
- }
-
- public void setDeleteType(Integer deleteType) {
- this.deleteType = deleteType;
- }
-
- NoteBookStatusEnum(int code, String description, int deleteType) {
- this.code = code;
- this.description = description;
- this.deleteType = deleteType;
- }
-
- public static String getDescription(Integer code) {
- if (code != null) {
- for (NoteBookStatusEnum en : NoteBookStatusEnum.values()) {
- if (en.getCode().equals(code)) {
- return en.getDescription();
- }
- }
- }
- return null;
- }
-
- /**
- * k8s状态转换成NoteBook状态
- * 当查询不到k8s状态时即为删除
- *
- * @param bizPodPhase
- * @return
- */
- public static NoteBookStatusEnum convert(String bizPodPhase) {
- if (bizPodPhase == null
- || PodPhaseEnum.DELETED.getPhase().equals(bizPodPhase)
- || PodPhaseEnum.FAILED.getPhase().equals(bizPodPhase)) {
- return STOP;
- } else if (PodPhaseEnum.PENDING.getPhase().equals(bizPodPhase)) {
- return STARTING;
- } else if (PodPhaseEnum.RUNNING.getPhase().equals(bizPodPhase)) {
- return RUN;
- } else if (PodPhaseEnum.SUCCEEDED.getPhase().equals(bizPodPhase)) {
- return STOPPING;
- } else {
- return ERROR;
- }
- }
-
-
- /**
- * 查找可以删除的状态集合
- *
- * @return List
- */
- public static List getCanDeleteStatus() {
- List list = new ArrayList<>();
- for (NoteBookStatusEnum en : NoteBookStatusEnum.values()) {
- if (en.getDeleteType().equals(MagicNumConstant.ONE)) {
- list.add(en.getCode());
- }
- }
- return list;
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/OptimizeTypeEnum.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/OptimizeTypeEnum.java
deleted file mode 100644
index 52aac0b..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/OptimizeTypeEnum.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/**
- * 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.enums;
-
-import lombok.Getter;
-
-/**
- * @description 优化算法类型
- * @date 2021-01-06
- */
-@Getter
-public enum OptimizeTypeEnum {
-
- SLIMMING(0, "剪枝", "/ChannelSlimming"),
-
- DISTILL(1, "蒸馏", "/distil"),
-
- QUANTIFY(2, "量化", "/quantization"),
- ;
-
- /**
- * 类型值
- */
- private Integer type;
-
- /**
- * 类型名称
- */
- private String name;
-
- /**
- * 代码目录
- */
- private String codeDir;
-
- OptimizeTypeEnum(Integer type, String name, String codeDir) {
- this.type = type;
- this.name = name;
- this.codeDir = codeDir;
- }
-
-
- public static String getCodeDirByType(Integer type) {
- for (OptimizeTypeEnum optimizeTypeEnum : OptimizeTypeEnum.values()) {
- if (optimizeTypeEnum.getType().equals(type)) {
- return optimizeTypeEnum.getCodeDir();
- }
- }
- return "";
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/ResourcesPoolTypeEnum.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/ResourcesPoolTypeEnum.java
deleted file mode 100644
index 3282f7d..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/ResourcesPoolTypeEnum.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * 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.enums;
-
-/**
- * @description 规格类型
- * @date 2020-07-15
- */
-public enum ResourcesPoolTypeEnum {
-
- CPU(0, "CPU"),
- GPU(1, "GPU");
-
-
- /**
- * 编码
- */
- private Integer code;
-
- /**
- * 描述
- */
- private String description;
-
- ResourcesPoolTypeEnum(int code, String description) {
- this.code = code;
- this.description = description;
- }
-
- public Integer getCode() {
- return code;
- }
-
- public String getDescription() {
- return description;
- }
-
- /**
- * 是否是GPU编码
- * @param code
- * @return true 是 ,false 否
- */
- public static boolean isGpuCode(Integer code){
- return GPU.getCode().equals(code);
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/TrainTypeEnum.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/TrainTypeEnum.java
deleted file mode 100644
index 5769737..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/enums/TrainTypeEnum.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * 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.enums;
-
-import lombok.Getter;
-
-/**
- * @description 训练类型
- * @date 2020-08-31
- */
-@Getter
-public enum TrainTypeEnum {
-
- /**
- * 普通训练
- */
- JOB(0,"普通训练"),
- /**
- * 分布式训练
- */
- DISTRIBUTE_TRAIN(1,"分布式训练"),
- ;
-
-
- private Integer code;
-
- private String name;
-
- TrainTypeEnum(Integer code, String name) {
- this.code = code;
- this.name = name;
- }
-
- /**
- * 判断是否是分布式训练
- * @param trainType 训练类型
- * @return true 分布式训练,false 普通训练
- */
- public static boolean isDistributeTrain(int trainType){
- return DISTRIBUTE_TRAIN.getCode() == trainType;
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/BatchServingController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/BatchServingController.java
deleted file mode 100644
index a9b7991..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/BatchServingController.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.dto.BatchServingCreateDTO;
-import org.dubhe.domain.dto.BatchServingDeleteDTO;
-import org.dubhe.domain.dto.BatchServingDetailDTO;
-import org.dubhe.domain.dto.BatchServingQueryDTO;
-import org.dubhe.domain.dto.BatchServingStartDTO;
-import org.dubhe.domain.dto.BatchServingStopDTO;
-import org.dubhe.domain.dto.BatchServingUpdateDTO;
-import org.dubhe.service.BatchServingService;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-/**
- * @description 批量服务管理
- * @date 2020-08-27
- */
-@Api(tags = "云端Serving:批量服务管理")
-@RestController
-@RequestMapping("/api/batchServing")
-public class BatchServingController {
-
- @Resource
- private BatchServingService batchServingService;
-
- @ApiOperation("查询批量服务")
- @GetMapping
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody query(BatchServingQueryDTO batchServingQueryDTO) {
- return new DataResponseBody(batchServingService.query(batchServingQueryDTO));
- }
-
- @ApiOperation("创建批量服务")
- @PostMapping
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody create(@Validated @RequestBody BatchServingCreateDTO batchServingCreateDTO) {
- return new DataResponseBody(batchServingService.create(batchServingCreateDTO));
- }
-
- @ApiOperation("修改批量服务")
- @PutMapping
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody update(@Validated @RequestBody BatchServingUpdateDTO batchServingUpdateDTO) {
- return new DataResponseBody(batchServingService.update(batchServingUpdateDTO));
- }
-
- @ApiOperation("删除批量服务")
- @DeleteMapping
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody delete(@Validated @RequestBody BatchServingDeleteDTO batchServingDeleteDTO) {
- return new DataResponseBody(batchServingService.delete(batchServingDeleteDTO));
- }
-
- @ApiOperation("启动批量服务")
- @PostMapping("/start")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody start(@Validated @RequestBody BatchServingStartDTO batchServingStartDTO) {
- return new DataResponseBody(batchServingService.start(batchServingStartDTO));
- }
-
- @ApiOperation("停止批量服务")
- @PostMapping("/stop")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody stop(@Validated @RequestBody BatchServingStopDTO batchServingStopDTO) {
- return new DataResponseBody(batchServingService.stop(batchServingStopDTO));
- }
-
- @ApiOperation("获取批量服务详情")
- @GetMapping("/detail")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody getDetail(@Validated BatchServingDetailDTO batchServingDetailDTO) {
- return new DataResponseBody(batchServingService.getDetail(batchServingDetailDTO));
- }
-
- @GetMapping("/pod/{id}")
- @ApiOperation("获取批量服务下pod信息")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody getServingLog(@PathVariable Long id) {
- return new DataResponseBody(batchServingService.getPods(id));
- }
-
-
- @GetMapping("/queryById/{id}")
- @ApiOperation("获取批量服务状态及进度")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody queryStatusAndProgress(@PathVariable Long id) {
- return new DataResponseBody(batchServingService.queryStatusAndProgress(id));
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ForwardController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ForwardController.java
deleted file mode 100644
index 99865f4..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ForwardController.java
+++ /dev/null
@@ -1,126 +0,0 @@
-/** 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.rest;
-
-import cn.hutool.core.util.StrUtil;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.http.HttpEntity;
-import org.springframework.http.HttpHeaders;
-import org.springframework.http.HttpMethod;
-import org.springframework.http.ResponseEntity;
-import org.springframework.web.bind.annotation.*;
-import org.springframework.web.client.RestTemplate;
-
-import javax.servlet.http.HttpServletRequest;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * @description 代理转发
- * @date 2020-06-23
- */
-
-@RestController
-public class ForwardController {
- @Value("${dubhe-proxy.visual.keyword}")
- private String visual;
- @Value("${dubhe-proxy.visual.server}")
- private String visualServer;
- @Value("${dubhe-proxy.visual.port}")
- private String visualPort;
- @Value("${dubhe-proxy.refine.keyword}")
- private String refine;
- @Value("${dubhe-proxy.refine.server}")
- private String refineServer;
- @Value("${dubhe-proxy.refine.port}")
- private String refinePort;
-
- RestTemplate restTemplate = new RestTemplate();
-
- /**
- * 根据不同的请求拼上对应的转发路径
- *
- * @param request http请求
- * @return URI 用于restTemplate的请求路径
- **/
- private URI getURI(HttpServletRequest request) throws URISyntaxException {
- String requestURI = request.getRequestURI();
- String server = null;
- String prefix = "";
- int port = 0;
- if (requestURI.startsWith(StrUtil.SLASH + visual)) {
- prefix = visual;
- server = visualServer;
- port = Integer.parseInt(visualPort);
- } else if (requestURI.startsWith(StrUtil.SLASH + refine)) {
- prefix = refine;
- server = refineServer;
- port = Integer.parseInt(refinePort);
- }
-
- return new URI("http", null, server, port, requestURI.substring(prefix.length() + 1), request.getQueryString(), null);
- }
-
- /**
- * 获取请求中的Cookie
- *
- * @param request http请求
- * @return HttpHeaders 用于restTemplate的header
- **/
- private HttpHeaders getHeader(HttpServletRequest request) {
- String cookie = request.getHeader("Cookie");
- HttpHeaders httpHeaders = new HttpHeaders();
- if (null != cookie) {
- httpHeaders.set("Cookie", cookie);
- }
- return httpHeaders;
- }
-
- /**
- * 转发get请求
- *
- * @param request http请求
- * @return ResponseEntity 返回给前端的响应实体
- **/
- @GetMapping({StrUtil.SLASH + "${dubhe-proxy.visual.keyword}" + StrUtil.SLASH + "**", StrUtil.SLASH + "${dubhe-proxy.refine.keyword}" + StrUtil.SLASH + "**"})
- @ResponseBody
- public ResponseEntity mirrorRest(HttpServletRequest request) throws URISyntaxException {
- URI uri = getURI(request);
- HttpHeaders httpHeaders = getHeader(request);
- ResponseEntity responseEntity =
- restTemplate.exchange(uri, HttpMethod.GET, new HttpEntity(httpHeaders), String.class);
- return responseEntity;
- }
-
- /**
- * 转发get请求
- *
- * @param request http请求
- * @param method 请求方法
- * @param body 请求体
- * @return ResponseEntity 返回给前端的响应实体
- **/
- @RequestMapping({StrUtil.SLASH + "${dubhe-proxy.visual.keyword}" + StrUtil.SLASH + "**", StrUtil.SLASH + "${dubhe-proxy.refine.keyword}" + StrUtil.SLASH + "**"})
- @ResponseBody
- public ResponseEntity mirrorRest(HttpMethod method, HttpServletRequest request, @RequestBody String body) throws URISyntaxException {
- URI uri = getURI(request);
- HttpHeaders httpHeaders = getHeader(request);
- ResponseEntity responseEntity =
- restTemplate.exchange(uri, method, new HttpEntity(body, httpHeaders), String.class);
- return responseEntity;
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/K8sCallbackDeploymentController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/K8sCallbackDeploymentController.java
deleted file mode 100644
index d8538c4..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/K8sCallbackDeploymentController.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.dto.callback.ServingK8sDeploymentCallbackCreateDTO;
-import org.dubhe.factory.DataResponseFactory;
-import org.dubhe.service.DeploymentCallbackAsyncService;
-import org.dubhe.utils.K8sCallBackTool;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import javax.annotation.Resource;
-
-import static org.dubhe.constant.StringConstant.K8S_CALLBACK_PATH_DEPLOYMENT;
-
-/**
- * @description k8s deployment回调
- * @date 2020-11-27
- */
-@Api(tags = "k8s回调:deployment")
-@RestController
-@RequestMapping(K8S_CALLBACK_PATH_DEPLOYMENT)
-public class K8sCallbackDeploymentController {
-
- @Resource(name = "servingAsyncService")
- private DeploymentCallbackAsyncService servingAsyncService;
-
- /**
- * 云端serving在线服务异步回调
- *
- * @param k8sToken
- * @param k8sDeploymentCallbackReq
- * @return
- */
- @PostMapping(value = "/serving")
- @ApiOperation("云端serving deployment 回调")
- public DataResponseBody servingPodCallBack(@ApiParam(type = "head") @RequestHeader(name = K8sCallBackTool.K8S_CALLBACK_TOKEN) String k8sToken,
- @Validated @RequestBody ServingK8sDeploymentCallbackCreateDTO k8sDeploymentCallbackReq) {
- servingAsyncService.deploymentCallBack(k8sDeploymentCallbackReq);
- return DataResponseFactory.success("云端serving在线服务异步回调中");
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/K8sCallbackPodController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/K8sCallbackPodController.java
deleted file mode 100644
index 4489d6d..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/K8sCallbackPodController.java
+++ /dev/null
@@ -1,119 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import io.swagger.annotations.ApiParam;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.dto.callback.AlgorithmK8sPodCallbackCreateDTO;
-import org.dubhe.dto.callback.BatchServingK8sPodCallbackCreateDTO;
-import org.dubhe.dto.callback.ModelOptK8sPodCallbackCreateDTO;
-import org.dubhe.dto.callback.NotebookK8sPodCallbackCreateDTO;
-import org.dubhe.factory.DataResponseFactory;
-import org.dubhe.service.PodCallbackAsyncService;
-import org.dubhe.utils.K8sCallBackTool;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestHeader;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-import static org.dubhe.constant.StringConstant.K8S_CALLBACK_URI;
-
-/**
- * @description k8s Pod 异步回调处理类
- * @date 2020-05-28
- */
-@Api(tags = "k8s回调:Pod")
-@RestController
-@RequestMapping(K8S_CALLBACK_URI)
-public class K8sCallbackPodController {
-
- @Resource(name = "noteBookAsyncServiceImpl")
- private PodCallbackAsyncService noteBookAsyncService;
- @Resource(name = "algorithmAsyncServiceImpl")
- private PodCallbackAsyncService algorithmAsyncServiceImpl;
- @Resource(name = "modelOptAsyncServiceImpl")
- private PodCallbackAsyncService modelOptAsyncService;
- @Resource(name = "batchServingAsyncService")
- private PodCallbackAsyncService batchServingAsyncService;
-
- /**
- * notebook异步回调
- *
- * @param k8sToken
- * @param k8sPodCallbackReq
- * @return
- */
- @PostMapping(value = "/notebook")
- @ApiOperation("模型管理 pod 回调")
- public DataResponseBody notebookPodCallBack(@ApiParam(type = "head") @RequestHeader(name = K8sCallBackTool.K8S_CALLBACK_TOKEN) String k8sToken
- , @Validated @RequestBody NotebookK8sPodCallbackCreateDTO k8sPodCallbackReq) {
- noteBookAsyncService.podCallBack(k8sPodCallbackReq);
- return DataResponseFactory.success("notebook正在异步处理pod中。");
- }
-
- /**
- * algorithm异步回调
- *
- * @param k8sToken
- * @param k8sPodCallbackReq
- * @return
- */
- @PostMapping(value = "/algorithm")
- @ApiOperation("算法管理 pod 回调")
- public DataResponseBody algorithmPodCallBack(@ApiParam(type = "head") @RequestHeader(name = K8sCallBackTool.K8S_CALLBACK_TOKEN) String k8sToken
- , @Validated @RequestBody AlgorithmK8sPodCallbackCreateDTO k8sPodCallbackReq) {
- algorithmAsyncServiceImpl.podCallBack(k8sPodCallbackReq);
- return DataResponseFactory.success("算法管理异步回调处理中");
- }
-
- /**
- * modelOpt异步回调
- *
- * @param k8sToken
- * @param k8sPodCallbackReq
- * @return
- */
- @PostMapping(value = "/modelopt")
- @ApiOperation("模型优化管理 pod 回调")
- public DataResponseBody modelOptPodCallBack(@ApiParam(type = "head") @RequestHeader(name= K8sCallBackTool.K8S_CALLBACK_TOKEN) String k8sToken,
- @Validated @RequestBody ModelOptK8sPodCallbackCreateDTO k8sPodCallbackReq) {
- modelOptAsyncService.podCallBack(k8sPodCallbackReq);
- return DataResponseFactory.success("model-opt 正在异步处理pod中。");
- }
-
- /**
- * 云端serving批量服务异步回调
- *
- * @param k8sToken
- * @param k8sPodCallbackReq
- * @return
- */
- @PostMapping(value = "/batchserving")
- @ApiOperation("云端serving pod 回调")
- public DataResponseBody servingPodCallBack(@ApiParam(type = "head") @RequestHeader(name = K8sCallBackTool.K8S_CALLBACK_TOKEN) String k8sToken,
- @Validated @RequestBody BatchServingK8sPodCallbackCreateDTO k8sPodCallbackReq) {
- batchServingAsyncService.podCallBack(k8sPodCallbackReq);
- return DataResponseFactory.success("云端serving批量服务异步回调处理中");
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ModelOptTaskController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ModelOptTaskController.java
deleted file mode 100644
index 23f5dba..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ModelOptTaskController.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.dto.ModelOptDatasetCreateDTO;
-import org.dubhe.domain.dto.ModelOptTaskCreateDTO;
-import org.dubhe.domain.dto.ModelOptTaskDeleteDTO;
-import org.dubhe.domain.dto.ModelOptTaskQueryDTO;
-import org.dubhe.domain.dto.ModelOptTaskSubmitDTO;
-import org.dubhe.domain.dto.ModelOptTaskUpdateDTO;
-import org.dubhe.factory.DataResponseFactory;
-import org.dubhe.service.ModelOptTaskService;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-/**
- * @description 模型优化任务
- * @date 2020-05-22
- */
-@Api(tags = "模型优化:任务")
-@RestController
-@RequestMapping("/api/modelOpt/task")
-public class ModelOptTaskController {
-
- @Resource
- private ModelOptTaskService modelOptTaskService;
-
- @GetMapping
- @ApiOperation("任务列表分页查询")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody getModelOptList(ModelOptTaskQueryDTO modelOptTaskQueryDTO) {
- return DataResponseFactory.success(modelOptTaskService.queryAll(modelOptTaskQueryDTO));
- }
-
- @PostMapping
- @ApiOperation("创建任务")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody create(@Validated @RequestBody ModelOptTaskCreateDTO modelOptTaskCreateDTO) {
- return DataResponseFactory.success(modelOptTaskService.create(modelOptTaskCreateDTO));
- }
-
- @PostMapping("/submit")
- @ApiOperation("提交任务,创建实例")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody submit(@Validated @RequestBody ModelOptTaskSubmitDTO submitDTO) {
- modelOptTaskService.submit(submitDTO);
- return DataResponseFactory.success();
- }
-
- @PutMapping
- @ApiOperation("编辑模型优化任务")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody update(@Validated @RequestBody ModelOptTaskUpdateDTO modelOptTaskUpdateDTO) {
- return DataResponseFactory.success(modelOptTaskService.update(modelOptTaskUpdateDTO));
- }
-
- @DeleteMapping
- @ApiOperation("删除模型优化任务")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody delete(@Validated @RequestBody ModelOptTaskDeleteDTO modelOptTaskDeleteDTO) {
- modelOptTaskService.delete(modelOptTaskDeleteDTO);
- return DataResponseFactory.success();
- }
-
- @GetMapping(value = "/getBuiltInModel")
- @ApiOperation("获取全部内置模型")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody getBuiltInModel(Integer type, String dataset, String algorithm) {
- return DataResponseFactory.success(modelOptTaskService.getBuiltInModel(type, dataset, algorithm));
- }
-
- @GetMapping(value = "/getAlgorithm")
- @ApiOperation("获取模型优化算法")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody getAlgorithm(Integer type, String model, String dataset) {
- return DataResponseFactory.success(modelOptTaskService.getAlgorithm(type, model, dataset));
- }
-
- @GetMapping(value = "/getDataset")
- @ApiOperation("获取内置模型优化数据集")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody getDataset(Integer type, String model, String algorithm) {
- return DataResponseFactory.success(modelOptTaskService.getDataset(type, model, algorithm));
- }
-
- @GetMapping(value = "/MyDataset")
- @ApiOperation("获取我的模型优化数据集")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody getMyDataset() {
- return DataResponseFactory.success(modelOptTaskService.getMyDataset());
- }
-
- @PostMapping(value = "/MyDataset")
- @ApiOperation("创建我的模型优化数据集")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody createMyDataset(@Validated @RequestBody ModelOptDatasetCreateDTO modelOptDatasetCreateDTO) {
- return DataResponseFactory.success(modelOptTaskService.createMyDataset(modelOptDatasetCreateDTO));
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ModelOptTaskInstanceController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ModelOptTaskInstanceController.java
deleted file mode 100644
index 82f487d..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ModelOptTaskInstanceController.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.dto.ModelOptTaskInstanceDeleteDTO;
-import org.dubhe.domain.dto.ModelOptTaskInstanceCancelDTO;
-import org.dubhe.domain.dto.ModelOptTaskInstanceDetailDTO;
-import org.dubhe.domain.dto.ModelOptTaskInstanceQueryDTO;
-import org.dubhe.domain.dto.ModelOptTaskInstanceResubmitDTO;
-import org.dubhe.factory.DataResponseFactory;
-import org.dubhe.service.ModelOptTaskInstanceService;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import javax.annotation.Resource;
-
-/**
- * @description 模型优化任务实例
- * @date 2020-05-22
- */
-@Api(tags = "模型优化:任务实例")
-@RestController
-@RequestMapping("/api/modelOpt/taskInstance")
-public class ModelOptTaskInstanceController {
-
- @Resource
- private ModelOptTaskInstanceService modelOptTaskInstanceService;
-
- @ApiOperation("分页查询任务执行记录实例列表")
- @GetMapping
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody query(ModelOptTaskInstanceQueryDTO instanceQueryDTO) {
- return DataResponseFactory.success(modelOptTaskInstanceService.queryAll(instanceQueryDTO));
- }
-
- @ApiOperation("重新提交任务实例")
- @PostMapping(value = "/resubmit")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody resubmit(@Validated @RequestBody ModelOptTaskInstanceResubmitDTO resubmitDTO) {
- modelOptTaskInstanceService.resubmit(resubmitDTO);
- return DataResponseFactory.success();
- }
-
- @ApiOperation("取消模型优化任务实例")
- @PutMapping(value = "/cancel")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody cancel(@Validated @RequestBody ModelOptTaskInstanceCancelDTO cancelDTO) {
- modelOptTaskInstanceService.cancel(cancelDTO);
- return DataResponseFactory.success();
- }
-
- @ApiOperation("查看任务实例详情")
- @GetMapping(value = "/detail")
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody getInstDetail(@Validated ModelOptTaskInstanceDetailDTO detailDTO) {
- return DataResponseFactory.success(modelOptTaskInstanceService.getInstDetail(detailDTO));
- }
-
- @ApiOperation("删除任务实例")
- @DeleteMapping
- @RequiresPermissions(Permissions.MODEL_OPTIMIZE)
- public DataResponseBody delete(@Validated @RequestBody ModelOptTaskInstanceDeleteDTO modelOptTaskInstanceDeleteDTO) {
- modelOptTaskInstanceService.delete(modelOptTaskInstanceDeleteDTO);
- return DataResponseFactory.success();
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/NoteBookController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/NoteBookController.java
deleted file mode 100644
index 12d7202..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/NoteBookController.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/**
- * 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.rest;
-
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import io.swagger.annotations.*;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.base.ResponseCode;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.entity.NoteBook;
-import org.dubhe.domain.dto.NoteBookListQueryDTO;
-import org.dubhe.domain.dto.SourceNoteBookDTO;
-import org.dubhe.domain.dto.NoteBookCreateDTO;
-import org.dubhe.enums.BizNfsEnum;
-import org.dubhe.factory.DataResponseFactory;
-import org.dubhe.service.NoteBookService;
-import org.dubhe.utils.NotebookUtil;
-import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-import java.util.Set;
-
-/**
- * @description notebook controller
- * @date 2020-04-27
- */
-@Api(tags = "模型开发:Notebook")
-@RestController
-@RequestMapping("/api/{version}/notebook")
-public class NoteBookController {
-
- @Autowired
- private NoteBookService noteBookService;
-
- @ApiOperation("新增加notebook")
- @PostMapping(value = "/notebooks")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody createNoteBook(@Validated @RequestBody NoteBookCreateDTO noteBookCreateDTO) {
- long userId = NotebookUtil.getCurUserId();
- NoteBook noteBook = new NoteBook();
- BeanUtils.copyProperties(noteBookCreateDTO, noteBook);
- noteBook.setCreateUserId(userId);
- noteBook.setUserId(userId);
- noteBook.setCreateResource(BizNfsEnum.NOTEBOOK.getCreateResource());
- return new DataResponseBody(noteBookService.createNoteBook(noteBook));
- }
-
- @ApiOperation("查询notebook")
- @GetMapping(value = "/notebooks")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody getNoteBookList(Page page, NoteBookListQueryDTO noteBookListQueryDTO) {
- return new DataResponseBody(noteBookService.getNoteBookList(page, noteBookListQueryDTO));
- }
-
- @ApiOperation("异步批量删除notebook")
- @DeleteMapping
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody deleteNoteBook(@RequestBody Set noteBookIds) {
- List noteBookList = noteBookService.validateDeleteNoteBook(noteBookIds);
- noteBookService.deleteNoteBooks(noteBookList);
- return new DataResponseBody(ResponseCode.SUCCESS, "正在异步删除NoteBook中..");
- }
-
- @ApiOperation("启动notebook")
- @PutMapping(value = "/start")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody startNotebook(@RequestParam(required = true) Long noteBookId) {
- String resultInfo = noteBookService.startNoteBook(noteBookId);
- return new DataResponseBody(
- NotebookUtil.validateFailedInfo(resultInfo) ? ResponseCode.ERROR : ResponseCode.SUCCESS
- , resultInfo);
- }
-
- @ApiOperation("停止notebook")
- @PutMapping(value = "/stop")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody stopNotebook(@RequestParam(required = true) Long noteBookId) {
- String resultInfo = noteBookService.stopNoteBook(noteBookId);
- return new DataResponseBody(
- NotebookUtil.validateFailedInfo(resultInfo) ? ResponseCode.ERROR : ResponseCode.SUCCESS
- , resultInfo);
- }
-
-
- @ApiOperation("打开notebook")
- @GetMapping(value = "/{id}")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody openNotebook(@PathVariable(name = "id", required = true) Long noteBookId) {
- return DataResponseFactory.success("获取成功", noteBookService.openNoteBook(noteBookId));
- }
-
-
- @ApiOperation("第三方业务创建notebook")
- @PostMapping(value = "/create/{source}")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody createByThirdParty(@PathVariable int source, @Validated @RequestBody SourceNoteBookDTO sourceNoteBookDTO) {
- BizNfsEnum bizNfsEnum = BizNfsEnum.getByCreateResource(source);
- if (bizNfsEnum == null || BizNfsEnum.NOTEBOOK == bizNfsEnum) {
- return new DataResponseBody(ResponseCode.BADREQUEST, "不支持该渠道创建Notebook!");
- }
- sourceNoteBookDTO.setCurUserId(NotebookUtil.getCurUserId());
- return DataResponseFactory.success("操作成功", noteBookService.createNoteBookByThirdParty(bizNfsEnum, sourceNoteBookDTO));
- }
-
- @ApiOperation("获取编辑地址")
- @GetMapping(value = "/{id}/get-address")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody getAddress(@PathVariable(name = "id", required = true) Long noteBookId) {
- return new DataResponseBody(noteBookService.getAddress(noteBookId));
- }
-
- @ApiOperation("获取状态")
- @GetMapping(value = "/status")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody getNoteBookStatus() {
- return new DataResponseBody(noteBookService.getNoteBookStatus());
- }
-
-
- @ApiOperation("获取正在运行的notebook数量")
- @GetMapping(value = "/run-number")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody getNoteBookRunNumber() {
- return new DataResponseBody(noteBookService.getNoteBookRunNumber());
- }
-
-
- @ApiOperation("获取notebook模板")
- @GetMapping(value = "/notebook-model")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody getNoteBookModel() {
- return new DataResponseBody(noteBookService.getNoteBookModel());
- }
-
-
- @ApiOperation("获取notebook详情")
- @PostMapping(value = "/detail")
- @RequiresPermissions(Permissions.DEVELOPMENT_NOTEBOOK)
- public DataResponseBody getNotebookDetail(@RequestBody Set noteBookIds) {
- return new DataResponseBody(noteBookService.getNotebookDetail(noteBookIds));
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtImageController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtImageController.java
deleted file mode 100644
index 08c289d..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtImageController.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.annotation.ApiVersion;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.dto.*;
-import org.dubhe.service.PtImageService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @description 镜像
- * @date 2020-04-27
- */
-@Api(tags = "镜像:镜像管理")
-@RestController
-@ApiVersion(1)
-@RequestMapping("/api/{version}/ptImage")
-public class PtImageController {
-
- @Autowired
- private PtImageService ptImageService;
-
- @GetMapping("/info")
- @ApiOperation("查询镜像")
- @RequiresPermissions(Permissions.TRAINING_IMAGE)
- public DataResponseBody getImage(PtImageQueryDTO ptImageQueryDTO) {
- return new DataResponseBody(ptImageService.getImage(ptImageQueryDTO));
- }
-
- @ApiOperation("通过projectName查询镜像")
- @GetMapping
- @RequiresPermissions(Permissions.TRAINING_IMAGE)
- public DataResponseBody getTagsByImageName(@RequestParam Integer projectType, @RequestParam String imageName) {
- return new DataResponseBody(ptImageService.searchImages(projectType, imageName));
- }
-
- @PostMapping("uploadImage")
- @ApiOperation("上传镜像包到harbor")
- @RequiresPermissions(Permissions.TRAINING_IMAGE)
- public DataResponseBody uploadImage(@Validated @RequestBody PtImageUploadDTO ptImageUploadDTO) {
- ptImageService.uploadImage(ptImageUploadDTO);
- return new DataResponseBody();
- }
-
- @DeleteMapping
- @ApiOperation("删除镜像")
- @RequiresPermissions(Permissions.TRAINING_IMAGE)
- public DataResponseBody deleteTrainImage(@Validated @RequestBody PtImageDeleteDTO ptImageDeleteDTO) {
- ptImageService.deleteTrainImage(ptImageDeleteDTO);
- return new DataResponseBody();
- }
-
- @PutMapping
- @ApiOperation("修改镜像信息")
- @RequiresPermissions(Permissions.TRAINING_IMAGE)
- public DataResponseBody updateTrainImage(@Validated @RequestBody PtImageUpdateDTO ptImageUpdateDTO) {
- ptImageService.updateTrainImage(ptImageUpdateDTO);
- return new DataResponseBody();
- }
-
- @GetMapping("/imageNameList")
- @ApiOperation("获取镜像名称列表")
- @RequiresPermissions(Permissions.TRAINING_IMAGE)
- public DataResponseBody getImageNameList(@RequestParam Integer projectType) {
- return new DataResponseBody(ptImageService.getImageNameList(projectType));
- }
-
- @PutMapping("/imageResource")
- @ApiOperation("修改镜像来源(notebook定制)")
- @RequiresPermissions(Permissions.TRAINING_IMAGE)
- public DataResponseBody updateImageResource(@RequestParam Long id) {
- ptImageService.updImageResource(id);
- return new DataResponseBody();
- }
-
- @GetMapping("/imageUrl")
- @ApiOperation("查询镜像url")
- @RequiresPermissions(Permissions.TRAINING_IMAGE)
- public DataResponseBody getImageUrl(PtImageQueryUrlDTO ptImageQueryUrlDTO) {
- return new DataResponseBody(ptImageService.getImageUrl(ptImageQueryUrlDTO));
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtMeasureController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtMeasureController.java
deleted file mode 100644
index 81c1b24..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtMeasureController.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.dubhe.annotation.ApiVersion;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.domain.dto.PtMeasureDTO;
-import org.dubhe.domain.dto.PtMeasureDeleteDTO;
-import org.dubhe.domain.dto.PtMeasureQueryDTO;
-import org.dubhe.domain.dto.PtMeasureUpdateDTO;
-import org.dubhe.service.PtMeasureService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @description 度量管理
- * @date 2020-11-16
- */
-@Api(tags = "度量:度量管理")
-@RestController
-@ApiVersion(1)
-@RequestMapping("/api/{version}/ptMeasure")
-public class PtMeasureController {
-
- @Autowired
- private PtMeasureService ptMeasureService;
-
- @GetMapping
- @ApiOperation("查询度量")
- public DataResponseBody getMeasure(PtMeasureQueryDTO ptMeasureQueryDTO) {
- return new DataResponseBody(ptMeasureService.getMeasure(ptMeasureQueryDTO));
- }
-
- @PostMapping
- @ApiOperation("新建度量")
- public DataResponseBody addMeasure(@Validated @RequestBody PtMeasureDTO ptMeasureCreateDTO) {
- ptMeasureService.createMeasure(ptMeasureCreateDTO);
- return new DataResponseBody();
- }
-
- @PutMapping
- @ApiOperation("修改度量")
- public DataResponseBody updateMeasure(@Validated @RequestBody PtMeasureUpdateDTO ptMeasureUpdateDTO) {
- ptMeasureService.updateMeasure(ptMeasureUpdateDTO);
- return new DataResponseBody();
- }
-
- @DeleteMapping
- @ApiOperation("删除度量")
- public DataResponseBody deleteMeasure(@Validated @RequestBody PtMeasureDeleteDTO PtMeasureUpdateDTO) {
- ptMeasureService.deleteMeasure(PtMeasureUpdateDTO);
- return new DataResponseBody();
- }
-
- @GetMapping("/byName")
- @ApiOperation("通过度量名称查询")
- public DataResponseBody getMeasureByName(@RequestParam String name) {
- return new DataResponseBody(ptMeasureService.getMeasureByName(name));
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainAlgorithmController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainAlgorithmController.java
deleted file mode 100644
index 5cc6fec..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainAlgorithmController.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.annotation.ApiVersion;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.dto.*;
-import org.dubhe.service.PtTrainAlgorithmService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @description 训练算法
- * @date 2020-04-27
- */
-@Api(tags = "训练:算法管理")
-@RestController
-@ApiVersion(1)
-@RequestMapping("/api/{version}/algorithm")
-public class PtTrainAlgorithmController {
-
- @Autowired
- private PtTrainAlgorithmService ptTrainAlgorithmService;
-
- @GetMapping
- @ApiOperation("查询算法")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody getAlgorithms(@Validated PtTrainAlgorithmQueryDTO ptTrainAlgorithmQueryDTO) {
- return new DataResponseBody(ptTrainAlgorithmService.queryAll(ptTrainAlgorithmQueryDTO));
- }
-
- @GetMapping("/myAlgorithmCount")
- @ApiOperation("查询当前用户的算法个数")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody getAlgorithmCount() {
- return new DataResponseBody(ptTrainAlgorithmService.getAlgorithmCount());
- }
-
- @PostMapping
- @ApiOperation("新增算法")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody create(@Validated @RequestBody PtTrainAlgorithmCreateDTO ptTrainAlgorithmCreateDTO) {
- return new DataResponseBody(ptTrainAlgorithmService.create(ptTrainAlgorithmCreateDTO));
- }
-
- @PutMapping
- @ApiOperation("修改算法")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody update(@Validated @RequestBody PtTrainAlgorithmUpdateDTO ptTrainAlgorithmUpdateDTO) {
- return new DataResponseBody(ptTrainAlgorithmService.update(ptTrainAlgorithmUpdateDTO));
- }
-
- @DeleteMapping
- @ApiOperation("删除算法")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody deleteAll(@Validated @RequestBody PtTrainAlgorithmDeleteDTO ptTrainAlgorithmDeleteDTO) {
- ptTrainAlgorithmService.deleteAll(ptTrainAlgorithmDeleteDTO);
- return new DataResponseBody();
- }
-
- @PostMapping("/uploadAlgorithm")
- @ApiOperation("模型优化上传算法")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody modelOptimizationUploadAlgorithm(@Validated @RequestBody PtModelAlgorithmCreateDTO ptModelAlgorithmCreateDTO) {
- return new DataResponseBody(ptTrainAlgorithmService.modelOptimizationUploadAlgorithm(ptModelAlgorithmCreateDTO));
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainAlgorithmUsageController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainAlgorithmUsageController.java
deleted file mode 100644
index 299f3c4..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainAlgorithmUsageController.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.annotation.ApiVersion;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.constant.Permissions;
-import org.dubhe.constant.UserAuxiliaryInfoConstant;
-import org.dubhe.domain.dto.PtTrainAlgorithmUsageDeleteDTO;
-import org.dubhe.domain.dto.PtTrainAlgorithmUsageCreateDTO;
-import org.dubhe.domain.dto.PtTrainAlgorithmUsageQueryDTO;
-import org.dubhe.domain.dto.PtTrainAlgorithmUsageUpdateDTO;
-import org.dubhe.factory.DataResponseFactory;
-import org.dubhe.service.PtTrainAlgorithmUsageService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @description 算法用途管理
- * @date 2020-06-19
- */
-@Api(tags = "训练:算法用途管理")
-@RestController
-@ApiVersion(1)
-@RequestMapping("/api/{version}/algorithmUsage")
-public class PtTrainAlgorithmUsageController {
-
- @Autowired
- private PtTrainAlgorithmUsageService ptTrainAlgorithmUsageService;
-
- @GetMapping
- @ApiOperation("算法用途列表展示")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody queryAll(@Validated PtTrainAlgorithmUsageQueryDTO ptTrainAlgorithmUsageQueryDTO) {
- ptTrainAlgorithmUsageQueryDTO.setType(UserAuxiliaryInfoConstant.ALGORITHM_USAGE);
- return DataResponseFactory
- .success(ptTrainAlgorithmUsageService.queryAll(ptTrainAlgorithmUsageQueryDTO));
- }
-
- @PostMapping
- @ApiOperation("新增算法用途")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody create(
- @Validated @RequestBody PtTrainAlgorithmUsageCreateDTO ptTrainAlgorithmUsageCreateDTO) {
- ptTrainAlgorithmUsageCreateDTO.setType(UserAuxiliaryInfoConstant.ALGORITHM_USAGE);
- return DataResponseFactory.success(ptTrainAlgorithmUsageService.create(ptTrainAlgorithmUsageCreateDTO));
- }
-
- @DeleteMapping
- @ApiOperation("删除算法用途")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody deleteAll(@Validated @RequestBody PtTrainAlgorithmUsageDeleteDTO ptTrainAlgorithmUsageDeleteDTO) {
- ptTrainAlgorithmUsageService.deleteAll(ptTrainAlgorithmUsageDeleteDTO);
- return new DataResponseBody();
- }
-
- @PutMapping
- @ApiOperation("修改算法用途")
- @RequiresPermissions(Permissions.DEVELOPMENT_ALGORITHM)
- public DataResponseBody update(
- @Validated @RequestBody PtTrainAlgorithmUsageUpdateDTO ptTrainAlgorithmUsageUpdateDTO) {
- ptTrainAlgorithmUsageService.update(ptTrainAlgorithmUsageUpdateDTO);
- return new DataResponseBody();
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainJobController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainJobController.java
deleted file mode 100644
index 5a0dec7..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainJobController.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.Logical;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.annotation.ApiVersion;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.dto.*;
-import org.dubhe.enums.TrainTypeEnum;
-import org.dubhe.factory.DataResponseFactory;
-import org.dubhe.service.PtTrainJobService;
-import org.dubhe.service.PtTrainJobSpecsService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-
-/**
- * @description 训练作业job
- * @date 2020-04-27
- */
-@Api(tags = "训练:任务管理")
-@RestController
-@ApiVersion(1)
-@RequestMapping("/api/{version}/trainJob")
-public class PtTrainJobController {
-
- @Autowired
- private PtTrainJobService ptTrainJobService;
-
- @Autowired
- private PtTrainJobSpecsService ptTrainJobSpecsService;
-
- @GetMapping
- @ApiOperation("作业列表展示")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody getTrainJob(@Validated PtTrainQueryDTO ptTrainQueryDTO) {
- return new DataResponseBody(ptTrainJobService.getTrainJob(ptTrainQueryDTO));
- }
-
- @GetMapping("/trainJobSpecs")
- @ApiOperation("规格展示")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody getTrainJobSpecs(@Validated PtTrainJobSpecsQueryDTO ptTrainJobSpecsQueryDTO) {
- return new DataResponseBody(ptTrainJobSpecsService.getTrainJobSpecs(ptTrainJobSpecsQueryDTO));
- }
-
- @GetMapping("/jobDetail")
- @ApiOperation("根据jobId查询训练任务详情")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody getTrainJobDetail(@Validated PtTrainJobDetailQueryDTO ptTrainJobDetailQueryDTO) {
- return new DataResponseBody(ptTrainJobService.getTrainJobDetail(ptTrainJobDetailQueryDTO));
- }
-
- @GetMapping("/mine")
- @ApiOperation(value = "我的训练任务统计", notes = "运行中的任务:PENDDING,RUNNING;完成的任务:其他状态")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody statisticsMine() {
- return new DataResponseBody(ptTrainJobService.statisticsMine());
- }
-
- @GetMapping("/trainJobVersionDetail")
- @ApiOperation("作业不同版本任务列表展示")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody getTrainJobVersion(@Validated PtTrainJobVersionQueryDTO ptTrainJobVersionQueryDTO) {
- return new DataResponseBody(ptTrainJobService.getTrainJobVersion(ptTrainJobVersionQueryDTO));
- }
-
- @GetMapping("/dataSourceStatus")
- @ApiOperation("数据集状态展示")
- @RequiresPermissions(value = {Permissions.TRAINING_JOB, Permissions.DATA}, logical = Logical.OR)
- public DataResponseBody getTrainDataSourceStatus(@Validated PtTrainDataSourceStatusQueryDTO ptTrainDataSourceStatusQueryDTO) {
- return new DataResponseBody(ptTrainJobService.getTrainDataSourceStatus(ptTrainDataSourceStatusQueryDTO));
- }
-
- @PostMapping
- @ApiOperation("创建训练任务")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody createTrainJob(@Validated @RequestBody PtTrainJobCreateDTO ptTrainJobCreateDTO) {
- if (TrainTypeEnum.isDistributeTrain(ptTrainJobCreateDTO.getTrainType())
- && ptTrainJobCreateDTO.getResourcesPoolNode() < 2) {
- // 分布式训练节点数校验补偿
- return DataResponseFactory.failed("分布式训练节点个数至少2个");
- }
- return new DataResponseBody(ptTrainJobService.createTrainJobVersion(ptTrainJobCreateDTO));
- }
-
- @PutMapping
- @ApiOperation("修改训练任务")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody updateTrainJob(@Validated @RequestBody PtTrainJobUpdateDTO ptTrainJobUpdateDTO) {
- return new DataResponseBody(ptTrainJobService.updateTrainJob(ptTrainJobUpdateDTO));
- }
-
- @DeleteMapping
- @ApiOperation("删除训练任务")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody deleteTrainJob(@Validated @RequestBody PtTrainJobDeleteDTO ptTrainJobDeleteDTO) {
- return new DataResponseBody(ptTrainJobService.deleteTrainJob(ptTrainJobDeleteDTO));
- }
-
- @PostMapping("/stop")
- @ApiOperation("停止训练任务")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody stopTrainJob(@Validated @RequestBody PtTrainJobStopDTO ptTrainJobStopDTO) {
- return new DataResponseBody(ptTrainJobService.stopTrainJob(ptTrainJobStopDTO));
- }
-
- @PostMapping("/resume")
- @ApiOperation("恢复训练任务")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody resumeTrainJob(@Validated @RequestBody PtTrainJobResumeDTO ptTrainJobResumeDTO) {
- ptTrainJobService.resumeTrainJob(ptTrainJobResumeDTO);
- return new DataResponseBody();
- }
-
- @GetMapping("/grafanaUrl/{jobId}")
- @ApiOperation("获取job在grafana监控的地址")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody getGrafanaUrl( @PathVariable Long jobId) {
- return new DataResponseBody(ptTrainJobService.getGrafanaUrl(jobId));
- }
-
- @GetMapping("/model")
- @ApiOperation("获取job使用的模型")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody getTrainJobModel(@Validated PtTrainModelDTO ptTrainModelDTO) {
- return new DataResponseBody(ptTrainJobService.getTrainJobModel(ptTrainModelDTO));
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainLogController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainLogController.java
deleted file mode 100644
index f2b28c0..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainLogController.java
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.annotation.ApiVersion;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.base.MagicNumConstant;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.dto.PtTrainLogQueryDTO;
-import org.dubhe.domain.vo.PtTrainLogQueryVO;
-import org.dubhe.factory.DataResponseFactory;
-import org.dubhe.service.PtTrainLogService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-/**
- * @description 训练日志 控制器入口
- * @date 2020-05-08
- */
-@Api(tags = "训练:训练日志")
-@RestController
-@ApiVersion(1)
-@RequestMapping("/api/{version}/trainLog")
-public class PtTrainLogController {
-
- @Autowired
- private PtTrainLogService ptTrainLogService;
-
- @GetMapping
- @ApiOperation("训练日志查询")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody getTrainLog(@Validated PtTrainLogQueryDTO ptTrainLogQueryDTO) {
- return new DataResponseBody(ptTrainLogService.queryTrainLog(ptTrainLogQueryDTO));
- }
-
- @GetMapping("/download")
- @ApiOperation("训练日志下载")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody downLoadTrainLog(@Validated PtTrainLogQueryDTO ptTrainLogQueryDTO) {
-
- ptTrainLogQueryDTO.setStartLine(MagicNumConstant.ONE).setLines(MagicNumConstant.MILLION);
-
- PtTrainLogQueryVO ptTrainLogQueryVO = ptTrainLogService.queryTrainLog(ptTrainLogQueryDTO);
- return new DataResponseBody(ptTrainLogService.getTrainLogString(ptTrainLogQueryVO.getContent()));
- }
-
- @GetMapping("/pod/{id}")
- @ApiOperation("获取pod节点")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody getPods(@PathVariable Long id) {
- return DataResponseFactory.success(ptTrainLogService.getPods(id));
- }
-
-
-
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainParamController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainParamController.java
deleted file mode 100644
index 05790fb..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtTrainParamController.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.annotation.ApiVersion;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.dto.PtTrainParamCreateDTO;
-import org.dubhe.domain.dto.PtTrainParamDeleteDTO;
-import org.dubhe.domain.dto.PtTrainParamQueryDTO;
-import org.dubhe.domain.dto.PtTrainParamUpdateDTO;
-import org.dubhe.service.PtTrainParamService;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.*;
-
-/**
- * @description 任务参数
- * @date 2020-04-27
- */
-@Api(tags = "训练:任务参数管理")
-@RestController
-@ApiVersion(1)
-@RequestMapping("/api/{version}/trainParams")
-public class PtTrainParamController {
-
- @Autowired
- private PtTrainParamService ptTrainParamService;
-
- @GetMapping
- @ApiOperation("任务参数列表展示")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody getTrainParam(@Validated PtTrainParamQueryDTO ptTrainParamQueryDTO) {
- return new DataResponseBody(ptTrainParamService.getTrainParam(ptTrainParamQueryDTO));
- }
-
- @PostMapping
- @ApiOperation("保存任务参数")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody createTrainParam(@Validated @RequestBody PtTrainParamCreateDTO ptTrainParamCreateDTO) {
- return new DataResponseBody(ptTrainParamService.createTrainParam(ptTrainParamCreateDTO));
- }
-
- @PutMapping
- @ApiOperation("修改任务参数")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody updateTrainParam(@Validated @RequestBody PtTrainParamUpdateDTO ptTrainParamUpdateDTO) {
- return new DataResponseBody(ptTrainParamService.updateTrainParam(ptTrainParamUpdateDTO));
- }
-
- @DeleteMapping
- @ApiOperation("删除任务参数")
- @RequiresPermissions(Permissions.TRAINING_JOB)
- public DataResponseBody deleteTrainParam(@Validated @RequestBody PtTrainParamDeleteDTO ptTrainParamDeleteDTO) {
- ptTrainParamService.deleteTrainParam(ptTrainParamDeleteDTO);
- return new DataResponseBody();
- }
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ServingController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ServingController.java
deleted file mode 100644
index 09baeae..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/ServingController.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/**
- * 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.rest;
-
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import org.apache.shiro.authz.annotation.RequiresPermissions;
-import org.dubhe.base.DataResponseBody;
-import org.dubhe.constant.Permissions;
-import org.dubhe.domain.dto.PredictParamDTO;
-import org.dubhe.domain.dto.ServingInfoCreateDTO;
-import org.dubhe.domain.dto.ServingInfoDeleteDTO;
-import org.dubhe.domain.dto.ServingInfoDetailDTO;
-import org.dubhe.domain.dto.ServingInfoQueryDTO;
-import org.dubhe.domain.dto.ServingInfoUpdateDTO;
-import org.dubhe.domain.dto.ServingStartDTO;
-import org.dubhe.domain.dto.ServingStopDTO;
-import org.dubhe.service.ServingService;
-import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.DeleteMapping;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-import org.springframework.web.bind.annotation.RequestBody;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-import org.springframework.web.multipart.MultipartFile;
-
-import javax.annotation.Resource;
-
-/**
- * @description 在线服务管理
- * @date 2020-08-24
- */
-@Api(tags = "云端Serving:在线服务管理")
-@RestController
-@RequestMapping("/api/serving")
-public class ServingController {
-
- @Resource
- private ServingService servingService;
-
- @ApiOperation("查询服务")
- @GetMapping
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody query(ServingInfoQueryDTO servingInfoQueryDTO) {
- return new DataResponseBody(servingService.query(servingInfoQueryDTO));
- }
-
- @ApiOperation("创建服务")
- @PostMapping
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody create(@Validated @RequestBody ServingInfoCreateDTO servingInfoCreateDTO) {
- return new DataResponseBody(servingService.create(servingInfoCreateDTO));
- }
-
- @ApiOperation("修改服务")
- @PutMapping
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody update(@Validated @RequestBody ServingInfoUpdateDTO servingInfoUpdateDTO) {
- return new DataResponseBody(servingService.update(servingInfoUpdateDTO));
- }
-
- @ApiOperation("删除服务")
- @DeleteMapping
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody delete(@Validated @RequestBody ServingInfoDeleteDTO servingInfoDeleteDTO) {
- return new DataResponseBody(servingService.delete(servingInfoDeleteDTO));
- }
-
- @ApiOperation("获取服务详情")
- @GetMapping("/detail")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody getDetail(@Validated ServingInfoDetailDTO servingInfoDetailDTO) {
- return new DataResponseBody(servingService.getDetail(servingInfoDetailDTO));
- }
-
- @ApiOperation("启动服务")
- @PostMapping("/start")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody start(@Validated @RequestBody ServingStartDTO servingStartDTO) {
- return new DataResponseBody(servingService.start(servingStartDTO));
- }
-
- @ApiOperation("停止服务")
- @PostMapping("/stop")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody stop(@Validated @RequestBody ServingStopDTO servingStopDTO) {
- return new DataResponseBody(servingService.stop(servingStopDTO));
- }
-
- @ApiOperation("获取接口参数")
- @GetMapping("/predictParam")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody getPredictParam(@Validated PredictParamDTO predictParamDTO) {
- return new DataResponseBody(servingService.getPredictParam(predictParamDTO));
- }
-
- @GetMapping("/servingConfig/pod/{modelConfigId}")
- @ApiOperation("获取modelConfigId下pod信息")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody getServingLog(@PathVariable Long modelConfigId) {
- return new DataResponseBody(servingService.getPods(modelConfigId));
- }
-
- @PostMapping("/predict")
- @ApiOperation("预测")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody predict(MultipartFile[] files, Long id, String url) {
- return new DataResponseBody(servingService.predict(id, url, files));
- }
-
- @GetMapping("/metrics/{servingId}")
- @ApiOperation("获取服务的监控信息")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody getServingMetrics(@PathVariable Long servingId) {
- return new DataResponseBody(servingService.getMetricsDetail(servingId));
- }
-
- @GetMapping("/rollback/{servingId}")
- @ApiOperation("获取回滚列表")
- @RequiresPermissions(Permissions.SERVING_DEPLOYMENT)
- public DataResponseBody getRollbackList(@PathVariable Long servingId) {
- return new DataResponseBody(servingService.getRollbackList(servingId));
- }
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/BatchServingService.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/BatchServingService.java
deleted file mode 100644
index cef17c0..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/BatchServingService.java
+++ /dev/null
@@ -1,113 +0,0 @@
-/**
- * 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.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import org.dubhe.domain.dto.*;
-import org.dubhe.domain.entity.BatchServing;
-import org.dubhe.domain.vo.*;
-import org.dubhe.dto.callback.BatchServingK8sPodCallbackCreateDTO;
-import org.dubhe.k8s.domain.vo.PodVO;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @description 批量服务管理
- * @date 2020-08-26
- */
-public interface BatchServingService extends IService {
-
- /**
- * 批量服务查询
- *
- * @param batchServingQueryDTO 批量服务查询参数
- * @return Map 批量服务查询返回分页对象
- */
- Map query(BatchServingQueryDTO batchServingQueryDTO);
-
- /**
- * 创建批量服务
- *
- * @param batchServingCreateDTO 批量服务创建参数
- * @return BatchServingCreateVO 批量服务创建返回结果
- */
- BatchServingCreateVO create(BatchServingCreateDTO batchServingCreateDTO);
-
- /**
- * 修改批量服务
- *
- * @param batchServingUpdateDTO 批量服务修改参数
- * @return BatchServingUpdateVO 批量服务修改返回结果
- */
- BatchServingUpdateVO update(BatchServingUpdateDTO batchServingUpdateDTO);
-
- /**
- * 删除批量服务
- *
- * @param batchServingDeleteDTO 批量服务删除参数
- * @return BatchServingDeleteVO 批量服务删除返回结果
- */
- BatchServingDeleteVO delete(BatchServingDeleteDTO batchServingDeleteDTO);
-
- /**
- * 启动批量服务
- *
- * @param batchServingStartDTO 批量服务启动参数
- * @return BatchServingStartVO 批量服务启动返回结果
- */
- BatchServingStartVO start(BatchServingStartDTO batchServingStartDTO);
-
- /**
- * 停止批量服务
- *
- * @param batchServingStopDTO 批量服务停止参数
- * @return BatchServingStopVO 批量服务停止返回结果
- */
- BatchServingStopVO stop(BatchServingStopDTO batchServingStopDTO);
-
- /**
- * 获取批量服务详情
- *
- * @param batchServingDetailDTO 批量服务详情参数
- * @return BatchServingDetailVO 批量服务详情返回结果
- */
- BatchServingDetailVO getDetail(BatchServingDetailDTO batchServingDetailDTO);
-
- /**
- * k8s回调批量服务状态
- *
- * @param times 回调请求次数
- * @param req 回调请求对象
- * @return boolean 返回回调结果
- */
- boolean batchServingCallback(int times, BatchServingK8sPodCallbackCreateDTO req);
-
- /**
- * @param id 服务配置id
- * @return List 服务配下的pod信息
- */
- List getPods(Long id);
-
- /**
- * 轮询返回状态及进度
- * @param id 批量服务id
- * @return BatchServingQueryVO 返回查询结果
- */
- BatchServingQueryVO queryStatusAndProgress(Long id);
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/DeploymentCallbackAsyncService.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/DeploymentCallbackAsyncService.java
deleted file mode 100644
index d302512..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/DeploymentCallbackAsyncService.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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.service;
-
-import org.dubhe.dto.callback.BaseK8sDeploymentCallbackCreateDTO;
-import org.springframework.scheduling.annotation.Async;
-
-/**
- * @description deployment 异步回调
- * @date 2020-11-27
- */
-public interface DeploymentCallbackAsyncService {
-
- /**
- * deployment 异步回调
- * @param k8sDeploymentCallbackCreateDTO
- */
- @Async
- void deploymentCallBack (R k8sDeploymentCallbackCreateDTO);
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/ModelOptTaskInstanceService.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/ModelOptTaskInstanceService.java
deleted file mode 100644
index 0b6de2f..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/ModelOptTaskInstanceService.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/**
- * 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.service;
-
-import org.dubhe.domain.dto.ModelOptTaskInstanceCancelDTO;
-import org.dubhe.domain.dto.ModelOptTaskInstanceDeleteDTO;
-import org.dubhe.domain.dto.ModelOptTaskInstanceDetailDTO;
-import org.dubhe.domain.dto.ModelOptTaskInstanceQueryDTO;
-import org.dubhe.domain.dto.ModelOptTaskInstanceResubmitDTO;
-import org.dubhe.domain.entity.ModelOptTaskInstance;
-import org.dubhe.domain.vo.ModelOptTaskInstanceQueryVO;
-import org.dubhe.dto.callback.ModelOptK8sPodCallbackCreateDTO;
-
-import java.util.Map;
-
-/**
- * @description 模型优化任务实例
- * @date 2020-05-22
- */
-public interface ModelOptTaskInstanceService {
- /**
- * 分页查询任务执行记录实例列表
- *
- * @param instanceQueryDTO 模型优化实例查询参数包装类
- * @return Map 分页对象
- */
- Map queryAll(ModelOptTaskInstanceQueryDTO instanceQueryDTO);
-
- /**
- * 新增任务实例
- *
- * @param modelOptTaskInstance 模型优化实例对象
- */
- void create(ModelOptTaskInstance modelOptTaskInstance);
-
- /**
- * 重新提交任务实例
- *
- * @param resubmitDTO 重新提交任务实例参数
- */
- void resubmit(ModelOptTaskInstanceResubmitDTO resubmitDTO);
-
- /**
- * 取消模型优化任务
- *
- * @param cancelDTO 取消模型优化任务参数
- */
- void cancel(ModelOptTaskInstanceCancelDTO cancelDTO);
-
- /**
- * 查看单个任务实例详情
- *
- * @param detailDTO 查看任务实例详情参数
- * @return ModelOptTaskInstanceVO 任务实例对象
- */
- ModelOptTaskInstanceQueryVO getInstDetail(ModelOptTaskInstanceDetailDTO detailDTO);
-
- /**
- * k8s回调模型优化方法
- *
- * @param req 模型优化自定义回调参数类
- * @return 返回回调状态
- */
- boolean modelOptCallBack(ModelOptK8sPodCallbackCreateDTO req);
-
- /**
- * 查询K8S并同步相关实例状态
- */
- void syncInstanceStatus();
-
- /**
- * 校验该任务是否存在进行中和等待中的实例
- *
- * @param taskId 任务ID
- * @return Boolean 是否存在进行中和等待中的实例
- */
- Boolean checkUnfinishedInst(Long taskId);
-
- /**
- * 根据任务id删除实例
- *
- * @param taskId 任务id
- * @return Integer 删除实例数量
- */
- int deleteByTaskId(Long taskId);
-
- /**
- * 删除任务实例
- *
- * @param modelOptTaskInstanceDeleteDTO
- */
- void delete(ModelOptTaskInstanceDeleteDTO modelOptTaskInstanceDeleteDTO);
-
-}
diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/ModelOptTaskService.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/ModelOptTaskService.java
deleted file mode 100644
index 8257dbf..0000000
--- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/ModelOptTaskService.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/**
- * 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.service;
-
-import org.dubhe.domain.dto.ModelOptDatasetCreateDTO;
-import org.dubhe.domain.dto.ModelOptTaskCreateDTO;
-import org.dubhe.domain.dto.ModelOptTaskDeleteDTO;
-import org.dubhe.domain.dto.ModelOptTaskQueryDTO;
-import org.dubhe.domain.dto.ModelOptTaskSubmitDTO;
-import org.dubhe.domain.dto.ModelOptTaskUpdateDTO;
-import org.dubhe.domain.vo.ModelOptAlgorithmQueryVO;
-import org.dubhe.domain.vo.ModelOptCreateVO;
-import org.dubhe.domain.vo.ModelOptDatasetQueryVO;
-import org.dubhe.domain.vo.ModelOptDatasetVO;
-import org.dubhe.domain.vo.ModelOptModelQueryVO;
-import org.dubhe.domain.vo.ModelOptUpdateVO;
-
-import java.util.List;
-import java.util.Map;
-
-/**
- * @description 模型优化任务
- * @date 2020-05-22
- */
-public interface ModelOptTaskService {
-
- /**
- * 查询数据分页
- *
- * @param modelOptTaskQueryDTO 模型优化任务查询参数
- * @return Map 模型优化任务分页对象
- */
- Map queryAll(ModelOptTaskQueryDTO modelOptTaskQueryDTO);
-
- /**
- * 创建模型优化任务
- *
- * @param modelOptTaskCreateDTO 模型优化任务创建对象
- */
- ModelOptCreateVO create(ModelOptTaskCreateDTO modelOptTaskCreateDTO);
-
- /**
- * 提交模型优化任务,创建任务实例
- *
- * @param submitDTO 任务提交参数
- */
- void submit(ModelOptTaskSubmitDTO submitDTO);
-
- /**
- * 修改模型优化任务
- *
- * @param modelOptTaskUpdateDTO 模型优化任务修改对象
- */
- ModelOptUpdateVO update(ModelOptTaskUpdateDTO modelOptTaskUpdateDTO);
-
- /**
- * 删除模型优化任务
- *
- * @param modelOptTaskDeleteDTO 模型优化任务删除参数
- */
- void delete(ModelOptTaskDeleteDTO modelOptTaskDeleteDTO);
-
- /**
- * 获取内置模型
- *
- * @param type 算法类型
- * @param dataset 数据集
- * @param algorithm 训练算法
- * @return List