Skip to content

Commit

Permalink
handle sast
Browse files Browse the repository at this point in the history
Signed-off-by: wmqwxb <[email protected]>
  • Loading branch information
wmqwxb committed Dec 18, 2023
1 parent db531c2 commit e84af00
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 16 deletions.
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 e84af00

Please sign in to comment.