| @@ -29,6 +29,8 @@ export async function getInitialState(): Promise<{ | |||||
| loading?: boolean; | loading?: boolean; | ||||
| fetchUserInfo?: () => Promise<API.CurrentUser | undefined>; | fetchUserInfo?: () => Promise<API.CurrentUser | undefined>; | ||||
| }> { | }> { | ||||
| console.log('getInitialState'); | |||||
| const fetchUserInfo = async () => { | const fetchUserInfo = async () => { | ||||
| try { | try { | ||||
| const response = await getUserInfo({ | const response = await getUserInfo({ | ||||
| @@ -133,22 +135,7 @@ export const layout: RunTimeLayoutConfig = ({ initialState }) => { | |||||
| // 增加一个 loading 的状态 | // 增加一个 loading 的状态 | ||||
| childrenRender: (children) => { | childrenRender: (children) => { | ||||
| // if (initialState?.loading) return <PageLoading />; | // if (initialState?.loading) return <PageLoading />; | ||||
| return ( | |||||
| <> | |||||
| {children} | |||||
| {/* <SettingDrawer | |||||
| disableUrlParams | |||||
| enableDarkTheme | |||||
| settings={initialState?.settings} | |||||
| onSettingChange={(settings) => { | |||||
| setInitialState((preInitialState) => ({ | |||||
| ...preInitialState, | |||||
| settings, | |||||
| })); | |||||
| }} | |||||
| /> */} | |||||
| </> | |||||
| ); | |||||
| return <>{children}</>; | |||||
| }, | }, | ||||
| ...initialState?.settings, | ...initialState?.settings, | ||||
| }; | }; | ||||
| @@ -17,13 +17,8 @@ const HeaderDropdown: React.FC<HeaderDropdownProps> = ({ overlayClassName: cls, | |||||
| }, | }, | ||||
| }; | }; | ||||
| }); | }); | ||||
| return ( | |||||
| <Dropdown | |||||
| overlayClassName={classNames(className, cls)} | |||||
| getPopupContainer={(target) => target.parentElement || document.body} | |||||
| {...restProps} | |||||
| /> | |||||
| ); | |||||
| return <Dropdown overlayClassName={classNames(className, cls)} {...restProps} />; | |||||
| }; | }; | ||||
| export default HeaderDropdown; | export default HeaderDropdown; | ||||
| @@ -1,13 +1,12 @@ | |||||
| import { clearSessionToken } from '@/access'; | import { clearSessionToken } from '@/access'; | ||||
| import { PageEnum } from '@/enums/pagesEnums'; | |||||
| import { setRemoteMenu } from '@/services/session'; | import { setRemoteMenu } from '@/services/session'; | ||||
| import { logout } from '@/services/system/auth'; | import { logout } from '@/services/system/auth'; | ||||
| import { gotoLoginPage } from '@/utils/ui'; | |||||
| import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons'; | import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons'; | ||||
| import { setAlpha } from '@ant-design/pro-components'; | import { setAlpha } from '@ant-design/pro-components'; | ||||
| import { useEmotionCss } from '@ant-design/use-emotion-css'; | import { useEmotionCss } from '@ant-design/use-emotion-css'; | ||||
| import { history, useModel } from '@umijs/max'; | import { history, useModel } from '@umijs/max'; | ||||
| import { Avatar, Spin } from 'antd'; | import { Avatar, Spin } from 'antd'; | ||||
| import { stringify } from 'querystring'; | |||||
| import type { MenuInfo } from 'rc-menu/lib/interface'; | import type { MenuInfo } from 'rc-menu/lib/interface'; | ||||
| import React, { useCallback } from 'react'; | import React, { useCallback } from 'react'; | ||||
| import { flushSync } from 'react-dom'; | import { flushSync } from 'react-dom'; | ||||
| @@ -23,7 +22,7 @@ const Name = () => { | |||||
| const nameClassName = useEmotionCss(({ token }) => { | const nameClassName = useEmotionCss(({ token }) => { | ||||
| return { | return { | ||||
| width: '70px', | |||||
| // width: '70px', | |||||
| height: '48px', | height: '48px', | ||||
| overflow: 'hidden', | overflow: 'hidden', | ||||
| lineHeight: '48px', | lineHeight: '48px', | ||||
| @@ -64,19 +63,7 @@ const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu }) => { | |||||
| await logout(); | await logout(); | ||||
| clearSessionToken(); | clearSessionToken(); | ||||
| setRemoteMenu(null); | setRemoteMenu(null); | ||||
| const { search, pathname } = window.location; | |||||
| const urlParams = new URL(window.location.href).searchParams; | |||||
| /** 此方法会跳转到 redirect 参数所在的位置 */ | |||||
| const redirect = urlParams.get('redirect'); | |||||
| // Note: There may be security issues, please note | |||||
| if (window.location.pathname !== PageEnum.LOGIN && !redirect) { | |||||
| history.replace({ | |||||
| pathname: PageEnum.LOGIN, | |||||
| search: stringify({ | |||||
| redirect: pathname + search, | |||||
| }), | |||||
| }); | |||||
| } | |||||
| gotoLoginPage(); | |||||
| }; | }; | ||||
| const actionClassName = useEmotionCss(({ token }) => { | const actionClassName = useEmotionCss(({ token }) => { | ||||
| return { | return { | ||||
| @@ -1,6 +1,5 @@ | |||||
| import { QuestionCircleOutlined } from '@ant-design/icons'; | |||||
| import { useEmotionCss } from '@ant-design/use-emotion-css'; | import { useEmotionCss } from '@ant-design/use-emotion-css'; | ||||
| import { SelectLang, useModel } from '@umijs/max'; | |||||
| import { useModel } from '@umijs/max'; | |||||
| import React from 'react'; | import React from 'react'; | ||||
| import Avatar from './AvatarDropdown'; | import Avatar from './AvatarDropdown'; | ||||
| @@ -17,21 +16,21 @@ const GlobalHeaderRight: React.FC = () => { | |||||
| }; | }; | ||||
| }); | }); | ||||
| const actionClassName = useEmotionCss(({ token }) => { | |||||
| return { | |||||
| display: 'flex', | |||||
| float: 'right', | |||||
| height: '48px', | |||||
| marginLeft: 'auto', | |||||
| overflow: 'hidden', | |||||
| cursor: 'pointer', | |||||
| padding: '0 12px', | |||||
| borderRadius: token.borderRadius, | |||||
| '&:hover': { | |||||
| backgroundColor: token.colorBgTextHover, | |||||
| }, | |||||
| }; | |||||
| }); | |||||
| // const actionClassName = useEmotionCss(({ token }) => { | |||||
| // return { | |||||
| // display: 'flex', | |||||
| // float: 'right', | |||||
| // height: '48px', | |||||
| // marginLeft: 'auto', | |||||
| // overflow: 'hidden', | |||||
| // cursor: 'pointer', | |||||
| // padding: '0 12px', | |||||
| // borderRadius: token.borderRadius, | |||||
| // '&:hover': { | |||||
| // backgroundColor: token.colorBgTextHover, | |||||
| // }, | |||||
| // }; | |||||
| // }); | |||||
| const { initialState } = useModel('@@initialState'); | const { initialState } = useModel('@@initialState'); | ||||
| @@ -41,15 +40,15 @@ const GlobalHeaderRight: React.FC = () => { | |||||
| return ( | return ( | ||||
| <div className={className}> | <div className={className}> | ||||
| <span | |||||
| {/* <span | |||||
| className={actionClassName} | className={actionClassName} | ||||
| onClick={() => { | onClick={() => { | ||||
| window.open('https://pro.ant.design/docs/getting-started'); | window.open('https://pro.ant.design/docs/getting-started'); | ||||
| }} | }} | ||||
| > | > | ||||
| <QuestionCircleOutlined /> | <QuestionCircleOutlined /> | ||||
| </span> | |||||
| <Avatar menu={true} /> | |||||
| </span> */} | |||||
| <Avatar menu={false} /> | |||||
| {/* <SelectLang className={actionClassName} /> */} | {/* <SelectLang className={actionClassName} /> */} | ||||
| </div> | </div> | ||||
| ); | ); | ||||
| @@ -1,3 +1,9 @@ | |||||
| /* | |||||
| * @Author: 赵伟 | |||||
| * @Date: 2024-04-28 08:47:43 | |||||
| * @Description: 覆盖 antd 样式 | |||||
| */ | |||||
| // 设置 Table 可以滑动 | // 设置 Table 可以滑动 | ||||
| .vertical-scroll-table { | .vertical-scroll-table { | ||||
| .ant-table-wrapper { | .ant-table-wrapper { | ||||
| @@ -9,7 +15,7 @@ | |||||
| height: 100%; | height: 100%; | ||||
| .ant-table { | .ant-table { | ||||
| height: calc(100% - 74px); | |||||
| height: calc(100% - 74px); // 分页控件的高度 | |||||
| .ant-table-container { | .ant-table-container { | ||||
| height: 100%; | height: 100%; | ||||
| @@ -144,8 +144,15 @@ function AddExperimentModal({ | |||||
| label="实验描述" | label="实验描述" | ||||
| name="description" | name="description" | ||||
| rules={[{ required: true, message: '请输入实验描述' }]} | rules={[{ required: true, message: '请输入实验描述' }]} | ||||
| style={{ marginBottom: '48px' }} | |||||
| > | > | ||||
| <Input placeholder="请输入实验描述" maxLength={128} showCount allowClear /> | |||||
| <Input.TextArea | |||||
| placeholder="请输入实验描述" | |||||
| maxLength={128} | |||||
| autoSize={{ minRows: 2, maxRows: 5 }} | |||||
| showCount | |||||
| allowClear | |||||
| /> | |||||
| </Form.Item> | </Form.Item> | ||||
| <Form.Item | <Form.Item | ||||
| label="选择流水线" | label="选择流水线" | ||||
| @@ -380,10 +380,10 @@ const EditPipeline = () => { | |||||
| return ( | return ( | ||||
| cfg.anchorPoints || [ | cfg.anchorPoints || [ | ||||
| // 四个 | // 四个 | ||||
| // [0.5, 0], | |||||
| // [0.5, 1], | |||||
| [0, 0.5], | |||||
| [1, 0.5], | |||||
| [0.5, 0], | |||||
| [0.5, 1], | |||||
| // [0, 0.5], | |||||
| // [1, 0.5], | |||||
| ] | ] | ||||
| ); | ); | ||||
| }, | }, | ||||
| @@ -1,13 +1,13 @@ | |||||
| /* | /* | ||||
| * @Author: 赵伟 | * @Author: 赵伟 | ||||
| * @Date: 2024-03-25 13:52:54 | * @Date: 2024-03-25 13:52:54 | ||||
| * @Description: | |||||
| * @Description: 网络请求配置,详情请参考 https://umijs.org/docs/max/request | |||||
| */ | */ | ||||
| import type { RequestConfig } from '@umijs/max'; | import type { RequestConfig } from '@umijs/max'; | ||||
| import { message } from 'antd'; | import { message } from 'antd'; | ||||
| import { clearSessionToken, getAccessToken, getRefreshToken, getTokenExpireTime } from './access'; | |||||
| const checkRegion = 5 * 60 * 1000; | |||||
| import { clearSessionToken, getAccessToken } from './access'; | |||||
| import { setRemoteMenu } from './services/session'; | |||||
| import { gotoLoginPage } from './utils/ui'; | |||||
| /** | /** | ||||
| * Umi Max 网络请求配置 | * Umi Max 网络请求配置 | ||||
| @@ -21,23 +21,25 @@ export const requestConfig: RequestConfig = { | |||||
| const authHeader = headers['Authorization']; | const authHeader = headers['Authorization']; | ||||
| const isToken = headers['isToken']; | const isToken = headers['isToken']; | ||||
| if (!authHeader && isToken !== false) { | if (!authHeader && isToken !== false) { | ||||
| const expireTime = getTokenExpireTime(); | |||||
| if (expireTime) { | |||||
| const left = Number(expireTime) - new Date().getTime(); | |||||
| const refreshToken = getRefreshToken(); | |||||
| if (left < checkRegion && refreshToken) { | |||||
| if (left < 0) { | |||||
| clearSessionToken(); | |||||
| } | |||||
| } else { | |||||
| const accessToken = getAccessToken(); | |||||
| if (accessToken) { | |||||
| headers['Authorization'] = `Bearer ${accessToken}`; | |||||
| } | |||||
| } | |||||
| } else { | |||||
| clearSessionToken(); | |||||
| const accessToken = getAccessToken(); | |||||
| if (accessToken) { | |||||
| headers['Authorization'] = `Bearer ${accessToken}`; | |||||
| } | } | ||||
| // const expireTime = getTokenExpireTime(); | |||||
| // if (expireTime) { | |||||
| // const left = Number(expireTime) - new Date().getTime(); | |||||
| // const refreshToken = getRefreshToken(); | |||||
| // if (left < 0 && refreshToken) { | |||||
| // clearSessionToken(); | |||||
| // } else { | |||||
| // const accessToken = getAccessToken(); | |||||
| // if (accessToken) { | |||||
| // headers['Authorization'] = `Bearer ${accessToken}`; | |||||
| // } | |||||
| // } | |||||
| // } else { | |||||
| // clearSessionToken(); | |||||
| // } | |||||
| } | } | ||||
| return { url, options }; | return { url, options }; | ||||
| }, | }, | ||||
| @@ -45,15 +47,19 @@ export const requestConfig: RequestConfig = { | |||||
| responseInterceptors: [ | responseInterceptors: [ | ||||
| (response: any) => { | (response: any) => { | ||||
| const { status, data } = response; | const { status, data } = response; | ||||
| // console.log('response', response); | |||||
| if (status >= 200 && status < 300 && data && (data instanceof Blob || data.code === 200)) { | |||||
| return response; | |||||
| } else { | |||||
| if (data && data.msg) { | |||||
| message.error(data.msg); | |||||
| if (status >= 200 && status < 300) { | |||||
| if (data && (data instanceof Blob || data.code === 200)) { | |||||
| return response; | |||||
| } else if (data && data.code === 401) { | |||||
| clearSessionToken(); | |||||
| setRemoteMenu(null); | |||||
| gotoLoginPage(false); | |||||
| } else { | } else { | ||||
| message.error('请求失败'); | |||||
| message.error(data?.msg ?? '请求失败'); | |||||
| return Promise.reject(response); | |||||
| } | } | ||||
| } else { | |||||
| message.error('请求失败'); | |||||
| return Promise.reject(response); | return Promise.reject(response); | ||||
| } | } | ||||
| }, | }, | ||||
| @@ -1,8 +1,7 @@ | |||||
| import { createIcon } from '@/utils/IconUtil'; | |||||
| import { MenuDataItem } from '@ant-design/pro-components'; | import { MenuDataItem } from '@ant-design/pro-components'; | ||||
| import { request } from '@umijs/max'; | import { request } from '@umijs/max'; | ||||
| import React, { lazy } from 'react'; | import React, { lazy } from 'react'; | ||||
| import { createFromIconfontCN } from '@ant-design/icons'; | |||||
| let remoteMenu: any = null; | let remoteMenu: any = null; | ||||
| export function getRemoteMenu() { | export function getRemoteMenu() { | ||||
| @@ -107,7 +106,7 @@ export function convertCompatRouters(childrens: API.RoutersMenuItem[]): any[] { | |||||
| return { | return { | ||||
| path: item.path, | path: item.path, | ||||
| // icon:'icon-a-057_fenlei', | // icon:'icon-a-057_fenlei', | ||||
| icon: 'icon-'+item.meta.icon, | |||||
| icon: 'icon-' + item.meta.icon, | |||||
| // icon: item.meta.icon, | // icon: item.meta.icon, | ||||
| name: item.meta.title, | name: item.meta.title, | ||||
| routes: item.children ? convertCompatRouters(item.children) : undefined, | routes: item.children ? convertCompatRouters(item.children) : undefined, | ||||
| @@ -28,8 +28,8 @@ export async function login(body: API.LoginParams, options?: Record<string, any> | |||||
| /** 退出登录接口 POST /api/login/outLogin */ | /** 退出登录接口 POST /api/login/outLogin */ | ||||
| export async function logout() { | export async function logout() { | ||||
| return request<Record<string, any>>('/api/logout', { | |||||
| method: 'delete', | |||||
| return request<Record<string, any>>('/api/auth/logout', { | |||||
| method: 'DELETE', | |||||
| }); | }); | ||||
| } | } | ||||
| @@ -1,4 +1,10 @@ | |||||
| // 全局颜色变量 | |||||
| /* | |||||
| * @Author: 赵伟 | |||||
| * @Date: 2024-04-28 08:47:43 | |||||
| * @Description: 全局变量,可以直接在 less 文件里使用,无需引入;也可以导入到 js 里使用;为 antd 主题修改提供常量值 | |||||
| */ | |||||
| // 颜色 | |||||
| @primary-color: #1664ff; // 主色调 | @primary-color: #1664ff; // 主色调 | ||||
| @primary-color-hover: #69b1ff; | @primary-color-hover: #69b1ff; | ||||
| @background-color: #f9fafb; // 页面背景颜色 | @background-color: #f9fafb; // 页面背景颜色 | ||||
| @@ -1,3 +1,9 @@ | |||||
| /* | |||||
| * @Author: 赵伟 | |||||
| * @Date: 2024-04-08 09:54:39 | |||||
| * @Description: 定义全局类型,比如无关联的页面都需要要的类型 | |||||
| */ | |||||
| // 流水线全局参数 | // 流水线全局参数 | ||||
| export type PipelineGlobalParam = { | export type PipelineGlobalParam = { | ||||
| param_name: string; | param_name: string; | ||||
| @@ -3,7 +3,9 @@ | |||||
| * @Date: 2024-04-19 14:42:51 | * @Date: 2024-04-19 14:42:51 | ||||
| * @Description: UI 公共方法 | * @Description: UI 公共方法 | ||||
| */ | */ | ||||
| import { PageEnum } from '@/enums/pagesEnums'; | |||||
| import themes from '@/styles/theme.less'; | import themes from '@/styles/theme.less'; | ||||
| import { history } from '@umijs/max'; | |||||
| import { Modal, type ModalFuncProps, type UploadFile } from 'antd'; | import { Modal, type ModalFuncProps, type UploadFile } from 'antd'; | ||||
| // 自定义 Confirm 弹框 | // 自定义 Confirm 弹框 | ||||
| @@ -43,3 +45,17 @@ export const getFileListFromEvent = (e: any) => { | |||||
| return item; | return item; | ||||
| }); | }); | ||||
| }; | }; | ||||
| // 去登录页面 | |||||
| export const gotoLoginPage = (toHome: boolean = true) => { | |||||
| const { pathname, search } = window.location; | |||||
| const urlParams = new URLSearchParams(); | |||||
| urlParams.append('redirect', pathname + search); | |||||
| const newSearch = toHome ? '' : urlParams.toString(); | |||||
| if (window.location.pathname !== PageEnum.LOGIN) { | |||||
| history.replace({ | |||||
| pathname: PageEnum.LOGIN, | |||||
| search: newSearch, | |||||
| }); | |||||
| } | |||||
| }; | |||||
| @@ -17,9 +17,7 @@ import org.springframework.scheduling.annotation.EnableScheduling; | |||||
| @EnableRyFeignClients | @EnableRyFeignClients | ||||
| @SpringBootApplication | @SpringBootApplication | ||||
| @EnableScheduling | @EnableScheduling | ||||
| public class | |||||
| RuoYiManagementPlatformApplication { | |||||
| public class RuoYiManagementPlatformApplication { | |||||
| public static void main(String[] args) { | public static void main(String[] args) { | ||||
| SpringApplication.run(RuoYiManagementPlatformApplication.class, args); | SpringApplication.run(RuoYiManagementPlatformApplication.class, args); | ||||
| System.out.println("(♥◠‿◠)ノ゙ 复杂智能软件管理平台启动成功 ლ(´ڡ`ლ)゙ \n" + | System.out.println("(♥◠‿◠)ノ゙ 复杂智能软件管理平台启动成功 ლ(´ڡ`ლ)゙ \n" + | ||||
| @@ -4,7 +4,7 @@ import com.ruoyi.common.core.web.controller.BaseController; | |||||
| import com.ruoyi.common.core.web.domain.GenericsAjaxResult; | import com.ruoyi.common.core.web.domain.GenericsAjaxResult; | ||||
| import com.ruoyi.platform.domain.DatasetVersion; | import com.ruoyi.platform.domain.DatasetVersion; | ||||
| import com.ruoyi.platform.service.DatasetVersionService; | import com.ruoyi.platform.service.DatasetVersionService; | ||||
| import com.ruoyi.platform.vo.LabelDatasetVersion; | |||||
| import com.ruoyi.platform.vo.LabelDatasetVersionVo; | |||||
| import io.swagger.annotations.ApiOperation; | import io.swagger.annotations.ApiOperation; | ||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
| @@ -138,8 +138,10 @@ public class DatasetVersionController extends BaseController { | |||||
| @PostMapping("/addDatasetVersionsFromLabel") | @PostMapping("/addDatasetVersionsFromLabel") | ||||
| @ApiOperation("从数据标注添加数据集版本") | @ApiOperation("从数据标注添加数据集版本") | ||||
| public GenericsAjaxResult<Boolean> addDatasetVersionsFromLabel(@RequestBody LabelDatasetVersion labelDatasetVersion) throws Exception { | |||||
| return genericsSuccess(true); | |||||
| public GenericsAjaxResult<?> addDatasetVersionsFromLabel(@RequestBody LabelDatasetVersionVo labelDatasetVersionVo) throws Exception { | |||||
| datasetVersionService.addDatasetVersionsFromLabel(labelDatasetVersionVo); | |||||
| return GenericsAjaxResult.success(); | |||||
| } | } | ||||
| } | } | ||||
| @@ -123,7 +123,7 @@ public class ModelsController extends BaseController { | |||||
| */ | */ | ||||
| @PostMapping | @PostMapping | ||||
| @ApiOperation("添加模型") | @ApiOperation("添加模型") | ||||
| public GenericsAjaxResult<Models> add(@RequestBody Models models) { | |||||
| public GenericsAjaxResult<Models> add(@RequestBody Models models) throws Exception { | |||||
| return genericsSuccess(this.modelsService.insert(models)); | return genericsSuccess(this.modelsService.insert(models)); | ||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.ruoyi.platform.domain; | |||||
| import com.fasterxml.jackson.databind.PropertyNamingStrategy; | import com.fasterxml.jackson.databind.PropertyNamingStrategy; | ||||
| import com.fasterxml.jackson.databind.annotation.JsonNaming; | import com.fasterxml.jackson.databind.annotation.JsonNaming; | ||||
| import com.ruoyi.platform.annotations.CheckDuplicate; | |||||
| import io.swagger.annotations.ApiModel; | import io.swagger.annotations.ApiModel; | ||||
| import io.swagger.annotations.ApiModelProperty; | import io.swagger.annotations.ApiModelProperty; | ||||
| @@ -22,6 +23,7 @@ public class Models implements Serializable { | |||||
| private Integer id; | private Integer id; | ||||
| @ApiModelProperty(value = "模型名称") | @ApiModelProperty(value = "模型名称") | ||||
| @CheckDuplicate | |||||
| private String name; | private String name; | ||||
| @ApiModelProperty(value = "模型描述") | @ApiModelProperty(value = "模型描述") | ||||
| @@ -84,7 +84,8 @@ public interface DatasetVersionDao { | |||||
| List<DatasetVersion> queryByDatasetId(Integer datasetId); | List<DatasetVersion> queryByDatasetId(Integer datasetId); | ||||
| DatasetVersion queryByDatasetVersion(@Param("datasetVersion") DatasetVersion datasetVersion); | |||||
| DatasetVersion | |||||
| queryByDatasetVersion(@Param("datasetVersion") DatasetVersion datasetVersion); | |||||
| List<DatasetVersion> queryAllByDatasetVersion(@Param("datasetId") Integer datasetId, @Param("version") String version); | List<DatasetVersion> queryAllByDatasetVersion(@Param("datasetId") Integer datasetId, @Param("version") String version); | ||||
| @@ -62,7 +62,7 @@ public interface ExperimentDao { | |||||
| * @return 影响行数 | * @return 影响行数 | ||||
| * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 | * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 | ||||
| */ | */ | ||||
| int insertOrUpdateBatch(@Param("entities") List<Experiment> entities); | |||||
| int insertOrUpdateBatch(List<Experiment> entities); | |||||
| /** | /** | ||||
| * 修改数据 | * 修改数据 | ||||
| @@ -62,7 +62,7 @@ public interface ExperimentInsDao { | |||||
| * @return 影响行数 | * @return 影响行数 | ||||
| * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 | * @throws org.springframework.jdbc.BadSqlGrammarException 入参是空List的时候会抛SQL语句错误的异常,请自行校验入参 | ||||
| */ | */ | ||||
| int insertOrUpdateBatch(@Param("entities") List<ExperimentIns> entities); | |||||
| int insertOrUpdateBatch(List<ExperimentIns> entities); | |||||
| /** | /** | ||||
| * 修改数据 | * 修改数据 | ||||
| @@ -92,5 +92,7 @@ public interface ExperimentInsDao { | |||||
| List<ExperimentIns> queryByExperiment(@Param("experimentIns") ExperimentIns experimentIns); | List<ExperimentIns> queryByExperiment(@Param("experimentIns") ExperimentIns experimentIns); | ||||
| List<ExperimentIns> queryByExperimentId(Integer id); | List<ExperimentIns> queryByExperimentId(Integer id); | ||||
| List<ExperimentIns> queryByExperimentIsNotTerminated(); | |||||
| } | } | ||||
| @@ -1,10 +1,12 @@ | |||||
| package com.ruoyi.platform.mapper; | package com.ruoyi.platform.mapper; | ||||
| import com.ruoyi.platform.domain.Dataset; | |||||
| import com.ruoyi.platform.domain.Models; | import com.ruoyi.platform.domain.Models; | ||||
| import org.apache.ibatis.annotations.Param; | import org.apache.ibatis.annotations.Param; | ||||
| import org.springframework.data.domain.Pageable; | import org.springframework.data.domain.Pageable; | ||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | |||||
| /** | /** | ||||
| * (Models)表数据库访问层 | * (Models)表数据库访问层 | ||||
| @@ -22,6 +24,8 @@ public interface ModelsDao { | |||||
| */ | */ | ||||
| Models queryById(Integer id); | Models queryById(Integer id); | ||||
| Models findByName(@Param("name") String name); | |||||
| /** | /** | ||||
| * 查询指定行数据 | * 查询指定行数据 | ||||
| * | * | ||||
| @@ -0,0 +1,88 @@ | |||||
| package com.ruoyi.platform.scheduling; | |||||
| import com.ruoyi.common.security.utils.SecurityUtils; | |||||
| import com.ruoyi.platform.domain.Experiment; | |||||
| import com.ruoyi.platform.domain.ExperimentIns; | |||||
| import com.ruoyi.platform.mapper.ExperimentDao; | |||||
| import com.ruoyi.platform.mapper.ExperimentInsDao; | |||||
| import com.ruoyi.platform.service.ExperimentInsService; | |||||
| import com.ruoyi.platform.service.ExperimentService; | |||||
| import com.ruoyi.platform.utils.JsonUtils; | |||||
| import com.ruoyi.system.api.model.LoginUser; | |||||
| import io.swagger.models.auth.In; | |||||
| import org.apache.commons.lang3.StringUtils; | |||||
| import org.springframework.beans.factory.annotation.Autowired; | |||||
| import org.springframework.scheduling.annotation.Scheduled; | |||||
| import org.springframework.stereotype.Component; | |||||
| import javax.annotation.Resource; | |||||
| import java.io.IOException; | |||||
| import java.util.*; | |||||
| import java.util.stream.Collectors; | |||||
| @Component() | |||||
| public class ExperimentInstanceStatusTask { | |||||
| @Autowired | |||||
| private ExperimentInsService experimentInsService; | |||||
| @Resource | |||||
| private ExperimentDao experimentDao; | |||||
| @Resource | |||||
| private ExperimentInsDao experimentInsDao; | |||||
| private List<Integer> experimentIds = new ArrayList<>(); | |||||
| @Scheduled(cron = "0/30 * * * * ?") // 每30S执行一次 | |||||
| public void executeExperimentInsStatus() throws IOException { | |||||
| // 查到所有非终止态的实例 | |||||
| List<ExperimentIns> experimentInsList = experimentInsService.queryByExperimentIsNotTerminated(); | |||||
| // 去argo查询状态 | |||||
| List<ExperimentIns> updateList = new ArrayList<>(); | |||||
| 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 (!StringUtils.equals(oldStatus,experimentIns.getStatus())){ | |||||
| experimentIns.setUpdateTime(new Date()); | |||||
| experimentIds.add(experimentIns.getExperimentId()); | |||||
| updateList.add(experimentIns); | |||||
| } | |||||
| experimentInsDao.update(experimentIns); | |||||
| } | |||||
| } | |||||
| if (updateList.size() > 0){ | |||||
| experimentInsDao.insertOrUpdateBatch(updateList); | |||||
| } | |||||
| } | |||||
| @Scheduled(cron = "0/30 * * * * ?") // / 每30S执行一次 | |||||
| public void executeExperimentStatus() throws IOException { | |||||
| if (experimentIds.size()==0){ | |||||
| return; | |||||
| } | |||||
| List<Experiment> updateexperiments = new ArrayList<>(); | |||||
| for (Integer experimentId : experimentIds){ | |||||
| List<ExperimentIns> insList = experimentInsService.getByExperimentId(experimentId); | |||||
| List<String> statusList = new ArrayList<String>(); | |||||
| // 更新实验状态列表 | |||||
| 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); | |||||
| if (!StringUtils.equals(subStatus,experiment.getStatusList())){ | |||||
| experiment.setStatusList(subStatus); | |||||
| updateexperiments.add(experiment); | |||||
| } | |||||
| } | |||||
| if (updateexperiments.size() > 0) { | |||||
| experimentDao.insertOrUpdateBatch(updateexperiments); | |||||
| for (int index = 0; index < updateexperiments.size(); index++) { | |||||
| experimentIds.remove(index); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @@ -1,11 +1,8 @@ | |||||
| package com.ruoyi.platform.service; | package com.ruoyi.platform.service; | ||||
| import com.ruoyi.platform.domain.Dataset; | |||||
| import com.ruoyi.platform.domain.DatasetVersion; | import com.ruoyi.platform.domain.DatasetVersion; | ||||
| import com.ruoyi.platform.vo.LabelDatasetVersion; | |||||
| import com.ruoyi.platform.vo.LabelDatasetVersionVo; | |||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
| @@ -75,5 +72,6 @@ public interface DatasetVersionService { | |||||
| String addDatasetVersions(List<DatasetVersion> datasetVersions) throws Exception; | String addDatasetVersions(List<DatasetVersion> datasetVersions) throws Exception; | ||||
| void addDatasetVersionsFromLabel(LabelDatasetVersion labelDatasetVersion) throws Exception; | |||||
| void | |||||
| addDatasetVersionsFromLabel(LabelDatasetVersionVo labelDatasetVersionVo) throws Exception; | |||||
| } | } | ||||
| @@ -98,4 +98,9 @@ public interface ExperimentInsService { | |||||
| String getRealtimePodLogFromPod(PodLogVo podLogVo); | String getRealtimePodLogFromPod(PodLogVo podLogVo); | ||||
| /** | |||||
| * 查询非终止态的实例 | |||||
| * @return | |||||
| */ | |||||
| List<ExperimentIns> queryByExperimentIsNotTerminated(); | |||||
| } | } | ||||
| @@ -4,6 +4,7 @@ import org.springframework.core.io.InputStreamResource; | |||||
| import org.springframework.http.ResponseEntity; | import org.springframework.http.ResponseEntity; | ||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||
| import java.io.InputStream; | |||||
| import java.util.List; | import java.util.List; | ||||
| import java.util.Map; | import java.util.Map; | ||||
| @@ -11,5 +12,5 @@ public interface MinioService { | |||||
| ResponseEntity<InputStreamResource> downloadZipFile(String bucketName , String path); | ResponseEntity<InputStreamResource> downloadZipFile(String bucketName , String path); | ||||
| Map<String, String> uploadFile(String bucketName, String objectName, MultipartFile file ) throws Exception; | Map<String, String> uploadFile(String bucketName, String objectName, MultipartFile file ) throws Exception; | ||||
| void uploaInputStream(String bucketName, String objectName, InputStream inputStream ) throws Exception; | |||||
| } | } | ||||
| @@ -2,6 +2,7 @@ package com.ruoyi.platform.service; | |||||
| import com.ruoyi.platform.domain.Dataset; | |||||
| import com.ruoyi.platform.domain.Models; | import com.ruoyi.platform.domain.Models; | ||||
| import com.ruoyi.platform.domain.ModelsVersion; | import com.ruoyi.platform.domain.ModelsVersion; | ||||
| import com.ruoyi.platform.vo.ModelsVo; | import com.ruoyi.platform.vo.ModelsVo; | ||||
| @@ -45,7 +46,7 @@ public interface ModelsService { | |||||
| * @param models 实例对象 | * @param models 实例对象 | ||||
| * @return 实例对象 | * @return 实例对象 | ||||
| */ | */ | ||||
| Models insert(Models models); | |||||
| Models insert(Models models) throws Exception; | |||||
| /** | /** | ||||
| * 修改数据 | * 修改数据 | ||||
| @@ -81,5 +82,7 @@ public interface ModelsService { | |||||
| String readFileContent(Integer modelsId, String version) throws Exception; | String readFileContent(Integer modelsId, String version) throws Exception; | ||||
| public void checkDeclaredName(Models insert) throws Exception; | |||||
| List<Map<String, String>> exportModels(String path, String uuid) throws Exception; | List<Map<String, String>> exportModels(String path, String uuid) throws Exception; | ||||
| } | } | ||||
| @@ -20,6 +20,7 @@ import com.ruoyi.platform.vo.DatasetVo; | |||||
| import com.ruoyi.system.api.model.LoginUser; | import com.ruoyi.system.api.model.LoginUser; | ||||
| import io.minio.messages.Item; | import io.minio.messages.Item; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Value; | |||||
| import org.springframework.core.io.InputStreamResource; | import org.springframework.core.io.InputStreamResource; | ||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageImpl; | import org.springframework.data.domain.PageImpl; | ||||
| @@ -67,7 +68,8 @@ public class DatasetServiceImpl implements DatasetService { | |||||
| private MinioService minioService; | private MinioService minioService; | ||||
| // 固定存储桶名 | // 固定存储桶名 | ||||
| private final String bucketName = "platform-data"; | |||||
| @Value("${minio.dataReleaseBucketName}") | |||||
| private String bucketName; | |||||
| @Resource | @Resource | ||||
| private MinioUtil minioUtil; | private MinioUtil minioUtil; | ||||
| @@ -240,6 +242,7 @@ public class DatasetServiceImpl implements DatasetService { | |||||
| @Override | @Override | ||||
| public List<Map<String, String>> uploadDataset(MultipartFile[] files, String uuid) throws Exception { | public List<Map<String, String>> uploadDataset(MultipartFile[] files, String uuid) throws Exception { | ||||
| List<Map<String, String>> results = new ArrayList<>(); | List<Map<String, String>> results = new ArrayList<>(); | ||||
| for (MultipartFile file:files){ | for (MultipartFile file:files){ | ||||
| // 构建objectName | // 构建objectName | ||||
| String username = SecurityUtils.getLoginUser().getUsername(); | String username = SecurityUtils.getLoginUser().getUsername(); | ||||
| @@ -259,7 +262,6 @@ public class DatasetServiceImpl implements DatasetService { | |||||
| if (dataset == null) { | if (dataset == null) { | ||||
| throw new Exception("数据集不存在,请检查数据集id"); | throw new Exception("数据集不存在,请检查数据集id"); | ||||
| } | } | ||||
| DatasetVersion version = datasetVersionService.queryByDatasetVersion(datasetVersion); | DatasetVersion version = datasetVersionService.queryByDatasetVersion(datasetVersion); | ||||
| String url = ""; | String url = ""; | ||||
| if (version == null) { | if (version == null) { | ||||
| @@ -1,17 +1,20 @@ | |||||
| package com.ruoyi.platform.service.impl; | package com.ruoyi.platform.service.impl; | ||||
| import com.ruoyi.common.core.utils.DateUtils; | |||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.annotations.CheckDuplicate; | import com.ruoyi.platform.annotations.CheckDuplicate; | ||||
| import com.ruoyi.platform.domain.Dataset; | import com.ruoyi.platform.domain.Dataset; | ||||
| import com.ruoyi.platform.domain.DatasetVersion; | import com.ruoyi.platform.domain.DatasetVersion; | ||||
| import com.ruoyi.platform.domain.ModelsVersion; | |||||
| import com.ruoyi.platform.domain.Workflow; | |||||
| import com.ruoyi.platform.mapper.DatasetDao; | |||||
| import com.ruoyi.platform.mapper.DatasetVersionDao; | import com.ruoyi.platform.mapper.DatasetVersionDao; | ||||
| import com.ruoyi.platform.service.DatasetVersionService; | import com.ruoyi.platform.service.DatasetVersionService; | ||||
| import com.ruoyi.platform.service.MinioService; | |||||
| import com.ruoyi.platform.utils.FileUtil; | |||||
| import com.ruoyi.platform.utils.HttpUtils; | import com.ruoyi.platform.utils.HttpUtils; | ||||
| import com.ruoyi.platform.vo.LabelDatasetVersion; | |||||
| import com.ruoyi.platform.vo.LabelDatasetVersionVo; | |||||
| import com.ruoyi.system.api.model.LoginUser; | import com.ruoyi.system.api.model.LoginUser; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Value; | |||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageImpl; | import org.springframework.data.domain.PageImpl; | ||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
| @@ -35,9 +38,13 @@ import java.util.Map; | |||||
| public class DatasetVersionServiceImpl implements DatasetVersionService { | public class DatasetVersionServiceImpl implements DatasetVersionService { | ||||
| @Resource | @Resource | ||||
| private DatasetVersionDao datasetVersionDao; | private DatasetVersionDao datasetVersionDao; | ||||
| @Resource | |||||
| private DatasetDao datasetDao; | |||||
| // 固定存储桶名 | // 固定存储桶名 | ||||
| private final String bucketName = "platform-data"; | |||||
| @Value("${minio.dataReleaseBucketName}") | |||||
| private String bucketName; | |||||
| @Resource | |||||
| private MinioService minioService; | |||||
| /** | /** | ||||
| * 通过ID查询单条数据 | * 通过ID查询单条数据 | ||||
| * | * | ||||
| @@ -198,12 +205,31 @@ public class DatasetVersionServiceImpl implements DatasetVersionService { | |||||
| } | } | ||||
| @Override | @Override | ||||
| public void addDatasetVersionsFromLabel(LabelDatasetVersion labelDatasetVersion) throws Exception{ | |||||
| public void addDatasetVersionsFromLabel(LabelDatasetVersionVo labelDatasetVersionVo) throws Exception{ | |||||
| Dataset dataset = datasetDao.queryById(labelDatasetVersionVo.getDataset_id()); | |||||
| if (dataset == null){ | |||||
| throw new Exception("数据集不存在"); | |||||
| } | |||||
| // 获取label-studio数据流 | // 获取label-studio数据流 | ||||
| InputStream inputStream = HttpUtils.getInputStream("http://127.0.0.1:8080/api/projects/"+labelDatasetVersion.getProject_id()+"/export?exportType="+labelDatasetVersion.getExportType(), labelDatasetVersion.getToken()); | |||||
| // 上传镜像至minio | |||||
| Map<String, String> headers = new HashMap<String, String>(); | |||||
| headers.put("Authorization","Token "+labelDatasetVersionVo.getToken()); | |||||
| InputStream inputStream = HttpUtils.getIntputStream("http://127.0.0.1:8080/api/projects/"+labelDatasetVersionVo.getProject_id()+"/export?exportType="+labelDatasetVersionVo.getExportType(), headers); | |||||
| // 构建objectName | |||||
| String username = SecurityUtils.getLoginUser().getUsername(); | |||||
| String url = username + "/" + DateUtils.dateTimeNow() + "/" + dataset.getName()+"_"+labelDatasetVersionVo.getVersion()+"."+labelDatasetVersionVo.getExportType(); | |||||
| String objectName = "datasets/" + url; | |||||
| String formattedSize = FileUtil.formatFileSize(inputStream.available()); | |||||
| minioService.uploaInputStream(bucketName,objectName,inputStream); | |||||
| //保存DatasetVersion | //保存DatasetVersion | ||||
| DatasetVersion datasetVersion = new DatasetVersion(); | |||||
| datasetVersion.setVersion(labelDatasetVersionVo.getVersion()); | |||||
| datasetVersion.setDatasetId(labelDatasetVersionVo.getDataset_id()); | |||||
| datasetVersion.setFileName(dataset.getName()+"_"+labelDatasetVersionVo.getVersion()+"."+labelDatasetVersionVo.getExportType()); | |||||
| datasetVersion.setFileSize(formattedSize); | |||||
| datasetVersion.setUrl(url); | |||||
| datasetVersion.setDescription(labelDatasetVersionVo.getDesc()); | |||||
| this.insert(datasetVersion); | |||||
| } | } | ||||
| private void insertPrepare(DatasetVersion datasetVersion) throws Exception { | private void insertPrepare(DatasetVersion datasetVersion) throws Exception { | ||||
| @@ -71,14 +71,16 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| @Override | @Override | ||||
| public ExperimentIns queryById(Integer id) throws IOException { | public ExperimentIns queryById(Integer id) throws IOException { | ||||
| ExperimentIns experimentIns = this.experimentInsDao.queryById(id); | ExperimentIns experimentIns = this.experimentInsDao.queryById(id); | ||||
| if (experimentIns != null && (StringUtils.isEmpty(experimentIns.getStatus())) || !isTerminatedState(experimentIns)) { | |||||
| experimentIns = this.queryStatusFromArgo(experimentIns); | |||||
| //只有当新状态是终止态时才更新数据库 | |||||
| if (isTerminatedState(experimentIns)) { | |||||
| //同时更新各个节点 | |||||
| this.update(experimentIns); | |||||
| } | |||||
| } | |||||
| //已经迁移至定时任务进行更新操作 | |||||
| // if (experimentIns != null && (StringUtils.isEmpty(experimentIns.getStatus())) || !isTerminatedState(experimentIns)) { | |||||
| // experimentIns = this.queryStatusFromArgo(experimentIns); | |||||
| // //只有当新状态是终止态时才更新数据库 | |||||
| // if (isTerminatedState(experimentIns)) { | |||||
| // //同时更新各个节点 | |||||
| // this.update(experimentIns); | |||||
| // } | |||||
| // } | |||||
| return experimentIns; | return experimentIns; | ||||
| } | } | ||||
| @@ -93,40 +95,42 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| @Override | @Override | ||||
| public List<ExperimentIns> getByExperimentId(Integer experimentId) throws IOException { | public List<ExperimentIns> getByExperimentId(Integer experimentId) throws IOException { | ||||
| List<ExperimentIns> experimentInsList = experimentInsDao.getByExperimentId(experimentId); | List<ExperimentIns> experimentInsList = experimentInsDao.getByExperimentId(experimentId); | ||||
| //搞个标记,当状态改变才去改表 | |||||
| boolean flag = false; | |||||
| List<ExperimentIns> result = new ArrayList<ExperimentIns>(); | |||||
| if (experimentInsList!=null && experimentInsList.size()>0) { | |||||
| for (ExperimentIns experimentIns : experimentInsList) { | |||||
| //当原本状态为null或非终止态时才调用argo接口 | |||||
| if (experimentIns != null && (StringUtils.isEmpty(experimentIns.getStatus())) || !isTerminatedState(experimentIns)) { | |||||
| experimentIns = this.queryStatusFromArgo(experimentIns); | |||||
| if (!flag){ | |||||
| flag = true; | |||||
| } | |||||
| //只有当新状态是终止态时才更新数据库 | |||||
| if (isTerminatedState(experimentIns)) { | |||||
| //同时更新各个节点 | |||||
| this.update(experimentIns); | |||||
| } | |||||
| } | |||||
| //新增查询tensorBoard容器状态 | |||||
| result.add(experimentIns); | |||||
| } | |||||
| } | |||||
| if (flag) { | |||||
| List<String> statusList = new ArrayList<String>(); | |||||
| // 更新实验状态列表 | |||||
| for (int i=0;i<result.size();i++){ | |||||
| statusList.add(result.get(i).getStatus()); | |||||
| } | |||||
| Experiment experiment = experimentDao.queryById(experimentId); | |||||
| experiment.setStatusList(statusList.toString().substring(1, statusList.toString().length()-1)); | |||||
| experimentDao.update(experiment); | |||||
| } | |||||
| return result; | |||||
| //代码全部迁移至定时任务 | |||||
| //搞个标记,当状态改变才去改表 | |||||
| // boolean flag = false; | |||||
| // List<ExperimentIns> result = new ArrayList<ExperimentIns>(); | |||||
| // if (experimentInsList!=null && experimentInsList.size()>0) { | |||||
| // for (ExperimentIns experimentIns : experimentInsList) { | |||||
| // //当原本状态为null或非终止态时才调用argo接口 | |||||
| // if (experimentIns != null && (StringUtils.isEmpty(experimentIns.getStatus())) || !isTerminatedState(experimentIns)) { | |||||
| // experimentIns = this.queryStatusFromArgo(experimentIns); | |||||
| // if (!flag){ | |||||
| // flag = true; | |||||
| // } | |||||
| // //只有当新状态是终止态时才更新数据库 | |||||
| // if (isTerminatedState(experimentIns)) { | |||||
| // //同时更新各个节点 | |||||
| // this.update(experimentIns); | |||||
| // } | |||||
| // } | |||||
| // | |||||
| // //新增查询tensorBoard容器状态 | |||||
| // result.add(experimentIns); | |||||
| // } | |||||
| // } | |||||
| // if (flag) { | |||||
| // List<String> statusList = new ArrayList<String>(); | |||||
| // // 更新实验状态列表 | |||||
| // for (int i=0;i<result.size();i++){ | |||||
| // statusList.add(result.get(i).getStatus()); | |||||
| // } | |||||
| // Experiment experiment = experimentDao.queryById(experimentId); | |||||
| // experiment.setStatusList(statusList.toString().substring(1, statusList.toString().length()-1)); | |||||
| // experimentDao.update(experiment); | |||||
| // } | |||||
| return experimentInsList; | |||||
| } | } | ||||
| @@ -141,15 +145,15 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| public Page<ExperimentIns> queryByPage(ExperimentIns experimentIns, PageRequest pageRequest) throws IOException { | public Page<ExperimentIns> queryByPage(ExperimentIns experimentIns, PageRequest pageRequest) throws IOException { | ||||
| long total = this.experimentInsDao.count(experimentIns); | long total = this.experimentInsDao.count(experimentIns); | ||||
| List<ExperimentIns> experimentInsList = this.experimentInsDao.queryAllByLimit(experimentIns, pageRequest); | List<ExperimentIns> 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); | |||||
| } | |||||
| } | |||||
| } | |||||
| // 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); | return new PageImpl<>(experimentInsList, pageRequest, total); | ||||
| } | } | ||||
| @@ -524,6 +528,11 @@ public class ExperimentInsServiceImpl implements ExperimentInsService { | |||||
| return k8sClientUtil.getPodLogs(podLogVo.getPodName(), podLogVo.getNamespace(),podLogVo.getContainerName(), logsLines); | return k8sClientUtil.getPodLogs(podLogVo.getPodName(), podLogVo.getNamespace(),podLogVo.getContainerName(), logsLines); | ||||
| } | } | ||||
| @Override | |||||
| public List<ExperimentIns> queryByExperimentIsNotTerminated() { | |||||
| return experimentInsDao.queryByExperimentIsNotTerminated(); | |||||
| } | |||||
| private boolean isTerminatedState(ExperimentIns ins) throws IOException { | private boolean isTerminatedState(ExperimentIns ins) throws IOException { | ||||
| // 定义终止态的列表,例如 "Succeeded", "Failed" 等 | // 定义终止态的列表,例如 "Succeeded", "Failed" 等 | ||||
| String status = ins.getStatus(); | String status = ins.getStatus(); | ||||
| @@ -256,8 +256,9 @@ public class ExperimentServiceImpl implements ExperimentService { | |||||
| experimentIns.setExperimentId(experiment.getId()); | experimentIns.setExperimentId(experiment.getId()); | ||||
| experimentIns.setArgoInsNs((String) metadata.get("namespace")); | experimentIns.setArgoInsNs((String) metadata.get("namespace")); | ||||
| experimentIns.setArgoInsName((String) metadata.get("name")); | experimentIns.setArgoInsName((String) metadata.get("name")); | ||||
| //传入实验全局参数 | |||||
| experimentIns.setStatus("Pending"); | |||||
| //传入实验全局参数 | |||||
| experimentIns.setGlobalParam(experiment.getGlobalParam()); | experimentIns.setGlobalParam(experiment.getGlobalParam()); | ||||
| @@ -221,7 +221,7 @@ public class ImageServiceImpl implements ImageService { | |||||
| if (imageVersionInsert == null) { | if (imageVersionInsert == null) { | ||||
| throw new Exception("新增镜像版本失败"); | throw new Exception("新增镜像版本失败"); | ||||
| } | } | ||||
| // 使用CompletableFuture异步执行不同的镜像构建逻辑 | |||||
| // 使用CompletableFuture异步执行不同的镜像构建逻辑,在构建镜像的同时,更新数据库中的镜像版本状态 | |||||
| CompletableFuture.supplyAsync(() -> { | CompletableFuture.supplyAsync(() -> { | ||||
| Map<String, String> resultMap = new HashMap<>(); | Map<String, String> resultMap = new HashMap<>(); | ||||
| try { | try { | ||||
| @@ -281,6 +281,7 @@ public class ImageServiceImpl implements ImageService { | |||||
| String pushCmd = "docker push " + imageUrl; | String pushCmd = "docker push " + imageUrl; | ||||
| String sizeCmd = "docker inspect --format='{{.Size}}' " + imageUrl; | String sizeCmd = "docker inspect --format='{{.Size}}' " + imageUrl; | ||||
| String s = k8sClientUtil.executeCommand(pod, tagCmd); | String s = k8sClientUtil.executeCommand(pod, tagCmd); | ||||
| if (StringUtils.isNotEmpty(k8sClientUtil.executeCommand(pod, pushCmd))){ | if (StringUtils.isNotEmpty(k8sClientUtil.executeCommand(pod, pushCmd))){ | ||||
| resultMap.put("url", imageUrl); | resultMap.put("url", imageUrl); | ||||
| //得到镜像文件大小 | //得到镜像文件大小 | ||||
| @@ -69,4 +69,9 @@ public class MinioServiceImpl implements MinioService { | |||||
| } | } | ||||
| return result; | return result; | ||||
| } | } | ||||
| @Override | |||||
| public void uploaInputStream(String bucketName, String objectName, InputStream inputStream ) throws Exception { | |||||
| minioUtil.uploadObject(bucketName, objectName, inputStream); | |||||
| } | |||||
| } | } | ||||
| @@ -1,7 +1,9 @@ | |||||
| package com.ruoyi.platform.service.impl; | package com.ruoyi.platform.service.impl; | ||||
| import com.ruoyi.common.security.utils.SecurityUtils; | import com.ruoyi.common.security.utils.SecurityUtils; | ||||
| import com.ruoyi.platform.annotations.CheckDuplicate; | |||||
| import com.ruoyi.platform.domain.AssetIcon; | import com.ruoyi.platform.domain.AssetIcon; | ||||
| import com.ruoyi.platform.domain.Dataset; | |||||
| import com.ruoyi.platform.domain.Models; | import com.ruoyi.platform.domain.Models; | ||||
| import com.ruoyi.platform.domain.ModelsVersion; | import com.ruoyi.platform.domain.ModelsVersion; | ||||
| import com.ruoyi.platform.mapper.ModelsDao; | import com.ruoyi.platform.mapper.ModelsDao; | ||||
| @@ -19,6 +21,7 @@ import com.ruoyi.system.api.model.LoginUser; | |||||
| import io.minio.messages.Item; | import io.minio.messages.Item; | ||||
| import io.netty.util.Version; | import io.netty.util.Version; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Value; | |||||
| import org.springframework.core.io.InputStreamResource; | import org.springframework.core.io.InputStreamResource; | ||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageImpl; | import org.springframework.data.domain.PageImpl; | ||||
| @@ -34,6 +37,7 @@ import javax.annotation.Resource; | |||||
| import java.io.ByteArrayInputStream; | import java.io.ByteArrayInputStream; | ||||
| import java.io.ByteArrayOutputStream; | import java.io.ByteArrayOutputStream; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.lang.reflect.Field; | |||||
| import java.net.URLEncoder; | import java.net.URLEncoder; | ||||
| import java.util.*; | import java.util.*; | ||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||
| @@ -64,7 +68,8 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| // 固定存储桶名 | // 固定存储桶名 | ||||
| private final String bucketName = "platform-data"; | |||||
| @Value("${minio.dataReleaseBucketName}") | |||||
| private String bucketName; | |||||
| @Resource | @Resource | ||||
| private MinioUtil minioUtil; | private MinioUtil minioUtil; | ||||
| @@ -116,8 +121,9 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| * @return 实例对象 | * @return 实例对象 | ||||
| */ | */ | ||||
| @Override | @Override | ||||
| public Models insert(Models models) { | |||||
| public Models insert(Models models) throws Exception { | |||||
| LoginUser loginUser = SecurityUtils.getLoginUser(); | LoginUser loginUser = SecurityUtils.getLoginUser(); | ||||
| checkDeclaredName(models); | |||||
| models.setCreateBy(loginUser.getUsername()); | models.setCreateBy(loginUser.getUsername()); | ||||
| models.setUpdateBy(loginUser.getUsername()); | models.setUpdateBy(loginUser.getUsername()); | ||||
| models.setUpdateTime(new Date()); | models.setUpdateTime(new Date()); | ||||
| @@ -173,8 +179,9 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | if (!(StringUtils.equals(username,"admin") || StringUtils.equals(username,createdBy))){ | ||||
| throw new Exception("无权限删除该模型"); | throw new Exception("无权限删除该模型"); | ||||
| } | } | ||||
| if (modelsVersionService.queryByModelsId(id).size()>0){ | |||||
| throw new Exception("请先删除该镜像下的版本文件"); | |||||
| //判断是否有版本文件 | |||||
| if (!modelsVersionService.queryByModelsId(id).isEmpty()){ | |||||
| throw new Exception("请先删除该模型下的版本文件"); | |||||
| } | } | ||||
| models.setState(0); | models.setState(0); | ||||
| return this.modelsDao.update(models)>0?"删除成功":"删除失败"; | return this.modelsDao.update(models)>0?"删除成功":"删除失败"; | ||||
| @@ -427,6 +434,31 @@ public class ModelsServiceImpl implements ModelsService { | |||||
| } | } | ||||
| @Override | |||||
| public void checkDeclaredName(Models insert) throws Exception { | |||||
| Models existingModel = modelsDao.findByName(insert.getName()); | |||||
| if (existingModel != null) { | |||||
| // Check if the found models is not the same as the one being inserted | |||||
| // This is important if you are using this method for both insert and update operations | |||||
| // You may need an identifier check here, e.g., if 'insert' has an ID and it's the same as 'existingDataset' | |||||
| if (insert.getId() != null && insert.getId().equals(existingModel.getId())) { | |||||
| // This is the same dataset, no duplicate name issue for update operation | |||||
| return; | |||||
| } | |||||
| // Now we know there's another dataset with the same name | |||||
| Field[] fields = Models.class.getDeclaredFields(); | |||||
| for (Field field : fields) { | |||||
| field.setAccessible(true); // Make private fields accessible | |||||
| if ("name".equals(field.getName()) && field.isAnnotationPresent(CheckDuplicate.class)) { | |||||
| // If the field is 'name' and is marked with CheckDuplicate annotation | |||||
| CheckDuplicate annotation = field.getAnnotation(CheckDuplicate.class); | |||||
| throw new Exception("重复的模型名称: " + insert.getName() + ". " + annotation.message()); | |||||
| } | |||||
| } | |||||
| } | |||||
| } | |||||
| @Override | @Override | ||||
| public List<Map<String, String>> exportModels(String path, String uuid) throws Exception { | public List<Map<String, String>> exportModels(String path, String uuid) throws Exception { | ||||
| List<Map<String, String>> results = new ArrayList<>(); | List<Map<String, String>> results = new ArrayList<>(); | ||||
| @@ -8,6 +8,7 @@ import com.ruoyi.platform.mapper.ModelsVersionDao; | |||||
| import com.ruoyi.platform.service.ModelsVersionService; | import com.ruoyi.platform.service.ModelsVersionService; | ||||
| import com.ruoyi.system.api.model.LoginUser; | import com.ruoyi.system.api.model.LoginUser; | ||||
| import org.apache.commons.lang3.StringUtils; | import org.apache.commons.lang3.StringUtils; | ||||
| import org.springframework.beans.factory.annotation.Value; | |||||
| import org.springframework.data.domain.Page; | import org.springframework.data.domain.Page; | ||||
| import org.springframework.data.domain.PageImpl; | import org.springframework.data.domain.PageImpl; | ||||
| import org.springframework.data.domain.PageRequest; | import org.springframework.data.domain.PageRequest; | ||||
| @@ -35,7 +36,8 @@ public class ModelsVersionServiceImpl implements ModelsVersionService { | |||||
| private ModelsDao modelsDao; | private ModelsDao modelsDao; | ||||
| // 固定存储桶名 | // 固定存储桶名 | ||||
| private final String bucketName = "platform-data"; | |||||
| @Value("${minio.dataReleaseBucketName}") | |||||
| private String bucketName; | |||||
| /** | /** | ||||
| * 通过ID查询单条数据 | * 通过ID查询单条数据 | ||||
| @@ -375,25 +375,54 @@ public class HttpUtils { | |||||
| } | } | ||||
| /** | /** | ||||
| * 发送 HTTP 请求并返回二进制数据流(InputStream)。 | |||||
| * 发送 HTTP 请求并返回二进制数据流(OutputStream)。 | |||||
| * | * | ||||
| * @param url 请求的 URL 地址。 | * @param url 请求的 URL 地址。 | ||||
| * @param token 要携带的 Token。 | |||||
| * @return 服务器响应的二进制数据流(InputStream)。 | |||||
| * @param headers 头节点。 | |||||
| * @return 服务器响应的二进制数据流(OutputStream)。 | |||||
| * @throws IOException 如果请求失败或发生其他 I/O 错误。 | * @throws IOException 如果请求失败或发生其他 I/O 错误。 | ||||
| */ | */ | ||||
| public static InputStream getInputStream(String url, String token) throws IOException { | |||||
| public static InputStream getIntputStream(String url, Map<String, String> headers) throws IOException { | |||||
| URL requestUrl = new URL(url); | URL requestUrl = new URL(url); | ||||
| HttpURLConnection connection = (HttpURLConnection) requestUrl.openConnection(); | HttpURLConnection connection = (HttpURLConnection) requestUrl.openConnection(); | ||||
| // Set request headers | |||||
| for (Map.Entry<String, String> entry : headers.entrySet()) { | |||||
| connection.setRequestProperty(entry.getKey(), entry.getValue()); | |||||
| } | |||||
| // Set other connection properties (e.g., timeouts, request method, etc.) | |||||
| connection.setRequestMethod("GET"); | connection.setRequestMethod("GET"); | ||||
| connection.setRequestProperty("Authorization", "Bearer " + token); // 添加 Authorization 头部,携带 Token | |||||
| connection.setConnectTimeout(5000); | |||||
| connection.setReadTimeout(5000); | |||||
| // Connect and get the response code | |||||
| connection.connect(); | |||||
| int responseCode = connection.getResponseCode(); | int responseCode = connection.getResponseCode(); | ||||
| if (responseCode == HttpURLConnection.HTTP_OK) { | if (responseCode == HttpURLConnection.HTTP_OK) { | ||||
| return connection.getInputStream(); // 获取响应的输入流 | |||||
| // Get the response InputStream | |||||
| InputStream inputStream = connection.getInputStream(); | |||||
| // // Create a ByteArrayOutputStream to store the response data | |||||
| // ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); | |||||
| // | |||||
| // // Read data from the InputStream and write it to the ByteArrayOutputStream | |||||
| // byte[] buffer = new byte[1024]; | |||||
| // int bytesRead; | |||||
| // while ((bytesRead = inputStream.read(buffer)) != -1) { | |||||
| // outputStream.write(buffer, 0, bytesRead); | |||||
| // } | |||||
| // | |||||
| // // Close the InputStream | |||||
| // inputStream.close(); | |||||
| // Return the ByteArrayOutputStream as an OutputStream | |||||
| return inputStream; | |||||
| } else { | } else { | ||||
| throw new IOException("HTTP 请求失败,状态码:" + responseCode); | |||||
| throw new IOException("HTTP request failed with response code: " + responseCode); | |||||
| } | } | ||||
| } | } | ||||
| @@ -6,10 +6,10 @@ import com.fasterxml.jackson.databind.annotation.JsonNaming; | |||||
| import java.io.Serializable; | import java.io.Serializable; | ||||
| @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | @JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class) | ||||
| public class LabelDatasetVersion implements Serializable { | |||||
| public class LabelDatasetVersionVo implements Serializable { | |||||
| private String token; | private String token; | ||||
| private String project_id; | private String project_id; | ||||
| private String dataset_id; | |||||
| private Integer dataset_id; | |||||
| private String version; | private String version; | ||||
| private String desc; | private String desc; | ||||
| private String exportType; | private String exportType; | ||||
| @@ -29,11 +29,11 @@ public class LabelDatasetVersion implements Serializable { | |||||
| this.project_id = project_id; | this.project_id = project_id; | ||||
| } | } | ||||
| public String getDataset_id() { | |||||
| public Integer getDataset_id() { | |||||
| return dataset_id; | return dataset_id; | ||||
| } | } | ||||
| public void setDataset_id(String dataset_id) { | |||||
| public void setDataset_id(Integer dataset_id) { | |||||
| this.dataset_id = dataset_id; | this.dataset_id = dataset_id; | ||||
| } | } | ||||
| @@ -31,6 +31,7 @@ | |||||
| from dataset | from dataset | ||||
| where name = #{name} and state = 1 limit 1 | where name = #{name} and state = 1 limit 1 | ||||
| </select> | </select> | ||||
| <!--查询指定行数据--> | <!--查询指定行数据--> | ||||
| <select id="queryAllByLimit" resultMap="DatasetMap"> | <select id="queryAllByLimit" resultMap="DatasetMap"> | ||||
| select | select | ||||
| @@ -160,24 +160,25 @@ | |||||
| </foreach> | </foreach> | ||||
| </insert> | </insert> | ||||
| <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> | |||||
| insert into experiment(name,workflow_id, global_param, status_list, description, create_by, create_time, update_by, update_time, state) | |||||
| <update id="insertOrUpdateBatch"> | |||||
| insert into experiment (id, name, workflow_id, global_param, status_list, description, create_by, create_time, update_by, update_time, state) | |||||
| values | values | ||||
| <foreach collection="entities" item="entity" separator=","> | |||||
| (#{entity.name},#{entity.workflowId}, #{entity.globalParam}, #{entity.statusList}, #{entity.description}, #{entity.createBy}, #{entity.createTime}, | |||||
| #{entity.updateBy}, #{entity.updateTime}, #{entity.state}) | |||||
| <foreach collection="list" item="item" index="index" separator=","> | |||||
| (#{item.id}, #{item.name}, #{item.workflowId}, #{item.globalParam}, #{item.statusList}, #{item.description}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state}) | |||||
| </foreach> | </foreach> | ||||
| on duplicate key update | |||||
| name=values(name), | |||||
| workflow_id = values(workflow_id), | |||||
| global_param = values(global_param), | |||||
| description = values(description), | |||||
| create_by = values(create_by), | |||||
| create_time = values(create_time), | |||||
| update_by = values(update_by), | |||||
| update_time = values(update_time), | |||||
| state = values(state) | |||||
| </insert> | |||||
| ON DUPLICATE KEY UPDATE | |||||
| name = VALUES(name), | |||||
| workflow_id = VALUES(workflow_id), | |||||
| global_param = VALUES(global_param), | |||||
| status_list = VALUES(status_list), | |||||
| description = VALUES(description), | |||||
| create_by = VALUES(create_by), | |||||
| create_time = VALUES(create_time), | |||||
| update_by = VALUES(update_by), | |||||
| update_time = VALUES(update_time), | |||||
| state = VALUES(state); | |||||
| </update> | |||||
| <!--通过主键修改数据--> | <!--通过主键修改数据--> | ||||
| <update id="update"> | <update id="update"> | ||||
| @@ -21,7 +21,13 @@ | |||||
| <result property="state" column="state" jdbcType="INTEGER"/> | <result property="state" column="state" jdbcType="INTEGER"/> | ||||
| </resultMap> | </resultMap> | ||||
| <!--查询非终止态的实例--> | |||||
| <select id="queryByExperimentIsNotTerminated" resultMap="ExperimentInsMap"> | |||||
| select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs,global_param, start_time, finish_time, create_by, create_time, update_by, update_time, state | |||||
| from experiment_ins | |||||
| where (status NOT IN ('Terminated', 'Succeeded', 'Failed') | |||||
| OR status IS NULL) and state = 1 | |||||
| </select> | |||||
| <!--查询单个--> | <!--查询单个--> | ||||
| <select id="queryById" resultMap="ExperimentInsMap"> | <select id="queryById" resultMap="ExperimentInsMap"> | ||||
| @@ -217,18 +223,39 @@ | |||||
| </foreach> | </foreach> | ||||
| </insert> | </insert> | ||||
| <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true"> | |||||
| insert into | |||||
| experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,start_time,finish_time,create_by,create_time,update_by,update_time,state) | |||||
| <!-- <insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">--> | |||||
| <!-- insert into--> | |||||
| <!-- experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,start_time,finish_time,create_by,create_time,update_by,update_time,state)--> | |||||
| <!-- values--> | |||||
| <!-- <foreach collection="entities" item="entity" separator=",">--> | |||||
| <!-- (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesResult},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})--> | |||||
| <!-- </foreach>--> | |||||
| <!-- on duplicate key update--> | |||||
| <!-- experiment_id = values(experiment_id)argo_ins_name = values(argo_ins_name)argo_ins_ns = values(argo_ins_ns)status = values(status) nodes_status = values(nodes_status) create_by = values(create_by)create_time = values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state)--> | |||||
| <!-- </insert>--> | |||||
| <update id="insertOrUpdateBatch"> | |||||
| insert into experiment_ins (id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status, nodes_result, nodes_logs, global_param, start_time, finish_time, create_by, create_time, update_by, update_time, state) | |||||
| values | values | ||||
| <foreach collection="entities" item="entity" separator=","> | |||||
| (#{entity.experimentId},#{entity.argoInsName},#{entity.argoInsNs},#{entity.status},#{entity.nodesStatus},#{entity.nodesResult},#{entity.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state}) | |||||
| <foreach collection="list" item="item" index="index" separator=","> | |||||
| (#{item.id}, #{item.experimentId}, #{item.argoInsName}, #{item.argoInsNs}, #{item.status}, #{item.nodesStatus}, #{item.nodesResult}, #{item.nodesLogs}, #{item.globalParam}, #{item.startTime}, #{item.finishTime}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.state}) | |||||
| </foreach> | </foreach> | ||||
| on duplicate key update | |||||
| experiment_id = values(experiment_id)argo_ins_name = values(argo_ins_name)argo_ins_ns = | |||||
| values(argo_ins_ns)status = values(status) nodes_status = values(nodes_status) create_by = values(create_by)create_time = | |||||
| values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state) | |||||
| </insert> | |||||
| ON DUPLICATE KEY UPDATE | |||||
| experiment_id = VALUES(experiment_id), | |||||
| argo_ins_name = VALUES(argo_ins_name), | |||||
| argo_ins_ns = VALUES(argo_ins_ns), | |||||
| status = VALUES(status), | |||||
| nodes_status = VALUES(nodes_status), | |||||
| nodes_result = VALUES(nodes_result), | |||||
| nodes_logs = VALUES(nodes_logs), | |||||
| global_param = VALUES(global_param), | |||||
| start_time = VALUES(start_time), | |||||
| finish_time = VALUES(finish_time), | |||||
| create_by = VALUES(create_by), | |||||
| create_time = VALUES(create_time), | |||||
| update_by = VALUES(update_by), | |||||
| update_time = VALUES(update_time), | |||||
| state = VALUES(state); | |||||
| </update> | |||||
| <update id="update"> | <update id="update"> | ||||
| update experiment_ins | update experiment_ins | ||||
| @@ -24,6 +24,14 @@ | |||||
| where id = #{id} and state = 1 | where id = #{id} and state = 1 | ||||
| </select> | </select> | ||||
| <!--查询单个--> | |||||
| <select id="findByName" resultMap="ModelsMap"> | |||||
| select | |||||
| id, name, description,available_range, model_type,model_tag, create_by, create_time, update_by, update_time, state | |||||
| from models | |||||
| where name = #{name} and state = 1 limit 1 | |||||
| </select> | |||||
| <!--查询指定行数据--> | <!--查询指定行数据--> | ||||
| <select id="queryAllByLimit" resultMap="ModelsMap"> | <select id="queryAllByLimit" resultMap="ModelsMap"> | ||||
| select | select | ||||