You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by di...@apache.org on 2020/11/02 19:48:08 UTC

[airavata] branch develop updated (3acf293 -> 7d6073b)

This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a change to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git.


    from 3acf293  Changing pga folder permissions to be accessible by all
     new 4ca774b  Reading properties from the environment variables
     new 7d6073b  Automatically creating the helix cluster if not available

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../airavata/helix/impl/controller/HelixController.java   | 15 +++++++++++++++
 .../apache/airavata/common/utils/ApplicationSettings.java | 14 +++++++++-----
 2 files changed, 24 insertions(+), 5 deletions(-)


[airavata] 01/02: Reading properties from the environment variables

Posted by di...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 4ca774bbd36bd8d8f882b993a4a438283e9ca775
Author: Dimuthu Wannipurage <di...@gmail.com>
AuthorDate: Mon Nov 2 14:47:25 2020 -0500

    Reading properties from the environment variables
---
 .../apache/airavata/common/utils/ApplicationSettings.java  | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java b/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
index f78b196..7340ef9 100644
--- a/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
+++ b/modules/commons/src/main/java/org/apache/airavata/common/utils/ApplicationSettings.java
@@ -180,13 +180,17 @@ public class ApplicationSettings {
     }
     
     public String getSettingImpl(String key) throws ApplicationSettingsException{
-    	String rawValue=null;
-    	if (System.getProperties().containsKey(key)){
-    		rawValue=System.getProperties().getProperty(key);
-    	}else{
+    	String rawValue;
+    	if (System.getProperties().containsKey(key)) {
+            rawValue = System.getProperties().getProperty(key);
+
+        } else if (System.getenv().containsKey(key)) {
+    	    rawValue = System.getenv().get(key);
+
+    	} else {
     		validateSuccessfulPropertyFileLoad();
 	    	if (properties.containsKey(key)){
-	    		rawValue=properties.getProperty(key);
+	    		rawValue = properties.getProperty(key);
 	    	}else{
 	    		throw new ApplicationSettingsException(key);
 	    	}


[airavata] 02/02: Automatically creating the helix cluster if not available

Posted by di...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

dimuthuupe pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 7d6073b9227c2cd1949e1e41f4371f2ca755e8d3
Author: Dimuthu Wannipurage <di...@gmail.com>
AuthorDate: Mon Nov 2 14:47:53 2020 -0500

    Automatically creating the helix cluster if not available
---
 .../airavata/helix/impl/controller/HelixController.java   | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/controller/HelixController.java b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/controller/HelixController.java
index 799b216..ee4656e 100644
--- a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/controller/HelixController.java
+++ b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/controller/HelixController.java
@@ -22,6 +22,9 @@ package org.apache.airavata.helix.impl.controller;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.helix.controller.HelixControllerMain;
+import org.apache.helix.manager.zk.ZKHelixAdmin;
+import org.apache.helix.manager.zk.ZNRecordSerializer;
+import org.apache.helix.manager.zk.ZkClient;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -57,6 +60,18 @@ public class HelixController implements Runnable {
 
     public void run() {
         try {
+            ZkClient zkClient = new ZkClient(ServerSettings.getZookeeperConnection(), ZkClient.DEFAULT_SESSION_TIMEOUT,
+                    ZkClient.DEFAULT_CONNECTION_TIMEOUT, new ZNRecordSerializer());
+            ZKHelixAdmin zkHelixAdmin = new ZKHelixAdmin(zkClient);
+
+            // Creates the zk cluster if not available
+            if (! zkHelixAdmin.getClusters().contains(clusterName)) {
+                zkHelixAdmin.addCluster(clusterName, true);
+            }
+
+            zkHelixAdmin.close();
+            zkClient.close();
+
             logger.info("Connection to helix cluster : " + clusterName + " with name : " + controllerName);
             logger.info("Zookeeper connection string " + zkAddress);