From 30e2a4ad37bc678b225b70c188416761fcc5a8dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B9=8B=E6=B1=9F=E5=AE=9E=E9=AA=8C=E5=AE=A4?= Date: Tue, 17 Nov 2020 10:25:24 +0800 Subject: [PATCH] update dubhe-server --- .../src/main/java/org/dubhe/aspect/LogAspect.java | 4 +- .../src/main/java/org/dubhe/enums/LogEnum.java | 6 +- .../main/java/org/dubhe/filter/BaseLogFilter.java | 5 + .../src/main/java/org/dubhe/utils/JwtUtils.java | 2 +- .../main/java/org/dubhe/dao/PtDatasetMapper.java | 28 ----- .../main/java/org/dubhe/dao/PtDevEnvsMapper.java | 29 ----- .../main/java/org/dubhe/dao/PtStorageMapper.java | 28 ----- .../src/main/java/org/dubhe/domain/PtDataset.java | 71 ------------ .../src/main/java/org/dubhe/domain/PtDevEnvs.java | 114 ------------------- .../src/main/java/org/dubhe/domain/PtStorage.java | 69 ------------ .../dubhe/domain/dto/PtDatasetQueryCriteria.java | 28 ----- .../java/org/dubhe/domain/dto/PtStorageDTO.java | 41 ------- .../dubhe/domain/dto/PtStorageQueryCriteria.java | 28 ----- .../org/dubhe/domain/dto/PtTrainJobCreateDTO.java | 3 +- .../java/org/dubhe/rest/PtDatasetController.java | 89 --------------- .../java/org/dubhe/rest/PtDevEnvsController.java | 88 --------------- .../java/org/dubhe/rest/PtStorageController.java | 87 --------------- .../java/org/dubhe/rest/PtTrainJobController.java | 7 ++ .../java/org/dubhe/service/PtDatasetService.java | 91 --------------- .../java/org/dubhe/service/PtDevEnvsService.java | 91 --------------- .../java/org/dubhe/service/PtStorageService.java | 92 --------------- .../service/abstracts/AbstractPodCallback.java | 4 +- .../dubhe/service/convert/PtDatasetConvert.java | 33 ------ .../dubhe/service/convert/PtDevEnvsConvert.java | 34 ------ .../org/dubhe/service/convert/PtImageConvert.java | 34 ------ .../dubhe/service/convert/PtStorageConvert.java | 33 ------ .../dubhe/service/convert/PtTrainJobConvert.java | 34 ------ .../service/impl/NoteBookAsyncServiceImpl.java | 2 +- .../dubhe/service/impl/NoteBookServiceImpl.java | 10 +- .../dubhe/service/impl/PtDatasetServiceImpl.java | 121 -------------------- .../dubhe/service/impl/PtDevEnvsServiceImpl.java | 123 --------------------- .../org/dubhe/service/impl/PtImageServiceImpl.java | 2 +- .../dubhe/service/impl/PtStorageServiceImpl.java | 122 -------------------- .../src/main/resources/config/application-dev.yml | 35 +++--- .../src/main/resources/config/application.yml | 26 +++-- .../dubhe-admin/src/main/resources/kubeconfig-prod | 19 ---- .../src/test/java/org/dubhe/BaseTest.java | 4 +- .../machine/statemachine/GlobalStateMachine.java | 2 +- .../data/service/impl/DatasetServiceImpl.java | 14 +-- .../dubhe/data/service/impl/LabelServiceImpl.java | 9 +- .../org/dubhe/harbor/api/impl/HarborApiImpl.java | 2 +- .../dubhe/k8s/api/impl/JupyterResourceApiImpl.java | 6 +- .../org/dubhe/k8s/api/impl/TrainJobApiImpl.java | 1 - .../java/org/dubhe/k8s/domain/bo/K8sTaskBO.java | 19 ---- .../java/org/dubhe/k8s/domain/entity/K8sTask.java | 9 ++ .../org/dubhe/k8s/event/watcher/PodWatcher.java | 2 +- .../org/dubhe/k8s/observer/TrainJobObserver.java | 2 +- .../java/org/dubhe/service/RecycleTaskService.java | 3 +- .../dubhe/service/impl/RecycleTaskServiceImpl.java | 51 +++++---- .../src/test/java/org/dubhe/BaseTest.java | 4 +- .../org/dubhe/task/k8s/DelayCudResourceTask.java | 5 + .../src/main/resources/config/application-dev.yml | 41 +++---- .../src/main/resources/config/application.yml | 56 +++++++--- dubhe-server/sql/v1/09-Dubhe-Patch.sql | 2 +- 54 files changed, 189 insertions(+), 1676 deletions(-) delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtDatasetMapper.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtDevEnvsMapper.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtStorageMapper.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtDataset.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtDevEnvs.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtStorage.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetQueryCriteria.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageDTO.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageQueryCriteria.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtDatasetController.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtDevEnvsController.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtStorageController.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtDatasetService.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtDevEnvsService.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtStorageService.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtDatasetConvert.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtDevEnvsConvert.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtImageConvert.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtStorageConvert.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtTrainJobConvert.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtDatasetServiceImpl.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtDevEnvsServiceImpl.java delete mode 100644 dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtStorageServiceImpl.java delete mode 100644 dubhe-server/dubhe-admin/src/main/resources/kubeconfig-prod 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 index 71e3c77..172eae2 100755 --- a/dubhe-server/common/src/main/java/org/dubhe/aspect/LogAspect.java +++ b/dubhe-server/common/src/main/java/org/dubhe/aspect/LogAspect.java @@ -75,11 +75,11 @@ public class LogAspect { private Object combineLogInfo(JoinPoint joinPoint) throws Throwable { Object[] param = joinPoint.getArgs(); - LogUtil.info(LogEnum.REST_REQ, "uri:{},input:{},==>begin", joinPoint.getSignature(), param); + 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.REST_REQ, "uri:{},output:{},proc_time:{},<==end", joinPoint.getSignature().toString(), + 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/enums/LogEnum.java b/dubhe-server/common/src/main/java/org/dubhe/enums/LogEnum.java index 8fbd401..603f590 100644 --- a/dubhe-server/common/src/main/java/org/dubhe/enums/LogEnum.java +++ b/dubhe-server/common/src/main/java/org/dubhe/enums/LogEnum.java @@ -59,8 +59,10 @@ public enum LogEnum { //DATA_SEQUENCE DATA_SEQUENCE, //IO UTIL - IO_UTIL; - + IO_UTIL, + // 日志切面 + LOG_ASPECT + ; /** * 判断日志类型不能为空 * 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 index 3b83331..50c7bc5 100644 --- a/dubhe-server/common/src/main/java/org/dubhe/filter/BaseLogFilter.java +++ b/dubhe-server/common/src/main/java/org/dubhe/filter/BaseLogFilter.java @@ -55,6 +55,11 @@ public class BaseLogFilter extends AbstractMatcherFilter { return onMismatch; } + /** + * 检测日志级别 + * @param iLoggingEvent 日志事件 + * @return true 过滤当前级别 false 不过滤当前级别 + */ protected boolean checkLevel(ILoggingEvent iLoggingEvent) { return this.level != null && iLoggingEvent.getLevel() != null 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 index afaaed5..fedd799 100644 --- a/dubhe-server/common/src/main/java/org/dubhe/utils/JwtUtils.java +++ b/dubhe-server/common/src/main/java/org/dubhe/utils/JwtUtils.java @@ -41,7 +41,7 @@ import java.util.Objects; import java.util.concurrent.TimeUnit; /** - * @description JWT + * @description JWT * @date 2020-03-14 */ @Component diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtDatasetMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtDatasetMapper.java deleted file mode 100644 index 8154436..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtDatasetMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.PtDataset; - -/** - * @description 数据集 - * @date 2020-03-30 - */ -public interface PtDatasetMapper extends BaseMapper { -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtDevEnvsMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtDevEnvsMapper.java deleted file mode 100644 index 272f17b..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtDevEnvsMapper.java +++ /dev/null @@ -1,29 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.PtDevEnvs; - -/** - * @description 开发环境 - * @date 2020-03-30 - */ -public interface PtDevEnvsMapper extends BaseMapper { - -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtStorageMapper.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtStorageMapper.java deleted file mode 100644 index a7b4596..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/dao/PtStorageMapper.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.PtStorage; - -/** - * @description 存储管理 - * @date 2020-03-30 - */ -public interface PtStorageMapper extends BaseMapper { -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtDataset.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtDataset.java deleted file mode 100644 index 4cee51f..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtDataset.java +++ /dev/null @@ -1,71 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -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; -import org.dubhe.domain.entity.Team; -import org.dubhe.domain.entity.User; - -import javax.validation.constraints.NotBlank; - -/** - * @description 数据集 - * @date 2020-03-17 - */ -@Data -@TableName("pt_dataset") -public class PtDataset extends BaseEntity { - - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @TableField(value = "name") - @NotBlank - private String name; - - @TableField(value = "remark") - private String remark; - - @TableField(value = "type") - @NotBlank - private String type; - /** - * 团队 - */ - @TableField(exist = false) - private Team team; - /** - * 创建用户 - */ - @TableField(exist = false) - private User createUser; - - public void copy(PtDataset source) { - BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); - } - - public @interface Update { - } -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtDevEnvs.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtDevEnvs.java deleted file mode 100644 index 776bf9f..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtDevEnvs.java +++ /dev/null @@ -1,114 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -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; -import org.dubhe.domain.entity.PtImage; -import org.dubhe.domain.entity.Team; -import org.dubhe.domain.entity.User; - -import javax.validation.constraints.NotBlank; -import java.sql.Timestamp; - -/** - * @description 开发环境 - * @date 2020-03-17 - */ - -@Data -@TableName("pt_dev_envs") -public class PtDevEnvs extends BaseEntity { - @TableId(value = "id", type = IdType.AUTO) - private Long id; - - @NotBlank - private String name; - - @TableField(value = "remark") - private String remark; - - @TableField(value = "type") - @NotBlank - private String type; - - @TableField(value = "pod_num") - private Integer podNum; - - @TableField(value = "gpu_num") - private Integer gpuNum; - - @TableField(value = "mem_num") - private Integer memNum; - - @TableField(value = "cpu_num") - private Integer cpuNum; - - @TableField(value = "duration") - private Integer duration; - - @TableField(value = "start_time") - private Timestamp startTime; - - @TableField(value = "close_time") - private Timestamp closeTime; - - /** - * 数据集 - */ - @TableField(exist = false) - private PtDataset dataset; - - /** - * 镜像 - */ - @TableField(exist = false) - private PtImage image; - - /** - * 存储 - */ - @TableField(exist = false) - private PtStorage storage; - - /** - * 团队 - */ - @TableField(exist = false) - private Team team; - - /** - * 创建用户 - */ - @TableField(exist = false) - private User createUser; - - - public void copy(PtDevEnvs source) { - BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); - } - - public @interface Update { - } -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtStorage.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtStorage.java deleted file mode 100644 index 75a41fd..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/PtStorage.java +++ /dev/null @@ -1,69 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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; - -import cn.hutool.core.bean.BeanUtil; -import cn.hutool.core.bean.copier.CopyOptions; -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; -import org.dubhe.domain.entity.Team; -import org.dubhe.domain.entity.User; - -import javax.validation.constraints.NotBlank; -import javax.validation.constraints.NotNull; - -/** - * @description 存储 - * @date 2020-03-17 - */ -@Data -@TableName("pt_storage") -public class PtStorage extends BaseEntity { - @TableId(value = "id", type = IdType.AUTO) - @NotNull(groups = {Update.class}) - private Long id; - - @TableField(value = "name") - @NotBlank - private String name; - - @TableField(value = "size") - private Integer size; - - @TableField(value = "storageclass") - @NotBlank - private String storageclass; - - @TableField(exist = false) - private Team team; - - @TableField(exist = false) - private User createUser; - - - public void copy(PtStorage source) { - BeanUtil.copyProperties(source, this, CopyOptions.create().setIgnoreNullValue(true)); - } - - public @interface Update { - } -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetQueryCriteria.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetQueryCriteria.java deleted file mode 100644 index d15dd2a..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtDatasetQueryCriteria.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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 PtDatasetQueryCriteria { -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageDTO.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageDTO.java deleted file mode 100644 index 8354adc..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageDTO.java +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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 PtStorageDTO implements Serializable { - - private Long id; - private String name; - private Integer size; - private String storageclass; - 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/PtStorageQueryCriteria.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageQueryCriteria.java deleted file mode 100644 index 4f5528a..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/domain/dto/PtStorageQueryCriteria.java +++ /dev/null @@ -1,28 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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 PtStorageQueryCriteria { -} 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 index 7ccc0b6..cabc883 100644 --- 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 @@ -103,8 +103,7 @@ public class PtTrainJobCreateDTO extends BaseImageDTO { private Integer trainType; @ApiModelProperty(value = "节点个数", required = true) - @Min(value = TrainUtil.NUMBER_ONE, message = "节点个数在1~8之间") - @Max(value = TrainUtil.NUMBER_EIGHT, message = "节点个数在1~8之间") + @Min(value = TrainUtil.NUMBER_ONE, message = "节点个数至少1个") @NotNull(message = "节点个数") private Integer resourcesPoolNode; diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtDatasetController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtDatasetController.java deleted file mode 100644 index 486e34c..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtDatasetController.java +++ /dev/null @@ -1,89 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.Api; -import io.swagger.annotations.ApiOperation; -import org.dubhe.base.DataResponseBody; -import org.dubhe.domain.PtDataset; -import org.dubhe.domain.dto.PtDatasetQueryCriteria; -import org.dubhe.service.PtDatasetService; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * @description dataset管理 - * @date 2020-03-17 - */ -@Api(tags = "dataset管理") -@ApiIgnore -@RestController -@RequestMapping("/api/{version}/pt_dataset") -public class PtDatasetController { - - private final PtDatasetService ptDatasetService; - - public PtDatasetController(PtDatasetService ptDatasetService) { - this.ptDatasetService = ptDatasetService; - } - - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('ptDataset:list')") - public void download(HttpServletResponse response, PtDatasetQueryCriteria criteria) throws IOException { - ptDatasetService.download(ptDatasetService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询dataset") - @PreAuthorize("@el.check('ptDataset:list')") - public DataResponseBody getPtDatasets(PtDatasetQueryCriteria criteria, Page page) { - return new DataResponseBody(ptDatasetService.queryAll(criteria, page)); - } - - @PostMapping - @ApiOperation("新增dataset") - @PreAuthorize("@el.check('ptDataset:add')") - public DataResponseBody create(@Validated @RequestBody PtDataset resources) { - return new DataResponseBody(ptDatasetService.create(resources)); - } - - @PutMapping - @ApiOperation("修改dataset") - @PreAuthorize("@el.check('ptDataset:edit')") - public DataResponseBody update(@Validated @RequestBody PtDataset resources) { - ptDatasetService.update(resources); - return new DataResponseBody(); - } - - @ApiOperation("删除dataset") - @PreAuthorize("@el.check('ptDataset:del')") - @DeleteMapping - public DataResponseBody deleteAll(@RequestBody Long[] ids) { - ptDatasetService.deleteAll(ids); - return new DataResponseBody(); - } -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtDevEnvsController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtDevEnvsController.java deleted file mode 100644 index 620d167..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtDevEnvsController.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.Api; -import io.swagger.annotations.ApiOperation; -import org.dubhe.base.DataResponseBody; -import org.dubhe.domain.PtDevEnvs; -import org.dubhe.domain.dto.PtDevEnvsQueryCriteria; -import org.dubhe.service.PtDevEnvsService; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * @description devEnvs管理 - * @date 2020-03-17 - */ -@Api(tags = "devEnvs管理") -@ApiIgnore -@RestController -@RequestMapping("/api/{version}/pt_ev_envs") -public class PtDevEnvsController { - - private final PtDevEnvsService ptDevEnvsService; - - public PtDevEnvsController(PtDevEnvsService ptDevEnvsService) { - this.ptDevEnvsService = ptDevEnvsService; - } - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('ptDevEnvs:list')") - public void download(HttpServletResponse response, PtDevEnvsQueryCriteria criteria) throws IOException { - ptDevEnvsService.download(ptDevEnvsService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询devEnvs") - @PreAuthorize("@el.check('ptDevEnvs:list')") - public DataResponseBody getPtDevEnvss(PtDevEnvsQueryCriteria criteria, Page page) { - return new DataResponseBody(ptDevEnvsService.queryAll(criteria, page)); - } - - @PostMapping - @ApiOperation("新增devEnvs") - @PreAuthorize("@el.check('ptDevEnvs:add')") - public DataResponseBody create(@Validated @RequestBody PtDevEnvs resources) { - return new DataResponseBody(ptDevEnvsService.create(resources)); - } - - @PutMapping - @ApiOperation("修改devEnvs") - @PreAuthorize("@el.check('ptDevEnvs:edit')") - public DataResponseBody update(@Validated @RequestBody PtDevEnvs resources) { - ptDevEnvsService.update(resources); - return new DataResponseBody(); - } - - @ApiOperation("删除devEnvs") - @PreAuthorize("@el.check('ptDevEnvs:del')") - @DeleteMapping - public DataResponseBody deleteAll(@RequestBody Long[] ids) { - ptDevEnvsService.deleteAll(ids); - return new DataResponseBody(); - } -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtStorageController.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtStorageController.java deleted file mode 100644 index 408e28a..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/rest/PtStorageController.java +++ /dev/null @@ -1,87 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.Api; -import io.swagger.annotations.ApiOperation; -import org.dubhe.base.DataResponseBody; -import org.dubhe.domain.PtStorage; -import org.dubhe.domain.dto.PtStorageQueryCriteria; -import org.dubhe.service.PtStorageService; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.validation.annotation.Validated; -import org.springframework.web.bind.annotation.*; -import springfox.documentation.annotations.ApiIgnore; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -/** - * @description storage管理 - * @date 2020-03-17 - */ -@Api(tags = "storage管理") -@ApiIgnore -@RestController -@RequestMapping("/api/{version}/pt_storage") -public class PtStorageController { - - private final PtStorageService ptStorageService; - - public PtStorageController(PtStorageService ptStorageService) { - this.ptStorageService = ptStorageService; - } - - @ApiOperation("导出数据") - @GetMapping(value = "/download") - @PreAuthorize("@el.check('ptStorage:list')") - public void download(HttpServletResponse response, PtStorageQueryCriteria criteria) throws IOException { - ptStorageService.download(ptStorageService.queryAll(criteria), response); - } - - @GetMapping - @ApiOperation("查询storage") - @PreAuthorize("@el.check('ptStorage:list')") - public DataResponseBody getPtStorages(PtStorageQueryCriteria criteria, Page page) { - return new DataResponseBody(ptStorageService.queryAll(criteria, page)); - } - - @PostMapping - @ApiOperation("新增storage") - @PreAuthorize("@el.check('ptStorage:add')") - public DataResponseBody create(@Validated @RequestBody PtStorage resources) { - return new DataResponseBody(ptStorageService.create(resources)); - } - - @PutMapping - @ApiOperation("修改storage") - @PreAuthorize("@el.check('ptStorage:edit')") - public DataResponseBody update(@Validated @RequestBody PtStorage resources) { - ptStorageService.update(resources); - return new DataResponseBody(); - } - - @ApiOperation("删除storage") - @PreAuthorize("@el.check('ptStorage:del')") - @DeleteMapping - public DataResponseBody deleteAll(@RequestBody Long[] ids) { - ptStorageService.deleteAll(ids); - 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 index 04f025e..a6cb3c7 100644 --- 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 @@ -25,6 +25,8 @@ 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; @@ -94,6 +96,11 @@ public class PtTrainJobController { @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)); } diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtDatasetService.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtDatasetService.java deleted file mode 100644 index 2fed740..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtDatasetService.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.plugins.pagination.Page; -import org.dubhe.domain.PtDataset; -import org.dubhe.domain.dto.PtDatasetDTO; -import org.dubhe.domain.dto.PtDatasetQueryCriteria; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * @description 查询数据 - * @date 2020-03-17 - */ -public interface PtDatasetService { - - /** - * 查询数据分页 - * - * @param criteria 条件 - * @param page 分页参数 - * @return Map - */ - Map queryAll(PtDatasetQueryCriteria criteria, Page page); - - /** - * 查询所有数据不分页 - * - * @param criteria 条件参数 - * @return List - */ - List queryAll(PtDatasetQueryCriteria criteria); - - /** - * 根据ID查询 - * - * @param id ID - * @return PtDatasetDto - */ - PtDatasetDTO findById(Long id); - - /** - * 创建 - * - * @param resources / - * @return PtDatasetDto - */ - PtDatasetDTO create(PtDataset resources); - - /** - * 编辑 - * - * @param resources / - */ - void update(PtDataset resources); - - /** - * 多选删除 - * - * @param ids / - */ - void deleteAll(Long[] ids); - - /** - * 导出数据 - * - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtDevEnvsService.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtDevEnvsService.java deleted file mode 100644 index 4eaa17d..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtDevEnvsService.java +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.plugins.pagination.Page; -import org.dubhe.domain.PtDevEnvs; -import org.dubhe.domain.dto.PtDevEnvsDTO; -import org.dubhe.domain.dto.PtDevEnvsQueryCriteria; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * @description 查询数据 - * @date 2020-03-17 - */ -public interface PtDevEnvsService { - - /** - * 查询数据分页 - * - * @param criteria 条件 - * @param page 分页参数 - * @return Map - */ - Map queryAll(PtDevEnvsQueryCriteria criteria, Page page); - - /** - * 查询所有数据不分页 - * - * @param criteria 条件参数 - * @return List - */ - List queryAll(PtDevEnvsQueryCriteria criteria); - - /** - * 根据ID查询 - * - * @param id ID - * @return PtDevEnvsDto - */ - PtDevEnvsDTO findById(Long id); - - /** - * 创建 - * - * @param resources / - * @return PtDevEnvsDto - */ - PtDevEnvsDTO create(PtDevEnvs resources); - - /** - * 编辑 - * - * @param resources / - */ - void update(PtDevEnvs resources); - - /** - * 多选删除 - * - * @param ids / - */ - void deleteAll(Long[] ids); - - /** - * 导出数据 - * - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtStorageService.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtStorageService.java deleted file mode 100644 index ebbf862..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/PtStorageService.java +++ /dev/null @@ -1,92 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.plugins.pagination.Page; -import org.dubhe.domain.PtStorage; -import org.dubhe.domain.dto.PtStorageDTO; -import org.dubhe.domain.dto.PtStorageQueryCriteria; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.List; -import java.util.Map; - -/** - * @description 查询数据 - * @date 2020-03-17 - */ -public interface PtStorageService { - - /** - * 查询数据分页 - * - * @param criteria 条件 - * @param page 分页参数 - * @return Map - */ - Map queryAll(PtStorageQueryCriteria criteria, Page page); - - /** - * 查询所有数据不分页 - * - * @param criteria 条件参数 - * @return List - */ - List queryAll(PtStorageQueryCriteria criteria); - - /** - * 根据ID查询 - * - * @param id ID - * @return PtStorageDto - */ - PtStorageDTO findById(Long id); - - /** - * 创建 - * - * @param resources / - * @return PtStorageDto - */ - PtStorageDTO create(PtStorage resources); - - /** - * 编辑 - * - * @param resources / - */ - void update(PtStorage resources); - - /** - * 多选删除 - * - * @param ids / - */ - void deleteAll(Long[] ids); - - /** - * 导出数据 - * - * @param all 待导出的数据 - * @param response / - * @throws IOException / - */ - void download(List all, HttpServletResponse response) throws IOException; -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/abstracts/AbstractPodCallback.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/abstracts/AbstractPodCallback.java index 612816b..00baba8 100644 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/abstracts/AbstractPodCallback.java +++ b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/abstracts/AbstractPodCallback.java @@ -49,7 +49,7 @@ public abstract class AbstractPodCallback implements PodCallbackAsyncService { Thread.sleep(tryTime * 1000); continue; } catch (InterruptedException e) { - LogUtil.error(LogEnum.NOTE_BOOK,"AbstractPodCallback podCallBack InterruptedException", e); + LogUtil.error(LogEnum.NOTE_BOOK,"AbstractPodCallback podCallBack InterruptedException : {}", e); // Restore interrupted state...       Thread.currentThread().interrupt(); } @@ -61,7 +61,7 @@ public abstract class AbstractPodCallback implements PodCallbackAsyncService { } } - /** + /** * pod 异步回调具体实现处理类 * @param times 第n次处理 * @param k8sPodCallbackCreateDTO k8s回调实体类 diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtDatasetConvert.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtDatasetConvert.java deleted file mode 100644 index 87c986d..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtDatasetConvert.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.convert; - -import org.dubhe.base.BaseConvert; -import org.dubhe.domain.PtDataset; -import org.dubhe.domain.dto.PtDatasetDTO; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** - * @description 数据集 - * @date 2020-03-17 - */ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface PtDatasetConvert extends BaseConvert { - -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtDevEnvsConvert.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtDevEnvsConvert.java deleted file mode 100644 index 81f7688..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtDevEnvsConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.convert; - - -import org.dubhe.base.BaseConvert; -import org.dubhe.domain.PtDevEnvs; -import org.dubhe.domain.dto.PtDevEnvsDTO; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** - * @description 开发环境 - * @date 2020-03-17 - */ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface PtDevEnvsConvert extends BaseConvert { - -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtImageConvert.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtImageConvert.java deleted file mode 100644 index 8cbd6af..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtImageConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.convert; - - -import org.dubhe.base.BaseConvert; -import org.dubhe.domain.entity.PtImage; -import org.dubhe.domain.dto.PtImageDTO; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** - * @description 镜像 - * @date 2020-03-17 - */ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface PtImageConvert extends BaseConvert { - -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtStorageConvert.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtStorageConvert.java deleted file mode 100644 index 4b39370..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtStorageConvert.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.convert; - - -import org.dubhe.base.BaseConvert; -import org.dubhe.domain.PtStorage; -import org.dubhe.domain.dto.PtStorageDTO; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** - * @description 存储类转化 - * @date 2020-03-17 - */ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface PtStorageConvert extends BaseConvert { -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtTrainJobConvert.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtTrainJobConvert.java deleted file mode 100644 index 433c3af..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/convert/PtTrainJobConvert.java +++ /dev/null @@ -1,34 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.convert; - - -import org.dubhe.base.BaseConvert; -import org.dubhe.domain.entity.PtTrainJob; -import org.dubhe.domain.dto.PtTrainJobDTO; -import org.mapstruct.Mapper; -import org.mapstruct.ReportingPolicy; - -/** - * @description 训练任务转化 - * @date 2020-03-17 - */ -@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE) -public interface PtTrainJobConvert extends BaseConvert { - -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/NoteBookAsyncServiceImpl.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/NoteBookAsyncServiceImpl.java index 146c63b..03cf7ad 100644 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/NoteBookAsyncServiceImpl.java +++ b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/NoteBookAsyncServiceImpl.java @@ -65,7 +65,7 @@ public class NoteBookAsyncServiceImpl extends AbstractPodCallback implements Pod noteBookService.updateById(notebook); return true; } catch (Exception e) { - LogUtil.error(LogEnum.NOTE_BOOK, "NoteBook doCallback error!", e); + LogUtil.error(LogEnum.NOTE_BOOK, "NoteBook doCallback error!{}", e); return false; } } diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/NoteBookServiceImpl.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/NoteBookServiceImpl.java index 3a7043e..323168c 100644 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/NoteBookServiceImpl.java +++ b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/NoteBookServiceImpl.java @@ -222,7 +222,7 @@ public class NoteBookServiceImpl implements NoteBookService { return (HttpUtils.isSuccess(result.getCode()) || K8sResponseEnum.EXISTS.getCode().equals(result.getCode())); } catch (Exception e) { - LogUtil.error(LogEnum.NOTE_BOOK, "createNoteBook调用jupyterResourceApi.createWithPvc异常!", e); + LogUtil.error(LogEnum.NOTE_BOOK, "createNoteBook调用jupyterResourceApi.createWithPvc异常!{}", e); noteBook.setK8sStatusCode(BLANK); noteBook.setK8sStatusInfo(NotebookUtil.getK8sStatusInfo(e)); return false; @@ -305,7 +305,7 @@ public class NoteBookServiceImpl implements NoteBookService { returnStr = "删除失败"; } } catch (Exception e) { - LogUtil.error(LogEnum.NOTE_BOOK, "deleteNoteBook调用jupyterResourceApi.delete异常!", e); + LogUtil.error(LogEnum.NOTE_BOOK, "deleteNoteBook调用jupyterResourceApi.delete异常!{}", e); noteBook.setK8sStatusCode(BLANK); noteBook.setK8sStatusInfo(NotebookUtil.getK8sStatusInfo(e)); returnStr = "删除失败"; @@ -392,7 +392,7 @@ public class NoteBookServiceImpl implements NoteBookService { noteBook.setK8sStatusInfo(NotebookUtil.getK8sStatusInfo(result)); return HttpUtils.isSuccess(result.getCode()); } catch (Exception e) { - LogUtil.error(LogEnum.NOTE_BOOK, "notebook调用jupyterResourceApi.createWithPvc异常!", e); + LogUtil.error(LogEnum.NOTE_BOOK, "notebook调用jupyterResourceApi.createWithPvc异常!{}", e); noteBook.setK8sStatusCode(BLANK); noteBook.setK8sStatusInfo(NotebookUtil.getK8sStatusInfo(e)); return false; @@ -447,7 +447,7 @@ public class NoteBookServiceImpl implements NoteBookService { returnStr = "停止" + NotebookUtil.FAILED; } } catch (Exception e) { - LogUtil.error(LogEnum.NOTE_BOOK, "停止notebook调用jupyterResourceApi.delete异常!", e); + LogUtil.error(LogEnum.NOTE_BOOK, "停止notebook调用jupyterResourceApi.delete异常!{}", e); noteBook.setK8sStatusCode(BLANK); noteBook.setK8sStatusInfo(NotebookUtil.getK8sStatusInfo(e)); returnStr = "停止" + NotebookUtil.FAILED; @@ -527,7 +527,7 @@ public class NoteBookServiceImpl implements NoteBookService { } return NoteBookStatusEnum.convert(result.getPhase()); } catch (Exception e) { - LogUtil.error(LogEnum.NOTE_BOOK, "notebook nameSpace:{} resourceName:{} 查询异常!", noteBook.getK8sNamespace(), noteBook.getK8sResourceName(), e); + LogUtil.error(LogEnum.NOTE_BOOK, "notebook nameSpace:{} resourceName:{} 查询异常!{}", noteBook.getK8sNamespace(), noteBook.getK8sResourceName(), e); noteBook.setK8sStatusCode(BLANK); noteBook.setK8sStatusInfo(NotebookUtil.getK8sStatusInfo(e)); return null; diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtDatasetServiceImpl.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtDatasetServiceImpl.java deleted file mode 100644 index ac88a20..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtDatasetServiceImpl.java +++ /dev/null @@ -1,121 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.impl; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.dubhe.dao.PtDatasetMapper; -import org.dubhe.domain.PtDataset; -import org.dubhe.domain.dto.PtDatasetDTO; -import org.dubhe.domain.dto.PtDatasetQueryCriteria; -import org.dubhe.service.PtDatasetService; -import org.dubhe.service.convert.PtDatasetConvert; -import org.dubhe.utils.FileUtil; -import org.dubhe.utils.PageUtil; -import org.dubhe.utils.WrapperHelp; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * @description 数据集管理 - * @date 2020-03-17 - */ -@Service -@CacheConfig(cacheNames = "ptDataset") -@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) -public class PtDatasetServiceImpl implements PtDatasetService { - - @Autowired - private PtDatasetMapper ptDatasetMapper; - @Autowired - private PtDatasetConvert ptDatasetConvert; - - - @Override - @Cacheable - public Map queryAll(PtDatasetQueryCriteria criteria, Page page) { - IPage ptDatasets = ptDatasetMapper.selectPage(page, WrapperHelp.getWrapper(criteria)); - return PageUtil.toPage(ptDatasets, ptDatasetConvert::toDto); - } - - @Override - @Cacheable - public List queryAll(PtDatasetQueryCriteria criteria) { - return ptDatasetConvert.toDto(ptDatasetMapper.selectList(WrapperHelp.getWrapper(criteria))); - } - - @Override - @Cacheable(key = "#p0") - public PtDatasetDTO findById(Long id) { - PtDataset ptDataset = ptDatasetMapper.selectById(id); - return ptDatasetConvert.toDto(ptDataset); - } - - @Override - @CacheEvict(allEntries = true) - @Transactional(rollbackFor = Exception.class) - public PtDatasetDTO create(PtDataset resources) { - ptDatasetMapper.insert(resources); - return ptDatasetConvert.toDto(resources); - } - - @Override - @CacheEvict(allEntries = true) - @Transactional(rollbackFor = Exception.class) - public void update(PtDataset resources) { - PtDataset ptDataset = ptDatasetMapper.selectById(resources.getId()); - ptDataset.copy(resources); - ptDatasetMapper.updateById(ptDataset); - } - - @Override - @CacheEvict(allEntries = true) - public void deleteAll(Long[] ids) { - for (Long id : ids) { - ptDatasetMapper.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (PtDatasetDTO ptDataset : all) { - Map map = new LinkedHashMap<>(); - map.put(" name", ptDataset.getName()); - map.put(" remark", ptDataset.getRemark()); - map.put(" type", ptDataset.getType()); - map.put(" team", ptDataset.getTeam()); - map.put(" createUser", ptDataset.getCreateUser()); - map.put(" createTime", ptDataset.getCreateTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtDevEnvsServiceImpl.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtDevEnvsServiceImpl.java deleted file mode 100644 index 262a962..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtDevEnvsServiceImpl.java +++ /dev/null @@ -1,123 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.impl; - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.dubhe.dao.PtDevEnvsMapper; -import org.dubhe.domain.PtDevEnvs; -import org.dubhe.domain.dto.PtDevEnvsDTO; -import org.dubhe.domain.dto.PtDevEnvsQueryCriteria; -import org.dubhe.service.PtDevEnvsService; -import org.dubhe.service.convert.PtDevEnvsConvert; -import org.dubhe.utils.FileUtil; -import org.dubhe.utils.PageUtil; -import org.dubhe.utils.WrapperHelp; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * @description 开发环境 - * @date 2020-03-17 - */ -@Service -@CacheConfig(cacheNames = "ptDevEnvs") -@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) -public class PtDevEnvsServiceImpl implements PtDevEnvsService { - - @Autowired - private PtDevEnvsMapper ptDevEnvsMapper; - private PtDevEnvsConvert ptDevEnvsConvert; - - - @Override - @Cacheable - public Map queryAll(PtDevEnvsQueryCriteria criteria, Page page) { - IPage ptDevEnvss = ptDevEnvsMapper.selectPage(page, WrapperHelp.getWrapper(criteria)); - return PageUtil.toPage(ptDevEnvss, ptDevEnvsConvert::toDto); - } - - @Override - @Cacheable - public List queryAll(PtDevEnvsQueryCriteria criteria) { - return ptDevEnvsConvert.toDto(ptDevEnvsMapper.selectList(WrapperHelp.getWrapper(criteria))); - } - - @Override - @Cacheable(key = "#p0") - public PtDevEnvsDTO findById(Long id) { - PtDevEnvs ptDevEnvs = ptDevEnvsMapper.selectById(id); - return ptDevEnvsConvert.toDto(ptDevEnvs); - } - - @Override - @CacheEvict(allEntries = true) - @Transactional(rollbackFor = Exception.class) - public PtDevEnvsDTO create(PtDevEnvs resources) { - ptDevEnvsMapper.insert(resources); - return ptDevEnvsConvert.toDto(resources); - } - - @Override - @CacheEvict(allEntries = true) - @Transactional(rollbackFor = Exception.class) - public void update(PtDevEnvs resources) { - PtDevEnvs ptDevEnvs = ptDevEnvsMapper.selectById(resources.getId()); - ptDevEnvs.copy(resources); - ptDevEnvsMapper.updateById(ptDevEnvs); - } - - @Override - @CacheEvict(allEntries = true) - public void deleteAll(Long[] ids) { - for (Long id : ids) { - ptDevEnvsMapper.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (PtDevEnvsDTO ptDevEnvs : all) { - Map map = new LinkedHashMap<>(); - map.put(" name", ptDevEnvs.getName()); - map.put(" remark", ptDevEnvs.getRemark()); - map.put(" podnum", ptDevEnvs.getPodNum()); - map.put(" gpunum", ptDevEnvs.getGpuNum()); - map.put(" memnum", ptDevEnvs.getMemNum()); - map.put(" cpunum", ptDevEnvs.getCpuNum()); - map.put(" duration", ptDevEnvs.getDuration()); - map.put(" startTime", ptDevEnvs.getStartTime()); - map.put(" closeTime", ptDevEnvs.getCloseTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtImageServiceImpl.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtImageServiceImpl.java index c23109c..e050baa 100644 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtImageServiceImpl.java +++ b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtImageServiceImpl.java @@ -121,7 +121,7 @@ public class PtImageServiceImpl implements PtImageService { } ptImages = ptImageMapper.selectPage(page, query); } catch (Exception e) { - LogUtil.error(LogEnum.BIZ_TRAIN, "User {} query mirror list display exception :{}, request information :{}", e, ptImageQueryDTO); + LogUtil.error(LogEnum.BIZ_TRAIN, "User {} query mirror list display exception :{}, request information :{}",user.getId() ,e, ptImageQueryDTO); throw new BusinessException("查询镜像列表展示异常"); } List ptImageQueryResult = ptImages.getRecords().stream().map(x -> { diff --git a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtStorageServiceImpl.java b/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtStorageServiceImpl.java deleted file mode 100644 index ae491a0..0000000 --- a/dubhe-server/dubhe-admin/src/main/java/org/dubhe/service/impl/PtStorageServiceImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -/** - * Copyright 2020 Zhejiang Lab. All Rights Reserved. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS 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.impl; - - -import com.baomidou.mybatisplus.core.metadata.IPage; -import com.baomidou.mybatisplus.extension.plugins.pagination.Page; -import org.dubhe.dao.PtStorageMapper; -import org.dubhe.domain.PtStorage; -import org.dubhe.domain.dto.PtStorageDTO; -import org.dubhe.domain.dto.PtStorageQueryCriteria; -import org.dubhe.service.PtStorageService; -import org.dubhe.service.convert.PtStorageConvert; -import org.dubhe.utils.FileUtil; -import org.dubhe.utils.PageUtil; -import org.dubhe.utils.WrapperHelp; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.CacheConfig; -import org.springframework.cache.annotation.CacheEvict; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Propagation; -import org.springframework.transaction.annotation.Transactional; - -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; -import java.util.ArrayList; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -/** - * @description 存储服务类 - * @date 2020-03-17 - */ -@Service -@CacheConfig(cacheNames = "ptStorage") -@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) -public class PtStorageServiceImpl implements PtStorageService { - - @Autowired - private PtStorageMapper ptStorageMapper; - - @Autowired - private PtStorageConvert ptStorageConvert; - - - @Override - @Cacheable - public Map queryAll(PtStorageQueryCriteria criteria, Page page) { - IPage ptStorages = ptStorageMapper.selectPage(page, WrapperHelp.getWrapper(criteria)); - return PageUtil.toPage(ptStorages, ptStorageConvert::toDto); - } - - @Override - @Cacheable - public List queryAll(PtStorageQueryCriteria criteria) { - return ptStorageConvert.toDto(ptStorageMapper.selectList(WrapperHelp.getWrapper(criteria))); - } - - @Override - @Cacheable(key = "#p0") - public PtStorageDTO findById(Long id) { - PtStorage ptStorage = ptStorageMapper.selectById(id); - return ptStorageConvert.toDto(ptStorage); - } - - @Override - @CacheEvict(allEntries = true) - @Transactional(rollbackFor = Exception.class) - public PtStorageDTO create(PtStorage resources) { - ptStorageMapper.insert(resources); - return ptStorageConvert.toDto(resources); - } - - @Override - @CacheEvict(allEntries = true) - @Transactional(rollbackFor = Exception.class) - public void update(PtStorage resources) { - PtStorage ptStorage = ptStorageMapper.selectById(resources.getId()); - ptStorage.copy(resources); - ptStorageMapper.updateById(ptStorage); - } - - @Override - @CacheEvict(allEntries = true) - public void deleteAll(Long[] ids) { - for (Long id : ids) { - ptStorageMapper.deleteById(id); - } - } - - @Override - public void download(List all, HttpServletResponse response) throws IOException { - List> list = new ArrayList<>(); - for (PtStorageDTO ptStorage : all) { - Map map = new LinkedHashMap<>(); - map.put(" name", ptStorage.getName()); - map.put(" size", ptStorage.getSize()); - map.put(" storageclass", ptStorage.getStorageclass()); - map.put(" createUser", ptStorage.getCreateUser()); - map.put(" createTime", ptStorage.getCreateTime()); - list.add(map); - } - FileUtil.downloadExcel(list, response); - } -} diff --git a/dubhe-server/dubhe-admin/src/main/resources/config/application-dev.yml b/dubhe-server/dubhe-admin/src/main/resources/config/application-dev.yml index c6d98c7..05431f6 100644 --- a/dubhe-server/dubhe-admin/src/main/resources/config/application-dev.yml +++ b/dubhe-server/dubhe-admin/src/main/resources/config/application-dev.yml @@ -8,7 +8,7 @@ spring: redis: #数据库索引 database: 0 - host: + host: 127.0.0.1 port: 6379 password: #连接超时时间 @@ -18,8 +18,8 @@ spring: db-type: com.alibaba.druid.pool.DruidDataSource driverClassName: net.sf.log4jdbc.sql.jdbcapi.DriverSpy url: jdbc:log4jdbc:mysql://127.0.0.1:3306/dubhe-dev?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&useInformationSchema=true - username: - password: + username: test + password: test # 初始化配置 initial-size: 3 @@ -59,8 +59,8 @@ spring: type: com.alibaba.druid.pool.DruidDataSource driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy url: jdbc:log4jdbc:mysql://127.0.0.1:3306/dubhe-dev?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false&allowMultiQueries=true&useInformationSchema=true - username: - password: + username: test + password: test #指定data_dataset表 主键id 生成策略 sharding: @@ -86,19 +86,19 @@ k8s: # k8s集群配置文件 kubeconfig: kubeconfig # nfs服务暴露的IP地址 如需测试需修改为合适的地址 - nfs: + nfs: 127.0.0.1 #nfs服务端 共享目录 nfs-root-path: /nfs/ nfs-root-windows-path: "Z:" # 命名空间关键字 namespace: namespace # k8s ingress域名 如需测试需修改为合适的域名 - host: - # k8s ingress-controller 对外port - port: - # elasticsearch暴露的服务地址 + host: notebook.test.com + # k8s ingress-controller 对外port,获取方式:部署 ingress-controller 后,在k8s master节点执行 kubectl get svc -A | grep 'ingress-nginx-controller' 获取80对应的外部端口 + port: 33334 + # elasticsearch暴露的服务地址,获取方式 部署 管理集群日志 后,在k8s msater节点执行 kubectl get svc -A | grep 'elasticsearch' 获取9200对应的外部端口 elasticsearch: - hostlist: ${eshostlist::} + hostlist: ${eshostlist:127.0.0.1:33333} # 日志采集配置信息 log: type: _doc @@ -120,9 +120,10 @@ k8s: nfs-storage-class-name: zjlab-nfs-storage #配置harbor harbor: - address: - username: - password: + # habor服务域名,需要将用户持有域名解析到 harbor服务所在服务器ip + address: harbor.test.com + username: admin + password: Harbor12345 model-name: train # data模块配置 data: @@ -157,8 +158,10 @@ data: # minio配置 minio: url: http://127.0.0.1:9000/ - accessKey: - secretKey: + # 部署 minio 时指定的 MINIO_ACCESS_KEY + accessKey: admin + # 部署 minio 时指定的 MINIO_SECRET_KEY + secretKey: 123@abc.com bucketName: dubhe-dev presignedUrlExpiryTime: 300 annotation: /annotation/ diff --git a/dubhe-server/dubhe-admin/src/main/resources/config/application.yml b/dubhe-server/dubhe-admin/src/main/resources/config/application.yml index 23f74de..4e17d7f 100644 --- a/dubhe-server/dubhe-admin/src/main/resources/config/application.yml +++ b/dubhe-server/dubhe-admin/src/main/resources/config/application.yml @@ -9,13 +9,13 @@ spring: repositories: enabled: false - # 邮箱配置 + # 邮箱配置,用于发送用户注册邮箱验证码 mail: - host: + host: smtp.163.com # 邮件的发送者 163邮箱(开发测试时使用 发送延时 20秒,每天发送量限制 50) - username: + username: test@163.com # SMTP授权密码 - password: + password: AAAAAAAAAAAAAAAA protocol: smtp properties.mail.smtp.auth: true properties.mail.smtp.port: 465 #465或者994 @@ -32,10 +32,10 @@ loginCode: height: 28 length: 4 -#密码加密传输,前端公钥加密,后端私钥解密 +#密码加密传输,前端公钥加密,后端私钥解密,与前端src/settings.js publicKey搭配使用;可使用genKeyPair方法进行生成 rsa: - private_key: - public_key: + private_key: MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== + public_key: MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ== #jwt jwt: @@ -43,7 +43,7 @@ jwt: # 令牌前缀 token-start-with: Bearer # 必须使用最少88位的Base64对该令牌进行编码 - base64-secret: + base64-secret: ZmQ0ZGI5NjQ0MDQwY2I4MjMxY2Y3ZmI3MjdhN2ZmMjNhODViOTg1ZGE0NTBjMGM4NDA5NzYxMjdjOWMwYWRmZTBlZjlhNGY3ZTg4Y2U3YTE1ODVkZDU5Y2Y3OGYwZWE1NzUzNWQ2YjFjZDc0NGMxZWU2MmQ3MjY1NzJmMTIzNDU= # 令牌过期时间 此处单位/毫秒 ,默认24小时,可在此网站生成 https://www.convertworld.com/zh-hans/time/milliseconds.html token-validity-in-seconds: 86400000 # 在线用户key @@ -56,7 +56,7 @@ swagger: enabled: true # 后台添加用户的初始密码 -initial_password: "" +initial_password: "123456" train-job: namespace: "namespace-" @@ -123,12 +123,14 @@ logging: dubhe-proxy: visual: keyword: visual - server: - port: + # 可视化服务后端 ip + server: 127.0.0.1 + # 可视化服务后端 端口 + port: 9898 refine: keyword: refine server: localhost - port: + port: 9797 # 延时全局配置 delay: diff --git a/dubhe-server/dubhe-admin/src/main/resources/kubeconfig-prod b/dubhe-server/dubhe-admin/src/main/resources/kubeconfig-prod deleted file mode 100644 index 76cf823..0000000 --- a/dubhe-server/dubhe-admin/src/main/resources/kubeconfig-prod +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: v1 -clusters: -- cluster: - certificate-authority-data: - server: - name: kubernetes -contexts: -- context: - cluster: kubernetes - user: kubernetes-admin - name: kubernetes-admin@kubernetes -current-context: kubernetes-admin@kubernetes -kind: Config -preferences: {} -users: -- name: kubernetes-admin - user: - client-certificate-data: - client-key-data: \ No newline at end of file diff --git a/dubhe-server/dubhe-admin/src/test/java/org/dubhe/BaseTest.java b/dubhe-server/dubhe-admin/src/test/java/org/dubhe/BaseTest.java index 4ea8af0..150d571 100755 --- a/dubhe-server/dubhe-admin/src/test/java/org/dubhe/BaseTest.java +++ b/dubhe-server/dubhe-admin/src/test/java/org/dubhe/BaseTest.java @@ -19,6 +19,7 @@ package org.dubhe; import org.apache.shiro.SecurityUtils; import org.apache.shiro.subject.Subject; +import org.apache.shiro.util.ThreadContext; import org.apache.shiro.web.mgt.DefaultWebSecurityManager; import org.dubhe.support.login.UsernamePasswordCaptchaToken; import org.junit.Assert; @@ -65,8 +66,9 @@ public class BaseTest { public void setup() { this.mockMvc = MockMvcBuilders.webAppContextSetup(this.wac).build(); SecurityUtils.setSecurityManager(defaultWebSecurityManager); + ThreadContext.bind(defaultWebSecurityManager); Subject subject = SecurityUtils.getSubject(); - UsernamePasswordCaptchaToken token = new UsernamePasswordCaptchaToken("admin", "admin"); + UsernamePasswordCaptchaToken token = new UsernamePasswordCaptchaToken("admin", "123456"); token.setRememberMe(true); subject.login(token); } diff --git a/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/machine/statemachine/GlobalStateMachine.java b/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/machine/statemachine/GlobalStateMachine.java index 97fd58e..de8212e 100644 --- a/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/machine/statemachine/GlobalStateMachine.java +++ b/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/machine/statemachine/GlobalStateMachine.java @@ -37,4 +37,4 @@ public class GlobalStateMachine { */ private FileStateMachine fileStateMachine; -} +} \ No newline at end of file diff --git a/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/DatasetServiceImpl.java b/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/DatasetServiceImpl.java index 151357f..85b2ce3 100644 --- a/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/DatasetServiceImpl.java +++ b/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/DatasetServiceImpl.java @@ -35,7 +35,6 @@ import org.dubhe.base.MagicNumConstant; import org.dubhe.constant.NumberConstant; import org.dubhe.data.constant.*; import org.dubhe.data.dao.DatasetMapper; -import org.dubhe.data.dao.DatasetVersionFileMapper; import org.dubhe.data.dao.DatasetVersionMapper; import org.dubhe.data.dao.TaskMapper; import org.dubhe.data.domain.dto.*; @@ -137,12 +136,6 @@ public class DatasetServiceImpl extends ServiceImpl impl public FileService fileService; /** - * 数据集转换 - */ - @Autowired - private DatasetConvert datasetConvert; - - /** * 数据集标签服务类 */ @Autowired @@ -201,9 +194,6 @@ public class DatasetServiceImpl extends ServiceImpl impl @Autowired private LabelGroupServiceImpl labelGroupService; - @Autowired - private DatasetVersionFileMapper datasetVersionFileMapper; - /** * 检测是否为公共数据集 * @@ -434,12 +424,10 @@ public class DatasetServiceImpl extends ServiceImpl impl Map labelNameMap = labelList.stream().collect(Collectors.toMap(Label::getName, Label::getId)); if(!Objects.isNull(labelNameMap.get(label.getName()))){ datasetLabelService.insert(DatasetLabel.builder().datasetId(datasetId).labelId(labelNameMap.get(label.getName())).build()); + datasetGroupLabelService.insert(DatasetGroupLabel.builder().labelGroupId(dataset.getLabelGroupId()).labelId(labelNameMap.get(label.getName())).build()); }else { insertLabelData(label,datasetId); } - if(!Objects.isNull(dataset.getLabelGroupId()) && COCO_ID.compareTo(dataset.getLabelGroupId()) != 0){ - datasetGroupLabelService.insert(DatasetGroupLabel.builder().labelGroupId(dataset.getLabelGroupId()).labelId(label.getId()).build()); - } }else { insertLabelData(label,datasetId); } diff --git a/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/LabelServiceImpl.java b/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/LabelServiceImpl.java index 9ca1f65..cd2f482 100644 --- a/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/LabelServiceImpl.java +++ b/dubhe-server/dubhe-data/src/main/java/org/dubhe/data/service/impl/LabelServiceImpl.java @@ -27,13 +27,11 @@ import org.dubhe.data.constant.ErrorEnum; import org.dubhe.data.dao.LabelMapper; import org.dubhe.data.domain.dto.LabelCreateDTO; import org.dubhe.data.domain.dto.LabelDTO; -import org.dubhe.data.domain.entity.Dataset; import org.dubhe.data.domain.entity.DatasetGroupLabel; import org.dubhe.data.domain.entity.DatasetLabel; import org.dubhe.data.domain.entity.Label; import org.dubhe.data.service.DatasetGroupLabelService; import org.dubhe.data.service.DatasetLabelService; -import org.dubhe.data.service.DatasetService; import org.dubhe.data.service.LabelService; import org.dubhe.enums.LogEnum; import org.dubhe.exception.BusinessException; @@ -92,12 +90,15 @@ public class LabelServiceImpl extends ServiceImpl implements List