Browse Source

chore: merge

pull/14/head
cp3hnu 1 year ago
parent
commit
0a7824d08d
50 changed files with 1462 additions and 439 deletions
  1. +1
    -1
      react-ui/config/proxy.ts
  2. +0
    -14
      react-ui/src/pages/DevelopmentEnvironment/index.jsx
  3. +22
    -0
      react-ui/src/pages/DevelopmentEnvironment/index.tsx
  4. +4
    -0
      ruoyi-common/ruoyi-common-core/pom.xml
  5. +63
    -0
      ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/SortUtils.java
  6. +156
    -43
      ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java
  7. +171
    -0
      ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/GenericsAjaxResult.java
  8. +98
    -0
      ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/GenericsTableDataInfo.java
  9. +6
    -0
      ruoyi-modules/management-platform/pom.xml
  10. +1
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/RuoYiManagementPlatformApplication.java
  11. +17
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/config/WebSocketConfig.java
  12. +27
    -24
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/dataset/DatasetVersionController.java
  13. +26
    -21
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentController.java
  14. +54
    -28
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java
  15. +20
    -20
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/icon/AssetIconController.java
  16. +30
    -33
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/image/ImageController.java
  17. +15
    -16
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/image/ImageVersionController.java
  18. +3
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/jupyter/JupyterController.java
  19. +34
    -34
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsController.java
  20. +24
    -21
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsVersionController.java
  21. +14
    -12
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/resources/ComputingResourceController.java
  22. +42
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/tensorBoard/TensorBoardController.java
  23. +0
    -15
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/tensorBoard/tensorBoard.java
  24. +19
    -17
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowController.java
  25. +16
    -14
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowParamController.java
  26. +4
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/Experiment.java
  27. +21
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ExperimentIns.java
  28. +2
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/Models.java
  29. +2
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelsVersion.java
  30. +32
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/TensorBoardStatus.java
  31. +16
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/Workflow.java
  32. +12
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/WorkflowParam.java
  33. +4
    -4
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/WorkflowParamDao.java
  34. +7
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java
  35. +16
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/TensorBoardService.java
  36. +1
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/WorkflowService.java
  37. +48
    -9
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java
  38. +9
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java
  39. +2
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java
  40. +57
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/TensorBoardServiceImpl.java
  41. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowParamServiceImpl.java
  42. +2
    -4
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java
  43. +98
    -5
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java
  44. +37
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/FrameLogPathVo.java
  45. +37
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/PodLogVo.java
  46. +69
    -0
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/webSocket/WebSocket.java
  47. +3
    -3
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentDaoMapper.xml
  48. +20
    -8
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml
  49. +19
    -9
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowDaoMapper.xml
  50. +80
    -77
      ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowParamDaoMapper.xml

+ 1
- 1
react-ui/config/proxy.ts View File

@@ -26,7 +26,7 @@ export default {
'/profile/avatar/': {
target: 'http://172.20.32.181:31205',
changeOrigin: true,
}
},
},

/**


+ 0
- 14
react-ui/src/pages/DevelopmentEnvironment/index.jsx View File

@@ -1,14 +0,0 @@
import React ,{ useState,useEffect,useRef }from 'react';
import {getJupyterUrl} from '@/services/developmentEnvironment/index.js'
const developmentEnvironment = React.FC = () => {
const [iframeUrl,setIframeUrl]=useState('')
useEffect(()=>{
getJupyterUrl().then(ret=>{
console.log(ret);
setIframeUrl(ret.msg)
})
},[])
return (
<iframe style={{width:'100%',height:'81vh'}} src={iframeUrl} frameborder="0"></iframe>
)};
export default developmentEnvironment;

+ 22
- 0
react-ui/src/pages/DevelopmentEnvironment/index.tsx View File

@@ -0,0 +1,22 @@
import { getJupyterUrl } from '@/services/developmentEnvironment';
import { to } from '@/utils/promise';
import { useEffect, useState } from 'react';

const DevelopmentEnvironment = () => {
const [iframeUrl, setIframeUrl] = useState('');
useEffect(() => {
requestJupyterUrl();
}, []);

const requestJupyterUrl = async () => {
const [res, error] = await to(getJupyterUrl());
if (res) {
setIframeUrl(res.data as string);
} else {
console.log(error);
}
};

return <iframe style={{ width: '100%', height: '81vh', border: 0 }} src={iframeUrl}></iframe>;
};
export default DevelopmentEnvironment;

+ 4
- 0
ruoyi-common/ruoyi-common-core/pom.xml View File

@@ -112,6 +112,10 @@
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

</dependencies>



+ 63
- 0
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/utils/SortUtils.java View File

@@ -0,0 +1,63 @@
package com.ruoyi.common.core.utils;

import com.ruoyi.common.core.exception.ServiceException;

import java.lang.reflect.Field;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;
import java.util.List;

/**
* @author otto
*/
public class SortUtils {
public static List<?> sort(List<?> list, final String param, boolean isAsc) {
//自定义Comparator对象,自定义排序
Comparator c = (o1, o2) -> {
try {
Field field1 = o1.getClass().getDeclaredField(param);
Field field2 = o2.getClass().getDeclaredField(param);
field1.setAccessible(true);
field2.setAccessible(true);
if (Integer.class.equals(field1.getType())) {
if ((Integer) field1.get(o1) < (Integer) field2.get(o2)) {
return isAsc ? -1 : 1;
} else {
//注意!!返回值必须是一对相反数,否则无效。jdk1.7以后就是这样。
return isAsc ? 1 : -1;
}
}
if (Long.class.equals(field1.getType())) {
Long long1 = (Long) field1.get(o1);
Long long2 = (Long) field2.get(o2);
if (long1 < long2) {
return isAsc ? -1 : 1;
} else {
//注意!!返回值必须是一对相反数,否则无效。jdk1.7以后就是这样。
return isAsc ? 1 : -1;
}
}
if (Date.class.equals(field1.getType())) {
Date date1 = (Date) field1.get(o1);
Date date2 = (Date) field2.get(o2);
if (date1.before(date2)) {
return isAsc ? -1 : 1;
} else {
//注意!!返回值必须是一对相反数,否则无效。jdk1.7以后就是这样。
return isAsc ? 1 : -1;
}
}

} catch (NoSuchFieldException e) {
throw new ServiceException(String.format("指定的排序字段不存在[%s]", param));
} catch (IllegalAccessException e) {
throw new ServiceException(String.format("访问排序字段非法,请检查排序字段[%s]权限", param));
}
return 1;
};
Collections.sort(list, c);
return list;

}
}

+ 156
- 43
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/controller/BaseController.java View File

@@ -1,40 +1,41 @@
package com.ruoyi.common.core.web.controller;

import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.constant.Constants;
import com.ruoyi.common.core.constant.HttpStatus;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.core.utils.PageUtils;
import com.ruoyi.common.core.utils.*;
import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.common.core.web.page.GenericsTableDataInfo;
import com.ruoyi.common.core.web.page.PageDomain;
import com.ruoyi.common.core.web.page.TableDataInfo;
import com.ruoyi.common.core.web.page.TableSupport;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.InitBinder;

import java.beans.PropertyEditorSupport;
import java.util.Date;
import java.util.List;

