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/07 18:18:39 UTC
svn commit: r1443607 - in /airavata/trunk/modules/gfac-core/src:
main/java/org/apache/airavata/gfac/
main/java/org/apache/airavata/gfac/context/
main/java/org/apache/airavata/gfac/external/
main/java/org/apache/airavata/gfac/handler/ main/java/org/apac...
Author: lahiru
Date: Thu Feb 7 17:18:38 2013
New Revision: 1443607
URL: http://svn.apache.org/viewvc?rev=1443607&view=rev
Log:
more changes to gfac-core.
Added:
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java
Modified:
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacAPI.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.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/context/JobExecutionContext.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.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/notification/events/StatusChangeEvent.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.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/GramProvider.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/utils/GramJobSubmissionListener.java
airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/utils/GramProviderUtils.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/src/main/java/org/apache/airavata/gfac/GFacAPI.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacAPI.java?rev=1443607&r1=1443606&r2=1443607&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacAPI.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacAPI.java Thu Feb 7 17:18:38 2013
@@ -39,13 +39,13 @@ public class GFacAPI {
private static final Logger log = LoggerFactory.getLogger(GFacAPI.class);
-
public void submitJob(JobExecutionContext jobExecutionContext) throws GFacException {
// We need to check whether this job is submitted as a part of a large workflow. If yes,
// we need to setup workflow tracking listerner.
String workflowInstanceID = null;
if ((workflowInstanceID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_INSTANCE_ID)) != null) {
// This mean we need to register workflow tracking listener.
+ //todo implement WorkflowTrackingListener properly
registerWorkflowTrackingListener(workflowInstanceID, jobExecutionContext);
}
// Register log event listener. This is required in all scenarios.
@@ -56,22 +56,27 @@ public class GFacAPI {
private void schedule(JobExecutionContext jobExecutionContext) throws GFacException {
// Scheduler will decide the execution flow of handlers and provider which handles
// the job.
- Scheduler.schedule(jobExecutionContext);
+ try {
+ Scheduler.schedule(jobExecutionContext);
- // Executing in handlers in the order as they have configured in GFac configuration
- invokeInFlowHandlers(jobExecutionContext);
+ // Executing in handlers in the order as they have configured in GFac configuration
+ invokeInFlowHandlers(jobExecutionContext);
- // After executing the in handlers provider instance should be set to job execution context.
- // We get the provider instance and execute it.
- GFacProvider provider = jobExecutionContext.getProvider();
- if (provider != null) {
- initProvider(provider, jobExecutionContext);
- executeProvider(provider, jobExecutionContext);
- disposeProvider(provider, jobExecutionContext);
- }
+ // After executing the in handlers provider instance should be set to job execution context.
+ // We get the provider instance and execute it.
+ GFacProvider provider = jobExecutionContext.getProvider();
+ if (provider != null) {
+ initProvider(provider, jobExecutionContext);
+ executeProvider(provider, jobExecutionContext);
+ disposeProvider(provider, jobExecutionContext);
+ }
- invokeOutFlowHandlers(jobExecutionContext);
+ invokeOutFlowHandlers(jobExecutionContext);
+ } catch (GFacException e) {
+ jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(e.getCause()));
+ throw e;
+ }
}
private void initProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException {
@@ -109,7 +114,6 @@ public class GFacAPI {
private void invokeInFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException {
List<String> handlers = jobExecutionContext.getGFacConfiguration().getInHandlers();
-
for (String handlerClassName : handlers) {
Class<? extends GFacHandler> handlerClass;
GFacHandler handler;
@@ -123,16 +127,10 @@ public class GFacAPI {
} catch (IllegalAccessException e) {
throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
}
-
-
try {
handler.invoke(jobExecutionContext);
- jobExecutionContext.getNotificationService().publish(new FinishExecutionEvent());
} catch (GFacHandlerException e) {
- // TODO: Better error reporting.
- jobExecutionContext.getNotificationService().publish(new ExecutionFailEvent(e));
- log.error("Error occurred during in handler " + handlerClassName + " execution.");
- break;
+ throw new GFacException("Error Executing a InFlow Handler", e.getCause());
}
}
}
@@ -144,25 +142,23 @@ public class GFacAPI {
Class<? extends GFacHandler> handlerClass;
GFacHandler handler;
try {
- handlerClass = Class.forName(handlerClassName.trim()).asSubclass(GFacHandler.class);
+ handlerClass = Class.forName(handlerClassName.trim()).asSubclass(GFacHandler.class);
handler = handlerClass.newInstance();
} catch (ClassNotFoundException e) {
+ log.error(e.getMessage());
throw new GFacException("Cannot load handler class " + handlerClassName, e);
} catch (InstantiationException e) {
+ log.error(e.getMessage());
throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
} catch (IllegalAccessException e) {
+ log.error(e.getMessage());
throw new GFacException("Cannot instantiate handler class " + handlerClassName, e);
}
-
-
try {
handler.invoke(jobExecutionContext);
- jobExecutionContext.getNotificationService().publish(new FinishExecutionEvent());
} catch (GFacHandlerException e) {
// TODO: Better error reporting.
- jobExecutionContext.getNotificationService().publish(new ExecutionFailEvent(e));
- log.error("Error occurred during out handler " + handlerClassName + " execution.");
- break;
+ throw new GFacException("Error Executing a OutFlow Handler" , e.getCause());
}
}
}
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.java?rev=1443607&r1=1443606&r2=1443607&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/GFacConfiguration.java Thu Feb 7 17:18:38 2013
@@ -186,7 +186,8 @@ public class GFacConfiguration {
String xPath = Constants.XPATH_EXPR_APPLICATION_HANDLERS_START + applicationName + Constants.XPATH_EXPR_APPLICATION_OUTFLOW_HANDLERS_END;
List<String> strings = xpathGetAttributeValueList(handlerDoc, xPath, Constants.GFAC_CONFIG_HANDLER_CLASS_ATTRIBUTE);
this.outHandlers.addAll(strings);
- } else if (providerName != null) {
+ }
+ if(providerName != null) {
String xPath = Constants.XPATH_EXPR_PROVIDER_HANDLERS_START + providerName + Constants.XPATH_EXPR_PROVIDER_OUTFLOW_HANDLERS_END;
List<String> strings = xpathGetAttributeValueList(handlerDoc, xPath, Constants.GFAC_CONFIG_HANDLER_CLASS_ATTRIBUTE);
this.outHandlers.addAll(strings);
@@ -201,40 +202,47 @@ public class GFacConfiguration {
* file for GFac will look like below.
* <p/>
* <GFac>
- * <GlobalHandlers>
- * <InHandlers>
- * <Handler class="org.apache.airavata.gfac.GlobalHandler1">
- * </InHandler>
- * <OutHandlers>
- * <Handler class="org.apache.airavata.gfac.GlabalHandler2">
- * </OutHandlers>
+ * <GlobalHandlers>
+ * <InHandlers>
+ * <Handler class="org.apache.airavata.gfac.GlobalHandler1">
+ * </InHandler>
+ * <OutHandlers>
+ * <Handler class="org.apache.airavata.gfac.GlabalHandler2">
+ * </OutHandlers>
* </GlobalHandlers>
- * <Provider class="org.apache.airavata.gfac.providers.LocalProvider" host="LocalHost">
- * <InHandlers>
- * <Handler class="org.apache.airavata.gfac.handlers.LocalEvenSetupHandler">
- * </InHandlers>
- * <OutHandlers>
- * <Handler>org.apache.airavata.LocalOutHandler1</Handler>
- * </OutHandlers>
- * </Provider>
- * <Application name="UltraScan">
- * <InHandlers>
- * <Handler class="org.apache.airavata.gfac.handlers.LocalEvenSetupHandler">
- * </InHandlers>
- * <OutHandlers>
- * <Handler class="org.apache.airavata.gfac.LocalOutHandler1">
- * </OutHandlers>
- * </Application>
+ * <Provider class="org.apache.airavata.gfac.providers.LocalProvider" host="LocalHost">
+ * <InHandlers>
+ * <Handler class="org.apache.airavata.gfac.handlers.LocalEvenSetupHandler">
+ * </InHandlers>
+ * <OutHandlers>
+ * <Handler>org.apache.airavata.LocalOutHandler1</Handler>
+ * </OutHandlers>
+ * </Provider>
+ * <Application name="UltraScan">
+ * <InHandlers>
+ * <Handler class="org.apache.airavata.gfac.handlers.LocalEvenSetupHandler">
+ * </InHandlers>
+ * <OutHandlers>
+ * <Handler class="org.apache.airavata.gfac.LocalOutHandler1">
+ * </OutHandlers>
+ * </Application>
* </GFac>
*
* @param configFile configuration file
* @return GFacConfiguration object.
*/
- public static GFacConfiguration create(File configFile, AiravataAPI airavataAPI) throws ParserConfigurationException, IOException, SAXException, XPathExpressionException {
+ public static GFacConfiguration create(File configFile, AiravataAPI airavataAPI, Properties configurationProperties) throws ParserConfigurationException, IOException, SAXException, XPathExpressionException {
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
handlerDoc = docBuilder.parse(configFile);
GFacConfiguration configuration = new GFacConfiguration(airavataAPI);
+ if (configurationProperties != null) {
+ configuration.setMyProxyUser(configurationProperties.getProperty(MYPROXY_USER));
+ configuration.setMyProxyServer(configurationProperties.getProperty(MYPROXY_SERVER));
+ configuration.setMyProxyPassphrase(configurationProperties.getProperty(MYPROXY_PASS));
+ configuration.setMyProxyLifeCycle(Integer.parseInt(configurationProperties.getProperty(MYPROXY_LIFE)));
+ configuration.setTrustedCertLocation(configurationProperties.getProperty(TRUSTED_CERT_LOCATION));
+ }
return configuration;
}
@@ -256,7 +264,6 @@ public class GFacConfiguration {
* @throws XPathExpressionException
*/
private static List<String> xpathGetAttributeValueList(Document doc, String expression, String attribute) throws XPathExpressionException {
- System.out.println(expression);
XPathFactory xPathFactory = XPathFactory.newInstance();
XPath xPath = xPathFactory.newXPath();
XPathExpression expr = xPath.compile(expression);
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=1443607&r1=1443606&r2=1443607&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 7 17:18:38 2013
@@ -55,8 +55,6 @@ public class GSISecurityContext extends
public GSSCredential getGssCredentails() throws SecurityException {
try {
-
- System.out.println(gssCredentails);
if (gssCredentails == null || gssCredentails.getRemainingLifetime() < 10 * 90) {
if (proxyRenewer != null) {
gssCredentails = proxyRenewer.renewProxy();
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=1443607&r1=1443606&r2=1443607&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 Thu Feb 7 17:18:38 2013
@@ -63,9 +63,10 @@ public class JobExecutionContext extends
// by this context instance.
private String serviceName;
- public JobExecutionContext(GFacConfiguration gFacConfiguration){
+ public JobExecutionContext(GFacConfiguration gFacConfiguration,String serviceName){
this.gfacConfiguration = gFacConfiguration;
notifier = new GFacNotifier();
+ setServiceName(serviceName);
}
public ApplicationContext getApplicationContext() {
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.java?rev=1443607&r1=1443606&r2=1443607&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/external/GridFtp.java Thu Feb 7 17:18:38 2013
@@ -357,7 +357,7 @@ public class GridFtp {
localTempfile = localFile;
}
- log.info("Loca temporary file:" + localTempfile);
+ log.info("Local temporary file:" + localTempfile);
downloadFile(destURI, gsCredential, localTempfile);
Added: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java?rev=1443607&view=auto
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java (added)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java Thu Feb 7 17:18:38 2013
@@ -0,0 +1,81 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.handler;
+
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
+import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.File;
+import java.util.Date;
+import java.util.UUID;
+
+public class AppDescriptorCheckHandler implements GFacHandler {
+ private static final Logger logger = LoggerFactory.getLogger(AppDescriptorCheckHandler.class);
+
+ public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
+ logger.info("Invoking ApplicationDescriptorCheckHandler ...");
+ ApplicationDescription app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
+ ApplicationDeploymentDescriptionType appDesc = app.getType();
+ if (appDesc.getScratchWorkingDirectory() == null) {
+ appDesc.setScratchWorkingDirectory("/tmp");
+ }
+
+ /*
+ * Working dir
+ */
+ if (appDesc.getStaticWorkingDirectory() == null || "null".equals(appDesc.getStaticWorkingDirectory())) {
+ String date = new Date().toString();
+ date = date.replaceAll(" ", "_");
+ date = date.replaceAll(":", "_");
+
+ String tmpDir = appDesc.getScratchWorkingDirectory() + File.separator
+ + jobExecutionContext.getServiceName() + "_" + date + "_" + UUID.randomUUID();
+
+ appDesc.setStaticWorkingDirectory(tmpDir);
+ }
+
+ /*
+ * Input and Output Directory
+ */
+ if (appDesc.getInputDataDirectory() == null || "".equals(appDesc.getInputDataDirectory())) {
+ appDesc.setInputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + "inputData");
+ }
+ if (appDesc.getOutputDataDirectory() == null || "".equals(appDesc.getOutputDataDirectory())) {
+ appDesc.setOutputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + "outputData");
+ }
+
+ /*
+ * Stdout and Stderr for Shell
+ */
+ if (appDesc.getStandardOutput() == null || "".equals(appDesc.getStandardOutput())) {
+ appDesc.setStandardOutput(appDesc.getStaticWorkingDirectory() + File.separator
+ + appDesc.getApplicationName().getStringValue() + ".stdout");
+ }
+ if (appDesc.getStandardError() == null || "".equals(appDesc.getStandardError())) {
+ appDesc.setStandardError(appDesc.getStaticWorkingDirectory() + File.separator
+ + appDesc.getApplicationName().getStringValue() + ".stderr");
+ }
+ jobExecutionContext.getApplicationContext().setApplicationDeploymentDescription(app);
+ }
+}
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=1443607&r1=1443606&r2=1443607&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 Thu Feb 7 17:18:38 2013
@@ -21,12 +21,12 @@
package org.apache.airavata.gfac.handler;
+import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.notification.events.ExecutionFailEvent;
-public class GFacHandlerException extends Exception{
+public class GFacHandlerException extends GFacException{
public GFacHandlerException(String s) {
- super(s);
+ super(s,new Throwable(s));
}
public GFacHandlerException(String s, Throwable throwable) {
@@ -38,12 +38,12 @@ public class GFacHandlerException extend
}
public GFacHandlerException(String message, JobExecutionContext context) {
- super(message);
+ super(message,new Throwable(message));
sendFaultNotification(message,context,new Exception(message));
}
public GFacHandlerException(String message, JobExecutionContext context,Exception e,String... additionExceptiondata) {
- super(message);
+ super(message,e);
sendFaultNotification(message,context,e, additionExceptiondata);
}
@@ -53,6 +53,5 @@ public class GFacHandlerException extend
if (additionalExceptiondata==null || additionalExceptiondata.length==0){
additionalExceptiondata=new String[]{message,e.getLocalizedMessage()};
}
- executionContext.getNotifier().publish(new ExecutionFailEvent(e));
}
}
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=1443607&r1=1443606&r2=1443607&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 7 17:18:38 2013
@@ -20,6 +20,7 @@
*/
package org.apache.airavata.gfac.handler;
+import org.apache.airavata.commons.gfac.type.ApplicationDescription;
import org.apache.airavata.gfac.ToolsException;
import org.apache.airavata.gfac.context.GSISecurityContext;
import org.apache.airavata.gfac.context.JobExecutionContext;
@@ -33,15 +34,20 @@ import org.ietf.jgss.GSSCredential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import java.io.File;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.Date;
+import java.util.UUID;
public class GramDirectorySetupHandler implements GFacHandler {
private static final Logger log = LoggerFactory.getLogger(GramJobSubmissionListener.class);
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
+ log.info("Invoking GramDirectorySetupHandler ...");
GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
- ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
+ ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription();
+ ApplicationDeploymentDescriptionType app = applicationDeploymentDescription.getType();
GridFtp ftp = new GridFtp();
try {
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=1443607&r1=1443606&r2=1443607&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 7 17:18:38 2013
@@ -34,6 +34,8 @@ import org.apache.airavata.schemas.gfac.
import org.apache.airavata.schemas.gfac.URIArrayType;
import org.apache.airavata.schemas.gfac.URIParameterType;
import org.ietf.jgss.GSSCredential;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
import java.io.File;
import java.io.FileInputStream;
@@ -46,7 +48,9 @@ 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();
@@ -68,7 +72,7 @@ public class GridFTPInputHandler impleme
inputNew.getParameters().put(paramName, actualParameter);
}
} catch (Exception e) {
-// jobExecutionContext.getExecutionContext().getNotifier().executionFail(jobExecutionContext,e,"Error during Input File staging");
+ log.error(e.getMessage());
throw new GFacHandlerException("Error while input File Staging", jobExecutionContext, e, e.getLocalizedMessage());
}
jobExecutionContext.setInMessageContext(inputNew);
@@ -107,7 +111,6 @@ public class GridFTPInputHandler impleme
return paramValue;
}
}
- System.out.println(destURI.getPath());
return destURI.getPath();
}
}
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=1443607&r1=1443606&r2=1443607&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 7 17:18:38 2013
@@ -27,7 +27,6 @@ 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.notification.events.ExecutionFailEvent;
import org.apache.airavata.gfac.provider.GFacProviderException;
import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gfac.utils.GramJobSubmissionListener;
@@ -42,11 +41,12 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
-public class GridFTPOutputHandler implements GFacHandler{
+public class GridFTPOutputHandler implements GFacHandler {
private static final Logger log = LoggerFactory.getLogger(GramJobSubmissionListener.class);
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException {
- GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
+ log.info("Invoking GridFTPOutputHandler ...");
+ GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
GridFtp ftp = new GridFtp();
File localStdErrFile = null;
@@ -105,24 +105,24 @@ public class GridFTPOutputHandler implem
}
}
if (stringMap == null || stringMap.isEmpty()) {
- jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(new Throwable("Empty Output returned from the Application, Double check the application" +
- "and ApplicationDescriptor output Parameter Names")));
-// GFacProviderException exception = new GFacProviderException("Gram provider: Error creating job output", jobExecutionContext);
-// jobExecutionContext.getExecutionContext().getNotifier().executionFail(jobExecutionContext,exception,exception.getLocalizedMessage());
-// throw exception;
+ throw new GFacHandlerException("Empty Output returned from the Application, Double check the application" +
+ "and ApplicationDescriptor output Parameter Names");
}
//todo check the workflow context header and run the stateOutputFiles method to stage the output files in to a user defined location
- stageOutputFiles(jobExecutionContext,app.getOutputDataDirectory());
+// stageOutputFiles(jobExecutionContext, app.getOutputDataDirectory());
} catch (ToolsException e) {
+ log.error(e.getMessage());
throw new GFacHandlerException(e.getMessage(), jobExecutionContext, 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));
} catch (NullPointerException e) {
+ log.error(e.getMessage());
throw new GFacHandlerException("Output is not produced in stdout:" + e.getMessage(), jobExecutionContext, e, readLastLinesofStdOut(localStdErrFile.getPath(), 20));
}
}
} catch (Exception e) {
-// jobExecutionContext.getExecutionContext().getNotifier().executionFail(jobExecutionContext,e,readLastLinesofStdOut(localStdErrFile.getPath(), 20));
+ log.error(e.getMessage());
throw new GFacHandlerException(e.getMessage(), jobExecutionContext, e, readLastLinesofStdOut(localStdErrFile.getPath(), 20));
}
}
@@ -202,8 +202,10 @@ public class GridFTPOutputHandler implem
}
} catch (URISyntaxException e) {
+ log.error(e.getMessage());
throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
} catch (ToolsException e) {
+ log.error(e.getMessage());
throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
}
outputNew.getParameters().put(paramName, actualParameter);
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java?rev=1443607&r1=1443606&r2=1443607&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java Thu Feb 7 17:18:38 2013
@@ -21,8 +21,13 @@
package org.apache.airavata.gfac.notification.events;
public class StatusChangeEvent extends GFacEvent {
-
- public StatusChangeEvent(){
+ String statusMessage;
+ public StatusChangeEvent(String message){
+ statusMessage = message;
this.eventType = StatusChangeEvent.class.getSimpleName();
}
+
+ public String getStatusMessage() {
+ return statusMessage;
+ }
}
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java?rev=1443607&r1=1443606&r2=1443607&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java Thu Feb 7 17:18:38 2013
@@ -22,8 +22,7 @@
package org.apache.airavata.gfac.notification.listeners;
import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.gfac.notification.events.ExecutionFailEvent;
-import org.apache.airavata.gfac.notification.events.GFacEvent;
+import org.apache.airavata.gfac.notification.events.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -39,4 +38,20 @@ public class LoggingListener {
public void logExecutionFail(ExecutionFailEvent e){
log.error("Execution failed." + e.getEventType());
}
+
+ @Subscribe
+ public void logFinishExecutionEvent(FinishExecutionEvent event){
+ log.info("Execution has Finished ...");
+ }
+
+ @Subscribe
+ public void logStartExecutionEvent(StartExecutionEvent event){
+ log.info("Execution has started ...");
+ }
+
+ @Subscribe
+ public void logStatusChangeEvent(StatusChangeEvent event){
+ log.info("Job status has changed ...");
+ log.info(event.getStatusMessage());
+ }
}
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java?rev=1443607&r1=1443606&r2=1443607&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java Thu Feb 7 17:18:38 2013
@@ -26,7 +26,6 @@ import org.apache.airavata.gfac.notifica
import org.apache.airavata.workflow.tracking.Notifier;
import org.apache.airavata.workflow.tracking.NotifierFactory;
import org.apache.airavata.workflow.tracking.common.DurationObj;
-import org.apache.airavata.workflow.tracking.common.InvocationContext;
import org.apache.airavata.workflow.tracking.common.InvocationEntity;
import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext;
@@ -89,8 +88,8 @@ public class WorkflowTrackingListener {
}
@Subscribe
- public void statusChanged(InvocationContext context, String... data) {
- this.notifier.info(this.context, data);
+ public void statusChanged(StatusChangeEvent event) {
+ this.notifier.info(this.context, event.getStatusMessage());
}
@Subscribe
@@ -105,16 +104,16 @@ public class WorkflowTrackingListener {
@Subscribe
- public void info(InvocationContext context, String... data) {
+ public void info(String... data) {
this.notifier.info(this.context, data);
}
@Subscribe
- public void warning(InvocationContext context, String... data) {
+ public void warning(String... data) {
}
@Subscribe
- public void exception(InvocationContext context, String... data) {
+ public void exception(String... data) {
}
@Subscribe
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=1443607&r1=1443606&r2=1443607&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 Thu Feb 7 17:18:38 2013
@@ -22,7 +22,6 @@
package org.apache.airavata.gfac.provider;
import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.notification.events.ExecutionFailEvent;
public class GFacProviderException extends Exception {
private String aditionalInfo[] = null;
@@ -57,7 +56,6 @@ public class GFacProviderException exten
if (additionalExceptiondata==null || additionalExceptiondata.length==0){
additionalExceptiondata=new String[]{message,e.getLocalizedMessage()};
}
- executionContext.getNotifier().publish(new ExecutionFailEvent(e));
}
public String[] getAditionalInfo() {
Modified: airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GramProvider.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GramProvider.java?rev=1443607&r1=1443606&r2=1443607&view=diff
==============================================================================
--- airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GramProvider.java (original)
+++ airavata/trunk/modules/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GramProvider.java Thu Feb 7 17:18:38 2013
@@ -23,7 +23,7 @@ package org.apache.airavata.gfac.provide
import org.apache.airavata.gfac.JobSubmissionFault;
import org.apache.airavata.gfac.context.GSISecurityContext;
import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.gfac.notification.events.ExecutionFailEvent;
+import org.apache.airavata.gfac.notification.events.StartExecutionEvent;
import org.apache.airavata.gfac.utils.GramJobSubmissionListener;
import org.apache.airavata.gfac.utils.GramProviderUtils;
import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType;
@@ -49,6 +49,7 @@ public class GramProvider implements GFa
}
public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException {
+ jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
@@ -101,14 +102,13 @@ public class GramProvider implements GFa
+ listener.getError();
JobSubmissionFault error = new JobSubmissionFault(this, new Exception(errorMsg), "GFAC HOST",
gateKeeper, job.getRSL(), jobExecutionContext);
- jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(error.getCause()));
throw error;
}
} catch (GramException e) {
log.error(e.getMessage());
JobSubmissionFault error = new JobSubmissionFault(this, e, host.getHostAddress(),
host.getGlobusGateKeeperEndPointArray(0), job.getRSL(), jobExecutionContext);
- jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(error.getCause()));
+ throw error;
} catch (GSSException e) {
log.error(e.getMessage());
throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
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=1443607&r1=1443606&r2=1443607&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 Thu Feb 7 17:18:38 2013
@@ -25,6 +25,7 @@ import org.apache.airavata.commons.gfac.
import org.apache.airavata.gfac.Constants;
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.notification.events.StartExecutionEvent;
import org.apache.airavata.gfac.provider.GFacProvider;
import org.apache.airavata.gfac.provider.GFacProviderException;
import org.apache.airavata.gfac.utils.GFacUtils;
@@ -74,6 +75,7 @@ public class LocalProvider implements GF
}
public void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException {
+ jobExecutionContext.getNotifier().publish(new StartExecutionEvent());
ApplicationDeploymentDescriptionType app = jobExecutionContext.
getApplicationContext().getApplicationDeploymentDescription().getType();
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=1443607&r1=1443606&r2=1443607&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 7 17:18:38 2013
@@ -110,12 +110,10 @@ public class GramJobSubmissionListener i
public void statusChanged(GramJob job) {
String jobStatusMessage = "Status of job " + job.getIDAsString() + "is " + job.getStatusAsString();
- log.info(jobStatusMessage);
-
/*
* Notify status change
*/
- this.context.getNotifier().publish(new StatusChangeEvent());
+ this.context.getNotifier().publish(new StatusChangeEvent(jobStatusMessage));
/*
* Set new status if it is finished, notify all wait object
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=1443607&r1=1443606&r2=1443607&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 Thu Feb 7 17:18:38 2013
@@ -20,80 +20,17 @@
*/
package org.apache.airavata.gfac.utils;
-import org.apache.airavata.commons.gfac.type.ActualParameter;
-import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.ToolsException;
-import org.apache.airavata.gfac.context.GSISecurityContext;
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.notification.events.ExecutionFailEvent;
import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.schemas.gfac.*;
import org.globus.gram.GramAttributes;
import org.globus.gram.GramJob;
-import org.ietf.jgss.GSSCredential;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import java.io.*;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.util.*;
-
public class GramProviderUtils {
private static final Logger log = LoggerFactory.getLogger(GramJobSubmissionListener.class);
- public static void makeDirectory(JobExecutionContext jobExecutionContext) throws GFacProviderException {
- GlobusHostType host = (GlobusHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType();
- ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType();
- GridFtp ftp = new GridFtp();
-
- try {
- GSISecurityContext gssContext = new GSISecurityContext(jobExecutionContext.getGFacConfiguration());
- GSSCredential gssCred = gssContext.getGssCredentails();
- String[] hostgridFTP = host.getGridFTPEndPointArray();
- if (hostgridFTP == null || hostgridFTP.length == 0) {
- hostgridFTP = new String[]{host.getHostAddress()};
- }
- boolean success = false;
- GFacProviderException pe = null;// = new ProviderException("");
- for (String endpoint : host.getGridFTPEndPointArray()) {
- try {
-
- URI tmpdirURI = GFacUtils.createGsiftpURI(endpoint, app.getScratchWorkingDirectory());
- URI workingDirURI = GFacUtils.createGsiftpURI(endpoint, app.getStaticWorkingDirectory());
- URI inputURI = GFacUtils.createGsiftpURI(endpoint, app.getInputDataDirectory());
- URI outputURI = GFacUtils.createGsiftpURI(endpoint, app.getOutputDataDirectory());
-
- log.info("Host FTP = " + hostgridFTP[0]);
- log.info("temp directory = " + tmpdirURI);
- log.info("Working directory = " + workingDirURI);
- log.info("Input directory = " + inputURI);
- log.info("Output directory = " + outputURI);
-
- ftp.makeDir(tmpdirURI, gssCred);
- ftp.makeDir(workingDirURI, gssCred);
- ftp.makeDir(inputURI, gssCred);
- ftp.makeDir(outputURI, gssCred);
-
- success = true;
- break;
- } catch (URISyntaxException e) {
- pe = new GFacProviderException("URI is malformatted:" + e.getMessage(), e, jobExecutionContext);
-
- } catch (ToolsException e) {
- pe = new GFacProviderException(e.getMessage(), e, jobExecutionContext);
- }
- }
- if (success == false) {
- throw pe;
- }
- } catch (SecurityException e) {
- throw new GFacProviderException(e.getMessage(), e, jobExecutionContext);
- }
- }
-
public static GramJob setupEnvironment(JobExecutionContext jobExecutionContext) throws GFacProviderException {
log.debug("Searching for Gate Keeper");
try {
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=1443607&r1=1443606&r2=1443607&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 7 17:18:38 2013
@@ -47,7 +47,7 @@ public class GramProviderTest {
public void setUp() throws Exception {
URL resource = GramProviderTest.class.getClassLoader().getResource("gfac-config.xml");
System.out.println(resource.getFile());
- GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null);
+ GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()),null,null);
gFacConfiguration.setMyProxyLifeCycle(3600);
gFacConfiguration.setMyProxyServer("myproxy.teragrid.org");
gFacConfiguration.setMyProxyUser("ogce");
@@ -56,9 +56,6 @@ public class GramProviderTest {
//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"}));
- jobExecutionContext = new JobExecutionContext(gFacConfiguration);
- ApplicationContext applicationContext = new ApplicationContext();
- jobExecutionContext.setApplicationContext(applicationContext);
/*
* Host
@@ -68,7 +65,6 @@ public class GramProviderTest {
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/"});
- applicationContext.setHostDescription(host);
/*
* App
*/
@@ -112,7 +108,6 @@ public class GramProviderTest {
app.setStandardOutput(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stdout");
app.setStandardError(tempDir + File.separator + app.getApplicationName().getStringValue() + ".stderr");
- applicationContext.setApplicationDeploymentDescription(appDesc);
/*
* Service
@@ -139,11 +134,16 @@ public class GramProviderTest {
serv.getType().setInputParametersArray(inputParamList);
serv.getType().setOutputParametersArray(outputParamList);
+ jobExecutionContext = new JobExecutionContext(gFacConfiguration,serv.getType().getName());
+ ApplicationContext applicationContext = new ApplicationContext();
+ jobExecutionContext.setApplicationContext(applicationContext);
applicationContext.setServiceDescription(serv);
+ applicationContext.setApplicationDeploymentDescription(appDesc);
+ applicationContext.setHostDescription(host);
MessageContext inMessage = new MessageContext();
ActualParameter echo_input = new ActualParameter();
- ((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
+ ((StringParameterType)echo_input.getType()).setValue("echo_output=hello");
inMessage.addParameter("echo_input", echo_input);
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=1443607&r1=1443606&r2=1443607&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 7 17:18:38 2013
@@ -51,12 +51,7 @@ public class LocalProviderTest {
GFacConfiguration gFacConfiguration = new GFacConfiguration(null);
//have to set InFlwo Handlers and outFlowHandlers
- jobExecutionContext = new JobExecutionContext(gFacConfiguration);
ApplicationContext applicationContext = new ApplicationContext();
- jobExecutionContext.setApplicationContext(applicationContext);
- /*
- * Host
- */
HostDescription host = new HostDescription();
host.getType().setHostName("localhost");
host.getType().setHostAddress("localhost");
@@ -123,6 +118,11 @@ public class LocalProviderTest {
serv.getType().setInputParametersArray(inputParamList);
serv.getType().setOutputParametersArray(outputParamList);
+ jobExecutionContext = new JobExecutionContext(gFacConfiguration,serv.getType().getName());
+ jobExecutionContext.setApplicationContext(applicationContext);
+ /*
+ * Host
+ */
applicationContext.setServiceDescription(serv);
MessageContext inMessage = new MessageContext();
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=1443607&r1=1443606&r2=1443607&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 7 17:18:38 2013
@@ -50,9 +50,6 @@ public class ParamChemTest {
//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"}));
- jobExecutionContext = new JobExecutionContext(gFacConfiguration);
- ApplicationContext applicationContext = new ApplicationContext();
- jobExecutionContext.setApplicationContext(applicationContext);
/*
* Host
*/
@@ -63,7 +60,6 @@ public class ParamChemTest {
((GlobusHostType) host.getType()).addGridFTPEndPoint("gsiftp://trestles-login2.sdsc.edu:2811");
((GlobusHostType) host.getType()).addGlobusGateKeeperEndPoint("trestles-login2.sdsc.edu:2119/jobmanager-pbstest2");
- applicationContext.setHostDescription(host);
/*
* App
*/
@@ -100,7 +96,6 @@ public class ParamChemTest {
((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).setNodeCount(1);
((HpcApplicationDeploymentType) applicationDeploymentDescriptionType).setProcessorsPerNode(1);
- applicationContext.setApplicationDeploymentDescription(appDesc);
/*
* Service
@@ -216,6 +211,11 @@ public class ParamChemTest {
serv.getType().setInputParametersArray(inputParameters.toArray(new InputParameterType[]{}));
serv.getType().setOutputParametersArray(outputParameters.toArray(new OutputParameterType[]{}));
+ jobExecutionContext = new JobExecutionContext(gFacConfiguration,serv.getType().getName());
+ ApplicationContext applicationContext = new ApplicationContext();
+ applicationContext.setHostDescription(host);
+ applicationContext.setApplicationDeploymentDescription(appDesc);
+ jobExecutionContext.setApplicationContext(applicationContext);
applicationContext.setServiceDescription(serv);
MessageContext inMessage = new MessageContext();
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=1443607&r1=1443606&r2=1443607&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 7 17:18:38 2013
@@ -1,5 +1,9 @@
<GFac>
<GlobalHandlers>
+ <InHandlers>
+ <Handler class="org.apache.airavata.gfac.handler.AppDescriptorCheckHandler"/>
+ </InHandlers>
+ <OutHandlers></OutHandlers>
</GlobalHandlers>
<Provider class="org.apache.airavata.gfac.provider.GramProvider">
<InHandlers>
@@ -7,7 +11,7 @@
<Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
</InHandlers>
<OutHandlers>
- <Handler class="org.apache.airavata.gfac.handler.GridFTPInputHandler"/>
+ <Handler class="org.apache.airavata.gfac.handler.GridFTPOutputHandler"/>
</OutHandlers>
</Provider>
<Application name="UltraScan">
@@ -16,7 +20,7 @@
<Handler class="org.apache.airavata.handlers.GridFTPInputHandler"/>
</InHandlers>
<OutHandlers>
- <Handler class="org.apache.airavata.handlers.GridFTPInputHandler"/>
+ <Handler class="org.apache.airavata.handlers.GridFTPOutputHandler"/>
</OutHandlers>
</Application>
</GFac>
\ No newline at end of file