airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1532043 - in /airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac: ./ context/security/ handler/ provider/ provider/impl/ utils/
Date Mon, 14 Oct 2013 19:50:20 GMT
Author: lahiru
Date: Mon Oct 14 19:50:20 2013
New Revision: 1532043

URL: http://svn.apache.org/r1532043
Log:
fixing gsi ssh integration and refactoring.

Modified:
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/LocalDirectorySetupHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/LocalProvider.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.java
    airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/LocalProviderUtil.java

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/AbstractSecurityContext.java
Mon Oct 14 19:50:20 2013
@@ -29,6 +29,7 @@ package org.apache.airavata.gfac;
 
 import org.apache.airavata.credential.store.store.CredentialReader;
 import org.apache.airavata.gfac.SecurityContext;
+import org.apache.commons.math.stat.clustering.Cluster;
 
 /**
  * Abstract implementation of the security context.

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/JobSubmissionFault.java
Mon Oct 14 19:50:20 2013
@@ -41,7 +41,7 @@ public class JobSubmissionFault extends 
 
     public JobSubmissionFault(Throwable cause, String submitHost, String contact, String
rsl,
                               JobExecutionContext jobExecutionContext, String reason, int
errorCode) {
-        super(cause.getMessage(), cause,jobExecutionContext);
+        super(cause.getMessage(), cause);
 
         this.host = submitHost;
         this.contact = contact;

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/security/GSISecurityContext.java
Mon Oct 14 19:50:20 2013
@@ -33,6 +33,7 @@ import org.apache.airavata.gfac.Abstract
 import org.apache.airavata.gfac.Constants;
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.RequestData;
+import org.apache.airavata.gsi.ssh.api.Cluster;
 import org.globus.gsi.X509Credential;
 import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
 import org.globus.gsi.provider.GlobusProvider;
@@ -60,6 +61,8 @@ public class GSISecurityContext extends 
 
     private GSSCredential gssCredentials = null;
 
+    private Cluster pbsCluster = null;
+
     // Set trusted cert path and add provider
     static {
         Security.addProvider(new GlobusProvider());
@@ -263,4 +266,12 @@ public class GSISecurityContext extends 
             throw new GFacException("An error occurred while renewing security credentials.",
e);
         }
     }
+
+    public Cluster getPbsCluster() {
+        return pbsCluster;
+    }
+
+    public void setPbsCluster(Cluster pbsCluster) {
+        this.pbsCluster = pbsCluster;
+    }
 }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java
Mon Oct 14 19:50:20 2013
@@ -23,35 +23,35 @@ package org.apache.airavata.gfac.handler
 
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
-public class GFacHandlerException extends GFacException{
-    public GFacHandlerException(String s) {
-        super(s,new Throwable(s));
+public class GFacHandlerException extends GFacException {
+    private static final Logger log = LoggerFactory.getLogger(GFacHandlerException.class);
+
+    public GFacHandlerException(String message) {
+        super(message, new Throwable(message));
+        sendFaultNotification(message, new Exception(message));
+        log.error(message);
     }
 
     public GFacHandlerException(String s, Throwable throwable) {
         super(s, throwable);
-    }
-        public GFacHandlerException(String message, Throwable cause,JobExecutionContext context)
{
-        super(message, cause);
-        sendFaultNotification(message,context,new Exception(cause));
+        sendFaultNotification(s, new Exception(throwable));
+        log.error(s);
     }
 
-    public GFacHandlerException(String message, JobExecutionContext context) {
-        super(message,new Throwable(message));
-        sendFaultNotification(message,context,new Exception(message));
-    }
-
-    public GFacHandlerException(String message, JobExecutionContext context,Exception e,String...
additionExceptiondata) {
-        super(message,e);
-        sendFaultNotification(message,context,e, additionExceptiondata);
+    public GFacHandlerException(String message, Exception e, String... additionExceptiondata)
{
+        super(message, e);
+        sendFaultNotification(message, e, additionExceptiondata);
+        log.error(message);
     }
 
     private void sendFaultNotification(String message,
-			JobExecutionContext executionContext, Exception e,
-			String... additionalExceptiondata) {
-		if (additionalExceptiondata==null || additionalExceptiondata.length==0){
-        	additionalExceptiondata=new String[]{message,e.getLocalizedMessage()};
+                                        Exception e,
+                                       String... additionalExceptiondata) {
+        if (additionalExceptiondata == null || additionalExceptiondata.length == 0) {
+            additionalExceptiondata = new String[]{message, e.getLocalizedMessage()};
         }
-	}
+    }
 }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GramDirectorySetupHandler.java
Mon Oct 14 19:50:20 2013
@@ -107,17 +107,17 @@ public class GramDirectorySetupHandler i
                     success = true;
                     break;
                 } catch (URISyntaxException e) {
-                    pe = new GFacHandlerException("URI is malformatted:" + e.getMessage(),
e, jobExecutionContext);
+                    pe = new GFacHandlerException("URI is malformatted:" + e.getMessage(),
e);
 
                 } catch (ToolsException e) {
-                    pe = new GFacHandlerException(e.getMessage(), e, jobExecutionContext);
+                    pe = new GFacHandlerException(e.getMessage(), e);
                 }
             }
             if (success == false) {
                 throw pe;
             }
         } catch (SecurityException e) {
-            throw new GFacHandlerException(e.getMessage(), e, jobExecutionContext);
+            throw new GFacHandlerException(e.getMessage(), e);
         }
     }
 

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPInputHandler.java
Mon Oct 14 19:50:20 2013
@@ -75,7 +75,7 @@ public class GridFTPInputHandler impleme
             }
         } catch (Exception e) {
             log.error(e.getMessage());
-            throw new GFacHandlerException("Error while input File Staging", jobExecutionContext,
e, e.getLocalizedMessage());
+            throw new GFacHandlerException("Error while input File Staging", e, e.getLocalizedMessage());
         }
         jobExecutionContext.setInMessageContext(inputNew);
     }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GridFTPOutputHandler.java
Mon Oct 14 19:50:20 2013
@@ -190,15 +190,15 @@ public class GridFTPOutputHandler implem
                     }
                 } catch (ToolsException e) {
                     log.error(e.getMessage());
-                    throw new GFacHandlerException(e.getMessage(), jobExecutionContext, e,
readLastLinesofStdOut(localStdErrFile.getPath(), 20));
+                    throw new GFacHandlerException(e.getMessage(), e, readLastLinesofStdOut(localStdErrFile.getPath(),
20));
                 } catch (URISyntaxException e) {
                     log.error(e.getMessage());
-                    throw new GFacHandlerException("URI is malformatted:" + e.getMessage(),
jobExecutionContext, e, readLastLinesofStdOut(localStdErrFile.getPath(), 20));
+                    throw new GFacHandlerException("URI is malformatted:" + e.getMessage(),
e, readLastLinesofStdOut(localStdErrFile.getPath(), 20));
                 }
             }
         } catch (Exception e) {
             log.error(e.getMessage());
-            throw new GFacHandlerException(e.getMessage(), jobExecutionContext, e, readLastLinesofStdOut(localStdErrFile.getPath(),
20));
+            throw new GFacHandlerException(e.getMessage(), e, readLastLinesofStdOut(localStdErrFile.getPath(),
20));
         }
 
     }
@@ -287,10 +287,10 @@ public class GridFTPOutputHandler implem
                 }
             } catch (URISyntaxException e) {
                 log.error(e.getMessage());
-                throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
+                throw new GFacProviderException(e.getMessage(), e);
             } catch (ToolsException e) {
                 log.error(e.getMessage());
-                throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
+                throw new GFacProviderException(e.getMessage(), e);
             }
             outputNew.getParameters().put(paramName, actualParameter);
         }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/LocalDirectorySetupHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/LocalDirectorySetupHandler.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/LocalDirectorySetupHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/LocalDirectorySetupHandler.java
Mon Oct 14 19:50:20 2013
@@ -52,7 +52,7 @@ public class LocalDirectorySetupHandler 
            if (f.isDirectory() && f.exists()) {
                return;
            } else if (!new File(dir).mkdir()) {
-               throw new GFacHandlerException("Cannot make directory "+dir, jobExecutionContext);
+               throw new GFacHandlerException("Cannot make directory "+dir);
            }
     }
 

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
Mon Oct 14 19:50:20 2013
@@ -74,7 +74,7 @@ public class SCPInputHandler implements 
 	            }
 	        } catch (Exception e) {
 	            log.error(e.getMessage());
-	            throw new GFacHandlerException("Error while input File Staging", jobExecutionContext,
e, e.getLocalizedMessage());
+	            throw new GFacHandlerException("Error while input File Staging", e, e.getLocalizedMessage());
 	        }
 	        jobExecutionContext.setInMessageContext(inputNew);
 	}
@@ -90,7 +90,7 @@ public class SCPInputHandler implements 
             pbsCluster.scpTo(targetFile, paramValue);
             return targetFile;
         } catch (SSHApiException e) {
-            throw new GFacHandlerException("Error while input File Staging", context, e,
e.getLocalizedMessage());
+            throw new GFacHandlerException("Error while input File Staging", e, e.getLocalizedMessage());
         }
     }
 

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java
Mon Oct 14 19:50:20 2013
@@ -32,35 +32,27 @@ public class GFacProviderException exten
 
     public GFacProviderException(String message) {
         super(message);
+        sendFaultNotification(message, new Exception(message));
         log.error(message);
     }
 
-    public GFacProviderException(String message, Throwable cause) {
-        super(message, cause);
-        log.error(message);
-    }
 
-    public GFacProviderException(String message, Throwable cause, JobExecutionContext context)
{
+    public GFacProviderException(String message, Throwable cause) {
         super(message, cause);
-        sendFaultNotification(message, context, new Exception(cause));
+        sendFaultNotification(message, new Exception(cause));
         log.error(message);
     }
 
-    public GFacProviderException(String message, JobExecutionContext context) {
-        super(message);
-        sendFaultNotification(message, context, new Exception(message));
-        log.error(message);
-    }
 
-    public GFacProviderException(String message, JobExecutionContext context, Exception e,
String... additionExceptiondata) {
+    public GFacProviderException(String message, Exception e, String... additionExceptiondata)
{
         super(message);
         this.aditionalInfo = additionExceptiondata;
-        sendFaultNotification(message, context, e, additionExceptiondata);
+        sendFaultNotification(message, e, additionExceptiondata);
         log.error(message);
     }
 
     private void sendFaultNotification(String message,
-                                       JobExecutionContext executionContext, Exception e,
+                                       Exception e,
                                        String... additionalExceptiondata) {
         if (additionalExceptiondata == null || additionalExceptiondata.length == 0) {
             additionalExceptiondata = new String[]{message, e.getLocalizedMessage()};

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/EC2Provider.java
Mon Oct 14 19:50:20 2013
@@ -111,15 +111,15 @@ public class EC2Provider implements GFac
 //        job
         /* Validation */
         if (amazonSecurityContext.getAccessKey() == null || amazonSecurityContext.getAccessKey().isEmpty())