/**
* web层通用数据处理
*
*
* @author ruoyi
*/
public class BaseController
{
public class BaseController {
protected final Logger logger = LoggerFactory.getLogger(this.getClass());

/**
* 将前台传递过来的日期格式的字符串,自动转化为Date类型
*/
@InitBinder
public void initBinder(WebDataBinder binder)
{
public void initBinder(WebDataBinder binder) {
// Date 类型转换
binder.registerCustomEditor(Date.class, new PropertyEditorSupport()
{
binder.registerCustomEditor(Date.class, new PropertyEditorSupport() {
@Override
public void setAsText(String text)
{
public void setAsText(String text) {
setValue(DateUtils.parseDate(text));
}
});
@@ -43,25 +44,22 @@ public class BaseController
/**
* 设置请求分页数据
*/
protected void startPage()
{
protected void startPage() {
PageUtils.startPage();
}

/**
* 清理分页的线程变量
*/
protected void clearPage()
{
protected void clearPage() {
PageUtils.clearPage();
}

/**
* 响应请求分页数据
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable(List<?> list)
{
@SuppressWarnings({"rawtypes", "unchecked"})
protected TableDataInfo getDataTable(List<?> list) {
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setRows(list);
@@ -70,73 +68,188 @@ public class BaseController
return rspData;
}

/**
* 响应请求分页数据
*/
@SuppressWarnings({"rawtypes", "unchecked"})
protected <T> GenericsTableDataInfo<T> getGenericsDataTable(List<T> list) {
GenericsTableDataInfo<T> rspData = new GenericsTableDataInfo<>();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setRows(list);
rspData.setMsg("查询成功");
rspData.setTotal(new PageInfo(list).getTotal());
return rspData;
}

/**
* 响应请求分页数据
*/

protected <T> GenericsTableDataInfo<T> getGenericsDataTable(List<T> list, Integer count) {
GenericsTableDataInfo<T> rspData = new GenericsTableDataInfo<>();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setRows(list);
rspData.setMsg("查询成功");
rspData.setTotal(count);
return rspData;
}

/**
* 响应请求分页数据
*/
protected <T> GenericsTableDataInfo<T> getAllGenericsDataTableToPage(List<T> list) {
GenericsTableDataInfo<T> rspData = new GenericsTableDataInfo<>();
rspData.setCode(HttpStatus.SUCCESS);
int total = list.size();
rspData.setTotal(total);
String orderByStr = ServletUtils.getParameter(Constants.ORDER_BY_COLUMN);
if (StringUtils.isNotEmpty(orderByStr)) {
String isAscStr = ServletUtils.getParameter(Constants.IS_ASC);
if (StringUtils.isNotEmpty(orderByStr)) {
String ascString = "asc";
boolean isAsc = true;
if (isAscStr != null && !ascString.equals(isAscStr.toLowerCase())) {
isAsc = false;
}
SortUtils.sort(list, orderByStr, isAsc);
}
}
if (StringUtils.isNotEmpty(ServletUtils.getParameter(Constants.PAGE_NUM))
&& StringUtils.isNotEmpty(ServletUtils.getParameter(Constants.PAGE_SIZE))) {
PageDomain pageDomain = TableSupport.buildPageRequest();
Integer pageNum = pageDomain.getPageNum();
Integer pageSize = pageDomain.getPageSize();

if (pageNum != null && pageSize != null) {
if (pageNum > 0) {
pageNum = pageNum - 1;
} else {
pageNum = 0;
}
int startIndex = pageNum * pageSize;
int endIndex = (pageNum + 1) * pageSize;

int currentSize = total - startIndex;
if (currentSize < pageSize && currentSize > 0) {
endIndex = startIndex + currentSize;
} else if (currentSize <= 0) {
if (total > pageSize) {
startIndex = total - pageSize - 1;
} else {
startIndex = 0;
endIndex = total;
}

}
list = list.subList(startIndex, endIndex);
}
//todo:暂不考虑 Boolean reasonable = pageDomain.getReasonable();
}

rspData.setRows(list);
rspData.setMsg("查询成功");
return rspData;
}

/**
* 响应请求分页数据
*/
@SuppressWarnings({"rawtypes", "unchecked"})
protected TableDataInfo getDataTable(List<?> list, Integer size) {
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setRows(list);
rspData.setMsg("查询成功");
rspData.setTotal(size);
return rspData;
}

/**
* 返回成功
*/
public AjaxResult success()
{
public AjaxResult success() {
return AjaxResult.success();
}

/**
* 返回成功消息
*/
public AjaxResult success(String message)
{
public AjaxResult success(String message) {
return AjaxResult.success(message);
}

/**
* 返回成功消息
*/
public AjaxResult success(Object data)
{
public AjaxResult success(Object data) {
return AjaxResult.success(data);
}

/**
* 返回成功消息
*/
public <T> GenericsAjaxResult<T> genericsSuccess(T data) {
return GenericsAjaxResult.success(data);
}

/**
* 返回失败消息
*/
public AjaxResult error()
{
public AjaxResult error() {
return AjaxResult.error();
}

/**
* 返回失败消息
*/
public AjaxResult error(String message)
{
public AjaxResult error(String message) {
return AjaxResult.error(message);
}

/**
* 返回警告消息
*/
public AjaxResult warn(String message)
{
public AjaxResult warn(String message) {
return AjaxResult.warn(message);
}

/**
* 响应返回结果
*
*
* @param rows 影响行数
* @return 操作结果
*/
protected AjaxResult toAjax(int rows)
{
protected AjaxResult toAjax(int rows) {
return rows > 0 ? AjaxResult.success() : AjaxResult.error();
}

/**
* 响应返回结果
*
*
* @param rows 影响行数
* @return 操作结果
*/
protected <T> GenericsAjaxResult<T> toGenericsAjax(int rows) {
return rows > 0 ? GenericsAjaxResult.success() : GenericsAjaxResult.error();
}

/**
* 响应返回结果
*
* @param data 数据
* @return 操作结果
*/
protected <T> GenericsAjaxResult<T> successToGenericsAjax(T data) {
return GenericsAjaxResult.success(data);
}

/**
* 响应返回结果
*
* @param result 结果
* @return 操作结果
*/
protected AjaxResult toAjax(boolean result)
{
protected AjaxResult toAjax(boolean result) {
return result ? success() : error();
}
}

+ 171
- 0
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/domain/GenericsAjaxResult.java View File

@@ -0,0 +1,171 @@
package com.ruoyi.common.core.web.domain;

import com.ruoyi.common.core.constant.HttpStatus;
import com.ruoyi.common.core.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
* 操作消息提醒
*
* @author ruoyi
*/
@Data
@ApiModel("返回对象")
public class GenericsAjaxResult<T> implements Serializable {
private static final long serialVersionUID = 1L;

/**
* 状态码
*/
@ApiModelProperty("状态码")
private Integer code;

/**
* 返回内容
*/
@ApiModelProperty("返回内容")
private String msg;

/**
* 数据对象
*/
@ApiModelProperty("数据对象")
public T data;

/**
* 初始化一个新创建的 AjaxResult 对象,使其表示一个空消息。
*/
public GenericsAjaxResult() {
}

/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态码
* @param msg 返回内容
*/
public GenericsAjaxResult(int code, String msg) {
this.code = code;
this.msg = msg;
}

/**
* 初始化一个新创建的 AjaxResult 对象
*
* @param code 状态码
* @param msg 返回内容
* @param data 数据对象
*/
public GenericsAjaxResult(int code, String msg, T data) {
this.code = code;
this.msg = msg;
if (StringUtils.isNotNull(data)) {
this.data = data;
}
}

/**
* 返回成功消息
*
* @return 成功消息
*/
public static <T> GenericsAjaxResult<T> success() {
return GenericsAjaxResult.success("操作成功");
}

/**
* 返回成功数据
*
* @return 成功消息
*/
public static <T> GenericsAjaxResult<T> success(T data) {
return GenericsAjaxResult.success("操作成功", data);
}

/**
* 返回成功消息
*
* @param msg 返回内容
* @return 成功消息
*/
public static <T> GenericsAjaxResult<T> success(String msg) {
return GenericsAjaxResult.success(msg, null);
}

/**
* 返回成功消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 成功消息
*/
public static <T> GenericsAjaxResult<T> success(String msg, T data) {
return new GenericsAjaxResult<>(HttpStatus.SUCCESS, msg, data);
}

/**
* 返回警告消息
*
* @param msg 返回内容
* @return 警告消息
*/
public static <T> GenericsAjaxResult<T> warn(String msg) {
return GenericsAjaxResult.warn(msg, null);
}

/**
* 返回警告消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 警告消息
*/
public static <T> GenericsAjaxResult<T> warn(String msg, T data) {
return new GenericsAjaxResult<>(HttpStatus.WARN, msg, data);
}

/**
* 返回错误消息
*
* @return 错误消息
*/
public static <T> GenericsAjaxResult<T> error() {
return GenericsAjaxResult.error("操作失败");
}

/**
* 返回错误消息
*
* @param msg 返回内容
* @return 错误消息
*/
public static <T> GenericsAjaxResult<T> error(String msg) {
return GenericsAjaxResult.error(msg, null);
}

/**
* 返回错误消息
*
* @param msg 返回内容
* @param data 数据对象
* @return 错误消息
*/
public static <T> GenericsAjaxResult<T> error(String msg, T data) {
return new GenericsAjaxResult<>(HttpStatus.ERROR, msg, data);
}

/**
* 返回错误消息
*
* @param code 状态码
* @param msg 返回内容
* @return 错误消息
*/
public static <T> GenericsAjaxResult<T> error(int code, String msg) {
return new GenericsAjaxResult<>(code, msg, null);
}
}

+ 98
- 0
ruoyi-common/ruoyi-common-core/src/main/java/com/ruoyi/common/core/web/page/GenericsTableDataInfo.java View File

@@ -0,0 +1,98 @@
package com.ruoyi.common.core.web.page;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import com.ruoyi.common.core.constant.HttpStatus;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Optional;

/**
* 表格分页数据对象
*
* @author ruoyi
*/
@Data
@ApiModel("表格分页数据对象")
public class GenericsTableDataInfo<T> implements Serializable {
private static final long serialVersionUID = 1L;

/**
* 总记录数
*/
@ApiModelProperty("总记录数")
private long total;

/**
* 列表数据
*/
@ApiModelProperty("列表数据")
private List<T> rows;

/**
* 消息状态码
*/
@ApiModelProperty("消息状态码")
private int code;

/**
* 消息内容
*/
@ApiModelProperty("消息内容")
private String msg;


/**
* 表格数据对象
*/
public GenericsTableDataInfo() {
this.total = 0;
this.rows = new ArrayList<>();
this.code = HttpStatus.SUCCESS;
this.msg = "查询成功";
}

/**
* 将原始列表通过传入方法转换为对应类型,同时根据原始列表分页数据构建分页对象
*
* @param rows 原始列表(带分页)
* @param toList Lambda表达式,对原始列表进行转换
* @param <E> 原始列表列席
*/
@SuppressWarnings({"rawtypes", "unchecked"})
public <E> GenericsTableDataInfo(List<E> rows, Page.Function<List<E>, List<T>> toList) {
rows = Optional.ofNullable(rows).orElse(Collections.emptyList());
this.total = new PageInfo(rows).getTotal();
this.rows = toList.apply(rows);
this.code = HttpStatus.SUCCESS;
this.msg = "查询成功";
}

@SuppressWarnings({"rawtypes", "unchecked"})
public GenericsTableDataInfo(List<T> rows) {
this.total = new PageInfo(rows).getTotal();
this.rows = rows;
this.code = HttpStatus.SUCCESS;
this.msg = "查询成功";
}

/**
* 分页
*
* @param list 列表数据
* @param total 总记录数
*/
public GenericsTableDataInfo(List<T> list, Long total) {
this.rows = list;
this.total = total;
this.code = HttpStatus.SUCCESS;
this.msg = "查询成功";
}
}

+ 6
- 0
ruoyi-modules/management-platform/pom.xml View File

@@ -201,6 +201,12 @@
<version>0.1.55</version> <!-- 检查最新版本 -->
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>


</dependencies>

<build>


+ 1
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/RuoYiManagementPlatformApplication.java View File

@@ -32,3 +32,4 @@ public class RuoYiManagementPlatformApplication {
" ''-' `'-' `-..-' ");
}
}


+ 17
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/config/WebSocketConfig.java View File

@@ -0,0 +1,17 @@
package com.ruoyi.platform.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

@Configuration
public class WebSocketConfig {
/**
* 注入 ServerEndpointExporter,
* 这个 bean 会自动注册使用了 @ServerEndpoint 注解声明的 WebSocket endpoint
*/
@Bean
public ServerEndpointExporter serverEndpointExporter() {
return new ServerEndpointExporter();
}
}

+ 27
- 24
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/dataset/DatasetVersionController.java View File

@@ -1,14 +1,17 @@
package com.ruoyi.platform.controller.dataset;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.DatasetVersion;
import com.ruoyi.platform.service.DatasetVersionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* (DatasetVersion)表控制层
@@ -19,7 +22,7 @@ import java.util.List;
@RestController
@RequestMapping("datasetVersion")
@ApiOperation(value = "数据集版本管理")
public class DatasetVersionController {
public class DatasetVersionController extends BaseController {
/**
* 服务对象
*/
@@ -30,15 +33,15 @@ public class DatasetVersionController {
* 分页查询
*
* @param datasetVersion 筛选条件
* @param page 页数
* @param size 大小
* @param page 页数
* @param size 大小
* @return 查询结果
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(DatasetVersion datasetVersion, int page,int size) {
public GenericsAjaxResult<Page<DatasetVersion>> queryByPage(DatasetVersion datasetVersion, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.datasetVersionService.queryByPage(datasetVersion, pageRequest));
return genericsSuccess(this.datasetVersionService.queryByPage(datasetVersion, pageRequest));
}


@@ -50,22 +53,22 @@ public class DatasetVersionController {
*/
@GetMapping("{id}")
@ApiOperation("根据id查询数据集版本")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.datasetVersionService.queryById(id));
public GenericsAjaxResult<DatasetVersion> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.datasetVersionService.queryById(id));
}

/**
* 通过数据集id和version查询版本列表
*
* @param datasetId 数据集ID
* @param version 数据集版本
* @param version 数据集版本
* @return 匹配的数据集版本记录列表
*/
@GetMapping("/versions")
@ApiOperation("通过数据集id和version查询版本文件列表")
public AjaxResult queryByDatasetIdAndVersion(@RequestParam("dataset_id") Integer datasetId,
@RequestParam("version") String version) {
return AjaxResult.success(this.datasetVersionService.queryByDatasetIdAndVersion(datasetId, version));
public GenericsAjaxResult<List<DatasetVersion>> queryByDatasetIdAndVersion(@RequestParam("dataset_id") Integer datasetId,
@RequestParam("version") String version) {
return genericsSuccess(this.datasetVersionService.queryByDatasetIdAndVersion(datasetId, version));
}


@@ -77,8 +80,8 @@ public class DatasetVersionController {
*/
@PostMapping
@ApiOperation("添加数据集版本")
public AjaxResult add(@RequestBody DatasetVersion datasetVersion) throws Exception {
return AjaxResult.success(this.datasetVersionService.insert(datasetVersion));
public GenericsAjaxResult<DatasetVersion> add(@RequestBody DatasetVersion datasetVersion) throws Exception {
return genericsSuccess(this.datasetVersionService.insert(datasetVersion));
}

/**
@@ -89,8 +92,8 @@ public class DatasetVersionController {
*/
@PostMapping("/addDatasetVersions")
@ApiOperation("添加数据集版本")
public AjaxResult addDatasetVersions(@RequestBody List<DatasetVersion> datasetVersions) throws Exception {
return AjaxResult.success(this.datasetVersionService.addDatasetVersions(datasetVersions));
public GenericsAjaxResult<String> addDatasetVersions(@RequestBody List<DatasetVersion> datasetVersions) throws Exception {
return genericsSuccess(this.datasetVersionService.addDatasetVersions(datasetVersions));
}


@@ -102,8 +105,8 @@ public class DatasetVersionController {
*/
@PutMapping
@ApiOperation("编辑数据集版本")
public AjaxResult edit(@RequestBody DatasetVersion datasetVersion) {
return AjaxResult.success(this.datasetVersionService.update(datasetVersion));
public GenericsAjaxResult<DatasetVersion> edit(@RequestBody DatasetVersion datasetVersion) {
return genericsSuccess(this.datasetVersionService.update(datasetVersion));
}

/**
@@ -114,22 +117,22 @@ public class DatasetVersionController {
*/
@DeleteMapping({"{id}"})
@ApiOperation("删除数据集版本")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.datasetVersionService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.datasetVersionService.removeById(id));
}

/**
* 删除版本下的所有数据
*
* @param datasetId 模型主键
* @param version 版本
* @param version 版本
* @return 删除是否成功
*/
@DeleteMapping("/deleteVersion")
@ApiOperation(value = "逻辑删除模型版本", notes = "根据数据集ID和版本逻辑删除模型版本记录。")
public AjaxResult deleteDatasetVersion(@RequestParam("dataset_id") Integer datasetId,
@RequestParam("version") String version) {
return AjaxResult.success(this.datasetVersionService.deleteDatasetVersion(datasetId, version));
public GenericsAjaxResult<Map<Integer, String>> deleteDatasetVersion(@RequestParam("dataset_id") Integer datasetId,
@RequestParam("version") String version) {
return genericsSuccess(this.datasetVersionService.deleteDatasetVersion(datasetId, version));
}

}


+ 26
- 21
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentController.java View File

@@ -1,12 +1,16 @@
package com.ruoyi.platform.controller.experiment;


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.domain.Experiment;
import com.ruoyi.platform.service.ExperimentService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@@ -21,7 +25,7 @@ import java.io.IOException;
@RestController
@RequestMapping("experiment")
@Api("实验管理")
public class ExperimentController {
public class ExperimentController extends BaseController {
/**
* 服务对象
*/
@@ -36,22 +40,23 @@ public class ExperimentController {
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(Experiment experiment, int page,int size) {
public GenericsAjaxResult<Page<Experiment>> queryByPage(Experiment experiment, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.experimentService.queryByPage(experiment, pageRequest));
return genericsSuccess(this.experimentService.queryByPage(experiment, pageRequest));
}

@GetMapping(("/status"))
@GetMapping("/status")
@ApiOperation("查询实验状态")
public AjaxResult selectStatus(@RequestBody Experiment experiment, PageRequest pageRequest) throws IOException {
return AjaxResult.success(this.experimentService.selectStatus(experiment, pageRequest));
public GenericsAjaxResult<Page<Experiment>> selectStatus(@RequestBody Experiment experiment, PageRequest pageRequest) throws IOException {
return genericsSuccess(this.experimentService.selectStatus(experiment, pageRequest));
}



@GetMapping(("/configuration"))
public AjaxResult showExperimentConfig(@RequestBody Experiment experiment){
return AjaxResult.success(this.experimentService.showExperimentConfig(experiment));
@GetMapping("/configuration")
@ApiOperation("查询实验配置参数")
public GenericsAjaxResult<ResponseEntity<Experiment>> showExperimentConfig(@RequestBody Experiment experiment){
return genericsSuccess(this.experimentService.showExperimentConfig(experiment));
}

/**
@@ -62,8 +67,8 @@ public class ExperimentController {
*/
@GetMapping("{id}")
@ApiOperation("通过id查询实验")
public AjaxResult queryById(@PathVariable("id") Integer id) throws IOException {
return AjaxResult.success(this.experimentService.queryById(id));
public GenericsAjaxResult<Experiment> queryById(@PathVariable("id") Integer id) throws IOException {
return genericsSuccess(this.experimentService.queryById(id));
}

/**
@@ -74,8 +79,8 @@ public class ExperimentController {
*/
@PostMapping
@ApiOperation("新增实验")
public AjaxResult add(@RequestBody Experiment experiment) {
return AjaxResult.success(this.experimentService.insert(experiment));
public GenericsAjaxResult<Experiment> add(@RequestBody Experiment experiment) {
return genericsSuccess(this.experimentService.insert(experiment));
}

/**
@@ -86,8 +91,8 @@ public class ExperimentController {
*/
@PutMapping
@ApiOperation("编辑实验")
public AjaxResult edit(@RequestBody Experiment experiment) throws IOException {
return AjaxResult.success(this.experimentService.update(experiment));
public GenericsAjaxResult<Experiment> edit(@RequestBody Experiment experiment) throws IOException {
return genericsSuccess(this.experimentService.update(experiment));
}

/**
@@ -98,8 +103,8 @@ public class ExperimentController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除流水线")
public AjaxResult deleteById(@PathVariable("id") Integer id) throws Exception {
return AjaxResult.success(this.experimentService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) throws Exception {
return genericsSuccess(this.experimentService.removeById(id));
}


@@ -114,8 +119,8 @@ public class ExperimentController {
*/
@PutMapping("/experiments/{id}")
@ApiOperation("运行实验")
public AjaxResult runExperiment(@PathVariable("id") Integer id) throws Exception {
return AjaxResult.success(this.experimentService.runExperiment(id));
public GenericsAjaxResult<Experiment> runExperiment(@PathVariable("id") Integer id) throws Exception {
return genericsSuccess(this.experimentService.runExperiment(id));
}

/**
@@ -126,8 +131,8 @@ public class ExperimentController {
*/
@PostMapping("/addAndRunExperiment")
@ApiOperation("实验创建页面确定并运行")
public AjaxResult addAndRunExperiment(@RequestBody Experiment experiment) {
return AjaxResult.success(this.experimentService.addAndRunExperiment(experiment));
public GenericsAjaxResult<Experiment> addAndRunExperiment(@RequestBody Experiment experiment) {
return genericsSuccess(this.experimentService.addAndRunExperiment(experiment));
}
}


+ 54
- 28
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/experiment/ExperimentInsController.java View File

@@ -1,17 +1,20 @@
package com.ruoyi.platform.controller.experiment;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.ExperimentIns;
import com.ruoyi.platform.service.ExperimentInsService;
import com.ruoyi.platform.vo.LogRequestVo;
import com.ruoyi.platform.vo.PodLogVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.ws.rs.POST;
import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
@@ -23,7 +26,7 @@ import java.util.Map;
@RestController
@RequestMapping("experimentIns")
@Api("实验实例管理")
public class ExperimentInsController {
public class ExperimentInsController extends BaseController {
/**
* 服务对象
*/
@@ -38,9 +41,9 @@ public class ExperimentInsController {
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(ExperimentIns experimentIns, int page, int size) throws IOException {
public GenericsAjaxResult<Page<ExperimentIns>> queryByPage(ExperimentIns experimentIns, int page, int size) throws IOException {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.experimentInsService.queryByPage(experimentIns, pageRequest));
return genericsSuccess(this.experimentInsService.queryByPage(experimentIns, pageRequest));
}

/**
@@ -51,8 +54,8 @@ public class ExperimentInsController {
*/
@GetMapping("{id}")
@ApiOperation("通过id查询实验实例")
public AjaxResult queryById(@PathVariable("id") Integer id) throws IOException {
return AjaxResult.success(this.experimentInsService.queryById(id));
public GenericsAjaxResult<ExperimentIns> queryById(@PathVariable("id") Integer id) throws IOException {
return genericsSuccess(this.experimentInsService.queryById(id));
}

/**
@@ -63,8 +66,8 @@ public class ExperimentInsController {
*/
@GetMapping("/queryByExperimentId/{Experiment_id}")
@ApiOperation("通过实验id查询查询实验实例列表")
public AjaxResult queryByExperimentId(@PathVariable("Experiment_id") Integer experimentId) throws IOException {
return AjaxResult.success(this.experimentInsService.getByExperimentId(experimentId));
public GenericsAjaxResult<List<ExperimentIns>> queryByExperimentId(@PathVariable("Experiment_id") Integer experimentId) throws IOException {
return genericsSuccess(this.experimentInsService.getByExperimentId(experimentId));
}

/**
@@ -75,8 +78,8 @@ public class ExperimentInsController {
*/
@PostMapping
@ApiOperation("新增实验实例")
public AjaxResult add(@RequestBody ExperimentIns experimentIns) {
return AjaxResult.success(this.experimentInsService.insert(experimentIns));
public GenericsAjaxResult<ExperimentIns> add(@RequestBody ExperimentIns experimentIns) {
return genericsSuccess(this.experimentInsService.insert(experimentIns));
}

/**
@@ -87,8 +90,8 @@ public class ExperimentInsController {
*/
@PutMapping
@ApiOperation("编辑实验实例")
public AjaxResult edit(@RequestBody ExperimentIns experimentIns) throws IOException {
return AjaxResult.success(this.experimentInsService.update(experimentIns));
public GenericsAjaxResult<ExperimentIns> edit(@RequestBody ExperimentIns experimentIns) throws IOException {
return genericsSuccess(this.experimentInsService.update(experimentIns));
}

/**
@@ -99,8 +102,8 @@ public class ExperimentInsController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除实验实例")
public AjaxResult deleteById( @PathVariable("id") Integer id) {
return AjaxResult.success(this.experimentInsService.removeById(id));
public GenericsAjaxResult<String> deleteById( @PathVariable("id") Integer id) {
return genericsSuccess(this.experimentInsService.removeById(id));
}

/**
@@ -111,8 +114,8 @@ public class ExperimentInsController {
*/
@PutMapping("{id}")
@ApiOperation("终止实验实例")
public AjaxResult terminateExperimentIns(@PathVariable("id") Integer id) {
return AjaxResult.success(this.experimentInsService.terminateExperimentIns(id));
public GenericsAjaxResult<Boolean> terminateExperimentIns(@PathVariable("id") Integer id) {
return genericsSuccess(this.experimentInsService.terminateExperimentIns(id));
}

/**
@@ -121,36 +124,59 @@ public class ExperimentInsController {
* @return 运行日志
*/

@GetMapping(("/log"))
@GetMapping("/log")
@ApiOperation("查询实例日志")
public AjaxResult showExperimentInsLog(@RequestParam("id") Integer id,
public GenericsAjaxResult<String> showExperimentInsLog(@RequestParam("id") Integer id,
@RequestParam("component_id") String componentId){
return AjaxResult.success(this.experimentInsService.showExperimentInsLog(id,componentId));
return genericsSuccess(this.experimentInsService.showExperimentInsLog(id,componentId));
}

/**
* 查询实验实时日志
* 查询pods实时日志
*
* @return 运行日志
*/

@PostMapping(("/realTimeLog"))
@ApiOperation("查询实例实时日志")
public AjaxResult getRealtimeWorkflowLog(@RequestBody LogRequestVo logRequest){
return AjaxResult.success(this.experimentInsService.getRealtimeWorkflowLog(logRequest));
@GetMapping("/pods/log")
@ApiOperation("获取pod实时日志请求")
public GenericsAjaxResult<Map<String, Object>> getRealtimePodLog(@RequestParam("pod_name") String podName,
@RequestParam("start_time") String startTime){
return genericsSuccess(this.experimentInsService.getRealtimePodLog(podName,startTime));
}


@PostMapping("/pods/realTimeLog")
@ApiOperation("获取pod实时日志请求")
public GenericsAjaxResult<String> getRealtimePodLogFromPod(@RequestBody PodLogVo podLogVo){
return genericsSuccess(this.experimentInsService.getRealtimePodLogFromPod(podLogVo));
}


/**
* 查询实验实例实时日志
*
* @return 运行日志
*/

@PostMapping("/realTimeLog")
@ApiOperation("查询实验实例实时日志")
public GenericsAjaxResult<Map<String, Object>> getRealtimeWorkflowLog(@RequestBody LogRequestVo logRequest){
return genericsSuccess(this.experimentInsService.getRealtimeWorkflowLog(logRequest));
}





/**
* 查询实验节点结果
*
* @return 运行日志
*/
@GetMapping(("/nodeResult"))
@GetMapping("/nodeResult")
@ApiOperation("查询实例节点结果")
public AjaxResult getNodeResult(@RequestParam("id") Integer id,@RequestParam("node_id") String nodeId) throws Exception {
return AjaxResult.success(this.experimentInsService.getNodeResult(id,nodeId));
public GenericsAjaxResult<List> getNodeResult(@RequestParam("id") Integer id, @RequestParam("node_id") String nodeId) throws Exception {
return genericsSuccess(this.experimentInsService.getNodeResult(id,nodeId));
}

}


+ 20
- 20
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/icon/AssetIconController.java View File

@@ -1,17 +1,17 @@
package com.ruoyi.platform.controller.icon;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.AssetIcon;
import com.ruoyi.platform.domain.Models;
import com.ruoyi.platform.service.AssetIconService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

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

/**
* (AssetIcon)表控制层
@@ -22,7 +22,7 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("assetIcon")
@Api("图标管理")
public class AssetIconController {
public class AssetIconController extends BaseController {
/**
* 服务对象
*/
@@ -33,15 +33,15 @@ public class AssetIconController {
* 分页查询
*
* @param assetIcon 筛选条件
* @param page 分页对象
* @param size 分页对象
* @param page 分页对象
* @param size 分页对象
* @return 查询结果
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(AssetIcon assetIcon, int page, int size) {
public GenericsAjaxResult<Page<AssetIcon>> queryByPage(AssetIcon assetIcon, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.assetIconService.queryByPage(assetIcon, pageRequest));
return genericsSuccess(this.assetIconService.queryByPage(assetIcon, pageRequest));
}

/**
@@ -52,8 +52,8 @@ public class AssetIconController {
*/
@GetMapping("{id}")
@ApiOperation("根据id查询")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.assetIconService.queryById(id));
public GenericsAjaxResult<AssetIcon> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.assetIconService.queryById(id));
}

/**
@@ -64,8 +64,8 @@ public class AssetIconController {
*/
@GetMapping("category/{id}")
@ApiOperation("根据图标类别id查询")
public AjaxResult queryByCategoryId(@PathVariable("id") Integer categoryId) {
return AjaxResult.success(this.assetIconService.queryByCategoryId(categoryId));
public GenericsAjaxResult<List<AssetIcon>> queryByCategoryId(@PathVariable("id") Integer categoryId) {
return genericsSuccess(this.assetIconService.queryByCategoryId(categoryId));


}
@@ -78,8 +78,8 @@ public class AssetIconController {
*/
@GetMapping("name/{name}")
@ApiOperation("按名字模糊查询图标名字")
public AjaxResult queryByName(@PathVariable("name") String name) {
return AjaxResult.success(this.assetIconService.queryByName(name));
public GenericsAjaxResult<List<AssetIcon>> queryByName(@PathVariable("name") String name) {
return genericsSuccess(this.assetIconService.queryByName(name));
}

/**
@@ -90,8 +90,8 @@ public class AssetIconController {
*/
@PostMapping
@ApiOperation("新增图标")
public AjaxResult add(@RequestBody AssetIcon assetIcon) {
return AjaxResult.success(this.assetIconService.insert(assetIcon));
public GenericsAjaxResult<AssetIcon> add(@RequestBody AssetIcon assetIcon) {
return genericsSuccess(this.assetIconService.insert(assetIcon));
}

/**
@@ -102,8 +102,8 @@ public class AssetIconController {
*/
@PutMapping
@ApiOperation("更新图标")
public AjaxResult edit(@RequestBody AssetIcon assetIcon) {
return AjaxResult.success(this.assetIconService.update(assetIcon));
public GenericsAjaxResult<AssetIcon> edit(@RequestBody AssetIcon assetIcon) {
return genericsSuccess(this.assetIconService.update(assetIcon));
}

/**
@@ -114,8 +114,8 @@ public class AssetIconController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除图标")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.assetIconService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.assetIconService.removeById(id));
}

}


+ 30
- 33
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/image/ImageController.java View File

@@ -1,20 +1,19 @@
package com.ruoyi.platform.controller.image;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.Image;
import com.ruoyi.platform.domain.Models;
import com.ruoyi.platform.service.ImageService;
import com.ruoyi.platform.vo.DatasetVo;
import com.ruoyi.platform.vo.ImageVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

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

/**
* (Image)表控制层
@@ -25,7 +24,7 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("image")
@Api("镜像管理")
public class ImageController {
public class ImageController extends BaseController {
/**
* 服务对象
*/
@@ -36,15 +35,15 @@ public class ImageController {
* 分页查询
*
* @param image 筛选条件
* @param page 分页对象
* @param size 分页对象
* @param page 分页对象
* @param size 分页对象
* @return 查询结果
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(Image image, int page, int size) {
public GenericsAjaxResult<Page<Image>> queryByPage(Image image, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.imageService.queryByPage(image, pageRequest));
return genericsSuccess(this.imageService.queryByPage(image, pageRequest));
}

/**
@@ -55,8 +54,8 @@ public class ImageController {
*/
@GetMapping("{id}")
@ApiOperation("按id查询镜像")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.imageService.queryById(id));
public GenericsAjaxResult<Image> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.imageService.queryById(id));
}

/**
@@ -67,8 +66,8 @@ public class ImageController {
*/
@GetMapping("name/{name}")
@ApiOperation("按名字模糊查询镜像")
public AjaxResult queryByName(@PathVariable("name") String name) {
return AjaxResult.success(this.imageService.queryByName(name));
public GenericsAjaxResult<Page<Image>> queryByName(@PathVariable("name") String name) {
return genericsSuccess(this.imageService.queryByName(name));
}
/**
* 新增数据
@@ -78,8 +77,8 @@ public class ImageController {
*/
@PostMapping
@ApiOperation("新增镜像")
public AjaxResult add(@RequestBody Image image) {
return AjaxResult.success(this.imageService.insert(image));
public GenericsAjaxResult<Image> add(@RequestBody Image image) {
return genericsSuccess(this.imageService.insert(image));
}

/**
@@ -90,8 +89,8 @@ public class ImageController {
*/
@PostMapping("/addImageAndVersion")
@ApiOperation("添加镜像和版本")
public AjaxResult addImageAndVersion(@RequestBody ImageVo imageVo) throws Exception {
return AjaxResult.success(this.imageService.insertImageAndVersion(imageVo));
public GenericsAjaxResult<String> addImageAndVersion(@RequestBody ImageVo imageVo) throws Exception {
return genericsSuccess(this.imageService.insertImageAndVersion(imageVo));

}

@@ -102,36 +101,35 @@ public class ImageController {
* @return 编辑结果
*/
@PutMapping
public AjaxResult edit(@RequestBody Image image) {
return AjaxResult.success(this.imageService.update(image));
public GenericsAjaxResult<Image> edit(@RequestBody Image image) {
return genericsSuccess(this.imageService.update(image));
}

/**
* 删除数据
*
* @param id 主键
*
* @return 删除是否成功
*/
@DeleteMapping("{id}")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.imageService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.imageService.removeById(id));
}

@PostMapping("/net")
@ApiOperation("从本地上传构建镜像")
public AjaxResult createImageFromNet(@RequestParam("name") String imageName,
@RequestParam("tag") String imageTag,
@RequestParam("path") String path) throws Exception {
return AjaxResult.success(this.imageService.createImageFromNet(imageName,imageTag,path));
public GenericsAjaxResult<String> createImageFromNet(@RequestParam("name") String imageName,
@RequestParam("tag") String imageTag,
@RequestParam("path") String path) throws Exception {
return genericsSuccess(this.imageService.createImageFromNet(imageName,imageTag,path));
}

@PostMapping("/local")
@ApiOperation("从本地上传构建镜像")
public AjaxResult createImageFromLocal(@RequestParam("name") String imageName,
@RequestParam("tag") String imageTag,
@RequestParam("path") String path) throws Exception {
return AjaxResult.success(this.imageService.createImageFromLocal(imageName,imageTag,path));
public GenericsAjaxResult<String> createImageFromLocal(@RequestParam("name") String imageName,
@RequestParam("tag") String imageTag,
@RequestParam("path") String path) throws Exception {
return genericsSuccess(this.imageService.createImageFromLocal(imageName,imageTag,path));
}


@@ -139,13 +137,12 @@ public class ImageController {
/**
* 镜像上传
*
*
* @return 上传结果
*/
@PostMapping("/upload")
@ApiOperation(value = "上传镜像文件", notes = "上传镜像tar包,返回存储路径")
public AjaxResult uploadImageFiles(@RequestParam("file") MultipartFile file) throws Exception {
return AjaxResult.success(this.imageService.uploadImageFiles(file));
public GenericsAjaxResult<Map<String, String>> uploadImageFiles(@RequestParam("file") MultipartFile file) throws Exception {
return genericsSuccess(this.imageService.uploadImageFiles(file));
}

}


+ 15
- 16
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/image/ImageVersionController.java View File

@@ -1,13 +1,12 @@
package com.ruoyi.platform.controller.image;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.platform.domain.Image;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.ImageVersion;
import com.ruoyi.platform.service.ImageVersionService;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@@ -20,7 +19,7 @@ import javax.annotation.Resource;
*/
@RestController
@RequestMapping("imageVersion")
public class ImageVersionController {
public class ImageVersionController extends BaseController {
/**
* 服务对象
*/
@@ -31,15 +30,15 @@ public class ImageVersionController {
* 分页查询
*
* @param imageVersion 筛选条件
* @param page 分页对象
* @param size 分页对象
* @param page 分页对象
* @param size 分页对象
* @return 查询结果
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(ImageVersion imageVersion, int page, int size) {
public GenericsAjaxResult<Page<ImageVersion>> queryByPage(ImageVersion imageVersion, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.imageVersionService.queryByPage(imageVersion, pageRequest));
return genericsSuccess(this.imageVersionService.queryByPage(imageVersion, pageRequest));
}

/**
@@ -49,8 +48,8 @@ public class ImageVersionController {
* @return 单条数据
*/
@GetMapping("{id}")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.imageVersionService.queryById(id));
public GenericsAjaxResult<ImageVersion> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.imageVersionService.queryById(id));
}

/**
@@ -60,8 +59,8 @@ public class ImageVersionController {
* @return 新增结果
*/
@PostMapping
public AjaxResult add(@RequestBody ImageVersion imageVersion) {
return AjaxResult.success(this.imageVersionService.insert(imageVersion));
public GenericsAjaxResult<ImageVersion> add(@RequestBody ImageVersion imageVersion) {
return genericsSuccess(this.imageVersionService.insert(imageVersion));
}

/**
@@ -71,8 +70,8 @@ public class ImageVersionController {
* @return 编辑结果
*/
@PutMapping
public AjaxResult edit(@RequestBody ImageVersion imageVersion) {
return AjaxResult.success(this.imageVersionService.update(imageVersion));
public GenericsAjaxResult<ImageVersion> edit(@RequestBody ImageVersion imageVersion) {
return genericsSuccess(this.imageVersionService.update(imageVersion));
}

/**
@@ -82,8 +81,8 @@ public class ImageVersionController {
* @return 删除是否成功
*/
@DeleteMapping("{id}")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.imageVersionService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.imageVersionService.removeById(id));
}

}


+ 3
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/jupyter/JupyterController.java View File

@@ -2,6 +2,7 @@ package com.ruoyi.platform.controller.jupyter;

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.JupyterService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@@ -23,8 +24,8 @@ public class JupyterController extends BaseController {
private JupyterService jupyterService;
@GetMapping(value = "/getURL")
@ApiOperation("得到访问地址")
public AjaxResult getURL() throws IOException {
return AjaxResult.success(jupyterService.getJupyterServiceUrl());
public GenericsAjaxResult<String> getURL() throws IOException {
return genericsSuccess(jupyterService.getJupyterServiceUrl());
}

@GetMapping(value = "/upload")


+ 34
- 34
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsController.java View File

@@ -1,26 +1,26 @@
package com.ruoyi.platform.controller.model;


import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.platform.domain.Dataset;
import com.ruoyi.platform.domain.Models;
import com.ruoyi.platform.domain.ModelsVersion;
import com.ruoyi.platform.service.ModelsService;
import com.ruoyi.platform.vo.DatasetVo;
import com.ruoyi.platform.vo.ModelsVo;
import com.ruoyi.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.core.io.InputStreamResource;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* (Models)表控制层
@@ -31,7 +31,7 @@ import java.util.List;
@RestController
@RequestMapping("models")
@Api("模型管理")
public class ModelsController {
public class ModelsController extends BaseController {
/**
* 服务对象
*/
@@ -48,11 +48,11 @@ public class ModelsController {
*/
@GetMapping
@ApiOperation("模型广场分页查询,可传model_type进行筛选")
public AjaxResult queryByPage(Models models, @RequestParam("page") int page,
@RequestParam("size") int size,
//@RequestParam("available_range") int availableRange,
@RequestParam(value = "model_type", required = false) String modelType,
@RequestParam(value = "model_tag", required = false) String modelTag) {
public GenericsAjaxResult<Page<Models>> queryByPage(Models models, @RequestParam("page") int page,
@RequestParam("size") int size,
//@RequestParam("available_range") int availableRange,
@RequestParam(value = "model_type", required = false) String modelType,
@RequestParam(value = "model_tag", required = false) String modelTag) {
if (modelType != null){
models.setModelType(modelType); // 设置筛选条件
}
@@ -61,7 +61,7 @@ public class ModelsController {
}
models.setAvailableRange(1); // 设置筛选条件
PageRequest pageRequest = PageRequest.of(page, size);
return AjaxResult.success(this.modelsService.queryByPage(models, pageRequest));
return genericsSuccess(this.modelsService.queryByPage(models, pageRequest));
}


@@ -75,10 +75,10 @@ public class ModelsController {
*/
@GetMapping("/personalModels")
@ApiOperation("分页查询当前用户的个人模型 ,根据model_type筛选")
public AjaxResult queryByPagePersonal(Models models, @RequestParam("page") int page,
@RequestParam("size") int size,
@RequestParam(value = "model_type", required = false) String modelType,
@RequestParam(value = "model_tag", required = false) String modelTag) {
public GenericsAjaxResult<Page<Models>> queryByPagePersonal(Models models, @RequestParam("page") int page,
@RequestParam("size") int size,
@RequestParam(value = "model_type", required = false) String modelType,
@RequestParam(value = "model_tag", required = false) String modelTag) {
// 获取当前用户的认证信息
LoginUser loginUser = SecurityUtils.getLoginUser();
// 设置筛选条件
@@ -90,7 +90,7 @@ public class ModelsController {
models.setModelTag(modelTag); // 设置筛选条件
}
PageRequest pageRequest = PageRequest.of(page, size);
return AjaxResult.success(this.modelsService.queryByPage(models, pageRequest));
return genericsSuccess(this.modelsService.queryByPage(models, pageRequest));
}


@@ -102,14 +102,14 @@ public class ModelsController {
*/
@GetMapping("{id}")
@ApiOperation("根据id查询")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.modelsService.queryById(id));
public GenericsAjaxResult<Models> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.modelsService.queryById(id));
}

@GetMapping("/versions/{modelId}")
@ApiOperation(value = "获取模型的所有版本", notes = "根据模型ID获取该模型的所有版本信息。")
public AjaxResult getModelVersions(@PathVariable("modelId") Integer modelId) throws Exception {
return AjaxResult.success(this.modelsService.getModelVersions(modelId));
public GenericsAjaxResult<List<String>> getModelVersions(@PathVariable("modelId") Integer modelId) throws Exception {
return genericsSuccess(this.modelsService.getModelVersions(modelId));
}


@@ -121,8 +121,8 @@ public class ModelsController {
*/
@PostMapping
@ApiOperation("添加模型")
public AjaxResult add(@RequestBody Models models) {
return AjaxResult.success(this.modelsService.insert(models));
public GenericsAjaxResult<Models> add(@RequestBody Models models) {
return genericsSuccess(this.modelsService.insert(models));
}


@@ -134,8 +134,8 @@ public class ModelsController {
*/
@PostMapping("/addModelAndVersion")
@ApiOperation("添加模型和版本")
public AjaxResult addModelAndVersion(@RequestBody ModelsVo modelsVo) throws Exception {
return AjaxResult.success(this.modelsService.insertModelAndVersion(modelsVo));
public GenericsAjaxResult<String> addModelAndVersion(@RequestBody ModelsVo modelsVo) throws Exception {
return genericsSuccess(this.modelsService.insertModelAndVersion(modelsVo));

}

@@ -147,8 +147,8 @@ public class ModelsController {
*/
@PutMapping
@ApiOperation("编辑模型")
public AjaxResult edit(@RequestBody Models models) {
return AjaxResult.success(this.modelsService.update(models));
public GenericsAjaxResult<Models> edit(@RequestBody Models models) {
return genericsSuccess(this.modelsService.update(models));
}

/**
@@ -159,8 +159,8 @@ public class ModelsController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除模型")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.modelsService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.modelsService.removeById(id));
}

/**
@@ -176,8 +176,8 @@ public class ModelsController {
@CrossOrigin(origins = "*", allowedHeaders = "*")
@PostMapping("/upload")
@ApiOperation(value = "上传模型", notes = "根据模型id上传模型文件,并将信息存入数据库。")
public AjaxResult uploadModels(@RequestParam("file") MultipartFile[] files) throws Exception {
return AjaxResult.success(this.modelsService.uploadModels(files));
public GenericsAjaxResult<List<Map<String, String>>> uploadModels(@RequestParam("file") MultipartFile[] files) throws Exception {
return genericsSuccess(this.modelsService.uploadModels(files));

}

@@ -187,8 +187,8 @@ public class ModelsController {
*/
@PostMapping("/upload_pipeline")
@ApiOperation("从流水线上传模型,并将信息存入数据库")
public AjaxResult uploadModelsPipeline(@RequestBody(required =false) ModelsVersion modelsVersion) throws Exception {
return AjaxResult.success(this.modelsService.uploadModelsPipeline(modelsVersion));
public GenericsAjaxResult<Map> uploadModelsPipeline(@RequestBody(required =false) ModelsVersion modelsVersion) throws Exception {
return genericsSuccess(this.modelsService.uploadModelsPipeline(modelsVersion));
}

/**
@@ -220,8 +220,8 @@ public class ModelsController {

@GetMapping("/readme")
@ApiOperation(value = "读取README文件", notes = "读取README文件并返回String类型。")
public AjaxResult readFileContent(@RequestParam("models_id") Integer modelsId, @RequestParam("version") String version) throws Exception {
return AjaxResult.success(this.modelsService.readFileContent(modelsId,version));
public GenericsAjaxResult<String> readFileContent(@RequestParam("models_id") Integer modelsId, @RequestParam("version") String version) throws Exception {
return genericsSuccess(this.modelsService.readFileContent(modelsId,version));

}



+ 24
- 21
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsVersionController.java View File

@@ -1,16 +1,18 @@
package com.ruoyi.platform.controller.model;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.*;
import com.ruoyi.platform.service.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
* (ModelsVersion)表控制层
@@ -20,7 +22,8 @@ import java.util.List;
*/
@RestController
@RequestMapping("modelsVersion")
public class ModelsVersionController {
@Api("模型版本管理")
public class ModelsVersionController extends BaseController {
/**
* 服务对象
*/
@@ -37,9 +40,9 @@ public class ModelsVersionController {
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(ModelsVersion modelsVersion, int page, int size) {
public GenericsAjaxResult<Page<ModelsVersion>> queryByPage(ModelsVersion modelsVersion, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.modelsVersionService.queryByPage(modelsVersion, pageRequest));
return genericsSuccess(this.modelsVersionService.queryByPage(modelsVersion, pageRequest));
}

/**
@@ -49,8 +52,8 @@ public class ModelsVersionController {
* @return 单条数据
*/
@GetMapping("{id}")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.modelsVersionService.queryById(id));
public GenericsAjaxResult<ModelsVersion> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.modelsVersionService.queryById(id));
}

/**
@@ -61,9 +64,9 @@ public class ModelsVersionController {
* @return 匹配的模型版本记录列表
*/
@GetMapping("/versions")
public AjaxResult queryByModelsIdAndVersion(@RequestParam("models_id") Integer modelsId,
@RequestParam("version") String version) {
return AjaxResult.success(this.modelsVersionService.queryByModelsIdAndVersion(modelsId, version));
public GenericsAjaxResult<List<ModelsVersion>> queryByModelsIdAndVersion(@RequestParam("models_id") Integer modelsId,
@RequestParam("version") String version) {
return genericsSuccess(this.modelsVersionService.queryByModelsIdAndVersion(modelsId, version));
}


@@ -74,8 +77,8 @@ public class ModelsVersionController {
* @return 新增结果
*/
@PostMapping
public AjaxResult add(@RequestBody ModelsVersion modelsVersion) {
return AjaxResult.success(this.modelsVersionService.insert(modelsVersion));
public GenericsAjaxResult<ModelsVersion> add(@RequestBody ModelsVersion modelsVersion) {
return genericsSuccess(this.modelsVersionService.insert(modelsVersion));
}

/**
@@ -86,8 +89,8 @@ public class ModelsVersionController {
*/
@PostMapping("/addModelVersions")
@ApiOperation("批量添加模型版本,传数组")
public AjaxResult addModelVersions(@RequestBody List<ModelsVersion> modelsVersions) throws Exception {
return AjaxResult.success(this.modelsVersionService.addModelVersions(modelsVersions));
public GenericsAjaxResult<String> addModelVersions(@RequestBody List<ModelsVersion> modelsVersions) throws Exception {
return genericsSuccess(this.modelsVersionService.addModelVersions(modelsVersions));
}

/**
@@ -97,8 +100,8 @@ public class ModelsVersionController {
* @return 编辑结果
*/
@PutMapping
public AjaxResult edit(@RequestBody ModelsVersion modelsVersion) {
return AjaxResult.success(this.modelsVersionService.update(modelsVersion));
public GenericsAjaxResult<ModelsVersion> edit(@RequestBody ModelsVersion modelsVersion) {
return genericsSuccess(this.modelsVersionService.update(modelsVersion));
}

/**
@@ -108,8 +111,8 @@ public class ModelsVersionController {
* @return 删除是否成功
*/
@DeleteMapping("{id}")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.modelsVersionService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.modelsVersionService.removeById(id));
}


@@ -123,9 +126,9 @@ public class ModelsVersionController {
*/
@DeleteMapping("/deleteVersion")
@ApiOperation(value = "逻辑删除模型版本", notes = "根据模型ID和版本逻辑删除模型版本记录。")
public AjaxResult deleteModelsVersion(@RequestParam("models_id") Integer modelsId,
@RequestParam("version") String version) {
return AjaxResult.success(this.modelsVersionService.deleteModelsVersion(modelsId, version));
public GenericsAjaxResult<Map<Integer, String>> deleteModelsVersion(@RequestParam("models_id") Integer modelsId,
@RequestParam("version") String version) {
return genericsSuccess(this.modelsVersionService.deleteModelsVersion(modelsId, version));
}

}


+ 14
- 12
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/resources/ComputingResourceController.java View File

@@ -1,10 +1,12 @@
package com.ruoyi.platform.controller.resources;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.ComputingResource;
import com.ruoyi.platform.service.ComputingResourceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.*;

@@ -19,7 +21,7 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("computingResource")
@Api("计算资源管理")
public class ComputingResourceController {
public class ComputingResourceController extends BaseController {
/**
* 服务对象
*/
@@ -34,9 +36,9 @@ public class ComputingResourceController {
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(ComputingResource computingResource, int page, int size) {
public GenericsAjaxResult<Page<ComputingResource>> queryByPage(ComputingResource computingResource, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.computingResourceService.queryByPage(computingResource, pageRequest));
return genericsSuccess(this.computingResourceService.queryByPage(computingResource, pageRequest));
}

/**
@@ -47,8 +49,8 @@ public class ComputingResourceController {
*/
@GetMapping("{id}")
@ApiOperation("根据id查询")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.computingResourceService.queryById(id));
public GenericsAjaxResult<ComputingResource> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.computingResourceService.queryById(id));
}

/**
@@ -59,8 +61,8 @@ public class ComputingResourceController {
*/
@PostMapping
@ApiOperation("新增计算资源")
public AjaxResult add(@RequestBody ComputingResource computingResource) {
return AjaxResult.success(this.computingResourceService.insert(computingResource));
public GenericsAjaxResult<ComputingResource> add(@RequestBody ComputingResource computingResource) {
return genericsSuccess(this.computingResourceService.insert(computingResource));
}

/**
@@ -71,8 +73,8 @@ public class ComputingResourceController {
*/
@PutMapping
@ApiOperation("编辑计算资源")
public AjaxResult edit(@RequestBody ComputingResource computingResource) {
return AjaxResult.success(this.computingResourceService.update(computingResource));
public GenericsAjaxResult<ComputingResource> edit(@RequestBody ComputingResource computingResource) {
return genericsSuccess(this.computingResourceService.update(computingResource));
}

/**
@@ -83,8 +85,8 @@ public class ComputingResourceController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除计算资源")
public AjaxResult deleteById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.computingResourceService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Integer id) {
return genericsSuccess(this.computingResourceService.removeById(id));
}

}


+ 42
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/tensorBoard/TensorBoardController.java View File

@@ -0,0 +1,42 @@
package com.ruoyi.platform.controller.tensorBoard;

import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.service.TensorBoardService;
import com.ruoyi.platform.vo.FrameLogPathVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.responses.ApiResponse;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("tensorBoard")
@Api("TensorBoard管理")
public class TensorBoardController extends BaseController {

@Resource
private TensorBoardService tensorBoardService;

/**
* 启动tensorBoard接口
*
* @param frameLogPathVo 存储路径
* @return url
*/
@PostMapping("/run")
@ApiOperation("启动tensorBoard")
@ApiResponse
public GenericsAjaxResult<String> runTensorBoard(@RequestBody FrameLogPathVo frameLogPathVo) throws Exception {
return genericsSuccess(tensorBoardService.runTensorBoard(frameLogPathVo));
}
@PostMapping("/getStatus")
@ApiResponse
public GenericsAjaxResult<String> getStatus(@RequestBody FrameLogPathVo frameLogPathVo) throws Exception {
return genericsSuccess(tensorBoardService.getTensorBoardStatus(frameLogPathVo));
}
}

+ 0
- 15
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/tensorBoard/tensorBoard.java View File

@@ -1,15 +0,0 @@
package com.ruoyi.platform.controller.tensorBoard;

import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("tensorBoard")
@Api("流水线管理")
public class tensorBoard {

//状态查询接口

//启动tensorBoard接口
}

+ 19
- 17
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowController.java View File

@@ -1,10 +1,12 @@
package com.ruoyi.platform.controller.workflow;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.Workflow;
import com.ruoyi.platform.service.WorkflowService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.web.bind.annotation.*;

@@ -19,7 +21,7 @@ import javax.annotation.Resource;
@RestController
@RequestMapping("workflow")
@Api("流水线管理")
public class WorkflowController {
public class WorkflowController extends BaseController {



@@ -39,9 +41,9 @@ public class WorkflowController {
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(Workflow workflow, int page,int size) {
public GenericsAjaxResult<Page<Workflow>> queryByPage(Workflow workflow, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.workflowService.queryByPage(workflow, pageRequest));
return genericsSuccess(this.workflowService.queryByPage(workflow, pageRequest));
}


@@ -53,8 +55,8 @@ public class WorkflowController {
*/
@GetMapping("name/{name}")
@ApiOperation("按流水线名字模糊查询流水线")
public AjaxResult queryByName(@PathVariable("name") String name) {
return AjaxResult.success(this.workflowService.queryByName(name));
public GenericsAjaxResult<Page<Workflow>> queryByName(@PathVariable("name") String name) {
return genericsSuccess(this.workflowService.queryByName(name));
}

/**
@@ -65,8 +67,8 @@ public class WorkflowController {
*/
@GetMapping("{id}")
@ApiOperation("根据id查询单条数据")
public AjaxResult queryById(@PathVariable("id") Long id) {
return AjaxResult.success(this.workflowService.queryById(id));
public GenericsAjaxResult<Workflow> queryById(@PathVariable("id") Long id) {
return genericsSuccess(this.workflowService.queryById(id));
}

/**
@@ -77,8 +79,8 @@ public class WorkflowController {
*/
@PostMapping
@ApiOperation("新增流水线")
public AjaxResult add(@RequestBody Workflow workflow) {
return AjaxResult.success(this.workflowService.insert(workflow));
public GenericsAjaxResult<Workflow> add(@RequestBody Workflow workflow) {
return genericsSuccess(this.workflowService.insert(workflow));
}


@@ -90,8 +92,8 @@ public class WorkflowController {
*/
@ApiOperation("复制流水线记录")
@PostMapping("duplicate/{id}")
public AjaxResult duplicateWorkflow(@PathVariable("id") Long id) {
return AjaxResult.success(this.workflowService.duplicateWorkflow(id));
public GenericsAjaxResult<Workflow> duplicateWorkflow(@PathVariable("id") Long id) {
return genericsSuccess(this.workflowService.duplicateWorkflow(id));
}

/**
@@ -102,7 +104,7 @@ public class WorkflowController {
// @ApiOperation("流水线保存")
// @PutMapping("/saveWorkflow/{id}")
// public ResponseEntity<Workflow> saveWorkflow(@PathVariable("id") Long id) {
// return AjaxResult.success(this.workflowService.saveWorkflow(id));
// return genericsSuccess(this.workflowService.saveWorkflow(id));
// }


@@ -114,8 +116,8 @@ public class WorkflowController {
*/
@PutMapping
@ApiOperation("编辑流水线")
public AjaxResult edit(@RequestBody Workflow workflow) {
return AjaxResult.success(this.workflowService.update(workflow));
public GenericsAjaxResult<Workflow> edit(@RequestBody Workflow workflow) {
return genericsSuccess(this.workflowService.update(workflow));
}

/**
@@ -129,8 +131,8 @@ public class WorkflowController {
*/
@DeleteMapping("{id}")
@ApiOperation("删除流水线")
public AjaxResult deleteById(@PathVariable("id") Long id) throws Exception {
return AjaxResult.success(this.workflowService.removeById(id));
public GenericsAjaxResult<String> deleteById(@PathVariable("id") Long id) throws Exception {
return genericsSuccess(this.workflowService.removeById(id));
}

}


+ 16
- 14
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/workflow/WorkflowParamController.java View File

@@ -1,12 +1,13 @@
package com.ruoyi.platform.controller.workflow;

import com.ruoyi.common.core.web.domain.AjaxResult;
import com.ruoyi.common.core.web.controller.BaseController;
import com.ruoyi.common.core.web.domain.GenericsAjaxResult;
import com.ruoyi.platform.domain.WorkflowParam;
import com.ruoyi.platform.service.WorkflowParamService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
@@ -19,7 +20,8 @@ import javax.annotation.Resource;
*/
@RestController
@RequestMapping("workflowParam")
public class WorkflowParamController {
@Api("流水线参数管理")
public class WorkflowParamController extends BaseController {
/**
* 服务对象
*/
@@ -34,9 +36,9 @@ public class WorkflowParamController {
*/
@GetMapping
@ApiOperation("分页查询")
public AjaxResult queryByPage(WorkflowParam workflowParam, int page, int size) {
public GenericsAjaxResult<Page<WorkflowParam>> queryByPage(WorkflowParam workflowParam, int page, int size) {
PageRequest pageRequest = PageRequest.of(page,size);
return AjaxResult.success(this.workflowParamService.queryByPage(workflowParam, pageRequest));
return genericsSuccess(this.workflowParamService.queryByPage(workflowParam, pageRequest));
}

/**
@@ -47,8 +49,8 @@ public class WorkflowParamController {
*/
@GetMapping("{id}")
@ApiOperation("根据id查询单条数据")
public AjaxResult queryById(@PathVariable("id") Integer id) {
return AjaxResult.success(this.workflowParamService.queryById(id));
public GenericsAjaxResult<WorkflowParam> queryById(@PathVariable("id") Integer id) {
return genericsSuccess(this.workflowParamService.queryById(id));
}
/**
* 新增数据
@@ -58,8 +60,8 @@ public class WorkflowParamController {
*/
@PostMapping
@ApiOperation("新增流水线参数")
public AjaxResult add(WorkflowParam workflowParam) throws Exception {
return AjaxResult.success(this.workflowParamService.insert(workflowParam));
public GenericsAjaxResult<WorkflowParam> add(WorkflowParam workflowParam) throws Exception {
return genericsSuccess(this.workflowParamService.insert(workflowParam));
}

/**
@@ -70,8 +72,8 @@ public class WorkflowParamController {
*/
@PutMapping
@ApiOperation("编辑流水线参数")
public AjaxResult edit(WorkflowParam workflowParam) {
return AjaxResult.success(this.workflowParamService.update(workflowParam));
public GenericsAjaxResult<WorkflowParam> edit(WorkflowParam workflowParam) {
return genericsSuccess(this.workflowParamService.update(workflowParam));
}

/**
@@ -82,8 +84,8 @@ public class WorkflowParamController {
*/
@DeleteMapping
@ApiOperation("删除流水线参数")
public AjaxResult deleteById(Integer id) {
return AjaxResult.success(this.workflowParamService.removeById(id));
public GenericsAjaxResult<String> deleteById(Integer id) {
return genericsSuccess(this.workflowParamService.removeById(id));
}

}


+ 4
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/Experiment.java View File

@@ -4,9 +4,11 @@ import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.ruoyi.common.core.web.domain.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
@@ -20,6 +22,7 @@ import java.util.List;
* @since 2023-11-07 15:08:22
*/
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@ApiModel("实验对象")
public class Experiment implements Serializable {
private static final long serialVersionUID = 409135817108439880L;
// @ApiModelProperty(name = "id")
@@ -32,6 +35,7 @@ public class Experiment implements Serializable {
* 全局参数
*/
@ApiModelProperty(name = "global_param")
@JsonRawValue
private String globalParam;

private String statusList;


+ 21
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ExperimentIns.java View File

@@ -1,7 +1,9 @@
package com.ruoyi.platform.domain;

import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;
@@ -14,6 +16,7 @@ import java.util.Date;
* @since 2023-11-09 09:48:36
*/
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@ApiModel("实验实例对象")
public class ExperimentIns implements Serializable {
private static final long serialVersionUID = 623464560240790680L;
@ApiModelProperty(name = "id")
@@ -45,6 +48,16 @@ public class ExperimentIns implements Serializable {
@ApiModelProperty(name = "nodes_logs")
private String nodesLogs;



/**
* 实验实例全局参数
*/
// @ApiModelProperty(name = "global_param")

@JsonRawValue
private String globalParam;

/**
* 开始时间
*/
@@ -153,6 +166,14 @@ public class ExperimentIns implements Serializable {
this.nodesLogs = nodesLogs;
}

public String getGlobalParam() {
return globalParam;
}

public void setGlobalParam(String globalParam) {
this.globalParam = globalParam;
}

public void setStartTime(Date startTime) {
this.startTime = startTime;
}


+ 2
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/Models.java View File

@@ -2,6 +2,7 @@ package com.ruoyi.platform.domain;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
@@ -14,6 +15,7 @@ import java.io.Serializable;
* @since 2023-11-28 16:24:19
*/
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@ApiModel("模型对象")
public class Models implements Serializable {
private static final long serialVersionUID = -59896385986032571L;
@ApiModelProperty(name = "id")


+ 2
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/ModelsVersion.java View File

@@ -2,6 +2,7 @@ package com.ruoyi.platform.domain;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
@@ -14,6 +15,7 @@ import java.io.Serializable;
* @since 2024-01-05 09:02:42
*/
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@ApiModel("模型版本对象")
public class ModelsVersion implements Serializable {
private static final long serialVersionUID = -20181111893295288L;
/**


+ 32
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/TensorBoardStatus.java View File

@@ -0,0 +1,32 @@
package com.ruoyi.platform.domain;

public enum TensorBoardStatus {
Pending("Pending",1), Running("Running",2),Terminated("未运行",3);
private String name;
private int index;
private TensorBoardStatus(String name, int index) {
this.name = name;
this.index = index;
}
public static String getName(int index) {
for (TensorBoardStatus c : TensorBoardStatus.values()) {
if (c.getIndex() == index) {
return c.name;
}
}
return null;
}
// get set 方法
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getIndex() {
return index;
}
public void setIndex(int index) {
this.index = index;
}
}

+ 16
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/Workflow.java View File

@@ -2,9 +2,11 @@ package com.ruoyi.platform.domain;

import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import com.ruoyi.platform.handler.BaseMetaObjectHandler;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.stereotype.Component;

@@ -21,6 +23,7 @@ import java.util.Date;
@Component
@Table(name = "workflow")
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@ApiModel("流水线对象")
public class Workflow extends BaseMetaObjectHandler implements Serializable {
private static final long serialVersionUID = -28387946419827568L;
/**
@@ -44,6 +47,11 @@ public class Workflow extends BaseMetaObjectHandler implements Serializable {
*/
@ApiModelProperty(name = "dag")
private String dag;

// @ApiModelProperty(name = "global_param")
@JsonRawValue
private String globalParam;

/**
* 创建者
*/
@@ -103,6 +111,14 @@ public class Workflow extends BaseMetaObjectHandler implements Serializable {
this.dag = dag;
}

public String getGlobalParam() {
return globalParam;
}

public void setGlobalParam(String globalParam) {
this.globalParam = globalParam;
}

public String getCreateBy() {
return createBy;
}


+ 12
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/domain/WorkflowParam.java View File

@@ -2,6 +2,8 @@ package com.ruoyi.platform.domain;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.Date;
import java.io.Serializable;
@@ -13,35 +15,45 @@ import java.io.Serializable;
* @since 2024-03-18 15:48:42
*/
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
@ApiModel("流水线参数对象")
public class WorkflowParam implements Serializable {
private static final long serialVersionUID = -96152285866099549L;
/**
* 主键
*/
@ApiModelProperty(name = "id")
private Integer id;
/**
* 流水线id
*/
@ApiModelProperty(value = "对应流水线id",required = true)
private Long workflowId;
/**
* 参数名称
*/
@ApiModelProperty(value = "参数名称",required = true)
private String paramName;
/**
* 参数描述
*/

@ApiModelProperty(value = "参数描述",required = true)
private String description;
/**
* 参数类型,1字符串,2整形,3布尔型
*/

@ApiModelProperty(value = "参数类型",required = true)
private Integer paramType;
/**
* 参数的值
*/
@ApiModelProperty(value = "参数的值",required = true)
private String paramValue;
/**
* 0失效,1生效
*/
@ApiModelProperty(value = "是否敏感",required = true)
private Integer isSensitive;
/**
* 创建者


+ 4
- 4
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/mapper/WorkflowParamDao.java View File

@@ -28,7 +28,7 @@ public interface WorkflowParamDao {
* @param pageable 分页对象
* @return 对象列表
*/
List<WorkflowParam> queryAllByLimit(WorkflowParam workflowParam, @Param("pageable") Pageable pageable);
List<WorkflowParam> queryAllByLimit(@Param("workflowParam") WorkflowParam workflowParam, @Param("pageable") Pageable pageable);

/**
* 统计总行数
@@ -36,7 +36,7 @@ public interface WorkflowParamDao {
* @param workflowParam 查询条件
* @return 总行数
*/
long count(WorkflowParam workflowParam);
long count(@Param("workflowParam") WorkflowParam workflowParam);

/**
* 新增数据
@@ -44,7 +44,7 @@ public interface WorkflowParamDao {
* @param workflowParam 实例对象
* @return 影响行数
*/
int insert(WorkflowParam workflowParam);
int insert(@Param("workflowParam") WorkflowParam workflowParam);

/**
* 批量新增数据(MyBatis原生foreach方法)
@@ -69,7 +69,7 @@ public interface WorkflowParamDao {
* @param workflowParam 实例对象
* @return 影响行数
*/
int update(WorkflowParam workflowParam);
int update(@Param("workflowParam") WorkflowParam workflowParam);

/**
* 通过主键删除数据


+ 7
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ExperimentInsService.java View File

@@ -2,11 +2,13 @@ package com.ruoyi.platform.service;

import com.ruoyi.platform.domain.ExperimentIns;
import com.ruoyi.platform.vo.LogRequestVo;
import com.ruoyi.platform.vo.PodLogVo;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;

import java.io.IOException;
import java.util.List;
import java.util.Map;

/**
* (ExperimentIns)表服务接口
@@ -90,6 +92,10 @@ public interface ExperimentInsService {

List getNodeResult(Integer id, String nodeId) throws Exception;

String getRealtimeWorkflowLog(LogRequestVo logRequest);
Map<String, Object> getRealtimeWorkflowLog(LogRequestVo logRequest);

Map<String, Object> getRealtimePodLog(String podName, String startTime);

String getRealtimePodLogFromPod(PodLogVo podLogVo);

}

+ 16
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/TensorBoardService.java View File

@@ -0,0 +1,16 @@
package com.ruoyi.platform.service;

import com.ruoyi.platform.vo.FrameLogPathVo;

public interface TensorBoardService {


String getTensorBoardStatus(FrameLogPathVo frameLogPathVo);
/**
* 在集群中启动TensorBoard容器,并且返回地址,4小时后销毁
* @param frameLogPathVo
* @return
* @throws Exception
*/
String runTensorBoard(FrameLogPathVo frameLogPathVo) throws Exception;
}

+ 1
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/WorkflowService.java View File

@@ -1,5 +1,6 @@
package com.ruoyi.platform.service;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.ruoyi.platform.domain.Workflow;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;


+ 48
- 9
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentInsServiceImpl.java View File

@@ -1,6 +1,5 @@
package com.ruoyi.platform.service.impl;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.platform.domain.Experiment;
import com.ruoyi.platform.domain.ExperimentIns;
@@ -8,11 +7,9 @@ import com.ruoyi.platform.mapper.ExperimentDao;
import com.ruoyi.platform.mapper.ExperimentInsDao;
import com.ruoyi.platform.service.ExperimentInsService;
import com.ruoyi.platform.service.WorkflowService;
import com.ruoyi.platform.utils.DateUtils;
import com.ruoyi.platform.utils.HttpUtils;
import com.ruoyi.platform.utils.JsonUtils;
import com.ruoyi.platform.utils.MinioUtil;
import com.ruoyi.platform.utils.*;
import com.ruoyi.platform.vo.LogRequestVo;
import com.ruoyi.platform.vo.PodLogVo;
import com.ruoyi.system.api.model.LoginUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
@@ -53,6 +50,11 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
private String argoWorkflowLog;
@Value("${argo.workflowRealTimeLog}")
private String argoWorkflowRealTimeLog;
@Value("${argo.workflowPodLog}")
private String argoWorkflowPodLog;
@Value("${argo.ins.logsLines}")
private int logsLines;

private final MinioUtil minioUtil;

public ExperimentInsServiceImpl(MinioUtil minioUtil) {
@@ -93,7 +95,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
//搞个标记,当状态改变才去改表
boolean flag = false;
List<ExperimentIns> result = new ArrayList<ExperimentIns>();
if (experimentInsList!=null&&experimentInsList.size()>0) {
if (experimentInsList!=null&& experimentInsList.size()>0) {
for (ExperimentIns experimentIns : experimentInsList) {
//当原本状态为null或非终止态时才调用argo接口
if (experimentIns != null && (StringUtils.isEmpty(experimentIns.getStatus())) || !isTerminatedState(experimentIns)) {
@@ -107,6 +109,9 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
this.update(experimentIns);
}
}

//新增查询tensorBoard容器状态

result.add(experimentIns);
}
}
@@ -436,7 +441,8 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
throw new Exception("实验实例未查询到节点结果,id:" + id);
}
Map<String, Object> nodesResult = JsonUtils.jsonToMap(nodesResultString);
List<Map<String,Object>> nodeList = (List<Map<String,Object>>) nodesResult.get(nodeId);
Map<String, Object> paramOutput = (Map<String, Object>) nodesResult.get("param_output");
List<Map<String,Object>> nodeList = (List<Map<String,Object>>) paramOutput.get(nodeId);
//遍历 查询minio
for (int i = 0; i < nodeList.size(); i++) {
Map<String, Object> map = nodeList.get(i);
@@ -457,7 +463,7 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
}

@Override
public String getRealtimeWorkflowLog(LogRequestVo logRequest) {
public Map<String, Object> getRealtimeWorkflowLog(LogRequestVo logRequest) {

String componentId = logRequest.getComponentId();
String nameSpace = logRequest.getNamespace();
@@ -482,7 +488,10 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
if (StringUtils.isEmpty(req)) {
throw new RuntimeException("响应内容为空");
}
return req;
// 使用JacksonUtil将响应字符串转换为Map
Map<String, Object> tempMap = JacksonUtil.parseJSONStr2Map(req);
//去掉中间多余的data层
return (Map<String, Object>) tempMap.get("data");

} catch (Exception e) {
throw new RuntimeException("查询实验日志失败: " + e.getMessage(), e);
@@ -490,6 +499,34 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {

}

@Override
public Map<String, Object> getRealtimePodLog(String podName, String startTime) {
Map<String,Object> 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));
// 检查响应是否为空或无内容
if (StringUtils.isEmpty(req)) {
throw new RuntimeException("响应内容为空");
}
// 使用JacksonUtil将响应字符串转换为Map
Map<String, Object> tempMap = JacksonUtil.parseJSONStr2Map(req);
//去掉中间多余的data层
return (Map<String, Object>) tempMap.get("data");

} catch (Exception e) {
throw new RuntimeException("查询pod实时日志失败: " + e.getMessage(), e);
}

}

@Override
public String getRealtimePodLogFromPod(PodLogVo podLogVo) {
return K8sClientUtil.getPodLogs(podLogVo.getPodName(), podLogVo.getNamespace(),podLogVo.getContainerName(), logsLines);
}

private boolean isTerminatedState(ExperimentIns ins) throws IOException {
// 定义终止态的列表,例如 "Succeeded", "Failed" 等
String status = ins.getStatus();
@@ -500,6 +537,8 @@ public class ExperimentInsServiceImpl implements ExperimentInsService {
//如果跟node_status里面不一样,就要去更新node_status的信息
String nodesStatus = ins.getNodesStatus();
Map<String, Object> nodeMap = JsonUtils.jsonToMap(nodesStatus);


String keyStartsWithWorkflow = nodeMap.keySet().stream()
.filter(key -> key.startsWith("workflow-"))
.findFirst()


+ 9
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java View File

@@ -10,6 +10,7 @@ import com.ruoyi.platform.service.ExperimentInsService;
import com.ruoyi.platform.service.ExperimentService;
import com.ruoyi.platform.service.WorkflowService;
import com.ruoyi.platform.utils.HttpUtils;
import com.ruoyi.platform.utils.JacksonUtil;
import com.ruoyi.platform.utils.JsonUtils;
import com.ruoyi.system.api.model.LoginUser;
import org.apache.commons.collections4.MapUtils;
@@ -225,7 +226,11 @@ public class ExperimentServiceImpl implements ExperimentService {
// 组装运行接口json
Map<String, Object> runReqMap = new HashMap<>();
runReqMap.put("data", converMap.get("data"));
runReqMap.put("params", JsonUtils.jsonToMap(StringUtils.isEmpty(experiment.getGlobalParam())?"{}":experiment.getGlobalParam()));
List<Map<String, Object>> params = JacksonUtil.parseJSONStr2MapList(StringUtils.isEmpty(experiment.getGlobalParam()) ? "[]" : experiment.getGlobalParam());
runReqMap.put("params", params);
//runReqMap.put("params", JsonUtils.jsonToMap(StringUtils.isEmpty(experiment.getGlobalParam())?"{}":experiment.getGlobalParam()));
runReqMap.put("experiment", new HashMap<String, Object>().put("name", "experiment-"+experiment.getId()));

Map<String ,Object> output = (Map<String, Object>) converMap.get("output");
// 调argo运行接口
String runRes = HttpUtils.sendPost(argoUrl + argoWorkflowRun, JsonUtils.mapToJson(runReqMap));
@@ -243,10 +248,13 @@ public class ExperimentServiceImpl implements ExperimentService {

Map<String, Object> metadata = (Map<String, Object>) data.get("metadata");

// 插入记录到实验实例表
ExperimentIns experimentIns = new ExperimentIns();
experimentIns.setExperimentId(experiment.getId());
experimentIns.setArgoInsNs((String) metadata.get("namespace"));
experimentIns.setArgoInsName((String) metadata.get("name"));
//传入实验全局参数
experimentIns.setGlobalParam(experiment.getGlobalParam());

//替换argoInsName
String outputString = JsonUtils.mapToJson(output);


+ 2
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/JupyterServiceImpl.java View File

@@ -44,8 +44,8 @@ public class JupyterServiceImpl implements JupyterService {
@Override
public String getJupyterServiceUrl() {
LoginUser loginUser = SecurityUtils.getLoginUser();
String podName = loginUser.getUsername() + "-editor-pod";
String pvcName = loginUser.getUsername() + "-editor-pvc";
String podName = loginUser.getUsername().toLowerCase() + "-editor-pod";
String pvcName = loginUser.getUsername().toLowerCase() + "-editor-pvc";
V1PersistentVolumeClaim pvc = K8sClientUtil.createPvc(namespace, pvcName, storage,storageClassName);
Integer podPort = K8sClientUtil.createPod(podName, namespace, port, mountPath, pvc, image);
return masterIp + ":" + podPort;


+ 57
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/TensorBoardServiceImpl.java View File

@@ -0,0 +1,57 @@
package com.ruoyi.platform.service.impl;

import com.ruoyi.common.core.utils.StringUtils;
import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.platform.domain.TensorBoardStatus;
import com.ruoyi.platform.service.TensorBoardService;
import com.ruoyi.platform.utils.K8sClientUtil;
import com.ruoyi.platform.vo.FrameLogPathVo;
import com.ruoyi.system.api.model.LoginUser;
import io.kubernetes.client.openapi.models.V1Pod;
import net.sf.jsqlparser.schema.Database;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

@Service
public class TensorBoardServiceImpl implements TensorBoardService {
@Value("${tensorBoard.image}")
private String image;
@Value("${tensorBoard.port}")
private Integer port;
@Value("${tensorBoard.mountPath}")
private String mountPath;
@Value("${tensorBoard.masterIp}")
private String masterIp;

@Override
public String getTensorBoardStatus(FrameLogPathVo frameLogPathVo){
String status = TensorBoardStatus.Terminated.getName();
if (StringUtils.isEmpty(frameLogPathVo.getPath())||StringUtils.isEmpty(frameLogPathVo.getPvcName())){
return status;
}
LoginUser loginUser = SecurityUtils.getLoginUser();
String podName = loginUser.getUsername().toLowerCase()+"-"+frameLogPathVo.getPath().split("/")[2]+ "-tensorboard-pod";

try {
String podStatus = K8sClientUtil.getPodStatus(podName, StringUtils.isEmpty(frameLogPathVo.getNamespace()) ? "default" : frameLogPathVo.getNamespace());
System.out.println(podStatus);
} catch (Exception e) {
return TensorBoardStatus.Terminated.getName();
}
return status;
}

@Override
public String runTensorBoard(FrameLogPathVo frameLogPathVo) throws Exception {
if (StringUtils.isEmpty(frameLogPathVo.getPath())||StringUtils.isEmpty(frameLogPathVo.getPvcName())){
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);
return masterIp + ":" + podPort;
}
}

+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowParamServiceImpl.java View File

@@ -83,7 +83,7 @@ public class WorkflowParamServiceImpl implements WorkflowParamService {
public String removeById(Integer id) {
WorkflowParam workflowParam = this.workflowParamDao.queryById(id);
if (workflowParam == null){
return "图标不存在";
return "流水线参数不存在";
}

//判断权限,只有admin和创建者本身可以删除


+ 2
- 4
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/WorkflowServiceImpl.java View File

@@ -153,9 +153,9 @@ public class WorkflowServiceImpl implements WorkflowService {
return new PageImpl<>(this.workflowDao.queryByName(name));
}

@Override


@Override
public Workflow duplicateWorkflow(Long id) {
//先去查找数据库中存在的数据
Workflow workflow = this.queryById(id);
@@ -182,18 +182,16 @@ public class WorkflowServiceImpl implements WorkflowService {
}
duplicateWorkflow.setDag(newDag);
duplicateWorkflow.setDescription(workflow.getDescription());
duplicateWorkflow.setGlobalParam(workflow.getGlobalParam());
return this.insert(duplicateWorkflow);
} catch (Exception e) {
throw new RuntimeException("复制流水线失败: " + e.getMessage(), e);

}

}
return null;

}




}

+ 98
- 5
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/K8sClientUtil.java View File

@@ -1,13 +1,16 @@
package com.ruoyi.platform.utils;

import com.alibaba.nacos.shaded.com.google.gson.reflect.TypeToken;
import io.kubernetes.client.Exec;
import io.kubernetes.client.custom.IntOrString;
import io.kubernetes.client.custom.Quantity;
import io.kubernetes.client.openapi.ApiClient;
import io.kubernetes.client.openapi.ApiException;
import io.kubernetes.client.openapi.ApiResponse;
import io.kubernetes.client.openapi.apis.CoreV1Api;
import io.kubernetes.client.openapi.models.*;
import io.kubernetes.client.util.ClientBuilder;
import io.kubernetes.client.util.Watch;
import io.kubernetes.client.util.credentials.AccessTokenAuthentication;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
@@ -15,7 +18,6 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.LinkedHashMap;
@@ -247,7 +249,7 @@ public class K8sClientUtil {
.withName(podName)
.withLabels(selector)
.endMetadata()
.withNewSpec()
.withNewSpec().withSchedulerName("0 */4 * * *")//默认不被操作4小时后删除
.addNewContainer()
.withName(podName)
.withImage(image)
@@ -257,7 +259,7 @@ public class K8sClientUtil {
.addNewVolume()
.withName("workspace").withPersistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvc.getMetadata().getName()))
.endVolume()
.withTerminationGracePeriodSeconds(14400L) //默认不被操作4小时后删除
// .withTerminationGracePeriodSeconds(14400L) //默认不被操作4小时后删除
.endSpec()
.build();

@@ -265,9 +267,9 @@ public class K8sClientUtil {
try {
pod = api.createNamespacedPod(namespace, pod, null, null, null);
} catch (ApiException e) {
log.error("创建pvc异常:" + e.getResponseBody(), e);
log.error("创建pod异常:" + e.getResponseBody(), e);
} catch (Exception e) {
log.error("创建pvc系统异常:", e);
log.error("创建pod系统异常:", e);
}

V1Service service = createService(namespace, podName + "-svc", port, selector);
@@ -275,6 +277,75 @@ public class K8sClientUtil {
}


/**
* 创建k8s 临时POD
* @param podName pod name
* @param namespace 命名空间
* @param port port
* @param mountPath 映射路径
* @param subPath pvc子路径
* @param pvcName 存储名
* @param image 镜像
* @return 创建成功的pod,的nodePort端口
*/

public static Integer createPodWithSubPath(String podName, String namespace, Integer port ,String mountPath,String subPath,String pvcName, String image){

Map<String, String> selector = new LinkedHashMap<String, String>();
selector.put("k8s-jupyter", podName);

CoreV1Api api = new CoreV1Api(apiClient);
V1PodList v1PodList = null;
try {
v1PodList = api.listNamespacedPod(namespace, null, null, null, null, null, null, null, null, null, null);
} catch (ApiException e) {
log.error("获取 POD 异常:", e);
}
if (v1PodList!=null) {
for (V1Pod pod1 : v1PodList.getItems()) {
if (StringUtils.equals(pod1.getMetadata().getName(), podName)) {
// PVC 已存在

V1Service service = createService(namespace, podName + "-svc", port, selector);
if (service != null) {
return service.getSpec().getPorts().get(0).getNodePort();
}
}
}
}

V1Pod pod = new V1PodBuilder()
.withNewMetadata()
.withName(podName)
.withLabels(selector)
.endMetadata()
.withNewSpec().withSchedulerName("0 */1 * * *")//默认不被操作4小时后删除
.addNewContainer()
.withName(podName)
.withImage(image)
.withPorts(new V1ContainerPort().containerPort(port).protocol("TCP"))
.withVolumeMounts(new V1VolumeMount().name("workspace").mountPath(mountPath).subPath(subPath))
.endContainer()
.addNewVolume()
.withName("workspace").withPersistentVolumeClaim(new V1PersistentVolumeClaimVolumeSource().claimName(pvcName))
.endVolume()
// .withTerminationGracePeriodSeconds(14400L)
.endSpec()
.build();


try {
pod = api.createNamespacedPod(namespace, pod, null, null, null);
} catch (ApiException e) {
log.error("创建pod异常:" + e.getResponseBody(), e);
} catch (Exception e) {
log.error("创建pod系统异常:", e);
}

V1Service service = createService(namespace, podName + "-svc", port, selector);
return service.getSpec().getPorts().get(0).getNodePort();
}

/**
* 根据获取namespace,deploymentName的Pod Name
*
@@ -321,4 +392,26 @@ public class K8sClientUtil {
throw new RuntimeException("执行命令异常");
}
}

/**
* 根据Pod的名称和Namespace查询Pod的状态
* @param podName Pod的名称
* @param namespace Pod所在的Namespace
*/
public static String getPodStatus(String podName, String namespace) throws Exception {
CoreV1Api api = new CoreV1Api(apiClient);
V1Pod pod = api.readNamespacedPod(podName, namespace, null, null, null);
return pod.getStatus().getPhase();
}

public static String getPodLogs(String podName,String namespace,String container,int line) {
CoreV1Api api = new CoreV1Api(apiClient);
try {
String log = api.readNamespacedPodLog(podName, namespace, StringUtils.isEmpty(container)?null:container, null, null, null, null,null, null, line, null);
return log;
} catch (ApiException e) {
throw new RuntimeException("获取Pod日志异常", e);
}

}
}

+ 37
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/FrameLogPathVo.java View File

@@ -0,0 +1,37 @@
package com.ruoyi.platform.vo;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.io.Serializable;

@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class FrameLogPathVo implements Serializable {
String path;
String namespace;
String pvcName;

public String getPath() {
return path;
}

public void setPath(String path) {
this.path = path;
}

public String getNamespace() {
return namespace;
}

public void setNamespace(String namespace) {
this.namespace = namespace;
}

public String getPvcName() {
return pvcName;
}

public void setPvcName(String pvcName) {
this.pvcName = pvcName;
}
}

+ 37
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/vo/PodLogVo.java View File

@@ -0,0 +1,37 @@
package com.ruoyi.platform.vo;

import com.fasterxml.jackson.databind.PropertyNamingStrategy;
import com.fasterxml.jackson.databind.annotation.JsonNaming;

import java.io.Serializable;

@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class PodLogVo implements Serializable {
private String podName;
private String namespace;
private String containerName;

public String getPodName() {
return podName;
}

public void setPodName(String podName) {
this.podName = podName;
}

public String getNamespace() {
return namespace;
}

public void setNamespace(String namespace) {
this.namespace = namespace;
}

public String getContainerName() {
return containerName;
}

public void setContainerName(String containerName) {
this.containerName = containerName;
}
}

+ 69
- 0
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/webSocket/WebSocket.java View File

@@ -0,0 +1,69 @@
package com.ruoyi.platform.webSocket;

import javax.annotation.Resource;
import javax.websocket.*;
import javax.websocket.server.PathParam;
import javax.websocket.server.ServerEndpoint;

import com.ruoyi.platform.service.ExperimentInsService;
import com.ruoyi.platform.utils.K8sClientUtil;
import org.springframework.stereotype.Component;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ConcurrentHashMap;

@Component
@Slf4j
@ServerEndpoint("/websocket/workflowLogs")
@RestController
public class WebSocket {
private Session session;
private String userId;
private static CopyOnWriteArraySet<WebSocket> webSockets = new CopyOnWriteArraySet<>();
private static ConcurrentHashMap<String, Session> sessionPool = new ConcurrentHashMap<>();

@OnOpen
public void onOpen(Session session, @PathParam("userId") String userId) {
try {
this.session = session;
this.userId = "workflowLogs";
webSockets.add(this);
sessionPool.put(userId, session);
log.info("【WebSocket 消息】有新的连接,总数为:" + webSockets.size());
} catch (Exception e) {
// 异常处理
}
}

@OnClose
public void onClose() {
try {
webSockets.remove(this);
sessionPool.remove(this.userId);
log.info("【WebSocket 消息】连接断开,总数为:" + webSockets.size());
} catch (Exception e) {
// 异常处理
}
}

@OnMessage
public void onMessage(String message, Session session) {
log.info("【WebSocket 消息】收到客户端消息:" + message);
// 处理收到的消息,例如获取实时日志数据

// 推送日志数据给客户端
try {
session.getBasicRemote().sendText("nihao");
} catch (Exception e) {
log.error("【WebSocket 消息】推送日志数据失败:" + e.getMessage());
}
}

@OnError
public void onError(Session session, Throwable error) {
log.error("【WebSocket 消息】发生错误:" + error.getMessage());
}
}

+ 3
- 3
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentDaoMapper.xml View File

@@ -84,7 +84,7 @@
and global_param = #{experiment.globalParam}
</if>
<if test="experiment.statusList != null and experiment.statusList != ''">
status_list = #{experiment.statusList},
status_list = #{experiment.statusList}
</if>
<if test="experiment.description != null and experiment.description != ''">
and description = #{experiment.description}
@@ -125,7 +125,7 @@
and global_param = #{experiment.globalParam}
</if>
<if test="experiment.statusList != null and experiment.statusList != ''">
status_list = #{experiment.statusList},
status_list = #{experiment.statusList}
</if>
<if test="experiment.description != null and experiment.description != ''">
and description = #{experiment.description}
@@ -148,7 +148,7 @@
<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into experiment(name,workflow_id, global_param, status_list, description, create_by, create_time, update_by, update_time, state)
values (#{experiment.name},#{experiment.workflowId}, #{experiment.globalParam},#{experiment.statusList}, #{experiment.description}, #{experiment.createBy}, #{experiment.createTime}, #{experiment.updateBy}, #{experiment.updateTime}, #{experiment.state})
values (#{experiment.name},#{experiment.workflowId}, #{experiment.globalParam},#{experiment.statusList}, #{experiment.description}, #{experiment.createBy}, #{experiment.createTime}, #{experiment.updateBy}, #{experiment.updateTime}, #{experiment.state})
</insert>

<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">


+ 20
- 8
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/ExperimentInsDaoMapper.xml View File

@@ -24,14 +24,14 @@

<!--查询单个-->
<select id="queryById" resultMap="ExperimentInsMap">
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, 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, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins
where id = #{id} and state = 1
</select>

<!--查询列表-->
<select id="getByExperimentId" resultMap="ExperimentInsMap">
select id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, 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, 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
@@ -41,7 +41,7 @@

<select id="queryByExperiment" resultMap="ExperimentInsMap">
select
id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, 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, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins
<where>
state = 1
@@ -66,6 +66,9 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
and nodes_logs = #{experimentIns.nodesLogs}
</if>
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
and global_param = #{experimentIns.globalParam}
</if>
<if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime}
</if>
@@ -90,7 +93,7 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="ExperimentInsMap">
select
id, experiment_id, argo_ins_name, argo_ins_ns, status, nodes_status,nodes_result, nodes_logs, 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, start_time, finish_time, create_by, create_time, update_by, update_time, state
from experiment_ins
<where>
state = 1
@@ -115,6 +118,9 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
and nodes_logs = #{experimentIns.nodesLogs}
</if>
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
and global_param = #{experimentIns.globalParam}
</if>
<if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime}
</if>
@@ -165,6 +171,9 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
and nodes_logs = #{experimentIns.nodesLogs}
</if>
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
and global_param = #{experimentIns.globalParam}
</if>
<if test="experimentIns.startTime != null">
and start_time = #{experimentIns.startTime}
</if>
@@ -188,16 +197,16 @@

<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,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.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,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.startTime},#{experimentIns.finishTime},#{experimentIns.createBy},#{experimentIns.createTime},#{experimentIns.updateBy},#{experimentIns.updateTime},#{experimentIns.state})
</insert>

<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into
experiment_ins(experiment_id,argo_ins_name,argo_ins_ns,status,nodes_status,nodes_result,nodes_logs,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,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.nodesLogs},#{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.startTime},#{entity.finishTime},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})
</foreach>
</insert>

@@ -238,6 +247,9 @@
<if test="experimentIns.nodesLogs != null and experimentIns.nodesLogs != ''">
nodes_logs = #{experimentIns.nodesLogs},
</if>
<if test="experimentIns.globalParam != null and experimentIns.globalParam != ''">
global_param = #{experimentIns.globalParam},
</if>
<if test="experimentIns.startTime != null">
start_time = #{experimentIns.startTime},
</if>


+ 19
- 9
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowDaoMapper.xml View File

@@ -7,6 +7,7 @@
<result property="name" column="name" jdbcType="VARCHAR"/>
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="dag" column="dag" jdbcType="VARCHAR"/>
<result property="globalParam" column="global_param" jdbcType="VARCHAR"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
<result property="createTime" column="create_time" jdbcType="TIMESTAMP"/>
<result property="updateBy" column="update_by" jdbcType="VARCHAR"/>
@@ -17,7 +18,7 @@
<!--查询单个-->
<select id="queryById" resultMap="WorkflowMap">
select
id, name, description, dag, create_by, create_time, update_by, update_time, state
id, name, description, dag, global_param, create_by, create_time, update_by, update_time, state
from workflow
where id = #{id} and state = 1
</select>
@@ -25,7 +26,7 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="WorkflowMap" >
select
id, name, description, dag, create_by, create_time, update_by, update_time, state
id, name, description, dag, global_param, create_by, create_time, update_by, update_time, state
from workflow
<where>
state = 1
@@ -41,6 +42,9 @@
<if test="workflow.dag != null and workflow.dag != ''">
and dag = #{workflow.dag}
</if>
<if test="workflow.globalParam != null and workflow.globalParam != ''">
and global_param = #{workflow.globalParam}
</if>
<if test="workflow.createBy != null and workflow.createBy != ''">
and create_by = #{workflow.createBy}
</if>
@@ -76,6 +80,9 @@
<if test="workflow.dag != null and workflow.dag != ''">
and dag = #{workflow.dag}
</if>
<if test="workflow.globalParam != null and workflow.globalParam != ''">
and global_param = #{workflow.globalParam}
</if>
<if test="workflow.createBy != null and workflow.createBy != ''">
and create_by = #{workflow.createBy}
</if>
@@ -93,26 +100,26 @@

<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into workflow(name, description, dag, create_by, create_time, update_by, update_time,state)
values (#{workflow.name}, #{workflow.description}, #{workflow.dag}, #{workflow.createBy}, #{workflow.createTime}, #{workflow.updateBy}, #{workflow.updateTime}, #{workflow.state})
insert into workflow(name, description, dag, global_param, create_by, create_time, update_by, update_time,state)
values (#{workflow.name}, #{workflow.description}, #{workflow.dag},#{workflow.globalParam}, #{workflow.createBy}, #{workflow.createTime}, #{workflow.updateBy}, #{workflow.updateTime}, #{workflow.state})
</insert>



<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into workflow(name, description, dag, create_by, create_time, update_by, update_time, state)
insert into workflow(name, description, dag, global_param, create_by, create_time, update_by, update_time, state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name}, #{entity.description}, #{entity.dag}, #{entity.createBy}, #{entity.createTime},
(#{entity.name}, #{entity.description}, #{entity.dag}, #{entity.globalParam}, #{entity.createBy}, #{entity.createTime},
#{entity.updateBy}, #{entity.updateTime}, #{entity.state})
</foreach>
</insert>

<insert id="insertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
insert into workflow(name, description, dag, create_by, create_time, update_by, update_time, state)
insert into workflow(name, description, dag, global_param, create_by, create_time, update_by, update_time, state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.name}, #{entity.description}, #{entity.dag}, #{entity.createBy}, #{entity.createTime},
(#{entity.name}, #{entity.description}, #{entity.dag}, #{entity.globalParam},#{entity.createBy}, #{entity.createTime},
#{entity.updateBy}, #{entity.updateTime}, #{entity.state})
</foreach>
on duplicate key update
@@ -139,6 +146,9 @@
<if test="workflow.dag != null and workflow.dag != ''">
dag = #{workflow.dag},
</if>
<if test="workflow.globalParam != null and workflow.globalParam != ''">
global_param = #{workflow.globalParam},
</if>
<if test="workflow.createBy != null and workflow.createBy != ''">
create_by = #{workflow.createBy},
</if>
@@ -166,7 +176,7 @@
<!--通过流水线名字进行模糊查询-->
<select id="queryByName" resultMap="WorkflowMap">
select
id, name, description, dag, create_by, create_time, update_by, update_time, state
id, name, description, dag, global_param, create_by, create_time, update_by, update_time, state
from workflow
<where>
state = 1


+ 80
- 77
ruoyi-modules/management-platform/src/main/resources/mapper/managementPlatform/WorkflowParamDaoMapper.xml View File

@@ -7,7 +7,7 @@
<result property="workflowId" column="workflow_id" jdbcType="INTEGER"/>
<result property="paramName" column="param_name" jdbcType="VARCHAR"/>
<result property="description" column="description" jdbcType="VARCHAR"/>
<result property="paramType" column="param_type" jdbcType="INTEGER"/>
<result property="paramType" column="param_type" jdbcType="VARCHAR"/>
<result property="paramValue" column="param_value" jdbcType="VARCHAR"/>
<result property="isSensitive" column="is_sensitive" jdbcType="INTEGER"/>
<result property="createBy" column="create_by" jdbcType="VARCHAR"/>
@@ -28,106 +28,108 @@
<!--查询指定行数据-->
<select id="queryAllByLimit" resultMap="WorkflowParamMap">
select
id,workflow_id,param_name,description,param_type,param_value,is_sensitive,create_by,create_time,update_by,update_time,state
id, workflow_id, param_name, description, param_type, param_value, is_sensitive, create_by, create_time, update_by, update_time, state
from workflow_param
<where>
state = 1
<if test="id != null">
and id = #{id}
<if test="workflowParam.id != null">
and id = #{workflowParam.id}
</if>
<if test="workflowId != null">
and workflow_id = #{workflowId}
<if test="workflowParam.workflowId != null">
and workflow_id = #{workflowParam.workflowId}
</if>
<if test="paramName != null and paramName != ''">
and param_name = #{paramName}
<if test="workflowParam.paramName != null and workflowParam.paramName != ''">
and param_name = #{workflowParam.paramName}
</if>
<if test="description != null and description != ''">
and description = #{description}
<if test="workflowParam.description != null and workflowParam.description != ''">
and description = #{workflowParam.description}
</if>
<if test="paramType != null">
and param_type = #{paramType}
<if test="workflowParam.paramType != null">
and param_type = #{workflowParam.paramType}
</if>
<if test="paramValue != null and paramValue != ''">
and param_value = #{paramValue}
<if test="workflowParam.paramValue != null and workflowParam.paramValue != ''">
and param_value = #{workflowParam.paramValue}
</if>
<if test="isSensitive != null">
and is_sensitive = #{isSensitive}
<if test="workflowParam.isSensitive != null">
and is_sensitive = #{workflowParam.isSensitive}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
<if test="workflowParam.createBy != null and workflowParam.createBy != ''">
and create_by = #{workflowParam.createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
<if test="workflowParam.createTime != null">
and create_time = #{workflowParam.createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
<if test="workflowParam.updateBy != null and workflowParam.updateBy != ''">
and update_by = #{workflowParam.updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
<if test="workflowParam.updateTime != null">
and update_time = #{workflowParam.updateTime}
</if>
<if test="state != null">
and state = #{state}
<if test="workflowParam.state != null">
and state = #{workflowParam.state}
</if>
</where>
limit #{pageable.offset}, #{pageable.pageSize}
</select>


<!--统计总行数-->
<select id="count" resultType="java.lang.Long">
select count(1)
from workflow_param
<where>
state = 1
<if test="id != null">
and id = #{id}
<if test="workflowParam.id != null">
and id = #{workflowParam.id}
</if>
<if test="workflowId != null">
and workflow_id = #{workflowId}
<if test="workflowParam.workflowId != null">
and workflow_id = #{workflowParam.workflowId}
</if>
<if test="paramName != null and paramName != ''">
and param_name = #{paramName}
<if test="workflowParam.paramName != null and workflowParam.paramName != ''">
and param_name = #{workflowParam.paramName}
</if>
<if test="description != null and description != ''">
and description = #{description}
<if test="workflowParam.description != null and workflowParam.description != ''">
and description = #{workflowParam.description}
</if>
<if test="paramType != null">
and param_type = #{paramType}
<if test="workflowParam.paramType != null">
and param_type = #{workflowParam.paramType}
</if>
<if test="paramValue != null and paramValue != ''">
and param_value = #{paramValue}
<if test="workflowParam.paramValue != null and workflowParam.paramValue != ''">
and param_value = #{workflowParam.paramValue}
</if>
<if test="isSensitive != null">
and is_sensitive = #{isSensitive}
<if test="workflowParam.isSensitive != null">
and is_sensitive = #{workflowParam.isSensitive}
</if>
<if test="createBy != null and createBy != ''">
and create_by = #{createBy}
<if test="workflowParam.createBy != null and workflowParam.createBy != ''">
and create_by = #{workflowParam.createBy}
</if>
<if test="createTime != null">
and create_time = #{createTime}
<if test="workflowParam.createTime != null">
and create_time = #{workflowParam.createTime}
</if>
<if test="updateBy != null and updateBy != ''">
and update_by = #{updateBy}
<if test="workflowParam.updateBy != null and workflowParam.updateBy != ''">
and update_by = #{workflowParam.updateBy}
</if>
<if test="updateTime != null">
and update_time = #{updateTime}
<if test="workflowParam.updateTime != null">
and update_time = #{workflowParam.updateTime}
</if>
<if test="state != null">
and state = #{state}
<if test="workflowParam.state != null">
and state = #{workflowParam.state}
</if>
</where>
</select>

<!--新增所有列-->
<insert id="insert" keyProperty="id" useGeneratedKeys="true">
insert into workflow_param(workflow_id,param_name,description,param_type,param_value,is_sensitive,create_by,create_time,update_by,update_time,state)
values (#{workflowId}#{paramName}#{description}#{paramType}#{paramValue}#{isSensitive}#{createBy}#{createTime}#{updateBy}#{updateTime}#{state})
insert into workflow_param(workflow_id, param_name, description, param_type, param_value, is_sensitive, create_by, create_time, update_by, update_time, state)
values (#{workflowParam.workflowId}, #{workflowParam.paramName}, #{workflowParam.description}, #{workflowParam.paramType}, #{workflowParam.paramValue}, #{workflowParam.isSensitive}, #{workflowParam.createBy}, #{workflowParam.createTime}, #{workflowParam.updateBy}, #{workflowParam.updateTime}, #{workflowParam.state})
</insert>


<insert id="insertBatch" keyProperty="id" useGeneratedKeys="true">
insert into workflow_param(workflow_id,param_name,description,param_type,param_value,is_sensitive,create_by,create_time,update_by,update_time,state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.workflowId}#{entity.paramName}#{entity.description}#{entity.paramType}#{entity.paramValue}#{entity.isSensitive}#{entity.createBy}#{entity.createTime}#{entity.updateBy}#{entity.updateTime}#{entity.state})
(#{entity.workflowId},#{entity.paramName},#{entity.description},#{entity.paramType},#{entity.paramValue},#{entity.isSensitive},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})
</foreach>
</insert>

@@ -135,7 +137,7 @@
insert into workflow_param(workflow_id,param_name,description,param_type,param_value,is_sensitive,create_by,create_time,update_by,update_time,state)
values
<foreach collection="entities" item="entity" separator=",">
(#{entity.workflowId}#{entity.paramName}#{entity.description}#{entity.paramType}#{entity.paramValue}#{entity.isSensitive}#{entity.createBy}#{entity.createTime}#{entity.updateBy}#{entity.updateTime}#{entity.state})
(#{entity.workflowId},#{entity.paramName},#{entity.description},#{entity.paramType},#{entity.paramValue},#{entity.isSensitive},#{entity.createBy},#{entity.createTime},#{entity.updateBy},#{entity.updateTime},#{entity.state})
</foreach>
on duplicate key update
workflow_id = values(workflow_id)param_name = values(param_name)description = values(description)param_type = values(param_type)param_value = values(param_value)is_sensitive = values(is_sensitive)create_by = values(create_by)create_time = values(create_time)update_by = values(update_by)update_time = values(update_time)state = values(state)
@@ -145,43 +147,44 @@ workflow_id = values(workflow_id)param_name = values(param_name)description = va
<update id="update">
update workflow_param
<set>
<if test="workflowId != null">
workflow_id = #{workflowId},
<if test="workflowParam.workflowId != null">
workflow_id = #{workflowParam.workflowId},
</if>
<if test="paramName != null and paramName != ''">
param_name = #{paramName},
<if test="workflowParam.paramName != null and workflowParam.paramName != ''">
param_name = #{workflowParam.paramName},
</if>
<if test="description != null and description != ''">
description = #{description},
<if test="workflowParam.description != null and workflowParam.description != ''">
description = #{workflowParam.description},
</if>
<if test="paramType != null">
param_type = #{paramType},
<if test="workflowParam.paramType != null">
param_type = #{workflowParam.paramType},
</if>
<if test="paramValue != null and paramValue != ''">
param_value = #{paramValue},
<if test="workflowParam.paramValue != null and workflowParam.paramValue != ''">
param_value = #{workflowParam.paramValue},
</if>
<if test="isSensitive != null">
is_sensitive = #{isSensitive},
<if test="workflowParam.isSensitive != null">
is_sensitive = #{workflowParam.isSensitive},
</if>
<if test="createBy != null and createBy != ''">
create_by = #{createBy},
<if test="workflowParam.createBy != null and workflowParam.createBy != ''">
create_by = #{workflowParam.createBy},
</if>
<if test="createTime != null">
create_time = #{createTime},
<if test="workflowParam.createTime != null">
create_time = #{workflowParam.createTime},
</if>
<if test="updateBy != null and updateBy != ''">
update_by = #{updateBy},
<if test="workflowParam.updateBy != null and workflowParam.updateBy != ''">
update_by = #{workflowParam.updateBy},
</if>
<if test="updateTime != null">
update_time = #{updateTime},
<if test="workflowParam.updateTime != null">
update_time = #{workflowParam.updateTime},
</if>
<if test="state != null">
state = #{state},
<if test="workflowParam.state != null">
state = #{workflowParam.state},
</if>
</set>
where id = #{id}
where id = #{workflowParam.id}
</update>


<!--通过主键删除-->
<delete id="deleteById">
delete from workflow_param where id = #{id}


Loading…
Cancel
Save