You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2013/02/21 16:19:14 UTC
svn commit: r1448678 - in /airavata/trunk/modules/gfac-core: ./
src/main/java/org/apache/airavata/core/gfac/extension/data/
src/main/java/org/apache/airavata/core/gfac/extension/post/
src/main/java/org/apache/airavata/core/gfac/provider/impl/ src/main/...
Author: lahiru
Date: Thu Feb 21 15:19:13 2013
New Revision: 1448678
URL: http://svn.apache.org/r1448678
Log:
commiting shabhaz's patch, and thank you very much for your contribution.
Modified:
airavata/trunk/modules/gfac-core/pom.xml
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/GridFtpOutputStaging.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/JSDLProvider.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JSDLGenerator.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/GSISecurityContext.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/provider/impl/GramProvider.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/MyProxyManager.java
airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTest.java
airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTest.java
airavata/trunk/modules/gfac-core/src/test/resources/gfac-config.xml
Modified: airavata/trunk/modules/gfac-core/pom.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/pom.xml?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/pom.xml (original)
+++ airavata/trunk/modules/gfac-core/pom.xml Thu Feb 21 15:19:13 2013
@@ -24,9 +24,9 @@
<dependencies>
<dependency>
- <groupId>cog-jglobus</groupId>
+ <groupId>cog-globus</groupId>
<artifactId>cog-jglobus</artifactId>
- <version>1.8.0_1</version>
+ <version>1.8.0-bc146</version>
</dependency>
<!-- Experimental dependencies for XSP integration
<dependency>
@@ -41,27 +41,23 @@
</dependency>
-->
<dependency>
- <groupId>lead-security</groupId>
+ <groupId>cog-globus</groupId>
<artifactId>puretls</artifactId>
<type>jar</type>
- <version>0.9b4-1</version>
+ <!-- <version>0.9b4-1</version> -->
+ <version>1.0</version>
</dependency>
<dependency>
- <groupId>lead-security</groupId>
+ <groupId>cog-globus</groupId>
<artifactId>cryptix32</artifactId>
- <version>versionless</version>
+ <version>1.0</version>
</dependency>
<dependency>
- <groupId>lead-security</groupId>
+ <groupId>cog-globus</groupId>
<artifactId>cryptix-asn1</artifactId>
- <version>versionless</version>
- </dependency>
- <dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk15</artifactId>
- <version>1.45</version>
+ <version>1.0</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
<version>1.6</version>
@@ -143,9 +139,9 @@
<dependency>
<groupId>eu.unicore</groupId>
<artifactId>ogsabes-client</artifactId>
- <version>1.5.1-rc3</version>
+ <version>1.6.0-SNAPSHOT</version>
</dependency>
- <dependency>
+ <!-- <dependency>
<groupId>eu.unicore</groupId>
<artifactId>ogsabes-types</artifactId>
<version>1.5.1-rc3</version>
@@ -194,7 +190,7 @@
<groupId>eu.unicore</groupId>
<artifactId>uftp</artifactId>
<version>1.2.1</version>
- </dependency>
+ </dependency> -->
<!-- unicore dependencies finished -->
<!-- Guava -->
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/data/RegistryDataService.java Thu Feb 21 15:19:13 2013
@@ -33,8 +33,9 @@ import org.apache.airavata.core.gfac.ext
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
/**
- * This plugin fills out all information that is missing in {@link org.apache.airavata.commons.gfac.type.ApplicationDescription} based on Unix
- * system. For instance, it will use "/tmp" as default temporary directory.
+ * This plugin fills out all information that is missing in
+ * {@link org.apache.airavata.commons.gfac.type.ApplicationDescription} based on
+ * Unix system. For instance, it will use "/tmp" as default temporary directory.
*
*/
public class RegistryDataService extends DataServiceChain {
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/GridFtpOutputStaging.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/GridFtpOutputStaging.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/GridFtpOutputStaging.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/extension/post/GridFtpOutputStaging.java Thu Feb 21 15:19:13 2013
@@ -31,6 +31,7 @@ import org.apache.airavata.commons.gfac.
import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
import org.apache.airavata.core.gfac.context.message.MessageContext;
import org.apache.airavata.core.gfac.context.security.impl.GSISecurityContext;
+
import org.apache.airavata.core.gfac.exception.ExtensionException;
import org.apache.airavata.core.gfac.exception.SecurityException;
import org.apache.airavata.core.gfac.exception.ToolsException;
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/GramProvider.java Thu Feb 21 15:19:13 2013
@@ -215,16 +215,16 @@ public class GramProvider extends Abstra
*/
int jobStatus = listener.getStatus();
- if(job.getExitCode() != 0 || jobStatus == GramJob.STATUS_FAILED){
- int errCode = listener.getError();
- String errorMsg = "Job " + job.getID() + " on host " + host.getHostAddress() + " Job Exit Code = "
- + listener.getError();
- JobSubmissionFault error = new JobSubmissionFault(this, new Exception(errorMsg), "GFAC HOST",
- gateKeeper, job.getRSL(),invocationContext);
- errorReason(errCode, error);
- invocationContext.getExecutionContext().getNotifier().executionFail(invocationContext,error,errorMsg);
- throw error;
- }
+// if(job.getExitCode() != 0 || jobStatus == GramJob.STATUS_FAILED){
+// int errCode = listener.getError();
+// String errorMsg = "Job " + job.getID() + " on host " + host.getHostAddress() + " Job Exit Code = "
+// + listener.getError();
+// JobSubmissionFault error = new JobSubmissionFault(this, new Exception(errorMsg), "GFAC HOST",
+// gateKeeper, job.getRSL(),invocationContext);
+// errorReason(errCode, error);
+// invocationContext.getExecutionContext().getNotifier().executionFail(invocationContext,error,errorMsg);
+// throw error;
+// }
} catch (GramException e) {
JobSubmissionFault error = new JobSubmissionFault(this, e, host.getHostAddress(), gateKeeper, job.getRSL(), invocationContext);
int errCode = listener.getError();
@@ -251,7 +251,7 @@ public class GramProvider extends Abstra
if (errCode == 8) {
error.setReason(JobSubmissionFault.JOB_CANCEL);
} else {
- error.setReason(JobSubmissionFault.JOB_FAILED + " With Exit Code:" + job.getExitCode());
+// error.setReason(JobSubmissionFault.JOB_FAILED + " With Exit Code:" + job.getExitCode());
}
return error;
}
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/JSDLProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/JSDLProvider.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/JSDLProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/impl/JSDLProvider.java Thu Feb 21 15:19:13 2013
@@ -24,7 +24,6 @@ import de.fzj.unicore.bes.client.Factory
import de.fzj.unicore.bes.faults.InvalidRequestMessageFault;
import de.fzj.unicore.bes.faults.NotAcceptingNewActivitiesFault;
import de.fzj.unicore.bes.faults.UnsupportedFeatureFault;
-import de.fzj.unicore.uas.security.ClientProperties;
import de.fzj.unicore.wsrflite.xmlbeans.WSUtilities;
import eu.unicore.security.util.client.IClientProperties;
import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
@@ -155,7 +154,7 @@ public class JSDLProvider {
/*
* Set Security
*/
- securityProperties = initSecurityProperties();
+// securityProperties = initSecurityProperties();
String factoryUrl = job.getFactoryUrl();
EndpointReferenceType eprt = EndpointReferenceType.Factory
.newInstance();
@@ -227,16 +226,5 @@ public class JSDLProvider {
log.debug(buf.toString());
}
- protected ClientProperties initSecurityProperties() {
- //todo provide a proper way of specified credentials
- ClientProperties sp = new ClientProperties();
- sp.setSslEnabled(true);
- sp.setSignMessage(true);
- sp.setKeystore("src/test/resources/demo-keystore.jks");
- sp.setKeystorePassword("654321");
- sp.setKeystoreAlias("demouser-new");
- sp.setKeystoreType("JKS");
- return sp;
- }
}
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JSDLGenerator.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JSDLGenerator.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JSDLGenerator.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JSDLGenerator.java Thu Feb 21 15:19:13 2013
@@ -32,6 +32,7 @@ import org.ggf.schemas.jsdl.x2005.x11.js
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+@Deprecated
public class JSDLGenerator {
protected final Logger log = LoggerFactory.getLogger(this.getClass());
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/provider/utils/JobSubmissionListener.java Thu Feb 21 15:19:13 2013
@@ -22,7 +22,7 @@
package org.apache.airavata.core.gfac.provider.utils;
import org.apache.airavata.core.gfac.context.invocation.InvocationContext;
-import org.apache.airavata.core.gfac.context.security.impl.GSISecurityContext;
+//import org.apache.airavata.core.gfac.context.security.impl.GSISecurityContext;
import org.apache.airavata.core.gfac.exception.SecurityException;
import org.globus.gram.GramException;
import org.globus.gram.GramJob;
@@ -67,9 +67,9 @@ public class JobSubmissionListener imple
int proxyExpTime = job.getCredentials().getRemainingLifetime();
if (proxyExpTime < JOB_PROXY_REMAINING_TIME_LIMIT) {
log.info("Job proxy expired. Trying to renew proxy");
- GSSCredential gssCred = ((GSISecurityContext) context.getSecurityContext(MYPROXY_SECURITY_CONTEXT))
- .getGssCredentails();
- job.renew(gssCred);
+// GSSCredential gssCred = ((GSISecurityContext) context.getSecurityContext(MYPROXY_SECURITY_CONTEXT))
+// .getGssCredentails();
+// job.renew(gssCred);
log.info("Myproxy renewed");
}
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/core/gfac/services/impl/AbstractSimpleService.java Thu Feb 21 15:19:13 2013
@@ -83,7 +83,7 @@ public abstract class AbstractSimpleServ
/*
* Determine provider
*/
- Scheduler scheduler = getScheduler(context);
+ Scheduler scheduler = getScheduler(context); //SM: why passing context when not used
context.getExecutionContext().getNotifier().startSchedule(context);
Provider provider = scheduler.schedule(context);
context.getExecutionContext().getNotifier().finishSchedule(context);
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/Scheduler.java Thu Feb 21 15:19:13 2013
@@ -24,9 +24,11 @@ package org.apache.airavata.gfac;
import org.apache.airavata.commons.gfac.type.HostDescription;
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.provider.GFacProvider;
+import org.apache.airavata.gfac.provider.impl.BESProvider;
import org.apache.airavata.gfac.provider.impl.GramProvider;
import org.apache.airavata.gfac.provider.impl.LocalProvider;
import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.airavata.schemas.gfac.UnicoreHostType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -59,7 +61,11 @@ public class Scheduler {
HostDescription hostDescription = jobExecutionContext.getApplicationContext().getHostDescription();
if(hostDescription.getType() instanceof GlobusHostType){
return new GramProvider();
- }else{
+ }
+ else if (hostDescription.getType() instanceof UnicoreHostType) {
+ return new BESProvider();
+ }
+ else{
return new LocalProvider();
}
}
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/GSISecurityContext.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/GSISecurityContext.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/GSISecurityContext.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/context/GSISecurityContext.java Thu Feb 21 15:19:13 2013
@@ -22,6 +22,7 @@ package org.apache.airavata.gfac.context
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.utils.MyProxyManager;
+import org.globus.gsi.GlobusCredential;
import org.globus.tools.MyProxy;
import org.ietf.jgss.GSSCredential;
import org.slf4j.Logger;
@@ -43,7 +44,8 @@ public class GSISecurityContext extends
private String trustedCertLoc;
private GSSCredential gssCredentails;
-
+
+ private GlobusCredential globusCredential;
public GSISecurityContext(GFacConfiguration configuration) {
this.setMyproxyLifetime(configuration.getMyProxyLifeCycle());
@@ -71,6 +73,31 @@ public class GSISecurityContext extends
}
}
+
+ public GlobusCredential getGlobusCredential() {
+ try{
+ System.out.println(gssCredentails);
+ if (gssCredentails == null || gssCredentails.getRemainingLifetime() < 10 * 90) {
+ if (proxyRenewer != null) {
+// gssCredentails = proxyRenewer.renewProxy();
+ globusCredential = proxyRenewer.getGlobusCredential();
+ } else if (myproxyUserName != null && myproxyPasswd != null && myproxyServer != null) {
+ this.proxyRenewer = new MyProxyManager(myproxyUserName, myproxyPasswd, MyProxy.MYPROXY_SERVER_PORT,
+ myproxyLifetime, myproxyServer, trustedCertLoc);
+ log.debug("loaded credentails from Proxy server");
+// gssCredentails = this.proxyRenewer.renewProxy();
+ globusCredential = proxyRenewer.getGlobusCredential();
+ }
+ }
+ return globusCredential;
+ } catch (Exception e) {
+ throw new SecurityException(e.getMessage(), e);
+ }
+ }
+
+
+
+
public String getTrustedCertLoc() {
return trustedCertLoc;
}
@@ -110,4 +137,7 @@ public class GSISecurityContext extends
public void setMyproxyLifetime(int myproxyLifetime) {
this.myproxyLifetime = myproxyLifetime;
}
+
+
+
}
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=1448678&r1=1448677&r2=1448678&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 Thu Feb 21 15:19:13 2013
@@ -30,6 +30,8 @@ import org.apache.airavata.gfac.utils.GF
import org.apache.airavata.gfac.utils.GramJobSubmissionListener;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.airavata.schemas.gfac.HostDescriptionType;
+import org.apache.airavata.schemas.gfac.UnicoreHostType;
import org.ietf.jgss.GSSCredential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -45,7 +47,31 @@ public class GramDirectorySetupHandler i
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
log.info("Invoking GramDirectorySetupHandler ...");
- GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
+
+
+ String[] gridFTPEndpointArray = null;
+
+ String hostName = null;
+
+ //TODO: why it is tightly coupled with gridftp
+// GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
+
+ //TODO: make it more reusable
+ HostDescriptionType hostType = jobExecutionContext.getApplicationContext().getHostDescription().getType();
+
+
+
+ if(hostType instanceof GlobusHostType){
+ gridFTPEndpointArray = ((GlobusHostType) hostType).getGridFTPEndPointArray();
+ }
+ else if (hostType instanceof UnicoreHostType){
+ gridFTPEndpointArray = ((UnicoreHostType) hostType).getGridFTPEndPointArray();
+ }
+ else {
+ //TODO
+ }
+
+
ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
ApplicationDeploymentDescriptionType app = applicationDeploymentDescription.getType();
GridFtp ftp = new GridFtp();
@@ -58,13 +84,13 @@ public class GramDirectorySetupHandler i
jobExecutionContext.setSecurityContext(gssContext);
}
GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext()).getGssCredentails();
- String[] hostgridFTP = host.getGridFTPEndPointArray();
- if (hostgridFTP == null || hostgridFTP.length == 0) {
- hostgridFTP = new String[]{host.getHostAddress()};
+
+ if (gridFTPEndpointArray == null || gridFTPEndpointArray.length == 0) {
+ gridFTPEndpointArray = new String[]{hostType.getHostAddress()};
}
boolean success = false;
GFacHandlerException pe = null;// = new ProviderException("");
- for (String endpoint : host.getGridFTPEndPointArray()) {
+ for (String endpoint : gridFTPEndpointArray) {
try {
URI tmpdirURI = GFacUtils.createGsiftpURI(endpoint, app.getScratchWorkingDirectory());
@@ -72,7 +98,7 @@ public class GramDirectorySetupHandler i
URI inputURI = GFacUtils.createGsiftpURI(endpoint, app.getInputDataDirectory());
URI outputURI = GFacUtils.createGsiftpURI(endpoint, app.getOutputDataDirectory());
- log.info("Host FTP = " + hostgridFTP[0]);
+ log.info("Host FTP = " + gridFTPEndpointArray[0]);
log.info("temp directory = " + tmpdirURI);
log.info("Working directory = " + workingDirURI);
log.info("Input directory = " + inputURI);
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=1448678&r1=1448677&r2=1448678&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 Thu Feb 21 15:19:13 2013
@@ -20,6 +20,17 @@
*/
package org.apache.airavata.gfac.handler;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Set;
+
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.ToolsException;
@@ -27,31 +38,24 @@ import org.apache.airavata.gfac.context.
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.context.MessageContext;
import org.apache.airavata.gfac.external.GridFtp;
-import org.apache.airavata.gfac.provider.GFacProviderException;
import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.airavata.schemas.gfac.HostDescriptionType;
import org.apache.airavata.schemas.gfac.URIArrayType;
import org.apache.airavata.schemas.gfac.URIParameterType;
+import org.apache.airavata.schemas.gfac.UnicoreHostType;
import org.ietf.jgss.GSSCredential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Set;
-
public class GridFTPInputHandler implements GFacHandler {
private static final Logger log = LoggerFactory.getLogger(AppDescriptorCheckHandler.class);
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
log.info("Invoking GridFTPInputHandler ...");
+
+
MessageContext inputNew = new MessageContext();
try {
MessageContext input = jobExecutionContext.getInMessageContext();
@@ -80,9 +84,32 @@ public class GridFTPInputHandler impleme
}
private static String stageInputFiles(JobExecutionContext jobExecutionContext, String paramValue) throws URISyntaxException, SecurityException, ToolsException, IOException {
- URI gridftpURL;
- gridftpURL = new URI(paramValue);
- GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
+ URI gridftpURL = new URI(paramValue);
+
+ String[] gridFTPEndpointArray = null;
+
+ // not to download input files to the input dir if its http / gsiftp
+ // but if local then yes
+ boolean isInputNonLocal = true;
+
+ //TODO: why it is tightly coupled with gridftp
+// GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
+
+ //TODO: make it more reusable
+ HostDescriptionType hostType = jobExecutionContext.getApplicationContext().getHostDescription().getType();
+
+ if(jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof GlobusHostType){
+ gridFTPEndpointArray = ((GlobusHostType) hostType).getGridFTPEndPointArray();
+ }
+ else if (jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof UnicoreHostType){
+ gridFTPEndpointArray = ((UnicoreHostType) hostType).getGridFTPEndPointArray();
+ isInputNonLocal = false;
+ }
+ else {
+ //TODO
+ }
+
+
ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
GridFtp ftp = new GridFtp();
URI destURI = null;
@@ -92,8 +119,10 @@ public class GridFTPInputHandler impleme
jobExecutionContext.setSecurityContext(gssContext);
}
GSSCredential gssCred = ((GSISecurityContext) jobExecutionContext.getSecurityContext()).getGssCredentails();
+
+
- for (String endpoint : host.getGridFTPEndPointArray()) {
+ for (String endpoint : gridFTPEndpointArray) {
URI inputURI = GFacUtils.createGsiftpURI(endpoint, app.getInputDataDirectory());
String fileName = new File(gridftpURL.getPath()).getName();
String s = inputURI.getPath() + File.separator + fileName;
@@ -101,13 +130,33 @@ public class GridFTPInputHandler impleme
if (fileName != null && !"".equals(fileName)) {
destURI = GFacUtils.createGsiftpURI(endpoint, s);
if (paramValue.startsWith("gsiftp")) {
- ftp.uploadFile(gridftpURL, destURI, gssCred);
+ // no need to do if it is unicore, as unicore will download this on user's behalf to the job space dir
+ if(isInputNonLocal) ftp.uploadFile(gridftpURL, destURI, gssCred);
+ else return paramValue;
} else if (paramValue.startsWith("file")) {
String localFile = paramValue.substring(paramValue.indexOf(":") + 1, paramValue.length());
- ftp.uploadFile(destURI, gssCred, new FileInputStream(localFile));
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(localFile);
+ ftp.uploadFile(destURI, gssCred, fis);
+ }finally {
+ fis.close();
+ }
} else if (paramValue.startsWith("http")) {
- ftp.uploadFile(destURI,
- gssCred, (gridftpURL.toURL().openStream()));
+ // no need to do if it is unicore
+ if(isInputNonLocal) {
+ InputStream is = null;
+ try {
+ is = gridftpURL.toURL().openStream();
+ ftp.uploadFile(destURI, gssCred, (is));
+ }finally {
+ is.close();
+ }
+ } else {
+ // don't return destUri
+ return paramValue;
+ }
+
} else {
//todo throw exception telling unsupported protocol
return paramValue;
@@ -117,6 +166,10 @@ public class GridFTPInputHandler impleme
return paramValue;
}
}
- return destURI.getPath();
+ return destURI.toString();
}
+
+
+
+
}
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=1448678&r1=1448677&r2=1448678&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 Thu Feb 21 15:19:13 2013
@@ -36,22 +36,55 @@ import org.ietf.jgss.GSSCredential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.*;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStreamReader;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
public class GridFTPOutputHandler implements GFacHandler {
private static final Logger log = LoggerFactory.getLogger(GramJobSubmissionListener.class);
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
log.info("Invoking GridFTPOutputHandler ...");
- GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
- ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
- GridFtp ftp = new GridFtp();
- File localStdErrFile = null;
- Map<String, ActualParameter> stringMap = null;
- try {
+
+ ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
+
+ HostDescriptionType hostType = jobExecutionContext.getApplicationContext().getHostDescription().getType();
+ String[] gridFTPEndpointArray = null;
+ String hostName = null;
+ String hostAddress = null;
+
+ if(jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof GlobusHostType){
+ gridFTPEndpointArray = ((GlobusHostType) hostType).getGridFTPEndPointArray();
+ hostName = ((GlobusHostType) hostType).getHostName();
+ hostAddress = ((GlobusHostType) hostType).getHostAddress();
+
+ }
+ else if (jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof UnicoreHostType){
+ gridFTPEndpointArray = ((UnicoreHostType) hostType).getGridFTPEndPointArray();
+ hostName = ((UnicoreHostType) hostType).getHostName();
+ hostAddress = ((UnicoreHostType) hostType).getHostAddress();
+ }
+ else {
+ //TODO
+ }
+
+ GridFtp ftp = new GridFtp();
+ File localStdErrFile = null;
+ Map<String, ActualParameter> stringMap = new HashMap<String, ActualParameter>();
+ try {
if (jobExecutionContext.getSecurityContext() == null ||
!(jobExecutionContext.getSecurityContext() instanceof GSISecurityContext))
{
@@ -59,11 +92,11 @@ public class GridFTPOutputHandler implem
jobExecutionContext.setSecurityContext(gssContext);
}
GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext()).getGssCredentails();
- String[] hostgridFTP = host.getGridFTPEndPointArray();
+ String[] hostgridFTP = gridFTPEndpointArray;
if (hostgridFTP == null || hostgridFTP.length == 0) {
- hostgridFTP = new String[]{host.getHostAddress()};
+ hostgridFTP = new String[]{hostName};
}
- for (String endpoint : host.getGridFTPEndPointArray()) {
+ for (String endpoint : gridFTPEndpointArray) {
try {
/*
* Read Stdout and Stderror
@@ -84,8 +117,28 @@ public class GridFTPOutputHandler implem
File localStdOutFile = File.createTempFile(timeStampedServiceName, "stdout");
localStdErrFile = File.createTempFile(timeStampedServiceName, "stderr");
- String stdout = ftp.readRemoteFile(stdoutURI, gssCred, localStdOutFile);
- String stderr = ftp.readRemoteFile(stderrURI, gssCred, localStdErrFile);
+
+
+
+ // Shahbaz Comment: in principle when job is failed the execution chain must be stopped
+ // there
+
+
+ String stdout = null;
+ String stderr = null;
+
+ // TODO: what if job is failed
+ // and this handler is not able to find std* files?
+ try {
+ stdout = ftp.readRemoteFile(stdoutURI, gssCred, localStdOutFile);
+ stderr = ftp.readRemoteFile(stderrURI, gssCred, localStdErrFile);
+ //TODO: do we also need to set them as output parameters for another job
+ }
+ catch(ToolsException e) {
+ log.error("Cannot download stdout/err files. One reason could be the job is not successfully finished: "+e.getMessage());
+ }
+
+
Map<String, Object> output = jobExecutionContext.getOutMessageContext().getParameters();
Set<String> keys = output.keySet();
for (String paramName : keys) {
@@ -95,19 +148,22 @@ public class GridFTPOutputHandler implem
List<String> outputList = ftp.listDir(outputURI, gssCred);
String[] valueList = outputList.toArray(new String[outputList.size()]);
((URIArrayType) actualParameter.getType()).setValueArray(valueList);
- stringMap = new HashMap<String, ActualParameter>();
+ // why to instantiate new instance?
+// stringMap = new HashMap<String, ActualParameter>();
stringMap.put(paramName, actualParameter);
}else if ("StringArray".equals(actualParameter.getType().getType().toString())) {
String[] valueList = OutputUtils.parseStdoutArray(stdout, paramName);
((StringArrayType) actualParameter.getType()).setValueArray(valueList);
- stringMap = new HashMap<String, ActualParameter>();
+// stringMap = new HashMap<String, ActualParameter>();
stringMap.put(paramName, actualParameter);
} else if ("URI".equals(actualParameter.getType().getType().toString())) {
- URI outputURI = GFacUtils.createGsiftpURI(endpoint, app.getOutputDataDirectory());
- List<String> outputList = ftp.listDir(outputURI, gssCred);
- String valueList = outputList.get(0);
- ((URIParameterType) actualParameter.getType()).setValue(valueList);
- stringMap = new HashMap<String, ActualParameter>();
+ stringMap.put(paramName, actualParameter);
+ }
+ else if ("String".equals(actualParameter.getType().getType().toString())) {
+ String path = app.getOutputDataDirectory()+"/"+((StringParameterType) actualParameter.getType()).getValue();
+ URI outputURI = GFacUtils.createGsiftpURI(endpoint, path);
+ ((StringParameterType) actualParameter.getType()).setValue(outputURI.toString());
+// stringMap = new HashMap<String, ActualParameter>();
stringMap.put(paramName, actualParameter);
}
else {
@@ -136,6 +192,7 @@ public class GridFTPOutputHandler implem
log.error(e.getMessage());
throw new GFacHandlerException(e.getMessage(), jobExecutionContext, e, readLastLinesofStdOut(localStdErrFile.getPath(), 20));
}
+
}
private static String readLastLinesofStdOut(String path, int count) {
@@ -178,14 +235,29 @@ public class GridFTPOutputHandler implem
}
private static void stageOutputFiles(JobExecutionContext jobExecutionContext, String outputFileStagingPath) throws GFacProviderException {
+
+
+ HostDescriptionType hostType = jobExecutionContext.getApplicationContext().getHostDescription().getType();
+ String[] gridFTPEndpointArray = null;
+
+ if(jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof GlobusHostType){
+ gridFTPEndpointArray = ((GlobusHostType) hostType).getGridFTPEndPointArray();
+ }
+ else if (jobExecutionContext.getApplicationContext().getHostDescription().getType() instanceof UnicoreHostType){
+ gridFTPEndpointArray = ((UnicoreHostType) hostType).getGridFTPEndPointArray();
+ }
+ else {
+ //TODO
+ }
+
+
MessageContext outputNew = new MessageContext();
MessageContext output = jobExecutionContext.getOutMessageContext();
Map<String, Object> parameters = output.getParameters();
for (String paramName : parameters.keySet()) {
ActualParameter actualParameter = (ActualParameter) parameters
.get(paramName);
- //TODO: Review this with type
- GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
+
GridFtp ftp = new GridFtp();
if (jobExecutionContext.getSecurityContext() == null ||
@@ -197,14 +269,14 @@ public class GridFTPOutputHandler implem
GSSCredential gssCred = ((GSISecurityContext)jobExecutionContext.getSecurityContext()).getGssCredentails();
try {
if ("URI".equals(actualParameter.getType().getType().toString())) {
- for (String endpoint : host.getGridFTPEndPointArray()) {
+ for (String endpoint : gridFTPEndpointArray) {
((URIParameterType) actualParameter.getType()).setValue(doStaging(outputFileStagingPath,
MappingFactory.toString(actualParameter), ftp, gssCred, endpoint));
}
} else if ("URIArray".equals(actualParameter.getType().getType().toString())) {
List<String> split = Arrays.asList(MappingFactory.toString(actualParameter).split(","));
List<String> newFiles = new ArrayList<String>();
- for (String endpoint : host.getGridFTPEndPointArray()) {
+ for (String endpoint : gridFTPEndpointArray) {
for (String paramValueEach : split) {
newFiles.add(doStaging(outputFileStagingPath, paramValueEach, ftp, gssCred, endpoint));
}
@@ -232,4 +304,5 @@ public class GridFTPOutputHandler implem
gssCred, outputFile);
return outputFileStagingPath + File.separator + fileName;
}
+
}
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GramProvider.java Thu Feb 21 15:19:13 2013
@@ -99,7 +99,8 @@ public class GramProvider implements GFa
*/
int jobStatus = listener.getStatus();
- if (job.getExitCode() != 0 || jobStatus == GramJob.STATUS_FAILED) {
+// if (job.getExitCode() != 0 || jobStatus == GramJob.STATUS_FAILED) {
+ if (jobStatus == GramJob.STATUS_FAILED) {
int errCode = listener.getError();
String errorMsg = "Job " + job.getID() + " on host " + host.getHostAddress() + " Job Exit Code = "
+ listener.getError();
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GFacUtils.java Thu Feb 21 15:19:13 2013
@@ -130,6 +130,17 @@ public class GFacUtils {
buf.append(localPath);
return new URI(buf.toString());
}
+
+ public static String createGsiftpURIAsString(String host, String localPath) throws URISyntaxException {
+ StringBuffer buf = new StringBuffer();
+ if (!host.startsWith("gsiftp://"))
+ buf.append("gsiftp://");
+ buf.append(host);
+ if (!host.endsWith("/"))
+ buf.append("/");
+ buf.append(localPath);
+ return buf.toString();
+ }
public static ActualParameter getInputActualParameter(Parameter parameter, OMElement element) {
OMElement innerelement = null;
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramJobSubmissionListener.java Thu Feb 21 15:19:13 2013
@@ -62,7 +62,7 @@ public class GramJobSubmissionListener i
if (proxyExpTime < JOB_PROXY_REMAINING_TIME_LIMIT) {
log.info("Job proxy expired. Trying to renew proxy");
GSSCredential gssCred = (new GSISecurityContext(context.getGFacConfiguration())).getGssCredentails();
- job.renew(gssCred);
+// job.renew(gssCred);
log.info("Myproxy renewed");
}
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/MyProxyManager.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/MyProxyManager.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/MyProxyManager.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/MyProxyManager.java Thu Feb 21 15:19:13 2013
@@ -30,6 +30,7 @@ import org.globus.gsi.TrustedCertificate
import org.globus.gsi.gssapi.GlobusGSSCredentialImpl;
import org.globus.myproxy.MyProxy;
import org.globus.myproxy.MyProxyException;
+import org.gridforum.jgss.ExtendedGSSCredential;
import org.ietf.jgss.GSSCredential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -69,10 +70,11 @@ public class MyProxyManager {
TrustedCertificates.setDefaultTrustedCertificates(certificates);
}
}
-
+
+ // not thread safe
public GSSCredential renewProxy() throws MyProxyException, IOException {
-
init();
+
String proxyloc = null;
MyProxy myproxy = new MyProxy(hostname, port);
GSSCredential proxy = myproxy.get(username, password, lifetime);
@@ -111,8 +113,30 @@ public class MyProxyManager {
Runtime.getRuntime().exec("/bin/chmod 600 " + proxyloc);
log.info("Proxy file renewed to " + proxyloc + " for the user " + username + " with " + lifetime
+ " lifetime.");
-
}
+
return proxy;
}
+
+ // this should be reused by the above method
+ public GlobusCredential getGlobusCredential() throws Exception{
+ init();
+ String proxyloc = null;
+ MyProxy myproxy = new MyProxy(hostname, port);
+ GSSCredential proxy = myproxy.get(username, password, lifetime);
+ GlobusCredential globusCred = null;
+ if (proxy instanceof GlobusGSSCredentialImpl) {
+ globusCred = ((GlobusGSSCredentialImpl) proxy)
+ .getGlobusCredential();
+ log.debug("got proxy from myproxy for " + username + " with "
+ + lifetime + " lifetime.");
+ }
+
+ return globusCred;
+ }
+
+
+
+
+
}
Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTest.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/GramProviderTest.java Thu Feb 21 15:19:13 2013
@@ -20,29 +20,53 @@
*/
package org.apache.airavata.core.gfac.services.impl;
-import com.amazonaws.services.importexport.model.JobType;
-import org.apache.airavata.client.AiravataAPIFactory;
-import org.apache.airavata.client.api.AiravataAPI;
-import org.apache.airavata.commons.gfac.type.*;
-import org.apache.airavata.gfac.Constants;
+import java.io.File;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import org.apache.airavata.commons.gfac.type.ActualParameter;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.commons.gfac.type.MappingFactory;
+import org.apache.airavata.commons.gfac.type.ServiceDescription;
import org.apache.airavata.gfac.GFacAPI;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
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.schemas.gfac.*;
-import org.apache.commons.lang.SystemUtils;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.airavata.schemas.gfac.HpcApplicationDeploymentType;
+import org.apache.airavata.schemas.gfac.InputParameterType;
+import org.apache.airavata.schemas.gfac.JobTypeType;
+import org.apache.airavata.schemas.gfac.OutputParameterType;
+import org.apache.airavata.schemas.gfac.ProjectAccountType;
+import org.apache.airavata.schemas.gfac.QueueType;
+import org.apache.airavata.schemas.gfac.StringParameterType;
+import org.apache.airavata.schemas.gfac.URIParameterType;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import java.io.File;
-import java.net.URL;
-import java.util.*;
-
public class GramProviderTest {
private JobExecutionContext jobExecutionContext;
+
+
+// private static final String hostAddress = "blacklight.psc.teragrid.org";
+// private static final String hostName = "Blacklight";
+// private static final String gridftpAddress = "gsiftp://gridftp.blacklight.psc.teragrid.org:2812";
+// private static final String gramAddress = "";
+
+
+ private static final String hostAddress = "tg-condor.purdue.teragrid.org";
+ private static final String hostName = "Condor Pool (Purdue)";
+ private static final String gridftpAddress = "gsiftp://tg-condor.purdue.teragrid.org:2811";
+ private static final String gramAddress = "tg-condor.rcac.purdue.edu:2119/jobmanager-fork";
+
@Before
public void setUp() throws Exception {
URL resource = GramProviderTest.class.getClassLoader().getResource("gfac-config.xml");
@@ -50,9 +74,9 @@ public class GramProviderTest {
GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null,null);
gFacConfiguration.setMyProxyLifeCycle(3600);
gFacConfiguration.setMyProxyServer("myproxy.teragrid.org");
- gFacConfiguration.setMyProxyUser("ogce");
- gFacConfiguration.setMyProxyPassphrase("");
- gFacConfiguration.setTrustedCertLocation("/Users/lahirugunathilake/Downloads/certificates");
+ gFacConfiguration.setMyProxyUser("*********");
+ gFacConfiguration.setMyProxyPassphrase("******");
+ gFacConfiguration.setTrustedCertLocation("/home/m.memon/.globus/certificates");
//have to set InFlwo Handlers and outFlowHandlers
// gFacConfiguration.setInHandlers(Arrays.asList(new String[] {"org.apache.airavata.gfac.handler.GramDirectorySetupHandler","org.apache.airavata.gfac.handler.GridFTPInputHandler"}));
// gFacConfiguration.setOutHandlers(Arrays.asList(new String[] {"org.apache.airavata.gfac.handler.GridFTPOutputHandler"}));
@@ -61,10 +85,10 @@ public class GramProviderTest {
* Host
*/
HostDescription host = new HostDescription(GlobusHostType.type);
- host.getType().setHostAddress("ranger.tacc.teragrid.org");
- host.getType().setHostName("ranger");
- ((GlobusHostType)host.getType()).setGlobusGateKeeperEndPointArray(new String[]{"gatekeeper.ranger.tacc.teragrid.org:2119/jobmanager-sge"});
- ((GlobusHostType)host.getType()).setGridFTPEndPointArray(new String[]{"gsiftp://gridftp.ranger.tacc.teragrid.org:2811/"});
+ host.getType().setHostAddress(hostAddress);
+ host.getType().setHostName(hostName);
+ ((GlobusHostType)host.getType()).setGlobusGateKeeperEndPointArray(new String[]{gramAddress});
+ ((GlobusHostType)host.getType()).setGridFTPEndPointArray(new String[]{gridftpAddress});
/*
* App
*/
@@ -92,7 +116,7 @@ public class GramProviderTest {
/*
* Default tmp location
*/
- String tempDir = "/scratch/01437/ogce/test";
+ String tempDir = "/scratch/02055/msmemon/airavata";
String date = (new Date()).toString();
date = date.replaceAll(" ", "_");
date = date.replaceAll(":", "_");
@@ -116,21 +140,32 @@ public class GramProviderTest {
serv.getType().setName("SimpleEcho");
List<InputParameterType> inputList = new ArrayList<InputParameterType>();
+
InputParameterType input = InputParameterType.Factory.newInstance();
input.setParameterName("echo_input");
input.setParameterType(StringParameterType.Factory.newInstance());
inputList.add(input);
+
+ InputParameterType input1 = InputParameterType.Factory.newInstance();
+ input.setParameterName("myinput");
+ URIParameterType uriType = URIParameterType.Factory.newInstance();
+ uriType.setValue("gsiftp://gridftp.ranger.tacc.teragrid.org:2811/tmp/t1/date.txt");
+ input.setParameterType(uriType);
+ inputList.add(input1);
+
+
InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList
- .size()]);
+ .size()]);
List<OutputParameterType> outputList = new ArrayList<OutputParameterType>();
OutputParameterType output = OutputParameterType.Factory.newInstance();
output.setParameterName("echo_output");
output.setParameterType(StringParameterType.Factory.newInstance());
outputList.add(output);
+
OutputParameterType[] outputParamList = outputList
.toArray(new OutputParameterType[outputList.size()]);
-
+
serv.getType().setInputParametersArray(inputParamList);
serv.getType().setOutputParametersArray(outputParamList);
@@ -145,6 +180,20 @@ public class GramProviderTest {
ActualParameter echo_input = new ActualParameter();
((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
inMessage.addParameter("echo_input", echo_input);
+
+ // added extra
+ ActualParameter copy_input = new ActualParameter();
+ copy_input.getType().changeType(URIParameterType.type);
+ ((URIParameterType)copy_input.getType()).setValue("file:///tmp/tmpstrace");
+
+ ActualParameter outlocation = new ActualParameter();
+ ((StringParameterType)outlocation.getType()).setValue("./outputData/.");
+ inMessage.addParameter("copy_input", copy_input);
+ inMessage.addParameter("outputlocation", outlocation);
+
+ // added extra
+
+
jobExecutionContext.setInMessageContext(inMessage);
Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java Thu Feb 21 15:19:13 2013
@@ -20,10 +20,7 @@
*/
package org.apache.airavata.core.gfac.services.impl;
-import org.apache.airavata.client.AiravataAPIFactory;
-import org.apache.airavata.client.api.AiravataAPI;
import org.apache.airavata.commons.gfac.type.*;
-import org.apache.airavata.gfac.Constants;
import org.apache.airavata.gfac.GFacAPI;
import org.apache.airavata.gfac.GFacConfiguration;
import org.apache.airavata.gfac.GFacException;
Modified: airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTest.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTest.java?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTest.java (original)
+++ airavata/trunk/modules/gfac-core/src/test/java/org/apache/airavata/core/gfac/services/impl/ParamChemTest.java Thu Feb 21 15:19:13 2013
@@ -45,8 +45,8 @@ public class ParamChemTest {
gFacConfiguration.setMyProxyLifeCycle(3600);
gFacConfiguration.setMyProxyServer("myproxy.teragrid.org");
gFacConfiguration.setMyProxyUser("ccguser");
- gFacConfiguration.setMyProxyPassphrase("");
- gFacConfiguration.setTrustedCertLocation("/Users/lahirugunathilake/Downloads/certificates");
+ gFacConfiguration.setMyProxyPassphrase("s3@g(id12");
+ gFacConfiguration.setTrustedCertLocation("");
//have to set InFlwo Handlers and outFlowHandlers
gFacConfiguration.setInHandlers(Arrays.asList(new String[]{"org.apache.airavata.gfac.handler.GramDirectorySetupHandler", "org.apache.airavata.gfac.handler.GridFTPInputHandler"}));
gFacConfiguration.setOutHandlers(Arrays.asList(new String[] {"org.apache.airavata.gfac.handler.GridFTPOutputHandler"}));
@@ -57,7 +57,7 @@ public class ParamChemTest {
HostDescription host = new HostDescription(GlobusHostType.type);
host.getType().setHostName("trestles");
host.getType().setHostAddress("trestles.sdsc.edu");
- ((GlobusHostType) host.getType()).addGridFTPEndPoint("gsiftp://trestles-login2.sdsc.edu:2811");
+ ((GlobusHostType) host.getType()).addGridFTPEndPoint("gsiftp://trestles-dm.sdsc.edu:2811");
((GlobusHostType) host.getType()).addGlobusGateKeeperEndPoint("trestles-login2.sdsc.edu:2119/jobmanager-pbstest2");
/*
@@ -281,10 +281,10 @@ public class ParamChemTest {
@Test
public void testGramProvider() throws GFacException {
-// GFacAPI gFacAPI = new GFacAPI();
-// gFacAPI.submitJob(jobExecutionContext);
-// MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
-// Assert.assertFalse(outMessageContext.getParameters().isEmpty());
+ GFacAPI gFacAPI = new GFacAPI();
+ gFacAPI.submitJob(jobExecutionContext);
+ MessageContext outMessageContext = jobExecutionContext.getOutMessageContext();
+ Assert.assertFalse(outMessageContext.getParameters().isEmpty());
// Assert.assertEquals(MappingFactory.toString((ActualParameter) outMessageContext.getParameter("echo_output")), "hello");
}
}
Modified: airavata/trunk/modules/gfac-core/src/test/resources/gfac-config.xml
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/test/resources/gfac-config.xml?rev=1448678&r1=1448677&r2=1448678&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/test/resources/gfac-config.xml (original)
+++ airavata/trunk/modules/gfac-core/src/test/resources/gfac-config.xml Thu Feb 21 15:19:13 2013
@@ -19,6 +19,15 @@
<Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
</OutHandlers>
</Provider>
+ <Provider class="org.apache.airavata.gfac.provider.BESProvider">
+ <InHandlers>
+ <Handler class="org.apache.airavata.gfac.handler.GramDirectorySetupHandler"/>
+ <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+ </InHandlers>
+ <OutHandlers>
+ <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
+ </OutHandlers>
+ </Provider>
<Application name="UltraScan">
<InHandlers>
<Handler class="org.apache.airavata.handlers.GramDirectorySetupHandler"/>