-            throw new GFacProviderException("EC2 Access Key is empty", jobExecutionContext);
+            throw new GFacProviderException("EC2 Access Key is empty");
         if (amazonSecurityContext.getSecretKey() == null || amazonSecurityContext.getSecretKey().isEmpty())
-            throw new GFacProviderException("EC2 Secret Key is empty", jobExecutionContext);
+            throw new GFacProviderException("EC2 Secret Key is empty");
         if ((amazonSecurityContext.getAmiId() == null && amazonSecurityContext.getInstanceId()
== null) ||
                 (amazonSecurityContext.getAmiId() != null && amazonSecurityContext.getAmiId().isEmpty())
||
                 (amazonSecurityContext.getInstanceId() != null && amazonSecurityContext.getInstanceId().isEmpty()))
-            throw new GFacProviderException("EC2 AMI or Instance ID is empty", jobExecutionContext);
+            throw new GFacProviderException("EC2 AMI or Instance ID is empty");
         if (amazonSecurityContext.getUserName() == null || amazonSecurityContext.getUserName().isEmpty())
-            throw new GFacProviderException("EC2 Username is empty", jobExecutionContext);
+            throw new GFacProviderException("EC2 Username is empty");
 
         /* Need to start EC2 instance before running it */
         AWSCredentials credential =
