Skip to content

Commit

Permalink
Fix settings and cleanup old values
Browse files Browse the repository at this point in the history
  • Loading branch information
lukfor committed Sep 4, 2023
1 parent 8e6bdc4 commit f432128
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 152 deletions.
4 changes: 0 additions & 4 deletions src/main/java/cloudgene/mapred/cli/StartServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -130,10 +130,6 @@ protected Settings loadSettings(Config config) throws FileNotFoundException, Yam
settings = new Settings(config);
}

if (!settings.testPaths()) {
System.exit(1);
}

if (settings.getServerUrl() == null || settings.getServerUrl().trim().isEmpty()) {
System.out.println("serverUrl not set. Please set serverUrl in file '" + settingsFilename + "'");
System.exit(1);
Expand Down
153 changes: 5 additions & 148 deletions src/main/java/cloudgene/mapred/util/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,14 @@

public class Settings {

private String serverUrl = "http://localhost:8082";

private String hadoopPath = "/usr/";

private String pigPath = "/usr/";
private static final Logger log = LoggerFactory.getLogger(Settings.class);

private String sparkPath = "/usr/bin/spark-submit";
private String serverUrl = "http://localhost:8082";

private String tempPath = "tmp";

private String localWorkspace = "workspace";

private String hdfsWorkspace = "cloudgene/data";

private String hdfsAppWorkspace = "cloudgene/apps";

private String streamingJar = "";

private String version;

private String name = "Cloudgene";
Expand All @@ -53,8 +43,6 @@ public class Settings {

private Map<String, String> database;

private Map<String, String> cluster;

private Map<String, Map<String, String>> plugins;

private int autoRetireInterval = 5;
Expand All @@ -73,30 +61,18 @@ public class Settings {

private boolean streaming = true;

private boolean removeHdfsWorkspace = true;

private static final Logger log = LoggerFactory.getLogger(Settings.class);

private boolean writeStatistics = true;

private boolean https = false;

private String httpsKeystore = "";

private String httpsPassword = "";

private boolean maintenance = false;

private String adminMail = null;

private String slack = null;

private String urlPrefix = "";

private List<MenuItem> navigation = new Vector<MenuItem>();

private boolean secureCookie = false;

private Map<String, String> externalWorkspace = null;

private int uploadLimit = 500;
Expand All @@ -116,7 +92,7 @@ public class Settings {

private ApplicationRepository repository;

public Settings() {
private Settings() {

repository = new ApplicationRepository();

Expand Down Expand Up @@ -197,6 +173,8 @@ public static Settings load(Config config) throws FileNotFoundException, YamlExc
log.info("Notify user after " + settings.notificationAfter + " days.");
log.info("Write statistics: " + settings.writeStatistics);

settings.config = config;

// workspace in config has higher priority
if (config.getWorkspace() != null) {
settings.setLocalWorkspace(config.getWorkspace());
Expand Down Expand Up @@ -291,22 +269,6 @@ public void save(String filename) {

}

public String getHadoopPath() {
return hadoopPath;
}

public void setHadoopPath(String hadoopPath) {
this.hadoopPath = hadoopPath;
}

public void setPigPath(String pigPath) {
this.pigPath = pigPath;
}

public String getPigPath() {
return pigPath;
}

public String getTempPath() {
return tempPath;
}
Expand All @@ -323,30 +285,6 @@ public void setLocalWorkspace(String localWorkspace) {
this.localWorkspace = localWorkspace;
}

public String getHdfsWorkspace() {
return hdfsWorkspace;
}

public void setHdfsWorkspace(String hdfsWorkspace) {
this.hdfsWorkspace = hdfsWorkspace;
}

public String getHdfsAppWorkspace() {
return hdfsAppWorkspace;
}

public void setHdfsAppWorkspace(String hdfsAppWorkspace) {
this.hdfsAppWorkspace = hdfsAppWorkspace;
}

public String getStreamingJar() {
return streamingJar;
}

public void setStreamingJar(String streamingJar) {
this.streamingJar = streamingJar;
}

public boolean isStreaming() {
return streaming;
}
Expand All @@ -355,39 +293,6 @@ public void setStreaming(boolean streaming) {
this.streaming = streaming;
}

public boolean isRemoveHdfsWorkspace() {
return removeHdfsWorkspace;
}

public void setRemoveHdfsWorkspace(boolean removeHdfsWorkspace) {
this.removeHdfsWorkspace = removeHdfsWorkspace;
}

public boolean testPaths() {

String hadoop = FileUtil.path(hadoopPath, "bin", "hadoop");

if (!new File(hadoop).exists()) {

log.warn("hadoop '" + hadoop + "' does not exist. please change it.");

// return false;

}
/*
* if (!new File(streamingJar).exists()) {
*
* log.error("streamingJar '" + streamingJar + "' does not exist.");
*
* return false;
*
* }
*/

return true;

}

public String getVersion() {
return version;
}
Expand All @@ -404,22 +309,6 @@ public void setMail(Map<String, String> mail) {
this.mail = mail;
}

public Map<String, String> getCluster() {
return cluster;
}

public void setCluster(Map<String, String> cluster) {
this.cluster = cluster;
}

public String getSlack() {
return slack;
}

public void setSlack(String slack) {
this.slack = slack;
}

public void setName(String name) {
this.name = name;
}
Expand Down Expand Up @@ -482,22 +371,6 @@ public boolean isHttps() {
return https;
}

public void setHttpsKeystore(String httpsKeystore) {
this.httpsKeystore = httpsKeystore;
}

public String getHttpsKeystore() {
return httpsKeystore;
}

public void setHttpsPassword(String httpsPassword) {
this.httpsPassword = httpsPassword;
}

public String getHttpsPassword() {
return httpsPassword;
}

public void setMaintenance(boolean maintenance) {
this.maintenance = maintenance;
}
Expand All @@ -514,14 +387,6 @@ public String getAdminMail() {
return adminMail;
}

public String getSparkPath() {
return sparkPath;
}

public void setSparkPath(String sparkPath) {
this.sparkPath = sparkPath;
}

public void setThreadsQueue(int threadsQueue) {
this.threadsQueue = threadsQueue;
}
Expand Down Expand Up @@ -570,14 +435,6 @@ public List<MenuItem> getNavigation() {
return navigation;
}

public boolean isSecureCookie() {
return secureCookie;
}

public void setSecureCookie(boolean secureCookie) {
this.secureCookie = secureCookie;
}

public int getUploadLimit() {
return uploadLimit;
}
Expand Down

0 comments on commit f432128

Please sign in to comment.