diff --git a/k8s/build.sh b/k8s/build.sh index ed30e9f1..424a9a8c 100755 --- a/k8s/build.sh +++ b/k8s/build.sh @@ -91,7 +91,6 @@ compile_java() { param=$1 # 编译java docker run -v ${baseDir}:${baseDir} -v /home/maven:/home/maven \ - -e http_proxy=http://172.20.32.253:3128 -e https_proxy=http://172.20.32.253:3128 \ 172.20.32.187/ci4s/build:v1 ${baseDir}/k8s/build-java.sh $param if [ $? -ne 0 ]; then echo "编译失败,请检查代码!" diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java index 8e0eefcf..52ac55da 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ExperimentServiceImpl.java @@ -13,13 +13,11 @@ import com.ruoyi.platform.mapper.ExperimentDao; import com.ruoyi.platform.mapper.ExperimentInsDao; import com.ruoyi.platform.mapper.ModelDependency1Dao; import com.ruoyi.platform.service.*; -import com.ruoyi.platform.utils.FileUtil; import com.ruoyi.platform.utils.HttpUtils; import com.ruoyi.platform.utils.JacksonUtil; import com.ruoyi.platform.utils.JsonUtils; import com.ruoyi.platform.vo.ModelsVo; import com.ruoyi.platform.vo.NewDatasetVo; -import com.ruoyi.platform.vo.VersionVo; import com.ruoyi.system.api.model.LoginUser; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; @@ -545,8 +543,10 @@ public class ExperimentServiceImpl implements ExperimentService { for (int i = 0; i < jsonArray.size(); i++) { JSONObject jsonObject = jsonArray.getJSONObject(i); String paramName = jsonObject.getString("param_name"); - Object paramValue = jsonObject.get("param_value"); - trainParam.put(paramName, paramValue); + if (!"model_version".equals(paramName)) { + Object paramValue = jsonObject.get("param_value"); + trainParam.put(paramName, paramValue); + } } modelMetaVo.setParams(trainParam); diff --git a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/YamlUtils.java b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/YamlUtils.java index 3f235af1..265ee8eb 100644 --- a/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/YamlUtils.java +++ b/ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/utils/YamlUtils.java @@ -1,32 +1,49 @@ package com.ruoyi.platform.utils; import org.yaml.snakeyaml.DumperOptions; -import org.yaml.snakeyaml.Yaml; -import org.yaml.snakeyaml.nodes.Node; -import org.yaml.snakeyaml.representer.Represent; -import org.yaml.snakeyaml.representer.Representer; +//import org.yaml.snakeyaml.Yaml; import java.io.*; -import java.util.Iterator; import java.util.Map; -import org.yaml.snakeyaml.nodes.Tag; + + +import org.ho.yaml.Yaml; + public class YamlUtils { /** * 将Map对象转换为YAML格式并写入指定路径的文件中 * - * @param data Map对象 - * @param path 文件路径 - * @param fileName 文件名 + * @param data Map对象 + * @param path 文件路径 + * @param fileName 文件名 */ +// public static void generateYamlFile(Map data, String path, String fileName) { +// DumperOptions options = new DumperOptions(); +// options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); +// options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN); +// +// +// // 创建Yaml实例 +// Yaml yaml = new Yaml(options); +// +// File directory = new File(path); +// if (!directory.exists()) { +// boolean isCreated = directory.mkdirs(); +// if (!isCreated) { +// throw new RuntimeException("创建路径失败: " + path); +// } +// } +// +// String fullPath = path + "/" + fileName + ".yaml"; +// +// try (FileWriter writer = new FileWriter(fullPath)) { +// yaml.dump(data, writer); +// } catch (IOException e) { +// e.printStackTrace(); +// } +// } public static void generateYamlFile(Map data, String path, String fileName) { - DumperOptions options = new DumperOptions(); - options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); - options.setDefaultScalarStyle(DumperOptions.ScalarStyle.PLAIN); - - // 创建Yaml实例 - Yaml yaml = new Yaml(options); - File directory = new File(path); if (!directory.exists()) { boolean isCreated = directory.mkdirs(); @@ -36,11 +53,12 @@ public class YamlUtils { } String fullPath = path + "/" + fileName + ".yaml"; - - try (FileWriter writer = new FileWriter(fullPath)) { - yaml.dump(data, writer); - } catch (IOException e) { + File dumpFile = new File(fullPath); + try { + Yaml.dump(data, dumpFile); + } catch (FileNotFoundException e) { e.printStackTrace(); + } } @@ -53,7 +71,8 @@ public class YamlUtils { public static Map loadYamlFile(String filePath) { Yaml yaml = new Yaml(); try (InputStream inputStream = new FileInputStream(new File(filePath))) { - return yaml.load(inputStream); + Map load = (Map) yaml.load(inputStream); + return load; } catch (IOException e) { e.printStackTrace(); return null;