@@ -166,7 +166,7 @@ public class EC2Provider implements GFac
                 outParamName = outputParametersArray[0].getParameterName();
             } else {
                 throw new GFacProviderException("Output parameter name is not set. Therefore,
not being able " +
-                        "to filter the job result from standard out ", jobExecutionContext);
+                        "to filter the job result from standard out ");
             }
 
             sshClient.connect(properties, new HostKeyVerification() {
@@ -187,10 +187,10 @@ public class EC2Provider implements GFac
             // Authenticate
             int result = sshClient.authenticate(publicKeyAuth);
             if(result== AuthenticationProtocolState.FAILED) {
-                throw new GFacProviderException("The authentication failed", jobExecutionContext);
+                throw new GFacProviderException("The authentication failed");
             } else if(result==AuthenticationProtocolState.PARTIAL) {
                 throw new GFacProviderException("The authentication succeeded but another"
-                        + "authentication is required", jobExecutionContext);
+                        + "authentication is required");
             } else if(result==AuthenticationProtocolState.COMPLETE) {
                 log.info("ssh client authentication is complete...");
             }
@@ -246,7 +246,6 @@ public class EC2Provider implements GFac
         // Do nothing
     }
 
-    @Override
     public void cancelJob(String jobId, JobExecutionContext jobExecutionContext) throws GFacException
{
         throw new NotImplementedException();
     }
