From 5f37bd0e669fc4bbdec45e8136f5485ded04befc Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 14 Oct 2024 15:30:30 +0800 Subject: [PATCH 01/91] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E5=89=8D=E7=AB=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/proxy.ts | 4 ++-- react-ui/src/components/IFramePage/index.tsx | 2 +- react-ui/src/components/RobotFrame/index.tsx | 2 +- react-ui/src/pages/Experiment/components/LogGroup/index.tsx | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/react-ui/config/proxy.ts b/react-ui/config/proxy.ts index f8875e9d..35232b47 100644 --- a/react-ui/config/proxy.ts +++ b/react-ui/config/proxy.ts @@ -20,7 +20,7 @@ export default { // localhost:8000/api/** -> https://preview.pro.ant.design/api/** '/api/': { // 要代理的地址 - target: 'http://172.20.32.181:31213', // 开发环境 + target: 'http://172.20.32.185:31213', // 开发环境 // target: 'http://172.20.32.98:8082', // target: 'http://172.20.32.150:8082', // 配置了这个可以从 http 代理到 https @@ -29,7 +29,7 @@ export default { // pathRewrite: { '^/api': '' }, }, '/profile/avatar/': { - target: 'http://172.20.32.181:31213', + target: 'http://172.20.32.185:31213', changeOrigin: true, }, }, diff --git a/react-ui/src/components/IFramePage/index.tsx b/react-ui/src/components/IFramePage/index.tsx index c4ab9d3f..861a0c05 100644 --- a/react-ui/src/components/IFramePage/index.tsx +++ b/react-ui/src/components/IFramePage/index.tsx @@ -19,7 +19,7 @@ const getRequestAPI = (type: IframePageType): (() => Promise) => { case IframePageType.DatasetAnnotation: return getLabelStudioUrl; case IframePageType.AppDevelopment: - return () => Promise.resolve({ code: 200, data: 'http://172.20.32.181:30080/' }); + return () => Promise.resolve({ code: 200, data: 'http://172.20.32.185:30080/' }); case IframePageType.DevEnv: return () => Promise.resolve({ diff --git a/react-ui/src/components/RobotFrame/index.tsx b/react-ui/src/components/RobotFrame/index.tsx index 7905265d..1c8e8cf2 100644 --- a/react-ui/src/components/RobotFrame/index.tsx +++ b/react-ui/src/components/RobotFrame/index.tsx @@ -9,7 +9,7 @@ type RobotFrameProps = { }; function RobotFrame({ onClose, visible }: RobotFrameProps) { - const url = 'http://172.20.32.181:30080/chat/EruwZfxVgDkWdLYs'; + const url = 'http://172.20.32.185:30080/chat/EruwZfxVgDkWdLYs'; const openUrl = () => { window.open(url, '_blank'); }; diff --git a/react-ui/src/pages/Experiment/components/LogGroup/index.tsx b/react-ui/src/pages/Experiment/components/LogGroup/index.tsx index b6d45ce0..8edc5562 100644 --- a/react-ui/src/pages/Experiment/components/LogGroup/index.tsx +++ b/react-ui/src/pages/Experiment/components/LogGroup/index.tsx @@ -135,7 +135,7 @@ function LogGroup({ const setupSockect = () => { let { host } = location; if (process.env.NODE_ENV === 'development') { - host = '172.20.32.181:31213'; + host = '172.20.32.185:31213'; } const socket = new WebSocket( `ws://${host}/newlog/realtimeLog?start=${start_time}&query={pod="${pod_name}"}`, From 6e5d2ee277b07798decba2666256742311db5592 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 14 Oct 2024 17:21:23 +0800 Subject: [PATCH 02/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9E=84=E5=BB=BA?= =?UTF-8?q?=E9=95=9C=E5=83=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/utils/K8sClientUtil.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java index c0ff80cf..ce0b2817 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java @@ -526,12 +526,13 @@ public class K8sClientUtil { log.error("获取 POD 异常:", e); } // invokes the CoreV1Api client - - for (V1Pod item : v1PodList.getItems()) { - String generateName = item.getMetadata().getName(); - if (StringUtils.isNotEmpty(generateName) && generateName.startsWith(deploymentName)) { - // 找到匹配的Pod,获取其名称 - return item; + if (v1PodList != null) { + for (V1Pod item : v1PodList.getItems()) { + String generateName = item.getMetadata().getName(); + if (StringUtils.isNotEmpty(generateName) && generateName.startsWith(deploymentName)) { + // 找到匹配的Pod,获取其名称 + return item; + } } } return null; From 90f959af63d00c967b04c710b36cff42e0f684ea Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Tue, 15 Oct 2024 14:21:36 +0800 Subject: [PATCH 03/91] =?UTF-8?q?fix:=20JSON.parse=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E4=B8=BAparseJsonText?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/hooks/pageCacheState.ts | 7 ++----- react-ui/src/pages/Experiment/Info/index.jsx | 4 ++-- react-ui/src/pages/Pipeline/Info/index.jsx | 6 +++--- .../Pipeline/components/PipelineNodeDrawer/index.tsx | 2 +- react-ui/src/pages/User/Login/index.tsx | 3 ++- react-ui/src/utils/index.ts | 2 +- react-ui/src/utils/localStorage.ts | 10 ++++------ react-ui/src/utils/sessionStorage.ts | 12 ++++-------- 8 files changed, 19 insertions(+), 27 deletions(-) diff --git a/react-ui/src/hooks/pageCacheState.ts b/react-ui/src/hooks/pageCacheState.ts index 9268a07a..e320b0a6 100644 --- a/react-ui/src/hooks/pageCacheState.ts +++ b/react-ui/src/hooks/pageCacheState.ts @@ -4,6 +4,7 @@ * @Description: 页面状态缓存,pop 回到这个页面的时候,重新构建之前的状态 */ +import { parseJsonText } from '@/utils'; import { useCallback, useState } from 'react'; const pageKeys: string[] = []; @@ -14,11 +15,7 @@ const getCacheState = (key: string) => { const jsonStr = sessionStorage.getItem(key); if (jsonStr) { removeCacheState(key); - try { - return JSON.parse(jsonStr); - } catch (error) { - return undefined; - } + return parseJsonText(jsonStr); } return undefined; }; diff --git a/react-ui/src/pages/Experiment/Info/index.jsx b/react-ui/src/pages/Experiment/Info/index.jsx index a958794b..c96d781e 100644 --- a/react-ui/src/pages/Experiment/Info/index.jsx +++ b/react-ui/src/pages/Experiment/Info/index.jsx @@ -3,7 +3,7 @@ import { useStateRef, useVisible } from '@/hooks'; import { getExperimentIns } from '@/services/experiment/index.js'; import { getWorkflowById } from '@/services/pipeline/index.js'; import themes from '@/styles/theme.less'; -import { fittingString } from '@/utils'; +import { fittingString, parseJsonText } from '@/utils'; import { elapsedTime, formatDate } from '@/utils/date'; import { to } from '@/utils/promise'; import G6, { Util } from '@antv/g6'; @@ -88,7 +88,7 @@ function ExperimentText() { setExperimentIns(res.data); const { status, nodes_status, argo_ins_ns, argo_ins_name } = res.data; const workflowData = workflowRef.current; - const experimentStatusObjs = JSON.parse(nodes_status); + const experimentStatusObjs = parseJsonText(nodes_status); workflowData.nodes.forEach((item) => { const experimentNode = experimentStatusObjs?.[item.id]; updateWorkflowNode(item, experimentNode); diff --git a/react-ui/src/pages/Pipeline/Info/index.jsx b/react-ui/src/pages/Pipeline/Info/index.jsx index b538fa50..3ae7ea59 100644 --- a/react-ui/src/pages/Pipeline/Info/index.jsx +++ b/react-ui/src/pages/Pipeline/Info/index.jsx @@ -2,7 +2,7 @@ import KFIcon from '@/components/KFIcon'; import { useStateRef, useVisible } from '@/hooks'; import { getWorkflowById, saveWorkflow } from '@/services/pipeline/index.js'; import themes from '@/styles/theme.less'; -import { fittingString, s8 } from '@/utils'; +import { fittingString, parseJsonText, s8 } from '@/utils'; import { to } from '@/utils/promise'; import G6 from '@antv/g6'; import { useNavigate, useParams } from '@umijs/max'; @@ -130,7 +130,7 @@ const EditPipeline = () => { // 渲染数据 const getGraphData = (data) => { - if (graph) { + if (graph && data) { graph.data(data); graph.render(); } else { @@ -283,7 +283,7 @@ const EditPipeline = () => { const { global_param, dag } = res.data; setGlobalParam(global_param || []); if (dag) { - getGraphData(JSON.parse(dag)); + getGraphData(parseJsonText(dag)); } } }; diff --git a/react-ui/src/pages/Pipeline/components/PipelineNodeDrawer/index.tsx b/react-ui/src/pages/Pipeline/components/PipelineNodeDrawer/index.tsx index bea129dd..2eae5c64 100644 --- a/react-ui/src/pages/Pipeline/components/PipelineNodeDrawer/index.tsx +++ b/react-ui/src/pages/Pipeline/components/PipelineNodeDrawer/index.tsx @@ -80,7 +80,7 @@ const PipelineNodeParameter = forwardRef(({ onFormChange }: PipelineNodeParamete out_parameters: JSON.parse(model.out_parameters), control_strategy: JSON.parse(model.control_strategy), }; - console.log('model', nodeData); + // console.log('model', nodeData); setStagingItem({ ...nodeData, }); diff --git a/react-ui/src/pages/User/Login/index.tsx b/react-ui/src/pages/User/Login/index.tsx index a4585bfa..9ef18148 100644 --- a/react-ui/src/pages/User/Login/index.tsx +++ b/react-ui/src/pages/User/Login/index.tsx @@ -1,5 +1,6 @@ import { clearSessionToken, setSessionToken } from '@/access'; import { getCaptchaImg, login } from '@/services/system/auth'; +import { parseJsonText } from '@/utils'; import { safeInvoke } from '@/utils/functional'; import LocalStorage from '@/utils/localStorage'; import { to } from '@/utils/promise'; @@ -37,7 +38,7 @@ const Login = () => { const userJson = safeInvoke((text: string) => CryptoJS.AES.decrypt(text, AESKEY).toString(CryptoJS.enc.Utf8), )(userStorage); - const user = safeInvoke(JSON.parse)(userJson); + const user = safeInvoke(parseJsonText)(userJson); if (user && typeof user === 'object' && user.version === VERSION) { const { username, password } = user; form.setFieldsValue({ username: username, password: password, autoLogin: true }); diff --git a/react-ui/src/utils/index.ts b/react-ui/src/utils/index.ts index 01b6cb36..0af6f5aa 100644 --- a/react-ui/src/utils/index.ts +++ b/react-ui/src/utils/index.ts @@ -21,7 +21,7 @@ export function getNameByCode(list: any[], code: any) { // 解析 json 字符串 export function parseJsonText(text?: string | null): any | null { - if (!text) { + if (text === undefined || text === null || text === '') { return null; } try { diff --git a/react-ui/src/utils/localStorage.ts b/react-ui/src/utils/localStorage.ts index beb2c2b0..4d224465 100644 --- a/react-ui/src/utils/localStorage.ts +++ b/react-ui/src/utils/localStorage.ts @@ -1,3 +1,5 @@ +import { parseJsonText } from './index'; + export default class LocalStorage { // 登录的用户,包括用户名、密码和版本号 static readonly loginUserKey = 'login-user'; @@ -10,13 +12,9 @@ export default class LocalStorage { return jsonStr; } if (jsonStr) { - try { - return JSON.parse(jsonStr); - } catch (error) { - return undefined; - } + return parseJsonText(jsonStr); } - return undefined; + return null; } static setItem(key: string, state?: any, isObject: boolean = false) { diff --git a/react-ui/src/utils/sessionStorage.ts b/react-ui/src/utils/sessionStorage.ts index 701ef63c..41117e1e 100644 --- a/react-ui/src/utils/sessionStorage.ts +++ b/react-ui/src/utils/sessionStorage.ts @@ -1,3 +1,5 @@ +import { parseJsonText } from './index'; + export default class SessionStorage { // 用于新建镜像 static readonly mirrorNameKey = 'mirror-name'; @@ -7,8 +9,6 @@ export default class SessionStorage { static readonly serviceVersionInfoKey = 'service-version-info'; // 编辑器 url static readonly editorUrlKey = 'editor-url'; - // 数据集、模型资源 - static readonly resourceItemKey = 'resource-item'; static getItem(key: string, isObject: boolean = false) { const jsonStr = sessionStorage.getItem(key); @@ -16,13 +16,9 @@ export default class SessionStorage { return jsonStr; } if (jsonStr) { - try { - return JSON.parse(jsonStr); - } catch (error) { - return undefined; - } + return parseJsonText(jsonStr); } - return undefined; + return null; } static setItem(key: string, state?: any, isObject: boolean = false) { From 3cc14b84a786d6cfa42431f0aeaba1440cc39ee3 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 15 Oct 2024 15:13:33 +0800 Subject: [PATCH 04/91] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=88=86=E9=A1=B5?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/NewModelFromGitController.java | 13 +++++++--- .../platform/mapper/ModelDependency1Dao.java | 2 ++ .../ruoyi/platform/service/ModelsService.java | 2 ++ .../service/impl/ModelsServiceImpl.java | 26 +++++++++++++++++-- .../ModelDependency1DaoMapper.xml | 9 +++++++ 5 files changed, 47 insertions(+), 5 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java index 426c3de4..e7eb47ef 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java @@ -2,11 +2,9 @@ package com.ruoyi.platform.controller.model; import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.platform.service.ModelsService; -import com.ruoyi.platform.utils.DVCUtils; import com.ruoyi.platform.vo.ModelsVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; -import org.eclipse.jgit.api.errors.GitAPIException; import org.springframework.core.io.InputStreamResource; import org.springframework.data.domain.PageRequest; import org.springframework.http.ResponseEntity; @@ -14,7 +12,6 @@ import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; -import java.io.IOException; import java.util.List; import java.util.Map; @@ -77,6 +74,16 @@ public class NewModelFromGitController { } } + @GetMapping("/queryVersions") + @ApiOperation("分页查询模型版本") + public AjaxResult queryVersions(@RequestParam(value = "page") int page, + @RequestParam(value = "size") int size, + @RequestParam("identifier") String identifier, + @RequestParam("owner") String owner) throws Exception { + PageRequest pageRequest = PageRequest.of(page, size); + return AjaxResult.success(this.modelsService.queryVersions(pageRequest, identifier, owner)); + } + @GetMapping("/getVersionList") @ApiOperation(value = "获取模型分支列表") public AjaxResult getVersionList(@RequestParam("identifier") String identifier, @RequestParam("owner") String owner) throws Exception { diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java index 28baa541..c44bd8bd 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java @@ -24,4 +24,6 @@ public interface ModelDependency1Dao { int deleteModel(@Param("repoId") Integer repoId, @Param("identifier") String identifier, @Param("owner") String owner, @Param("version") String version); int deleteModelDependency(@Param("parentModel") String parentModel); + + String getMeta(@Param("identifier") String identifier, @Param("owner") String owner, @Param("version") String version); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java index 067f90a7..8b51d696 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java @@ -99,6 +99,8 @@ public interface ModelsService { Page newPersonalQueryByPage(ModelsVo modelsVo, PageRequest pageRequest) throws Exception; + Page> queryVersions(PageRequest pageRequest, String identifier, String owner) throws Exception; + List> getVersionList(String identifier, String owner) throws Exception; ModelsVo getModelDetail(Integer id, String identifier, String owner, String version) throws Exception; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index a7a2aa31..8000a953 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -973,11 +973,33 @@ public class ModelsServiceImpl implements ModelsService { return new PageImpl<>(result, pageRequest, collect.size()); } + @Override + public Page> queryVersions(PageRequest pageRequest, String identifier, String owner) throws Exception { + String token = gitService.checkoutToken(); + List> collect = gitService.getBrancheList(token, owner, identifier); + List> result = collect.stream() + .filter(branch -> !"master".equals(branch.get("name"))) + .skip((pageRequest.getPageNumber()) * pageRequest.getPageSize()).limit(pageRequest.getPageSize()) + .collect(Collectors.toList()); + + for (Map branch : result) { + String meta = modelDependency1Dao.getMeta(identifier, owner, (String) branch.get("name")); + ModelMetaVo modelMetaVo = JSON.parseObject(meta, ModelMetaVo.class); + if (modelMetaVo.getParams() != null) { + branch.putAll(modelMetaVo.getParams()); + } + if (modelMetaVo.getMetrics() != null) { + branch.putAll(modelMetaVo.getMetrics()); + } + } + return new PageImpl<>(result, pageRequest, collect.size()); + } + @Override public List> getVersionList(String identifier, String owner) throws Exception { String token = gitService.checkoutToken(); - List> brancheList = gitService.getBrancheList(token, owner, identifier); - return brancheList.stream() + List> branchList = gitService.getBrancheList(token, owner, identifier); + return branchList.stream() .filter(branch -> !"master".equals(branch.get("name"))) .collect(Collectors.toList()); } diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml index 5266f05f..bc2a58fb 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml @@ -60,6 +60,15 @@ order by create_time desc limit 1 + + update model_dependency1 set state = 0 From 952f469fbc5a79c76c25b5020aa3e12bf3813074 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 16 Oct 2024 14:35:55 +0800 Subject: [PATCH 05/91] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../RuoYiManagementPlatformApplication.java | 2 + .../model/NewModelFromGitController.java | 7 ++++ .../platform/mapper/ModelDependency1Dao.java | 2 +- .../ruoyi/platform/service/AimService.java | 6 +++ .../ruoyi/platform/service/ModelsService.java | 2 + .../platform/service/impl/AimServiceImpl.java | 42 +++++++++++++++++++ .../service/impl/ExperimentServiceImpl.java | 2 +- .../service/impl/ModelsServiceImpl.java | 22 ++++++++-- .../com/ruoyi/platform/vo/ModelMetaVo.java | 3 ++ .../ModelDependency1DaoMapper.xml | 3 +- 10 files changed, 84 insertions(+), 7 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/RuoYiManagementPlatformApplication.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/RuoYiManagementPlatformApplication.java index b3b22ac9..a950808a 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/RuoYiManagementPlatformApplication.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/RuoYiManagementPlatformApplication.java @@ -5,6 +5,7 @@ import com.ruoyi.common.security.annotation.EnableRyFeignClients; import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; /** @@ -17,6 +18,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; @EnableRyFeignClients @SpringBootApplication @EnableScheduling +@EnableAsync public class RuoYiManagementPlatformApplication { public static void main(String[] args) { SpringApplication.run(RuoYiManagementPlatformApplication.class, args); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java index e7eb47ef..ab4c5925 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java @@ -84,6 +84,13 @@ public class NewModelFromGitController { return AjaxResult.success(this.modelsService.queryVersions(pageRequest, identifier, owner)); } + @GetMapping("/queryVersionsMetrics") + @ApiOperation("查询版本指标") + public AjaxResult queryVersionsMetrics(@RequestParam("runIds") List runIds) throws Exception { + return AjaxResult.success(this.modelsService.queryVersionsMetrics(runIds)); + } + + @GetMapping("/getVersionList") @ApiOperation(value = "获取模型分支列表") public AjaxResult getVersionList(@RequestParam("identifier") String identifier, @RequestParam("owner") String owner) throws Exception { diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java index c44bd8bd..721496ea 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java @@ -9,7 +9,7 @@ public interface ModelDependency1Dao { int insert(ModelDependency1 modelDependency1); - int updateState(@Param("repoId") Integer repoId, @Param("identifier") String identifier, @Param("version") String version, @Param("state") Integer state); + int updateState(@Param("repoId") Integer repoId, @Param("identifier") String identifier, @Param("version") String version, @Param("meta") String meta, @Param("state") Integer state); List queryModelDependency(@Param("modelName") String modelName, @Param("repoId") Integer repoId, @Param("owner") String owner); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java index 9f3868f5..b6c03292 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java @@ -2,7 +2,9 @@ package com.ruoyi.platform.service; import com.ruoyi.platform.vo.InsMetricInfoVo; +import java.util.HashMap; import java.util.List; +import java.util.Map; public interface AimService { @@ -13,4 +15,8 @@ public interface AimService { List getExpEvaluateInfos(Integer experimentId) throws Exception; String getExpMetrics(List runIds) throws Exception; + + HashMap queryMetricsParams(String runId) throws Exception; + + List> getBatchMetric(String runHash, String params); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java index 8b51d696..6c5f6a58 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java @@ -101,6 +101,8 @@ public interface ModelsService { Page> queryVersions(PageRequest pageRequest, String identifier, String owner) throws Exception; + List>> queryVersionsMetrics(List runIds) throws Exception; + List> getVersionList(String identifier, String owner) throws Exception; ModelsVo getModelDetail(Integer id, String identifier, String owner, String version) throws Exception; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index 1b754404..663158ba 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -1,5 +1,6 @@ package com.ruoyi.platform.service.impl; +import com.alibaba.fastjson2.JSON; import com.ruoyi.platform.domain.ExperimentIns; import com.ruoyi.platform.service.AimService; import com.ruoyi.platform.service.ExperimentInsService; @@ -13,6 +14,7 @@ import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.io.UnsupportedEncodingException; import java.net.URLEncoder; import java.util.*; import java.util.stream.Collectors; @@ -245,4 +247,44 @@ public class AimServiceImpl implements AimService { } return datasetList; } + + @Override + public HashMap queryMetricsParams(String runId) throws UnsupportedEncodingException { + String encodedUrlString = URLEncoder.encode("run.id==\"" + runId + "\"", "UTF-8"); + String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; + String s = httpUtils.sendGet(url, null); + List> response = JacksonUtil.parseJSONStr2MapList(s); + if (response == null || response.size() == 0) { + return new HashMap<>(); + } + + HashMap resultMap = new HashMap<>(); + List> paramList = new ArrayList<>(); + + Map map = response.get(0); + LinkedHashMap traces = (LinkedHashMap) map.get("traces"); + if (traces != null) { + List> metrics = traces.get("metric"); + for (Map metric : metrics) { + Map metricParam = new HashMap<>(); + metricParam.put("context", metric.get("context")); + metricParam.put("name", metric.get("name")); + paramList.add(metricParam); + } + resultMap.put("params", JSON.toJSONString(paramList)); + } + resultMap.put("run_hash", map.get("run_hash")); + return resultMap; + } + + @Override + public List> getBatchMetric(String runHash, String params) { + String url = aimUrl + "/api/runs/" + runHash + "/metric/get-batch"; + String response = httpUtils.sendPost(url, null, params); + if (StringUtils.isNotEmpty(response)) { + return JacksonUtil.parseJSONStr2MapList(response); + } + return null; + } + } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java index dfc8b5d4..e57296ca 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java @@ -560,7 +560,7 @@ public class ExperimentServiceImpl implements ExperimentService { //处理指标 HashMap metricMap = JSON.parseObject(metricRecord, HashMap.class); - modelMetaVo.setMetrics(metricMap); + modelMetaVo.setMetricsParams(metricMap); //训练数据集 List> trainDatasetList = (List>) modelTrainMap.get("datasets"); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index 8000a953..17a6093a 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -747,7 +747,7 @@ public class ModelsServiceImpl implements ModelsService { if (buildingModel != null) { modelMetaVo = JSON.parseObject(buildingModel.getMeta(), ModelMetaVo.class); //获取指标 - getMetrics(modelMetaVo); + transMetrics(modelMetaVo); } //拼接生产的元数据后写入yaml文件 @@ -806,7 +806,7 @@ public class ModelsServiceImpl implements ModelsService { modelDependency1Dao.insert(modelDependency); } else { //更新模型依赖 - modelDependency1Dao.updateState(modelsVo.getId(), modelsVo.getIdentifier(), modelsVo.getVersion(), Constant.State_valid); + modelDependency1Dao.updateState(modelsVo.getId(), modelsVo.getIdentifier(), modelsVo.getVersion(), meta, Constant.State_valid); } } else { //保存模型依赖 @@ -991,10 +991,24 @@ public class ModelsServiceImpl implements ModelsService { if (modelMetaVo.getMetrics() != null) { branch.putAll(modelMetaVo.getMetrics()); } + if (modelMetaVo.getMetricsParams() != null) { + branch.putAll(modelMetaVo.getMetricsParams()); + } } return new PageImpl<>(result, pageRequest, collect.size()); } + @Override + public List>> queryVersionsMetrics(List runIds) throws Exception { + List>> batchMetrics = new ArrayList<>(); + for (String runId : runIds) { + HashMap map = aimsService.queryMetricsParams(runId); + List> batchMetric = aimsService.getBatchMetric((String) map.get("run_hash"), (String) map.get("params")); + batchMetrics.add(batchMetric); + } + return batchMetrics; + } + @Override public List> getVersionList(String identifier, String owner) throws Exception { String token = gitService.checkoutToken(); @@ -1201,12 +1215,12 @@ public class ModelsServiceImpl implements ModelsService { return userInfo; } - void getMetrics(ModelMetaVo modelMetaVo) throws Exception { + void transMetrics(ModelMetaVo modelMetaVo) throws Exception { HashMap result = new HashMap<>(); HashMap train = new HashMap<>(); HashMap evaluate = new HashMap<>(); - HashMap metrics = modelMetaVo.getMetrics(); + HashMap metrics = modelMetaVo.getMetricsParams(); JSONArray trainMetrics = (JSONArray) metrics.get("train"); if (trainMetrics != null) { for (int i = 0; i < trainMetrics.size(); i++) { diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ModelMetaVo.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ModelMetaVo.java index e1b84905..2a5a538e 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ModelMetaVo.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ModelMetaVo.java @@ -59,6 +59,9 @@ public class ModelMetaVo implements Serializable { @ApiModelProperty(value = "指标") private HashMap metrics; + @ApiModelProperty(value = "指标查询参数") + private HashMap metricsParams; + @ApiModelProperty(value = "训练任务") private TrainTaskDepency trainTask; diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml index bc2a58fb..4e77a29b 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml @@ -86,7 +86,8 @@ update model_dependency1 - set state = 1 + set state = 1, + meta = #{meta} where repo_id = #{repoId} and identifier = #{identifier} and version = #{version} From 8e5a93ffb402bc7a0f506cc0f1896b55b63c68a8 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 16 Oct 2024 16:25:19 +0800 Subject: [PATCH 06/91] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/experiment/ExperimentInsController.java | 6 ++++++ .../com/ruoyi/platform/service/ExperimentInsService.java | 3 +++ .../platform/service/impl/ExperimentInsServiceImpl.java | 7 +++++++ 3 files changed, 16 insertions(+) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java index 1c36c1d2..8d18c409 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java @@ -106,6 +106,12 @@ public class ExperimentInsController extends BaseController { return genericsSuccess(this.experimentInsService.removeById(id)); } + @DeleteMapping("batchDelete") + @ApiOperation("批量删除实验实例") + public GenericsAjaxResult batchDelete(@RequestBody List ids) throws Exception{ + return genericsSuccess(this.experimentInsService.batchDelete(ids)); + } + /** * 终止实验实例 * diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java index 046e0186..3953a01e 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java @@ -73,6 +73,9 @@ public interface ExperimentInsService { * @param id 主键 * @return 是否成功 */ + + String batchDelete(List ids); + boolean deleteById(Integer id); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index 7b9c57f7..4b431689 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -230,6 +230,13 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { } + @Override + public String batchDelete(List ids) { + for (Integer id : ids) { + removeById(id); + } + return "删除成功"; + } /** From 4474d3a0034f7a385d756ebdbc583f517fdc7b86 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 16 Oct 2024 16:27:07 +0800 Subject: [PATCH 07/91] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ExperimentInsServiceImpl.java | 104 +++++++++--------- 1 file changed, 52 insertions(+), 52 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index 4b431689..4b73d671 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -36,13 +36,13 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { @Resource private WorkflowService workflowService; @Value("${argo.url}") - private String argoUrl; + private String argoUrl; @Value("${argo.convert}") - private String argoConvert; + private String argoConvert; @Value("${argo.workflowRun}") - private String argoWorkflowRun; + private String argoWorkflowRun; @Value("${argo.workflowStatus}") - private String argoWorkflowStatus; + private String argoWorkflowStatus; @Value("${argo.workflowTermination}") private String argoWorkflowTermination; @Value("${argo.workflowLog}") @@ -60,6 +60,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { @Resource private K8sClientUtil k8sClientUtil; private final MinioUtil minioUtil; + public ExperimentInsServiceImpl(MinioUtil minioUtil) { this.minioUtil = minioUtil; } @@ -97,8 +98,6 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { } /** - * - * * 根据实验ID查找所有具有相同ID的实例,并将它们添加到实验列表中 * * @param experimentId 实验ID @@ -187,8 +186,6 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { } - - /** * 修改数据 * @@ -207,7 +204,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { @Override public String removeById(Integer id) { ExperimentIns experimentIns = experimentInsDao.queryById(id); - if (experimentIns == null){ + if (experimentIns == null) { return "实验实例不存在"; } @@ -215,25 +212,28 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { LoginUser loginUser = SecurityUtils.getLoginUser(); String username = loginUser.getUsername(); String createdBy = experimentIns.getCreateBy(); - if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ + if (!(StringUtils.equals(username, "admin") || StringUtils.equals(username, createdBy))) { return "无权限删除该流水线"; } - if (StringUtils.isEmpty(experimentIns.getStatus())){ + if (StringUtils.isEmpty(experimentIns.getStatus())) { experimentIns = queryStatusFromArgo(experimentIns); } - if (StringUtils.equals(experimentIns.getStatus(),"Running")){ + if (StringUtils.equals(experimentIns.getStatus(), "Running")) { return "实验实例正在运行,不可删除"; } experimentIns.setState(0); - return this.experimentInsDao.update(experimentIns)>0?"删除成功":"删除失败"; + return this.experimentInsDao.update(experimentIns) > 0 ? "删除成功" : "删除失败"; } @Override public String batchDelete(List ids) { for (Integer id : ids) { - removeById(id); + String result = removeById(id); + if (!"删除成功".equals(result)) { + return result; + } } return "删除成功"; } @@ -263,16 +263,16 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { Integer id = ins.getId(); // 创建请求数据map ExperimentIns experimentIns = this.experimentInsDao.queryById(id); - Map requestData = new HashMap<>(); + Map requestData = new HashMap<>(); requestData.put("namespace", namespace); requestData.put("name", name); // 创建发送数据map,将请求数据作为"data"键的值 - Map res = new HashMap<>(); + Map res = new HashMap<>(); res.put("data", requestData); try { // 发送POST请求到Argo工作流状态查询接口,并将请求数据转换为JSON - String req = httpUtils.sendPost(argoUrl + argoWorkflowStatus,null, JsonUtils.mapToJson(res)); + String req = httpUtils.sendPost(argoUrl + argoWorkflowStatus, null, JsonUtils.mapToJson(res)); // 检查响应是否为空或无内容 if (req == null || StringUtils.isEmpty(req)) { throw new RuntimeException("工作流状态响应为空。"); @@ -300,10 +300,10 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { // 解析nodes字段,提取节点状态并转换为JSON字符串 Map nodes = (Map) status.get("nodes"); - Map modifiedNodes = new LinkedHashMap<>(); - if (nodes != null ) { + Map modifiedNodes = new LinkedHashMap<>(); + if (nodes != null) { for (Map.Entry nodeEntry : nodes.entrySet()) { - Map nodeDetails = (Map) nodeEntry.getValue(); + Map nodeDetails = (Map) nodeEntry.getValue(); String templateName = (String) nodeDetails.get("displayName"); modifiedNodes.put(templateName, nodeDetails); } @@ -313,10 +313,10 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { experimentIns.setNodesStatus(nodeStatusJson); //终止态为终止不改 - if (!StringUtils.equals(experimentIns.getStatus(),"Terminated")) { - experimentIns.setStatus(StringUtils.isNotEmpty((String) status.get("phase"))?(String) status.get("phase"):"Pending"); + if (!StringUtils.equals(experimentIns.getStatus(), "Terminated")) { + experimentIns.setStatus(StringUtils.isNotEmpty((String) status.get("phase")) ? (String) status.get("phase") : "Pending"); } - if (StringUtils.equals(experimentIns.getStatus(),"Error")) { + if (StringUtils.equals(experimentIns.getStatus(), "Error")) { experimentIns.setStatus("Failed"); } @@ -357,16 +357,16 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { } // 创建请求数据map - Map requestData = new HashMap<>(); + Map requestData = new HashMap<>(); requestData.put("namespace", namespace); requestData.put("name", name); // 创建发送数据map,将请求数据作为"data"键的值 - Map res = new HashMap<>(); + Map res = new HashMap<>(); res.put("data", requestData); try { // 发送POST请求到Argo工作流状态查询接口,并将请求数据转换为JSON - String req = httpUtils.sendPost(argoUrl + argoWorkflowTermination,null, JsonUtils.mapToJson(res)); + String req = httpUtils.sendPost(argoUrl + argoWorkflowTermination, null, JsonUtils.mapToJson(res)); // 检查响应是否为空或无内容 if (StringUtils.isEmpty(req)) { throw new RuntimeException("终止响应内容为空。"); @@ -430,20 +430,20 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { String namespace = experimentIns.getArgoInsNs(); // 创建请求数据的Json(map) - Map requestData = new HashMap<>(); + Map requestData = new HashMap<>(); requestData.put("namespace", namespace); requestData.put("name", name); //先写死这两个数据项 - requestData.put("workflow-type","workflows"); - requestData.put("artifact-name","main-logs"); - requestData.put("component-id",componentId); + requestData.put("workflow-type", "workflows"); + requestData.put("artifact-name", "main-logs"); + requestData.put("component-id", componentId); // 创建发送数据map,将请求数据作为"data"键的值 - Map res = new HashMap<>(); + Map res = new HashMap<>(); res.put("data", requestData); try { // 发送POST请求到Argo工作流日志查询接口,并将请求数据转换为JSON - String req = httpUtils.sendPost(argoUrl + argoWorkflowLog, null,JsonUtils.mapToJson(res)); + String req = httpUtils.sendPost(argoUrl + argoWorkflowLog, null, JsonUtils.mapToJson(res)); // 检查响应是否为空或无内容 if (StringUtils.isEmpty(req)) { throw new RuntimeException("响应内容为空"); @@ -452,7 +452,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { Map runResMap = JsonUtils.jsonToMap(req); // 从响应Map中获取"data"的值,也就是日志的值 String experimentInsLog = (String) runResMap.get("data"); - if (experimentInsLog == null){ + if (experimentInsLog == null) { throw new RuntimeException("日志为空。"); } //返回日志内容 @@ -470,28 +470,28 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { //查询 实例 ExperimentIns experimentIns = this.experimentInsDao.queryById(id); if (experimentIns == null) { - throw new Exception("实验实例未查询到,id:" + id); + throw new Exception("实验实例未查询到,id:" + id); } //找到 节点 节点结果 String nodesResultString = experimentIns.getNodesResult(); if (StringUtils.isEmpty(nodesResultString)) { - throw new Exception("实验实例未查询到节点结果,id:" + id); + throw new Exception("实验实例未查询到节点结果,id:" + id); } Map nodesResult = JsonUtils.jsonToMap(nodesResultString); Map paramOutput = (Map) nodesResult.get("param_output"); - List> nodeList = (List>) paramOutput.get(nodeId); + List> nodeList = (List>) paramOutput.get(nodeId); //遍历 查询minio for (int i = 0; i < nodeList.size(); i++) { Map map = nodeList.get(i); String path = (String) map.get("path"); String bucketName = path.substring(0, path.indexOf("/")); - String prefix = path.substring(path.indexOf("/")+1,path.length())+"/"; - if (StringUtils.equals( (String)map.get("type"),"file")){ + String prefix = path.substring(path.indexOf("/") + 1, path.length()) + "/"; + if (StringUtils.equals((String) map.get("type"), "file")) { List fileInfo = minioUtil.listFilesInDirectory(bucketName, prefix); - map.put("value",fileInfo); - }else if (StringUtils.equals( (String)map.get("type"),"string")){ + map.put("value", fileInfo); + } else if (StringUtils.equals((String) map.get("type"), "string")) { String resultInfo = minioUtil.readObjectAsString(bucketName, prefix); - map.put("value",resultInfo); + map.put("value", resultInfo); } results.add(map); //组装 @@ -508,14 +508,14 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { String taskId = logRequest.getTaskId(); String startTime = logRequest.getStartTime(); // 创建请求数据的Json(map) - Map requestData = new HashMap<>(); + Map requestData = new HashMap<>(); requestData.put("component_id", componentId); requestData.put("namespace", nameSpace); requestData.put("name", name); - requestData.put("task_id",taskId); - requestData.put("start_time",startTime); + requestData.put("task_id", taskId); + requestData.put("start_time", startTime); // 创建发送数据map,将请求数据作为"data"键的值 - Map res = new HashMap<>(); + Map res = new HashMap<>(); res.put("data", requestData); try { @@ -538,9 +538,9 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { @Override public Map getRealtimePodLog(String podName, String startTime) { - Map requestData = new HashMap<>(); - requestData.put("pod_name",podName); - requestData.put("start_time",startTime); + Map requestData = new HashMap<>(); + requestData.put("pod_name", podName); + requestData.put("start_time", startTime); try { // 将Map转换为JSON字符串 String req = HttpUtils.sendPost(argoUrl + argoWorkflowPodLog, JsonUtils.mapToJson(requestData)); @@ -561,7 +561,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { @Override public String getRealtimePodLogFromPod(PodLogVo podLogVo) { - return k8sClientUtil.getPodLogs(podLogVo.getPodName(), podLogVo.getNamespace(),podLogVo.getContainerName(), logsLines); + return k8sClientUtil.getPodLogs(podLogVo.getPodName(), podLogVo.getNamespace(), podLogVo.getContainerName(), logsLines); } @Override @@ -580,7 +580,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { experimentIns.setStatus(status.toString()); // 设置实例的状态为枚举中的状态 // 查询具有相同状态的实例数量 - Long count = experimentInsDao.count(experimentIns); + Long count = experimentInsDao.count(experimentIns); // 将状态及其对应的实例数量放入map中 statusCountMap.put(status.toString(), count); @@ -595,7 +595,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { boolean flag = true; List terminatedStates = Arrays.asList("Succeeded", "Failed"); flag = terminatedStates.contains(status); - if (StringUtils.equals(status, "Terminated")){ + if (StringUtils.equals(status, "Terminated")) { //如果跟node_status里面不一样,就要去更新node_status的信息 String nodesStatus = ins.getNodesStatus(); Map nodeMap = JsonUtils.jsonToMap(nodesStatus); @@ -604,7 +604,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { .findFirst() .orElse(null); Map workflowMap = (Map) nodeMap.get(keyStartsWithWorkflow); - if (workflowMap != null){ + if (workflowMap != null) { flag = StringUtils.equals("Terminated", (String) workflowMap.get("phase")); } } From 40d19ec2044275cd1df10bf0884668e7a597cf38 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 16 Oct 2024 16:53:16 +0800 Subject: [PATCH 08/91] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/service/impl/AimServiceImpl.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index 663158ba..ab11862b 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -5,9 +5,9 @@ import com.ruoyi.platform.domain.ExperimentIns; import com.ruoyi.platform.service.AimService; import com.ruoyi.platform.service.ExperimentInsService; import com.ruoyi.platform.utils.AIM64EncoderUtil; +import com.ruoyi.platform.utils.HttpUtils; import com.ruoyi.platform.utils.JacksonUtil; import com.ruoyi.platform.utils.JsonUtils; -import com.ruoyi.platform.utils.NewHttpUtils; import com.ruoyi.platform.vo.InsMetricInfoVo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; @@ -28,8 +28,6 @@ public class AimServiceImpl implements AimService { private String aimUrl; @Value("${aim.proxyUrl}") private String aimProxyUrl; - @Resource - private NewHttpUtils httpUtils; @Override public List getExpTrainInfos(Integer experimentId) throws Exception { @@ -54,7 +52,7 @@ public class AimServiceImpl implements AimService { } String encodedUrlString = URLEncoder.encode("run.experiment==\"" + experimentName + "\"", "UTF-8"); String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; - String s = httpUtils.sendGet(url, null); + String s = HttpUtils.sendGet(url, null); List> response = JacksonUtil.parseJSONStr2MapList(s); System.out.println("response: " + JacksonUtil.toJSONString(response)); if (response == null || response.size() == 0) { @@ -144,7 +142,7 @@ public class AimServiceImpl implements AimService { public List getExpTrainInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception { String encodedUrlString = URLEncoder.encode("run.id==\"" + runId + "\"", "UTF-8"); String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; - String s = httpUtils.sendGet(url, null); + String s = HttpUtils.sendGet(url, null); List> response = JacksonUtil.parseJSONStr2MapList(s); System.out.println("response: " + JacksonUtil.toJSONString(response)); if (response == null || response.size() == 0) { @@ -252,7 +250,7 @@ public class AimServiceImpl implements AimService { public HashMap queryMetricsParams(String runId) throws UnsupportedEncodingException { String encodedUrlString = URLEncoder.encode("run.id==\"" + runId + "\"", "UTF-8"); String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; - String s = httpUtils.sendGet(url, null); + String s = HttpUtils.sendGet(url, null); List> response = JacksonUtil.parseJSONStr2MapList(s); if (response == null || response.size() == 0) { return new HashMap<>(); @@ -280,7 +278,7 @@ public class AimServiceImpl implements AimService { @Override public List> getBatchMetric(String runHash, String params) { String url = aimUrl + "/api/runs/" + runHash + "/metric/get-batch"; - String response = httpUtils.sendPost(url, null, params); + String response = HttpUtils.sendPost(url, params); if (StringUtils.isNotEmpty(response)) { return JacksonUtil.parseJSONStr2MapList(response); } From 280eda9a5e66b2ddf076026c23c131d78df6cf86 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 16 Oct 2024 17:29:56 +0800 Subject: [PATCH 09/91] =?UTF-8?q?http=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/platform/service/impl/AimServiceImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index ab11862b..efb8b82e 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -28,6 +28,8 @@ public class AimServiceImpl implements AimService { private String aimUrl; @Value("${aim.proxyUrl}") private String aimProxyUrl; + @Resource + private HttpUtils httpUtils; @Override public List getExpTrainInfos(Integer experimentId) throws Exception { @@ -52,7 +54,7 @@ public class AimServiceImpl implements AimService { } String encodedUrlString = URLEncoder.encode("run.experiment==\"" + experimentName + "\"", "UTF-8"); String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; - String s = HttpUtils.sendGet(url, null); + String s = httpUtils.sendGet(url, null); List> response = JacksonUtil.parseJSONStr2MapList(s); System.out.println("response: " + JacksonUtil.toJSONString(response)); if (response == null || response.size() == 0) { From 7cdd3db3bdae9f6b60e9c3036704243da1f5aa03 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 16 Oct 2024 17:41:34 +0800 Subject: [PATCH 10/91] =?UTF-8?q?http=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/service/impl/AimServiceImpl.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index efb8b82e..acf82c8c 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -4,10 +4,7 @@ import com.alibaba.fastjson2.JSON; import com.ruoyi.platform.domain.ExperimentIns; import com.ruoyi.platform.service.AimService; import com.ruoyi.platform.service.ExperimentInsService; -import com.ruoyi.platform.utils.AIM64EncoderUtil; -import com.ruoyi.platform.utils.HttpUtils; -import com.ruoyi.platform.utils.JacksonUtil; -import com.ruoyi.platform.utils.JsonUtils; +import com.ruoyi.platform.utils.*; import com.ruoyi.platform.vo.InsMetricInfoVo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; @@ -29,7 +26,7 @@ public class AimServiceImpl implements AimService { @Value("${aim.proxyUrl}") private String aimProxyUrl; @Resource - private HttpUtils httpUtils; + private NewHttpUtils httpUtils; @Override public List getExpTrainInfos(Integer experimentId) throws Exception { From 25eb45de338d212be444c31311ed4afbf89e6bfb Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 16 Oct 2024 18:16:36 +0800 Subject: [PATCH 11/91] =?UTF-8?q?http=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/service/impl/AimServiceImpl.java | 2 +- .../com/ruoyi/platform/utils/HttpUtils.java | 25 +++++++++++-------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index acf82c8c..1ebc4a26 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -51,7 +51,7 @@ public class AimServiceImpl implements AimService { } String encodedUrlString = URLEncoder.encode("run.experiment==\"" + experimentName + "\"", "UTF-8"); String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; - String s = httpUtils.sendGet(url, null); + String s = HttpUtils.sendGet(url, null); List> response = JacksonUtil.parseJSONStr2MapList(s); System.out.println("response: " + JacksonUtil.toJSONString(response)); if (response == null || response.size() == 0) { diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java index 1de5d84e..6a130f0f 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java @@ -1,5 +1,6 @@ package com.ruoyi.platform.utils; +import com.ruoyi.common.core.utils.StringUtils; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; @@ -101,12 +102,13 @@ public class HttpUtils { // public static String sendGetWithToken(String url, String param,String token) { // return sendGet(url, param, "UTF-8",token); // } + /** * 向指定 URL 发送带 token 的 GET 方法的请求,使用 Apache HttpClient * - * @param url 发送请求的 URL - * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 - * @param token 认证 token + * @param url 发送请求的 URL + * @param param 请求参数,请求参数应该是 name1=value1&name2=value2 的形式。 + * @param token 认证 token * @return 所代表远程资源的响应结果 */ public static String sendGetWithToken(String url, String param, String token) { @@ -148,6 +150,7 @@ public class HttpUtils { } return result; } + /** * 向指定 URL 发送带token的GET方法的请求 * @@ -156,7 +159,7 @@ public class HttpUtils { * @param contentType 编码类型 * @return 所代表远程资源的响应结果 */ - public static String sendGet(String url, String param, String contentType,String token) { + public static String sendGet(String url, String param, String contentType, String token) { StringBuilder result = new StringBuilder(); BufferedReader in = null; try { @@ -196,7 +199,6 @@ public class HttpUtils { } - /** * 向指定 URL 发送GET方法的请求 * @@ -209,7 +211,10 @@ public class HttpUtils { StringBuilder result = new StringBuilder(); BufferedReader in = null; try { - String urlNameString = url + "?" + param; + String urlNameString = url; + if (StringUtils.isNotEmpty(param)) { + urlNameString = url + "?" + param; + } log.info("sendGet - {}", urlNameString); URL realUrl = new URL(urlNameString); URLConnection connection = realUrl.openConnection(); @@ -245,11 +250,11 @@ public class HttpUtils { /** * 向指定 URL 发送带token的POST方法的请求 * - * @param url 发送请求的 URL + * @param url 发送请求的 URL * @param * @return 所代表远程资源的响应结果 */ - public static String sendPostWithToken(String url, Object params, String token) throws Exception { + public static String sendPostWithToken(String url, Object params, String token) throws Exception { String resultStr = null; HttpPost httpPost = new HttpPost(url); if (params != null) { @@ -518,11 +523,10 @@ public class HttpUtils { } - /** * 发送 HTTP 请求并返回二进制数据流(OutputStream)。 * - * @param url 请求的 URL 地址。 + * @param url 请求的 URL 地址。 * @param headers 头节点。 * @return 服务器响应的二进制数据流(OutputStream)。 * @throws IOException 如果请求失败或发生其他 I/O 错误。 @@ -626,7 +630,6 @@ public class HttpUtils { } - // 其他方法保持不变 /** From 468bd01349e684ce2b5b116ee77e0ae0f8985021 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 16 Oct 2024 18:22:27 +0800 Subject: [PATCH 12/91] =?UTF-8?q?http=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/platform/service/impl/AimServiceImpl.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index 1ebc4a26..7fd7c706 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -25,8 +25,6 @@ public class AimServiceImpl implements AimService { private String aimUrl; @Value("${aim.proxyUrl}") private String aimProxyUrl; - @Resource - private NewHttpUtils httpUtils; @Override public List getExpTrainInfos(Integer experimentId) throws Exception { From 4703c07c7710e5b5fb6d69d409bcedd374f52b36 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 09:25:35 +0800 Subject: [PATCH 13/91] =?UTF-8?q?http=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/service/AimService.java | 2 +- .../platform/service/impl/AimServiceImpl.java | 4 ++-- .../service/impl/WorkflowServiceImpl.java | 3 ++- .../com/ruoyi/platform/utils/HttpUtils.java | 20 ++++++++++++++++--- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java index b6c03292..9a867ff8 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java @@ -18,5 +18,5 @@ public interface AimService { HashMap queryMetricsParams(String runId) throws Exception; - List> getBatchMetric(String runHash, String params); + List> getBatchMetric(String runHash, String body); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index 7fd7c706..fe364123 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -273,9 +273,9 @@ public class AimServiceImpl implements AimService { } @Override - public List> getBatchMetric(String runHash, String params) { + public List> getBatchMetric(String runHash, String body) { String url = aimUrl + "/api/runs/" + runHash + "/metric/get-batch"; - String response = HttpUtils.sendPost(url, params); + String response = HttpUtils.sendPost(url, null, body); if (StringUtils.isNotEmpty(response)) { return JacksonUtil.parseJSONStr2MapList(response); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java index 2b586f24..75921c4b 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.platform.domain.Workflow; import com.ruoyi.platform.mapper.WorkflowDao; import com.ruoyi.platform.service.ExperimentService; import com.ruoyi.platform.service.WorkflowService; +import com.ruoyi.platform.utils.HttpUtils; import com.ruoyi.platform.utils.JsonUtils; import com.ruoyi.platform.utils.MinioUtil; import com.ruoyi.platform.utils.NewHttpUtils; @@ -172,7 +173,7 @@ public class WorkflowServiceImpl implements WorkflowService { Map requestData = new HashMap<>(); requestData.put("data", oldDag); // 发送POST请求到Argo工作流复制接口,并将请求数据转换为JSON - String req = httpUtils.sendPost(argoUrl + argoWorkflowCopy,null , JsonUtils.mapToJson(requestData)); + String req = HttpUtils.sendPost(argoUrl + argoWorkflowCopy ,null, JsonUtils.mapToJson(requestData)); // 检查响应是否为空或无内容 if (StringUtils.isEmpty(req)) { throw new RuntimeException("工作流复制接口响应内容为空"); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java index 6a130f0f..b1e30064 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java @@ -1,5 +1,6 @@ package com.ruoyi.platform.utils; +import cn.hutool.http.HttpRequest; import com.ruoyi.common.core.utils.StringUtils; import lombok.extern.slf4j.Slf4j; import org.apache.http.HttpEntity; @@ -305,9 +306,9 @@ public class HttpUtils { conn.setRequestProperty("contentType", "utf-8"); conn.setDoOutput(true); conn.setDoInput(true); - out = new PrintWriter(conn.getOutputStream()); - out.print(param); - out.flush(); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); String line; while ((line = in.readLine()) != null) { @@ -337,6 +338,19 @@ public class HttpUtils { return result.toString(); } + public static String sendPost(String url, String param, String body){ + String urlNameString = url; + if (StringUtils.isNotEmpty(param)) { + urlNameString = url + "?" + param; + } + String response = HttpRequest.post(urlNameString) + .body(body) // 设置请求体 + .contentType("application/json") // 设置Content-Type + .execute() + .body(); + return response; + } + public static String sendSSLPost(String url, String param) { StringBuilder result = new StringBuilder(); String urlNameString = url + "?" + param; From a6c49e039e29b720f0fb18327243123019bc7ce3 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 09:43:22 +0800 Subject: [PATCH 14/91] =?UTF-8?q?http=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/service/impl/ExperimentInsServiceImpl.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index 4b73d671..59168810 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -272,7 +272,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { try { // 发送POST请求到Argo工作流状态查询接口,并将请求数据转换为JSON - String req = httpUtils.sendPost(argoUrl + argoWorkflowStatus, null, JsonUtils.mapToJson(res)); + String req = HttpUtils.sendPost(argoUrl + argoWorkflowStatus, null, JsonUtils.mapToJson(res)); // 检查响应是否为空或无内容 if (req == null || StringUtils.isEmpty(req)) { throw new RuntimeException("工作流状态响应为空。"); @@ -366,7 +366,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { try { // 发送POST请求到Argo工作流状态查询接口,并将请求数据转换为JSON - String req = httpUtils.sendPost(argoUrl + argoWorkflowTermination, null, JsonUtils.mapToJson(res)); + String req = HttpUtils.sendPost(argoUrl + argoWorkflowTermination, null, JsonUtils.mapToJson(res)); // 检查响应是否为空或无内容 if (StringUtils.isEmpty(req)) { throw new RuntimeException("终止响应内容为空。"); @@ -443,7 +443,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { try { // 发送POST请求到Argo工作流日志查询接口,并将请求数据转换为JSON - String req = httpUtils.sendPost(argoUrl + argoWorkflowLog, null, JsonUtils.mapToJson(res)); + String req = HttpUtils.sendPost(argoUrl + argoWorkflowLog, null, JsonUtils.mapToJson(res)); // 检查响应是否为空或无内容 if (StringUtils.isEmpty(req)) { throw new RuntimeException("响应内容为空"); From d059d63e58f660d6372f63f53c38bdd2b67f242a Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 09:44:45 +0800 Subject: [PATCH 15/91] =?UTF-8?q?http=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/proxy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-ui/config/proxy.ts b/react-ui/config/proxy.ts index 35232b47..93f990c1 100644 --- a/react-ui/config/proxy.ts +++ b/react-ui/config/proxy.ts @@ -20,7 +20,7 @@ export default { // localhost:8000/api/** -> https://preview.pro.ant.design/api/** '/api/': { // 要代理的地址 - target: 'http://172.20.32.185:31213', // 开发环境 + target: 'http://172.20.32.181:31213', // 开发环境 // target: 'http://172.20.32.98:8082', // target: 'http://172.20.32.150:8082', // 配置了这个可以从 http 代理到 https From ff0e2846aee0b7ff92afa5f6bb710932d03151c2 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 09:57:17 +0800 Subject: [PATCH 16/91] =?UTF-8?q?http=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ruoyi-modules/management-platform/pom.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ruoyi-modules/management-platform/pom.xml b/ruoyi-modules/management-platform/pom.xml index ba689d0e..cee6c681 100644 --- a/ruoyi-modules/management-platform/pom.xml +++ b/ruoyi-modules/management-platform/pom.xml @@ -242,6 +242,12 @@ jedis 3.6.0 + + + cn.hutool + hutool-all + 5.8.5 + From 4a15dd49e53e0c5c0dab38e36a675b6b1ea65cd1 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 09:59:44 +0800 Subject: [PATCH 17/91] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/proxy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-ui/config/proxy.ts b/react-ui/config/proxy.ts index 93f990c1..35232b47 100644 --- a/react-ui/config/proxy.ts +++ b/react-ui/config/proxy.ts @@ -20,7 +20,7 @@ export default { // localhost:8000/api/** -> https://preview.pro.ant.design/api/** '/api/': { // 要代理的地址 - target: 'http://172.20.32.181:31213', // 开发环境 + target: 'http://172.20.32.185:31213', // 开发环境 // target: 'http://172.20.32.98:8082', // target: 'http://172.20.32.150:8082', // 配置了这个可以从 http 代理到 https From a7c743e825a9866ddd434fe1e89cbd18cace5b9e Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Thu, 17 Oct 2024 10:52:45 +0800 Subject: [PATCH 18/91] =?UTF-8?q?fix:=20=E7=BB=9F=E4=B8=80tablecell=20rend?= =?UTF-8?q?er?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/CommonTableCell/index.tsx | 25 ----- .../src/components/DateTableCell/index.tsx | 20 ---- .../components/ResourceVersion/index.tsx | 23 ++--- .../DevelopmentEnvironment/List/index.tsx | 11 +-- .../src/pages/Experiment/Comparison/index.tsx | 13 +-- react-ui/src/pages/Experiment/index.jsx | 18 ++-- react-ui/src/pages/Mirror/Info/index.tsx | 11 +-- react-ui/src/pages/Mirror/List/index.tsx | 11 +-- .../src/pages/ModelDeployment/List/index.tsx | 28 +++--- .../ModelDeployment/ServiceInfo/index.tsx | 27 ++---- react-ui/src/pages/Pipeline/index.jsx | 27 +++--- react-ui/src/utils/table.tsx | 95 +++++++++++++++---- 12 files changed, 149 insertions(+), 160 deletions(-) delete mode 100644 react-ui/src/components/CommonTableCell/index.tsx delete mode 100644 react-ui/src/components/DateTableCell/index.tsx diff --git a/react-ui/src/components/CommonTableCell/index.tsx b/react-ui/src/components/CommonTableCell/index.tsx deleted file mode 100644 index c86ef9a9..00000000 --- a/react-ui/src/components/CommonTableCell/index.tsx +++ /dev/null @@ -1,25 +0,0 @@ -/* - * @Author: 赵伟 - * @Date: 2024-04-28 14:18:11 - * @Description: 自定义 Table 单元格,没有数据时展示 -- - */ - -import { Tooltip } from 'antd'; - -function renderCell(text?: any | null) { - return {text ?? '--'}; -} - -function CommonTableCell(ellipsis: boolean = false) { - if (ellipsis) { - return (text?: any | null) => ( - - {renderCell(text)} - - ); - } else { - return renderCell; - } -} - -export default CommonTableCell; diff --git a/react-ui/src/components/DateTableCell/index.tsx b/react-ui/src/components/DateTableCell/index.tsx deleted file mode 100644 index ea629ba7..00000000 --- a/react-ui/src/components/DateTableCell/index.tsx +++ /dev/null @@ -1,20 +0,0 @@ -/* - * @Author: 赵伟 - * @Date: 2024-04-28 14:18:11 - * @Description: 自定义 Table 日期类单元格 - */ - -import { formatDate } from '@/utils/date'; -import dayjs from 'dayjs'; - -function DateTableCell(text?: string | null) { - if (text === undefined || text === null || text === '') { - return --; - } - if (!dayjs(text).isValid()) { - return 无效的日期; - } - return {formatDate(text)}; -} - -export default DateTableCell; diff --git a/react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx b/react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx index b357ee00..4a6d190c 100644 --- a/react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx +++ b/react-ui/src/pages/Dataset/components/ResourceVersion/index.tsx @@ -1,5 +1,3 @@ -import CommonTableCell from '@/components/CommonTableCell'; -import DateTableCell from '@/components/DateTableCell'; import KFIcon from '@/components/KFIcon'; import { ResourceData, @@ -8,7 +6,8 @@ import { resourceConfig, } from '@/pages/Dataset/config'; import { downLoadZip } from '@/utils/downloadfile'; -import { Button, Flex, Table } from 'antd'; +import tableCellRender, { TableCellValueType } from '@/utils/table'; +import { Button, Flex, Table, TableProps } from 'antd'; import styles from './index.less'; type ResourceVersionProps = { @@ -38,37 +37,33 @@ function ResourceVersion({ resourceType, info }: ResourceVersionProps) { downLoadZip(url, { url: record.url }); }; - const columns = [ + const columns: TableProps['columns'] = [ { title: '序号', dataIndex: 'index', key: 'index', width: 80, - render(_text: string, _record: ResourceFileData, index: number) { - return {index + 1}; - }, + render: tableCellRender(false, TableCellValueType.Index), }, { title: '文件名称', dataIndex: 'file_name', key: 'file_name', - render: (text: string, record: ResourceFileData) => ( - downloadAlone(record)}> - {text} - - ), + render: tableCellRender(false, TableCellValueType.Link, { + onClick: downloadAlone, + }), }, { title: '文件大小', dataIndex: 'file_size', key: 'file_size', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '更新时间', dataIndex: 'update_time', key: 'update_time', - render: DateTableCell, + render: tableCellRender(false, TableCellValueType.Date), }, { title: '操作', diff --git a/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx b/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx index 3cbda163..b6a36e0f 100644 --- a/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx +++ b/react-ui/src/pages/DevelopmentEnvironment/List/index.tsx @@ -4,8 +4,6 @@ * @Description: 开发环境列表 */ -import CommonTableCell from '@/components/CommonTableCell'; -import DateTableCell from '@/components/DateTableCell'; import KFIcon from '@/components/KFIcon'; import { DevEditorStatus } from '@/enums'; import { useCacheState } from '@/hooks/pageCacheState'; @@ -19,6 +17,7 @@ import themes from '@/styles/theme.less'; import { openAntdModal } from '@/utils/modal'; import { to } from '@/utils/promise'; import SessionStorage from '@/utils/sessionStorage'; +import tableCellRender, { TableCellValueType } from '@/utils/table'; import { modalConfirm } from '@/utils/ui'; import { useNavigate } from '@umijs/max'; import { @@ -153,7 +152,7 @@ function EditorList() { }; // 分页切换 - const handleTableChange: TableProps['onChange'] = (pagination, filters, sorter, { action }) => { + const handleTableChange: TableProps['onChange'] = (pagination, _filters, _sorter, { action }) => { if (action === 'paginate') { setPagination(pagination); } @@ -186,21 +185,21 @@ function EditorList() { dataIndex: 'computing_resource', key: 'computing_resource', width: '20%', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '创建者', dataIndex: 'update_by', key: 'update_by', width: '20%', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '创建时间', dataIndex: 'create_time', key: 'create_time', width: '20%', - render: DateTableCell, + render: tableCellRender(false, TableCellValueType.Date), }, { title: '操作', diff --git a/react-ui/src/pages/Experiment/Comparison/index.tsx b/react-ui/src/pages/Experiment/Comparison/index.tsx index c4695d59..7c389c67 100644 --- a/react-ui/src/pages/Experiment/Comparison/index.tsx +++ b/react-ui/src/pages/Experiment/Comparison/index.tsx @@ -5,7 +5,7 @@ import { getExpTrainInfosReq, } from '@/services/experiment'; import { to } from '@/utils/promise'; -import tableCellRender, { arrayFormatter, dateFormatter } from '@/utils/table'; +import tableCellRender, { TableCellValueType } from '@/utils/table'; import { useSearchParams } from '@umijs/max'; import { App, Button, Table, /* TablePaginationConfig,*/ TableProps, Tooltip } from 'antd'; import classNames from 'classnames'; @@ -23,7 +23,7 @@ type TableData = { metrics_names: string[]; metrics: Record; params_names: string[]; - params: Record; + params: Record; }; function ExperimentComparison() { @@ -98,11 +98,12 @@ function ExperimentComparison() { }, }; - const columns: TableProps['columns'] = useMemo(() => { + const columns: TableProps['columns'] = useMemo(() => { const first: TableData | undefined = tableData[0]; return [ { title: '基本信息', + align: 'center', children: [ { title: '实例 ID', @@ -120,7 +121,7 @@ function ExperimentComparison() { width: 180, fixed: 'left', align: 'center', - render: tableCellRender(false, dateFormatter), + render: tableCellRender(false, TableCellValueType.Date), }, { title: '运行状态', @@ -128,7 +129,7 @@ function ExperimentComparison() { key: 'status', width: 100, fixed: 'left', - align: 'center', + // align: 'center', render: ExperimentStatusCell, }, { @@ -138,7 +139,7 @@ function ExperimentComparison() { width: 180, fixed: 'left', align: 'center', - render: tableCellRender(true, arrayFormatter()), + render: tableCellRender(true, TableCellValueType.Array), ellipsis: { showTitle: false }, }, ], diff --git a/react-ui/src/pages/Experiment/index.jsx b/react-ui/src/pages/Experiment/index.jsx index b09ba986..2d5bfba4 100644 --- a/react-ui/src/pages/Experiment/index.jsx +++ b/react-ui/src/pages/Experiment/index.jsx @@ -1,4 +1,3 @@ -import CommonTableCell from '@/components/CommonTableCell'; import KFIcon from '@/components/KFIcon'; import { ExperimentStatus, TensorBoardStatus } from '@/enums'; import { @@ -15,6 +14,7 @@ import { import { getWorkflow } from '@/services/pipeline/index.js'; import themes from '@/styles/theme.less'; import { to } from '@/utils/promise'; +import tableCellRender, { TableCellValueType } from '@/utils/table'; import { modalConfirm } from '@/utils/ui'; import { App, Button, ConfigProvider, Dropdown, Space, Table } from 'antd'; import classNames from 'classnames'; @@ -273,8 +273,7 @@ function Experiment() { }; // 跳转到流水线 - const gotoPipeline = (e, record) => { - e.stopPropagation(); + const gotoPipeline = (record) => { navigate({ pathname: `/pipeline/template/info/${record.workflow_id}` }); }; @@ -348,25 +347,23 @@ function Experiment() { title: '实验名称', dataIndex: 'name', key: 'name', - render: (text) =>
{text}
, + render: tableCellRender(), width: '16%', }, { title: '关联流水线名称', dataIndex: 'workflow_name', key: 'workflow_name', - render: (text, record) => ( - gotoPipeline(e, record)}> - {text} - - ), + render: tableCellRender(false, TableCellValueType.Link, { + onClick: gotoPipeline, + }), width: '16%', }, { title: '实验描述', dataIndex: 'description', key: 'description', - render: CommonTableCell(true), + render: tableCellRender(true), ellipsis: { showTitle: false }, }, { @@ -395,7 +392,6 @@ function Experiment() { ); }, }, - { title: '操作', key: 'action', diff --git a/react-ui/src/pages/Mirror/Info/index.tsx b/react-ui/src/pages/Mirror/Info/index.tsx index 7d5dcc17..a4100dbb 100644 --- a/react-ui/src/pages/Mirror/Info/index.tsx +++ b/react-ui/src/pages/Mirror/Info/index.tsx @@ -3,8 +3,6 @@ * @Date: 2024-04-16 13:58:08 * @Description: 镜像详情 */ -import CommonTableCell from '@/components/CommonTableCell'; -import DateTableCell from '@/components/DateTableCell'; import KFIcon from '@/components/KFIcon'; import PageTitle from '@/components/PageTitle'; import SubAreaTitle from '@/components/SubAreaTitle'; @@ -20,6 +18,7 @@ import themes from '@/styles/theme.less'; import { formatDate } from '@/utils/date'; import { to } from '@/utils/promise'; import SessionStorage from '@/utils/sessionStorage'; +import tableCellRender, { TableCellValueType } from '@/utils/table'; import { modalConfirm } from '@/utils/ui'; import { useNavigate, useParams } from '@umijs/max'; import { @@ -156,13 +155,13 @@ function MirrorInfo() { dataIndex: 'tag_name', key: 'tag_name', width: '25%', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '镜像地址', dataIndex: 'url', key: 'url', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '状态', @@ -176,14 +175,14 @@ function MirrorInfo() { dataIndex: 'file_size', key: 'file_size', width: 150, - render: CommonTableCell(), + render: tableCellRender(), }, { title: '创建时间', dataIndex: 'create_time', key: 'create_time', width: 200, - render: DateTableCell, + render: tableCellRender(false, TableCellValueType.Date), }, { title: '操作', diff --git a/react-ui/src/pages/Mirror/List/index.tsx b/react-ui/src/pages/Mirror/List/index.tsx index 1408dac8..0aee1808 100644 --- a/react-ui/src/pages/Mirror/List/index.tsx +++ b/react-ui/src/pages/Mirror/List/index.tsx @@ -3,8 +3,6 @@ * @Date: 2024-04-16 13:58:08 * @Description: 镜像列表 */ -import CommonTableCell from '@/components/CommonTableCell'; -import DateTableCell from '@/components/DateTableCell'; import KFIcon from '@/components/KFIcon'; import { CommonTabKeys } from '@/enums'; import { useCacheState } from '@/hooks/pageCacheState'; @@ -12,6 +10,7 @@ import { deleteMirrorReq, getMirrorListReq } from '@/services/mirror'; import themes from '@/styles/theme.less'; import { to } from '@/utils/promise'; import SessionStorage from '@/utils/sessionStorage'; +import tableCellRender, { TableCellValueType } from '@/utils/table'; import { modalConfirm } from '@/utils/ui'; import { useNavigate } from '@umijs/max'; import { @@ -169,21 +168,21 @@ function MirrorList() { dataIndex: 'name', key: 'name', width: '30%', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '版本数据', dataIndex: 'version_count', key: 'version_count', width: '15%', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '镜像描述', dataIndex: 'description', key: 'description', width: '35%', - render: CommonTableCell(true), + render: tableCellRender(true), ellipsis: { showTitle: false }, }, { @@ -191,7 +190,7 @@ function MirrorList() { dataIndex: 'create_time', key: 'create_time', width: '20%', - render: DateTableCell, + render: tableCellRender(false, TableCellValueType.Date), }, { title: '操作', diff --git a/react-ui/src/pages/ModelDeployment/List/index.tsx b/react-ui/src/pages/ModelDeployment/List/index.tsx index 2667f5a2..e6c77b18 100644 --- a/react-ui/src/pages/ModelDeployment/List/index.tsx +++ b/react-ui/src/pages/ModelDeployment/List/index.tsx @@ -3,8 +3,6 @@ * @Date: 2024-04-16 13:58:08 * @Description: 模型部署服务列表 */ -import CommonTableCell from '@/components/CommonTableCell'; -import DateTableCell from '@/components/DateTableCell'; import KFIcon from '@/components/KFIcon'; import PageTitle from '@/components/PageTitle'; import { serviceTypeOptions } from '@/enums'; @@ -13,6 +11,7 @@ import { deleteServiceReq, getServiceListReq } from '@/services/modelDeployment' import themes from '@/styles/theme.less'; import { to } from '@/utils/promise'; import SessionStorage from '@/utils/sessionStorage'; +import tableCellRender, { TableCellValueType } from '@/utils/table'; import { modalConfirm } from '@/utils/ui'; import { useNavigate } from '@umijs/max'; import { @@ -190,42 +189,39 @@ function ModelDeployment() { dataIndex: 'index', key: 'index', width: '20%', - render(_text, _record, index) { - return {(pagination.current! - 1) * pagination.pageSize! + index + 1}; - }, + render: tableCellRender(false, TableCellValueType.PageIndex, { + page: pagination.current! - 1, + pageSize: pagination.pageSize!, + }), }, { title: '服务名称', dataIndex: 'service_name', key: 'service_name', width: '20%', - render: (text, record) => { - return ( - toDetail(record)}> - {text} - - ); - }, + render: tableCellRender(false, TableCellValueType.Link, { + onClick: toDetail, + }), }, { title: '服务类型', dataIndex: 'service_type_name', key: 'service_type_name', width: '20%', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '版本数量', dataIndex: 'version_count', key: 'version_count', width: '20%', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '服务描述', dataIndex: 'description', key: 'description', - render: CommonTableCell(), + render: tableCellRender(), width: '20%', }, { @@ -233,7 +229,7 @@ function ModelDeployment() { dataIndex: 'update_time', key: 'update_time', width: '20%', - render: DateTableCell, + render: tableCellRender(false, TableCellValueType.Date), }, { title: '操作', diff --git a/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx b/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx index e14b829d..c00b1ea0 100644 --- a/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx +++ b/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx @@ -4,7 +4,6 @@ * @Description: 模型部署列表 */ import BasicInfo from '@/components/BasicInfo'; -import CommonTableCell from '@/components/CommonTableCell'; import KFIcon from '@/components/KFIcon'; import PageTitle from '@/components/PageTitle'; import SubAreaTitle from '@/components/SubAreaTitle'; @@ -21,6 +20,7 @@ import themes from '@/styles/theme.less'; import { formatDate } from '@/utils/date'; import { to } from '@/utils/promise'; import SessionStorage from '@/utils/sessionStorage'; +import tableCellRender, { TableCellValueType } from '@/utils/table'; import { modalConfirm } from '@/utils/ui'; import { useNavigate, useParams } from '@umijs/max'; import { @@ -222,31 +222,24 @@ function ServiceInfo() { dataIndex: 'index', key: 'index', width: '20%', - render(_text, _record, index) { - return {(pagination.current! - 1) * pagination.pageSize! + index + 1}; - }, + render: tableCellRender(false, TableCellValueType.PageIndex, { + page: pagination.current! - 1, + pageSize: pagination.pageSize!, + }), }, { title: '服务版本', dataIndex: 'version', key: 'version', width: '20%', - render: CommonTableCell(), + render: tableCellRender(), }, { title: '模型版本', - dataIndex: 'model', + dataIndex: ['model', 'show_value'], key: 'model', width: '20%', - render: (_text: string, record: ServiceVersionData) => ( - - {record.model.show_value} - - ), + render: tableCellRender(true), ellipsis: { showTitle: false }, }, { @@ -261,14 +254,14 @@ function ServiceInfo() { dataIndex: 'image', key: 'image', width: '20%', - render: CommonTableCell(true), + render: tableCellRender(true), ellipsis: { showTitle: false }, }, { title: '副本数量', dataIndex: 'replicas', key: 'replicas', - render: CommonTableCell(), + render: tableCellRender(), width: '20%', }, { diff --git a/react-ui/src/pages/Pipeline/index.jsx b/react-ui/src/pages/Pipeline/index.jsx index 371c3f4c..4374b24c 100644 --- a/react-ui/src/pages/Pipeline/index.jsx +++ b/react-ui/src/pages/Pipeline/index.jsx @@ -1,5 +1,3 @@ -import CommonTableCell from '@/components/CommonTableCell'; -import DateTableCell from '@/components/DateTableCell'; import KFIcon from '@/components/KFIcon'; import KFModal from '@/components/KFModal'; import { @@ -11,6 +9,7 @@ import { removeWorkflow, } from '@/services/pipeline/index.js'; import themes from '@/styles/theme.less'; +import tableCellRender, { TableCellValueType } from '@/utils/table'; import { modalConfirm } from '@/utils/ui'; import { App, Button, ConfigProvider, Form, Input, Space, Table } from 'antd'; import classNames from 'classnames'; @@ -41,8 +40,7 @@ const Pipeline = () => { } }); }; - const routeToEdit = (e, record) => { - e.stopPropagation(); + const routeToEdit = (record) => { navigate({ pathname: `/pipeline/template/info/${record.id}` }); }; const showModal = () => { @@ -114,38 +112,37 @@ const Pipeline = () => { key: 'index', width: 120, align: 'center', - render(text, record, index) { - return {(pageOption.current.page - 1) * pageOption.current.size + index + 1}; - }, + render: tableCellRender(false, TableCellValueType.PageIndex, { + page: pageOption.current.page - 1, + size: pageOption.current.size, + }), }, { title: '流水线名称', dataIndex: 'name', key: 'name', - render: (text, record) => ( - routeToEdit(e, record)}> - {text} - - ), + render: tableCellRender(false, TableCellValueType.Link, { + onClick: routeToEdit, + }), }, { title: '流水线描述', dataIndex: 'description', key: 'description', - render: CommonTableCell(true), + render: tableCellRender(true), ellipsis: { showTitle: false }, }, { title: '创建时间', dataIndex: 'create_time', key: 'create_time', - render: DateTableCell, + render: tableCellRender(false, TableCellValueType.Date), }, { title: '修改时间', dataIndex: 'update_time', key: 'update_time', - render: DateTableCell, + render: tableCellRender(false, TableCellValueType.Date), }, { title: '操作', diff --git a/react-ui/src/utils/table.tsx b/react-ui/src/utils/table.tsx index 3058284a..1353fe09 100644 --- a/react-ui/src/utils/table.tsx +++ b/react-ui/src/utils/table.tsx @@ -1,22 +1,33 @@ /* * @Author: 赵伟 * @Date: 2024-06-26 10:05:52 - * @Description: 列表自定义 render + * @Description: Table cell 自定义 render */ import { formatDate } from '@/utils/date'; import { Tooltip } from 'antd'; import dayjs from 'dayjs'; -type TableCellFormatter = (value?: any | null) => string | undefined | null; +export enum TableCellValueType { + Index = 'Index', + PageIndex = 'PageIndex', + Text = 'Text', + Date = 'Date', + Array = 'Array', + Link = 'Link', +} -// 字符串转换函数 -export const stringFormatter: TableCellFormatter = (value?: any | null) => { - return value; +export type TableCellValueOptions = { + page?: number; + pageSize?: number; + property?: string; + onClick?: (record: T, e: React.MouseEvent) => void; }; +type TableCellFormatter = (value: any | undefined | null) => string | undefined | null; + // 日期转换函数 -export const dateFormatter: TableCellFormatter = (value?: any | null) => { +const formatDateText: TableCellFormatter = (value?: any | null) => { if (value === undefined || value === null || value === '') { return null; } @@ -26,8 +37,12 @@ export const dateFormatter: TableCellFormatter = (value?: any | null) => { return formatDate(value); }; -// 数组转换函数 -export function arrayFormatter(property?: string) { +/** + * 数组转换函数,将数组元素转换为字符串,用逗号分隔 + * @param {string} property 如果数组元素是对象,那么取数组元素的某个属性 + * @returns {TableCellFormatter} Table cell 渲染函数 + */ +function formatArray(property?: string): TableCellFormatter { return (value?: any | null): ReturnType => { if ( value === undefined || @@ -38,31 +53,75 @@ export function arrayFormatter(property?: string) { return null; } - let list = value; - if (property && typeof value[0] === 'object') { - list = value.map((item) => item[property]); - } + const list = + property && typeof value[0] === 'object' ? value.map((item) => item[property]) : value; return list.join(','); }; } -function tableCellRender(ellipsis: boolean = false, format: TableCellFormatter = stringFormatter) { - return (value?: any | null) => { - const text = format(value); +function tableCellRender( + ellipsis: boolean = false, + type: TableCellValueType = TableCellValueType.Text, + options?: TableCellValueOptions, +) { + return (value: any | undefined | null, record: T, index: number) => { + let text = value; + switch (type) { + case TableCellValueType.Index: + text = index + 1; + break; + case TableCellValueType.PageIndex: + text = (options?.page ?? 1) * (options?.pageSize ?? 10) + index + 1; + break; + case TableCellValueType.Text: + case TableCellValueType.Link: + text = value; + break; + case TableCellValueType.Date: + text = formatDateText(value); + break; + case TableCellValueType.Array: + text = formatArray(options?.property)(value); + break; + default: + break; + } + if (ellipsis && text) { return ( - {renderCell(text)} + {renderCell(text, type === TableCellValueType.Link, record, options?.onClick)} ); } else { - return renderCell(text); + return renderCell(text, type === TableCellValueType.Link, record, options?.onClick); } }; } -function renderCell(text?: any | null) { +function renderCell( + text: any | undefined | null, + isLink: boolean, + record: T, + onClick?: (record: T, e: React.MouseEvent) => void, +) { + return isLink ? renderLink(text, record, onClick) : renderText(text); +} + +function renderText(text: any | undefined | null) { return {text ?? '--'}; } +function renderLink( + text: any | undefined | null, + record: T, + onClick?: (record: T, e: React.MouseEvent) => void, +) { + return ( + onClick?.(record, e)}> + {text} + + ); +} + export default tableCellRender; From 2caa5286e5afe4b99d14ede3036d8b2d20b61c59 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 11:27:42 +0800 Subject: [PATCH 19/91] =?UTF-8?q?=E6=9F=A5=E8=AF=A2=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/constant/Constant.java | 3 + .../model/NewModelFromGitController.java | 10 +-- .../ruoyi/platform/service/ModelsService.java | 5 +- .../service/impl/ModelsServiceImpl.java | 69 ++++++++++++++----- 4 files changed, 65 insertions(+), 22 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/constant/Constant.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/constant/Constant.java index 12300bb1..b325cc5d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/constant/Constant.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/constant/Constant.java @@ -31,4 +31,7 @@ public class Constant { public final static String Pending = "Pending"; public final static String Init = "Init"; public final static String Stopped = "Stopped"; + + public final static String Type_Train = "train"; + public final static String Type_Evaluate = "evaluate"; } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java index ab4c5925..958a78bf 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java @@ -1,6 +1,7 @@ package com.ruoyi.platform.controller.model; import com.ruoyi.common.core.web.domain.AjaxResult; +import com.ruoyi.platform.domain.ModelDependency1; import com.ruoyi.platform.service.ModelsService; import com.ruoyi.platform.vo.ModelsVo; import io.swagger.annotations.Api; @@ -79,15 +80,16 @@ public class NewModelFromGitController { public AjaxResult queryVersions(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size, @RequestParam("identifier") String identifier, - @RequestParam("owner") String owner) throws Exception { + @RequestParam("owner") String owner, + @RequestParam("type") String type) throws Exception { PageRequest pageRequest = PageRequest.of(page, size); - return AjaxResult.success(this.modelsService.queryVersions(pageRequest, identifier, owner)); + return AjaxResult.success(this.modelsService.queryVersions(pageRequest, identifier, owner, type)); } @GetMapping("/queryVersionsMetrics") @ApiOperation("查询版本指标") - public AjaxResult queryVersionsMetrics(@RequestParam("runIds") List runIds) throws Exception { - return AjaxResult.success(this.modelsService.queryVersionsMetrics(runIds)); + public AjaxResult queryVersionsMetrics(@RequestParam("params") List params, @RequestParam("type") String type) throws Exception { + return AjaxResult.success(this.modelsService.queryVersionsMetrics(params, type)); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java index 6c5f6a58..72ad75dd 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java @@ -1,6 +1,7 @@ package com.ruoyi.platform.service; +import com.ruoyi.platform.domain.ModelDependency1; import com.ruoyi.platform.domain.Models; import com.ruoyi.platform.domain.ModelsVersion; import com.ruoyi.platform.vo.ModelDependency1TreeVo; @@ -99,9 +100,9 @@ public interface ModelsService { Page newPersonalQueryByPage(ModelsVo modelsVo, PageRequest pageRequest) throws Exception; - Page> queryVersions(PageRequest pageRequest, String identifier, String owner) throws Exception; + Page> queryVersions(PageRequest pageRequest, String identifier, String owner, String type) throws Exception; - List>> queryVersionsMetrics(List runIds) throws Exception; + List queryVersionsMetrics(List params, String type) throws Exception; List> getVersionList(String identifier, String owner) throws Exception; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index f4d06f2f..431077b4 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -974,7 +974,7 @@ public class ModelsServiceImpl implements ModelsService { } @Override - public Page> queryVersions(PageRequest pageRequest, String identifier, String owner) throws Exception { + public Page> queryVersions(PageRequest pageRequest, String identifier, String owner, String type) throws Exception { String token = gitService.checkoutToken(); List> collect = gitService.getBrancheList(token, owner, identifier); List> result = collect.stream() @@ -984,27 +984,45 @@ public class ModelsServiceImpl implements ModelsService { for (Map branch : result) { String meta = modelDependency1Dao.getMeta(identifier, owner, (String) branch.get("name")); - ModelMetaVo modelMetaVo = JSON.parseObject(meta, ModelMetaVo.class); - if (modelMetaVo.getParams() != null) { - branch.putAll(modelMetaVo.getParams()); - } - if (modelMetaVo.getMetrics() != null) { - branch.putAll(modelMetaVo.getMetrics()); - } - if (modelMetaVo.getMetricsParams() != null) { - branch.putAll(modelMetaVo.getMetricsParams()); + if (StringUtils.isNotEmpty(meta)) { + ModelMetaVo modelMetaVo = JSON.parseObject(meta, ModelMetaVo.class); + if (modelMetaVo.getParams() != null) { + HashMap params = modelMetaVo.getParams(); + branch.putAll(params); + ArrayList params_names = new ArrayList<>(); + for (String key : params.keySet()) { + params_names.add(key); + } + branch.put("params_names", params_names); + } + if (modelMetaVo.getMetrics() != null) { + HashMap metrics = modelMetaVo.getMetrics(); + if (Constant.Type_Train.equals(type)) { + Map trainMetrics = (Map) metrics.get(Constant.Type_Train); + branch.putAll(trainMetrics); + } else { + Map evaluateMetrics = (Map) metrics.get(Constant.Type_Evaluate); + branch.putAll(evaluateMetrics); + } + } } } return new PageImpl<>(result, pageRequest, collect.size()); } @Override - public List>> queryVersionsMetrics(List runIds) throws Exception { - List>> batchMetrics = new ArrayList<>(); - for (String runId : runIds) { - HashMap map = aimsService.queryMetricsParams(runId); - List> batchMetric = aimsService.getBatchMetric((String) map.get("run_hash"), (String) map.get("params")); - batchMetrics.add(batchMetric); + public List queryVersionsMetrics(List params, String type) { + List batchMetrics = new ArrayList<>(); + for (ModelDependency1 model : params) { + + ModelDependency1 modelDependency1 = modelDependency1Dao.queryByRepoAndVersion(model.getRepoId(), model.getIdentifier(), model.getVersion()); + ModelMetaVo modelMetaVo = JSON.parseObject(modelDependency1.getMeta(), ModelMetaVo.class); + HashMap metrics = modelMetaVo.getMetrics(); + if (Constant.Type_Train.equals(type)) { + batchMetrics.add(metrics.get("tarinDetail")); + } else { + batchMetrics.add(metrics.get("evaluateDetail")); + } } return batchMetrics; } @@ -1220,6 +1238,9 @@ public class ModelsServiceImpl implements ModelsService { HashMap train = new HashMap<>(); HashMap evaluate = new HashMap<>(); + List>> trainBatchMetrics = new ArrayList<>(); + List>> evaluateBatchMetrics = new ArrayList<>(); + HashMap metrics = modelMetaVo.getMetricsParams(); JSONArray trainMetrics = (JSONArray) metrics.get("train"); if (trainMetrics != null) { @@ -1231,8 +1252,16 @@ public class ModelsServiceImpl implements ModelsService { Map metrics1 = expTrainInfo.getMetrics(); train.putAll(metrics1); } + + // 记录训练指标详情 + HashMap map = aimsService.queryMetricsParams(runId); + List> batchMetric = aimsService.getBatchMetric((String) map.get("run_hash"), (String) map.get("params")); + trainBatchMetrics.add(batchMetric); + } result.put("train", train); + result.put("tarinDetail", trainBatchMetrics); + } JSONArray testMetrics = (JSONArray) metrics.get("evaluate"); @@ -1245,8 +1274,16 @@ public class ModelsServiceImpl implements ModelsService { Map metrics1 = expTestInfo.getMetrics(); evaluate.putAll(metrics1); } + + // 记录验证指标详情 + HashMap map = aimsService.queryMetricsParams(runId); + List> batchMetric = aimsService.getBatchMetric((String) map.get("run_hash"), (String) map.get("params")); + evaluateBatchMetrics.add(batchMetric); + } result.put("evaluate", evaluate); + result.put("evaluateDetail", evaluateBatchMetrics); + } modelMetaVo.setMetrics(result); } From fd948f7150d47c384d069c1c9ea7813bea5d1174 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 14:04:34 +0800 Subject: [PATCH 20/91] =?UTF-8?q?http=E6=9F=A5=E8=AF=A2=E4=BF=AE=E6=94=B9?= =?UTF-8?q?=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/utils/HttpUtils.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java index b1e30064..0b6db3df 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/HttpUtils.java @@ -284,6 +284,13 @@ public class HttpUtils { return resultStr; } + private static void clearProxySettings() { + System.clearProperty("http.proxyHost"); + System.clearProperty("http.proxyPort"); + System.clearProperty("https.proxyHost"); + System.clearProperty("https.proxyPort"); + } + /** * 向指定 URL 发送POST方法的请求 * @@ -292,6 +299,7 @@ public class HttpUtils { * @return 所代表远程资源的响应结果 */ public static String sendPost(String url, String param) { + clearProxySettings(); PrintWriter out = null; BufferedReader in = null; StringBuilder result = new StringBuilder(); @@ -306,9 +314,9 @@ public class HttpUtils { conn.setRequestProperty("contentType", "utf-8"); conn.setDoOutput(true); conn.setDoInput(true); - out = new PrintWriter(conn.getOutputStream()); - out.print(param); - out.flush(); + out = new PrintWriter(conn.getOutputStream()); + out.print(param); + out.flush(); in = new BufferedReader(new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8)); String line; while ((line = in.readLine()) != null) { @@ -338,7 +346,8 @@ public class HttpUtils { return result.toString(); } - public static String sendPost(String url, String param, String body){ + public static String sendPost(String url, String param, String body) { + clearProxySettings(); String urlNameString = url; if (StringUtils.isNotEmpty(param)) { urlNameString = url + "?" + param; From a4f7e150395a7c84fc18403dcd8c193b808bdd5d Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 14:48:01 +0800 Subject: [PATCH 21/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/controller/model/NewModelFromGitController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java index 958a78bf..be6ebee7 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java @@ -86,9 +86,9 @@ public class NewModelFromGitController { return AjaxResult.success(this.modelsService.queryVersions(pageRequest, identifier, owner, type)); } - @GetMapping("/queryVersionsMetrics") + @PostMapping("/queryVersionsMetrics") @ApiOperation("查询版本指标") - public AjaxResult queryVersionsMetrics(@RequestParam("params") List params, @RequestParam("type") String type) throws Exception { + public AjaxResult queryVersionsMetrics(@RequestBody List params, @RequestParam("type") String type) throws Exception { return AjaxResult.success(this.modelsService.queryVersionsMetrics(params, type)); } From d8f65f337538ed5f86bf1f666464e3bcb489de7b Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Thu, 17 Oct 2024 15:01:32 +0800 Subject: [PATCH 22/91] =?UTF-8?q?chore:=20=E5=88=A0=E9=99=A4openapi?= =?UTF-8?q?=E7=9A=84=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/config.ts | 16 +- react-ui/config/oneapi.json | 593 ------------------ react-ui/src/services/ant-design-pro/api.ts | 11 - react-ui/src/services/ant-design-pro/index.ts | 12 - react-ui/src/services/ant-design-pro/login.ts | 38 -- react-ui/src/services/ant-design-pro/rule.ts | 42 -- .../src/services/ant-design-pro/typings.d.ts | 114 ---- react-ui/src/services/swagger/index.ts | 12 - react-ui/src/services/swagger/pet.ts | 153 ----- react-ui/src/services/swagger/store.ts | 48 -- react-ui/src/services/swagger/typings.d.ts | 112 ---- react-ui/src/services/swagger/user.ts | 100 --- 12 files changed, 1 insertion(+), 1250 deletions(-) delete mode 100644 react-ui/config/oneapi.json delete mode 100644 react-ui/src/services/ant-design-pro/api.ts delete mode 100644 react-ui/src/services/ant-design-pro/index.ts delete mode 100644 react-ui/src/services/ant-design-pro/login.ts delete mode 100644 react-ui/src/services/ant-design-pro/rule.ts delete mode 100644 react-ui/src/services/ant-design-pro/typings.d.ts delete mode 100644 react-ui/src/services/swagger/index.ts delete mode 100644 react-ui/src/services/swagger/pet.ts delete mode 100644 react-ui/src/services/swagger/store.ts delete mode 100644 react-ui/src/services/swagger/typings.d.ts delete mode 100644 react-ui/src/services/swagger/user.ts diff --git a/react-ui/config/config.ts b/react-ui/config/config.ts index 515b79cb..c10b23b6 100644 --- a/react-ui/config/config.ts +++ b/react-ui/config/config.ts @@ -1,6 +1,5 @@ // https://umijs.org/config/ import { defineConfig } from '@umijs/max'; -import { join } from 'path'; import defaultSettings from './defaultSettings'; import proxy from './proxy'; import routes from './routes'; @@ -145,20 +144,7 @@ export default defineConfig({ * @description 基于 openapi 的规范生成serve 和mock,能减少很多样板代码 * @doc https://pro.ant.design/zh-cn/docs/openapi/ */ - openAPI: [ - { - requestLibPath: "import { request } from '@umijs/max'", - // 或者使用在线的版本 - // schemaPath: "https://gw.alipayobjects.com/os/antfincdn/M%24jrzTTYJN/oneapi.json" - schemaPath: join(__dirname, 'oneapi.json'), - mock: false, - }, - { - requestLibPath: "import { request } from '@umijs/max'", - schemaPath: 'https://gw.alipayobjects.com/os/antfincdn/CA1dOm%2631B/openapi.json', - projectName: 'swagger', - }, - ], + // openAPI: [], // mfsu: { // strategy: 'normal', // }, diff --git a/react-ui/config/oneapi.json b/react-ui/config/oneapi.json deleted file mode 100644 index c77d988b..00000000 --- a/react-ui/config/oneapi.json +++ /dev/null @@ -1,593 +0,0 @@ -{ - "openapi": "3.0.1", - "info": { - "title": "Ant Design Pro", - "version": "1.0.0" - }, - "servers": [ - { - "url": "http://localhost:8000/" - }, - { - "url": "https://localhost:8000/" - } - ], - "paths": { - "/api/currentUser": { - "get": { - "tags": ["api"], - "description": "获取当前的用户", - "operationId": "currentUser", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/CurrentUser" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "x-swagger-router-controller": "api" - }, - "/api/login/captcha": { - "post": { - "description": "发送验证码", - "operationId": "getFakeCaptcha", - "tags": ["login"], - "parameters": [ - { - "name": "phone", - "in": "query", - "description": "手机号", - "schema": { - "type": "string" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/FakeCaptcha" - } - } - } - } - } - } - }, - "/api/login/outLogin": { - "post": { - "description": "登录接口", - "operationId": "outLogin", - "tags": ["login"], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "x-swagger-router-controller": "api" - }, - "/api/login/account": { - "post": { - "tags": ["login"], - "description": "登录接口", - "operationId": "login", - "requestBody": { - "description": "登录系统", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoginParams" - } - } - }, - "required": true - }, - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/LoginResult" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - }, - "x-codegen-request-body-name": "body" - }, - "x-swagger-router-controller": "api" - }, - "/api/notices": { - "summary": "getNotices", - "description": "NoticeIconItem", - "get": { - "tags": ["api"], - "operationId": "getNotices", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/NoticeIconList" - } - } - } - } - } - } - }, - "/api/rule": { - "get": { - "tags": ["rule"], - "description": "获取规则列表", - "operationId": "rule", - "parameters": [ - { - "name": "current", - "in": "query", - "description": "当前的页码", - "schema": { - "type": "number" - } - }, - { - "name": "pageSize", - "in": "query", - "description": "页面的容量", - "schema": { - "type": "number" - } - } - ], - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleList" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "post": { - "tags": ["rule"], - "description": "新建规则", - "operationId": "addRule", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleListItem" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "put": { - "tags": ["rule"], - "description": "新建规则", - "operationId": "updateRule", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/RuleListItem" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "delete": { - "tags": ["rule"], - "description": "删除规则", - "operationId": "removeRule", - "responses": { - "200": { - "description": "Success", - "content": { - "application/json": { - "schema": { - "type": "object" - } - } - } - }, - "401": { - "description": "Error", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorResponse" - } - } - } - } - } - }, - "x-swagger-router-controller": "api" - }, - "/swagger": { - "x-swagger-pipe": "swagger_raw" - } - }, - "components": { - "schemas": { - "CurrentUser": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "avatar": { - "type": "string" - }, - "userid": { - "type": "string" - }, - "email": { - "type": "string" - }, - "signature": { - "type": "string" - }, - "title": { - "type": "string" - }, - "group": { - "type": "string" - }, - "tags": { - "type": "array", - "items": { - "type": "object", - "properties": { - "key": { - "type": "string" - }, - "label": { - "type": "string" - } - } - } - }, - "notifyCount": { - "type": "integer", - "format": "int32" - }, - "unreadCount": { - "type": "integer", - "format": "int32" - }, - "country": { - "type": "string" - }, - "access": { - "type": "string" - }, - "geographic": { - "type": "object", - "properties": { - "province": { - "type": "object", - "properties": { - "label": { - "type": "string" - }, - "key": { - "type": "string" - } - } - }, - "city": { - "type": "object", - "properties": { - "label": { - "type": "string" - }, - "key": { - "type": "string" - } - } - } - } - }, - "address": { - "type": "string" - }, - "phone": { - "type": "string" - } - } - }, - "LoginResult": { - "type": "object", - "properties": { - "status": { - "type": "string" - }, - "type": { - "type": "string" - }, - "currentAuthority": { - "type": "string" - } - } - }, - "PageParams": { - "type": "object", - "properties": { - "current": { - "type": "number" - }, - "pageSize": { - "type": "number" - } - } - }, - "RuleListItem": { - "type": "object", - "properties": { - "key": { - "type": "integer", - "format": "int32" - }, - "disabled": { - "type": "boolean" - }, - "href": { - "type": "string" - }, - "avatar": { - "type": "string" - }, - "name": { - "type": "string" - }, - "owner": { - "type": "string" - }, - "desc": { - "type": "string" - }, - "callNo": { - "type": "integer", - "format": "int32" - }, - "status": { - "type": "integer", - "format": "int32" - }, - "updatedAt": { - "type": "string", - "format": "datetime" - }, - "createdAt": { - "type": "string", - "format": "datetime" - }, - "progress": { - "type": "integer", - "format": "int32" - } - } - }, - "RuleList": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/RuleListItem" - } - }, - "total": { - "type": "integer", - "description": "列表的内容总数", - "format": "int32" - }, - "success": { - "type": "boolean" - } - } - }, - "FakeCaptcha": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "status": { - "type": "string" - } - } - }, - "LoginParams": { - "type": "object", - "properties": { - "username": { - "type": "string" - }, - "password": { - "type": "string" - }, - "autoLogin": { - "type": "boolean" - }, - "type": { - "type": "string" - } - } - }, - "ErrorResponse": { - "required": ["errorCode"], - "type": "object", - "properties": { - "errorCode": { - "type": "string", - "description": "业务约定的错误码" - }, - "errorMessage": { - "type": "string", - "description": "业务上的错误信息" - }, - "success": { - "type": "boolean", - "description": "业务上的请求是否成功" - } - } - }, - "NoticeIconList": { - "type": "object", - "properties": { - "data": { - "type": "array", - "items": { - "$ref": "#/components/schemas/NoticeIconItem" - } - }, - "total": { - "type": "integer", - "description": "列表的内容总数", - "format": "int32" - }, - "success": { - "type": "boolean" - } - } - }, - "NoticeIconItemType": { - "title": "NoticeIconItemType", - "description": "已读未读列表的枚举", - "type": "string", - "properties": {}, - "enum": ["notification", "message", "event"] - }, - "NoticeIconItem": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "extra": { - "type": "string", - "format": "any" - }, - "key": { "type": "string" }, - "read": { - "type": "boolean" - }, - "avatar": { - "type": "string" - }, - "title": { - "type": "string" - }, - "status": { - "type": "string" - }, - "datetime": { - "type": "string", - "format": "date" - }, - "description": { - "type": "string" - }, - "type": { - "extensions": { - "x-is-enum": true - }, - "$ref": "#/components/schemas/NoticeIconItemType" - } - } - } - } - } -} diff --git a/react-ui/src/services/ant-design-pro/api.ts b/react-ui/src/services/ant-design-pro/api.ts deleted file mode 100644 index 64a950a7..00000000 --- a/react-ui/src/services/ant-design-pro/api.ts +++ /dev/null @@ -1,11 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import { request } from '@umijs/max'; - -/** 此处后端没有提供注释 GET /api/notices */ -export async function getNotices(options?: { [key: string]: any }) { - return request('/api/notices', { - method: 'GET', - ...(options || {}), - }); -} diff --git a/react-ui/src/services/ant-design-pro/index.ts b/react-ui/src/services/ant-design-pro/index.ts deleted file mode 100644 index 9ae58be7..00000000 --- a/react-ui/src/services/ant-design-pro/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -// API 更新时间: -// API 唯一标识: -import * as api from './api'; -import * as login from './login'; -import * as rule from './rule'; -export default { - api, - login, - rule, -}; diff --git a/react-ui/src/services/ant-design-pro/login.ts b/react-ui/src/services/ant-design-pro/login.ts deleted file mode 100644 index 3b00b436..00000000 --- a/react-ui/src/services/ant-design-pro/login.ts +++ /dev/null @@ -1,38 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import { request } from '@umijs/max'; - -/** 登录接口 POST /api/login/account */ -export async function login(body: API.LoginParams, options?: { [key: string]: any }) { - return request('/api/login/account', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - data: body, - ...(options || {}), - }); -} - -/** 发送验证码 POST /api/login/captcha */ -export async function getFakeCaptcha( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.getFakeCaptchaParams, - options?: { [key: string]: any }, -) { - return request('/api/login/captcha', { - method: 'POST', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 登录接口 POST /api/login/outLogin */ -export async function outLogin(options?: { [key: string]: any }) { - return request>('/api/login/outLogin', { - method: 'POST', - ...(options || {}), - }); -} diff --git a/react-ui/src/services/ant-design-pro/rule.ts b/react-ui/src/services/ant-design-pro/rule.ts deleted file mode 100644 index 4b8ebc5b..00000000 --- a/react-ui/src/services/ant-design-pro/rule.ts +++ /dev/null @@ -1,42 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import { request } from '@umijs/max'; - -/** 获取规则列表 GET /api/rule */ -export async function rule( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.ruleParams, - options?: { [key: string]: any }, -) { - return request('/api/rule', { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** 新建规则 PUT /api/rule */ -export async function updateRule(options?: { [key: string]: any }) { - return request('/api/rule', { - method: 'PUT', - ...(options || {}), - }); -} - -/** 新建规则 POST /api/rule */ -export async function addRule(options?: { [key: string]: any }) { - return request('/api/rule', { - method: 'POST', - ...(options || {}), - }); -} - -/** 删除规则 DELETE /api/rule */ -export async function removeRule(options?: { [key: string]: any }) { - return request>('/api/rule', { - method: 'DELETE', - ...(options || {}), - }); -} diff --git a/react-ui/src/services/ant-design-pro/typings.d.ts b/react-ui/src/services/ant-design-pro/typings.d.ts deleted file mode 100644 index e94832c6..00000000 --- a/react-ui/src/services/ant-design-pro/typings.d.ts +++ /dev/null @@ -1,114 +0,0 @@ -declare namespace API { - type CurrentUser = UserInfo & { - signature?: string; - title?: string; - group?: string; - tags?: { key?: string; label?: string }[]; - notifyCount?: number; - unreadCount?: number; - country?: string; - access?: string; - geographic?: { - province?: { label?: string; key?: string }; - city?: { label?: string; key?: string }; - }; - address?: string; - phone?: string; - roleNames?: { - roleName?: string; - }[]; - }; - - type ErrorResponse = { - /** 业务约定的错误码 */ - errorCode: string; - /** 业务上的错误信息 */ - errorMessage?: string; - /** 业务上的请求是否成功 */ - success?: boolean; - }; - - type FakeCaptcha = { - code?: number; - status?: string; - }; - - type getFakeCaptchaParams = { - /** 手机号 */ - phone?: string; - }; - - type LoginParams = { - username?: string; - password?: string; - uuid?: string; - autoLogin?: boolean; - type?: string; - }; - - type LoginResult = { - code: number; - msg?: string; - type?: string; - data?: { - access_token?: string; - expires_in?: number; - }; - }; - - type NoticeIconItem = { - id?: string; - extra?: string; - key?: string; - read?: boolean; - avatar?: string; - title?: string; - status?: string; - datetime?: string; - description?: string; - type?: NoticeIconItemType; - }; - - type NoticeIconItemType = 'notification' | 'message' | 'event'; - - type NoticeIconList = { - data?: NoticeIconItem[]; - /** 列表的内容总数 */ - total?: number; - success?: boolean; - }; - - type PageParams = { - current?: number; - pageSize?: number; - }; - - type RuleList = { - data?: RuleListItem[]; - /** 列表的内容总数 */ - total?: number; - success?: boolean; - }; - - type RuleListItem = { - key?: number; - disabled?: boolean; - href?: string; - avatar?: string; - name?: string; - owner?: string; - desc?: string; - callNo?: number; - status?: number; - updatedAt?: string; - createdAt?: string; - progress?: number; - }; - - type ruleParams = { - /** 当前的页码 */ - current?: number; - /** 页面的容量 */ - pageSize?: number; - }; -} diff --git a/react-ui/src/services/swagger/index.ts b/react-ui/src/services/swagger/index.ts deleted file mode 100644 index 83cf97ca..00000000 --- a/react-ui/src/services/swagger/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -// API 更新时间: -// API 唯一标识: -import * as pet from './pet'; -import * as store from './store'; -import * as user from './user'; -export default { - pet, - store, - user, -}; diff --git a/react-ui/src/services/swagger/pet.ts b/react-ui/src/services/swagger/pet.ts deleted file mode 100644 index b887475a..00000000 --- a/react-ui/src/services/swagger/pet.ts +++ /dev/null @@ -1,153 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import { request } from '@umijs/max'; - -/** Update an existing pet PUT /pet */ -export async function updatePet(body: API.Pet, options?: { [key: string]: any }) { - return request('/pet', { - method: 'PUT', - headers: { - 'Content-Type': 'application/json', - }, - data: body, - ...(options || {}), - }); -} - -/** Add a new pet to the store POST /pet */ -export async function addPet(body: API.Pet, options?: { [key: string]: any }) { - return request('/pet', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - data: body, - ...(options || {}), - }); -} - -/** Find pet by ID Returns a single pet GET /pet/${param0} */ -export async function getPetById( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.getPetByIdParams, - options?: { [key: string]: any }, -) { - const { petId: param0, ...queryParams } = params; - return request(`/pet/${param0}`, { - method: 'GET', - params: { ...queryParams }, - ...(options || {}), - }); -} - -/** Updates a pet in the store with form data POST /pet/${param0} */ -export async function updatePetWithForm( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.updatePetWithFormParams, - body: { name?: string; status?: string }, - options?: { [key: string]: any }, -) { - const { petId: param0, ...queryParams } = params; - const formData = new FormData(); - - Object.keys(body).forEach((ele) => { - const item = (body as any)[ele]; - - if (item !== undefined && item !== null) { - formData.append( - ele, - typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item, - ); - } - }); - - return request(`/pet/${param0}`, { - method: 'POST', - params: { ...queryParams }, - data: formData, - ...(options || {}), - }); -} - -/** Deletes a pet DELETE /pet/${param0} */ -export async function deletePet( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.deletePetParams & { - // header - api_key?: string; - }, - options?: { [key: string]: any }, -) { - const { petId: param0, ...queryParams } = params; - return request(`/pet/${param0}`, { - method: 'DELETE', - headers: {}, - params: { ...queryParams }, - ...(options || {}), - }); -} - -/** uploads an image POST /pet/${param0}/uploadImage */ -export async function uploadFile( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.uploadFileParams, - body: { additionalMetadata?: string; file?: string }, - file?: File, - options?: { [key: string]: any }, -) { - const { petId: param0, ...queryParams } = params; - const formData = new FormData(); - - if (file) { - formData.append('file', file); - } - - Object.keys(body).forEach((ele) => { - const item = (body as any)[ele]; - - if (item !== undefined && item !== null) { - formData.append( - ele, - typeof item === 'object' && !(item instanceof File) ? JSON.stringify(item) : item, - ); - } - }); - - return request(`/pet/${param0}/uploadImage`, { - method: 'POST', - params: { ...queryParams }, - data: formData, - requestType: 'form', - ...(options || {}), - }); -} - -/** Finds Pets by status Multiple status values can be provided with comma separated strings GET /pet/findByStatus */ -export async function findPetsByStatus( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.findPetsByStatusParams, - options?: { [key: string]: any }, -) { - return request('/pet/findByStatus', { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** Finds Pets by tags Muliple tags can be provided with comma separated strings. Use tag1, tag2, tag3 for testing. GET /pet/findByTags */ -export async function findPetsByTags( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.findPetsByTagsParams, - options?: { [key: string]: any }, -) { - return request('/pet/findByTags', { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} diff --git a/react-ui/src/services/swagger/store.ts b/react-ui/src/services/swagger/store.ts deleted file mode 100644 index b9c689a6..00000000 --- a/react-ui/src/services/swagger/store.ts +++ /dev/null @@ -1,48 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import { request } from '@umijs/max'; - -/** Returns pet inventories by status Returns a map of status codes to quantities GET /store/inventory */ -export async function getInventory(options?: { [key: string]: any }) { - return request>('/store/inventory', { - method: 'GET', - ...(options || {}), - }); -} - -/** Place an order for a pet POST /store/order */ -export async function placeOrder(body: API.Order, options?: { [key: string]: any }) { - return request('/store/order', { - method: 'POST', - data: body, - ...(options || {}), - }); -} - -/** Find purchase order by ID For valid response try integer IDs with value >= 1 and <= 10. Other values will generated exceptions GET /store/order/${param0} */ -export async function getOrderById( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.getOrderByIdParams, - options?: { [key: string]: any }, -) { - const { orderId: param0, ...queryParams } = params; - return request(`/store/order/${param0}`, { - method: 'GET', - params: { ...queryParams }, - ...(options || {}), - }); -} - -/** Delete purchase order by ID For valid response try integer IDs with positive integer value. Negative or non-integer values will generate API errors DELETE /store/order/${param0} */ -export async function deleteOrder( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.deleteOrderParams, - options?: { [key: string]: any }, -) { - const { orderId: param0, ...queryParams } = params; - return request(`/store/order/${param0}`, { - method: 'DELETE', - params: { ...queryParams }, - ...(options || {}), - }); -} diff --git a/react-ui/src/services/swagger/typings.d.ts b/react-ui/src/services/swagger/typings.d.ts deleted file mode 100644 index d06bcfcb..00000000 --- a/react-ui/src/services/swagger/typings.d.ts +++ /dev/null @@ -1,112 +0,0 @@ -declare namespace API { - type ApiResponse = { - code?: number; - type?: string; - message?: string; - }; - - type Category = { - id?: number; - name?: string; - }; - - type deleteOrderParams = { - /** ID of the order that needs to be deleted */ - orderId: number; - }; - - type deletePetParams = { - api_key?: string; - /** Pet id to delete */ - petId: number; - }; - - type deleteUserParams = { - /** The name that needs to be deleted */ - username: string; - }; - - type findPetsByStatusParams = { - /** Status values that need to be considered for filter */ - status: ('available' | 'pending' | 'sold')[]; - }; - - type findPetsByTagsParams = { - /** Tags to filter by */ - tags: string[]; - }; - - type getOrderByIdParams = { - /** ID of pet that needs to be fetched */ - orderId: number; - }; - - type getPetByIdParams = { - /** ID of pet to return */ - petId: number; - }; - - type getUserByNameParams = { - /** The name that needs to be fetched. Use user1 for testing. */ - username: string; - }; - - type loginUserParams = { - /** The user name for login */ - username: string; - /** The password for login in clear text */ - password: string; - }; - - type Order = { - id?: number; - petId?: number; - quantity?: number; - shipDate?: string; - /** Order Status */ - status?: 'placed' | 'approved' | 'delivered'; - complete?: boolean; - }; - - type Pet = { - id?: number; - category?: Category; - name: string; - photoUrls: string[]; - tags?: Tag[]; - /** pet status in the store */ - status?: 'available' | 'pending' | 'sold'; - }; - - type Tag = { - id?: number; - name?: string; - }; - - type updatePetWithFormParams = { - /** ID of pet that needs to be updated */ - petId: number; - }; - - type updateUserParams = { - /** name that need to be updated */ - username: string; - }; - - type uploadFileParams = { - /** ID of pet to update */ - petId: number; - }; - - type User = { - id?: number; - username?: string; - firstName?: string; - lastName?: string; - email?: string; - password?: string; - phone?: string; - /** User Status */ - userStatus?: number; - }; -} diff --git a/react-ui/src/services/swagger/user.ts b/react-ui/src/services/swagger/user.ts deleted file mode 100644 index 4dd6f421..00000000 --- a/react-ui/src/services/swagger/user.ts +++ /dev/null @@ -1,100 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import { request } from '@umijs/max'; - -/** Create user This can only be done by the logged in user. POST /user */ -export async function createUser(body: API.User, options?: { [key: string]: any }) { - return request('/user', { - method: 'POST', - data: body, - ...(options || {}), - }); -} - -/** Get user by user name GET /user/${param0} */ -export async function getUserByName( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.getUserByNameParams, - options?: { [key: string]: any }, -) { - const { username: param0, ...queryParams } = params; - return request(`/user/${param0}`, { - method: 'GET', - params: { ...queryParams }, - ...(options || {}), - }); -} - -/** Updated user This can only be done by the logged in user. PUT /user/${param0} */ -export async function updateUser( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.updateUserParams, - body: API.User, - options?: { [key: string]: any }, -) { - const { username: param0, ...queryParams } = params; - return request(`/user/${param0}`, { - method: 'PUT', - params: { ...queryParams }, - data: body, - ...(options || {}), - }); -} - -/** Delete user This can only be done by the logged in user. DELETE /user/${param0} */ -export async function deleteUser( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.deleteUserParams, - options?: { [key: string]: any }, -) { - const { username: param0, ...queryParams } = params; - return request(`/user/${param0}`, { - method: 'DELETE', - params: { ...queryParams }, - ...(options || {}), - }); -} - -/** Creates list of users with given input array POST /user/createWithArray */ -export async function createUsersWithArrayInput( - body: API.User[], - options?: { [key: string]: any }, -) { - return request('/user/createWithArray', { - method: 'POST', - data: body, - ...(options || {}), - }); -} - -/** Creates list of users with given input array POST /user/createWithList */ -export async function createUsersWithListInput(body: API.User[], options?: { [key: string]: any }) { - return request('/user/createWithList', { - method: 'POST', - data: body, - ...(options || {}), - }); -} - -/** Logs user into the system GET /user/login */ -export async function loginUser( - // 叠加生成的Param类型 (非body参数swagger默认没有生成对象) - params: API.loginUserParams, - options?: { [key: string]: any }, -) { - return request('/user/login', { - method: 'GET', - params: { - ...params, - }, - ...(options || {}), - }); -} - -/** Logs out current logged in user session GET /user/logout */ -export async function logoutUser(options?: { [key: string]: any }) { - return request('/user/logout', { - method: 'GET', - ...(options || {}), - }); -} From 68ede7118ad55ff14e7a03f73ba27bafdb6757cf Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 15:20:02 +0800 Subject: [PATCH 23/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ModelsServiceImpl.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index 431077b4..216824f7 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -988,7 +988,8 @@ public class ModelsServiceImpl implements ModelsService { ModelMetaVo modelMetaVo = JSON.parseObject(meta, ModelMetaVo.class); if (modelMetaVo.getParams() != null) { HashMap params = modelMetaVo.getParams(); - branch.putAll(params); + branch.put("params", params); + ArrayList params_names = new ArrayList<>(); for (String key : params.keySet()) { params_names.add(key); @@ -999,10 +1000,20 @@ public class ModelsServiceImpl implements ModelsService { HashMap metrics = modelMetaVo.getMetrics(); if (Constant.Type_Train.equals(type)) { Map trainMetrics = (Map) metrics.get(Constant.Type_Train); - branch.putAll(trainMetrics); + ArrayList metrics_names = new ArrayList<>(); + for (String key : trainMetrics.keySet()) { + metrics_names.add(key); + } + branch.put("metrics_names", metrics_names); + branch.put("metrics",trainMetrics); } else { Map evaluateMetrics = (Map) metrics.get(Constant.Type_Evaluate); - branch.putAll(evaluateMetrics); + ArrayList metrics_names = new ArrayList<>(); + for (String key : evaluateMetrics.keySet()) { + metrics_names.add(key); + } + branch.put("metrics_names", metrics_names); + branch.put("metrics",evaluateMetrics); } } } From 1fcd8e8b7b40f8e8944d9d26f83b5a8c7ce67f63 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 15:25:41 +0800 Subject: [PATCH 24/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/service/impl/ModelsServiceImpl.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index 216824f7..e4f78e13 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -1028,7 +1028,7 @@ public class ModelsServiceImpl implements ModelsService { ModelDependency1 modelDependency1 = modelDependency1Dao.queryByRepoAndVersion(model.getRepoId(), model.getIdentifier(), model.getVersion()); ModelMetaVo modelMetaVo = JSON.parseObject(modelDependency1.getMeta(), ModelMetaVo.class); - HashMap metrics = modelMetaVo.getMetrics(); + HashMap metrics = modelMetaVo.getMetricsParams(); if (Constant.Type_Train.equals(type)) { batchMetrics.add(metrics.get("tarinDetail")); } else { @@ -1271,7 +1271,7 @@ public class ModelsServiceImpl implements ModelsService { } result.put("train", train); - result.put("tarinDetail", trainBatchMetrics); + metrics.put("tarinDetail", trainBatchMetrics); } @@ -1293,10 +1293,11 @@ public class ModelsServiceImpl implements ModelsService { } result.put("evaluate", evaluate); - result.put("evaluateDetail", evaluateBatchMetrics); + metrics.put("evaluateDetail", evaluateBatchMetrics); } modelMetaVo.setMetrics(result); + modelMetaVo.setMetricsParams(metrics); } } From 19ec863dcbfb2f01cf6a441fa95248bbc2974b27 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 16:09:53 +0800 Subject: [PATCH 25/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index e4f78e13..4713b099 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -1132,7 +1132,7 @@ public class ModelsServiceImpl implements ModelsService { String parentModel = JSON.toJSONString(map); modelDependency1Dao.deleteModelDependency(parentModel); dvcUtils.deleteDirectory(rootPath); - FileUtil.renameFile(rootPath, rootPath + "_deleted"); + FileUtil.renameFile(rootPath, rootPath + "_deleted" + System.currentTimeMillis()); } public List convert(List> lst, String modelTopic, String modelTagName, String modelTypeName) { From 26749e9e730b71a7a8d90ca41ed73c965436e829 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 17:05:44 +0800 Subject: [PATCH 26/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ModelsServiceImpl.java | 58 +++++++++++-------- 1 file changed, 33 insertions(+), 25 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index 216824f7..da21bf35 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -986,34 +986,42 @@ public class ModelsServiceImpl implements ModelsService { String meta = modelDependency1Dao.getMeta(identifier, owner, (String) branch.get("name")); if (StringUtils.isNotEmpty(meta)) { ModelMetaVo modelMetaVo = JSON.parseObject(meta, ModelMetaVo.class); - if (modelMetaVo.getParams() != null) { - HashMap params = modelMetaVo.getParams(); - branch.put("params", params); + if (Constant.Source_Add.equals(modelMetaVo.getModelSource())) { + branch.put("params", null); + branch.put("params_names", new ArrayList<>()); + branch.put("metrics", null); + branch.put("metrics_names", new ArrayList<>()); + } else { + if (modelMetaVo.getParams() != null) { + HashMap params = modelMetaVo.getParams(); + branch.put("params", params); - ArrayList params_names = new ArrayList<>(); - for (String key : params.keySet()) { - params_names.add(key); - } - branch.put("params_names", params_names); - } - if (modelMetaVo.getMetrics() != null) { - HashMap metrics = modelMetaVo.getMetrics(); - if (Constant.Type_Train.equals(type)) { - Map trainMetrics = (Map) metrics.get(Constant.Type_Train); - ArrayList metrics_names = new ArrayList<>(); - for (String key : trainMetrics.keySet()) { - metrics_names.add(key); + ArrayList params_names = new ArrayList<>(); + for (String key : params.keySet()) { + params_names.add(key); } - branch.put("metrics_names", metrics_names); - branch.put("metrics",trainMetrics); - } else { - Map evaluateMetrics = (Map) metrics.get(Constant.Type_Evaluate); - ArrayList metrics_names = new ArrayList<>(); - for (String key : evaluateMetrics.keySet()) { - metrics_names.add(key); + branch.put("params_names", params_names); + } + if (modelMetaVo.getMetrics() != null) { + HashMap metrics = modelMetaVo.getMetrics(); + if (Constant.Type_Train.equals(type)) { + Map trainMetrics = (Map) metrics.get(Constant.Type_Train); + branch.put("metrics", trainMetrics); + + ArrayList metrics_names = new ArrayList<>(); + for (String key : trainMetrics.keySet()) { + metrics_names.add(key); + } + branch.put("metrics_names", metrics_names); + } else { + Map evaluateMetrics = (Map) metrics.get(Constant.Type_Evaluate); + ArrayList metrics_names = new ArrayList<>(); + for (String key : evaluateMetrics.keySet()) { + metrics_names.add(key); + } + branch.put("metrics_names", metrics_names); + branch.put("metrics", evaluateMetrics); } - branch.put("metrics_names", metrics_names); - branch.put("metrics",evaluateMetrics); } } } From c4cf890f6e0b89e0a96569b2731c95c187b08192 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 17 Oct 2024 18:13:42 +0800 Subject: [PATCH 27/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/domain/ModelDependency1.java | 5 ++++ .../service/impl/ModelsServiceImpl.java | 26 ++++++++++++++++--- .../service/impl/NewDatasetServiceImpl.java | 2 +- 3 files changed, 28 insertions(+), 5 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelDependency1.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelDependency1.java index 387d6c92..b19e2a4a 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelDependency1.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelDependency1.java @@ -1,10 +1,12 @@ package com.ruoyi.platform.domain; +import com.baomidou.mybatisplus.annotation.TableField; import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import lombok.Data; import java.io.Serializable; +import java.util.List; @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) @Data @@ -26,4 +28,7 @@ public class ModelDependency1 implements Serializable { private Integer state; private String meta; + + @TableField(exist = false) + private List metrics; } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index ee82c9b0..bcada61b 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -1033,14 +1033,32 @@ public class ModelsServiceImpl implements ModelsService { public List queryVersionsMetrics(List params, String type) { List batchMetrics = new ArrayList<>(); for (ModelDependency1 model : params) { - ModelDependency1 modelDependency1 = modelDependency1Dao.queryByRepoAndVersion(model.getRepoId(), model.getIdentifier(), model.getVersion()); ModelMetaVo modelMetaVo = JSON.parseObject(modelDependency1.getMeta(), ModelMetaVo.class); HashMap metrics = modelMetaVo.getMetricsParams(); + List needMetrics = model.getMetrics(); + + ArrayList> result = new ArrayList<>(); if (Constant.Type_Train.equals(type)) { - batchMetrics.add(metrics.get("tarinDetail")); + List>> tarinDetail = (List>>) metrics.get("tarinDetail"); + List> trainMetrics = tarinDetail.get(0); + + for (Map trainMetric : trainMetrics) { + if (needMetrics.contains((String) trainMetric.get("name"))) { + result.add(trainMetric); + } + } + batchMetrics.add(result); } else { - batchMetrics.add(metrics.get("evaluateDetail")); + List>> evaluateDetail = (List>>) metrics.get("evaluateDetail"); + List> evaluateMetrics = evaluateDetail.get(0); + + for (Map trainMetric : evaluateMetrics) { + if (needMetrics.contains((String) trainMetric.get("name"))) { + result.add(trainMetric); + } + } + batchMetrics.add(result); } } return batchMetrics; @@ -1140,7 +1158,7 @@ public class ModelsServiceImpl implements ModelsService { String parentModel = JSON.toJSONString(map); modelDependency1Dao.deleteModelDependency(parentModel); dvcUtils.deleteDirectory(rootPath); - FileUtil.renameFile(rootPath, rootPath + "_deleted" + System.currentTimeMillis()); + FileUtil.renameFile(rootPath, rootPath + "_deleted_" + System.currentTimeMillis()); } public List convert(List> lst, String modelTopic, String modelTagName, String modelTypeName) { diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java index 94259c5f..aaf139dd 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java @@ -393,7 +393,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { String rootPath = Paths.get(localPathlocal + "/" + relativePath).getParent().toString(); gitService.deleteBranch(token, owner, repo, version, rootPath); dvcUtils.deleteDirectory(rootPath); - FileUtil.renameFile(rootPath, rootPath + "_deleted"); + FileUtil.renameFile(rootPath, rootPath + "_deleted_" + System.currentTimeMillis()); } @Override From 9d9c1eff48aa68dc99524bbb4e9d983ebd4b1c70 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Fri, 18 Oct 2024 08:38:22 +0800 Subject: [PATCH 28/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../model/NewModelFromGitController.java | 5 +-- .../platform/domain/ModelDependency1.java | 3 -- .../ruoyi/platform/service/ModelsService.java | 3 +- .../service/impl/ModelsServiceImpl.java | 35 ++++++++++--------- .../platform/vo/QueryModelMetricsVo.java | 22 ++++++++++++ 5 files changed, 46 insertions(+), 22 deletions(-) create mode 100644 ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/QueryModelMetricsVo.java diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java index be6ebee7..3ba4a9fa 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/NewModelFromGitController.java @@ -4,6 +4,7 @@ import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.platform.domain.ModelDependency1; import com.ruoyi.platform.service.ModelsService; import com.ruoyi.platform.vo.ModelsVo; +import com.ruoyi.platform.vo.QueryModelMetricsVo; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.springframework.core.io.InputStreamResource; @@ -88,8 +89,8 @@ public class NewModelFromGitController { @PostMapping("/queryVersionsMetrics") @ApiOperation("查询版本指标") - public AjaxResult queryVersionsMetrics(@RequestBody List params, @RequestParam("type") String type) throws Exception { - return AjaxResult.success(this.modelsService.queryVersionsMetrics(params, type)); + public AjaxResult queryVersionsMetrics(@RequestBody QueryModelMetricsVo queryModelMetricsVo) throws Exception { + return AjaxResult.success(this.modelsService.queryVersionsMetrics(queryModelMetricsVo)); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelDependency1.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelDependency1.java index b19e2a4a..c8d6a224 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelDependency1.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelDependency1.java @@ -28,7 +28,4 @@ public class ModelDependency1 implements Serializable { private Integer state; private String meta; - - @TableField(exist = false) - private List metrics; } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java index 72ad75dd..ad3ac9f4 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java @@ -6,6 +6,7 @@ import com.ruoyi.platform.domain.Models; import com.ruoyi.platform.domain.ModelsVersion; import com.ruoyi.platform.vo.ModelDependency1TreeVo; import com.ruoyi.platform.vo.ModelsVo; +import com.ruoyi.platform.vo.QueryModelMetricsVo; import org.springframework.core.io.InputStreamResource; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; @@ -102,7 +103,7 @@ public interface ModelsService { Page> queryVersions(PageRequest pageRequest, String identifier, String owner, String type) throws Exception; - List queryVersionsMetrics(List params, String type) throws Exception; + List queryVersionsMetrics(QueryModelMetricsVo queryModelMetricsVo) throws Exception; List> getVersionList(String identifier, String owner) throws Exception; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index bcada61b..252d3bd6 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -1030,35 +1030,38 @@ public class ModelsServiceImpl implements ModelsService { } @Override - public List queryVersionsMetrics(List params, String type) { + public List queryVersionsMetrics(QueryModelMetricsVo queryModelMetricsVo) { List batchMetrics = new ArrayList<>(); - for (ModelDependency1 model : params) { - ModelDependency1 modelDependency1 = modelDependency1Dao.queryByRepoAndVersion(model.getRepoId(), model.getIdentifier(), model.getVersion()); + for (String version : queryModelMetricsVo.getVersions()) { + ModelDependency1 modelDependency1 = modelDependency1Dao.queryByRepoAndVersion(queryModelMetricsVo.getRepoId(), queryModelMetricsVo.getIdentifier(), version); ModelMetaVo modelMetaVo = JSON.parseObject(modelDependency1.getMeta(), ModelMetaVo.class); HashMap metrics = modelMetaVo.getMetricsParams(); - List needMetrics = model.getMetrics(); + List needMetrics = queryModelMetricsVo.getMetrics(); ArrayList> result = new ArrayList<>(); - if (Constant.Type_Train.equals(type)) { + if (Constant.Type_Train.equals(queryModelMetricsVo.getType())) { List>> tarinDetail = (List>>) metrics.get("tarinDetail"); - List> trainMetrics = tarinDetail.get(0); - - for (Map trainMetric : trainMetrics) { - if (needMetrics.contains((String) trainMetric.get("name"))) { - result.add(trainMetric); + if (tarinDetail != null && tarinDetail.size() > 0) { + List> trainMetrics = tarinDetail.get(0); + for (Map trainMetric : trainMetrics) { + if (needMetrics.contains((String) trainMetric.get("name"))) { + result.add(trainMetric); + } } + batchMetrics.add(result); } - batchMetrics.add(result); } else { List>> evaluateDetail = (List>>) metrics.get("evaluateDetail"); - List> evaluateMetrics = evaluateDetail.get(0); + if (evaluateDetail != null && evaluateDetail.size() > 0) { + List> evaluateMetrics = evaluateDetail.get(0); - for (Map trainMetric : evaluateMetrics) { - if (needMetrics.contains((String) trainMetric.get("name"))) { - result.add(trainMetric); + for (Map trainMetric : evaluateMetrics) { + if (needMetrics.contains((String) trainMetric.get("name"))) { + result.add(trainMetric); + } } + batchMetrics.add(result); } - batchMetrics.add(result); } } return batchMetrics; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/QueryModelMetricsVo.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/QueryModelMetricsVo.java new file mode 100644 index 00000000..435eaea4 --- /dev/null +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/QueryModelMetricsVo.java @@ -0,0 +1,22 @@ +package com.ruoyi.platform.vo; + +import com.fasterxml.jackson.databind.PropertyNamingStrategy; +import com.fasterxml.jackson.databind.annotation.JsonNaming; +import lombok.Data; + +import java.util.List; + +@Data +@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) +public class QueryModelMetricsVo { + + private Integer repoId; + + private String identifier; + + private List versions; + + private List metrics; + + private String type; +} From 3d2757bab57f9508e015db2317ab0ccd0331aead Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Fri, 18 Oct 2024 09:23:22 +0800 Subject: [PATCH 29/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/service/ModelsService.java | 2 +- .../service/impl/ModelsServiceImpl.java | 55 ++++++++++--------- 2 files changed, 31 insertions(+), 26 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java index ad3ac9f4..a346d050 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ModelsService.java @@ -103,7 +103,7 @@ public interface ModelsService { Page> queryVersions(PageRequest pageRequest, String identifier, String owner, String type) throws Exception; - List queryVersionsMetrics(QueryModelMetricsVo queryModelMetricsVo) throws Exception; + Map queryVersionsMetrics(QueryModelMetricsVo queryModelMetricsVo) throws Exception; List> getVersionList(String identifier, String owner) throws Exception; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index 252d3bd6..734e39e7 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -1030,40 +1030,45 @@ public class ModelsServiceImpl implements ModelsService { } @Override - public List queryVersionsMetrics(QueryModelMetricsVo queryModelMetricsVo) { - List batchMetrics = new ArrayList<>(); - for (String version : queryModelMetricsVo.getVersions()) { - ModelDependency1 modelDependency1 = modelDependency1Dao.queryByRepoAndVersion(queryModelMetricsVo.getRepoId(), queryModelMetricsVo.getIdentifier(), version); - ModelMetaVo modelMetaVo = JSON.parseObject(modelDependency1.getMeta(), ModelMetaVo.class); - HashMap metrics = modelMetaVo.getMetricsParams(); - List needMetrics = queryModelMetricsVo.getMetrics(); + public Map queryVersionsMetrics(QueryModelMetricsVo queryModelMetricsVo) { + Map batchMetrics = new HashMap<>(); + List needMetrics = queryModelMetricsVo.getMetrics(); + for (String needMetric : needMetrics) { ArrayList> result = new ArrayList<>(); - if (Constant.Type_Train.equals(queryModelMetricsVo.getType())) { - List>> tarinDetail = (List>>) metrics.get("tarinDetail"); - if (tarinDetail != null && tarinDetail.size() > 0) { - List> trainMetrics = tarinDetail.get(0); - for (Map trainMetric : trainMetrics) { - if (needMetrics.contains((String) trainMetric.get("name"))) { - result.add(trainMetric); + + for (String version : queryModelMetricsVo.getVersions()) { + ModelDependency1 modelDependency1 = modelDependency1Dao.queryByRepoAndVersion(queryModelMetricsVo.getRepoId(), queryModelMetricsVo.getIdentifier(), version); + ModelMetaVo modelMetaVo = JSON.parseObject(modelDependency1.getMeta(), ModelMetaVo.class); + HashMap metrics = modelMetaVo.getMetricsParams(); + + if (Constant.Type_Train.equals(queryModelMetricsVo.getType())) { + List>> tarinDetail = (List>>) metrics.get("tarinDetail"); + if (tarinDetail != null && tarinDetail.size() > 0) { + List> trainMetrics = tarinDetail.get(0); + for (Map trainMetric : trainMetrics) { + if (needMetric.equals(trainMetric.get("name"))) { + trainMetric.put("version", version); + result.add(trainMetric); + } } } - batchMetrics.add(result); - } - } else { - List>> evaluateDetail = (List>>) metrics.get("evaluateDetail"); - if (evaluateDetail != null && evaluateDetail.size() > 0) { - List> evaluateMetrics = evaluateDetail.get(0); - - for (Map trainMetric : evaluateMetrics) { - if (needMetrics.contains((String) trainMetric.get("name"))) { - result.add(trainMetric); + } else { + List>> evaluateDetail = (List>>) metrics.get("evaluateDetail"); + if (evaluateDetail != null && evaluateDetail.size() > 0) { + List> evaluateMetrics = evaluateDetail.get(0); + for (Map evaluateMetric : evaluateMetrics) { + if (needMetric.equals(evaluateMetric.get("name"))) { + evaluateMetric.put("version", version); + result.add(evaluateMetric); + } } } - batchMetrics.add(result); } } + batchMetrics.put(needMetric, result); } + return batchMetrics; } From 4fbd278954954dfb3023872d9e53fe4673555083 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Fri, 18 Oct 2024 09:27:52 +0800 Subject: [PATCH 30/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=BB=88=E6=AD=A2?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=95=B0=E6=8D=AE=E9=9B=86=E5=92=8C=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/ExperimentInsServiceImpl.java | 61 +++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index 59168810..da66d68f 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -59,6 +59,11 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { private NewHttpUtils httpUtils; @Resource private K8sClientUtil k8sClientUtil; + @Resource + private ModelsServiceImpl modelsService; + @Resource + private NewDatasetServiceImpl newDatasetService; + private final MinioUtil minioUtil; public ExperimentInsServiceImpl(MinioUtil minioUtil) { @@ -401,6 +406,10 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { ins.setStatus("Terminated"); ins.setFinishTime(new Date()); this.experimentInsDao.update(ins); + + //删除数据集模型导出版本 + deleteExportVersion(runResMap); + return true; } else { return false; @@ -411,6 +420,58 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { } + void deleteExportVersion(Map runResMap) throws Exception { + LoginUser loginUser = SecurityUtils.getLoginUser(); + String ci4sUsername = loginUser.getUsername(); + + Map spec = (Map) runResMap.get("spec"); + if (spec != null) { + List> templates = (ArrayList>) spec.get("templates"); + for (Map template : templates) { + String name = (String) template.get("name"); + if (StringUtils.isNotEmpty(name) && name.contains("model-export")) { + Map container = (Map) template.get("container"); + List args = (ArrayList) container.get("args"); + + Map model = new HashMap<>(); + String version = ""; + for (String arg : args) { + if (arg.startsWith("--model_id")) { + String modelStr = arg.substring("--model_id=".length()); + model = JsonUtils.jsonToMap(modelStr); + } + if (arg.startsWith("--version")) { + version = arg.substring("--version=".length()); + } + } + String relativePath = ci4sUsername + "/model/" + model.get("id") + "/" + model.get("identifier") + "/" + version + "/model"; + ; + modelsService.deleteVersion(Integer.valueOf((String) model.get("id")), (String) model.get("identifier"), (String) model.get("owner"), version, relativePath); + } + + if (StringUtils.isNotEmpty(name) && name.contains("dataset-export")) { + Map container = (Map) template.get("container"); + List args = (ArrayList) container.get("args"); + + Map dataset = new HashMap<>(); + String version = ""; + + for (String arg : args) { + if (arg.startsWith("--dataset_id")) { + String datasetStr = arg.substring("--dataset_id=".length()); + dataset = JsonUtils.jsonToMap(datasetStr); + } + if (arg.startsWith("--version")) { + version = arg.substring("--version=".length()); + } + } + String relativePath = ci4sUsername + "/datasets/" + dataset.get("id") + "/" + dataset.get("identifier") + "/" + version + "/dataset"; + newDatasetService.deleteDatasetVersionNew((String) dataset.get("identifier"), (String) dataset.get("owner"), version, relativePath); + } + } + } + } + /** * 查询实验实例日志的单个节点日志 * From 28c2fa57932c09e063b6a4bf05fcc20a6b8b1c68 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Fri, 18 Oct 2024 09:47:37 +0800 Subject: [PATCH 31/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=BB=88=E6=AD=A2?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=95=B0=E6=8D=AE=E9=9B=86=E5=92=8C=E6=A8=A1?= =?UTF-8?q?=E5=9E=8B=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/service/impl/ExperimentInsServiceImpl.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index da66d68f..f1dab53f 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -424,7 +424,8 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { LoginUser loginUser = SecurityUtils.getLoginUser(); String ci4sUsername = loginUser.getUsername(); - Map spec = (Map) runResMap.get("spec"); + Map data = (Map) runResMap.get("data"); + Map spec = (Map) data.get("spec"); if (spec != null) { List> templates = (ArrayList>) spec.get("templates"); for (Map template : templates) { From 30b6b1582050cb2c74649e7283d18ecebb9ca0b7 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Fri, 18 Oct 2024 15:50:29 +0800 Subject: [PATCH 32/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC=E6=8C=87=E6=A0=87=E5=AF=B9?= =?UTF-8?q?=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/service/impl/ModelsServiceImpl.java | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index 734e39e7..3742478d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -1009,15 +1009,19 @@ public class ModelsServiceImpl implements ModelsService { branch.put("metrics", trainMetrics); ArrayList metrics_names = new ArrayList<>(); - for (String key : trainMetrics.keySet()) { - metrics_names.add(key); + if (trainMetrics != null) { + for (String key : trainMetrics.keySet()) { + metrics_names.add(key); + } } branch.put("metrics_names", metrics_names); } else { Map evaluateMetrics = (Map) metrics.get(Constant.Type_Evaluate); ArrayList metrics_names = new ArrayList<>(); - for (String key : evaluateMetrics.keySet()) { - metrics_names.add(key); + if (evaluateMetrics != null) { + for (String key : evaluateMetrics.keySet()) { + metrics_names.add(key); + } } branch.put("metrics_names", metrics_names); branch.put("metrics", evaluateMetrics); From d615159e70e45951e5d2875260496282520fe295 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Fri, 18 Oct 2024 16:28:17 +0800 Subject: [PATCH 33/91] =?UTF-8?q?=E4=BC=98=E5=8C=96naocs=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- k8s/template-yaml/k8s-3nacos.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/k8s/template-yaml/k8s-3nacos.yaml b/k8s/template-yaml/k8s-3nacos.yaml index c21d6cf5..225c6b23 100644 --- a/k8s/template-yaml/k8s-3nacos.yaml +++ b/k8s/template-yaml/k8s-3nacos.yaml @@ -37,6 +37,10 @@ spec: - containerPort: 8848 - containerPort: 9848 - containerPort: 9849 + initContainers: + - name: init-mydb + image: busybox:1.31 + command: [ 'sh', '-c', 'nc -zv mysql.argo.svc 3306' ] restartPolicy: Always --- From 663aa97b77bb4c941c0f52cd56762c5526d3b7f3 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Sat, 19 Oct 2024 08:36:33 +0800 Subject: [PATCH 34/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/service/impl/ModelsServiceImpl.java | 4 ++++ .../ruoyi/platform/service/impl/NewDatasetServiceImpl.java | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index 3742478d..b97fd948 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -706,6 +706,10 @@ public class ModelsServiceImpl implements ModelsService { String metaPath = rootPath + "/metadata"; String relatePath = ci4sUsername + "/model/" + modelsVo.getId() + "/" + repositoryName + "/" + branchName + "/model"; + //干掉目标文件夹 + dvcUtils.deleteDirectory(rootPath); + FileUtil.renameFile(rootPath, rootPath + "_deleted_" + System.currentTimeMillis()); + //克隆 dvcUtils.gitClone(rootPath, projectUrl, oldModelDependencys.get(0).getVersion(), gitLinkUsername, gitLinkPassword); dvcUtils.refreshRemoteBranches(rootPath, gitLinkUsername, gitLinkPassword, oldModelDependencys.get(0).getVersion()); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java index aaf139dd..a27ff01d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java @@ -191,6 +191,10 @@ public class NewDatasetServiceImpl implements NewDatasetService { String datasetPath = localPath + "/dataset"; String projectUrl = gitendpoint + "/" + owner + "/" + repositoryName + ".git"; + //干掉目标文件夹 + dvcUtils.deleteDirectory(localPath); + FileUtil.renameFile(localPath, localPath + "_deleted_" + System.currentTimeMillis()); + //查询项目信息 Map projectDetail = gitService.getProjectDetail(owner, repositoryName, token); From caf8a7eadbdee2a847f68384d099a1fe090709cc Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Sat, 19 Oct 2024 08:42:47 +0800 Subject: [PATCH 35/91] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/proxy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-ui/config/proxy.ts b/react-ui/config/proxy.ts index 35232b47..93f990c1 100644 --- a/react-ui/config/proxy.ts +++ b/react-ui/config/proxy.ts @@ -20,7 +20,7 @@ export default { // localhost:8000/api/** -> https://preview.pro.ant.design/api/** '/api/': { // 要代理的地址 - target: 'http://172.20.32.185:31213', // 开发环境 + target: 'http://172.20.32.181:31213', // 开发环境 // target: 'http://172.20.32.98:8082', // target: 'http://172.20.32.150:8082', // 配置了这个可以从 http 代理到 https From 1b777256e65896bb13b7c60c59144736108119b5 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Sat, 19 Oct 2024 08:45:03 +0800 Subject: [PATCH 36/91] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/proxy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-ui/config/proxy.ts b/react-ui/config/proxy.ts index 93f990c1..35232b47 100644 --- a/react-ui/config/proxy.ts +++ b/react-ui/config/proxy.ts @@ -20,7 +20,7 @@ export default { // localhost:8000/api/** -> https://preview.pro.ant.design/api/** '/api/': { // 要代理的地址 - target: 'http://172.20.32.181:31213', // 开发环境 + target: 'http://172.20.32.185:31213', // 开发环境 // target: 'http://172.20.32.98:8082', // target: 'http://172.20.32.150:8082', // 配置了这个可以从 http 代理到 https From b043ed02dc8dd81a75f9c99ed2b276e03c71955b Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Sat, 19 Oct 2024 09:51:38 +0800 Subject: [PATCH 37/91] =?UTF-8?q?feat:=20Table=20cell=20render=20=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=87=AA=E5=AE=9A=E4=B9=89=E8=BD=AC=E6=8D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/pages/ModelDeployment/List/index.tsx | 2 +- .../ModelDeployment/ServiceInfo/index.tsx | 15 ++----- react-ui/src/pages/Pipeline/index.jsx | 4 +- react-ui/src/utils/date.ts | 2 +- react-ui/src/utils/table.tsx | 44 ++++++++++--------- 5 files changed, 32 insertions(+), 35 deletions(-) diff --git a/react-ui/src/pages/ModelDeployment/List/index.tsx b/react-ui/src/pages/ModelDeployment/List/index.tsx index e6c77b18..7f73322d 100644 --- a/react-ui/src/pages/ModelDeployment/List/index.tsx +++ b/react-ui/src/pages/ModelDeployment/List/index.tsx @@ -189,7 +189,7 @@ function ModelDeployment() { dataIndex: 'index', key: 'index', width: '20%', - render: tableCellRender(false, TableCellValueType.PageIndex, { + render: tableCellRender(false, TableCellValueType.Index, { page: pagination.current! - 1, pageSize: pagination.pageSize!, }), diff --git a/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx b/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx index c00b1ea0..42b80e87 100644 --- a/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx +++ b/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx @@ -30,7 +30,6 @@ import { Input, Select, Table, - Tooltip, type TablePaginationConfig, type TableProps, } from 'antd'; @@ -222,7 +221,7 @@ function ServiceInfo() { dataIndex: 'index', key: 'index', width: '20%', - render: tableCellRender(false, TableCellValueType.PageIndex, { + render: tableCellRender(false, TableCellValueType.Index, { page: pagination.current! - 1, pageSize: pagination.pageSize!, }), @@ -269,15 +268,9 @@ function ServiceInfo() { dataIndex: 'resource', key: 'resource', width: '20%', - render: (resource: string) => ( - - {resource ? getResourceDescription(resource) : '--'} - - ), + render: tableCellRender(true, TableCellValueType.Custom, { + format: getResourceDescription, + }), ellipsis: { showTitle: false }, }, { diff --git a/react-ui/src/pages/Pipeline/index.jsx b/react-ui/src/pages/Pipeline/index.jsx index 4374b24c..0d1faf6c 100644 --- a/react-ui/src/pages/Pipeline/index.jsx +++ b/react-ui/src/pages/Pipeline/index.jsx @@ -112,9 +112,9 @@ const Pipeline = () => { key: 'index', width: 120, align: 'center', - render: tableCellRender(false, TableCellValueType.PageIndex, { + render: tableCellRender(false, TableCellValueType.Index, { page: pageOption.current.page - 1, - size: pageOption.current.size, + pageSize: pageOption.current.size, }), }, { diff --git a/react-ui/src/utils/date.ts b/react-ui/src/utils/date.ts index 50b9e7e7..fbc83e35 100644 --- a/react-ui/src/utils/date.ts +++ b/react-ui/src/utils/date.ts @@ -79,7 +79,7 @@ export const canBeConvertToDate = (date?: Date | string | number | null): boolea * @return {string} The formatted date string. */ export const formatDate = ( - date?: Date | string | number | null, + date: Date | string | number | null | undefined, format: string = 'YYYY-MM-DD HH:mm:ss', ): string => { if (date === undefined || date === null || date === '') { diff --git a/react-ui/src/utils/table.tsx b/react-ui/src/utils/table.tsx index 1353fe09..0d4b1927 100644 --- a/react-ui/src/utils/table.tsx +++ b/react-ui/src/utils/table.tsx @@ -10,32 +10,36 @@ import dayjs from 'dayjs'; export enum TableCellValueType { Index = 'Index', - PageIndex = 'PageIndex', Text = 'Text', Date = 'Date', Array = 'Array', Link = 'Link', + Custom = 'Custom', } export type TableCellValueOptions = { - page?: number; - pageSize?: number; - property?: string; - onClick?: (record: T, e: React.MouseEvent) => void; + page?: number; // 类型为 Index 时有效 + pageSize?: number; // 类型为 Index 时有效 + property?: string; // 类型为 Array 时有效 + dateFormat?: string; // 类型为 Date 时有效 + onClick?: (record: T, e: React.MouseEvent) => void; // 类型为 Link 时有效 + format?: (value: any | undefined | null, record: T, index: number) => string | undefined | null; // 类型为 Custom 时有效 }; type TableCellFormatter = (value: any | undefined | null) => string | undefined | null; // 日期转换函数 -const formatDateText: TableCellFormatter = (value?: any | null) => { - if (value === undefined || value === null || value === '') { - return null; - } - if (!dayjs(value).isValid()) { - return null; - } - return formatDate(value); -}; +function formatDateText(dateFormat?: string): TableCellFormatter { + return (value: any | undefined | null): ReturnType => { + if (value === undefined || value === null || value === '') { + return null; + } + if (!dayjs(value).isValid()) { + return null; + } + return formatDate(value, dateFormat); + }; +} /** * 数组转换函数,将数组元素转换为字符串,用逗号分隔 @@ -43,7 +47,7 @@ const formatDateText: TableCellFormatter = (value?: any | null) => { * @returns {TableCellFormatter} Table cell 渲染函数 */ function formatArray(property?: string): TableCellFormatter { - return (value?: any | null): ReturnType => { + return (value: any | undefined | null): ReturnType => { if ( value === undefined || value === null || @@ -68,21 +72,21 @@ function tableCellRender( let text = value; switch (type) { case TableCellValueType.Index: - text = index + 1; - break; - case TableCellValueType.PageIndex: - text = (options?.page ?? 1) * (options?.pageSize ?? 10) + index + 1; + text = (options?.page ?? 0) * (options?.pageSize ?? 0) + index + 1; break; case TableCellValueType.Text: case TableCellValueType.Link: text = value; break; case TableCellValueType.Date: - text = formatDateText(value); + text = formatDateText(options?.dateFormat)(value); break; case TableCellValueType.Array: text = formatArray(options?.property)(value); break; + case TableCellValueType.Custom: + text = options?.format?.(value, record, index); + break; default: break; } From 66c47749395b86eb5200e0d71f35d75c72b1d610 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Sat, 19 Oct 2024 09:57:49 +0800 Subject: [PATCH 38/91] =?UTF-8?q?style:=20Table=20=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E9=A2=9C=E8=89=B2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/app.tsx | 11 ++--------- react-ui/src/components/RobotFrame/index.less | 2 +- react-ui/src/components/SubAreaTitle/index.tsx | 8 +++++--- react-ui/src/overrides.less | 6 ++++++ react-ui/src/pages/Experiment/Comparison/index.less | 2 +- .../Workspace/components/ExperimentChart/index.tsx | 10 +++++----- 6 files changed, 20 insertions(+), 19 deletions(-) diff --git a/react-ui/src/app.tsx b/react-ui/src/app.tsx index e6a09fb5..4f911013 100644 --- a/react-ui/src/app.tsx +++ b/react-ui/src/app.tsx @@ -118,18 +118,10 @@ export const layout: RuntimeConfig['layout'] = ({ initialState }) => { width: '331px', }, ], - // links: isDev - // ? [ - // - // - // OpenAPI 文档 - // , - // ] - // : [], // 自定义 403 页面 // unAccessible:
unAccessible
, - // 增加一个 loading 的状态 childrenRender: (children) => { + // 增加一个 loading 的状态 // if (initialState?.loading) return ; return (
@@ -236,6 +228,7 @@ export const antd: RuntimeAntdConfig = (memo) => { memo.theme.components.Table = { headerBg: 'rgba(242, 244, 247, 0.36)', headerBorderRadius: 4, + rowSelectedBg: 'rgba(22, 100, 255, 0.05)', }; memo.theme.components.Tabs = { titleFontSize: 16, diff --git a/react-ui/src/components/RobotFrame/index.less b/react-ui/src/components/RobotFrame/index.less index e3e5662e..a203ecc3 100644 --- a/react-ui/src/components/RobotFrame/index.less +++ b/react-ui/src/components/RobotFrame/index.less @@ -23,7 +23,7 @@ width: 100%; height: 60px; padding: 0 15px; - border-bottom: 1px solid #e8e8e8; + border-bottom: 1px solid @border-color-base; } &__iframe { diff --git a/react-ui/src/components/SubAreaTitle/index.tsx b/react-ui/src/components/SubAreaTitle/index.tsx index 0458f715..cd07b206 100644 --- a/react-ui/src/components/SubAreaTitle/index.tsx +++ b/react-ui/src/components/SubAreaTitle/index.tsx @@ -9,7 +9,7 @@ import './index.less'; type SubAreaTitleProps = { title: string; - image: string; + image?: string; style?: React.CSSProperties; className?: string; }; @@ -17,8 +17,10 @@ type SubAreaTitleProps = { function SubAreaTitle({ title, image, style, className }: SubAreaTitleProps) { return (
- - {title} + {image && ( + + )} + {title}
); } diff --git a/react-ui/src/overrides.less b/react-ui/src/overrides.less index af9591fe..9e4b34cc 100644 --- a/react-ui/src/overrides.less +++ b/react-ui/src/overrides.less @@ -79,6 +79,12 @@ background-color: #fff; } +.ant-table-row-selected { + .ant-table-cell { + color: @primary-color; + } +} + .ant-pro-page-container { overflow-y: auto; } diff --git a/react-ui/src/pages/Experiment/Comparison/index.less b/react-ui/src/pages/Experiment/Comparison/index.less index 7a97a588..b9198e74 100644 --- a/react-ui/src/pages/Experiment/Comparison/index.less +++ b/react-ui/src/pages/Experiment/Comparison/index.less @@ -25,7 +25,7 @@ .ant-table-thead { .ant-table-cell { background-color: rgb(247, 247, 247); - border-color: #e8e8e8 !important; + border-color: @border-color-base !important; } } .ant-table-tbody { diff --git a/react-ui/src/pages/Workspace/components/ExperimentChart/index.tsx b/react-ui/src/pages/Workspace/components/ExperimentChart/index.tsx index 89c1f34d..3cede1ef 100644 --- a/react-ui/src/pages/Workspace/components/ExperimentChart/index.tsx +++ b/react-ui/src/pages/Workspace/components/ExperimentChart/index.tsx @@ -153,11 +153,11 @@ function ExperimentChart({ chartData, style }: ExperimentChartProps) { show: false, }, data: [ - { value: chartData.Failed > 0 ? chartData.Failed : null, name: '失败' }, - { value: chartData.Succeeded > 0 ? chartData.Succeeded : null, name: '成功' }, - { value: chartData.Terminated > 0 ? chartData.Terminated : null, name: '中止' }, - { value: chartData.Pending > 0 ? chartData.Pending : null, name: '等待' }, - { value: chartData.Running > 0 ? chartData.Running : null, name: '运行中' }, + { value: chartData.Failed > 0 ? chartData.Failed : undefined, name: '失败' }, + { value: chartData.Succeeded > 0 ? chartData.Succeeded : undefined, name: '成功' }, + { value: chartData.Terminated > 0 ? chartData.Terminated : undefined, name: '中止' }, + { value: chartData.Pending > 0 ? chartData.Pending : undefined, name: '等待' }, + { value: chartData.Running > 0 ? chartData.Running : undefined, name: '运行中' }, ], }, { From 0fda060243a3c5773d5fc4cb9eafe986f77a120e Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Sat, 19 Oct 2024 09:59:05 +0800 Subject: [PATCH 39/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/service/impl/ModelsServiceImpl.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index b97fd948..f69b7359 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -1308,13 +1308,13 @@ public class ModelsServiceImpl implements ModelsService { // 记录训练指标详情 HashMap map = aimsService.queryMetricsParams(runId); - List> batchMetric = aimsService.getBatchMetric((String) map.get("run_hash"), (String) map.get("params")); - trainBatchMetrics.add(batchMetric); - + if (map != null && !map.isEmpty()) { + List> batchMetric = aimsService.getBatchMetric((String) map.get("run_hash"), (String) map.get("params")); + trainBatchMetrics.add(batchMetric); + } } result.put("train", train); metrics.put("tarinDetail", trainBatchMetrics); - } JSONArray testMetrics = (JSONArray) metrics.get("evaluate"); @@ -1330,8 +1330,10 @@ public class ModelsServiceImpl implements ModelsService { // 记录验证指标详情 HashMap map = aimsService.queryMetricsParams(runId); - List> batchMetric = aimsService.getBatchMetric((String) map.get("run_hash"), (String) map.get("params")); - evaluateBatchMetrics.add(batchMetric); + if (map != null && !map.isEmpty()) { + List> batchMetric = aimsService.getBatchMetric((String) map.get("run_hash"), (String) map.get("params")); + evaluateBatchMetrics.add(batchMetric); + } } result.put("evaluate", evaluate); From 0281084c92bfbfa568c781a20224b6ae981c76ef Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Sat, 19 Oct 2024 14:33:53 +0800 Subject: [PATCH 40/91] =?UTF-8?q?feat:=20=E5=AE=9E=E9=AA=8C=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=20&=20=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=AE=9E=E9=AA=8C=E6=B7=BB=E5=8A=A0=E3=80=90=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E5=B9=B6=E8=BF=90=E8=A1=8C=E3=80=91=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/hooks/index.ts | 44 +++++++++++- .../components/CodeConfigItem/index.less | 2 +- .../components/AddExperimentModal/index.tsx | 35 ++++++++-- .../components/ExperimentInstance/index.less | 7 +- .../components/ExperimentInstance/index.tsx | 68 ++++++++++++++++++- react-ui/src/pages/Experiment/index.jsx | 34 +++++++--- 6 files changed, 169 insertions(+), 21 deletions(-) diff --git a/react-ui/src/hooks/index.ts b/react-ui/src/hooks/index.ts index adf61e7d..6f5bdbbc 100644 --- a/react-ui/src/hooks/index.ts +++ b/react-ui/src/hooks/index.ts @@ -5,7 +5,7 @@ */ import { FormInstance } from 'antd'; import { debounce } from 'lodash'; -import { useCallback, useEffect, useRef, useState } from 'react'; +import { useCallback, useEffect, useMemo, useRef, useState } from 'react'; /** * 生成具有初始值的状态引用 * @@ -156,3 +156,45 @@ export const useEffectWhen = (effect: () => void, deps: React.DependencyList, wh } }, [when]); }; + +// 选择、全选操作 +export const useCheck = (list: T[]) => { + const [selected, setSelected] = useState([]); + + const checked = useMemo(() => { + return selected.length === list.length; + }, [selected, list]); + + const indeterminate = useMemo(() => { + return selected.length > 0 && selected.length < list.length; + }, [selected, list]); + + const checkAll = useCallback(() => { + setSelected(checked ? [] : list); + }, [list, checked]); + + const isSingleChecked = useCallback((item: T) => selected.includes(item), [selected]); + + const checkSingle = useCallback( + (item: T) => { + setSelected((prev) => { + if (isSingleChecked(item)) { + return prev.filter((i) => i !== item); + } else { + return [...prev, item]; + } + }); + }, + [selected, isSingleChecked], + ); + + return [ + selected, + setSelected, + checked, + indeterminate, + checkAll, + isSingleChecked, + checkSingle, + ] as const; +}; diff --git a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less index 1f1a9a92..c5d4abaa 100644 --- a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less +++ b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less @@ -39,7 +39,7 @@ } &__url { - margin-bottom: 10px; + margin-bottom: 10px !important; color: @text-color-secondary; font-size: 14px; } diff --git a/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx b/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx index 126e0557..4758a165 100644 --- a/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx +++ b/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx @@ -2,7 +2,8 @@ import createExperimentIcon from '@/assets/img/create-experiment.png'; import editExperimentIcon from '@/assets/img/edit-experiment.png'; import KFModal from '@/components/KFModal'; import { type PipelineGlobalParam } from '@/types'; -import { Form, Input, Radio, Select, type FormRule } from 'antd'; +import { to } from '@/utils/promise'; +import { Button, Form, Input, Radio, Select, type FormRule } from 'antd'; import { useState } from 'react'; import styles from './index.less'; @@ -17,7 +18,7 @@ type AddExperimentModalProps = { isAdd: boolean; open: boolean; onCancel: () => void; - onFinish: () => void; + onFinish: (values: any, isRun: boolean) => void; workflowList: Workflow[]; initialValues: FormData; }; @@ -113,25 +114,45 @@ function AddExperimentModal({ form.setFieldValue('global_param', []); } }; + + const handleRun = async (run: boolean) => { + const [values, error] = await to(form.validateFields()); + if (!error && values) { + onFinish(values, run); + } + }; + + const footer = [ + , + , + ]; + if (!isAdd) { + footer.push( + , + ); + } + return (
{ + return experimentInList?.map((item) => item.id) || []; + }, [experimentInList]); + const [ + selectedIns, + setSelectedIns, + checked, + indeterminate, + checkAll, + isSingleChecked, + checkSingle, + ] = useCheck(allIntanceIds); + + useEffect(() => { + // 关闭时清空 + if (allIntanceIds.length === 0) { + setSelectedIns([]); + } + }, [experimentInList]); // 删除实验实例确认 const handleRemove = (instance: ExperimentInstance) => { @@ -56,6 +78,26 @@ function ExperimentInstanceComponent({ } }; + // 批量删除实验实例确认 + const handleDeleteAll = () => { + modalConfirm({ + title: '确定批量删除选中的实例吗?', + onOk: () => { + batchDeleteExperimentInstances(); + }, + }); + }; + + // 批量删除实验实例 + const batchDeleteExperimentInstances = async () => { + const [res] = await to(deleteManyExperimentIns(selectedIns)); + if (res) { + message.success('删除成功'); + setSelectedIns([]); + onRemove?.(); + } + }; + // 终止实验实例 const terminateExperimentInstance = async (instance: ExperimentInstance) => { const [res] = await to(putQueryByExperimentInsId(instance.id)); @@ -72,6 +114,9 @@ function ExperimentInstanceComponent({ return (
+
+ +
序号
可视化
@@ -79,7 +124,20 @@ function ExperimentInstanceComponent({
开始时间
状态
-
操作
+
+ 操作 + {selectedIns.length > 0 && ( + + )} +
{experimentInList.map((item, index) => ( @@ -87,6 +145,12 @@ function ExperimentInstanceComponent({ key={item.id} className={classNames(styles.tableExpandBox, styles.tableExpandBoxContent)} > +
+ checkSingle(item.id)} + > +
{ - getList(); + getExperimentList(); getWorkflowList(); return () => { clearExperimentInTimers(); @@ -68,7 +68,7 @@ function Experiment() { }, []); // 获取实验列表 - const getList = async () => { + const getExperimentList = async () => { const params = { offset: 0, page: pageOption.current.page - 1, @@ -228,8 +228,8 @@ function Experiment() { setIsModalOpen(false); }; - // 创建或者编辑实验接口请求 - const handleAddExperiment = async (values) => { + // 创建或者编辑实验 + const handleAddExperiment = async (values, isRun) => { const global_param = JSON.stringify(values.global_param); if (!experimentId) { const params = { @@ -240,7 +240,7 @@ function Experiment() { if (res) { message.success('新建实验成功'); setIsModalOpen(false); - getList(); + getExperimentList(); } } else { const params = { ...values, global_param, id: experimentId }; @@ -248,7 +248,12 @@ function Experiment() { if (res) { message.success('编辑实验成功'); setIsModalOpen(false); - getList(); + getExperimentList(); + + // 确定并运行 + if (isRun) { + runExperiment(experimentId); + } } } }; @@ -259,7 +264,7 @@ function Experiment() { page: current, size: size, }; - getList(); + getExperimentList(); }; // 运行实验 const runExperiment = async (id) => { @@ -297,8 +302,16 @@ function Experiment() { } }; + // 刷新实验列表状态, + // 目前是直接刷新实验列表,后续需要优化,只刷新状态 + const refreshExperimentList = () => { + getExperimentList(); + }; + // 实验实例终止 const handleInstanceTerminate = async (experimentIn) => { + // 刷新实验列表 + refreshExperimentList(); setExperimentInList((prevList) => { return prevList.map((item) => { if (item.id === experimentIn.id) { @@ -448,7 +461,7 @@ function Experiment() { deleteExperimentById(record.id).then((ret) => { if (ret.code === 200) { message.success('删除成功'); - getList(); + getExperimentList(); } else { message.error(ret.msg); } @@ -485,7 +498,10 @@ function Experiment() { experimentInsTotal={experimentInsTotal} onClickInstance={(item) => gotoInstanceInfo(item, record)} onClickTensorBoard={handleTensorboard} - onRemove={() => refreshExperimentIns(record.id)} + onRemove={() => { + refreshExperimentIns(record.id); + refreshExperimentList(); + }} onTerminate={handleInstanceTerminate} onLoadMore={() => loadMoreExperimentIns()} > From 7259cfcfdbac294d380c62adc4e9703b8143d2ff Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Sat, 19 Oct 2024 14:34:12 +0800 Subject: [PATCH 41/91] =?UTF-8?q?feat:=20=E5=AE=9E=E9=AA=8C=E5=AE=9E?= =?UTF-8?q?=E4=BE=8B=E6=89=B9=E9=87=8F=E5=88=A0=E9=99=A4=20&=20=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=AE=9E=E9=AA=8C=E6=B7=BB=E5=8A=A0=E3=80=90=E7=A1=AE?= =?UTF-8?q?=E5=AE=9A=E5=B9=B6=E8=BF=90=E8=A1=8C=E3=80=91=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/services/experiment/index.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/react-ui/src/services/experiment/index.js b/react-ui/src/services/experiment/index.js index 0d4e431f..5431e526 100644 --- a/react-ui/src/services/experiment/index.js +++ b/react-ui/src/services/experiment/index.js @@ -40,6 +40,13 @@ export function deleteQueryByExperimentInsId(id) { method: 'DELETE', }); } +// 批量删除实验实例 +export function deleteManyExperimentIns(data) { + return request(`/api/mmp/experimentIns/batchDelete`, { + method: 'DELETE', + data, + }); +} // 根据id终止实验实例 export function putQueryByExperimentInsId(id) { return request(`/api/mmp/experimentIns/${id}`, { From 2bd85a20183e9dd700372ed58cb150756ea41d8c Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Sat, 19 Oct 2024 14:39:32 +0800 Subject: [PATCH 42/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=BB=88=E6=AD=A2?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=A8=A1=E5=9E=8B=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/mapper/ModelDependency1Dao.java | 2 + .../impl/ExperimentInsServiceImpl.java | 66 +++++++------------ .../service/impl/ExperimentServiceImpl.java | 1 + .../com/ruoyi/platform/vo/ModelMetaVo.java | 3 + .../ModelDependency1DaoMapper.xml | 7 ++ 5 files changed, 35 insertions(+), 44 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java index 721496ea..0b80f58e 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ModelDependency1Dao.java @@ -21,6 +21,8 @@ public interface ModelDependency1Dao { ModelDependency1 queryByTrainTask(@Param("trainTask") String trainTask); + ModelDependency1 queryByInsId(@Param("insId") String insId); + int deleteModel(@Param("repoId") Integer repoId, @Param("identifier") String identifier, @Param("owner") String owner, @Param("version") String version); int deleteModelDependency(@Param("parentModel") String parentModel); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index f1dab53f..7543527f 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -2,8 +2,10 @@ package com.ruoyi.platform.service.impl; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.platform.domain.ExperimentIns; +import com.ruoyi.platform.domain.ModelDependency1; import com.ruoyi.platform.mapper.ExperimentDao; import com.ruoyi.platform.mapper.ExperimentInsDao; +import com.ruoyi.platform.mapper.ModelDependency1Dao; import com.ruoyi.platform.service.ExperimentInsService; import com.ruoyi.platform.service.WorkflowService; import com.ruoyi.platform.utils.*; @@ -64,6 +66,9 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { @Resource private NewDatasetServiceImpl newDatasetService; + @Resource + private ModelDependency1Dao modelDependency1Dao; + private final MinioUtil minioUtil; public ExperimentInsServiceImpl(MinioUtil minioUtil) { @@ -408,7 +413,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { this.experimentInsDao.update(ins); //删除数据集模型导出版本 - deleteExportVersion(runResMap); + deleteExportVersion(experimentIns); return true; } else { @@ -420,55 +425,28 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { } - void deleteExportVersion(Map runResMap) throws Exception { + void deleteExportVersion(ExperimentIns experimentIns) throws Exception { LoginUser loginUser = SecurityUtils.getLoginUser(); String ci4sUsername = loginUser.getUsername(); - Map data = (Map) runResMap.get("data"); - Map spec = (Map) data.get("spec"); - if (spec != null) { - List> templates = (ArrayList>) spec.get("templates"); - for (Map template : templates) { - String name = (String) template.get("name"); - if (StringUtils.isNotEmpty(name) && name.contains("model-export")) { - Map container = (Map) template.get("container"); - List args = (ArrayList) container.get("args"); - - Map model = new HashMap<>(); - String version = ""; - for (String arg : args) { - if (arg.startsWith("--model_id")) { - String modelStr = arg.substring("--model_id=".length()); - model = JsonUtils.jsonToMap(modelStr); - } - if (arg.startsWith("--version")) { - version = arg.substring("--version=".length()); - } - } - String relativePath = ci4sUsername + "/model/" + model.get("id") + "/" + model.get("identifier") + "/" + version + "/model"; - ; - modelsService.deleteVersion(Integer.valueOf((String) model.get("id")), (String) model.get("identifier"), (String) model.get("owner"), version, relativePath); - } - - if (StringUtils.isNotEmpty(name) && name.contains("dataset-export")) { - Map container = (Map) template.get("container"); - List args = (ArrayList) container.get("args"); + String nodesResult = experimentIns.getNodesResult(); - Map dataset = new HashMap<>(); - String version = ""; + if (StringUtils.isNotEmpty(nodesResult)) { + Map nodesResultMap = JsonUtils.jsonToMap(nodesResult); + Map paramOutput = (Map) nodesResultMap.get("param_output"); - for (String arg : args) { - if (arg.startsWith("--dataset_id")) { - String datasetStr = arg.substring("--dataset_id=".length()); - dataset = JsonUtils.jsonToMap(datasetStr); - } - if (arg.startsWith("--version")) { - version = arg.substring("--version=".length()); - } - } - String relativePath = ci4sUsername + "/datasets/" + dataset.get("id") + "/" + dataset.get("identifier") + "/" + version + "/dataset"; - newDatasetService.deleteDatasetVersionNew((String) dataset.get("identifier"), (String) dataset.get("owner"), version, relativePath); + for (String key : paramOutput.keySet()) { + //删除导出模型版本 + if (key.contains("model-export")) { + String query = "\"insId\":" + experimentIns.getId(); + ModelDependency1 modelDependency1 = modelDependency1Dao.queryByInsId(query); + String relativePath = ci4sUsername + "/model/" + modelDependency1.getRepoId() + "/" + modelDependency1.getIdentifier() + "/" + modelDependency1.getVersion() + "/model"; + modelsService.deleteVersion(modelDependency1.getRepoId(), modelDependency1.getIdentifier(), modelDependency1.getOwner(), modelDependency1.getVersion(), relativePath); + break; } + //删除导出数据集版本 todo +// String relativePath = ci4sUsername + "/datasets/" + dataset.get("id") + "/" + dataset.get("identifier") + "/" + version + "/dataset"; +// newDatasetService.deleteDatasetVersionNew((String) dataset.get("identifier"), (String) dataset.get("owner"), version, relativePath); } } } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java index e57296ca..846581c6 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java @@ -515,6 +515,7 @@ public class ExperimentServiceImpl implements ExperimentService { while (dependendcyIterator.hasNext()) { ModelsVo modelMetaVo = new ModelsVo(); + modelMetaVo.setInsId(experimentInsId); modelMetaVo.setOwner(gitLinkUsername); ModelDependency1 modelDependency = new ModelDependency1(); modelDependency.setOwner(gitLinkUsername); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ModelMetaVo.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ModelMetaVo.java index 2a5a538e..2a5cc2f5 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ModelMetaVo.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/ModelMetaVo.java @@ -62,6 +62,9 @@ public class ModelMetaVo implements Serializable { @ApiModelProperty(value = "指标查询参数") private HashMap metricsParams; + @ApiModelProperty(value = "实验实例id") + private Integer insId; + @ApiModelProperty(value = "训练任务") private TrainTaskDepency trainTask; diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml index 4e77a29b..95e29f1f 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ModelDependency1DaoMapper.xml @@ -60,6 +60,13 @@ order by create_time desc limit 1 + + + + insert into dataset_temp_storage(name, version, source, state, create_by, create_time, update_by, update_time) From c9377ee2748540b2edd0817213f4e62c30b47481 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Sat, 19 Oct 2024 17:13:17 +0800 Subject: [PATCH 50/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=BB=88=E6=AD=A2?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=95=B0=E6=8D=AE=E9=9B=86=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/service/impl/ExperimentInsServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index d1fa276d..f327e71c 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -454,7 +454,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { //删除导出数据集版本 todo if (key.contains("dataset-export")) { HashMap queryMap = new HashMap(); - queryMap.put("insId", experimentIns.getId()); + queryMap.put("ins_id", experimentIns.getId()); DatasetTempStorage datasetTempStorage = datasetTempStorageDao.queryByInsId(JSON.toJSONString(queryMap)); Map source = JsonUtils.jsonToMap(datasetTempStorage.getSource()); String relativePath = ci4sUsername + "/datasets/" + source.get("repo_id") + "/" + source.get("identifier") + "/" + source.get("version") + "/dataset"; From 6a8f5c2d1ff7bfbc935f417835cda5524c46baa5 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 08:34:39 +0800 Subject: [PATCH 51/91] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/service/impl/ExperimentInsServiceImpl.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index f327e71c..4d3a96b9 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -451,7 +451,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { modelsService.deleteVersion(modelDependency1.getRepoId(), modelDependency1.getIdentifier(), modelDependency1.getOwner(), modelDependency1.getVersion(), relativePath); break; } - //删除导出数据集版本 todo + //删除导出数据集版本 if (key.contains("dataset-export")) { HashMap queryMap = new HashMap(); queryMap.put("ins_id", experimentIns.getId()); From a311f166b6dcce627c42dc38d0ff8b21034883cd Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 08:56:49 +0800 Subject: [PATCH 52/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/managementPlatform/ExperimentInsDaoMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml index 39d12aaa..8d22dc41 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml @@ -63,7 +63,7 @@ select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state from experiment_ins where experiment_id = #{experiment_id} and state = 1 - order by create_time DESC + order by update_time DESC limit 5 From a99a90a1bc62096c671f0cb2606e9173925b1eae Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 09:33:43 +0800 Subject: [PATCH 53/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExperimentInstanceStatusTask.java | 45 +------------------ .../impl/ExperimentInsServiceImpl.java | 19 +++++++- 2 files changed, 19 insertions(+), 45 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index 131dca48..51feb5b4 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -34,7 +34,6 @@ public class ExperimentInstanceStatusTask { // 首先查到所有非终止态的实验实例 List experimentInsList = experimentInsService.queryByExperimentIsNotTerminated(); // 去argo查询状态 - List updateList = new ArrayList<>(); if (experimentInsList != null && experimentInsList.size() > 0) { for (ExperimentIns experimentIns : experimentInsList) { //当原本状态为null或非终止态时才调用argo接口 @@ -49,48 +48,6 @@ public class ExperimentInstanceStatusTask { synchronized (experimentIds) { experimentIds.add(experimentIns.getExperimentId()); } - updateList.add(experimentIns); - } - } - if (updateList.size() > 0) { - experimentInsDao.insertOrUpdateBatch(updateList); - - //遍历模型关系表,找到 - List modelDependencyList = new ArrayList(); - for (ExperimentIns experimentIns : updateList) { - ModelDependency modelDependencyquery = new ModelDependency(); - modelDependencyquery.setExpInsId(experimentIns.getId()); - modelDependencyquery.setState(2); - - List modelDependencyListquery = modelDependencyDao.queryByModelDependency(modelDependencyquery); - if (modelDependencyListquery == null || modelDependencyListquery.size() == 0) { - continue; - } - ModelDependency modelDependency = modelDependencyListquery.get(0); - //查看状态, - if (StringUtils.equals("Failed", experimentIns.getStatus())) { - //取出节点状态 - String trainTask = modelDependency.getTrainTask(); - Map trainMap = JacksonUtil.parseJSONStr2Map(trainTask); - String task_id = (String) trainMap.get("task_id"); - if (StringUtils.isEmpty(task_id)) { - continue; - } - String nodesStatus = experimentIns.getNodesStatus(); - Map nodeMaps = JacksonUtil.parseJSONStr2Map(nodesStatus); - Map nodeMap = JacksonUtil.parseJSONStr2Map(JacksonUtil.toJSONString(nodeMaps.get(task_id))); - - if (nodeMap == null) { - continue; - } - if (!StringUtils.equals("Succeeded", (String) nodeMap.get("phase"))) { - modelDependency.setState(0); - modelDependencyList.add(modelDependency); - } - } - } - if (modelDependencyList.size() > 0) { - modelDependencyDao.insertOrUpdateBatch(modelDependencyList); } } } @@ -105,7 +62,7 @@ public class ExperimentInstanceStatusTask { for (Integer experimentId : experimentIds) { // 获取当前实验的所有实例列表 List insList = experimentInsService.getByExperimentId(experimentId); - List statusList = new ArrayList(); + List statusList = new ArrayList<>(); // 更新实验状态列表 for (int i = 0; i < insList.size(); i++) { statusList.add(insList.get(i).getStatus()); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index 4d3a96b9..635b10bd 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -3,6 +3,7 @@ package com.ruoyi.platform.service.impl; import com.alibaba.fastjson2.JSON; import com.ruoyi.common.security.utils.SecurityUtils; import com.ruoyi.platform.domain.DatasetTempStorage; +import com.ruoyi.platform.domain.Experiment; import com.ruoyi.platform.domain.ExperimentIns; import com.ruoyi.platform.domain.ModelDependency1; import com.ruoyi.platform.mapper.DatasetTempStorageDao; @@ -120,7 +121,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { * @return 实验列表 */ @Override - public List getByExperimentId(Integer experimentId) throws IOException { + public List getByExperimentId(Integer experimentId) { //代码全部迁移至定时任务 //搞个标记,当状态改变才去改表 @@ -239,6 +240,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { return "实验实例正在运行,不可删除"; } experimentIns.setState(0); + updateExperimentStatus(experimentIns.getExperimentId()); return this.experimentInsDao.update(experimentIns) > 0 ? "删除成功" : "删除失败"; } @@ -665,6 +667,21 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { return flag; } + void updateExperimentStatus(Integer experimentId) { + List insList = getByExperimentId(experimentId); + List statusList = new ArrayList<>(); + // 更新实验状态列表 + for (int i = 0; i < insList.size(); i++) { + statusList.add(insList.get(i).getStatus()); + } + String subStatus = statusList.toString().substring(1, statusList.toString().length() - 1); + Experiment experiment = experimentDao.queryById(experimentId); + experiment.setStatusList(subStatus); + List updateExperiments = new ArrayList<>(); + updateExperiments.add(experiment); + experimentDao.insertOrUpdateBatch(updateExperiments); + } + } From 8e6a5f643c87bbf6da6b6f1523e4ab9ac28221b5 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 09:46:11 +0800 Subject: [PATCH 54/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ExperimentInsServiceImpl.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index 635b10bd..d8c59007 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -240,9 +240,13 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { return "实验实例正在运行,不可删除"; } experimentIns.setState(0); - updateExperimentStatus(experimentIns.getExperimentId()); - return this.experimentInsDao.update(experimentIns) > 0 ? "删除成功" : "删除失败"; - + int update = this.experimentInsDao.update(experimentIns); + if (update > 0) { + updateExperimentStatus(experimentIns.getExperimentId()); + return "删除成功"; + } else { + return "删除失败"; + } } @Override From a270e685e43cca093ee7a9234ffbc6f382dd6ac0 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 10:00:57 +0800 Subject: [PATCH 55/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/platform/service/ExperimentInsService.java | 2 ++ .../ruoyi/platform/service/impl/ExperimentInsServiceImpl.java | 4 +++- .../ruoyi/platform/service/impl/ExperimentServiceImpl.java | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java index 3953a01e..98ee1b6d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java @@ -108,4 +108,6 @@ public interface ExperimentInsService { List queryByExperimentIsNotTerminated(); Map countByStatus(); + + void updateExperimentStatus(Integer experimentId); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index d8c59007..1319f0a9 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -426,6 +426,8 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { //删除数据集模型导出版本 deleteExportVersion(experimentIns); + //修改实验状态 + updateExperimentStatus(experimentIns.getExperimentId()); return true; } else { @@ -671,7 +673,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { return flag; } - void updateExperimentStatus(Integer experimentId) { + public void updateExperimentStatus(Integer experimentId) { List insList = getByExperimentId(experimentId); List statusList = new ArrayList<>(); // 更新实验状态列表 diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java index 6ddf7386..9ac0e089 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java @@ -311,6 +311,7 @@ public class ExperimentServiceImpl implements ExperimentService { } List updatedExperimentInsList = experimentInsService.getByExperimentId(id); experiment.setExperimentInsList(updatedExperimentInsList); + experimentInsService.updateExperimentStatus(id); return experiment; } From f023bc59f326097b27827928d4c32a7354199395 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 11:16:06 +0800 Subject: [PATCH 56/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=8A=B6=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/scheduling/ExperimentInstanceStatusTask.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index 51feb5b4..32b2fedf 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -34,6 +34,7 @@ public class ExperimentInstanceStatusTask { // 首先查到所有非终止态的实验实例 List experimentInsList = experimentInsService.queryByExperimentIsNotTerminated(); // 去argo查询状态 + List updateList = new ArrayList<>(); if (experimentInsList != null && experimentInsList.size() > 0) { for (ExperimentIns experimentIns : experimentInsList) { //当原本状态为null或非终止态时才调用argo接口 @@ -48,6 +49,10 @@ public class ExperimentInstanceStatusTask { synchronized (experimentIds) { experimentIds.add(experimentIns.getExperimentId()); } + updateList.add(experimentIns); + } + if (updateList.size() > 0) { + experimentInsDao.insertOrUpdateBatch(updateList); } } } From a6689ede3414344420e1af7858ded4d2bee91155 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 14:59:07 +0800 Subject: [PATCH 57/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=BF=90=E8=A1=8C=E7=BB=93=E6=9D=9F=E5=90=8E?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=8C=87=E6=A0=87=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/constant/Constant.java | 1 + .../ruoyi/platform/domain/ExperimentIns.java | 163 +----------------- .../ExperimentInstanceStatusTask.java | 43 ++++- 3 files changed, 45 insertions(+), 162 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/constant/Constant.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/constant/Constant.java index b325cc5d..834f63e4 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/constant/Constant.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/constant/Constant.java @@ -31,6 +31,7 @@ public class Constant { public final static String Pending = "Pending"; public final static String Init = "Init"; public final static String Stopped = "Stopped"; + public final static String Succeeded = "Succeeded"; public final static String Type_Train = "train"; public final static String Type_Evaluate = "evaluate"; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ExperimentIns.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ExperimentIns.java index 31246fd9..d29b7e10 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ExperimentIns.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ExperimentIns.java @@ -6,6 +6,7 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategy; import com.fasterxml.jackson.databind.annotation.JsonNaming; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; import java.io.Serializable; import java.util.Date; @@ -18,6 +19,7 @@ import java.util.Date; */ @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) @ApiModel("实验实例对象") +@Data public class ExperimentIns implements Serializable { private static final long serialVersionUID = 623464560240790680L; @ApiModelProperty(name = "id") @@ -53,6 +55,10 @@ public class ExperimentIns implements Serializable { @JsonRawValue private String metricRecord; + @ApiModelProperty(value = "指标数值", notes = "以JSON字符串格式存储") + @JsonRawValue + private String metricValue; + @ApiModelProperty(value = "开始时间") private Date startTime; @@ -81,162 +87,5 @@ public class ExperimentIns implements Serializable { @TableField(exist = false) private String experimentName; - public ExperimentIns() { - } - - - public Integer getId() { - return id; - } - - public void setId(Integer id) { - this.id = id; - } - - public Integer getExperimentId() { - return experimentId; - } - - public void setExperimentId(Integer experimentId) { - this.experimentId = experimentId; - } - - public String getArgoInsName() { - return argoInsName; - } - - public void setArgoInsName(String argoInsName) { - this.argoInsName = argoInsName; - } - - public String getArgoInsNs() { - return argoInsNs; - } - - public void setArgoInsNs(String argoInsNs) { - this.argoInsNs = argoInsNs; - } - - public String getStatus() { - return status; - } - - public void setStatus(String status) { - this.status = status; - } - - - public String getNodesStatus() { - return nodesStatus; - } - - public void setNodesStatus(String nodesStatus) { - this.nodesStatus = nodesStatus; - } - - public String getNodesResult() { - return nodesResult; - } - - public void setNodesResult(String nodesResult) { - this.nodesResult = nodesResult; - } - - public String getNodesLogs() { - return nodesLogs; - } - - public void setNodesLogs(String nodesLogs) { - this.nodesLogs = nodesLogs; - } - - public String getGlobalParam() { - return globalParam; - } - - public void setGlobalParam(String globalParam) { - this.globalParam = globalParam; - } - - public void setStartTime(Date startTime) { - this.startTime = startTime; - } - - public Date getStartTime() { - return startTime; - } - - public void setFinishTime(Date finishTime) { - this.finishTime = finishTime; - } - - public Date getFinishTime() { - return finishTime; - } - - - public String getCreateBy() { - return createBy; - } - - public void setCreateBy(String createBy) { - this.createBy = createBy; - } - - public Date getCreateTime() { - return createTime; - } - - public void setCreateTime(Date createTime) { - this.createTime = createTime; - } - - public String getUpdateBy() { - return updateBy; - } - - public void setUpdateBy(String updateBy) { - this.updateBy = updateBy; - } - - public Date getUpdateTime() { - return updateTime; - } - - public void setUpdateTime(Date updateTime) { - this.updateTime = updateTime; - } - - public Integer getState() { - return state; - } - - public void setState(Integer state) { - this.state = state; - } - - public Long getWorkflowId() { - return workflowId; - } - - public void setWorkflowId(Long workflowId) { - this.workflowId = workflowId; - } - - public String getMetricRecord() { - return metricRecord; - } - - public void setMetricRecord(String metricRecord) { - this.metricRecord = metricRecord; - } - - public String getExperimentName() { - return experimentName; - } - - public void setExperimentName(String experimentName) { - this.experimentName = experimentName; - } } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index 32b2fedf..eaf6ee12 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -1,13 +1,15 @@ package com.ruoyi.platform.scheduling; +import com.ruoyi.platform.constant.Constant; import com.ruoyi.platform.domain.Experiment; import com.ruoyi.platform.domain.ExperimentIns; -import com.ruoyi.platform.domain.ModelDependency; import com.ruoyi.platform.mapper.ExperimentDao; import com.ruoyi.platform.mapper.ExperimentInsDao; -import com.ruoyi.platform.mapper.ModelDependencyDao; +import com.ruoyi.platform.service.AimService; import com.ruoyi.platform.service.ExperimentInsService; import com.ruoyi.platform.utils.JacksonUtil; +import com.ruoyi.platform.utils.JsonUtils; +import com.ruoyi.platform.vo.InsMetricInfoVo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; @@ -26,11 +28,12 @@ public class ExperimentInstanceStatusTask { @Resource private ExperimentInsDao experimentInsDao; @Resource - private ModelDependencyDao modelDependencyDao; + private AimService aimService; + private List experimentIds = new ArrayList<>(); @Scheduled(cron = "0/30 * * * * ?") // 每30S执行一次 - public void executeExperimentInsStatus() throws IOException { + public void executeExperimentInsStatus() throws Exception { // 首先查到所有非终止态的实验实例 List experimentInsList = experimentInsService.queryByExperimentIsNotTerminated(); // 去argo查询状态 @@ -38,12 +41,42 @@ public class ExperimentInstanceStatusTask { if (experimentInsList != null && experimentInsList.size() > 0) { for (ExperimentIns experimentIns : experimentInsList) { //当原本状态为null或非终止态时才调用argo接口 - String oldStatus = experimentIns.getStatus(); try { experimentIns = experimentInsService.queryStatusFromArgo(experimentIns); } catch (Exception e) { experimentIns.setStatus("Failed"); } + //运行成功的实验实例记录指标数值 + if (Constant.Succeeded.equals(experimentIns.getStatus())) { + Map metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); + List> trainMetricRecord = (List>) metricRecord.get("train"); + List> evaluateMetricRecord = (List>) metricRecord.get("evaluate"); + + HashMap metricValue = new HashMap<>(); + HashMap trainMetricValue = new HashMap<>(); + HashMap evaluateMetricValue = new HashMap<>(); + + if (trainMetricRecord != null && !trainMetricRecord.isEmpty()) { + String runId = (String) trainMetricRecord.get(0).get("run_id"); + List expTrainInfos = aimService.getExpTrainInfos1(true, experimentIns.getExperimentId(), runId); + for (InsMetricInfoVo expTrainInfo : expTrainInfos) { + Map metrics = expTrainInfo.getMetrics(); + trainMetricValue.putAll(metrics); + } + } + + if (evaluateMetricRecord != null && !evaluateMetricRecord.isEmpty()) { + String runId = (String) evaluateMetricRecord.get(0).get("run_id"); + List expTrainInfos = aimService.getExpTrainInfos1(false, experimentIns.getExperimentId(), runId); + for (InsMetricInfoVo expTrainInfo : expTrainInfos) { + Map metrics = expTrainInfo.getMetrics(); + evaluateMetricValue.putAll(metrics); + } + } + metricValue.put("train", trainMetricValue); + metricValue.put("evaluate", evaluateMetricValue); + experimentIns.setMetricValue(JsonUtils.mapToJson(metricValue)); + } experimentIns.setUpdateTime(new Date()); // 线程安全的添加操作 synchronized (experimentIds) { From d1c35e4bee525224c69ee2925d967e44ab123a7c Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 16:21:29 +0800 Subject: [PATCH 58/91] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=AF=B9=E6=AF=94=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/service/ServiceController.java | 6 +++++ .../service/impl/ServiceServiceImpl.java | 23 ++++++++++++++++++ .../com/ruoyi/platform/utils/ConvertUtil.java | 24 +++++++++++++++++++ 3 files changed, 53 insertions(+) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/service/ServiceController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/service/ServiceController.java index 7d973bae..3eb28e4c 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/service/ServiceController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/service/ServiceController.java @@ -89,6 +89,12 @@ public class ServiceController extends BaseController { return genericsSuccess(serviceService.getServiceVersion(id)); } + @GetMapping("serviceVersionCompare") + @ApiOperation("服务版本版本对比") + public GenericsAjaxResult> serviceVersionCompare(@RequestParam("id1") Long id1, @RequestParam("id2") Long id2) throws IllegalAccessException { + return genericsSuccess(serviceService.serviceVersionCompare(id1, id2)); + } + @GetMapping("/serviceVersionList/{id}") @ApiOperation("查询服务版本列表") public GenericsAjaxResult> serviceVersionList(@PathVariable("id") Long id) { diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java index 11b30f45..36e0ef08 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java @@ -7,6 +7,7 @@ import com.ruoyi.platform.constant.Constant; import com.ruoyi.platform.domain.ServiceVersion; import com.ruoyi.platform.mapper.ServiceDao; import com.ruoyi.platform.service.ServiceService; +import com.ruoyi.platform.utils.ConvertUtil; import com.ruoyi.platform.utils.HttpUtils; import com.ruoyi.platform.utils.JacksonUtil; import com.ruoyi.platform.vo.serviceVos.ServiceCodeConfigVo; @@ -157,6 +158,28 @@ public class ServiceServiceImpl implements ServiceService { return serviceVersionVo; } + @Override + public Map serviceVersionCompare(Long id1, Long id2) throws IllegalAccessException { + HashMap result = new HashMap<>(); + + ServiceVersion serviceVersion1 = serviceDao.getServiceVersionById(id1); + ServiceVersion serviceVersion2 = serviceDao.getServiceVersionById(id2); + com.ruoyi.platform.domain.Service service = serviceDao.getServiceById(serviceVersion1.getServiceId()); + + ServiceVersionVo serviceVersionVo1 = getServiceVersionVo(serviceVersion1); + ServiceVersionVo serviceVersionVo2 = getServiceVersionVo(serviceVersion1); + serviceVersionVo1.setServiceName(service.getServiceName()); + serviceVersionVo2.setServiceName(service.getServiceName()); + + Map compareMap = ConvertUtil.compareObjects(serviceVersion1, serviceVersion2); + + result.put("version1", serviceVersionVo1); + result.put("version2", serviceVersionVo2); + result.put("differences", compareMap); + + return result; + } + @Override public String deleteService(Long id) { com.ruoyi.platform.domain.Service service = serviceDao.getServiceById(id); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/ConvertUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/ConvertUtil.java index a4195a17..52c89dd3 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/ConvertUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/ConvertUtil.java @@ -158,5 +158,29 @@ public class ConvertUtil { } return sb.toString(); } + + public static Map compareObjects(Object obj1, Object obj2) throws IllegalAccessException { + Map differences = new HashMap<>(); + + // Get the class of the first object + Class clazz = obj1.getClass(); + + // Iterate over all fields of the class + for (Field field : clazz.getDeclaredFields()) { + // Set the fields to be accessible + field.setAccessible(true); + + // Get the field value from both objects + Object value1 = field.get(obj1); + Object value2 = field.get(obj2); + + // Compare the field values + if ((value1 !=null && !value1.equals(value2)) || (value2 !=null && !value2.equals(value1))) { + differences.put(field.getName(), "Field " + field.getName() + " differs: " + value1 + " vs " + value2); + } + } + + return differences; + } } From 957c38228a3509e7acf334f8608dcab4f0d6d7fd Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 16:21:36 +0800 Subject: [PATCH 59/91] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=89=88=E6=9C=AC=E5=AF=B9=E6=AF=94=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/platform/service/ServiceService.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ServiceService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ServiceService.java index 6ce6bc6a..5c69f257 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ServiceService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ServiceService.java @@ -28,6 +28,8 @@ public interface ServiceService { ServiceVersionVo getServiceVersion(Long id); + Map serviceVersionCompare(Long id1, Long id2) throws IllegalAccessException; + String deleteService(Long id); String deleteServiceVersion(Long id); From 0b5756e1bb2aec14c61bd2a7607f223afa674832 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 16:59:40 +0800 Subject: [PATCH 60/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=BF=90=E8=A1=8C=E7=BB=93=E6=9D=9F=E5=90=8E?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=8C=87=E6=A0=87=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/managementPlatform/ExperimentInsDaoMapper.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml index 8d22dc41..d23de89a 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml @@ -296,7 +296,8 @@ create_time = VALUES(create_time), update_by = VALUES(update_by), update_time = VALUES(update_time), - state = VALUES(state); + state = VALUES(state), + metric_value = VALUES(metric_value); From 1ec6bec29d4ef45cfed087610d6086612ce2063c Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 17:14:58 +0800 Subject: [PATCH 61/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=BF=90=E8=A1=8C=E7=BB=93=E6=9D=9F=E5=90=8E?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=8C=87=E6=A0=87=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExperimentInstanceStatusTask.java | 38 ++++++++++++------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index eaf6ee12..64f43582 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -49,28 +49,38 @@ public class ExperimentInstanceStatusTask { //运行成功的实验实例记录指标数值 if (Constant.Succeeded.equals(experimentIns.getStatus())) { Map metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); - List> trainMetricRecord = (List>) metricRecord.get("train"); - List> evaluateMetricRecord = (List>) metricRecord.get("evaluate"); + List> trainMetricRecords = (List>) metricRecord.get("train"); + List> evaluateMetricRecords = (List>) metricRecord.get("evaluate"); HashMap metricValue = new HashMap<>(); HashMap trainMetricValue = new HashMap<>(); HashMap evaluateMetricValue = new HashMap<>(); - if (trainMetricRecord != null && !trainMetricRecord.isEmpty()) { - String runId = (String) trainMetricRecord.get(0).get("run_id"); - List expTrainInfos = aimService.getExpTrainInfos1(true, experimentIns.getExperimentId(), runId); - for (InsMetricInfoVo expTrainInfo : expTrainInfos) { - Map metrics = expTrainInfo.getMetrics(); - trainMetricValue.putAll(metrics); + if (trainMetricRecords != null && !trainMetricRecords.isEmpty()) { + for (Map trainMetricRecord : trainMetricRecords) { + String taskId = (String) trainMetricRecord.get("task_id"); + if (taskId.startsWith("model-export")) { + String runId = (String) trainMetricRecord.get("run_id"); + List expTrainInfos = aimService.getExpTrainInfos1(true, experimentIns.getExperimentId(), runId); + for (InsMetricInfoVo expTrainInfo : expTrainInfos) { + Map metrics = expTrainInfo.getMetrics(); + trainMetricValue.putAll(metrics); + } + } } } - if (evaluateMetricRecord != null && !evaluateMetricRecord.isEmpty()) { - String runId = (String) evaluateMetricRecord.get(0).get("run_id"); - List expTrainInfos = aimService.getExpTrainInfos1(false, experimentIns.getExperimentId(), runId); - for (InsMetricInfoVo expTrainInfo : expTrainInfos) { - Map metrics = expTrainInfo.getMetrics(); - evaluateMetricValue.putAll(metrics); + if (evaluateMetricRecords != null && !evaluateMetricRecords.isEmpty()) { + for (Map evaluateMetricRecord : evaluateMetricRecords) { + String taskId = (String) evaluateMetricRecord.get("task_id"); + if (taskId.startsWith("model-export")) { + String runId = (String) evaluateMetricRecord.get("run_id"); + List expTrainInfos = aimService.getExpTrainInfos1(false, experimentIns.getExperimentId(), runId); + for (InsMetricInfoVo expTrainInfo : expTrainInfos) { + Map metrics = expTrainInfo.getMetrics(); + evaluateMetricValue.putAll(metrics); + } + } } } metricValue.put("train", trainMetricValue); From 803eea2054f7e9552c39c63fdd6721fe8c0886c4 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 17:39:39 +0800 Subject: [PATCH 62/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=BF=90=E8=A1=8C=E7=BB=93=E6=9D=9F=E5=90=8E?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=8C=87=E6=A0=87=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/scheduling/ExperimentInstanceStatusTask.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index 64f43582..dad643c6 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -59,7 +59,7 @@ public class ExperimentInstanceStatusTask { if (trainMetricRecords != null && !trainMetricRecords.isEmpty()) { for (Map trainMetricRecord : trainMetricRecords) { String taskId = (String) trainMetricRecord.get("task_id"); - if (taskId.startsWith("model-export")) { + if (taskId.startsWith("model-train")) { String runId = (String) trainMetricRecord.get("run_id"); List expTrainInfos = aimService.getExpTrainInfos1(true, experimentIns.getExperimentId(), runId); for (InsMetricInfoVo expTrainInfo : expTrainInfos) { @@ -73,7 +73,7 @@ public class ExperimentInstanceStatusTask { if (evaluateMetricRecords != null && !evaluateMetricRecords.isEmpty()) { for (Map evaluateMetricRecord : evaluateMetricRecords) { String taskId = (String) evaluateMetricRecord.get("task_id"); - if (taskId.startsWith("model-export")) { + if (taskId.startsWith("model-evaluate")) { String runId = (String) evaluateMetricRecord.get("run_id"); List expTrainInfos = aimService.getExpTrainInfos1(false, experimentIns.getExperimentId(), runId); for (InsMetricInfoVo expTrainInfo : expTrainInfos) { From 2568d651e12ac3bc28109e18f7c772e12684acbc Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 18:04:04 +0800 Subject: [PATCH 63/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=BF=90=E8=A1=8C=E7=BB=93=E6=9D=9F=E5=90=8E?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=8C=87=E6=A0=87=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/managementPlatform/ExperimentInsDaoMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml index d23de89a..50d7bbc7 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml @@ -275,10 +275,10 @@ - insert into experiment_ins (id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_result, nodes_logs, global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state) + insert into experiment_ins (id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_result, nodes_logs, global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state, metric_value) values - (#{item.id}, #{item.experimentId}, #{item.argoInsName}, #{item.argoInsNs}, #{item.status}, #{item.nodesStatus}, #{item.nodesResult}, #{item.nodesLogs}, #{item.globalParam},#{item.metricRecord}, #{item.startTime}, #{item.finishTime}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state}) + (#{item.id}, #{item.experimentId}, #{item.argoInsName}, #{item.argoInsNs}, #{item.status}, #{item.nodesStatus}, #{item.nodesResult}, #{item.nodesLogs}, #{item.globalParam},#{item.metricRecord}, #{item.startTime}, #{item.finishTime}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state}, #{item.metric_value}) ON DUPLICATE KEY UPDATE experiment_id = VALUES(experiment_id), From 7f9cb9f3abb6e82c39aad0a2ea6bdef7af0636c3 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Mon, 21 Oct 2024 18:11:14 +0800 Subject: [PATCH 64/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=BF=90=E8=A1=8C=E7=BB=93=E6=9D=9F=E5=90=8E?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=8C=87=E6=A0=87=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/managementPlatform/ExperimentInsDaoMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml index 50d7bbc7..3ee4bd28 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml @@ -278,7 +278,7 @@ insert into experiment_ins (id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_result, nodes_logs, global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state, metric_value) values - (#{item.id}, #{item.experimentId}, #{item.argoInsName}, #{item.argoInsNs}, #{item.status}, #{item.nodesStatus}, #{item.nodesResult}, #{item.nodesLogs}, #{item.globalParam},#{item.metricRecord}, #{item.startTime}, #{item.finishTime}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state}, #{item.metric_value}) + (#{item.id}, #{item.experimentId}, #{item.argoInsName}, #{item.argoInsNs}, #{item.status}, #{item.nodesStatus}, #{item.nodesResult}, #{item.nodesLogs}, #{item.globalParam},#{item.metricRecord}, #{item.startTime}, #{item.finishTime}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state}, #{item.metricValue}) ON DUPLICATE KEY UPDATE experiment_id = VALUES(experiment_id), From 3b75b5f3879861f84fe1bc41cfd0ee5baa9b999d Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 22 Oct 2024 08:38:01 +0800 Subject: [PATCH 65/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduling/ExperimentInstanceStatusTask.java | 4 ++-- .../main/java/com/ruoyi/platform/service/AimService.java | 4 ++-- .../com/ruoyi/platform/service/impl/AimServiceImpl.java | 7 ++++++- .../platform/service/impl/ExperimentInsServiceImpl.java | 9 --------- .../ruoyi/platform/service/impl/ModelsServiceImpl.java | 4 ++-- 5 files changed, 12 insertions(+), 16 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index dad643c6..a5298747 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -61,7 +61,7 @@ public class ExperimentInstanceStatusTask { String taskId = (String) trainMetricRecord.get("task_id"); if (taskId.startsWith("model-train")) { String runId = (String) trainMetricRecord.get("run_id"); - List expTrainInfos = aimService.getExpTrainInfos1(true, experimentIns.getExperimentId(), runId); + List expTrainInfos = aimService.getExpInfos1(true, experimentIns.getExperimentId(), runId); for (InsMetricInfoVo expTrainInfo : expTrainInfos) { Map metrics = expTrainInfo.getMetrics(); trainMetricValue.putAll(metrics); @@ -75,7 +75,7 @@ public class ExperimentInstanceStatusTask { String taskId = (String) evaluateMetricRecord.get("task_id"); if (taskId.startsWith("model-evaluate")) { String runId = (String) evaluateMetricRecord.get("run_id"); - List expTrainInfos = aimService.getExpTrainInfos1(false, experimentIns.getExperimentId(), runId); + List expTrainInfos = aimService.getExpInfos1(false, experimentIns.getExperimentId(), runId); for (InsMetricInfoVo expTrainInfo : expTrainInfos) { Map metrics = expTrainInfo.getMetrics(); evaluateMetricValue.putAll(metrics); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java index 3e2ccb77..699d0036 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java @@ -10,10 +10,10 @@ public interface AimService { List getExpTrainInfos(Integer experimentId, String offset, int limit) throws Exception; - List getExpTrainInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception; - List getExpEvaluateInfos(Integer experimentId, String offset, int limit) throws Exception; + List getExpInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception; + String getExpMetrics(List runIds) throws Exception; HashMap queryMetricsParams(String runId) throws Exception; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index a2b21202..3bae116b 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -11,6 +11,7 @@ import com.ruoyi.platform.utils.JsonUtils; import com.ruoyi.platform.vo.InsMetricInfoVo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -145,9 +146,13 @@ public class AimServiceImpl implements AimService { return aimRunInfoList; } +// private List getExpInfos(Integer experimentId, int page, int size){ +// PageRequest pageRequest = PageRequest.of(page,size); +// +// } @Override - public List getExpTrainInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception { + public List getExpInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception { String encodedUrlString = URLEncoder.encode("run.id==\"" + runId + "\"", "UTF-8"); String url = aimProxyUrl + "/api/runs/search/run?query=" + encodedUrlString; String s = HttpUtils.sendGet(url, null); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java index 1319f0a9..b7ff69b4 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java @@ -172,15 +172,6 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { public Page queryByPage(ExperimentIns experimentIns, PageRequest pageRequest) throws IOException { long total = this.experimentInsDao.count(experimentIns); List experimentInsList = this.experimentInsDao.queryAllByLimit(experimentIns, pageRequest); -// if (experimentInsList!=null && experimentInsList.size()>0) { -// for (ExperimentIns ins : experimentInsList) { -// //如果实验实例不为空或者 -// if (ins != null && StringUtils.isEmpty(ins.getStatus())) { -// ins = this.queryStatusFromArgo(ins); -// this.update(ins); -// } -// } -// } return new PageImpl<>(experimentInsList, pageRequest, total); } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index f69b7359..ff053e78 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -1300,7 +1300,7 @@ public class ModelsServiceImpl implements ModelsService { for (int i = 0; i < trainMetrics.size(); i++) { JSONObject jsonObject = trainMetrics.getJSONObject(i); String runId = jsonObject.getString("run_id"); - List expTrainInfos = aimsService.getExpTrainInfos1(true, modelMetaVo.getTrainTask().getExperimentId(), runId); + List expTrainInfos = aimsService.getExpInfos1(true, modelMetaVo.getTrainTask().getExperimentId(), runId); for (InsMetricInfoVo expTrainInfo : expTrainInfos) { Map metrics1 = expTrainInfo.getMetrics(); train.putAll(metrics1); @@ -1322,7 +1322,7 @@ public class ModelsServiceImpl implements ModelsService { for (int i = 0; i < testMetrics.size(); i++) { JSONObject jsonObject = testMetrics.getJSONObject(i); String runId = jsonObject.getString("run_id"); - List expTestInfos = aimsService.getExpTrainInfos1(false, modelMetaVo.getTrainTask().getExperimentId(), runId); + List expTestInfos = aimsService.getExpInfos1(false, modelMetaVo.getTrainTask().getExperimentId(), runId); for (InsMetricInfoVo expTestInfo : expTestInfos) { Map metrics1 = expTestInfo.getMetrics(); evaluate.putAll(metrics1); From a6f54528d9ba1f606e0fe3b540e25084753075de Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 22 Oct 2024 08:57:44 +0800 Subject: [PATCH 66/91] =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=94=AF=E6=8C=81juice?= =?UTF-8?q?fs=E5=AD=98=E5=82=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/DatasetVersionServiceImpl.java | 6 +-- .../service/impl/ImageServiceImpl.java | 6 +-- .../service/impl/JupyterServiceImpl.java | 16 +++---- .../service/impl/TensorBoardServiceImpl.java | 14 +++---- .../ruoyi/platform/utils/K8sClientUtil.java | 42 +++++++++---------- .../com/ruoyi/platform/vo/FrameLogPathVo.java | 16 +++---- 6 files changed, 50 insertions(+), 50 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetVersionServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetVersionServiceImpl.java index 441ea786..4a00ddb4 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetVersionServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/DatasetVersionServiceImpl.java @@ -165,9 +165,9 @@ public class DatasetVersionServiceImpl implements DatasetVersionService { .findFirst() .ifPresent(datasetVersion -> { String url = datasetVersion.getUrl(); -// response.put("path", url); - String path = bucketName + '/' + url.substring(0, url.lastIndexOf('/')); - response.put("path", path); + response.put("path", url); +// String path = bucketName + '/' + url.substring(0, url.lastIndexOf('/')); +// response.put("path", path); }); response.put("content", datasetVersionList); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java index faacf8dd..92d2bb45 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ImageServiceImpl.java @@ -61,10 +61,10 @@ public class ImageServiceImpl implements ImageService { @Resource private MinioService minioService; -// @Value("${minio.dataReleaseBucketName}") -// private String bucketName; - @Value("${harbor.bucketName}") + @Value("${minio.dataReleaseBucketName}") private String bucketName; +// @Value("${harbor.bucketName}") +// private String bucketName; @Value("${harbor.repository}") private String repository; @Value("${harbor.harborUrl}") diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java index 3f2f7c9f..20e1e916 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java @@ -90,25 +90,25 @@ public class JupyterServiceImpl implements JupyterService { // 提取数据集,模型信息,得到数据集模型的path Map dataset = JacksonUtil.parseJSONStr2Map(devEnvironment.getDataset()); - String datasetPath = "argo-workflow" + "/" + dataset.get("path"); -// String datasetPath = (String) dataset.get("path"); +// String datasetPath = "argo-workflow" + "/" + dataset.get("path"); + String datasetPath = (String) dataset.get("path"); Map model = JacksonUtil.parseJSONStr2Map(devEnvironment.getModel()); - String modelPath = "argo-workflow" + "/" + model.get("path"); -// String modelPath = (String) model.get("path"); +// String modelPath = "argo-workflow" + "/" + model.get("path"); + String modelPath = (String) model.get("path"); LoginUser loginUser = SecurityUtils.getLoginUser(); //构造pod名称 String podName = loginUser.getUsername().toLowerCase() + "-editor-pod" + "-" + id; //新建编辑器的pvc - String pvcName = loginUser.getUsername().toLowerCase() + "-editor-pvc"; - V1PersistentVolumeClaim pvc = k8sClientUtil.createPvc(namespace, pvcName, storage, storageClassName); +// String pvcName = loginUser.getUsername().toLowerCase() + "-editor-pvc"; +// V1PersistentVolumeClaim pvc = k8sClientUtil.createPvc(namespace, pvcName, storage, storageClassName); //TODO 设置镜像可配置,这里先用默认镜像启动pod // 调用修改后的 createPod 方法,传入额外的参数 - Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, devEnvironment, minioPvcName, datasetPath, modelPath); -// Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, null, devEnvironment, minioPvcName, datasetPath, modelPath); +// Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, pvc, devEnvironment, minioPvcName, datasetPath, modelPath); + Integer podPort = k8sClientUtil.createConfiguredPod(podName, namespace, port, mountPath, null, devEnvironment, minioPvcName, datasetPath, modelPath); String url = masterIp + ":" + podPort; redisService.setCacheObject(podName, masterIp + ":" + podPort); devEnvironment.setStatus("Pending"); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/TensorBoardServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/TensorBoardServiceImpl.java index dca3651d..83b87d82 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/TensorBoardServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/TensorBoardServiceImpl.java @@ -59,17 +59,17 @@ public class TensorBoardServiceImpl implements TensorBoardService { @Override public String runTensorBoard(FrameLogPathVo frameLogPathVo) throws Exception { - if (StringUtils.isEmpty(frameLogPathVo.getPath())||StringUtils.isEmpty(frameLogPathVo.getPvcName())){ - throw new Exception("存储路径或存储为空"); - } -// if (StringUtils.isEmpty(frameLogPathVo.getPath())) { -// throw new Exception("存储路径为空"); +// if (StringUtils.isEmpty(frameLogPathVo.getPath())||StringUtils.isEmpty(frameLogPathVo.getPvcName())){ +// throw new Exception("存储路径或存储为空"); // } + if (StringUtils.isEmpty(frameLogPathVo.getPath())) { + throw new Exception("存储路径为空"); + } LoginUser loginUser = SecurityUtils.getLoginUser(); String podName = loginUser.getUsername().toLowerCase()+"-"+frameLogPathVo.getPath().split("/")[2]+ "-tensorboard-pod"; - Integer podPort = k8sClientUtil.createPodWithSubPath(podName, StringUtils.isEmpty(frameLogPathVo.getNamespace()) ? "default" : frameLogPathVo.getNamespace(), port, mountPath, frameLogPathVo.getPath(), frameLogPathVo.getPvcName(), image); -// Integer podPort = k8sClientUtil.createPodWithSubPath(podName, StringUtils.isEmpty(frameLogPathVo.getNamespace()) ? "default" : frameLogPathVo.getNamespace(), port, mountPath, frameLogPathVo.getPath(), image); +// Integer podPort = k8sClientUtil.createPodWithSubPath(podName, StringUtils.isEmpty(frameLogPathVo.getNamespace()) ? "default" : frameLogPathVo.getNamespace(), port, mountPath, frameLogPathVo.getPath(), frameLogPathVo.getPvcName(), image); + Integer podPort = k8sClientUtil.createPodWithSubPath(podName, StringUtils.isEmpty(frameLogPathVo.getNamespace()) ? "default" : frameLogPathVo.getNamespace(), port, mountPath, frameLogPathVo.getPath(), image); redisService.setCacheObject(podName, masterIp + ":" + podPort); return masterIp + ":" + podPort; } diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java index 49d56853..024298d8 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java @@ -34,8 +34,8 @@ import java.util.*; @Component public class K8sClientUtil { -// @Value("${jupyter.hostPath}") -// private String hostPath; + @Value("${jupyter.hostPath}") + private String hostPath; private String http; private String token; @@ -314,8 +314,8 @@ public class K8sClientUtil { * @param image 镜像 * @return 创建成功的pod,的nodePort端口 */ - public Integer createPodWithSubPath(String podName, String namespace, Integer port, String mountPath, String subPath, String pvcName, String image) { -// public Integer createPodWithSubPath(String podName, String namespace, Integer port, String mountPath, String subPath, String image) { +// public Integer createPodWithSubPath(String podName, String namespace, Integer port, String mountPath, String subPath, String pvcName, String image) { + public Integer createPodWithSubPath(String podName, String namespace, Integer port, String mountPath, String subPath, String image) { Map selector = new LinkedHashMap<>(); selector.put("k8s-jupyter", podName); @@ -366,8 +366,8 @@ public class K8sClientUtil { .endContainer() .addNewVolume() .withName("workspace") -// .withHostPath(new V1HostPathVolumeSource().path(hostPath).type("DirectoryOrCreate")) - .withPersistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvcName)) + .withHostPath(new V1HostPathVolumeSource().path(hostPath).type("DirectoryOrCreate")) +// .withPersistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvcName)) .endVolume() .withTerminationGracePeriodSeconds(14400L) .endSpec() @@ -449,25 +449,25 @@ public class K8sClientUtil { } } - // 配置卷和卷挂载 -// List volumeMounts = new ArrayList<>(); -// volumeMounts.add(new V1VolumeMount().name("workspace").mountPath("/opt/notebooks")); -// volumeMounts.add(new V1VolumeMount().name("data").mountPath("/opt/dataset").subPath(datasetPath).readOnly(true)); -// volumeMounts.add(new V1VolumeMount().name("data").mountPath("/opt/model").subPath(modelPath).readOnly(true)); -// -// List volumes = new ArrayList<>(); -// volumes.add(new V1Volume().name("workspace").hostPath(new V1HostPathVolumeSource().path(hostPath + "/" + podName + "/notebooks").type("DirectoryOrCreate"))); -// volumes.add(new V1Volume().name("data").hostPath(new V1HostPathVolumeSource().path(hostPath).type("DirectoryOrCreate"))); - // 配置卷和卷挂载 List volumeMounts = new ArrayList<>(); - volumeMounts.add(new V1VolumeMount().name("workspace").mountPath(mountPath)); - volumeMounts.add(new V1VolumeMount().name("minio-pvc").mountPath("/opt/data").subPath(datasetPath).readOnly(true)); - volumeMounts.add(new V1VolumeMount().name("minio-pvc").mountPath("/opt/model").subPath(modelPath).readOnly(true)); + volumeMounts.add(new V1VolumeMount().name("workspace").mountPath("/opt/notebooks")); + volumeMounts.add(new V1VolumeMount().name("data").mountPath("/opt/dataset").subPath(datasetPath).readOnly(true)); + volumeMounts.add(new V1VolumeMount().name("data").mountPath("/opt/model").subPath(modelPath).readOnly(true)); List volumes = new ArrayList<>(); - volumes.add(new V1Volume().name("workspace").persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvc.getMetadata().getName()))); - volumes.add(new V1Volume().name("minio-pvc").persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(dataPvcName))); + volumes.add(new V1Volume().name("workspace").hostPath(new V1HostPathVolumeSource().path(hostPath + "/" + podName + "/notebooks").type("DirectoryOrCreate"))); + volumes.add(new V1Volume().name("data").hostPath(new V1HostPathVolumeSource().path(hostPath).type("DirectoryOrCreate"))); + + // 配置卷和卷挂载 +// List volumeMounts = new ArrayList<>(); +// volumeMounts.add(new V1VolumeMount().name("workspace").mountPath(mountPath)); +// volumeMounts.add(new V1VolumeMount().name("minio-pvc").mountPath("/opt/data").subPath(datasetPath).readOnly(true)); +// volumeMounts.add(new V1VolumeMount().name("minio-pvc").mountPath("/opt/model").subPath(modelPath).readOnly(true)); +// +// List volumes = new ArrayList<>(); +// volumes.add(new V1Volume().name("workspace").persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvc.getMetadata().getName()))); +// volumes.add(new V1Volume().name("minio-pvc").persistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(dataPvcName))); //配置资源 diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/FrameLogPathVo.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/FrameLogPathVo.java index e4c8bd26..da32b84d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/FrameLogPathVo.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/FrameLogPathVo.java @@ -10,7 +10,7 @@ public class FrameLogPathVo implements Serializable { String path; String namespace; - String pvcName; +// String pvcName; public String getPath() { return path; } @@ -27,11 +27,11 @@ public class FrameLogPathVo implements Serializable { this.namespace = namespace; } - public String getPvcName() { - return pvcName; - } - - public void setPvcName(String pvcName) { - this.pvcName = pvcName; - } +// public String getPvcName() { +// return pvcName; +// } +// +// public void setPvcName(String pvcName) { +// this.pvcName = pvcName; +// } } From 42ce67062f23239a235f714d7f6b2c50fcc38444 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Tue, 22 Oct 2024 09:47:17 +0800 Subject: [PATCH 67/91] =?UTF-8?q?feat:=20=E5=AE=9E=E9=AA=8C=E5=AF=B9?= =?UTF-8?q?=E6=AF=94=E6=B7=BB=E5=8A=A0=E4=B8=8A=E6=8B=89=E5=8A=A0=E8=BD=BD?= =?UTF-8?q?=E6=9B=B4=E5=A4=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/.npmrc | 1 + react-ui/package.json | 4 +- react-ui/src/assets/img/robot.png | Bin 1777 -> 15171 bytes react-ui/src/components/KFModal/index.less | 2 +- react-ui/src/overrides.less | 2 +- .../pages/Experiment/Comparison/index.less | 29 ++- .../src/pages/Experiment/Comparison/index.tsx | 102 ++++---- .../components/AddExperimentModal/index.tsx | 2 +- react-ui/src/pages/Workspace/index.less | 10 +- react-ui/src/services/typings.d.ts | 223 ++++++++++++++++++ 10 files changed, 319 insertions(+), 56 deletions(-) create mode 100644 react-ui/.npmrc diff --git a/react-ui/.npmrc b/react-ui/.npmrc new file mode 100644 index 00000000..dd026c83 --- /dev/null +++ b/react-ui/.npmrc @@ -0,0 +1 @@ +save-prefix=~ diff --git a/react-ui/package.json b/react-ui/package.json index d5c09dbd..aebf21ca 100644 --- a/react-ui/package.json +++ b/react-ui/package.json @@ -60,7 +60,7 @@ "@antv/hierarchy": "^0.6.12", "@types/crypto-js": "^4.2.2", "@umijs/route-utils": "^4.0.1", - "antd": "^5.4.4", + "antd": "~5.21.4", "classnames": "^2.3.2", "crypto-js": "^4.2.0", "echarts": "^5.5.0", @@ -111,7 +111,7 @@ "umi-presets-pro": "^2.0.0" }, "engines": { - "node": ">=12.0.0" + "node": ">=16.14.0" }, "create-umi": { "ignoreScript": [ diff --git a/react-ui/src/assets/img/robot.png b/react-ui/src/assets/img/robot.png index c1379ef35055ce861d41a5ae240da54982d6dac2..9e179741cce50d8e436f887cd6ac25a777e99ae5 100644 GIT binary patch literal 15171 zcmV-JJG{h+P)S9C@v#>gbbw;<9#jpd0mBx`INobme&fPEEu>b$L=c_)qUe&#I zb5*@l+Pu1TE1dey`QI;pUqSrlDc~tEbP5!P{zU&kPXSK>@xb$oz*ArZ6!5?s0nz;< zJq0}Q{2K5S7y$)5@J2v%|42^(4?MpHJOxHT0S~+p5Zyo0Q@{hyuK`bi5m3MbZv;g5 zkMtDqz{|`Us3)AOLOnCDw15Yia55J#g$DNONr5!50oWURpbnbCQTO-28wJ(PGd=J| zM*0*y*aL51lh7rwS_z65vMcHol>t=rk_8+K;+)*saot3)WzU@%CM_l0PyGH>q4t$Ap zLJz!l%gO_99)%K!kx}AfQmzKhwNm8q<(fPNk3JS4ISPM|0GJ-yZnFCEJ-~P?o^=O) zFYdtoZmJaJ|7;WamEn@zazlc#?Mm`sbmy-vx%x5L>Ayz|*xKo8VX!GDbH&C@GPZh| zJO<0|#9C3F23kBBL|>97n&35eV?5UuYw|Nt;-_17%CBXmR05Gz0hxp|CejT(2tDvx ziIS~==YpTOi*=IBI;-5q`KS>YF$>X%Kvz9Og1-(r7j4g^uo3} z;lkv83lw-UpgTYGLlmXAt#i%+;0~_IdKfU?0t}r7Vvc16OWlkUoNx}>+_#Da`RIK` z!v*(SP$`bK;)Fc+{5Wgt!ULZNp1T5F;KhlO#~R>`9axjoN_9CKpB~rEBF_9Zb@{)w zx?HlgELY)O=Hw;^RB>F;1235N1q8ehmy2=(v<4fAHg-@&UJk3^+wt$%%!8*7F90j) zAK~)2c_=| zq&MKm0l7oVAYQ004}w;g0(qD2DPlhf_gjD>Xik9_!RaVkMsYdU6#)GWc$0hYm9ffd zc>^waw~Z1R#1hT*JsCj*+P!z#BKi388L1gdOcV&iu87DLnLo~#L*R9&%h5_{MM{G1 zuBto^fcq>K&2hO##*khP0Q?Oe^_C+_@{5KU6q`oLbR>S}3w#R$cwtT#;&NOIi>77u z;&J%^ruSt4T@L9oB&0<=2H?a0<;%62{8!@#Ov3%H%yy>tx+0(@RHezf9U^xCWC%Rt-ffpfO z#`)zOi=`1Qm&;@DEBj@@@t9OBIX{R71?qBJy(lkOwOww!k)O!{TUkCMb-!$JzkC5N z9D$-n6o78^5_wC#B=5_6AajPXyicm~U$*R)&zg52_`;%RLr&unnm8ZtAJ+XcEOusu<0TL;)i>vGxizR$ zQd=%pW6GY?r*+|PGXx62>Um9Rhr9p|za4?$h2Hn2;C5}n#{s6F`(+<^T&m!FZ&g7sV8C;+juX2s5bX$d~Q_`FD$^l`nEalG!t%bkaz zUS(ar5(tQSoc(+-mtD zte33T;I{=z0a!b)8`~l$PgP`BOR>`fFKUH298a?hS~$lm2TNg3S-yl{j2AA@_2ysO zp#a3rZ!TYiINV!A0`R$R2A->az9s;U*3vm*j@Lr3b7C)<(nIGsL5H?BuY_KAnO}XL z0!o2eMb28WRK7^?1!AY0+2A_Zn^yejz?UB2g>&i%JR5sSKV4-XKzFnpk0y)PfZ#qV z#p7;21?sW~g_NGQVl#?IV7ujT^f`(G9=}Wp*BcS=V*GWkh`9ko+61o+K(}_S$b%2c zM0rwv0XQD-*PN$71O+w$d{11lSY~h8Y~wn^$+RiT;|0Pk|mNu(cxc=w%hz z%6m-hfw9Fc7w>YuAv@Lw47>!6a%Pe{{<_K@DaHOMT!$#Xjon|@M&T(4M@(E-mo%BPn|u{JG*>MB`-@_aXd42%3y@e~*U1@={EO5_oTH&*-& zcZvM)w<32LZ<60eMFH@EZM9i>?8$^zXh!@(iSA=8#+Ryt36c|6`wtH{{#R)#TaZbMiCQ^^BnK;biHI2&i+NR z^a*$^e0MaeXlI|0C3B`EW8)=wQ3}YC%J_EGx#;(NY~v+ro4ziUA2l0j%cp!siff-` zzW@16BG11lT`zny@<7P-%=mBlp;W$mW-!3gqhBMX4HpETpZ;FNK|t@z@U{g8z2hdT zGS||=IY8G!|A7}(rVqf=&@i=RQny2h*ePQL`AUW-Fc^AU;63w0Qe5}q)B^9mPw$_F zxo^Bs>fm0J1v>CXqs(ihs=KF2_mz*8lRUQCgZP!s5!CRe58et7S1$nF7PVf zd9~DT-7gw*oG$S4pyxr{{FdyLGbn0~!ooRN;6;?_V<0rS-R_bsohr+n7{FMX7GSqy zq0jEe?{TgM_^J>&xs}N2Ea>?8B#3G>(WhynVdd}x8zZXUze(o4jtcqqhof}jc~W}J zYlGoF_MO>xE!cKn$CV1QlUz?j$zm;>eKxZ60eJ0Q2pW^gnIrJ#%2Gs+vsWNe<&$Yz ze7%mPiR;DPtg=m>|Dg%_`OWDnhW&-t&&bJ-nb<#S{BRI}{J|)!LdiF~rBOfacHWS+ z@cP1}TrpOGBRw3$$zr$z%u*i=@Iu+;ZZNbB4=X~%{7PQLOn2hL*1@JlQQaXjw^^EzLwDH5&pw&us zC(MQLLfh?}E7r)@e$~+Vy4lo%N)FWPcHwDTZO{fs-GdLte4{7WZy z5>Os~z?@un!EMdA1lRldpH|BacTZt_xZj=Gw_?W8Y)0g<<2&S!V=JXrWKkqUvykg8 zLT#4o!{TNi^}K-s&r}Yx?X}dXQdWQ6aI+^!Db6-x4XFzOeiX#xg4mP=l7ue{{(5I3D|$KImh zdQu!SQ7@-Ekt2f`&sPz_#;6$$S9{XK_R3Y~%r~$0Dh3Z??1Q=|f~K#8$oaYgfM>W~ zRMtYc4rd<#*aOFl0iK)wb10nT4@iLl(IyLl39r!a&~EGZ@Zv#}UpN~L7}sBLE22Xh z>0f4p6Y0J^tL5O8!_ECA7bF0`aOSOY_yH(@=WLtqo{*>W$6%psb-5FI-Xo2kr@%wt zH1xgtjrRbOZ5y6+r|S(Acxxx1&!M(TknFlciqp&G$f-s)!h+k*efCy)`^m6UfaOaG zPP6ieZA)-%NEPF$SA)5DKCG>2b9D@Qq3oTJM^5gLJ4(y{EUZ(mU=$tMO)%(UMBhJU(8RvoYg;EOk^40Y@%Mj~^6HWt^f{c4$slh0c!cRiSkK%$OF3N^)G>0{_P?|K3^JjNNnT(%IYb6s*=^9A$Mi;~xkVT@bpJ^UA1S3@f3M>~xw}k#|Qiv$_k0m8J6Ukg^`uE3vY2Jwf;F zx3~AfrR9C-13V4Mt_ul#0NxFio${2@Qiz%qH<70o>rC&HxY?zs8J}ss9>5En=B$?q z@sbuzx)J84r98e!?q4YV?y?3t1^+?=AAq-WcAp$IHi>fYR@7wH0xOXP&h$Pc@oIRS~Ww`=%Vwt#1wkZ81uX+pBq)XXeWzmo}h zM!6{89OQye%e}9Hc$s#ct{ttY^D*~sA#8J1Ii)ZwKch>*7+4NM+@@`EvK;kT`W-&j zJ;#gcW9|UY%`_+QmLU~rSHo=k-}63^;rc6Ce&00KhZzJtVIq0k(kc1u_B{;)OJrvH zHe38w4J;gpK~U!gmi__H)>a9Zc+fC01H6iS7={&;)yeP1%mf-!^0d*|a&5*di?y2% zxD-BxHTuq-$jxgTJ~n*dwP-Zi0(jK#RxFmnu9|!fNI$I|5wiL{^*UyuYbJMA-y=M3 zrUWr-KF^j;2yowCT9j8Cj^~Dt#nob=OCjKRO0ndeuS1U4IzH1_G-Kj3mqFY_xrc8S z3vyCk7G(H6@+4x0-!1PVCxWGayre2G+(|JLz|&eREO^Vf%|(dYyuOcdn|%k~j!=B2 z21XNjdrI=J(D5FdN8m*jw9VUlrm+xjzi14X!nMd*er_0e+D~se;x^LLG z5EPBT=)iG~!00N#xE!J;fOidm_lSNGD^2%lS@I!G1MOifEZ=_4=X#MLlEz(&CgcRTylN#{Hd$}8RrRqRL&v(~crh6X;Zz`&@gv8p zL(E)S0>_(0fg_f&&DnO-N8301$jd9!vU%*A^YS)L@3CcaOdd|)70C6Nn+M=&N1@mh zp)LcaI{;qDm2g2ruWOeIMBve|Qd@*f^f|c~SH#zk%iw&nHVQKj7ShHH24=D6Y?}e_ z4k_-Fx-qb51PiK<8Ovr|ZeH4fR{_VHEg)eiXTa;HQ6))LuwE8Bo07DvRF>raIW@A( zjMwGRGB{oscp5AnnG~B5;Qb+QI-XnlJjtSU&tc0e`o|a(Im~XWbnu`4Wb}G~N3~r) zyr_5LSXstBXWJG4?=Rwj7v$!(Oo}B%k~z`46E)qAKpRm7)wbb^$~sq3lN@iRF26;{ zSb9n*_qcL;v1YO>EIX`@aw7-)C<6GN-9;(EyjeGCT$w1yquK(G6Glh+2J2ej=Pq0d z0|lODB~ZsRz!T$6SUbwa*3V}rX}uivymx&S9fN+{&ynKXq$$RLz za3|aXcx|)MQw6+mRWX|mKH~=65E#>egv#2lkfxMNC_*b+GkzW7_ZL zwb?r%%6-vk-A}qfbYr3{4Mthb*{jy%l0^l%fDZIsbf6<%GdIASsmaSwz5HX{ES6DT zLvfN><-G!<74Sy+e){ZAffpV#LC0+Mw6&Q|LR(a^KYOAmSLO%qou)HPiC0or;=K=vHZ{6+9Ul94~wVhCA^ygOg$-1dY*_>(P zO3)oBWU>F7zFYy@Fb|I=Z~Q!{+0#uYws{X0bNelXdyhk4c$(S7#n zb31#Y8dt)uh^+beSkQKCuROFkg_3?YR&$;MJqzxHIN+fnO>uTgHlpszy3VF}bZ5K3 zqXB_BjBeckFRfgUI;?9rN(>P6~YF>bckmrlbd*uTz@Z5YnQ}8Gi9Iu0(cwykpEs~ca zL*bI%Au*gg3<`K0J=1~+z#sfpWY@moybqu9kOLa!<@s)%#Ak*_m>1w7GvS=Eee#t= zz#C~=P?x}~&q)EbHIJMq$@RlqX1zUWkic_CM&H*koX@mE_5wC{%y|LcOjXvSrsf@m zF>tn+MA&rX<8=W%My^!%pau&<$EroS9(rCT^74iSyxx8uMssx@fCr1_U8S0=FR{qc zV$@iPDE-hRY7U>{adK_ll`e}NDex*q`4}vl&@R%ydEmv*Q67K?i{{tLH91>>m%?I4 z4)D0ES?EsR^Lgd{P-TpL&rNwhayoFl`XpL+RkEY!dEn(6ct*b~qdoXEDvN>RrMtXe z6!37Ysgkr7w6!gmHBh<+0PdNAo;N1frJvt53=kTjLSx8Z{=@!JcjL#)!aFA&qjEf2 zM}OiZ(q_qzH!~-XT|6Oo6d`K5ahl}5tD&T%&a4Qt$#r<9YgS;O_Pfdu;Tg&B6 z>81hWbo^&Qv~=GOr5?Tx1IpRxbzW1$3W1l>R?IDc$FEjOG28gVAyZ#d z4J_b(Cqdl2veOAq%lY28l9rk1d>pl^ybR*yj}>@~SSh32gW-5A{eTu-reR5ZbiGEbG}d{&o9fYn10KXp(+7Q<6!tC#`1VMFt(aMH3|7n{fro`!K*(5;z$52_ zW$7YVH(!~>#oNz@C0Tp_EH^H}n)@`?+`B1amXQ2f+6EDGFE||B3G9D9h7LjOfv(L; z7Ok}X&sSLmD@(wulj}j$q$8aM7Q^-6&x7dslu}u~m9>S(@%GX?A&c+pjycP{6Xryo zGd?5Nk=vPw6<9RGmBq3FJkE$?*%WZRwc%dq;RqIRJOjW9Bc?Jf^yn-u#;BSsS$vO9 z#+=2PD#82J(2Rn#+y>szs^7J2R044{09}_o@%o_SMF3B^9tBrNFz{^n7@JkD4Y%z= zz%*S8rilqtglOTUWpmnazC#LSLB-1Kay`GaQ%!+=v(xg#@v3Zw;iN`xS3uG$1EU$A zNlwSW=z!a4IX~)l-1?~B4Tj@6z&rj>DWG#uLAl=CwuW25IMZ$Tm|8c<^-$jZpTUDO z=~_tjlJkROh}f54RQdZbw~GuDBey$H>NnnFjVhS{9tYVbe2n5|4ZuSlS3#ZWFtC&$ zem=BZkd2Uk%YLnR3iOKtU|E%FK~97yd7A={e^FqnUbJGSX;88foG&g~g@fsnMYBha zr)06#O%*wvC>E0#yBpjMQ7p4=Vl3SV(DUXw)8SZ$?dX$5k-zR2(fxfq1sIo!pYpdr zzcX=}#%YdySZV7;go#n?G@>TL#Kz%3XSB*V+z2>Y)&jiPt+9Nd+t{d$dbp#u@X`b%7ziCn#27l*%oU=-M0DaaGR?H+)|yl%uy z$9G5Ig`MW)b~iFog_}mJWCC~`q@(B2nck}USm4uhLdeMVWL(aIQ~msbO^Ls8?kNCn zcRsk?Wnpe-df*}3oZPQ~VCXUYHM$*K2=j^>Dd_k&T^!Fy()&4QgfqQK+;ogA?475s z1&W#`gbbh~=bM<6(p+8s1)AOoxnCjv1^Z8dy8LdeAkUqdmZ}L4gQ#gj#B5O`Bw{ zsL7)sB7Cp^v*PcVX9~ceQiZU13gpG#VGS8eCPht(nY*duIW7cdAsDCm{V=S+s%ctr z4ajNk(tL2hQ;{>qr>7xgHRyRYqzkzTvNn>XV8AEx5pQV8GfW2XZgsf=Id|_M=x9(e zkt%Q@Fa^j2M8lv`Oqyw~!%IEK+dt4oX1Zf!5pcbun3+zu0=XVIo*OvLDrC%B&~zaJ zurwhDLXiC_Zi@67Z80re0S*PvA^-8hKMx*PM_Uf zVDtbup5C&Jg_C)DaHvl&X^5I`pY)(C1cIj3!fA~x1@zN98Dhg{+LGL#u;3{GG4sXv zcdg-ejwO?wfWqlNrR|0rnz}0U^6u2A(q~Q=K)1g$)!wzxE?p>!>rF!BoGHr%5IJAd z-|_mp<%t3ay!h-yMb4Y1UKjG)wc>WB1y?xXHPgUz^}G%E0M~+AIK$~e)b*CJ3fcUu z1*7ZD&B?_0gnS!1-=p%hSp2*6i2|@<&hC*@%TqGjq}#b!2vNEn0-~ENnHw>lK4&6C zyEAFjhTnjDIg~Aq222X1knTcir@SqD8%j0r5gzz6?(98QYUH&#Xpa2tG5#Rf) z%BRd!xX$rM>cUl!vTL)0kp`$CMwp(WD!b*|{ZC2bdS&;eA{SC+o7zX$M)$ z_1wPcnz=v=C!<^T6=f;Pzh8~?q2qd+JAZW+DFE^Ek0`@_>Y|$LDgktR0lKjJz~y$O z1K>p8*(l2%6f#O=$;=G!bf9gFEV~dqeGC$0ZT-!l+&leyi035N(=7ESLrWuoxX3pDfz(IhDc^;aXl0kv=r79< z1%Q%m5c*C*0Q4OM9rZfpbVj^{CDS#iL}i!rb%zy`8AsXyST)-Kk6%ah)6*s=nx)PF z>cF>0tEP=;QIS*iJ^rm!^LWYC-EngI1!6FESe}@jP|2ku{4cxG>B0|En&s|W`0p(kwtn@R`uED!3)u7eL^=4BT&75+e9>(n$fh40a-=^-LI2eu-ko zhQmdI4q~RUVzRL$ix-6)<@5A9zOHM<9I&%Iin>Dro)H%IKg-qkHd>tw?gfE+foI00 z4yj|E84LIi+0 zoKL{{SSkXIPl`z8FVvRX0!h&KD0Z4UEdZW2K2d{ee10-q`YHnR{o7{ zf>=)HfKKBu={{h4t(N|}jb_I8w^3f0z-y!L@oN=3(e#A+o~#vdbN5WW7RGbZ$kK-M z8Sq(yiveFzR^gZP!?1WhHMPrdAq@=mQBZjHobifmHJ~GxBe!#Ox;Rc}K!-xKOl)Pt z5!2}hId*ajLc+-H*mOieN1BenQ64vyL$qo}4Iv_y)8%~D(rJt>wkD@`myHFV>U`GE z7l@q>_)NU#n4E~ zYQYS1x*>&xwWDgffydFq(rKLQ5thy%tPGq_lV{_^PBvFpCp$SG_vdQzNc_5f5JWh( z9ija9{i6WH%3ENyd|jy|H_KcjR4Z_fV_$2gggITLcxgGEruvxnT8zWI9yem#uE40HC`Ww0vi&A^ZsqCloK; z5HQ&bQPbAJG~%T#x6WFaY#_;+DNWYPB;sW(r_-4kj=wH$9i#wwI_o(jH@%R$`_RWMJ~bvXmIJeh8^qPr!yu&x4!+m1KB9Kp?B zD2Z%W_dwWHpqb-pxm3_a#a=QZ#dR4pSuf+7NRBWZEXjY9>3~D?6fVwl=BgM ztbnWi){W7{wteQUr@-~9)c**5azLaP3Cy4dfD}RJWU4kHr{ibgwE*CnB!pdP=Kye< z@y?$qP0LpxIqWq~aB{hQ;8-@DhcwZ`MBG>L(oJIB!Q)QA^E}X5P8V1&d82Tza^-aV zJEX+cPUkyiz|-M(CwB5`jd0<9(DKC>$c12Go$XYF*8gvcgOBs!vW!VFQLZEbJ4u-bc&FdP?fnTXpdT5(o5SInES5G~oCXvX zE44c-T?M=77-wov1n9H|ruyhOrl7e<6zEcDy^Nz{_JGGXX(4tpyv)sNU`mn3cT)6Z zW&>}bE(Zf~)%}$F5q#Lx@@dYY$O-GG?wik(_%sJMgvcrQ)jt)V9+6mM-9A50<}m7q|{_1G>F7Duw!-ElgxUXPZTm z(*>zLd@y4#xn;mPo&@RH1|Hwgbv5ww2K=+hw8yVA#+Cvz8w}`BK*@-nA?~+ajV`vN zgmOP~4IJ_OYXInkopIkBCnt1tKqWeYup7QYZWUPqo$x8(9w%~y5K9kEGC9LK2jjXA z&)SH={;W`yYoMd;HXtKtY%FCUP6A}A!5JzRWU9Y$KZe6G`ovf) zUBH36VXo*>XyS4~VWKeT6mTs;mu~Sg!@%RvW5iBa%>eKif)S@44bDjS;{-So zD`fNEIRD}}|MJP)_Tu|l{AC$D^B3Q9e+I{QU<9{g|5hOCHWUuJ4PxOIUKDV!sC}Y} zo8?~W1P{Q*H}S1t0gdm=gDu`%(Nf=c%Y^OH8;17=EuJDECc$Pl64Q2*gaD z<5)z^H3~L&pB7TPxz{$$N3BgzdvQO3c48q6qCZM}?|4>RhxFS2nwg8PLF=IV^yCq8u(HQW9LSAdBY8?F8V=en_Nj0-Uv0^7e@w;yh6eDDwiHgVARabomD! z-%zcdjfpH6izhZsFLE9327K1?Y4&YlC9`ic9tb{0OPkO$#|o-TApoK4ioll&E*zGc z1y>+aT5WBfcp3q`P7gJ4I}0QOENp=V631Z|X&kel4C`+OYK3r> z0CUWO&$Uu&+72Dy<{XiO%W(6TIN)ji<(D6r?@Y&d%T72=W;)%XM=fH zn`XpaEv&?S6+d-9EP^Tk2|}KuDM(5`1ICazYR+@OMe#H^KTgzaBZ3C=<$}zaMAyKg z;Bo<``>q(NmusqyImfyMngHkMa0YO$SZOoFdECTVatm85^+7I|n`c1DrY;wUqx=KU z)%i$;F!(m$m=!-++GU?Dtkg~fHQ=Eyklbj3n$_KSj1F%&Bt(61JZ6j}$RIHL^u_T!a5?^M zB~mT|*h~sKH+6_d`R4e2q-g1Z7c<>yIvgQ(a(L=+*P(`^Uaa`ZuUmS!*wRD9&+6e0PSIdK7J5t{&fu}O(G?~Y$aCm`$#tdzsMKp%o~N~D`y{L02s#wRs19s6oifl z%EQzH&0m{(B!@KofF=@#K(W?P?g#oHj}u@vhn;{7z-ZkR=2{1kQJ*`V92Zn(veiIh z&Hg;5AT!@vfSG-p6K9@jMM>^z5VPy}=5e|ObbOH_CBKZ)<6;dbW)zvVTDF@j4?I%H z6+ijeb-v?cSOn!MOg%DxVT57db|o}H$bHu$YCc<0R1Ro>6SkQ^6gA&lZm9QBF}2+U zw)@_Qi_WH8&438sp`?isALYTuNopi9%RXe8)Y}woKXHDhCa%a! z7?fdf>3wMCH_O)rpDiAw=LFVBD?;)(xtf0O>TNtmQPTXiktW;^f|>QAut>?{F4*{a z0g09SXLkQy&N*JxEAv=~AdC`0c^eBtM#7jUIeCEk*# zKT~{^yBpsqS2O!oltk;RI%r|GdEz7wZp6PhD?OPF>ca2J?;WbjUwTDG=a@Al+3eC(iNaU<6jT9 zPN&11?}2B?5Cc9XX**8H^V*1`JS7lG^}bd#b!RRLm|e|m=pq+b{K{}LD>~|_1R3`e ziIML86B|qPqWl_7lFpR}Ubnzg3Mb%#w2JCR2Yv9t5lx%GXDy~lC$Zgmf#uOT(G?we znBt>;-Q?)z!HxEtR@_Z5ZYffF-~|+DH)#v^`wm1<5-IGGP{O&Ka03oHBB`E2(bT2$ zJkHqTBq%4-+nDs5@aC3R;CC*_+;hVQ6MpCQw~lAXbG$?(Yaxp2622ftY>xt@3r2l@ z3@8%~ualEp>!W*J7-&%dQ;_j*%a!9r$#zrXf!B^g=KCIi*9kX_8%qS2Y&mQ-fJB|N z(K*-&SJTTPdlG~n9(W0elSP|@7O1FvtS zTmU!nz#G^kCj?^n`K^SuR$^;dJe;R?b^D^8!*xr!R@Zsp4T7qP?%5?U6WzO$lRU6G zp;o`n^}y>FB|E;42VTb{%h3fMc$t~Zq(Jo?EDKZWftQ6@@?*>$1w8O_H>LiCvOob3 zye!O;A7kz);DMLBDfKUu1qyiJWnq^57;{Gf54_w>sehp?P{0E(3$x_Mm^%u1;N@;g x{R?G*0v>o-m?b~P+)=;-FLzVwUnmO{`2WhD_3XKXN#Fng002ovPDHLkV1k7kW2XQB literal 1777 zcmah}>p#>9AN~Hu%ot?zWXZVH)FXtXafwJnD7g=w2{VjHt)-#C} zY0@f*R1CISw;{aRt#X0A5-ki_*oEInA#p#5sw6Zh+$l9H>rfwWj&dB0fhW_@_lId`ZzW=4-) zzwpvPOZiv%Ra7Hnk6qMCdJkQt@9?p{zTCd6t;Npin{A)vcCE`a6eRRg!U=G=eiBJS{q@|Ix=*5(eUrsb8u~9ar~^#{tII%rC9Mk?R5_%?Ka5AGkUDT$u z$ilFZ#+q$F=T4hwBLBw(E24f`W$}3q)%9)PgZjXR+=W+;yj?V%qjhaN;4!Plq3%Kbh4x?q|*FO9;o`e3;?xFvm?g#aCN051hR?@@JJ=AX#WV zG^{qsd{_UB%ZmgM9pKaOFgdMAC%iac$crRN=*R}JQK!9o>CASP&W1`qax$chj(?jH>ef8)FrM9)diCLX36k=>r(E#C8ft!f z?(z^t0jii|N8_`d1q$i1>JLp~FoTV?Z};5d_uj>$?z*BkzKf|vbZ_dd7Ypc!sbe=} zjJRn%?R&1ZReDWY|E=`krIVAbO%LY8SV@NsCri_!}`_AfQ;s7)&`VLY4 z`pyaGh@ohwY6c@93sg&c#PA=}voa96w@Ay)Ok!p@du($uvh+Xze7Bnl`Ib-Qi#tP0`l{ zr9WJZ6f*;m_~9TM_S_X9{d}z6d8d!9yE(^5-v{dtnPcCikZkmx+&4NO!x zDpS(OrKHz9$Tpc{epP7A{u7MXSvd6YQMSglUt4;$4ticc^6D6bW{m)a6wY&&1PV|@ zDK~^qPPuLsds?Rpz=a3KO8rH%quJwQq|o=l25c-)@)0jgODnf0_sf8RuUFxR#93eb-l0wrtZpcS$Gk-5U<)!?wlJW=x`(^buIS@KMKN@8;GvU|! zqXilLWm)6yHgMot_DDfV<K1i~e*l%IaL76%zP>40!Aqb7ZW00=-TUAs6NA%$Zq@CRls=!n2{^xviu;E$Xu z?F!{Y5vI1G3z@xN?r9KbZFAzJ$7VB{BtXuvv*WMjRSy75wp?(N$~`F{oyRA<+36pN z0CsNA$tHyyER%d4ij|&Sx3|L-iBI_i*HEwAl;(ykrZ!hXRxzzvc7A@ GO!zOCIu|$q diff --git a/react-ui/src/components/KFModal/index.less b/react-ui/src/components/KFModal/index.less index b034672d..fafc6f7d 100644 --- a/react-ui/src/components/KFModal/index.less +++ b/react-ui/src/components/KFModal/index.less @@ -20,7 +20,7 @@ height: 40px; padding: 0 30px; font-size: @font-size-content; - border-radius: 10px; + border-radius: 6px; } .ant-btn-default { border-color: transparent; diff --git a/react-ui/src/overrides.less b/react-ui/src/overrides.less index 9e4b34cc..f676890e 100644 --- a/react-ui/src/overrides.less +++ b/react-ui/src/overrides.less @@ -168,7 +168,7 @@ height: 40px; padding: 0 30px; font-size: @font-size-content; - border-radius: 10px; + border-radius: 6px; } .ant-btn-default { border-color: transparent; diff --git a/react-ui/src/pages/Experiment/Comparison/index.less b/react-ui/src/pages/Experiment/Comparison/index.less index b9198e74..273791c4 100644 --- a/react-ui/src/pages/Experiment/Comparison/index.less +++ b/react-ui/src/pages/Experiment/Comparison/index.less @@ -14,10 +14,30 @@ &__table { height: calc(100% - 60px); - padding: 20px 30px 0; + padding: 20px 30px; background-color: white; border-radius: 10px; + &__footer { + display: flex; + align-items: center; + padding-top: 20px; + color: @text-color-secondary; + font-size: 12px; + background-color: white; + + div { + flex: 1; + height: 1px; + background-color: @border-color-base; + } + + p { + flex: none; + margin: 0 8px; + } + } + :global { .ant-table-container { border: none !important; @@ -34,6 +54,13 @@ border-left: none !important; } } + .ant-table-tbody-virtual::after { + border-bottom: none !important; + } + .ant-table-footer { + padding: 0; + border: none !important; + } } } } diff --git a/react-ui/src/pages/Experiment/Comparison/index.tsx b/react-ui/src/pages/Experiment/Comparison/index.tsx index fe09198b..1667a064 100644 --- a/react-ui/src/pages/Experiment/Comparison/index.tsx +++ b/react-ui/src/pages/Experiment/Comparison/index.tsx @@ -1,4 +1,10 @@ -// import { useCacheState } from '@/hooks/pageCacheState'; +/* + * @Author: 赵伟 + * @Date: 2024-10-10 09:55:12 + * @Description: 实验对比 + */ + +import { useDomSize } from '@/hooks'; import { getExpEvaluateInfosReq, getExpMetricsReq, @@ -8,7 +14,6 @@ import { to } from '@/utils/promise'; import tableCellRender, { TableCellValueType } from '@/utils/table'; import { useSearchParams } from '@umijs/max'; import { App, Button, Table, /* TablePaginationConfig,*/ TableProps, Tooltip } from 'antd'; -import classNames from 'classnames'; import { useEffect, useMemo, useState } from 'react'; import ExperimentStatusCell from '../components/ExperimentStatusCell'; import { ComparisonType, comparisonConfig } from './config'; @@ -26,40 +31,57 @@ type TableData = { params: Record; }; +const pageSize = 30; + +// function Footer() { +// return ( +//
+//
+//

我是有底线的

+//
+//
+// ); +// } + function ExperimentComparison() { const [searchParams] = useSearchParams(); const comparisonType = searchParams.get('type') as ComparisonType; const experimentId = searchParams.get('id'); const [tableData, setTableData] = useState([]); - // const [cacheState, setCacheState] = useCacheState(); - // const [total, setTotal] = useState(0); const [selectedRowKeys, setSelectedRowKeys] = useState([]); - // const [loading, setLoading] = useState(false); const { message } = App.useApp(); const config = useMemo(() => comparisonConfig[comparisonType], [comparisonType]); - // const [pagination, setPagination] = useState( - // cacheState?.pagination ?? { - // current: 1, - // pageSize: 10, - // }, - // ); + const [tableRef, { width: tableWidth, height: tableHeight }] = useDomSize( + 0, + 0, + [], + ); + const [loadCompleted, setLoadCompleted] = useState(false); + const [loading, setLoading] = useState(false); // 避免误触发加载更多 useEffect(() => { getComparisonData(); }, [experimentId]); // 获取对比数据列表 - const getComparisonData = async () => { - // setLoading(true); + const getComparisonData = async (offset: string = '') => { const request = comparisonType === ComparisonType.Train ? getExpTrainInfosReq : getExpEvaluateInfosReq; - const [res] = await to(request(experimentId, { offset: '', limit: 50 })); - // setLoading(false); + const [res] = await to(request(experimentId, { offset: offset, limit: pageSize })); if (res && res.data) { - // const { content = [], totalElements = 0 } = res.data; - setTableData(res.data); - // setTotal(totalElements); + setTableData((prev) => [...prev, ...res.data]); + if (res.data.length === 0) { + setLoadCompleted(true); + const ele = document.getElementsByClassName('ant-table-body')[0]; + if (ele) { + const div = document.createElement('div'); + div.className = styles['experiment-comparison__table__footer']; + div.innerHTML = '

我是有底线的

'; + ele.appendChild(div); + } + } } + setLoading(false); }; // 获取对比 url @@ -80,17 +102,10 @@ function ExperimentComparison() { getExpMetrics(); }; - // 分页切换 - // const handleTableChange: TableProps['onChange'] = (pagination, filters, sorter, { action }) => { - // if (action === 'paginate') { - // setPagination(pagination); - // } - // // console.log(pagination, filters, sorter, action); - // }; - // 选择行 const rowSelection: TableProps['rowSelection'] = { type: 'checkbox', + columnWidth: 48, fixed: 'left', selectedRowKeys, onChange: (selectedRowKeys: React.Key[]) => { @@ -98,7 +113,20 @@ function ExperimentComparison() { }, }; - const columns: TableProps['columns'] = useMemo(() => { + const handleTableScroll = (e: React.UIEvent) => { + const target = e.target as HTMLDivElement; + + const { scrollTop, scrollHeight, clientHeight } = target; + + // 实现自动加载更多 + if (!loadCompleted && !loading && scrollHeight - scrollTop - clientHeight <= 0) { + const last = tableData[tableData.length - 1]; + setLoading(true); + getComparisonData(last?.run_id); + } + }; + + const columns: TableProps['columns'] = useMemo(() => { const first: TableData | undefined = tableData[0]; return [ { @@ -192,29 +220,15 @@ function ExperimentComparison() { 可视化对比
-
+
diff --git a/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx b/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx index 4758a165..2b7e80c5 100644 --- a/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx +++ b/react-ui/src/pages/Experiment/components/AddExperimentModal/index.tsx @@ -126,7 +126,7 @@ function AddExperimentModal({ , - , ]; diff --git a/react-ui/src/pages/Workspace/index.less b/react-ui/src/pages/Workspace/index.less index 300887e9..3fbcc8e8 100644 --- a/react-ui/src/pages/Workspace/index.less +++ b/react-ui/src/pages/Workspace/index.less @@ -47,13 +47,11 @@ &__robot-img { position: fixed; - right: 30px; - bottom: 20px; + right: 20px; + bottom: 90px; z-index: 99; - width: 64px; - height: 64px; - background-color: white; - border-radius: 10px; + width: 56px; + height: 56px; cursor: pointer; } } diff --git a/react-ui/src/services/typings.d.ts b/react-ui/src/services/typings.d.ts index 1e0b8b5f..5720efd7 100644 --- a/react-ui/src/services/typings.d.ts +++ b/react-ui/src/services/typings.d.ts @@ -188,4 +188,227 @@ declare namespace API { filter?: string; sorter?: string; }; + type CurrentUser = UserInfo & { + signature?: string; + title?: string; + group?: string; + tags?: { key?: string; label?: string }[]; + notifyCount?: number; + unreadCount?: number; + country?: string; + access?: string; + geographic?: { + province?: { label?: string; key?: string }; + city?: { label?: string; key?: string }; + }; + address?: string; + phone?: string; + roleNames?: { + roleName?: string; + }[]; + }; + + type ErrorResponse = { + /** 业务约定的错误码 */ + errorCode: string; + /** 业务上的错误信息 */ + errorMessage?: string; + /** 业务上的请求是否成功 */ + success?: boolean; + }; + + type FakeCaptcha = { + code?: number; + status?: string; + }; + + type getFakeCaptchaParams = { + /** 手机号 */ + phone?: string; + }; + + type LoginParams = { + username?: string; + password?: string; + uuid?: string; + autoLogin?: boolean; + type?: string; + }; + + type LoginResult = { + code: number; + msg?: string; + type?: string; + data?: { + access_token?: string; + expires_in?: number; + }; + }; + + type NoticeIconItem = { + id?: string; + extra?: string; + key?: string; + read?: boolean; + avatar?: string; + title?: string; + status?: string; + datetime?: string; + description?: string; + type?: NoticeIconItemType; + }; + + type NoticeIconItemType = 'notification' | 'message' | 'event'; + + type NoticeIconList = { + data?: NoticeIconItem[]; + /** 列表的内容总数 */ + total?: number; + success?: boolean; + }; + + type PageParams = { + current?: number; + pageSize?: number; + }; + + type RuleList = { + data?: RuleListItem[]; + /** 列表的内容总数 */ + total?: number; + success?: boolean; + }; + + type RuleListItem = { + key?: number; + disabled?: boolean; + href?: string; + avatar?: string; + name?: string; + owner?: string; + desc?: string; + callNo?: number; + status?: number; + updatedAt?: string; + createdAt?: string; + progress?: number; + }; + + type ruleParams = { + /** 当前的页码 */ + current?: number; + /** 页面的容量 */ + pageSize?: number; + }; + + type ApiResponse = { + code?: number; + type?: string; + message?: string; + }; + + type Category = { + id?: number; + name?: string; + }; + + type deleteOrderParams = { + /** ID of the order that needs to be deleted */ + orderId: number; + }; + + type deletePetParams = { + api_key?: string; + /** Pet id to delete */ + petId: number; + }; + + type deleteUserParams = { + /** The name that needs to be deleted */ + username: string; + }; + + type findPetsByStatusParams = { + /** Status values that need to be considered for filter */ + status: ('available' | 'pending' | 'sold')[]; + }; + + type findPetsByTagsParams = { + /** Tags to filter by */ + tags: string[]; + }; + + type getOrderByIdParams = { + /** ID of pet that needs to be fetched */ + orderId: number; + }; + + type getPetByIdParams = { + /** ID of pet to return */ + petId: number; + }; + + type getUserByNameParams = { + /** The name that needs to be fetched. Use user1 for testing. */ + username: string; + }; + + type loginUserParams = { + /** The user name for login */ + username: string; + /** The password for login in clear text */ + password: string; + }; + + type Order = { + id?: number; + petId?: number; + quantity?: number; + shipDate?: string; + /** Order Status */ + status?: 'placed' | 'approved' | 'delivered'; + complete?: boolean; + }; + + type Pet = { + id?: number; + category?: Category; + name: string; + photoUrls: string[]; + tags?: Tag[]; + /** pet status in the store */ + status?: 'available' | 'pending' | 'sold'; + }; + + type Tag = { + id?: number; + name?: string; + }; + + type updatePetWithFormParams = { + /** ID of pet that needs to be updated */ + petId: number; + }; + + type updateUserParams = { + /** name that need to be updated */ + username: string; + }; + + type uploadFileParams = { + /** ID of pet to update */ + petId: number; + }; + + type User = { + id?: number; + username?: string; + firstName?: string; + lastName?: string; + email?: string; + password?: string; + phone?: string; + /** User Status */ + userStatus?: number; + }; } From 6266261b22cc7d1317274c58cbbcba12aa371c31 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 22 Oct 2024 10:07:10 +0800 Subject: [PATCH 68/91] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E5=AE=9E=E4=BE=8B?= =?UTF-8?q?=E6=88=90=E5=8A=9F=E8=BF=90=E8=A1=8C=E7=BB=93=E6=9D=9F=E5=90=8E?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E6=8C=87=E6=A0=87=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index a5298747..283a0288 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -65,6 +65,7 @@ public class ExperimentInstanceStatusTask { for (InsMetricInfoVo expTrainInfo : expTrainInfos) { Map metrics = expTrainInfo.getMetrics(); trainMetricValue.putAll(metrics); + trainMetricValue.put("run_hash",expTrainInfo.getRunId()); } } } @@ -79,6 +80,7 @@ public class ExperimentInstanceStatusTask { for (InsMetricInfoVo expTrainInfo : expTrainInfos) { Map metrics = expTrainInfo.getMetrics(); evaluateMetricValue.putAll(metrics); + evaluateMetricValue.put("run_hash",expTrainInfo.getRunId()); } } } From c02a0f01500022ae20e288329c5fe52ec08350b2 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 22 Oct 2024 14:18:18 +0800 Subject: [PATCH 69/91] =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=94=AF=E6=8C=81juice?= =?UTF-8?q?fs=E5=AD=98=E5=82=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- k8s/template-yaml/k8s-7management.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/k8s/template-yaml/k8s-7management.yaml b/k8s/template-yaml/k8s-7management.yaml index 4fcddb15..edc1c621 100644 --- a/k8s/template-yaml/k8s-7management.yaml +++ b/k8s/template-yaml/k8s-7management.yaml @@ -26,10 +26,11 @@ spec: volumeMounts: - name: resource-volume mountPath: /home/resource/ + subPath: mini-model-platform-data volumes: - name: resource-volume - persistentVolumeClaim: - claimName: platform-data-pvc-nfs + hostPath: + path: /platform-data --- apiVersion: v1 kind: Service From 3002e7b0c59a6e5a54b7561a3710aba55e991010 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 22 Oct 2024 15:37:39 +0800 Subject: [PATCH 70/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/aim/AimController.java | 16 ++-- .../ExperimentInstanceStatusTask.java | 16 ++-- .../ruoyi/platform/service/AimService.java | 2 + .../platform/service/impl/AimServiceImpl.java | 93 ++++++++++++++++++- 4 files changed, 109 insertions(+), 18 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/aim/AimController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/aim/AimController.java index 31a6cba1..28632dcb 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/aim/AimController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/aim/AimController.java @@ -24,19 +24,19 @@ public class AimController extends BaseController { @GetMapping("/getExpTrainInfos/{experiment_id}") @ApiOperation("获取当前实验的模型训练指标信息") @ApiResponse - public GenericsAjaxResult> getExpTrainInfos(@RequestParam(value = "offset", required = false) String offset, - @RequestParam(value = "limit") int limit, - @PathVariable("experiment_id") Integer experimentId) throws Exception { - return genericsSuccess(aimService.getExpTrainInfos(experimentId, offset, limit)); + public GenericsAjaxResult> getExpTrainInfos(@RequestParam(value = "page") int page, + @RequestParam(value = "size") int size, + @PathVariable("experiment_id") Integer experimentId) { + return genericsSuccess(aimService.getExpInfos(true, experimentId, page, size)); } @GetMapping("/getExpEvaluateInfos/{experiment_id}") @ApiOperation("获取当前实验的模型推理指标信息") @ApiResponse - public GenericsAjaxResult> getExpEvaluateInfos(@RequestParam(value = "offset", required = false) String offset, - @RequestParam(value = "limit") int limit, - @PathVariable("experiment_id") Integer experimentId) throws Exception { - return genericsSuccess(aimService.getExpEvaluateInfos(experimentId, offset, limit)); + public GenericsAjaxResult> getExpEvaluateInfos(@RequestParam(value = "page") int page, + @RequestParam(value = "size") int size, + @PathVariable("experiment_id") Integer experimentId) { + return genericsSuccess(aimService.getExpInfos(false, experimentId, page, size)); } @PostMapping("/getExpMetrics") diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index 283a0288..59d8bf47 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -53,11 +53,12 @@ public class ExperimentInstanceStatusTask { List> evaluateMetricRecords = (List>) metricRecord.get("evaluate"); HashMap metricValue = new HashMap<>(); - HashMap trainMetricValue = new HashMap<>(); - HashMap evaluateMetricValue = new HashMap<>(); + HashMap trainMetricValues = new HashMap<>(); + HashMap evaluateMetricValues = new HashMap<>(); if (trainMetricRecords != null && !trainMetricRecords.isEmpty()) { for (Map trainMetricRecord : trainMetricRecords) { + HashMap trainMetricValue = new HashMap<>(); String taskId = (String) trainMetricRecord.get("task_id"); if (taskId.startsWith("model-train")) { String runId = (String) trainMetricRecord.get("run_id"); @@ -65,14 +66,16 @@ public class ExperimentInstanceStatusTask { for (InsMetricInfoVo expTrainInfo : expTrainInfos) { Map metrics = expTrainInfo.getMetrics(); trainMetricValue.putAll(metrics); - trainMetricValue.put("run_hash",expTrainInfo.getRunId()); + trainMetricValue.put("run_hash", expTrainInfo.getRunId()); } } + trainMetricValues.put(taskId, trainMetricValue); } } if (evaluateMetricRecords != null && !evaluateMetricRecords.isEmpty()) { for (Map evaluateMetricRecord : evaluateMetricRecords) { + HashMap evaluateMetricValue = new HashMap<>(); String taskId = (String) evaluateMetricRecord.get("task_id"); if (taskId.startsWith("model-evaluate")) { String runId = (String) evaluateMetricRecord.get("run_id"); @@ -80,13 +83,14 @@ public class ExperimentInstanceStatusTask { for (InsMetricInfoVo expTrainInfo : expTrainInfos) { Map metrics = expTrainInfo.getMetrics(); evaluateMetricValue.putAll(metrics); - evaluateMetricValue.put("run_hash",expTrainInfo.getRunId()); + evaluateMetricValue.put("run_hash", expTrainInfo.getRunId()); } } + evaluateMetricValues.put(taskId, evaluateMetricValue); } } - metricValue.put("train", trainMetricValue); - metricValue.put("evaluate", evaluateMetricValue); + metricValue.put("train", trainMetricValues); + metricValue.put("evaluate", evaluateMetricValues); experimentIns.setMetricValue(JsonUtils.mapToJson(metricValue)); } experimentIns.setUpdateTime(new Date()); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java index 699d0036..abcbc645 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java @@ -12,6 +12,8 @@ public interface AimService { List getExpEvaluateInfos(Integer experimentId, String offset, int limit) throws Exception; + List getExpInfos(boolean isTrain, Integer experimentId, int page, int size); + List getExpInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception; String getExpMetrics(List runIds) throws Exception; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index 3bae116b..1bfdb77d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -1,7 +1,10 @@ package com.ruoyi.platform.service.impl; import com.alibaba.fastjson2.JSON; +import com.alibaba.fastjson2.JSONArray; +import com.alibaba.fastjson2.JSONObject; import com.ruoyi.platform.domain.ExperimentIns; +import com.ruoyi.platform.mapper.ExperimentInsDao; import com.ruoyi.platform.service.AimService; import com.ruoyi.platform.service.ExperimentInsService; import com.ruoyi.platform.utils.AIM64EncoderUtil; @@ -24,6 +27,8 @@ import java.util.stream.Collectors; public class AimServiceImpl implements AimService { @Resource private ExperimentInsService experimentInsService; + @Resource + private ExperimentInsDao experimentInsDao; @Value("${aim.url}") private String aimUrl; @@ -146,10 +151,56 @@ public class AimServiceImpl implements AimService { return aimRunInfoList; } -// private List getExpInfos(Integer experimentId, int page, int size){ -// PageRequest pageRequest = PageRequest.of(page,size); -// -// } + public List getExpInfos(boolean isTrain, Integer experimentId, int page, int size) { + PageRequest pageRequest = PageRequest.of(page, size); + ExperimentIns query = new ExperimentIns(); + query.setExperimentId(experimentId); + List experimentInsList = experimentInsDao.queryAllByLimit(query, pageRequest); + if (experimentInsList == null || experimentInsList.size() == 0) { + return new ArrayList<>(); + } + List aimRunInfoList = new ArrayList<>(); + for (ExperimentIns experimentIns : experimentInsList) { + InsMetricInfoVo aimRunInfo = new InsMetricInfoVo(); + aimRunInfo.setExperimentInsId(experimentIns.getId()); + aimRunInfo.setStartTime(experimentIns.getCreateTime()); + aimRunInfo.setStatus(experimentIns.getStatus()); + + //解析参数 + JSONArray params = JSON.parseArray(experimentIns.getGlobalParam()); + HashMap paramsMap = new HashMap<>(); + List paramsNames = new ArrayList<>(); + + for (int i = 0; i < params.size(); i++) { + JSONObject jsonObject = params.getJSONObject(i); + String paramName = jsonObject.getString("param_name"); + String paramValue = jsonObject.getString("param_value"); + paramsMap.put(paramName, paramValue); + paramsNames.add(paramName); + } + aimRunInfo.setParams(paramsMap); + aimRunInfo.setParamsNames(paramsNames); + + //解析数据集 + Map metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); + if (isTrain) { + aimRunInfo.setDataset(getDataset("train", metricRecord)); + } else { + aimRunInfo.setDataset(getDataset("evaluate", metricRecord)); + } + + //解析指标 + Map metricValue = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricValue()); + if (isTrain) { + setMetricValue("train",metricValue,aimRunInfo); + } else { + setMetricValue("evaluate",metricValue,aimRunInfo); + } + aimRunInfoList.add(aimRunInfo); + } + return aimRunInfoList; + } + @Override public List getExpInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception { @@ -240,6 +291,40 @@ public class AimServiceImpl implements AimService { return aimRunInfoList; } + private List getDataset(String isTrain, Map metricRecord) { + List datasetList = new ArrayList<>(); + List> trainMetricRecords = (List>) metricRecord.get(isTrain); + for (Map trainMetricRecord : trainMetricRecords) { + String taskId = (String) trainMetricRecord.get("task_id"); + if (taskId.startsWith("model-" + isTrain)) { + List> datasets = (List>) trainMetricRecord.get("datasets"); + for (Map dataset : datasets) { + String datasetName = dataset.get("dataset_name") + ":" + dataset.get("dataset_version"); + datasetList.add(datasetName); + } + } + } + return datasetList; + } + + private void setMetricValue(String isTrain, Map metricValue, InsMetricInfoVo aimRunInfo){ + Map metricValues = (Map) metricValue.get(isTrain); + + HashMap metrics = new HashMap<>(); + List metricsNames = new ArrayList<>(); + for (String key : metricValues.keySet()) { + Map valueMap = (Map) metricValues.get(key); + aimRunInfo.setRunId((String) valueMap.get("run_hash")); + + metrics.putAll(valueMap.entrySet().stream().filter(entry -> !entry.getKey().equals("run_hash")).collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue + ))); + metricsNames.addAll(valueMap.keySet().stream().filter(entry -> !entry.equals("run_hash")).collect(Collectors.toList())); + } + aimRunInfo.setMetrics(metrics); + aimRunInfo.setMetricsNames(metricsNames); + } private List getTrainDateSet(List> records, String aimrunId) { List datasetList = new ArrayList<>(); From 9fe35a2979496888cf7303167023fa289c098a21 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 22 Oct 2024 16:37:25 +0800 Subject: [PATCH 71/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=AF=B9=E6=AF=94bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/service/impl/ModelsVersionServiceImpl.java | 4 +--- .../com/ruoyi/platform/service/impl/ServiceServiceImpl.java | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsVersionServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsVersionServiceImpl.java index c4dafa96..274b3c1d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsVersionServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsVersionServiceImpl.java @@ -43,9 +43,7 @@ public class ModelsVersionServiceImpl implements ModelsVersionService { @Resource @Lazy private ModelDependencyService modelDependencyService; - // 固定存储桶名 - @Value("${minio.dataReleaseBucketName}") - private String bucketName; + /** * 通过ID查询单条数据 diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java index 36e0ef08..5cd35fb7 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ServiceServiceImpl.java @@ -167,7 +167,7 @@ public class ServiceServiceImpl implements ServiceService { com.ruoyi.platform.domain.Service service = serviceDao.getServiceById(serviceVersion1.getServiceId()); ServiceVersionVo serviceVersionVo1 = getServiceVersionVo(serviceVersion1); - ServiceVersionVo serviceVersionVo2 = getServiceVersionVo(serviceVersion1); + ServiceVersionVo serviceVersionVo2 = getServiceVersionVo(serviceVersion2); serviceVersionVo1.setServiceName(service.getServiceName()); serviceVersionVo2.setServiceName(service.getServiceName()); From 3a7eda377baa8b228b00bfbe838c581719dc96e8 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 22 Oct 2024 17:00:02 +0800 Subject: [PATCH 72/91] =?UTF-8?q?=E5=BC=80=E5=8F=91=E6=94=AF=E6=8C=81juice?= =?UTF-8?q?fs=E5=AD=98=E5=82=A8=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/ruoyi/platform/utils/K8sClientUtil.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java index ca3fe694..14d4c795 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java @@ -341,6 +341,9 @@ public class K8sClientUtil { } } + int lastIndex = hostPath.lastIndexOf('/'); + String newPath = hostPath.substring(0, lastIndex); + V1Pod pod = new V1PodBuilder() .withNewMetadata() .withName(podName) @@ -368,7 +371,7 @@ public class K8sClientUtil { .endContainer() .addNewVolume() .withName("workspace") - .withHostPath(new V1HostPathVolumeSource().path(hostPath).type("DirectoryOrCreate")) + .withHostPath(new V1HostPathVolumeSource().path(newPath).type("DirectoryOrCreate")) // .withPersistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvcName)) .endVolume() .withTerminationGracePeriodSeconds(14400L) From 7a59ed2ff571e3d5657079f3c1b45f206604b3d6 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 22 Oct 2024 17:30:45 +0800 Subject: [PATCH 73/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E5=AF=B9=E6=AF=94bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/ruoyi/platform/utils/ConvertUtil.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/ConvertUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/ConvertUtil.java index 52c89dd3..95bb18cd 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/ConvertUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/ConvertUtil.java @@ -159,6 +159,17 @@ public class ConvertUtil { return sb.toString(); } + private static String toSnakeCase(String camelCase) { + return camelCase.replaceAll( + String.format("%s|%s|%s", + "(?<=[a-z])(?=[A-Z])", // 小写字母后接大写字母 + "(?<=[^A-Z])(?=[A-Z][a-z])", // 非大写字母后接大写字母开头的小写字母 + "(?<=[A-Z])(?=[A-Z][a-z][0-9])" // 大写字母后接另一个大写字母开头的小写字母和数字(可选,根据需求调整) + ), + "_" + ).toLowerCase(); + } + public static Map compareObjects(Object obj1, Object obj2) throws IllegalAccessException { Map differences = new HashMap<>(); @@ -176,7 +187,7 @@ public class ConvertUtil { // Compare the field values if ((value1 !=null && !value1.equals(value2)) || (value2 !=null && !value2.equals(value1))) { - differences.put(field.getName(), "Field " + field.getName() + " differs: " + value1 + " vs " + value2); + differences.put(toSnakeCase(field.getName()), "Field " + field.getName() + " differs: " + value1 + " vs " + value2); } } From fc1c3fe2b438f49bde7c4e96ea8aa3ab1aeed47e Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 23 Oct 2024 08:52:06 +0800 Subject: [PATCH 74/91] =?UTF-8?q?=E6=96=87=E4=BB=B6=E6=89=93=E5=8C=85?= =?UTF-8?q?=E4=B8=8B=E8=BD=BD=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/utils/MinioUtil.java | 31 ++++++++++--------- 1 file changed, 17 insertions(+), 14 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/MinioUtil.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/MinioUtil.java index 7bd5951b..f311065a 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/MinioUtil.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/MinioUtil.java @@ -394,21 +394,24 @@ public class MinioUtil { for (Result result : results) { Item item = result.get(); String objectName = item.objectName(); - InputStream objectStream = minioClient.getObject( - GetObjectArgs.builder().bucket(bucketName).object(objectName).build()); - - // Create a zip entry for each object - ZipEntry zipEntry = new ZipEntry(objectName); - zip.putNextEntry(zipEntry); - - // Write object data to zip stream - byte[] buffer = new byte[1024]; - int bytesRead; - while ((bytesRead = objectStream.read(buffer)) != -1) { - zip.write(buffer, 0, bytesRead); + if (!objectName.contains(".git")) { + InputStream objectStream = minioClient.getObject( + GetObjectArgs.builder().bucket(bucketName).object(objectName).build()); + + + // Create a zip entry for each object + ZipEntry zipEntry = new ZipEntry(objectName); + zip.putNextEntry(zipEntry); + + // Write object data to zip stream + byte[] buffer = new byte[1024]; + int bytesRead; + while ((bytesRead = objectStream.read(buffer)) != -1) { + zip.write(buffer, 0, bytesRead); + } + zip.closeEntry(); + objectStream.close(); } - zip.closeEntry(); - objectStream.close(); } zip.finish(); From 5d99e0481c5fa2fcb09af79e11bfe731e8fe5870 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Wed, 23 Oct 2024 09:15:29 +0800 Subject: [PATCH 75/91] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=AF=B9=E6=AF=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/components/BasicInfo/index.less | 5 - react-ui/src/components/BasicInfo/index.tsx | 13 +- .../src/components/BasicTableInfo/index.less | 6 +- react-ui/src/enums/pagesEnums.ts | 1 + react-ui/src/hooks/index.ts | 2 +- .../src/pages/Experiment/Comparison/index.tsx | 15 +- .../Model/components/ModelMetrics/index.tsx | 26 ++- .../ModelDeployment/ServiceInfo/index.tsx | 41 +++- .../components/VersionCompareModal/index.less | 117 +++++++++++ .../components/VersionCompareModal/index.tsx | 193 ++++++++++++++++++ .../src/services/modelDeployment/index.ts | 8 + react-ui/src/utils/index.ts | 23 +++ 12 files changed, 413 insertions(+), 37 deletions(-) create mode 100644 react-ui/src/pages/ModelDeployment/components/VersionCompareModal/index.less create mode 100644 react-ui/src/pages/ModelDeployment/components/VersionCompareModal/index.tsx diff --git a/react-ui/src/components/BasicInfo/index.less b/react-ui/src/components/BasicInfo/index.less index ffeb3d3d..e4570868 100644 --- a/react-ui/src/components/BasicInfo/index.less +++ b/react-ui/src/components/BasicInfo/index.less @@ -38,13 +38,8 @@ margin-left: 16px; font-size: @font-size-content; line-height: 1.6; - white-space: pre-line; word-break: break-all; - &--ellipsis { - .singleLine(); - } - &__text { color: @text-color; } diff --git a/react-ui/src/components/BasicInfo/index.tsx b/react-ui/src/components/BasicInfo/index.tsx index 60cd5b57..bd07db34 100644 --- a/react-ui/src/components/BasicInfo/index.tsx +++ b/react-ui/src/components/BasicInfo/index.tsx @@ -120,13 +120,10 @@ export function BasicInfoItemValue({ } return ( - - {component} - +
+ + {component} + +
); } diff --git a/react-ui/src/components/BasicTableInfo/index.less b/react-ui/src/components/BasicTableInfo/index.less index cc3d0984..314b05ca 100644 --- a/react-ui/src/components/BasicTableInfo/index.less +++ b/react-ui/src/components/BasicTableInfo/index.less @@ -33,10 +33,10 @@ &__value { flex: 1; + min-width: 0; margin: 0 !important; padding: 12px 20px 4px; font-size: @font-size; - white-space: pre-line; word-break: break-all; & + & { @@ -47,10 +47,6 @@ padding-bottom: 12px; } - &--ellipsis { - .singleLine(); - } - &__text { color: @text-color; } diff --git a/react-ui/src/enums/pagesEnums.ts b/react-ui/src/enums/pagesEnums.ts index 756d3325..d11eb8b5 100644 --- a/react-ui/src/enums/pagesEnums.ts +++ b/react-ui/src/enums/pagesEnums.ts @@ -1,3 +1,4 @@ export enum PageEnum { LOGIN = '/user/login', + Authorize = '/authorize', } diff --git a/react-ui/src/hooks/index.ts b/react-ui/src/hooks/index.ts index 6f5bdbbc..f5ef64af 100644 --- a/react-ui/src/hooks/index.ts +++ b/react-ui/src/hooks/index.ts @@ -162,7 +162,7 @@ export const useCheck = (list: T[]) => { const [selected, setSelected] = useState([]); const checked = useMemo(() => { - return selected.length === list.length; + return selected.length === list.length && selected.length > 0; }, [selected, list]); const indeterminate = useMemo(() => { diff --git a/react-ui/src/pages/Experiment/Comparison/index.tsx b/react-ui/src/pages/Experiment/Comparison/index.tsx index 1667a064..1edfd0a3 100644 --- a/react-ui/src/pages/Experiment/Comparison/index.tsx +++ b/react-ui/src/pages/Experiment/Comparison/index.tsx @@ -10,6 +10,7 @@ import { getExpMetricsReq, getExpTrainInfosReq, } from '@/services/experiment'; +import { tableSorter } from '@/utils'; import { to } from '@/utils/promise'; import tableCellRender, { TableCellValueType } from '@/utils/table'; import { useSearchParams } from '@umijs/max'; @@ -103,7 +104,7 @@ function ExperimentComparison() { }; // 选择行 - const rowSelection: TableProps['rowSelection'] = { + const rowSelection: TableProps['rowSelection'] = { type: 'checkbox', columnWidth: 48, fixed: 'left', @@ -126,8 +127,10 @@ function ExperimentComparison() { } }; - const columns: TableProps['columns'] = useMemo(() => { + const columns: TableProps['columns'] = useMemo(() => { const first: TableData | undefined = tableData[0]; + const metricsNames = first?.metrics_names ?? []; + const paramsNames = first?.params_names ?? []; return [ { title: '基本信息', @@ -175,7 +178,7 @@ function ExperimentComparison() { { title: `${config.title}参数`, align: 'center', - children: first?.params_names.map((name) => ({ + children: paramsNames.map((name) => ({ title: ( {name} @@ -187,14 +190,14 @@ function ExperimentComparison() { align: 'center', render: tableCellRender(true), ellipsis: { showTitle: false }, - sorter: (a, b) => a.params[name] - b.params[name], + sorter: (a, b) => tableSorter(a.params[name], b.params[name]), showSorterTooltip: false, })), }, { title: `${config.title}指标`, align: 'center', - children: first?.metrics_names.map((name) => ({ + children: metricsNames.map((name) => ({ title: ( {name} @@ -206,7 +209,7 @@ function ExperimentComparison() { align: 'center', render: tableCellRender(true), ellipsis: { showTitle: false }, - sorter: (a, b) => a.metrics[name] - b.metrics[name], + sorter: (a, b) => tableSorter(a.metrics[name], b.metrics[name]), showSorterTooltip: false, })), }, diff --git a/react-ui/src/pages/Model/components/ModelMetrics/index.tsx b/react-ui/src/pages/Model/components/ModelMetrics/index.tsx index 7ffd7fbb..d1f8d2d6 100644 --- a/react-ui/src/pages/Model/components/ModelMetrics/index.tsx +++ b/react-ui/src/pages/Model/components/ModelMetrics/index.tsx @@ -1,6 +1,7 @@ import SubAreaTitle from '@/components/SubAreaTitle'; import { useCheck } from '@/hooks'; import { getModelPageVersionsReq, getModelVersionsMetricsReq } from '@/services/dataset'; +import { tableSorter } from '@/utils'; import { to } from '@/utils/promise'; import tableCellRender from '@/utils/table'; import { Checkbox, Table, Tooltip, type TablePaginationConfig, type TableProps } from 'antd'; @@ -18,7 +19,7 @@ type TableData = { metrics_names?: string[]; metrics?: Record; params_names?: string[]; - params?: Record; + params?: Record; }; type ModelMetricsProps = { @@ -113,14 +114,18 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr }; // 分页切换 - const handleTableChange: TableProps['onChange'] = (pagination, _filters, _sorter, { action }) => { + const handleTableChange: TableProps['onChange'] = ( + pagination, + _filters, + _sorter, + { action }, + ) => { if (action === 'paginate') { setPagination(pagination); } - // console.log(pagination, filters, sorter, action); }; - const rowSelection: TableProps['rowSelection'] = { + const rowSelection: TableProps['rowSelection'] = { type: 'checkbox', fixed: 'left', selectedRowKeys, @@ -142,10 +147,12 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr }, [version, tableData]); // 表头 - const columns: TableProps['columns'] = useMemo(() => { + const columns: TableProps['columns'] = useMemo(() => { const first: TableData | undefined = tableData.find( (item) => item.metrics_names && item.metrics_names.length > 0, ); + const metricsNames = first?.metrics_names ?? []; + const paramsNames = first?.params_names ?? []; return [ { title: '基本信息', @@ -165,7 +172,7 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr { title: `训练参数`, align: 'center', - children: first?.params_names?.map((name) => ({ + children: paramsNames.map((name) => ({ title: ( {name} @@ -177,7 +184,7 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr align: 'center', render: tableCellRender(true), ellipsis: { showTitle: false }, - sorter: (a, b) => a.params?.[name] ?? 0 - b.params?.[name] ?? 0, + sorter: (a, b) => tableSorter(a.params?.[name], b.params?.[name]), showSorterTooltip: false, })), }, @@ -188,12 +195,13 @@ function ModelMetrics({ resourceId, identifier, owner, version }: ModelMetricsPr checked={metricsChecked} indeterminate={metricsIndeterminate} onChange={checkAllMetrics} + disabled={metricsNames.length === 0} >{' '} 训练指标 ), align: 'center', - children: first?.metrics_names?.map((name) => ({ + children: metricsNames.map((name) => ({ title: (
a.metrics?.[name] ?? 0 - b.metrics?.[name] ?? 0, + sorter: (a, b) => tableSorter(a.metrics?.[name], b.metrics?.[name]), showSorterTooltip: false, })), }, diff --git a/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx b/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx index 42b80e87..07d40de5 100644 --- a/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx +++ b/react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx @@ -18,6 +18,7 @@ import { } from '@/services/modelDeployment'; import themes from '@/styles/theme.less'; import { formatDate } from '@/utils/date'; +import { openAntdModal } from '@/utils/modal'; import { to } from '@/utils/promise'; import SessionStorage from '@/utils/sessionStorage'; import tableCellRender, { TableCellValueType } from '@/utils/table'; @@ -37,6 +38,7 @@ import { type SearchProps } from 'antd/es/input'; import classNames from 'classnames'; import { useEffect, useState } from 'react'; import ServiceRunStatusCell from '../components/ModelDeployStatusCell'; +import VersionCompareModal from '../components/VersionCompareModal'; import { CreateServiceVersionFrom, ServiceData, @@ -56,6 +58,7 @@ function ServiceInfo() { const [inputText, setInputText] = useState(cacheState?.searchText); const [tableData, setTableData] = useState([]); const [total, setTotal] = useState(0); + const [selectedRowKeys, setSelectedRowKeys] = useState([]); const [pagination, setPagination] = useState( cacheState?.pagination ?? { current: 1, @@ -208,11 +211,39 @@ function ServiceInfo() { }; // 分页切换 - const handleTableChange: TableProps['onChange'] = (pagination, _filters, _sorter, { action }) => { + const handleTableChange: TableProps['onChange'] = ( + pagination, + _filters, + _sorter, + { action }, + ) => { if (action === 'paginate') { setPagination(pagination); } - // console.log(pagination, filters, sorter, action); + }; + + // 版本对比 + const handleVersionCompare = () => { + if (selectedRowKeys.length !== 2) { + message.error('请选择两个版本进行对比'); + return; + } + + openAntdModal(VersionCompareModal, { + version1: selectedRowKeys[0] as string, + version2: selectedRowKeys[1] as string, + }); + }; + + // 选择行 + const rowSelection: TableProps['rowSelection'] = { + type: 'checkbox', + columnWidth: 48, + fixed: 'left', + selectedRowKeys, + onChange: (selectedRowKeys: React.Key[]) => { + setSelectedRowKeys(selectedRowKeys); + }, }; const columns: TableProps['columns'] = [ @@ -379,13 +410,16 @@ function ServiceInfo() { allowClear > +
diff --git a/react-ui/src/pages/ModelDeployment/components/VersionCompareModal/index.less b/react-ui/src/pages/ModelDeployment/components/VersionCompareModal/index.less new file mode 100644 index 00000000..f0d5449e --- /dev/null +++ b/react-ui/src/pages/ModelDeployment/components/VersionCompareModal/index.less @@ -0,0 +1,117 @@ +@purple-color: #6516ff; + +.title(@color, @background) { + width: 100%; + margin-bottom: 20px; + color: @color; + font-weight: 500; + font-size: @font-size; + line-height: 42px; + text-align: center; + background: @background; + .singleLine(); +} + +.text() { + margin-bottom: 20px !important; + color: @text-color-secondary; + font-size: 13px; + word-break: break-all; + .singleLine(); +} + +.version-container(@background) { + flex: 1; + min-width: 0; + background: @background; + border-radius: 4px; +} + +.version-compare { + :global { + .ant-modal-content { + padding: 40px 40px 25px !important; + } + .ant-modal-header { + margin-bottom: 20px !important; + } + .kf-modal-title { + color: @text-color; + font-weight: 500; + font-size: 20px; + } + } + + &__container { + display: flex; + flex-wrap: nowrap; + gap: 0 5px; + align-items: stretch; + height: 100%; + } + + &__fields { + flex: none; + width: 117px; + padding: 0 15px; + background: white; + border: 1px solid .addAlpha(@primary-color, 0.2) []; + border-radius: 4px; + + &__title { + margin-bottom: 20px; + color: @text-color; + font-size: @font-size; + line-height: 42px; + } + &__text { + .text(); + + &--different { + color: @error-color; + } + } + } + + &__left { + .version-container(.addAlpha(@primary-color, 0.04) []); + + &__title { + .title(@primary-color, linear-gradient( + 159.9deg,rgba(138, 177, 255, 0.5) 0%, + rgba(22, 100, 255, 0.5) 100% + )); + } + + &__text { + padding: 0 15px; + text-align: center; + .text(); + + &--different { + color: @primary-color; + } + } + } + + &__right { + .version-container(rgba(100, 30, 237, 0.04)); + &__title { + .title(@purple-color, linear-gradient( + 159.9deg, + rgba(193, 138, 255, 0.5) 0%, + rgba(146, 22, 255, 0.5) 100% + )); + } + + &__text { + padding: 0 15px; + text-align: center; + .text(); + + &--different { + color: @purple-color; + } + } + } +} diff --git a/react-ui/src/pages/ModelDeployment/components/VersionCompareModal/index.tsx b/react-ui/src/pages/ModelDeployment/components/VersionCompareModal/index.tsx new file mode 100644 index 00000000..be28ba3b --- /dev/null +++ b/react-ui/src/pages/ModelDeployment/components/VersionCompareModal/index.tsx @@ -0,0 +1,193 @@ +import KFModal from '@/components/KFModal'; +import { ServiceRunStatus } from '@/enums'; +import { useComputingResource } from '@/hooks/resource'; +import { type ServiceVersionData } from '@/pages/ModelDeployment/types'; +import { getServiceVersionCompareReq } from '@/services/modelDeployment'; +import { to } from '@/utils/promise'; +import { Typography, type ModalProps } from 'antd'; +import classNames from 'classnames'; +import { useEffect, useMemo, useState } from 'react'; +import { statusInfo } from '../ModelDeployStatusCell'; +import styles from './index.less'; + +type CompareData = { + differences: Record; + version1: ServiceVersionData; + version2: ServiceVersionData; +}; + +type ServiceVersionDataKey = keyof ServiceVersionData; + +type FiledType = { + key: ServiceVersionDataKey; + text: string; + format?: (data: any) => any; +}; + +interface CreateMirrorModalProps extends Omit { + version1: string; + version2: string; +} + +// 格式化环境变量 +const formatEnvText = (env: Record) => { + if (!env || Object.keys(env).length === 0) { + return '--'; + } + return Object.entries(env) + .map(([key, value]) => `${key} = ${value}`) + .join(','); +}; + +function VersionCompareModal({ version1, version2, ...rest }: CreateMirrorModalProps) { + const [compareData, setCompareData] = useState(undefined); + const getResourceDescription = useComputingResource()[2]; + + const fields: FiledType[] = useMemo( + () => [ + { + key: 'service_name', + text: '服务名称', + }, + { + key: 'run_state', + text: '状态', + format: (data: any) => { + return data ? statusInfo[data as ServiceRunStatus].text : '--'; + }, + }, + { + key: 'image', + text: '镜像', + }, + { + key: 'code_config', + text: '代码配置', + format: (data: any) => { + return data?.show_value; + }, + }, + { + key: 'model', + text: '模型', + format: (data: any) => { + return data?.show_value; + }, + }, + { + key: 'resource', + text: '资源规格', + format: getResourceDescription, + }, + { + key: 'replicas', + text: '副本数', + }, + { + key: 'mount_path', + text: '挂载路径', + }, + { + key: 'url', + text: '服务URL', + }, + { + key: 'env_variables', + text: '环境变量', + format: formatEnvText, + }, + { + key: 'description', + text: '描述', + }, + ], + [getResourceDescription], + ); + + useEffect(() => { + getServiceVersionCompare(); + }, []); + + // 获取对比数据 + const getServiceVersionCompare = async () => { + const params = { + id1: version1, + id2: version2, + }; + const [res] = await to(getServiceVersionCompareReq(params)); + if (res && res.data) { + setCompareData(res.data); + } + }; + + const { + version1: v1 = {} as ServiceVersionData, + version2: v2 = {} as ServiceVersionData, + differences = {}, + } = compareData || {}; + + const isDifferent = (key: ServiceVersionDataKey) => { + const keys = Object.keys(differences); + return keys.includes(key); + }; + + return ( + +
+
+
基础版本号
+ {fields.map(({ key, text }) => ( +
+ {text} +
+ ))} +
+
+
{v1.version}
+ {fields.map(({ key, format }) => { + const text = format ? format(v1[key]) : v1[key]; + return ( +
+ {text} +
+ ); + })} +
+
+
{v2.version}
+ {fields.map(({ key, format }) => { + const text = format ? format(v2[key]) : v2[key]; + return ( +
+ {text} +
+ ); + })} +
+
+
+ ); +} + +export default VersionCompareModal; diff --git a/react-ui/src/services/modelDeployment/index.ts b/react-ui/src/services/modelDeployment/index.ts index eccf841e..9a33687f 100644 --- a/react-ui/src/services/modelDeployment/index.ts +++ b/react-ui/src/services/modelDeployment/index.ts @@ -104,3 +104,11 @@ export function getServiceVersionLogReq(params: any) { params, }); } + +// 获取服务版本对比 +export function getServiceVersionCompareReq(params: any) { + return request(`/api/mmp/service/serviceVersionCompare`, { + method: 'GET', + params, + }); +} diff --git a/react-ui/src/utils/index.ts b/react-ui/src/utils/index.ts index 0af6f5aa..67ca10d2 100644 --- a/react-ui/src/utils/index.ts +++ b/react-ui/src/utils/index.ts @@ -4,6 +4,7 @@ * @Description: 工具类 */ +import { PageEnum } from '@/enums/pagesEnums'; import G6 from '@antv/g6'; // 生成 8 位随机数 @@ -218,3 +219,25 @@ export const getGitUrl = (url: string, branch: string): string => { const gitUrl = url.replace(/\.git$/, ''); return branch ? `${gitUrl}/tree/${branch}` : gitUrl; }; + +// 判断是否需要登录 +export const needAuth = (pathname: string) => { + return pathname !== PageEnum.LOGIN && pathname !== PageEnum.Authorize; +}; + +// 表格排序 +export const tableSorter = (a: any, b: any) => { + if (b === null || b === undefined) { + return -1; + } + if (a === null || a === undefined) { + return 1; + } + if (typeof a === 'number' && typeof b === 'number') { + return a - b; + } + if (typeof a === 'string' && typeof b === 'string') { + return a.localeCompare(b); + } + return 0; +}; From 1dbf028d50ac032535069a6d5b0fcdf28eaaf710 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 23 Oct 2024 09:42:07 +0800 Subject: [PATCH 76/91] =?UTF-8?q?dvc=E8=BF=9C=E7=A8=8B=E7=9B=AE=E5=BD=95?= =?UTF-8?q?=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/service/impl/AimServiceImpl.java | 6 +++--- .../com/ruoyi/platform/service/impl/ModelsServiceImpl.java | 4 ++-- .../ruoyi/platform/service/impl/NewDatasetServiceImpl.java | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index 1bfdb77d..34e938d5 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -192,9 +192,9 @@ public class AimServiceImpl implements AimService { //解析指标 Map metricValue = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricValue()); if (isTrain) { - setMetricValue("train",metricValue,aimRunInfo); + setMetricValue("train", metricValue, aimRunInfo); } else { - setMetricValue("evaluate",metricValue,aimRunInfo); + setMetricValue("evaluate", metricValue, aimRunInfo); } aimRunInfoList.add(aimRunInfo); } @@ -307,7 +307,7 @@ public class AimServiceImpl implements AimService { return datasetList; } - private void setMetricValue(String isTrain, Map metricValue, InsMetricInfoVo aimRunInfo){ + private void setMetricValue(String isTrain, Map metricValue, InsMetricInfoVo aimRunInfo) { Map metricValues = (Map) metricValue.get(isTrain); HashMap metrics = new HashMap<>(); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index ff053e78..3eb50725 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -654,7 +654,7 @@ public class ModelsServiceImpl implements ModelsService { try { dvcUtils.dvcInit(rootPath); // 配置远程S3地址 - String s3Path = "management-platform-files/" + ci4sUsername + "/model/" + gitlinIid + "/" + repositoryName + "/" + branchName; + String s3Path = "data/mini-model-management-platform-files/" + ci4sUsername + "/model/" + gitlinIid + "/" + repositoryName + "/" + branchName; dvcUtils.dvcRemoteAdd(rootPath, s3Path); dvcUtils.dvcConfigS3Credentials(rootPath, endpoint); dvcUtils.dvcConfigS3Credentials2(rootPath, accessKeyId); @@ -826,7 +826,7 @@ public class ModelsServiceImpl implements ModelsService { } // 配置远程S3地址 - String s3Path = "management-platform-files/" + ci4sUsername + "/model/" + modelsVo.getId() + "/" + repositoryName + "/" + branchName; + String s3Path = "data/mini-model-management-platform-files/" + ci4sUsername + "/model/" + modelsVo.getId() + "/" + repositoryName + "/" + branchName; dvcUtils.dvcRemoteAdd(rootPath, s3Path); dvcUtils.dvcConfigS3Credentials(rootPath, endpoint); dvcUtils.dvcConfigS3Credentials2(rootPath, accessKeyId); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java index a27ff01d..2fb84d2d 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java @@ -123,7 +123,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { // 命令行操作 git clone 项目地址 dvcUtils.gitClone(localPath, projectUrl, branchName, gitLinkUsername, gitLinkPassword); - String s3Path = "management-platform-files" + "/" + relatePath + "/" + branchName; + String s3Path = "data/mini-model-management-platform-files" + "/" + relatePath + "/" + branchName; //干掉目标文件夹 dvcUtils.deleteDirectory(datasetPath); dvcUtils.moveFiles(sourcePath, datasetPath); @@ -216,7 +216,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { dvcUtils.dvcCheckout(localPath); // 准备数据 - String s3Path = "management-platform-files" + "/" + relatePath + "/" + branchName; + String s3Path = "data/mini-model-management-platform-files" + "/" + relatePath + "/" + branchName; //干掉目标文件夹 dvcUtils.deleteDirectory(datasetPath); From 02a3952d0bfa5ca2e1eb1663586f2027e1724b4c Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 23 Oct 2024 10:18:55 +0800 Subject: [PATCH 77/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/service/impl/AimServiceImpl.java | 12 ++++++----- .../ExperimentInsDaoMapper.xml | 21 ++++++++++--------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index 34e938d5..5c07567f 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -190,11 +190,13 @@ public class AimServiceImpl implements AimService { } //解析指标 - Map metricValue = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricValue()); - if (isTrain) { - setMetricValue("train", metricValue, aimRunInfo); - } else { - setMetricValue("evaluate", metricValue, aimRunInfo); + if (StringUtils.isNotEmpty(experimentIns.getMetricValue())) { + Map metricValue = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricValue()); + if (isTrain) { + setMetricValue("train", metricValue, aimRunInfo); + } else { + setMetricValue("evaluate", metricValue, aimRunInfo); + } } aimRunInfoList.add(aimRunInfo); } diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml index 3ee4bd28..ef87ed63 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml @@ -13,6 +13,7 @@ + @@ -25,7 +26,7 @@ - select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state + select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, global_param,metric_record,metric_value, start_time, finish_time, create_by, create_time, update_by, update_time, state from experiment_ins where experiment_id = #{experiment_id} and state = 1 order by update_time DESC @@ -69,7 +70,7 @@ select - id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs,global_param,metric_record, start_time, finish_time, create_by, create_time, update_by, update_time, state + id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs,global_param,metric_record,metric_value, start_time, finish_time, create_by, create_time, update_by, update_time, state from experiment_ins state = 1 @@ -135,7 +136,7 @@ - insert into experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,global_param,metric_record,start_time,finish_time,create_by,create_time,update_by,update_time,state) - values (#{experimentIns.experimentId},#{experimentIns.argoInsName},#{experimentIns.argoInsNs},#{experimentIns.status},#{experimentIns.nodesStatus},#{experimentIns.nodesResult},#{experimentIns.nodesLogs},#{experimentIns.globalParam},#{experimentIns.metricRecord},#{experimentIns.startTime},#{experimentIns.finishTime},#{experimentIns.createBy},#{experimentIns.createTime},#{experimentIns.updateBy},#{experimentIns.updateTime},#{experimentIns.state}) + insert into experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,global_param,metric_record,metric_value,start_time,finish_time,create_by,create_time,update_by,update_time,state) + values (#{experimentIns.experimentId},#{experimentIns.argoInsName},#{experimentIns.argoInsNs},#{experimentIns.status},#{experimentIns.nodesStatus},#{experimentIns.nodesResult},#{experimentIns.nodesLogs},#{experimentIns.globalParam},#{experimentIns.metricRecord},#{experimentIns.metricValue},#{experimentIns.startTime},#{experimentIns.finishTime},#{experimentIns.createBy},#{experimentIns.createTime},#{experimentIns.updateBy},#{experimentIns.updateTime},#{experimentIns.state}) insert into - experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,global_param,metric_record,start_time,finish_time,create_by,create_time,update_by,update_time,state) + experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,global_param,metric_record,metric_value,start_time,finish_time,create_by,create_time,update_by,update_time,state) values - (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesResult},#{entity.nodesLogs},#{entity.globalParam},#{entity.metricRecord},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state}) + (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesResult},#{entity.nodesLogs},#{entity.globalParam},#{entity.metricRecord},#{entity.metricValue},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state}) From 1451f50c46985c319983f962f8972d536fa60b88 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 23 Oct 2024 10:31:30 +0800 Subject: [PATCH 78/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/aim/AimController.java | 13 ++++---- .../ruoyi/platform/service/AimService.java | 3 +- .../platform/service/impl/AimServiceImpl.java | 31 ++++++++++--------- 3 files changed, 26 insertions(+), 21 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/aim/AimController.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/aim/AimController.java index 28632dcb..9390e156 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/aim/AimController.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/aim/AimController.java @@ -1,6 +1,7 @@ package com.ruoyi.platform.controller.aim; import com.ruoyi.common.core.web.controller.BaseController; +import com.ruoyi.common.core.web.domain.AjaxResult; import com.ruoyi.common.core.web.domain.GenericsAjaxResult; import com.ruoyi.platform.service.AimService; import com.ruoyi.platform.vo.InsMetricInfoVo; @@ -24,19 +25,19 @@ public class AimController extends BaseController { @GetMapping("/getExpTrainInfos/{experiment_id}") @ApiOperation("获取当前实验的模型训练指标信息") @ApiResponse - public GenericsAjaxResult> getExpTrainInfos(@RequestParam(value = "page") int page, - @RequestParam(value = "size") int size, - @PathVariable("experiment_id") Integer experimentId) { - return genericsSuccess(aimService.getExpInfos(true, experimentId, page, size)); + public AjaxResult getExpTrainInfos(@RequestParam(value = "page") int page, + @RequestParam(value = "size") int size, + @PathVariable("experiment_id") Integer experimentId) { + return AjaxResult.success(aimService.getExpInfos(true, experimentId, page, size)); } @GetMapping("/getExpEvaluateInfos/{experiment_id}") @ApiOperation("获取当前实验的模型推理指标信息") @ApiResponse - public GenericsAjaxResult> getExpEvaluateInfos(@RequestParam(value = "page") int page, + public AjaxResult getExpEvaluateInfos(@RequestParam(value = "page") int page, @RequestParam(value = "size") int size, @PathVariable("experiment_id") Integer experimentId) { - return genericsSuccess(aimService.getExpInfos(false, experimentId, page, size)); + return AjaxResult.success(aimService.getExpInfos(false, experimentId, page, size)); } @PostMapping("/getExpMetrics") diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java index abcbc645..c7e383e3 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/AimService.java @@ -1,6 +1,7 @@ package com.ruoyi.platform.service; import com.ruoyi.platform.vo.InsMetricInfoVo; +import org.springframework.data.domain.Page; import java.util.HashMap; import java.util.List; @@ -12,7 +13,7 @@ public interface AimService { List getExpEvaluateInfos(Integer experimentId, String offset, int limit) throws Exception; - List getExpInfos(boolean isTrain, Integer experimentId, int page, int size); + Page getExpInfos(boolean isTrain, Integer experimentId, int page, int size); List getExpInfos1(boolean isTrain, Integer experimentId, String runId) throws Exception; diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index 5c07567f..a2e912e4 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -14,6 +14,8 @@ import com.ruoyi.platform.utils.JsonUtils; import com.ruoyi.platform.vo.InsMetricInfoVo; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Value; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.stereotype.Service; @@ -151,14 +153,12 @@ public class AimServiceImpl implements AimService { return aimRunInfoList; } - public List getExpInfos(boolean isTrain, Integer experimentId, int page, int size) { + public Page getExpInfos(boolean isTrain, Integer experimentId, int page, int size) { PageRequest pageRequest = PageRequest.of(page, size); ExperimentIns query = new ExperimentIns(); query.setExperimentId(experimentId); + long count = experimentInsDao.count(query); List experimentInsList = experimentInsDao.queryAllByLimit(query, pageRequest); - if (experimentInsList == null || experimentInsList.size() == 0) { - return new ArrayList<>(); - } List aimRunInfoList = new ArrayList<>(); for (ExperimentIns experimentIns : experimentInsList) { InsMetricInfoVo aimRunInfo = new InsMetricInfoVo(); @@ -200,7 +200,7 @@ public class AimServiceImpl implements AimService { } aimRunInfoList.add(aimRunInfo); } - return aimRunInfoList; + return new PageImpl<>(aimRunInfoList, pageRequest, count); } @@ -314,15 +314,18 @@ public class AimServiceImpl implements AimService { HashMap metrics = new HashMap<>(); List metricsNames = new ArrayList<>(); - for (String key : metricValues.keySet()) { - Map valueMap = (Map) metricValues.get(key); - aimRunInfo.setRunId((String) valueMap.get("run_hash")); - - metrics.putAll(valueMap.entrySet().stream().filter(entry -> !entry.getKey().equals("run_hash")).collect(Collectors.toMap( - Map.Entry::getKey, - Map.Entry::getValue - ))); - metricsNames.addAll(valueMap.keySet().stream().filter(entry -> !entry.equals("run_hash")).collect(Collectors.toList())); + + if(metricValues != null){ + for (String key : metricValues.keySet()) { + Map valueMap = (Map) metricValues.get(key); + aimRunInfo.setRunId((String) valueMap.get("run_hash")); + + metrics.putAll(valueMap.entrySet().stream().filter(entry -> !entry.getKey().equals("run_hash")).collect(Collectors.toMap( + Map.Entry::getKey, + Map.Entry::getValue + ))); + metricsNames.addAll(valueMap.keySet().stream().filter(entry -> !entry.equals("run_hash")).collect(Collectors.toList())); + } } aimRunInfo.setMetrics(metrics); aimRunInfo.setMetricsNames(metricsNames); From 2d14a96e345bca0647e68a4c36b32e6bdcaceb12 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Wed, 23 Oct 2024 11:01:24 +0800 Subject: [PATCH 79/91] =?UTF-8?q?=E4=BC=98=E5=8C=96dvc=E8=BF=9C=E7=A8=8B?= =?UTF-8?q?=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/ruoyi/platform/service/impl/ModelsServiceImpl.java | 4 ++-- .../ruoyi/platform/service/impl/NewDatasetServiceImpl.java | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java index 3eb50725..a39905a4 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ModelsServiceImpl.java @@ -654,7 +654,7 @@ public class ModelsServiceImpl implements ModelsService { try { dvcUtils.dvcInit(rootPath); // 配置远程S3地址 - String s3Path = "data/mini-model-management-platform-files/" + ci4sUsername + "/model/" + gitlinIid + "/" + repositoryName + "/" + branchName; + String s3Path = bucketName + "/mini-model-management-platform-files/" + ci4sUsername + "/model/" + gitlinIid + "/" + repositoryName + "/" + branchName; dvcUtils.dvcRemoteAdd(rootPath, s3Path); dvcUtils.dvcConfigS3Credentials(rootPath, endpoint); dvcUtils.dvcConfigS3Credentials2(rootPath, accessKeyId); @@ -826,7 +826,7 @@ public class ModelsServiceImpl implements ModelsService { } // 配置远程S3地址 - String s3Path = "data/mini-model-management-platform-files/" + ci4sUsername + "/model/" + modelsVo.getId() + "/" + repositoryName + "/" + branchName; + String s3Path = bucketName + "/mini-model-management-platform-files/" + ci4sUsername + "/model/" + modelsVo.getId() + "/" + repositoryName + "/" + branchName; dvcUtils.dvcRemoteAdd(rootPath, s3Path); dvcUtils.dvcConfigS3Credentials(rootPath, endpoint); dvcUtils.dvcConfigS3Credentials2(rootPath, accessKeyId); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java index 2fb84d2d..6c2b8c6b 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/NewDatasetServiceImpl.java @@ -63,6 +63,8 @@ public class NewDatasetServiceImpl implements NewDatasetService { String endpoint; @Value("${git.endpoint}") String gitendpoint; + @Value("${minio.dataReleaseBucketName}") + private String bucketName; @Value("${git.localPath}") String localPathlocal; @Resource @@ -123,7 +125,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { // 命令行操作 git clone 项目地址 dvcUtils.gitClone(localPath, projectUrl, branchName, gitLinkUsername, gitLinkPassword); - String s3Path = "data/mini-model-management-platform-files" + "/" + relatePath + "/" + branchName; + String s3Path = bucketName + "/mini-model-management-platform-files" + "/" + relatePath + "/" + branchName; //干掉目标文件夹 dvcUtils.deleteDirectory(datasetPath); dvcUtils.moveFiles(sourcePath, datasetPath); @@ -216,7 +218,7 @@ public class NewDatasetServiceImpl implements NewDatasetService { dvcUtils.dvcCheckout(localPath); // 准备数据 - String s3Path = "data/mini-model-management-platform-files" + "/" + relatePath + "/" + branchName; + String s3Path = bucketName + "/mini-model-management-platform-files" + "/" + relatePath + "/" + branchName; //干掉目标文件夹 dvcUtils.deleteDirectory(datasetPath); From ca16078569b245a94f0aa888e83501bbeceddf03 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Wed, 23 Oct 2024 14:45:29 +0800 Subject: [PATCH 80/91] =?UTF-8?q?feat:=20=E5=AE=8C=E6=88=90=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=85=8D=E7=BD=AE=E7=BB=93=E6=9E=84=E5=92=8C=E6=A0=B7?= =?UTF-8?q?=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/src/assets/img/code-name-icon.png | Bin 0 -> 2158 bytes react-ui/src/assets/img/creatBy.png | Bin 1566 -> 1656 bytes react-ui/src/assets/img/total-icon.png | Bin 0 -> 4078 bytes react-ui/src/pages/CodeConfig/List/index.less | 75 +++++++-------- react-ui/src/pages/CodeConfig/List/index.tsx | 90 ++++++++++-------- .../components/CodeConfigItem/index.less | 75 +++++++++++---- .../components/CodeConfigItem/index.tsx | 23 +++-- .../components/ResourceItem/index.less | 44 +++++---- .../components/ResourceList/index.less | 1 - .../Dataset/components/ResourceList/index.tsx | 1 + .../DevelopmentEnvironment/List/index.tsx | 7 +- .../components/ExperimentInstance/index.less | 2 +- .../components/ExperimentInstance/index.tsx | 3 +- .../components/TensorBoardStatus/index.less | 2 +- react-ui/src/pages/Mirror/Info/index.tsx | 7 +- react-ui/src/pages/Mirror/List/index.tsx | 7 +- .../src/pages/ModelDeployment/List/index.tsx | 7 +- .../components/VersionCompareModal/index.tsx | 8 +- .../components/CodeSelectorModal/index.less | 4 - .../components/CodeSelectorModal/index.tsx | 1 + 20 files changed, 218 insertions(+), 139 deletions(-) create mode 100644 react-ui/src/assets/img/code-name-icon.png create mode 100644 react-ui/src/assets/img/total-icon.png diff --git a/react-ui/src/assets/img/code-name-icon.png b/react-ui/src/assets/img/code-name-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..1e7991a97645ada3a9f925b57ab5c9d912fd19ca GIT binary patch literal 2158 zcmV-!2$A=RP)C4?CJU?_KYK0GsbXYcHG=ic4h zZgR8TcJG-vzjMy-{AQ*YS+4fSMGN8dd*YKWj1gi@eC+&p-b1$cv;MyLod1)<-3H4lc}Fg%6K5Q+(ZRZ&xEPJ&%93HG`2}Y zJ~?^y97c$Gbo{r^?d(+CQ66+e;f*BvdK~El!~Q#y$5-vm?LdreG9a&N!ia=I(Bbr# zFYWA9+zIq4+zn;~H1hgRMKC_~Ng+2yd0%NN8-ubn&C zbxg==g>Fa)(H(vzBLQ`=IC;!jlRE;%$NdqnTw#Y~?x&`W96?6PY(@oOk<;lc($*7f zTE*RSYGPr8)#MY;9G=T%)Os;z9Viy+coIS!IGq54n+0(lC5b%q=#RF^OWW-)_$Prr zcgB!6BBAO)M?nOqem_>|&JzWDA9zd%jhM=L-N?Sl*9VF(_|p#d?uzBS5ebRBc1|ER z^ZQYE{mMA-1UQhA^Alg^bD*<_1&}*#b&^#uq*F@N>2VOJQ^WbBiai3-fkdv$sZV^B z-2s{Z1qAtT&T2ObeA4MRH1f_KI>@jaFYZUBa?kUc(94ZIfBnNHZ75wBNccVht zNEMy)W*>-ZgwxU=!`=hScA)qSXcro?Qy6AegKf+K+k5;zg2+CMoo0=+c0eI+Xe_e^ zqDTq0z&YPPJ6vDj)l`-p&jcmHft}#3dTb--B~u2H{WF4`^~sz!(N0A^872A5*fio| z`|OAIl&a}K)-Xz~g9ttCU}vk!a7)hD>I1P9Go1lVi8vd*IFzopmhC{XyF5s+JAg3= zK?}cYhcY9dW=C*}eR^>2NL(*9>_A(0`RM|7j$`38N61Q60WUPWXtv3Nyk;rgsbef9 z`w?Xe!e_mI9a;5F=x5eMslHe2uCPngkrRlSix$oGN$nG*nW>G!zL0!3DLdpdp|o`A zJ@0|s5h!;1B?oyMlsmekHi~?rBU}4JiiQFOiipp~b34%44gEnb%M+|&YMRtsH_P%Ci3VHZMHIqoIII9V% z{sDhwN#mB?hhh)(22|ZITGC}LUDs9vaV-?rMo9q}Aup#-Fmi4L`BO-`3KF4&F|4pc zO_K%bROCY~l*NwBd5yfD{QSFxjk#+;$Es~t`Dw>-k3;@6*X8#*Id5%ZVJcNsD-_jK$t%bs&Zz^9?DG37)X0)mbI&XO zh`{a^qzl|YFX|Ub#z~1xq@nb?z%))k&t85neaUJ~A*pY$OTWj6bSW{1_}Jv}+WSB2 zUJ5o5N1Vn^xB^S^d{X}>`8|O=3HS`B;`#YQ4Tw3-HYPtaM8~H-uD?6I{#CzEILG)Z#urGy_Fp=<3_0D=Q{nr#7UA^5N7-GdC;R5B>*o{aQFe(S*m*3C6 zKV(gzj$T!cm5yiR>f}e+mz3*v2b)B}J(m@EIgYzXH(#oeGRfMrI#84j7&)n(m^_-@ z0Xf*(0Tu`nN^MId)W#OT1nr&9AFywbrL|kT124*z1YC)>K9$pf*4OB?aGkqq?F(t1 zCw?&V_q&CB+bSm8$VEv~e=ph3iSaye1mk1V!*+IB+wY&`tGt~tJDOrcFl)jWzoWJMsum(3&)d_mrjuXQ0tXL z`L@`xWSdy?303A2H#&gJHGYL3?FlvO<|=uGaqYAYD^;o?vxU64l+a2!%dbeQu zaK1jE=XA$j`Y-e3PF*GEHS*F0LdC+hw;DX;vpLn zfxNWuEz;4egDZT@dN(*AS;OoLl67VdHWq<92mHSBP2P}+ysnAWi$VXD!KRfx=w9Df z`L_U53qd?;vQ51dzV%JmvW5R&(Cc8mv#{`{qmK>inOO37YYl)T9uZ!god~PVHuXlo zeXn0CH&vRZss+hD*Zt9JZ#O+y@4L3Y*Q|Ughq2>ysslX^Y*T|Ovrgc)z5YmfwX;Rm klXruiz4mrvxv$6j9}f6iLj1QKM@L7$y1Tn; zOG--CIq40loYJUp2Jw6?ZBySKOZ zDww|l#oc*?uz!vP-(B2ycXxM(VW?deIwk=1_4Utz*?YL@^UN>I$V1#;mzI|5#Ds|g zsH>}c5zGp~$U}^ooWElxHsMm=R905b+v95&Kx1R$H89Bn11C9^W90?I9YX#Oh>Krr z(bxoVqI?dku(KTJ6L-+4%;T z`)~+2kD(g?@dZFUG8bk60IACzIldGFo_ACuwOXwT3=C8fpM!&gz3J)c#nsi-O-J}5 zCjRvG^{p=~EHqVc3jnpXwQ2CT*Bud(kdP1_8ylr6O(w9p;>5Y zY5AUq#(b=?HW&b)T`0!1P+KhNV)1<;#zR9x12Z!-D^i5Q-DgmtTNRW#;R0Ve(i-RG z<)sA#1YF`(#1R10W^8S3eV{<$dKrc59bVz)3(W*)Rt3IwnQ{$#iKum};#L~x^x z?d|OirBZp>oCjGS3;Hg&7%e3wU$myC8GrZ;9AsH(rKhLIhlPbj+tY}Yhvg+#Vk_Q% z5r7uFlx?*|ONz<%X?}iwhJ}liYhq$zY;tmPP6{mw znO5OQ8!fekuvS(o2&DfJ$*qKx4%C*FsWWYFZ|ANHXsN$bG&MDO;GvPXnJX$P$`(qM zQe1&(v|8;HV&Xn4{Yf*YkUooYXX04r_@5A=w2x)brt|PyVGM7$d8JPi=UVj=4q>`yUfka z&E~PN*w~eomBr4^&O2h`=y&t26%zmoW>|r?ReV{PSoilVG`7Z&^}D*dSbujZo}k11 z)Odbi;WDVo*Ad;Btjf?<3IbXsWjRSQXw|m9zOEY{9-d_FlMuW;SPPFBb+iD0%;Jo_ zoe$+$AFvvMXB?EDN4jn5?d^Rk2!LK<7JLBUV?18uVSWx{>2$N&`V37l>mZ=7AWc<3 zssF_GIvoN+pL&f(^T66r|9^`E4p_b&me&f+vgi>Lh~MIEGvsn7Y8TMvbYlzgXInf) z3m2W%0KofTc4~k`Jx` delta 1533 zcmV-Gk*ouNkl#1jL%q zCTbv&fbl^}F9JrYhDH-prShPpUJ41pl$KU~u!Y1LeGn2cme?jFcuUk+6Qj}+b+=dw z#+K6V`2A;l*4B(J2Rt@4B4SGmVeB{2579)z)GdDjDHKE zuxwm?AD>;+3Ktdd8=rTDuA>vJYB=cd)MqC-WqNsv!d9iQiAvVfs0?44G=>SNQ)`^o z*Ky*~yXvB^{^N~(16Wk0^D-i+<&5s4(djmWy7U<$ki$a}yzzI73j5J%3?P4x&Q#Y> z!&!TdoihClVt?9}Ag*#n-;5AQ|8aHIq@NLhyq$WrO2LP0e20nBz-=^sxTf&XV3YdA zOP42r+;Ux<0(`)k$?{T`jH3W9iV zx(?FBXaR!c>jWo-x6n2M>skhxmaRor*ix^O!^MA*Avuv7?de)Td%z7K$-021Y zITgAvP2(%3$b2L1bJa*AJgTtvuO`(OJ7gRHW}8LKHfQH(@-0t2ZFH7T*vkx2kF zzJR{g!+!_awg3*70Rmtqk=5ApI`Dn3-6&jz%cH5dd7x1Z#sSDL*9}aU)plxust17s z+st|kh~ii5SArl8hMUz3lK^D)nKFO%O~}UW%~}AQe~nAG&Ej$N8Pw-~h<4(0`}+Ws@HRV%wVdzMF1|g>DA6jWAwM zhnrN1lGI6F-yeh;chmqytNfc01OQ!rB$SFwMZUA00N(dM{8SIO6_A`CoA>WxO^{fL zl|TTfh{0T{l9l@tW1yfi-q@N)qV-`yt_%UU?+r3-PTxAk^x4Yv`9u&^GP7SEjGy5) zl7Hap)~MFyxxks1;o;tDJ9 zC#2T4WX{cn0td0A$jV}WTu1_3vXpHl79i0euF!3a0Ye@czlbvHQiY{R*@_T4i47Ye zfOg43)->9dLL?e%3xZkbkTsRCVW88^vM|$o$?pBug^0#uD(7*Xm6n09Uot2B-+wJt z+PH%Bk*X}!*;q*C^nB!6(P_ytpOG3QQ@VfRt0oJasZ7#o>EQQ;ril5yW1s0zX6<~x z;KaVr z);PJfG6}#5<^`Z9qQFE=BEL83Gk;whnf(XqjHyP5=LfeA()p%xy^?259n4NlnzJtq*l#h064|`<8qElR zqhza2&&$Ts?C>H#i@g-v{C3V+AE546LxVVklS)n~J;fZrxT@^kdhz@b)bih_k{BCu z)u3S{9rc4p)qtnfUTM@sfpgg-1&=zHJv2AQY%Y5MXPwI)qiCPA%O0-a+^*Y1ui6wk j?RnLPOWijc*KPg&14Beec_c=G3TRL$q69}qD8)w+p^Avw zQNUK(v1+wd0=8Pwj*2g|Eu&yn42*OTi-Ssvl8Qi$C@%>R2(Pe`5H|09_502}-|pF) zeP(xKo#xK$+`F&4_x$$%{m*y4bFK+`wvYr&J$ynF=m8W)Aw7V40L5k^Jqr3CRS^C$ zo+$rX@n1&!r6_-+^T)eOL0te6u5H}|EYW}hgDG2tuP+Qo!0`SefU<=F6qHy{i2~Fa zOd0roYgf5Eo*p5ja{Y6|ruzVu8N)3xpyCb4AB?IL0Yw6_Rmk5hg@bQGzwAtBL28P* zzoxkhh=bd$)wZ=eYa5!(wS_msaexXPP+qA7guuM8jLM2Hs5k=h_@9dv!(arIQrP}d zOWv@e^vM=8Oi41q)!6J_VPtgH<$;Y3C#>I9-LhfS{B)ZDCSWO`Ix8wJh8`zC3LI9A z3dU|Vo!K&Ce6M8lB9jTmMi^HCKj!g3rM<=ZSl0M2KLV@W;}5Ennqr0&DHRCeEq zrgC6#^fNeQ;3q4K1!YxmQ+g z@Ol%4oIfPGq^Ll30gzOVH>~{NOhY(t1yc=OnGp_OZ7@K5fhr{RqK#^5Zgbs|Ij*Wa z1f)a)QhO@|!)9D;H633vd_>{tfwB>&df@@qO>#Sq0z7UQQ^YAA-fpet#q);^$g}*%7*-62_6&stv}GT_(hUHg?+*>e`0i!r11y*fFt*sIDnD4H zGUZDI?(nycl7aL0e+{;wZjl1`g<51PiVzSRvl3e9J5ZaYIoB1gOG+|LG%ANw!XD$o zV}exvZ-C#v866nor~h;_j_7`*D=7&TB@`sXjgL9pTrST>^V9=Vp`g*N`%$M*3+qLZ z0FvrayL4SWb<2uN`{bHG;Lu_qtQy`sT>!sX39xosY;gG7H(Unr)GQrPFi7l2r|O;8 zQGHR&JRtqXHjLd$^)s>Fowj+eU!(DHehK%!Y&$cxlalS(2$ z-`ZW*<;^(sfgWb3Fma45CyEe|;y<=@?aaC#%+AWxUZIduhZDkk5Ej;tVf9vkM^<$Y zpl5Can1sU-3Ne1D<2O2PY;xb7J@v>6$ZK&&<3o`H%0d5WNHal3y4L*i5AIJ((H5%; z;+%)Vi$E>?C&03e-2-SYb`|&HFhsy%FT$1yqn4R=YrFf=jCn_%f@TDigFe&{nGXd6 z)H!=r05!cd@R#YSu*3_9JV^Fjq#lAqfL`e)KzB1B1cI|A0um2w8Bj|bJdioR=K0Qm zyjgWXqmB*`j=dn?Y-)I};HE5V((7vXPCi6n7|?3Wp3CHXU!ryN^sN|TBXuxFK-}Fo z+FiHhEU0}4>YN^7)LsR}3doQk5}@OM?mzzA9P@^NfT)X?CVkhdiAJNJ|JA#6lco?O zqgEBffKE0zC!KfS(SLaX(csmu1QK{$7G6OC0PR}X@4_JiEMJ5IL`u5&!R`U{#gkGw zApq?;?6`Q?qGNmG4@k^dU@s;-s02;AMw>GtJ9YVj>>31=B=Dh&&~lzmfjO2#2RNTX&6wxx3L|X2ck*uP)xdOAw~lTRF{%PD<%!6Q?$0#=dQ3= zOw-hYnCd|U=w0mU7q3Yyphu?x+cu((k|kEaL=mi~we^n`_n$P}x|hlwYGI5MMarf-@Uaz3tM~jZF@RpY6JRu!Vw2f> z0w;=|_r5q=d|lc8<6!TN8FWGtMLB~}T#9AZY7H_|HE6VGj`jJQv?RDR&`^U^M3Bg= z*M1K0_}chFdiZ*P>#?#(o+ElL3CTFraJyieWlG%y$a1)$sm%=qMOc2Vh`9V3YBaAW zi!?!K7_91m>b2_Ehg~@+Kk5BIgH;B^d&-G6RK*7p4J*oS@`0i73N~0hROk9}(QUgn zLsqT?q}Hc-uo}3Fr>l*i+@bi8D0iR_i7-pSX`cqIW8=_wG1s`70$3F1i?@`Jfcr70$PuzV2SaaN9M}wyDieI^d_ysSR2^Hxld>7V$NTp5rOW@>Mi zhmcT37hT?-ynSiGhnmTB31`<_wD*GIdXWS~@VNKeaR|WP3UHuKM^%^)U`+!k8RVOG z=DIV(A;ox)WmxgB!tL=?jk>q?s;{=BbO`m>aQqd#_Y$EJ>`w~gLB=rS-b|k~R8{oO z;{yi$baeVB9*-%D8_tkOH9XV7^=b}D`i%G$Sz8juNF@q+WvmQQN>!lHa~gB;+?cQa z<7r&|S@XD=zdKSBR6SztQ0V-JfkgmF2{Rscu!^v{$UPb~r)US(4Eo7{yyQ2Hv#Jb= z{w5AP4ntnppw6w)MR^x0usS3hHIxEO9J*_4uA7UdRlg4z7*^bKb@CqX@FJvoBIw1K zV}Qv+TDZ^$Rn&@MhKVDz_cuZF8SU`eqM7}2lb*$fr*plCr=C?PYLTBm$2w;~wCB1G zDTE91;#dMxrk-0)oPh-e*X~;d8QE?~IqDIKVH$?lDeT$ zGVHI=uv;56$mwJHbb0p3(S_z!sEWSyWrm@eI1f<-92sJ&4{*a75>MxFF`gmGkUX*V zfOE#UI}TJq15P-lp)p@1jX8MF6;?e_C`j=lbpXqG5r~rp3+NSK0(i zf(o>N%IWg#x7nS~j(xE1?W22}9biEyf#7uC0xDHScq~Fq>D8#9&yWtHk{sA9>lqEw zEI4-4Ow}*+yS{I4^StC_(`B(N!RzSoe15XtxvcP>WA8!}B5%cR+>V}O!Q;V-a;PvL zaLG&L>WNlC^3OFc|CNh4Y0jP@i6oMY+k$hNcaEyw_!fm2;dD_!%qqx2az98%5mE}m#I>DXP^Wc8^~Uqio>|nGL)3u%nIqsTm)% zwbkMNyf7DvYlKtt^~Pmj7?ID=CcI`S9`69}dT72+V~wMv<(cxs7Ag{{=!gbPhfT+m`=AtiQiXX#0Do`fMhEI+%rb+7;dNo zJBA*z@+wPwdniJy_E&Re5jJ$Uer{F@G65@xlHrCrzmO75>#}Opzbn=dGye4kHA!z$ zLD8{tOQrxOdHJ1;V9>@u==l46OQza9!|j>$7Kfe}79GU%rr!9eCXosXttfuC=eBSo zCuJPh>8-B55W4|K^2_n|ph$jG#6t8vZ}$KR5CW05>HqU{-<5*CH?(^Ih54&`0QCTh gEt-226o%h_0VFf#!Nj1iwEzGB07*qoM6N<$f>{2l>;M1& literal 0 HcmV?d00001 diff --git a/react-ui/src/pages/CodeConfig/List/index.less b/react-ui/src/pages/CodeConfig/List/index.less index 4108b486..d4cb1b4a 100644 --- a/react-ui/src/pages/CodeConfig/List/index.less +++ b/react-ui/src/pages/CodeConfig/List/index.less @@ -1,47 +1,46 @@ -.code-config-list { - display: flex; - flex: 1; - flex-direction: column; +.code-config { height: 100%; - height: 100%; - padding: 20px 0; - background: white; - box-shadow: 0px 3px 6px rgba(146, 146, 146, 0.09); - &__header { + &__list { display: flex; - align-items: center; - justify-content: space-between; - height: 32px; - margin-bottom: 30px; - padding: 0 30px; - color: @text-color; - font-size: 15px; - } + flex-direction: column; + height: calc(100% - 60px); + margin-top: 10px; + padding: 30px 30px 0; + background: white; + border-radius: 10px; + box-shadow: 0px 2px 12px rgba(180, 182, 191, 0.09); - &__content { - display: flex; - flex: 1; - flex-wrap: wrap; - gap: 20px; - align-content: flex-start; - width: 100%; - margin-bottom: 30px; - padding: 0 30px; - overflow-y: auto; - } + &__header { + display: flex; + align-items: center; + height: 32px; + color: @text-color; + font-size: 15px; + } - &__empty { - display: flex; - flex: 1; - align-items: center; - justify-content: center; - } + &__content { + display: flex; + flex: 1 1 0%; + flex-wrap: wrap; + gap: 20px; + align-content: flex-start; + width: 100%; + margin: 25px 0; + overflow-y: auto; + } + + &__empty { + display: flex; + flex: 1; + align-items: center; + justify-content: center; + } - :global { - .ant-pagination { - margin-right: 30px; - text-align: right; + :global { + .ant-pagination { + margin-bottom: 25px; + } } } } diff --git a/react-ui/src/pages/CodeConfig/List/index.tsx b/react-ui/src/pages/CodeConfig/List/index.tsx index 847d30ec..e8a2557f 100644 --- a/react-ui/src/pages/CodeConfig/List/index.tsx +++ b/react-ui/src/pages/CodeConfig/List/index.tsx @@ -1,5 +1,12 @@ +/* + * @Author: 赵伟 + * @Date: 2024-10-10 09:55:12 + * @Description: 代码配置 + */ + import KFEmpty, { EmptyType } from '@/components/KFEmpty'; import KFIcon from '@/components/KFIcon'; +import PageTitle from '@/components/PageTitle'; import { deleteCodeConfigReq, getCodeConfigListReq } from '@/services/codeConfig'; import { getGitUrl } from '@/utils'; import { openAntdModal } from '@/utils/modal'; @@ -127,64 +134,69 @@ function CodeConfigList() { }; return ( -
-
- 数据总数:{total} 个 -
+
+ +
+
+ 数据总数:{total} 个 setInputText(e.target.value)} value={inputText} />
-
- {dataList && dataList.length !== 0 && ( - <> -
- {dataList.map((item) => ( - - ))} -
- +
+ {dataList.map((item) => ( + + ))} +
+ + + )} + {dataList && dataList.length === 0 && ( + - - )} - {dataList && dataList.length === 0 && ( - - )} + )} +
); } diff --git a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less index c5d4abaa..c2855954 100644 --- a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less +++ b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less @@ -2,50 +2,96 @@ position: relative; width: calc(25% - 15px); padding: 20px; - background: white; - border: 1px solid #eaeaea; + background: linear-gradient(180deg, #f7faff 0%, #ffffff 100%); + border: 2px solid white; border-radius: 4px; + box-shadow: 0px 3px 10px rgba(164, 169, 181, 0.13); cursor: pointer; + &:hover { + border-color: @primary-color; + } + @media screen and (max-width: 1860px) { & { width: calc(33.33% - 13.33px); } } - &__name { + &__icon { + flex: none; + width: 16px; + height: 16px; margin-right: 10px; + } + + &__name { + position: relative; + margin-right: 20px; margin-bottom: 0 !important; color: @text-color; + font-weight: 500; font-size: 16px; + + &::after { + position: absolute; + top: 14px; + left: 0; + width: 100%; + height: 6px; + background: linear-gradient( + to right, + .addAlpha(@primary-color, 0.4) [] 0, + .addAlpha(@primary-color, 0) [] 100% + ); + content: ''; + } + } + + &:hover &__name { + color: @primary-color; } &__tag { - padding: 2px 11px; - font-size: 12px; - border-radius: 1000px; + flex: none; + padding: 1px 10px; + font-size: 13px; + border-radius: 2px; &--public { color: @primary-color; - background-color: .addAlpha(@primary-color, 0.08) []; + background-color: .addAlpha(@primary-color, 0.1) []; border-color: .addAlpha(@primary-color, 0.5) []; } &--private { color: @warning-color; - background-color: .addAlpha(@warning-color, 0.08) []; + background-color: .addAlpha(@warning-color, 0.1) []; border-color: .addAlpha(@warning-color, 0.5) []; } } + :global { + .ant-btn { + flex: none; + color: #808080; + } + } + + &__url-box { + margin-bottom: 15px; + padding: 14px; + background-color: .addAlpha(@primary-color, 0.03) []; + border-radius: 4px; + } + &__url { - margin-bottom: 10px !important; + margin-bottom: 15px !important; color: @text-color-secondary; font-size: 14px; } &__branch { - margin-bottom: 20px; color: @text-color-tertiary; font-size: 14px; } @@ -59,13 +105,4 @@ color: #808080; font-size: 13px; } - - &:hover { - border-color: @primary-color; - box-shadow: 0px 0px 6px 1px rgba(0, 0, 0, 0.1); - } - - &:hover &__name { - color: @primary-color; - } } diff --git a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.tsx b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.tsx index fe062bac..de903f47 100644 --- a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.tsx +++ b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.tsx @@ -19,6 +19,11 @@ function CodeConfigItem({ item, onClick, onEdit, onRemove }: CodeConfigItemProps return (
onClick?.(item)}> + - - {item.git_url} - -
{item.git_branch}
+
+ + {item.git_url} + +
{item.git_branch}
+
{ + const handleTableChange: TableProps['onChange'] = ( + pagination, + _filters, + _sorter, + { action }, + ) => { if (action === 'paginate') { setPagination(pagination); } diff --git a/react-ui/src/pages/Experiment/components/ExperimentInstance/index.less b/react-ui/src/pages/Experiment/components/ExperimentInstance/index.less index 56aa07e2..31df6572 100644 --- a/react-ui/src/pages/Experiment/components/ExperimentInstance/index.less +++ b/react-ui/src/pages/Experiment/components/ExperimentInstance/index.less @@ -4,7 +4,7 @@ width: 100%; padding: 0 0 0 33px; color: @text-color; - font-size: 15px; + font-size: 14px; & > div { padding: 0 16px; diff --git a/react-ui/src/pages/Experiment/components/ExperimentInstance/index.tsx b/react-ui/src/pages/Experiment/components/ExperimentInstance/index.tsx index 04508fb7..754034aa 100644 --- a/react-ui/src/pages/Experiment/components/ExperimentInstance/index.tsx +++ b/react-ui/src/pages/Experiment/components/ExperimentInstance/index.tsx @@ -129,7 +129,8 @@ function ExperimentInstanceComponent({ {selectedIns.length > 0 && (
); })} @@ -180,7 +182,9 @@ function VersionCompareModal({ version1, version2, ...rest }: CreateMirrorModalP [styles['version-compare__right__text--different']]: isDifferent(key), })} > - {text} + + {text} +
); })} diff --git a/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.less b/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.less index 3dd58383..cb77da6d 100644 --- a/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.less +++ b/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.less @@ -20,10 +20,6 @@ } } - .ant-pagination { - text-align: center; - } - .ant-input-group-addon { display: none; } diff --git a/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.tsx b/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.tsx index 6a42535c..24a54293 100644 --- a/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.tsx +++ b/react-ui/src/pages/Pipeline/components/CodeSelectorModal/index.tsx @@ -97,6 +97,7 @@ function CodeSelectorModal({ onOk, ...rest }: CodeSelectorModalProps) { ))}
Date: Wed, 23 Oct 2024 14:49:28 +0800 Subject: [PATCH 81/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/service/impl/AimServiceImpl.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index a2e912e4..9eba931a 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -296,13 +296,15 @@ public class AimServiceImpl implements AimService { private List getDataset(String isTrain, Map metricRecord) { List datasetList = new ArrayList<>(); List> trainMetricRecords = (List>) metricRecord.get(isTrain); - for (Map trainMetricRecord : trainMetricRecords) { - String taskId = (String) trainMetricRecord.get("task_id"); - if (taskId.startsWith("model-" + isTrain)) { - List> datasets = (List>) trainMetricRecord.get("datasets"); - for (Map dataset : datasets) { - String datasetName = dataset.get("dataset_name") + ":" + dataset.get("dataset_version"); - datasetList.add(datasetName); + if (trainMetricRecords != null) { + for (Map trainMetricRecord : trainMetricRecords) { + String taskId = (String) trainMetricRecord.get("task_id"); + if (taskId.startsWith("model-" + isTrain)) { + List> datasets = (List>) trainMetricRecord.get("datasets"); + for (Map dataset : datasets) { + String datasetName = dataset.get("dataset_name") + ":" + dataset.get("dataset_version"); + datasetList.add(datasetName); + } } } } @@ -315,7 +317,7 @@ public class AimServiceImpl implements AimService { HashMap metrics = new HashMap<>(); List metricsNames = new ArrayList<>(); - if(metricValues != null){ + if (metricValues != null) { for (String key : metricValues.keySet()) { Map valueMap = (Map) metricValues.get(key); aimRunInfo.setRunId((String) valueMap.get("run_hash")); From 9987c3b9fd7edb1addcce53bb13585907c980db3 Mon Sep 17 00:00:00 2001 From: cp3hnu <709011834@qq.com> Date: Wed, 23 Oct 2024 14:51:33 +0800 Subject: [PATCH 82/91] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/proxy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-ui/config/proxy.ts b/react-ui/config/proxy.ts index 35232b47..93f990c1 100644 --- a/react-ui/config/proxy.ts +++ b/react-ui/config/proxy.ts @@ -20,7 +20,7 @@ export default { // localhost:8000/api/** -> https://preview.pro.ant.design/api/** '/api/': { // 要代理的地址 - target: 'http://172.20.32.185:31213', // 开发环境 + target: 'http://172.20.32.181:31213', // 开发环境 // target: 'http://172.20.32.98:8082', // target: 'http://172.20.32.150:8082', // 配置了这个可以从 http 代理到 https From e60f111587ed983e2ef9db1b9f2a15ddd6026ced Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Wed, 23 Oct 2024 15:31:09 +0800 Subject: [PATCH 83/91] =?UTF-8?q?style:=20=E4=BF=AE=E6=94=B9=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E9=85=8D=E7=BD=AE=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../CodeConfig/components/CodeConfigItem/index.less | 10 +++++----- .../pages/Dataset/components/ResourceItem/index.less | 1 + 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less index c2855954..41415a9a 100644 --- a/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less +++ b/react-ui/src/pages/CodeConfig/components/CodeConfigItem/index.less @@ -61,13 +61,13 @@ &--public { color: @primary-color; background-color: .addAlpha(@primary-color, 0.1) []; - border-color: .addAlpha(@primary-color, 0.5) []; + border: 1px solid .addAlpha(@primary-color, 0.5) []; } &--private { color: @warning-color; background-color: .addAlpha(@warning-color, 0.1) []; - border-color: .addAlpha(@warning-color, 0.5) []; + border: 1px solid .addAlpha(@warning-color, 0.5) []; } } @@ -81,18 +81,18 @@ &__url-box { margin-bottom: 15px; padding: 14px; - background-color: .addAlpha(@primary-color, 0.03) []; + background-color: .addAlpha(@primary-color, 0.04) []; border-radius: 4px; } &__url { margin-bottom: 15px !important; - color: @text-color-secondary; + color: @text-color; font-size: 14px; } &__branch { - color: @text-color-tertiary; + color: @text-color-secondary; font-size: 14px; } diff --git a/react-ui/src/pages/Dataset/components/ResourceItem/index.less b/react-ui/src/pages/Dataset/components/ResourceItem/index.less index cdb69428..01be647c 100644 --- a/react-ui/src/pages/Dataset/components/ResourceItem/index.less +++ b/react-ui/src/pages/Dataset/components/ResourceItem/index.less @@ -24,6 +24,7 @@ height: 24px; margin: 0 10px 0 0 !important; color: @text-color; + font-weight: 500; font-size: 16px; &::after { From 7cd2b6d16654d5511250d99375ca9c1b61c6abd0 Mon Sep 17 00:00:00 2001 From: cp3hnu <709011834@qq.com> Date: Wed, 23 Oct 2024 15:51:29 +0800 Subject: [PATCH 84/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/platform/mapper/ExperimentInsDao.java | 3 ++- .../platform/service/impl/AimServiceImpl.java | 14 ++++++++++++-- .../managementPlatform/ExperimentInsDaoMapper.xml | 13 +++++++++++++ 3 files changed, 27 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java index 58642324..c9ef05bf 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java @@ -39,6 +39,8 @@ public interface ExperimentInsDao { */ long count(@Param("experimentIns") ExperimentIns experimentIns); + long countTorE(@Param("experimentId") Integer experimentId, @Param("isTrain") Boolean isTrain); + /* 统计实验实例总数 @@ -100,7 +102,6 @@ public interface ExperimentInsDao { List getLatestInsList(); - List queryByExperiment(@Param("experimentIns") ExperimentIns experimentIns); List queryByExperimentId(Integer id); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index 9eba931a..b63fe369 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -157,10 +157,20 @@ public class AimServiceImpl implements AimService { PageRequest pageRequest = PageRequest.of(page, size); ExperimentIns query = new ExperimentIns(); query.setExperimentId(experimentId); - long count = experimentInsDao.count(query); + long count = experimentInsDao.countTorE(experimentId, isTrain); List experimentInsList = experimentInsDao.queryAllByLimit(query, pageRequest); + + List collect = experimentInsList.stream().filter(ins -> { + Map metricRecord = JacksonUtil.parseJSONStr2Map(ins.getMetricRecord()); + if (isTrain) { + return metricRecord.get("train") != null; + } else { + return metricRecord.get("evaluate") != null; + } + }).collect(Collectors.toList()); + List aimRunInfoList = new ArrayList<>(); - for (ExperimentIns experimentIns : experimentInsList) { + for (ExperimentIns experimentIns : collect) { InsMetricInfoVo aimRunInfo = new InsMetricInfoVo(); aimRunInfo.setExperimentInsId(experimentIns.getId()); aimRunInfo.setStartTime(experimentIns.getCreateTime()); diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml index ef87ed63..87d06752 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml @@ -250,6 +250,19 @@ where experiment_id = #{id} and state = 1 + + insert into experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,global_param,metric_record,metric_value,start_time,finish_time,create_by,create_time,update_by,update_time,state) From 1188e964e340a26dad07844323decaf731dc0ebc Mon Sep 17 00:00:00 2001 From: cp3hnu <709011834@qq.com> Date: Wed, 23 Oct 2024 15:58:32 +0800 Subject: [PATCH 85/91] =?UTF-8?q?=E5=89=8D=E7=AB=AF=E8=AE=BF=E9=97=AE?= =?UTF-8?q?=E5=90=8E=E5=8F=B0=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- react-ui/config/proxy.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/react-ui/config/proxy.ts b/react-ui/config/proxy.ts index 93f990c1..35232b47 100644 --- a/react-ui/config/proxy.ts +++ b/react-ui/config/proxy.ts @@ -20,7 +20,7 @@ export default { // localhost:8000/api/** -> https://preview.pro.ant.design/api/** '/api/': { // 要代理的地址 - target: 'http://172.20.32.181:31213', // 开发环境 + target: 'http://172.20.32.185:31213', // 开发环境 // target: 'http://172.20.32.98:8082', // target: 'http://172.20.32.150:8082', // 配置了这个可以从 http 代理到 https From 49a338e999edb69b677d9d565336af5d442f0e09 Mon Sep 17 00:00:00 2001 From: cp3hnu <709011834@qq.com> Date: Wed, 23 Oct 2024 16:34:38 +0800 Subject: [PATCH 86/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/scheduling/ExperimentInstanceStatusTask.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index 59d8bf47..df339f73 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -47,7 +47,7 @@ public class ExperimentInstanceStatusTask { experimentIns.setStatus("Failed"); } //运行成功的实验实例记录指标数值 - if (Constant.Succeeded.equals(experimentIns.getStatus())) { +// if (Constant.Succeeded.equals(experimentIns.getStatus())) { Map metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); List> trainMetricRecords = (List>) metricRecord.get("train"); List> evaluateMetricRecords = (List>) metricRecord.get("evaluate"); @@ -92,7 +92,7 @@ public class ExperimentInstanceStatusTask { metricValue.put("train", trainMetricValues); metricValue.put("evaluate", evaluateMetricValues); experimentIns.setMetricValue(JsonUtils.mapToJson(metricValue)); - } +// } experimentIns.setUpdateTime(new Date()); // 线程安全的添加操作 synchronized (experimentIds) { From c0b74fafd2b742965504b88956daf26d45924bba Mon Sep 17 00:00:00 2001 From: cp3hnu <709011834@qq.com> Date: Wed, 23 Oct 2024 16:57:01 +0800 Subject: [PATCH 87/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../platform/mapper/ExperimentInsDao.java | 2 + .../ExperimentInstanceStatusTask.java | 75 ++++++++++--------- .../platform/service/impl/AimServiceImpl.java | 15 +--- .../ExperimentInsDaoMapper.xml | 16 ++++ 4 files changed, 59 insertions(+), 49 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java index c9ef05bf..478d0f28 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/ExperimentInsDao.java @@ -41,6 +41,8 @@ public interface ExperimentInsDao { long countTorE(@Param("experimentId") Integer experimentId, @Param("isTrain") Boolean isTrain); + List queryTorE(@Param("experimentId") Integer experimentId, @Param("isTrain") Boolean isTrain, @Param("pageable") Pageable pageable); + /* 统计实验实例总数 diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index df339f73..fb72bc65 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -1,6 +1,5 @@ package com.ruoyi.platform.scheduling; -import com.ruoyi.platform.constant.Constant; import com.ruoyi.platform.domain.Experiment; import com.ruoyi.platform.domain.ExperimentIns; import com.ruoyi.platform.mapper.ExperimentDao; @@ -48,50 +47,54 @@ public class ExperimentInstanceStatusTask { } //运行成功的实验实例记录指标数值 // if (Constant.Succeeded.equals(experimentIns.getStatus())) { - Map metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); - List> trainMetricRecords = (List>) metricRecord.get("train"); - List> evaluateMetricRecords = (List>) metricRecord.get("evaluate"); + Map metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); + List> trainMetricRecords = (List>) metricRecord.get("train"); + List> evaluateMetricRecords = (List>) metricRecord.get("evaluate"); - HashMap metricValue = new HashMap<>(); - HashMap trainMetricValues = new HashMap<>(); - HashMap evaluateMetricValues = new HashMap<>(); + HashMap metricValue = new HashMap<>(); + HashMap trainMetricValues = new HashMap<>(); + HashMap evaluateMetricValues = new HashMap<>(); - if (trainMetricRecords != null && !trainMetricRecords.isEmpty()) { - for (Map trainMetricRecord : trainMetricRecords) { - HashMap trainMetricValue = new HashMap<>(); - String taskId = (String) trainMetricRecord.get("task_id"); - if (taskId.startsWith("model-train")) { - String runId = (String) trainMetricRecord.get("run_id"); - List expTrainInfos = aimService.getExpInfos1(true, experimentIns.getExperimentId(), runId); - for (InsMetricInfoVo expTrainInfo : expTrainInfos) { - Map metrics = expTrainInfo.getMetrics(); - trainMetricValue.putAll(metrics); - trainMetricValue.put("run_hash", expTrainInfo.getRunId()); - } + if (trainMetricRecords != null && !trainMetricRecords.isEmpty()) { + for (Map trainMetricRecord : trainMetricRecords) { + HashMap trainMetricValue = new HashMap<>(); + String taskId = (String) trainMetricRecord.get("task_id"); + if (taskId.startsWith("model-train")) { + String runId = (String) trainMetricRecord.get("run_id"); + List expTrainInfos = aimService.getExpInfos1(true, experimentIns.getExperimentId(), runId); + for (InsMetricInfoVo expTrainInfo : expTrainInfos) { + Map metrics = expTrainInfo.getMetrics(); + trainMetricValue.putAll(metrics); + trainMetricValue.put("run_hash", expTrainInfo.getRunId()); + } + if (trainMetricValue.size() > 0) { + trainMetricValues.put(taskId, trainMetricValue); } - trainMetricValues.put(taskId, trainMetricValue); } } + } - if (evaluateMetricRecords != null && !evaluateMetricRecords.isEmpty()) { - for (Map evaluateMetricRecord : evaluateMetricRecords) { - HashMap evaluateMetricValue = new HashMap<>(); - String taskId = (String) evaluateMetricRecord.get("task_id"); - if (taskId.startsWith("model-evaluate")) { - String runId = (String) evaluateMetricRecord.get("run_id"); - List expTrainInfos = aimService.getExpInfos1(false, experimentIns.getExperimentId(), runId); - for (InsMetricInfoVo expTrainInfo : expTrainInfos) { - Map metrics = expTrainInfo.getMetrics(); - evaluateMetricValue.putAll(metrics); - evaluateMetricValue.put("run_hash", expTrainInfo.getRunId()); - } + if (evaluateMetricRecords != null && !evaluateMetricRecords.isEmpty()) { + for (Map evaluateMetricRecord : evaluateMetricRecords) { + HashMap evaluateMetricValue = new HashMap<>(); + String taskId = (String) evaluateMetricRecord.get("task_id"); + if (taskId.startsWith("model-evaluate")) { + String runId = (String) evaluateMetricRecord.get("run_id"); + List expTrainInfos = aimService.getExpInfos1(false, experimentIns.getExperimentId(), runId); + for (InsMetricInfoVo expTrainInfo : expTrainInfos) { + Map metrics = expTrainInfo.getMetrics(); + evaluateMetricValue.putAll(metrics); + evaluateMetricValue.put("run_hash", expTrainInfo.getRunId()); + } + if (evaluateMetricValue.size() > 0) { + evaluateMetricValues.put(taskId, evaluateMetricValue); } - evaluateMetricValues.put(taskId, evaluateMetricValue); } } - metricValue.put("train", trainMetricValues); - metricValue.put("evaluate", evaluateMetricValues); - experimentIns.setMetricValue(JsonUtils.mapToJson(metricValue)); + } + metricValue.put("train", trainMetricValues); + metricValue.put("evaluate", evaluateMetricValues); + experimentIns.setMetricValue(JsonUtils.mapToJson(metricValue)); // } experimentIns.setUpdateTime(new Date()); // 线程安全的添加操作 diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java index b63fe369..70915655 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/AimServiceImpl.java @@ -155,22 +155,11 @@ public class AimServiceImpl implements AimService { public Page getExpInfos(boolean isTrain, Integer experimentId, int page, int size) { PageRequest pageRequest = PageRequest.of(page, size); - ExperimentIns query = new ExperimentIns(); - query.setExperimentId(experimentId); long count = experimentInsDao.countTorE(experimentId, isTrain); - List experimentInsList = experimentInsDao.queryAllByLimit(query, pageRequest); - - List collect = experimentInsList.stream().filter(ins -> { - Map metricRecord = JacksonUtil.parseJSONStr2Map(ins.getMetricRecord()); - if (isTrain) { - return metricRecord.get("train") != null; - } else { - return metricRecord.get("evaluate") != null; - } - }).collect(Collectors.toList()); + List experimentInsList = experimentInsDao.queryTorE(experimentId, isTrain, pageRequest); List aimRunInfoList = new ArrayList<>(); - for (ExperimentIns experimentIns : collect) { + for (ExperimentIns experimentIns : experimentInsList) { InsMetricInfoVo aimRunInfo = new InsMetricInfoVo(); aimRunInfo.setExperimentInsId(experimentIns.getId()); aimRunInfo.setStartTime(experimentIns.getCreateTime()); diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml index 87d06752..9930093d 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml @@ -263,6 +263,22 @@ + + insert into experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,global_param,metric_record,metric_value,start_time,finish_time,create_by,create_time,update_by,update_time,state) From b3596a73424b79baece37781b062e628fdaae0d0 Mon Sep 17 00:00:00 2001 From: cp3hnu <709011834@qq.com> Date: Wed, 23 Oct 2024 17:11:48 +0800 Subject: [PATCH 88/91] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=AE=9E=E9=AA=8C?= =?UTF-8?q?=E5=AF=B9=E6=AF=94=E5=88=86=E9=A1=B5=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scheduling/ExperimentInstanceStatusTask.java | 14 ++++++++++---- .../managementPlatform/ExperimentInsDaoMapper.xml | 8 ++++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java index fb72bc65..55ed5a45 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/scheduling/ExperimentInstanceStatusTask.java @@ -46,7 +46,6 @@ public class ExperimentInstanceStatusTask { experimentIns.setStatus("Failed"); } //运行成功的实验实例记录指标数值 -// if (Constant.Succeeded.equals(experimentIns.getStatus())) { Map metricRecord = JacksonUtil.parseJSONStr2Map(experimentIns.getMetricRecord()); List> trainMetricRecords = (List>) metricRecord.get("train"); List> evaluateMetricRecords = (List>) metricRecord.get("evaluate"); @@ -92,10 +91,17 @@ public class ExperimentInstanceStatusTask { } } } - metricValue.put("train", trainMetricValues); - metricValue.put("evaluate", evaluateMetricValues); + if (trainMetricValues.size() > 0) { + metricValue.put("train", trainMetricValues); + } else { + metricValue.put("train", null); + } + if (evaluateMetricValues.size() > 0) { + metricValue.put("evaluate", evaluateMetricValues); + } else { + metricValue.put("evaluate", null); + } experimentIns.setMetricValue(JsonUtils.mapToJson(metricValue)); -// } experimentIns.setUpdateTime(new Date()); // 线程安全的添加操作 synchronized (experimentIds) { diff --git a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml index 9930093d..e46da649 100644 --- a/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml +++ b/ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml @@ -256,10 +256,10 @@ where state = 1 and experiment_id = #{experimentId} - and not JSON_CONTAINS(metric_record, 'null', '$.train') + and not JSON_CONTAINS(metric_value, 'null', '$.train') - and not JSON_CONTAINS(metric_record, 'null', '$.evaluate') + and not JSON_CONTAINS(metric_value, 'null', '$.evaluate') @@ -272,10 +272,10 @@ where state = 1 and experiment_id = #{experimentId} - and not JSON_CONTAINS(metric_record, 'null', '$.train') + and not JSON_CONTAINS(metric_value, 'null', '$.train') - and not JSON_CONTAINS(metric_record, 'null', '$.evaluate') + and not JSON_CONTAINS(metric_value, 'null', '$.evaluate') From d65c126f754864e705379f64340a5acd183c3499 Mon Sep 17 00:00:00 2001 From: cp3hnu Date: Thu, 24 Oct 2024 08:41:44 +0800 Subject: [PATCH 89/91] =?UTF-8?q?feat:=20=E5=AE=9E=E9=AA=8C=E5=AF=B9?= =?UTF-8?q?=E6=AF=94=E5=88=86=E9=A1=B5=E5=AE=9E=E7=8E=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pages/Experiment/Comparison/index.less | 2 +- .../src/pages/Experiment/Comparison/index.tsx | 102 ++++++++---------- 2 files changed, 46 insertions(+), 58 deletions(-) diff --git a/react-ui/src/pages/Experiment/Comparison/index.less b/react-ui/src/pages/Experiment/Comparison/index.less index 273791c4..3be69ed9 100644 --- a/react-ui/src/pages/Experiment/Comparison/index.less +++ b/react-ui/src/pages/Experiment/Comparison/index.less @@ -14,7 +14,7 @@ &__table { height: calc(100% - 60px); - padding: 20px 30px; + padding: 20px 30px 0; background-color: white; border-radius: 10px; diff --git a/react-ui/src/pages/Experiment/Comparison/index.tsx b/react-ui/src/pages/Experiment/Comparison/index.tsx index 1edfd0a3..b900842c 100644 --- a/react-ui/src/pages/Experiment/Comparison/index.tsx +++ b/react-ui/src/pages/Experiment/Comparison/index.tsx @@ -4,7 +4,6 @@ * @Description: 实验对比 */ -import { useDomSize } from '@/hooks'; import { getExpEvaluateInfosReq, getExpMetricsReq, @@ -14,7 +13,8 @@ import { tableSorter } from '@/utils'; import { to } from '@/utils/promise'; import tableCellRender, { TableCellValueType } from '@/utils/table'; import { useSearchParams } from '@umijs/max'; -import { App, Button, Table, /* TablePaginationConfig,*/ TableProps, Tooltip } from 'antd'; +import { App, Button, Table, TablePaginationConfig, TableProps, Tooltip } from 'antd'; +import classNames from 'classnames'; import { useEffect, useMemo, useState } from 'react'; import ExperimentStatusCell from '../components/ExperimentStatusCell'; import { ComparisonType, comparisonConfig } from './config'; @@ -26,63 +26,45 @@ type TableData = { dataset: string[]; start_time: string; status: string; - metrics_names: string[]; - metrics: Record; - params_names: string[]; - params: Record; + metrics_names?: string[]; + metrics?: Record; + params_names?: string[]; + params?: Record; }; -const pageSize = 30; - -// function Footer() { -// return ( -//
-//
-//

我是有底线的

-//
-//
-// ); -// } - function ExperimentComparison() { const [searchParams] = useSearchParams(); const comparisonType = searchParams.get('type') as ComparisonType; const experimentId = searchParams.get('id'); const [tableData, setTableData] = useState([]); const [selectedRowKeys, setSelectedRowKeys] = useState([]); + const [total, setTotal] = useState(0); + const [pagination, setPagination] = useState({ + current: 1, + pageSize: 10, + }); + const { message } = App.useApp(); const config = useMemo(() => comparisonConfig[comparisonType], [comparisonType]); - const [tableRef, { width: tableWidth, height: tableHeight }] = useDomSize( - 0, - 0, - [], - ); - const [loadCompleted, setLoadCompleted] = useState(false); - const [loading, setLoading] = useState(false); // 避免误触发加载更多 useEffect(() => { getComparisonData(); }, [experimentId]); // 获取对比数据列表 - const getComparisonData = async (offset: string = '') => { + const getComparisonData = async () => { const request = comparisonType === ComparisonType.Train ? getExpTrainInfosReq : getExpEvaluateInfosReq; - const [res] = await to(request(experimentId, { offset: offset, limit: pageSize })); + const params = { + page: pagination.current! - 1, + size: pagination.pageSize, + }; + const [res] = await to(request(experimentId, params)); if (res && res.data) { - setTableData((prev) => [...prev, ...res.data]); - if (res.data.length === 0) { - setLoadCompleted(true); - const ele = document.getElementsByClassName('ant-table-body')[0]; - if (ele) { - const div = document.createElement('div'); - div.className = styles['experiment-comparison__table__footer']; - div.innerHTML = '

我是有底线的

'; - ele.appendChild(div); - } - } + const { content = [], totalElements = 0 } = res.data; + setTableData(content); + setTotal(totalElements); } - setLoading(false); }; // 获取对比 url @@ -114,21 +96,22 @@ function ExperimentComparison() { }, }; - const handleTableScroll = (e: React.UIEvent) => { - const target = e.target as HTMLDivElement; - - const { scrollTop, scrollHeight, clientHeight } = target; - - // 实现自动加载更多 - if (!loadCompleted && !loading && scrollHeight - scrollTop - clientHeight <= 0) { - const last = tableData[tableData.length - 1]; - setLoading(true); - getComparisonData(last?.run_id); + // 分页切换 + const handleTableChange: TableProps['onChange'] = ( + pagination, + _filters, + _sorter, + { action }, + ) => { + if (action === 'paginate') { + setPagination(pagination); } }; const columns: TableProps['columns'] = useMemo(() => { - const first: TableData | undefined = tableData[0]; + const first: TableData | undefined = tableData.find( + (item) => item.metrics_names && item.metrics_names.length > 0, + ); const metricsNames = first?.metrics_names ?? []; const paramsNames = first?.params_names ?? []; return [ @@ -190,7 +173,7 @@ function ExperimentComparison() { align: 'center', render: tableCellRender(true), ellipsis: { showTitle: false }, - sorter: (a, b) => tableSorter(a.params[name], b.params[name]), + sorter: (a, b) => tableSorter(a.params?.[name], b.params?.[name]), showSorterTooltip: false, })), }, @@ -209,7 +192,7 @@ function ExperimentComparison() { align: 'center', render: tableCellRender(true), ellipsis: { showTitle: false }, - sorter: (a, b) => tableSorter(a.metrics[name], b.metrics[name]), + sorter: (a, b) => tableSorter(a.metrics?.[name], b.metrics?.[name]), showSorterTooltip: false, })), }, @@ -223,16 +206,21 @@ function ExperimentComparison() { 可视化对比
-
+
record.run_id || record.experiment_ins_id} /> From bb8daeac880109b61407707c424c5d6baa7aa77c Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Thu, 24 Oct 2024 14:04:49 +0800 Subject: [PATCH 90/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- k8s/build.sh | 19 ------------------- k8s/build_and_deploy.sh | 28 +++++++++++++++++++++++----- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/k8s/build.sh b/k8s/build.sh index a84e56f1..e8f19b3c 100755 --- a/k8s/build.sh +++ b/k8s/build.sh @@ -41,25 +41,6 @@ fi baseDir="/home/somuns/ci4s" cd ${baseDir} -# 拉取指定分支的最新代码 -echo "Checking out and pulling branch $branch..." - -git stash -git checkout $branch -if [ $? -ne 0 ]; then - echo "切换到分支 $branch 失败,请检查分支名称是否正确!" - exit 1 -fi - -git stash -git pull origin $branch -if [ $? -ne 0 ]; then - echo "拉取代码失败,请检查网络或联系管理员!" - exit 1 -fi - -chmod +777 ${baseDir}/k8s/*.sh - # 创建目录 mkdir -p ${baseDir}/k8s/dockerfiles/jar mkdir -p ${baseDir}/k8s/dockerfiles/html diff --git a/k8s/build_and_deploy.sh b/k8s/build_and_deploy.sh index eacc9c6b..8a9aee0d 100755 --- a/k8s/build_and_deploy.sh +++ b/k8s/build_and_deploy.sh @@ -3,11 +3,6 @@ #记录开始时间 startTime=$(date +%s) -# 登录到目标环境 -baseDir="/home/somuns/ci4s" -cd ${baseDir} - - #build # 默认参数 branch="master" @@ -50,6 +45,29 @@ if [[ ! " ${valid_envs[@]} " =~ " $env " ]]; then exit 1 fi +# 拉取指定分支的最新代码 +echo "Checking out and pulling branch $branch..." + +git stash +git checkout $branch +if [ $? -ne 0 ]; then + echo "切换到分支 $branch 失败,请检查分支名称是否正确!" + exit 1 +fi + +git stash +git pull origin $branch +if [ $? -ne 0 ]; then + echo "拉取代码失败,请检查网络或联系管理员!" + exit 1 +fi + +chmod +777 ${baseDir}/k8s/*.sh + +# 登录到目标环境 +baseDir="/home/somuns/ci4s" +cd ${baseDir} + echo "start build" sh ${baseDir}/k8s/build.sh -b ${branch} -s ${service} if [ $? -ne 0 ]; then From e355ae69dfc5b45121c2137d17194ecb996a91d9 Mon Sep 17 00:00:00 2001 From: chenzhihang <709011834@qq.com> Date: Tue, 29 Oct 2024 13:57:53 +0800 Subject: [PATCH 91/91] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=83=A8=E7=BD=B2?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- k8s/build_and_deploy.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/k8s/build_and_deploy.sh b/k8s/build_and_deploy.sh index 8a9aee0d..ef582cf3 100755 --- a/k8s/build_and_deploy.sh +++ b/k8s/build_and_deploy.sh @@ -3,6 +3,10 @@ #记录开始时间 startTime=$(date +%s) +# 登录到目标环境 +baseDir="/home/somuns/ci4s" +cd ${baseDir} + #build # 默认参数 branch="master" @@ -64,10 +68,6 @@ fi chmod +777 ${baseDir}/k8s/*.sh -# 登录到目标环境 -baseDir="/home/somuns/ci4s" -cd ${baseDir} - echo "start build" sh ${baseDir}/k8s/build.sh -b ${branch} -s ${service} if [ $? -ne 0 ]; then