Skip to content

Commit

Permalink
#7332 SparkUI - bugfix for config structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Lukasz Mitusinski committed Jun 19, 2018
1 parent e0b0361 commit 8c3a677
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion beakerx/beakerx/environment.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"use_data_grid": true,
"show_catalog": false
},
"spark_profiles": []
"spark_options":{}
}
}
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ public void saveSparkConf(List<Map<String, Object>> profiles) {
Map<String, Map> map = beakerxJsonAsMap(path);
Map<String, Object> sparkOptions = (Map<String, Object>) map.get(BEAKERX).getOrDefault(SPARK_OPTIONS, new HashMap<>());
sparkOptions.put(SPARK_PROFILES, profiles == null ? new ArrayList<>() : profiles);
map.get(BEAKERX).put(SPARK_OPTIONS, sparkOptions);
String content = gson.toJson(map);
Files.write(path, content.getBytes(StandardCharsets.UTF_8));
this.profiles = profiles;
Expand Down Expand Up @@ -136,9 +137,11 @@ public List<String> getProfileNames() {
@Override
public void saveProfileName(String profileName) {
try {
Map<String, Map> beakerxJson = beakerxJsonAsMap(path);
beakerxJson.get(BEAKERX).put(CURRENT_PROFILE, profileName);
String content = gson.toJson(beakerxJson);
Map<String, Map> map = beakerxJsonAsMap(path);
Map<String, Object> sparkOptions = (Map<String, Object>) map.get(BEAKERX).getOrDefault(SPARK_OPTIONS, new HashMap<>());
sparkOptions.put(CURRENT_PROFILE, profileName);
map.get(BEAKERX).put(SPARK_OPTIONS, sparkOptions);
String content = gson.toJson(map);
Files.write(path, content.getBytes(StandardCharsets.UTF_8));
currentProfile = profileName;
} catch (IOException e) {
Expand Down

0 comments on commit 8c3a677

Please sign in to comment.