Skip to content

Commit

Permalink
Merge branch 'develop-2.1.0' of https://github.com/FederatedAI/FATE-B…
Browse files Browse the repository at this point in the history
…oard into develop-2.1.0
  • Loading branch information
idwenwen committed Feb 29, 2024
2 parents 259e1ba + 6a1685d commit 8ec6e78
Show file tree
Hide file tree
Showing 8 changed files with 45 additions and 22 deletions.
6 changes: 4 additions & 2 deletions bin/service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,12 @@ eval action=\$$#

main_class=org.fedai.fate.board.bootstrap.Bootstrap
module=fateboard
version=2.0.0
version=2.1.0
start_type=background

if [ $action = starting ];then
action=start
start_type=front
elif [ $action = restarting ];then
action=restart
fi
Expand Down Expand Up @@ -252,7 +254,7 @@ start() {
cmd="$JAVA_HOME/bin/java -Dspring.config.location=$configpath/application.properties -Dssh_config_file=$basepath/ssh/ -Xmx2048m -Xms2048m -XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:gc.log -XX:+HeapDumpOnOutOfMemoryError -cp $libpath/*:$basepath/${module}-${version}.jar ${main_class}"
print_info "The command is: $cmd"

if [[ $1 == "front" ]]; then
if [[ ${start_type} == "front" ]]; then
exec $cmd >> ${BOARD_HOME}/logs/bootstrap.${module}.out 2>>${BOARD_HOME}/logs/bootstrap.${module}.err
else
exec $cmd >> ${BOARD_HOME}/logs/bootstrap.${module}.out 2>>${BOARD_HOME}/logs/bootstrap.${module}.err &
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.TypeReference;
import com.alibaba.fastjson.serializer.SerializerFeature;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.common.base.Preconditions;
import com.google.common.collect.Maps;
import org.fedai.fate.board.exceptions.LogicException;
Expand All @@ -39,6 +41,8 @@
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springframework.util.concurrent.ListenableFuture;
import org.yaml.snakeyaml.DumperOptions;
import org.yaml.snakeyaml.Yaml;

import javax.servlet.http.HttpServletResponse;
import java.io.*;
Expand Down Expand Up @@ -319,8 +323,10 @@ public ResponseResult download(DownloadQO downloadQO, HttpServletResponse respon
response.setContentType("application/force-download");
response.setHeader("Content-Disposition", "attachment;fileName=" + fileOutputName);
try {
String yamlStr = jsonConverToYaml(dagInfo.toJSONString());
OutputStream os = response.getOutputStream();
os.write(JSON.toJSONBytes(dagInfo, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat));
// os.write(JSON.toJSONBytes(dagInfo, SerializerFeature.PrettyFormat, SerializerFeature.WriteMapNullValue, SerializerFeature.WriteDateUseDateFormat));
os.write(yamlStr.getBytes());
log.info("download success,file :{}", fileOutputName);
} catch (Exception e) {
log.error("download failed", e);
Expand All @@ -329,6 +335,17 @@ public ResponseResult download(DownloadQO downloadQO, HttpServletResponse respon
return null;
}

private String jsonConverToYaml(String jsonString) throws JsonProcessingException {
ObjectMapper objectMapper = new ObjectMapper();
Object obj = objectMapper.readValue(jsonString, Object.class);
DumperOptions options = new DumperOptions();
options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK);
Yaml yaml = new Yaml(options);
String yamlStr = yaml.dumpAsMap(obj);
return yamlStr;
}


//host端需过滤掉其他方信息
private JSONObject getHostConfig(JSONObject runtime_confObject) {
if (runtime_confObject != null) {
Expand Down
3 changes: 2 additions & 1 deletion static/evaluation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ component:
use 'label' in the input dataframe
input_artifacts:
data:
input_data:
input_datas:
types:
- dataframe
optional: false
Expand Down Expand Up @@ -82,3 +82,4 @@ component:
description: metric, invisible for user
is_multi: false
schema_version: v1

11 changes: 6 additions & 5 deletions static/hetero_nn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ component:
description: ''
is_multi: false
model:
train_model_input:
warm_start_model:
types:
- model_directory
optional: true
Expand All @@ -98,7 +98,7 @@ component:
- host
description: ''
is_multi: false
predict_model_input:
input_model:
types:
- model_directory
optional: false
Expand All @@ -111,7 +111,7 @@ component:
is_multi: false
output_artifacts:
data:
train_data_output:
train_output_data:
types:
- dataframe
optional: true
Expand All @@ -122,7 +122,7 @@ component:
- host
description: ''
is_multi: false
predict_data_output:
test_output_data:
types:
- dataframe
optional: true
Expand All @@ -134,7 +134,7 @@ component:
description: ''
is_multi: false
model:
train_model_output:
output_model:
types:
- model_directory
optional: true
Expand All @@ -155,3 +155,4 @@ component:
description: metric, invisible for user
is_multi: false
schema_version: v1

9 changes: 5 additions & 4 deletions static/hetero_secureboost.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ component:
description: ''
is_multi: false
model:
train_model_input:
warm_start_model:
types:
- json_model
optional: true
Expand All @@ -327,7 +327,7 @@ component:
- host
description: ''
is_multi: false
predict_model_input:
input_model:
types:
- json_model
optional: false
Expand All @@ -340,7 +340,7 @@ component:
is_multi: false
output_artifacts:
data:
train_data_output:
train_output_data:
types:
- dataframe
optional: true
Expand Down Expand Up @@ -374,7 +374,7 @@ component:
description: ''
is_multi: true
model:
train_model_output:
output_model:
types:
- json_model
optional: true
Expand All @@ -395,3 +395,4 @@ component:
description: metric, invisible for user
is_multi: false
schema_version: v1

6 changes: 3 additions & 3 deletions static/homo_lr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ component:
description: ''
is_multi: false
model:
train_input_model:
warm_start_model:
types:
- json_model
optional: true
Expand All @@ -217,7 +217,7 @@ component:
- host
description: ''
is_multi: false
predict_input_model:
input_model:
types:
- json_model
optional: false
Expand Down Expand Up @@ -253,7 +253,7 @@ component:
description: ''
is_multi: false
model:
train_output_model:
output_model:
types:
- json_model
optional: false
Expand Down
11 changes: 6 additions & 5 deletions static/homo_nn.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ component:
description: ''
is_multi: false
model:
train_model_input:
warm_start_model:
types:
- model_directory
optional: true
Expand All @@ -99,7 +99,7 @@ component:
- host
description: ''
is_multi: false
predict_model_input:
input_model:
types:
- model_directory
optional: false
Expand All @@ -112,7 +112,7 @@ component:
is_multi: false
output_artifacts:
data:
train_data_output:
train_output_data:
types:
- dataframe
optional: true
Expand All @@ -123,7 +123,7 @@ component:
- host
description: ''
is_multi: false
predict_data_output:
test_output_data:
types:
- dataframe
optional: true
Expand All @@ -135,7 +135,7 @@ component:
description: ''
is_multi: false
model:
train_model_output:
output_model:
types:
- model_directory
optional: true
Expand All @@ -156,3 +156,4 @@ component:
description: metric, invisible for user
is_multi: false
schema_version: v1

2 changes: 1 addition & 1 deletion static/union.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ component:
parameters: { }
input_artifacts:
data:
input_data_list:
input_datas:
types:
- dataframe
optional: false
Expand Down

0 comments on commit 8ec6e78

Please sign in to comment.