airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject [34/62] [abbrv] airavata git commit: more fixed to support LSF
Date Thu, 19 Mar 2015 15:03:00 GMT
more fixed to support LSF


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

Branch: refs/heads/queue-gfac-rabbitmq
Commit: fcbda21f3fbbbc75afa01f4b590afe873c192de2
Parents: 04cecb4
Author: Lahiru Gunathilake <glahiru@gmail.com>
Authored: Mon Mar 9 17:03:33 2015 -0400
Committer: Lahiru Gunathilake <glahiru@gmail.com>
Committed: Mon Mar 9 17:03:33 2015 -0400

----------------------------------------------------------------------
 .../airavata/api/server/AiravataAPIServer.java  | 38 +++++++++---------
 .../client/samples/CreateLaunchExperiment.java  | 20 +++++++---
 .../tools/RegisterSampleApplications.java       | 10 +++--
 .../store/store/impl/db/SSHCredentialTest.java  |  2 +-
 .../airavata/gfac/server/GfacServerHandler.java | 39 +++++++++---------
 .../monitor/impl/pull/qstat/HPCPullMonitor.java | 42 +++++++++++++++++---
 .../airavata/gfac/monitor/util/CommonUtils.java |  1 +
 .../gfac/ssh/security/TokenizedSSHAuthInfo.java |  5 ++-
 .../impl/DefaultSSHApiTestWithMyProxyAuth.java  | 14 ++++---
 .../gsi/ssh/impl/VanilaTestWithSSHAuth.java     |  4 +-
 10 files changed, 112 insertions(+), 63 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
