Skip to content

Commit

Permalink
Merge branch 'develop-2.0.0' of https://github.com/FederatedAI/FATE-B…
Browse files Browse the repository at this point in the history
…oard into develop-2.0.0
  • Loading branch information
idwenwen committed Dec 19, 2023
2 parents 80552b9 + e84af00 commit fa55b93
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 17 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.7.12</version>
<version>2.7.18</version>
<relativePath/>
</parent>

Expand Down
37 changes: 25 additions & 12 deletions src/main/java/org/fedai/fate/board/services/JobDetailService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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<String> 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<String, Object> yamlData = yaml.load(inputStream);
jsonData = objectMapper.writeValueAsString(yamlData);
}

Yaml yaml = new Yaml();
ObjectMapper objectMapper = new ObjectMapper();
InputStream inputStream = new FileInputStream(yamlFilePath);
Map<String, Object> yamlData = yaml.load(inputStream);
jsonData = objectMapper.writeValueAsString(yamlData);

return jsonData;
}

private List<String> getWhiteList(String projectDir) {
String dirPath = projectDir + File.separator + "dag";
File dir = new File(dirPath);
File[] files = dir.listFiles();
List<String> 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();
Expand Down
8 changes: 4 additions & 4 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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 ;
Expand All @@ -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
Expand Down

0 comments on commit fa55b93

Please sign in to comment.