Author: lahiru
Date: Wed Oct 16 20:50:11 2013
New Revision: 1532904
URL: http://svn.apache.org/r1532904
Log:
fixiing bigred 2 issues.
Modified:
airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
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/GFacException.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.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/provider/GFacProviderException.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/SSHProvider.java
airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTest.java
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
airavata/trunk/pom.xml
Modified:
airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties?rev=1532904&r1=1532903&r2=1532904&view=diff
==============================================================================
---
airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
(original)
+++
airavata/trunk/modules/distribution/airavata-server/src/main/resources/conf/airavata-server.properties
Wed Oct 16 20:50:11 2013
@@ -103,6 +103,7 @@ myproxy.life=3600
trusted.cert.location=/path/to/trusted/certificates
# SSH PKI key pair or ssh password can be used SSH based authentication is
used.
+# if user specify both password authentication gets the higher preference
################# ---------- For ssh key pair authentication
------------------- ################
#public.ssh.key=/path to public key for ssh
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=1532904&r1=1532903&r2=1532904&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
Wed Oct 16 20:50:11 2013
@@ -43,6 +43,9 @@ public abstract class AbstractSecurityCo
this.credentialReader = credentialReader;
this.requestData = requestData;
}
+ public AbstractSecurityContext() {
+
+ }
public CredentialReader getCredentialReader() {
return credentialReader;
Modified:
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacException.java
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacException.java?rev=1532904&r1=1532903&r2=1532904&view=diff
==============================================================================
---
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacException.java
(original)
+++
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacException.java
Wed Oct 16 20:50:11 2013
@@ -21,7 +21,12 @@
package org.apache.airavata.gfac;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
public class GFacException extends Exception {
+ private static final Logger log =
LoggerFactory.getLogger(GFacException.class);
+
/**
*
*/
@@ -33,9 +38,11 @@ public class GFacException extends Excep
public GFacException(Exception e) {
super(e);
+ log.error(e.getMessage(),e);
}
public GFacException(String s, Throwable throwable) {
super(s, throwable);
+ log.error(s,throwable);
}
}
Modified:
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java?rev=1532904&r1=1532903&r2=1532904&view=diff
==============================================================================
---
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
(original)
+++
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/JobExecutionContext.java
Wed Oct 16 20:50:11 2013
@@ -181,9 +181,6 @@ public class JobExecutionContext extends
public SecurityContext getSecurityContext(String name) throws
GFacException{
SecurityContext secContext = securityContext.get(name);
- if(secContext == null){
- throw new GFacException( name + " not set in security
context");
- }
return secContext;
}
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=1532904&r1=1532903&r2=1532904&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
Wed Oct 16 20:50:11 2013
@@ -104,6 +104,11 @@ public class GSISecurityContext extends
super(credentialReader, requestData);
}
+
+ public GSISecurityContext(Cluster pbsCluster) {
+ this.setPbsCluster(pbsCluster);
+ }
+
/**
* Gets GSSCredentials. The process is as follows;
* If credentials were queried for the first time create credentials.
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=1532904&r1=1532903&r2=1532904&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
Wed Oct 16 20:50:11 2013
@@ -38,13 +38,13 @@ public class GFacHandlerException extend
public GFacHandlerException(String s, Throwable throwable) {
super(s, throwable);
sendFaultNotification(s, new Exception(throwable));
- log.error(s);
+ log.error(s,throwable);
}
public GFacHandlerException(String message, Exception e, String...
additionExceptiondata) {
super(message, e);
sendFaultNotification(message, e, additionExceptiondata);
- log.error(message);
+ log.error(message,e);
}
private void sendFaultNotification(String message,
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=1532904&r1=1532903&r2=1532904&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
Wed Oct 16 20:50:11 2013
@@ -40,7 +40,7 @@ public class GFacProviderException exten
public GFacProviderException(String message, Throwable cause) {
super(message, cause);
sendFaultNotification(message, new Exception(cause));
- log.error(message);
+ log.error(message,cause);
}
@@ -48,7 +48,7 @@ public class GFacProviderException exten
super(message);
this.aditionalInfo = additionExceptiondata;
sendFaultNotification(message, e, additionExceptiondata);
- log.error(message);
+ log.error(message,e);
}
private void sendFaultNotification(String message,
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=1532904&r1=1532903&r2=1532904&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
Wed Oct 16 20:50:11 2013
@@ -68,12 +68,12 @@ public class GSISSHProvider implements G
Cluster cluster = null;
if
(jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)
!= null) {
cluster = ((GSISecurityContext)
jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
- }else{
+ } else {
cluster = ((SSHSecurityContext)
jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
}
- if(cluster == null){
+ if (cluster == null) {
throw new GFacProviderException("Security context is not set
properly");
- }else{
+ } else {
log.info("Successfully retrieved the Security Context");
}
// This installed path is a mandetory field, because this could
change based on the computing resource
@@ -82,7 +82,7 @@ public class GSISSHProvider implements G
jobDescriptor.setShellName("/bin/bash");
Random random = new Random();
int i = random.nextInt();
- jobDescriptor.setJobName(app.getApplicationName() +
String.valueOf(i));
+ jobDescriptor.setJobName(app.getApplicationName().getStringValue()
+ String.valueOf(i));
jobDescriptor.setExecutablePath(app.getExecutableLocation());
jobDescriptor.setAllEnvExport(true);
jobDescriptor.setMailOptions("n");
@@ -125,12 +125,13 @@ public class GSISSHProvider implements G
jobDescriptor.setInputValues(inputValues);
log.info(jobDescriptor.toXML());
- String jobID = cluster.submitBatchJob(jobDescriptor);
+ final String jobID = cluster.submitBatchJob(jobDescriptor);
log.info("Job Submitted successfully and returned Job ID: " +
jobID);
jobExecutionContext.getNotifier().publish(new JobIDEvent(jobID));
- JobSubmissionListener listener = new
GSISSHJobSubmissionListener(jobExecutionContext);
- try {
+ final JobSubmissionListener listener = new
GSISSHJobSubmissionListener(jobExecutionContext);
+ final Cluster finalCluster = cluster;
+// try {
// // Wait 5 seconds to start the first poll, this is hard coded,
user doesn't have
// // to configure this.
// Thread.sleep(5000);
@@ -139,41 +140,40 @@ public class GSISSHProvider implements G
// throw new SSHApiException("Error during job status monitoring",
e);
// }
// // Get the job status first
-// try {
-////
-//// Thread t = new Thread() {
-//// @Override
-//// public void run() {
-//// try {
- // p
- JobStatus jobStatus = cluster.getJobStatus(jobID);
- listener.statusChanged(jobStatus);
- while (true) {
- while (!jobStatus.equals(JobStatus.C)) {
- if
(!jobStatus.equals(listener.getJobStatus().toString())) {
- listener.setJobStatus(jobStatus);
+ try {
+//
+ Thread t = new Thread() {
+ @Override
+ public void run() {
+ try {
+ JobStatus jobStatus =
finalCluster.getJobStatus(jobID);
listener.statusChanged(jobStatus);
- }
- Thread.sleep(60000);
+ while (true) {
+ while (!jobStatus.equals(JobStatus.C)) {
+ if
(!jobStatus.equals(listener.getJobStatus().toString())) {
+ listener.setJobStatus(jobStatus);
+ listener.statusChanged(jobStatus);
+ }
+ Thread.sleep(60000);
- jobStatus = cluster.getJobStatus(jobID);
+ jobStatus =
finalCluster.getJobStatus(jobID);
+ }
+ //Set the job status to Complete
+ listener.setJobStatus(JobStatus.C);
+ listener.statusChanged(jobStatus);
+ break;
+ }
+ } catch (InterruptedException e) {
+ log.error("Error listening to the submitted job",
e);
+ } catch (SSHApiException e) {
+ log.error("Error listening to the submitted job",
e);
+ }
}
- //Set the job status to Complete
- listener.setJobStatus(JobStatus.C);
- listener.statusChanged(jobStatus);
- break;
- }
-// } catch (InterruptedException e) {
-// log.error("Error listening to the submitted job", e);
-// } catch (SSHApiException e) {
-// log.error("Error listening to the submitted job", e);
-// }
-// }
-// };
+ };
// This thread runs until the program termination, so that
use can provide
// // any action in onChange method of the listener, without
worrying for waiting in the caller thread.
- //t.setDaemon(true);
-// t.start();
+ t.setDaemon(false);
+ t.start();
} catch (Exception e) {
String error = "Error during job status monitoring";
log.error(error);
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=1532904&r1=1532903&r2=1532904&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
Wed Oct 16 20:50:11 2013
@@ -135,6 +135,8 @@ public class SSHProvider implements GFac
throw new GFacProviderException(e.getMessage(), e);
} catch (IOException e) {
throw new GFacProviderException(e.getMessage(), e);
+ }catch (Exception e) {
+ throw new GFacProviderException(e.getMessage(), e);
} finally {
if (securityContext != null) {
securityContext.closeSession(session);
Modified:
airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTest.java
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTest.java?rev=1532904&r1=1532903&r2=1532904&view=diff
==============================================================================
---
airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTest.java
(original)
+++
airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GSISSHProviderTest.java
Wed Oct 16 20:50:11 2013
@@ -31,6 +31,7 @@ import org.apache.airavata.gfac.Security
import org.apache.airavata.gfac.context.ApplicationContext;
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.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
@@ -194,9 +195,7 @@ public class GSISSHProviderTest {
} catch (SSHApiException e) {
e.printStackTrace(); //To change body of catch statement use File
| Settings | File Templates.
}
- SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
- sshSecurityContext.setPbsCluster(pbsCluster);
- sshSecurityContext.setUsername(myProxyUserName);
+ GSISecurityContext sshSecurityContext = new
GSISecurityContext(pbsCluster);
return sshSecurityContext;
}
@Test
Modified:
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
URL:
http://svn.apache.org/viewvc/airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java?rev=1532904&r1=1532903&r2=1532904&view=diff
==============================================================================
---
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
(original)
+++
airavata/trunk/modules/xbaya-gui/src/main/java/org/apache/airavata/xbaya/invoker/EmbeddedGFacInvoker.java
Wed Oct 16 20:50:11 2013
@@ -442,10 +442,7 @@ public class EmbeddedGFacInvoker impleme
e.printStackTrace(); //To change body of catch statement
use File | Settings | File Templates.
}
-
- SSHSecurityContext sshSecurityContext = new
SSHSecurityContext();
- sshSecurityContext.setPbsCluster(pbsCluster);
-
sshSecurityContext.setUsername(requestData.getMyProxyUserName());
+ context.setPbsCluster(pbsCluster);
jobExecutionContext.addSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT,
context);
}
} else if (registeredHost.getType() instanceof Ec2HostType) {
@@ -462,10 +459,11 @@ public class EmbeddedGFacInvoker impleme
SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
if (((SSHHostType) registeredHost.getType()).getHpcResource()) {
AuthenticationInfo authenticationInfo = null;
- if(sshPassword != null){
+ // we give higher preference to the password over keypair ssh
authentication
+ if (sshPassword != null) {
authenticationInfo = new
DefaultPasswordAuthenticationInfo(sshPassword);
- }else{
- authenticationInfo = new
DefaultPublicKeyFileAuthentication(sshPublicKey,
sshPrivateKey,sshPrivateKeyPass);
+ } else {
+ authenticationInfo = new
DefaultPublicKeyFileAuthentication(sshPublicKey, sshPrivateKey,
sshPrivateKeyPass);
}
ServerInfo serverInfo = new ServerInfo(sshUserName,
registeredHost.getType().getHostAddress());
@@ -479,13 +477,12 @@ public class EmbeddedGFacInvoker impleme
sshSecurityContext.setPbsCluster(pbsCluster);
sshSecurityContext.setUsername(sshUserName);
} else {
- sshSecurityContext = new SSHSecurityContext();
+ sshSecurityContext = new SSHSecurityContext();
sshSecurityContext.setUsername(sshUserName);
sshSecurityContext.setPrivateKeyLoc(sshPrivateKey);
sshSecurityContext.setKeyPass(sshPrivateKeyPass);
}
jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT,
sshSecurityContext);
-
}
}
Modified: airavata/trunk/pom.xml
URL:
http://svn.apache.org/viewvc/airavata/trunk/pom.xml?rev=1532904&r1=1532903&r2=1532904&view=diff
==============================================================================
--- airavata/trunk/pom.xml (original)
+++ airavata/trunk/pom.xml Wed Oct 16 20:50:11 2013
@@ -342,6 +342,11 @@
</dependencyManagement>
<repositories>
+ <repository>
+ <name>ogce.m2.all</name>
+ <id>ogce.m2.all</id>
+
<url>http://community.ucs.indiana.edu:9090/archiva/repository/ogce.m2.all</url>
+ </repository>
<repository>
<id>central</id>
<name>Maven Central</name>