airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: Added logs to capture ssh connection creation and reuse
Date Mon, 21 Mar 2016 15:13:44 GMT
Repository: airavata
Updated Branches:
  refs/heads/develop 10274c11d -> 6d692ee34


Added logs to capture ssh connection creation and reuse


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6d692ee3
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6d692ee3
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6d692ee3

Branch: refs/heads/develop
Commit: 6d692ee342501d96e4ea89ec6cbe59f98fdb0558
Parents: 10274c1
Author: Shameera Rathnayaka <shameerainfo@gmail.com>
Authored: Mon Mar 21 11:13:40 2016 -0400
Committer: Shameera Rathnayaka <shameerainfo@gmail.com>
Committed: Mon Mar 21 11:13:40 2016 -0400

----------------------------------------------------------------------
 .../java/org/apache/airavata/gfac/impl/Factory.java     | 11 ++++++++++-
 .../org/apache/airavata/gfac/impl/HPCRemoteCluster.java | 12 +++++++++++-
 2 files changed, 21 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/6d692ee3/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
index c04de11..957b932 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
@@ -424,6 +424,12 @@ public abstract class Factory {
 		String key = serverInfo.getUserName() + "_" + serverInfo.getHost() + "_" + serverInfo.getPort();
 		Session session = sessionMap.get(key);
 		if (session == null || !session.isConnected()) {
+			// FIXME - move following info logs to debug
+			if (session != null) {
+				log.info("Reinitialize a new SSH session for :" + key);
+			} else {
+				log.info("Initialize a new SSH session for :" + key);
+			}
 			try {
 				if (authenticationInfo instanceof SSHKeyAuthentication) {
 					authentication = (SSHKeyAuthentication) authenticationInfo;
@@ -439,13 +445,16 @@ public abstract class Factory {
 				if (authentication.getStrictHostKeyChecking().equals("yes")) {
 					jSch.setKnownHosts(authentication.getKnownHostsFilePath());
 				} else {
-					session.setConfig("StrictHostKeyChecking","no");
+					session.setConfig("StrictHostKeyChecking", "no");
 				}
 				session.connect(); // 0 connection timeout
 				sessionMap.put(key, session);
 			} catch (JSchException e) {
 				throw new AiravataException("JSch initialization error ", e);
 			}
+		} else {
+			// FIXME - move following info log to debug
+			log.info("Reuse SSH session for :" + key);
 		}
 		return sessionMap.get(key);
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/6d692ee3/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/HPCRemoteCluster.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/HPCRemoteCluster.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/HPCRemoteCluster.java
index 7d8fe02..8e8b7ed 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/HPCRemoteCluster.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/HPCRemoteCluster.java
@@ -167,8 +167,13 @@ public class HPCRemoteCluster extends AbstractRemoteCluster{
 	@Override
 	public void scpThirdParty(String sourceFile, String destinationFile, Session clientSession,
DIRECTION direction, boolean ignoreEmptyFile) throws SSHApiException {
 		try {
-			if(!session.isConnected()){
+			if (!session.isConnected()) {
+				// FIXME - move following info log to debug
+				log.info("Reinitialize a new SSH session for key :" + serverInfo.getUserName() + "-"
+ serverInfo.getHost() + "-" + serverInfo.getPort());
 				session = getOpenSession();
+			} else {
+				// FIXME - move following info logs to debug
+				log.info("Reuse SSH session for key :" + serverInfo.getUserName() + "-" + serverInfo.getHost()
+ "-" + serverInfo.getPort());
 			}
 			log.info("Transferring from:" + sourceFile + " To: " + destinationFile);
             if (direction == DIRECTION.TO) {
@@ -186,7 +191,12 @@ public class HPCRemoteCluster extends AbstractRemoteCluster{
 	public void makeDirectory(String directoryPath) throws SSHApiException {
 		try {
 			if (!session.isConnected()) {
+				// FIXME - move following info log to debug
+				log.info("Reinitialize a new SSH session for key :" + serverInfo.getUserName() + "-"
+ serverInfo.getHost() + "-" + serverInfo.getPort());
 				session = getOpenSession();
+			} else {
+				// FIXME - move following info log to debug
+				log.info("Reuse SSH session for key :" + serverInfo.getUserName() + "-" + serverInfo.getHost()
+ "-" + serverInfo.getPort());
 			}
 			log.info("Creating directory: " + serverInfo.getHost() + ":" + directoryPath);
 			SSHUtils.makeDirectory(directoryPath, session);


Mime
View raw message