@@ -368,7 +367,7 @@ public class EC2Provider implements GFac
                     this.instance.getInstanceId() + " is running with public name " + this.instance.getPublicDnsName()));
 
         } catch (Exception e) {
-            throw new GFacProviderException("Invalid Request",e,jobExecutionContext);
+            throw new GFacProviderException("Invalid Request",e);
         }
 
     }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
Mon Oct 14 19:50:20 2013
@@ -26,6 +26,7 @@ import org.apache.airavata.commons.gfac.
 import org.apache.airavata.gfac.GFacException;
 import org.apache.airavata.gfac.context.JobExecutionContext;
 import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.context.security.GSISecurityContext;
 import org.apache.airavata.gfac.context.security.SSHSecurityContext;
 import org.apache.airavata.gfac.notification.events.JobIDEvent;
 import org.apache.airavata.gfac.notification.events.StartExecutionEvent;
@@ -64,8 +65,17 @@ public class GSISSHProvider implements G
         HpcApplicationDeploymentType app = (HpcApplicationDeploymentType) jobExecutionContext.getApplicationContext().
                 getApplicationDeploymentDescription().getType();
         try {
-            SSHSecurityContext securityContext = (SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT);
-            Cluster cluster = securityContext.getPbsCluster();
+            Cluster cluster = null;
+            if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
!= null) {
+                cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
+            }else{
+                cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
+            }
+            if(cluster == null){
+                throw new GFacProviderException("Security context is not set properly");
+            }else{
+                log.info("Successfully retrieved the Security Context");
+            }
             // This installed path is a mandetory field, because this could change based
on the computing resource
             JobDescriptor jobDescriptor = new JobDescriptor();
             jobDescriptor.setWorkingDirectory(app.getScratchWorkingDirectory());

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/LocalProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/LocalProvider.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/LocalProvider.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/LocalProvider.java
Mon Oct 14 19:50:20 2013
@@ -170,9 +170,9 @@ public class LocalProvider implements GF
             log.info(buf.toString());
 
         } catch (IOException io) {
-            throw new GFacProviderException(io.getMessage(), io,jobExecutionContext);
+            throw new GFacProviderException(io.getMessage(), io);
         } catch (InterruptedException e) {
-            throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
+            throw new GFacProviderException(e.getMessage(), e);
         }
     }
 
@@ -206,11 +206,11 @@ public class LocalProvider implements GF
 			Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters();
             OutputUtils.fillOutputFromStdout(output, stdOutStr, stdErrStr);
         } catch (XmlException e) {
-            throw new GFacProviderException("Cannot read output:" + e.getMessage(), e, jobExecutionContext);
+            throw new GFacProviderException("Cannot read output:" + e.getMessage(), e);
         } catch (IOException io) {
-            throw new GFacProviderException(io.getMessage(), io, jobExecutionContext);
+            throw new GFacProviderException(io.getMessage(), io);
         } catch (Exception e){
-        	throw new GFacProviderException("Error in retrieving results",e,jobExecutionContext);
+        	throw new GFacProviderException("Error in retrieving results",e);
         }
     }
 

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java
Mon Oct 14 19:50:20 2013
@@ -66,6 +66,8 @@ public class SSHProvider implements GFac
     private static final Logger log = LoggerFactory.getLogger(SSHProvider.class);
     private SSHSecurityContext securityContext;
     private String jobID = null;
