diff --git a/pom.xml b/pom.xml index b91a51a3..4492b36b 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ org.springframework.boot spring-boot-starter-parent - 2.7.12 + 2.7.18 diff --git a/src/main/java/org/fedai/fate/board/services/JobDetailService.java b/src/main/java/org/fedai/fate/board/services/JobDetailService.java index f90f959a..323b3efc 100644 --- a/src/main/java/org/fedai/fate/board/services/JobDetailService.java +++ b/src/main/java/org/fedai/fate/board/services/JobDetailService.java @@ -50,22 +50,35 @@ public class JobDetailService { public String getComponentStaticInfo(String componentName) throws Exception { String projectDir = System.getProperty("user.dir"); String jsonData = ""; - String yamlFilePath = projectDir + File.separator + "dag" + File.separator +componentName + ".yaml"; - File file = new File(yamlFilePath); - if (!file.exists()) { - logger.error("no this file find: {} ", yamlFilePath); - return jsonData; + List whiteList = getWhiteList(projectDir); + String fileName = componentName + ".yaml"; + int index = whiteList.indexOf(fileName); + if (index > -1) { + String yamlFilePath = projectDir + File.separator + "dag" + File.separator +componentName + ".yaml"; + Yaml yaml = new Yaml(); + ObjectMapper objectMapper = new ObjectMapper(); + InputStream inputStream = new FileInputStream(yamlFilePath); + Map yamlData = yaml.load(inputStream); + jsonData = objectMapper.writeValueAsString(yamlData); } - - Yaml yaml = new Yaml(); - ObjectMapper objectMapper = new ObjectMapper(); - InputStream inputStream = new FileInputStream(yamlFilePath); - Map yamlData = yaml.load(inputStream); - jsonData = objectMapper.writeValueAsString(yamlData); - return jsonData; } + private List getWhiteList(String projectDir) { + String dirPath = projectDir + File.separator + "dag"; + File dir = new File(dirPath); + File[] files = dir.listFiles(); + List whiteList = new ArrayList<>(); + if (files != null && files.length > 0) { + for (File file : files) { + if (file.isFile()) { + whiteList.add(file.getName()); + } + } + } + return whiteList; + } + public JSONObject getBatchMetricInfo(BatchMetricDTO batchMetricDTO) { String jobId = batchMetricDTO.getJob_id(); diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 3846fd7d..68c7c7dc 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -7,8 +7,8 @@ zookeeper.time_out=30000 zookeeper.url_list=localhost:2181 zookeeper.scheme=digest zookeeper.charset=UTF-8 -zookeeper.acl_username=admin -zookeeper.acl_password=admin +zookeeper.acl_username= +zookeeper.acl_password= zookeeper.node_path=/FATE-COMPONENTS/fate-flow #priority is higher than {fateflow.url}, split by ; @@ -27,8 +27,8 @@ spring.servlet.multipart.max-request-size=100MB spring.servlet.session.timeout=1800s server.compression.enabled=true server.compression.mime-types=application/json,application/xml,text/html,text/xml,text/plain -server.board.login.username=admin -server.board.login.password=admin +server.board.login.username= +server.board.login.password= server.board.encrypt.private_key= server.board.encrypt.enable=false #only [h,m,s] is available