index 0e6da90..4d465f7 100644
--- a/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
+++ b/airavata-api/airavata-api-server/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
@@ -302,26 +302,26 @@ public class AiravataAPIServer implements IServer, Watcher{
         synchronized (mutex) {
             Event.KeeperState state = watchedEvent.getState();
             logger.info(state.name());
-            if (state == Event.KeeperState.SyncConnected) {
-                mutex.notify();
-            } else if(state == Event.KeeperState.Expired ||
-                    state == Event.KeeperState.Disconnected){
-                try {
-                    mutex = -1;
-                    zk = new ZooKeeper(AiravataZKUtils.getZKhostPort(), 6000, this);
-                    synchronized (mutex) {
-                        mutex.wait();  // waiting for the syncConnected event
+            switch(state){
+                case SyncConnected:
+                    mutex.notify();
+                case Expired:case Disconnected:
+                    try {
+                        mutex = -1;
+                        zk = new ZooKeeper(AiravataZKUtils.getZKhostPort(), 6000, this);
+                        synchronized (mutex) {
+                            mutex.wait();  // waiting for the syncConnected event
+                        }
+                        storeServerConfig();
+                    } catch (IOException e) {
+                        logger.error("Error while synchronizing with zookeeper", e);
+                    } catch (ApplicationSettingsException e) {
+                        logger.error("Error while synchronizing with zookeeper", e);
+                    } catch (InterruptedException e) {
+                        logger.error("Error while synchronizing with zookeeper", e);
+                    } catch (AiravataSystemException e) {
+                        logger.error("Error while synchronizing with zookeeper", e);
                     }
-                    storeServerConfig();
-                } catch (IOException e) {
-                    logger.error("Error while synchronizing with zookeeper", e);
-                } catch (ApplicationSettingsException e) {
-                    logger.error("Error while synchronizing with zookeeper", e);
-                } catch (InterruptedException e) {
-                    logger.error("Error while synchronizing with zookeeper", e);
-                } catch (AiravataSystemException e) {
-                    logger.error("Error while synchronizing with zookeeper", e);
-                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index bb2ae6e..3d58197 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -58,7 +58,7 @@ public class CreateLaunchExperiment {
     private static final String DEFAULT_GATEWAY = "php_reference_gateway";
     private static Airavata.Client airavataClient;
 
-    private static String echoAppId = "Echo_802454e5-6358-4371-9a04-3d5d59cecbc7";
+    private static String echoAppId = "Echo_8506337e-ab7a-46b6-9b71-4a461b6c5e35";
     private static String mpiAppId = "HelloMPI_720e159f-198f-4daa-96ca-9f5eafee92c9";
     private static String wrfAppId = "WRF_7ad5da38-c08b-417c-a9ea-da9298839762";
     private static String amberAppId = "Amber_a56d457c-f239-4c0b-ba00-66bda936f7bc";
@@ -1348,27 +1348,37 @@ public class CreateLaunchExperiment {
 
     public static String createExperimentForLSF(Airavata.Client client) throws TException
{
         try {
-            List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();
+            List<InputDataObjectType> exInputs = client.getApplicationInputs(echoAppId);
+
+            for (InputDataObjectType inputDataObjectType : exInputs) {
+                inputDataObjectType.setValue("Hello World");
+            }
+            /*List<InputDataObjectType> exInputs = new ArrayList<InputDataObjectType>();
             InputDataObjectType input = new InputDataObjectType();
             input.setName("Input_to_Echo");
             input.setType(DataType.STRING);
             input.setValue("Echoed_Output=Hello World");
             input.setRequiredToAddedToCommandLine(true);
-            exInputs.add(input);
+            exInputs.add(input);*/
 
+            List<OutputDataObjectType> exOut = client.getApplicationOutputs(echoAppId);
+            /*
             List<OutputDataObjectType> exOut = new ArrayList<OutputDataObjectType>();
             OutputDataObjectType output = new OutputDataObjectType();
             output.setName("output_file");
             output.setType(DataType.URI);
             output.setValue("");
-            exOut.add(output);
+
+            exOut.add(output);*/
 
             Project project = ProjectModelUtil.createProject("default", "lg11w", "test project");
             String projectId = client.createProject(DEFAULT_GATEWAY, project);
 
+
             Experiment simpleExperiment =
                     ExperimentModelUtil.createSimpleExperiment(projectId, "lg11w", "sshEchoExperiment",
"StressMem", echoAppId, exInputs);
             simpleExperiment.setExperimentOutputs(exOut);
+            simpleExperiment.setExperimentInputs(exInputs);
 
             Map<String, String> computeResources = airavataClient.getAvailableAppInterfaceComputeResources(echoAppId);
             if (computeResources != null && computeResources.size() != 0) {
@@ -1598,7 +1608,7 @@ public class CreateLaunchExperiment {
     public static void launchExperiment(Airavata.Client client, String expId)
             throws TException {
         try {
-        	String tokenId ="aa-dcdb-48e3-9cd5-ac90b710d55e";
+        	String tokenId ="-0bbb-403b-a88a-42b6dbe198e9";
             client.launchExperiment(expId, tokenId);
         } catch (ExperimentNotFoundException e) {
             logger.error("Error occured while launching the experiment...", e.getMessage());

http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
index 8ae2dd2..55dbcf8 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/tools/RegisterSampleApplications.java
@@ -497,11 +497,15 @@ public class RegisterSampleApplications {
 //            applicationInputs.add(input2); applicationInputs.add(input3);
 
             OutputDataObjectType output1 = RegisterSampleApplicationsUtils.createAppOutput("Echoed_Output",
-                    "", DataType.STRING, false, false);
-            
+                    "", DataType.STDOUT, false, false);
+
+            OutputDataObjectType output2 = RegisterSampleApplicationsUtils.createAppOutput("Echoed_Error",
+                    "", DataType.STDERR, false, false);
+
             List<OutputDataObjectType> applicationOutputs = new ArrayList<OutputDataObjectType>();
             applicationOutputs.add(output1);
-            
+            applicationOutputs.add(output2);
+
 
             echoInterfaceId = airavataClient.registerApplicationInterface(DEFAULT_GATEWAY,
                     RegisterSampleApplicationsUtils.createApplicationInterfaceDescription(echoName,
echoDescription,

http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/SSHCredentialTest.java
----------------------------------------------------------------------
diff --git a/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/SSHCredentialTest.java
b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/SSHCredentialTest.java
index e78ab7a..e6969e6 100644
--- a/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/SSHCredentialTest.java
+++ b/modules/credential-store/credential-store-service/src/test/java/org/apache/airavata/credential/store/store/impl/db/SSHCredentialTest.java
@@ -67,7 +67,7 @@ public class SSHCredentialTest {
             pubKeyStream.close();
             sshCredential.setPrivateKey(bFilePub);
             sshCredential.setPublicKey(bFilePub);
-            sshCredential.setPassphrase("gjtlmiJdas7wph");
+            sshCredential.setPassphrase("ljclqowueqllad_lqlj");
             writer.writeCredentials(sshCredential);
             System.out.println(token);
         } catch (ClassNotFoundException e) {

http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
index 1687462..4973a41 100644
--- a/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
+++ b/modules/gfac/airavata-gfac-service/src/main/java/org/apache/airavata/gfac/server/GfacServerHandler.java
@@ -156,27 +156,26 @@ public class GfacServerHandler implements GfacService.Iface, Watcher{
         synchronized (mutex) {
             Event.KeeperState state = watchedEvent.getState();
             logger.info(state.name());
-            if (state == Event.KeeperState.SyncConnected) {
-                mutex.notify();
-                connected = true;
-            } else if(state == Event.KeeperState.Expired ||
-                    state == Event.KeeperState.Disconnected){
-                try {
-                    mutex = -1;
-                    zk = new ZooKeeper(AiravataZKUtils.getZKhostPort(), 6000, this);
-                    synchronized (mutex) {
-                        mutex.wait();  // waiting for the syncConnected event
+            switch (state){
+                case SyncConnected:
+                    mutex.notify();
+                    break;
+                case Expired:case Disconnected:
+                    try {
+                        zk = new ZooKeeper(AiravataZKUtils.getZKhostPort(), 6000, this);
+                        synchronized (mutex) {
+                            mutex.wait();  // waiting for the syncConnected event
+                        }
+                        storeServerConfig();
+                    } catch (IOException e) {
+                        logger.error(e.getMessage(), e);
+                    } catch (ApplicationSettingsException e) {
+                        logger.error(e.getMessage(), e);
+                    } catch (InterruptedException e) {
+                        logger.error(e.getMessage(), e);
+                    } catch (KeeperException e) {
+                        logger.error(e.getMessage(), e);
                     }
-                    storeServerConfig();
-                } catch (IOException e) {
-                    logger.error(e.getMessage(), e);
-                } catch (ApplicationSettingsException e) {
-                    logger.error(e.getMessage(), e);
-                } catch (InterruptedException e) {
-                    logger.error(e.getMessage(), e);
-                } catch (KeeperException e) {
-                    logger.error(e.getMessage(), e);
-                }
             }
         }
     }

http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
index b7f08a6..f0b447e 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/HPCPullMonitor.java
@@ -74,6 +74,8 @@ public class HPCPullMonitor extends PullMonitor {
 
     private AuthenticationInfo authenticationInfo;
 
+    private ArrayList<MonitorID> removeList;
+
     public HPCPullMonitor() {
         connections = new HashMap<String, ResourceConnection>();
         queue = new LinkedBlockingDeque<UserMonitorData>();
@@ -81,6 +83,7 @@ public class HPCPullMonitor extends PullMonitor {
         cancelJobList = new LinkedBlockingQueue<String>();
         completedJobsFromPush = new ArrayList<String>();
         (new SimpleJobFinishConsumer(this.completedJobsFromPush)).listen();
+        removeList = new ArrayList<MonitorID>();
     }
 
     public HPCPullMonitor(MonitorPublisher monitorPublisher, AuthenticationInfo authInfo)
{
@@ -91,6 +94,7 @@ public class HPCPullMonitor extends PullMonitor {
         cancelJobList = new LinkedBlockingQueue<String>();
         this.completedJobsFromPush = new ArrayList<String>();
         (new SimpleJobFinishConsumer(this.completedJobsFromPush)).listen();
+        removeList = new ArrayList<MonitorID>();
     }
 
     public HPCPullMonitor(BlockingQueue<UserMonitorData> queue, MonitorPublisher publisher)
{
@@ -100,6 +104,7 @@ public class HPCPullMonitor extends PullMonitor {
         cancelJobList = new LinkedBlockingQueue<String>();
         this.completedJobsFromPush = new ArrayList<String>();
         (new SimpleJobFinishConsumer(this.completedJobsFromPush)).listen();
+        removeList = new ArrayList<MonitorID>();
     }
 
 
@@ -182,20 +187,23 @@ public class HPCPullMonitor extends PullMonitor {
                             String cancelMId = iterator1.next();
                             if (cancelMId.equals(iMonitorID.getExperimentID() + "+" + iMonitorID.getTaskID()))
{
                                 iMonitorID.setStatus(JobState.CANCELED);
-                                CommonUtils.removeMonitorFromQueue(take, iMonitorID);
+//                                CommonUtils.removeMonitorFromQueue(take, iMonitorID);
+                                removeList.add(iMonitorID);
                                 logger.debugId(cancelMId, "Found a match in cancel monitor
queue, hence moved to the " +
                                                 "completed job queue, experiment {}, task
{} , job {}",
                                         iMonitorID.getExperimentID(), iMonitorID.getTaskID(),
iMonitorID.getJobID());
                                 logger.info("Job cancelled: marking the Job as ************CANCELLED************
experiment {}, task {}, job name {} .",
                                         iMonitorID.getExperimentID(), iMonitorID.getTaskID(),
iMonitorID.getJobName());
                                 sendNotification(iMonitorID);
-                                monitorIDListIterator.remove();
                                 GFacThreadPoolExecutor.getFixedThreadPool().submit(new OutHandlerWorker(gfac,
iMonitorID, publisher));
                                 break;
                             }
                         }
                         iterator1 = cancelJobList.iterator();
                     }
+
+                    cleanup(take);
+
                     synchronized (completedJobsFromPush) {
                         for (ListIterator<String> iterator = completedJobsFromPush.listIterator();
iterator.hasNext(); ) {
                             String completeId = iterator.next();
@@ -204,14 +212,14 @@ public class HPCPullMonitor extends PullMonitor {
                                 if (completeId.equals(iMonitorID.getUserName() + "," + iMonitorID.getJobName()))
{
                                     logger.info("This job is finished because push notification
came with <username,jobName> " + completeId);
                                     iMonitorID.setStatus(JobState.COMPLETE);
-                                    CommonUtils.removeMonitorFromQueue(take, iMonitorID);//we
have to make this empty everytime we iterate, otherwise this list will accumulate and will
lead to a memory leak
+//                                    CommonUtils.removeMonitorFromQueue(take, iMonitorID);//we
have to make this empty everytime we iterate, otherwise this list will accumulate and will
lead to a memory leak
+                                    removeList.add(iMonitorID);
                                     logger.debugId(completeId, "Push notification updated
job {} status to {}. " +
                                                     "experiment {} , task {}.", iMonitorID.getJobID(),
JobState.COMPLETE.toString(),
                                             iMonitorID.getExperimentID(), iMonitorID.getTaskID());
                                     logger.info("AMQP message recieved: marking the Job as
************COMPLETE************ experiment {}, task {}, job name {} .",
                                             iMonitorID.getExperimentID(), iMonitorID.getTaskID(),
iMonitorID.getJobName());
 
-                                    iterator.remove();
                                     sendNotification(iMonitorID);
                                     GFacThreadPoolExecutor.getFixedThreadPool().submit(new
OutHandlerWorker(gfac, iMonitorID, publisher));
                                     break;
@@ -220,6 +228,8 @@ public class HPCPullMonitor extends PullMonitor {
                         }
                     }
 
+                    cleanup(take);
+
                     // we have to get this again because we removed the already completed
jobs with amqp messages
                     monitorID = iHostMonitorData.getMonitorIDs();
                     Map<String, JobState> jobStatuses = connection.getJobStatuses(monitorID);
@@ -232,7 +242,8 @@ public class HPCPullMonitor extends PullMonitor {
                         } else if (JobState.COMPLETE.equals(iMonitorID.getStatus())) {
                             logger.debugId(iMonitorID.getJobID(), "Moved job {} to completed
jobs map, experiment {}, " +
                                     "task {}", iMonitorID.getJobID(), iMonitorID.getExperimentID(),
iMonitorID.getTaskID());
-                            CommonUtils.removeMonitorFromQueue(take, iMonitorID);
+//                            CommonUtils.removeMonitorFromQueue(take, iMonitorID);
+                            removeList.add(iMonitorID);
                             logger.info("PULL Notification is complete: marking the Job as
************COMPLETE************ experiment {}, task {}, job name {} .",
                                     iMonitorID.getExperimentID(), iMonitorID.getTaskID(),
iMonitorID.getJobName());
                             GFacThreadPoolExecutor.getFixedThreadPool().submit(new OutHandlerWorker(gfac,
iMonitorID, publisher));
@@ -244,6 +255,9 @@ public class HPCPullMonitor extends PullMonitor {
                         iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
                     }
 
+                    cleanup(take);
+
+
                     for (Iterator<MonitorID> iterator = monitorID.listIterator(); iterator.hasNext();
) {
                         MonitorID iMonitorID = iterator.next();
                         if (iMonitorID.getFailedCount() > FAILED_COUNT) {
@@ -268,7 +282,8 @@ public class HPCPullMonitor extends PullMonitor {
                                 logger.info("Listing directory came as complete: marking
the Job as ************COMPLETE************ experiment {}, task {}, job name {} .",
                                         iMonitorID.getExperimentID(), iMonitorID.getTaskID(),
iMonitorID.getJobName());
                                 sendNotification(iMonitorID);
-                                CommonUtils.removeMonitorFromQueue(take, iMonitorID);
+//                                CommonUtils.removeMonitorFromQueue(take, iMonitorID);
+                                removeList.add(iMonitorID);
                                 GFacThreadPoolExecutor.getFixedThreadPool().submit(new OutHandlerWorker(gfac,
iMonitorID, publisher));
                             } else {
                                 iMonitorID.setFailedCount(0);
@@ -281,6 +296,8 @@ public class HPCPullMonitor extends PullMonitor {
                         }
                     }
 
+                    cleanup(take);
+
 
                 } else {
                     logger.debug("Qstat Monitor doesn't handle non-gsissh hosts , host {}",
iHostMonitorData.
@@ -434,4 +451,17 @@ public class HPCPullMonitor extends PullMonitor {
     public void setCancelJobList(LinkedBlockingQueue<String> cancelJobList) {
         this.cancelJobList = cancelJobList;
     }
+
+
+    private void cleanup(UserMonitorData userMonitorData){
+        for(MonitorID iMonitorId:removeList){
+            try {
+                CommonUtils.removeMonitorFromQueue(userMonitorData, iMonitorId);
+            } catch (AiravataMonitorException e) {
+                logger.error(e.getMessage(), e);
+                logger.error("Error deleting the monitor data: " + iMonitorId.getJobID());
+            }
+        }
+        removeList.clear();
+    }
 }

http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
index 135349f..cbac726 100644
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
+++ b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
@@ -157,6 +157,7 @@ public class CommonUtils {
         logger.info("This might not be an error because someone else removed this job from
the queue");
     }
 
+
     public static void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws
GFacException {
         List<GFacHandlerConfig> handlers = jobExecutionContext.getGFacConfiguration().getOutHandlers();
 

http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/TokenizedSSHAuthInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/TokenizedSSHAuthInfo.java
b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/TokenizedSSHAuthInfo.java
index 683985f..a416dbd 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/TokenizedSSHAuthInfo.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/ssh/security/TokenizedSSHAuthInfo.java
@@ -21,6 +21,7 @@
 package org.apache.airavata.gfac.ssh.security;
 
 import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.IOUtil;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.credential.store.credential.Credential;
 import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
@@ -148,7 +149,7 @@ public class TokenizedSSHAuthInfo implements SSHPublicKeyFileAuthentication
{
      * @throws org.apache.airavata.gfac.GFacException                            If an error
occurred while retrieving credentials.
      * @throws org.apache.airavata.common.exception.ApplicationSettingsException
      */
-    public SSHCredential getDefaultCredentials() throws GFacException, ApplicationSettingsException
{
+    public SSHCredential getDefaultCredentials() throws GFacException, ApplicationSettingsException,
IOException {
         Properties configurationProperties = ServerSettings.getProperties();
         String sshUserName = configurationProperties.getProperty(Constants.SSH_USER_NAME);
         this.getRequestData().setRequestUser(sshUserName);
@@ -156,7 +157,7 @@ public class TokenizedSSHAuthInfo implements SSHPublicKeyFileAuthentication
{
         this.publicKeyFile = configurationProperties.getProperty(Constants.SSH_PUBLIC_KEY);
         this.passPhrase = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS);
         this.getRequestData().setRequestUser(sshUserName);
-        return new SSHCredential(null, null, null, requestData.getGatewayId(), sshUserName);
+        return new SSHCredential(IOUtil.readToByteArray(new File(this.privateKeyFile)), IOUtil.readToByteArray(new
File(this.publicKeyFile)), this.passPhrase, requestData.getGatewayId(), sshUserName);
     }
 
     public CredentialReader getCredentialReader() {

http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
index 0ca7546..7a2fce3 100644
--- a/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
+++ b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTestWithMyProxyAuth.java
@@ -27,16 +27,17 @@ import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
 import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
 import org.apache.airavata.gsi.ssh.config.ConfigReader;
 import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyAuthentication;
 import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
 import org.apache.airavata.gsi.ssh.util.CommonUtils;
+import org.apache.commons.io.IOUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.AssertJUnit;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
-import java.io.File;
-import java.io.IOException;
+import java.io.*;
 import java.util.ArrayList;
 import java.util.List;
 
@@ -49,11 +50,14 @@ public class DefaultSSHApiTestWithMyProxyAuth {
     }
 
 
-    public static void main(String[]ars){
+    public static void main(String[]ars) throws IOException {
          String myProxyUserName = "lg11w";
 
-        DefaultPasswordAuthenticationInfo authenticationInfo
-                = new DefaultPasswordAuthenticationInfo("");
+//        DefaultPasswordAuthenticationInfo authenticationInfo
+//                = new DefaultPasswordAuthenticationInfo("");
+        byte[] privateKey = IOUtils.toByteArray(new BufferedInputStream(new FileInputStream("/Users/lginnali/.ssh/id_dsa")));
+        byte[] publicKey = IOUtils.toByteArray(new BufferedInputStream(new FileInputStream("/Users/lginnali/.ssh/id_dsa.pub")));
+        DefaultPublicKeyAuthentication authenticationInfo = new DefaultPublicKeyAuthentication(privateKey,publicKey,"");
 
         // Create command
         CommandInfo commandInfo = new RawCommandInfo("source /etc/bashrc; bsub </home/lg11w/mywork/sshEchoExperiment_9d267072-ca65-4ca8-847a-cd3d130f6050/366787899.lsf");

http://git-wip-us.apache.org/repos/asf/airavata/blob/fcbda21f/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/VanilaTestWithSSHAuth.java
----------------------------------------------------------------------
diff --git a/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/VanilaTestWithSSHAuth.java
b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/VanilaTestWithSSHAuth.java
index 8d70a21..186aca6 100644
--- a/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/VanilaTestWithSSHAuth.java
+++ b/tools/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/VanilaTestWithSSHAuth.java
@@ -75,8 +75,8 @@ public class VanilaTestWithSSHAuth {
         
         System.setProperty("ssh.host",hostName);
         System.setProperty("ssh.username", userName);
-        System.setProperty("private.ssh.key", "/home/user/.ssh/id_dsa");
-        System.setProperty("public.ssh.key", "/home/user/.ssh/id_dsa.pub");
+        System.setProperty("private.ssh.key", "/home/lginnali/.ssh/id_dsa");
+        System.setProperty("public.ssh.key", "/home/lginnali/.ssh/id_dsa.pub");
         System.setProperty("ssh.working.directory", "/tmp");
 
         this.hostName = System.getProperty("ssh.host");


Mime
View raw message