+    // we keep gsisshprovider to support qsub submission incase of hpc scenario with ssh
+    private GSISSHProvider gsiSshProvider = null;
 
     public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException,
GFacException {
         if (!((SSHHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getHpcResource())
{
@@ -84,6 +86,8 @@ public class SSHProvider implements GFac
             } catch (IOException e) {
                 throw new GFacProviderException(e.getLocalizedMessage(), e);
             }
+        }else{
+           gsiSshProvider = new GSISSHProvider();
         }
     }
 
@@ -98,7 +102,7 @@ public class SSHProvider implements GFac
     }
 
     public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException
{
-        if (!((SSHHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getHpcResource())
{
+        if (gsiSshProvider == null) {
             ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
             Session session = null;
             try {
@@ -137,9 +141,8 @@ public class SSHProvider implements GFac
                 }
             }
         } else {
-            GSISSHProvider gsisshProvider = new GSISSHProvider();
             try {
-                gsisshProvider.execute(jobExecutionContext);
+                gsiSshProvider.execute(jobExecutionContext);
             } catch (GFacException e) {
                 throw new GFacProviderException(e.getMessage(), e);
             }
@@ -148,9 +151,16 @@ public class SSHProvider implements GFac
     }
 
     public void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException
{
+        if (gsiSshProvider != null){
+            try {
+                gsiSshProvider.dispose(jobExecutionContext);
+            } catch (GFacException e) {
+                throw new GFacProviderException(e.getMessage(),e);
+            }
+        }
     }
 
-    @Override
+
     public void cancelJob(String jobId, JobExecutionContext jobExecutionContext) throws GFacException
{
         throw new NotImplementedException();
     }
@@ -233,7 +243,13 @@ public class SSHProvider implements GFac
     }
 
     public void initProperties(Map<String, String> properties) throws GFacProviderException,
GFacException {
-
+         if (gsiSshProvider != null){
+            try {
+               initProperties(properties);
+            } catch (GFacException e) {
+                throw new GFacProviderException(e.getMessage(),e);
+            }
+        }
     }
 
 }

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.java
Mon Oct 14 19:50:20 2013
@@ -45,7 +45,7 @@ public class GramProviderUtils {
             GramJob job = new GramJob(rsl);
             return job;
         } catch (ToolsException te) {
-            throw new GFacProviderException(te.getMessage(), te, jobExecutionContext);
+            throw new GFacProviderException(te.getMessage(), te);
         }
     }
 

Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/LocalProviderUtil.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/LocalProviderUtil.java?rev=1532043&r1=1532042&r2=1532043&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/LocalProviderUtil.java
(original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/LocalProviderUtil.java
Mon Oct 14 19:50:20 2013
@@ -31,12 +31,12 @@ import java.io.File;
 public class LocalProviderUtil {
     private static final Logger log = LoggerFactory.getLogger(LocalProviderUtil.class);
 
-    private void makeFileSystemDir(String dir, JobExecutionContext jobExecutionContext) throws
GFacProviderException {
+    private void makeFileSystemDir(String dir) throws GFacProviderException {
         File f = new File(dir);
         if (f.isDirectory() && f.exists()) {
             return;
         } else if (!new File(dir).mkdir()) {
-            throw new GFacProviderException("Cannot make directory " + dir, jobExecutionContext);
+            throw new GFacProviderException("Cannot make directory " + dir);
         }
     }
 
@@ -45,10 +45,10 @@ public class LocalProviderUtil {
                 getApplicationContext().getApplicationDeploymentDescription().getType();
         log.info("working diectroy = " + app.getStaticWorkingDirectory());
         log.info("temp directory = " + app.getScratchWorkingDirectory());
-        makeFileSystemDir(app.getStaticWorkingDirectory(), jobExecutionContext);
-        makeFileSystemDir(app.getScratchWorkingDirectory(), jobExecutionContext);
-        makeFileSystemDir(app.getInputDataDirectory(), jobExecutionContext);
-        makeFileSystemDir(app.getOutputDataDirectory(), jobExecutionContext);
+        makeFileSystemDir(app.getStaticWorkingDirectory());
+        makeFileSystemDir(app.getScratchWorkingDirectory());
+        makeFileSystemDir(app.getInputDataDirectory());
+        makeFileSystemDir(app.getOutputDataDirectory());
     }
 
 }



Mime
View raw message