Return-Path: X-Original-To: apmail-airavata-commits-archive@www.apache.org Delivered-To: apmail-airavata-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DE51E11D98 for ; Mon, 5 May 2014 16:00:29 +0000 (UTC) Received: (qmail 91683 invoked by uid 500); 5 May 2014 16:00:15 -0000 Delivered-To: apmail-airavata-commits-archive@airavata.apache.org Received: (qmail 91603 invoked by uid 500); 5 May 2014 16:00:13 -0000 Mailing-List: contact commits-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list commits@airavata.apache.org Received: (qmail 91472 invoked by uid 99); 5 May 2014 16:00:10 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 05 May 2014 16:00:10 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id CD5429112C1; Mon, 5 May 2014 16:00:09 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: lahiru@apache.org To: commits@airavata.apache.org Date: Mon, 05 May 2014 16:00:12 -0000 Message-Id: <55c1d8d48d8045238c0de54beff49d99@git.apache.org> In-Reply-To: <9bc60efc36e748d6bbc1e9e3f018fd2d@git.apache.org> References: <9bc60efc36e748d6bbc1e9e3f018fd2d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [4/7] moving common monitoring classes to gfac-core http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java deleted file mode 100644 index 2241cb2..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java +++ /dev/null @@ -1,404 +0,0 @@ -/* - * - * 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.cpi; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import org.apache.airavata.client.api.AiravataAPI; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.commons.gfac.type.ApplicationDescription; -import org.apache.airavata.commons.gfac.type.HostDescription; -import org.apache.airavata.commons.gfac.type.ServiceDescription; -import org.apache.airavata.gfac.Constants; -import org.apache.airavata.gfac.GFacConfiguration; -import org.apache.airavata.gfac.GFacException; -import org.apache.airavata.gfac.Scheduler; -import org.apache.airavata.gfac.context.ApplicationContext; -import org.apache.airavata.gfac.context.JobExecutionContext; -import org.apache.airavata.gfac.context.MessageContext; -import org.apache.airavata.gfac.handler.GFacHandler; -import org.apache.airavata.gfac.handler.GFacHandlerConfig; -import org.apache.airavata.gfac.handler.GFacHandlerException; -import org.apache.airavata.gfac.handler.ThreadedHandler; -import org.apache.airavata.gfac.notification.events.ExecutionFailEvent; -import org.apache.airavata.gfac.notification.listeners.LoggingListener; -import org.apache.airavata.gfac.notification.listeners.WorkflowTrackingListener; -import org.apache.airavata.gfac.provider.GFacProvider; -import org.apache.airavata.gfac.scheduler.HostScheduler; -import org.apache.airavata.gfac.utils.GFacUtils; -import org.apache.airavata.model.workspace.experiment.DataObjectType; -import org.apache.airavata.model.workspace.experiment.Experiment; -import org.apache.airavata.model.workspace.experiment.TaskDetails; -import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails; -import org.apache.airavata.registry.api.AiravataRegistry2; -import org.apache.airavata.registry.cpi.DataType; -import org.apache.airavata.registry.cpi.Registry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import org.xml.sax.SAXException; - -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.xpath.XPathExpressionException; - -/** - * This is the GFac CPI class for external usage, this simply have a single method to submit a job to - * the resource, required data for the job has to be stored in registry prior to invoke this object. - */ -public class GFacImpl implements GFac { - private static final Logger log = LoggerFactory.getLogger(GFacImpl.class); - public static final String ERROR_SENT = "ErrorSent"; - - private Registry registry; - - private AiravataAPI airavataAPI; - - private AiravataRegistry2 airavataRegistry2; - - private static List daemonHandlers; - - private File gfacConfigFile; - /** - * Constructor for GFac - * - * @param registry - * @param airavataAPI - * @param airavataRegistry2 - */ - public GFacImpl(Registry registry, AiravataAPI airavataAPI, AiravataRegistry2 airavataRegistry2) { - this.registry = registry; - this.airavataAPI = airavataAPI; - this.airavataRegistry2 = airavataRegistry2; - daemonHandlers = new ArrayList(); - startDaemonHandlers(); - } - - private void startDaemonHandlers() { - List daemonHandlerConfig = null; - URL resource = GFacImpl.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML); - gfacConfigFile = new File(resource.getPath()); - try { - daemonHandlerConfig = GFacConfiguration.getDaemonHandlers(gfacConfigFile); - } catch (ParserConfigurationException e) { - log.error("Error parsing gfac-config.xml, double check the xml configuration",e); - } catch (IOException e) { - log.error("Error parsing gfac-config.xml, double check the xml configuration", e); - } catch (SAXException e) { - log.error("Error parsing gfac-config.xml, double check the xml configuration", e); - } catch (XPathExpressionException e) { - log.error("Error parsing gfac-config.xml, double check the xml configuration", e); - } - - for(GFacHandlerConfig handlerConfig:daemonHandlerConfig){ - String className = handlerConfig.getClassName(); - try { - Class aClass = Class.forName(className).asSubclass(ThreadedHandler.class); - ThreadedHandler threadedHandler = (ThreadedHandler) aClass.newInstance(); - threadedHandler.initProperties(handlerConfig.getProperties()); - daemonHandlers.add(threadedHandler); - }catch (ClassNotFoundException e){ - log.error("Error initializing the handler: " + className); - log.error(className + " class has to implement " + ThreadedHandler.class); - } catch (InstantiationException e) { - log.error("Error initializing the handler: " + className); - log.error(className + " class has to implement " + ThreadedHandler.class); - } catch (IllegalAccessException e) { - log.error("Error initializing the handler: " + className); - log.error(className + " class has to implement " + ThreadedHandler.class); - } catch (GFacHandlerException e) { - log.error("Error initializing the handler " + className); - } catch (GFacException e) { - e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. - } - } - for(ThreadedHandler tHandler:daemonHandlers){ - (new Thread(tHandler)).start(); - } - } - - /** - * This can be used to submit jobs for testing purposes just by filling parameters by hand (JobExecutionContext) - */ - public GFacImpl() { - daemonHandlers = new ArrayList(); - startDaemonHandlers(); - } - - /** - * This is the job launching method outsiders of GFac can use, this will invoke the GFac handler chain and providers - * And update the registry occordingly, so the users can query the database to retrieve status and output from Registry - * - * @param experimentID - * @return - * @throws GFacException - */ - public JobExecutionContext submitJob(String experimentID,String taskID) throws GFacException { - JobExecutionContext jobExecutionContext = null; - try { - jobExecutionContext = createJEC(experimentID, taskID); - - return submitJob(jobExecutionContext); - } catch (Exception e) { - log.error("Error inovoking the job with experiment ID: " + experimentID); - throw new GFacException(e); - } - } - - private JobExecutionContext createJEC(String experimentID, String taskID) throws Exception { - JobExecutionContext jobExecutionContext; - TaskDetails taskData = (TaskDetails) registry.get(DataType.TASK_DETAIL, taskID); - - // this is wear our new model and old model is mapping (so serviceName in ExperimentData and service name in ServiceDescriptor - // has to be same. - - // 1. Get the Task from the task ID and construct the Job object and save it in to registry - // 2. Add another property to jobExecutionContext and read them inside the provider and use it. - String serviceName = taskData.getApplicationId(); - if (serviceName == null) { - throw new GFacException("Error executing the job because there is not Application Name in this Experiment"); - } - List registeredHosts = new ArrayList(); - Map applicationDescriptors = airavataRegistry2.getApplicationDescriptors(serviceName); - for (String hostDescName : applicationDescriptors.keySet()) { - registeredHosts.add(airavataRegistry2.getHostDescriptor(hostDescName)); - } - Class aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class); - HostScheduler hostScheduler = aClass.newInstance(); - HostDescription hostDescription = hostScheduler.schedule(registeredHosts); - - ServiceDescription serviceDescription = airavataRegistry2.getServiceDescriptor(serviceName); - String hostName; - if(taskData.getTaskScheduling().getResourceHostId() != null){ - hostName = taskData.getTaskScheduling().getResourceHostId(); - }else{ - hostName = hostDescription.getType().getHostName(); - } - - ApplicationDescription applicationDescription = airavataRegistry2.getApplicationDescriptors(serviceName, hostName); - URL resource = GFacImpl.class.getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML); - Properties configurationProperties = ServerSettings.getProperties(); - GFacConfiguration gFacConfiguration = GFacConfiguration.create(new File(resource.getPath()), airavataAPI, configurationProperties); - - - // start constructing jobexecutioncontext - jobExecutionContext = new JobExecutionContext(gFacConfiguration, serviceName); - Experiment experiment = (Experiment) registry.get(DataType.EXPERIMENT, experimentID); - jobExecutionContext.setExperiment(experiment); - jobExecutionContext.setExperimentID(experimentID); - - jobExecutionContext.setTaskData(taskData); - - - - - jobExecutionContext.setRegistry(registry); - - ApplicationContext applicationContext = new ApplicationContext(); - applicationContext.setApplicationDeploymentDescription(applicationDescription); - applicationContext.setHostDescription(hostDescription); - applicationContext.setServiceDescription(serviceDescription); - jobExecutionContext.setApplicationContext(applicationContext); - - List experimentInputs = taskData.getApplicationInputs(); - jobExecutionContext.setInMessageContext(new MessageContext(GFacUtils.getMessageContext(experimentInputs, - serviceDescription.getType().getInputParametersArray()))); - - List outputData = taskData.getApplicationOutputs(); - jobExecutionContext.setOutMessageContext(new MessageContext(GFacUtils.getMessageContext(outputData, - serviceDescription.getType().getOutputParametersArray()))); - - jobExecutionContext.setProperty(Constants.PROP_TOPIC, experimentID); - - return jobExecutionContext; - } - - public JobExecutionContext 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. - jobExecutionContext.getNotificationService().registerListener(new LoggingListener()); - schedule(jobExecutionContext); - return jobExecutionContext; - } - - private void schedule(JobExecutionContext jobExecutionContext) throws GFacException { - // Scheduler will decide the execution flow of handlers and provider which handles - // the job. - String experimentID = jobExecutionContext.getExperimentID(); - try { - Scheduler.schedule(jobExecutionContext); - - // Executing in handlers in the order as they have configured in GFac configuration - invokeInFlowHandlers(jobExecutionContext); -// if (experimentID != null){ -// registry2.changeStatus(jobExecutionContext.getExperimentID(),AiravataJobState.State.INHANDLERSDONE); -// } - - // 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); - } - if(GFacUtils.isSynchronousMode(jobExecutionContext)){ - invokeOutFlowHandlers(jobExecutionContext); - } - } catch (Exception e) { - jobExecutionContext.setProperty(ERROR_SENT, "true"); - jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(e.getCause())); - throw new GFacException(e.getMessage(), e); - } - } - - private void initProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException { - try { - provider.initialize(jobExecutionContext); - } catch (Exception e) { - throw new GFacException("Error while initializing provider " + provider.getClass().getName() + ".", e); - } - } - - private void executeProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException { - try { - provider.execute(jobExecutionContext); - } catch (Exception e) { - throw new GFacException("Error while executing provider " + provider.getClass().getName() + " functionality.", e); - } - } - - private void disposeProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException { - try { - provider.dispose(jobExecutionContext); - } catch (Exception e) { - throw new GFacException("Error while invoking provider " + provider.getClass().getName() + " dispose method.", e); - } - } - - private void registerWorkflowTrackingListener(String workflowInstanceID, JobExecutionContext jobExecutionContext) { - String workflowNodeID = (String) jobExecutionContext.getProperty(Constants.PROP_WORKFLOW_NODE_ID); - String topic = (String) jobExecutionContext.getProperty(Constants.PROP_TOPIC); - String brokerUrl = (String) jobExecutionContext.getProperty(Constants.PROP_BROKER_URL); - jobExecutionContext.getNotificationService().registerListener( - new WorkflowTrackingListener(workflowInstanceID, workflowNodeID, brokerUrl, topic)); - - } - - private void invokeInFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException { - List handlers = jobExecutionContext.getGFacConfiguration().getInHandlers(); - for (GFacHandlerConfig handlerClassName : handlers) { - Class handlerClass; - GFacHandler handler; - try { - handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class); - handler = handlerClass.newInstance(); - handler.initProperties(handlerClassName.getProperties()); - } catch (ClassNotFoundException e) { - throw new GFacException("Cannot load handler class " + handlerClassName, e); - } catch (InstantiationException e) { - throw new GFacException("Cannot instantiate handler class " + handlerClassName, e); - } catch (IllegalAccessException e) { - throw new GFacException("Cannot instantiate handler class " + handlerClassName, e); - } - try { - handler.invoke(jobExecutionContext); - } catch (GFacHandlerException e) { - throw new GFacException("Error Executing a InFlow Handler", e.getCause()); - } - } - } - - public void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException { - GFacConfiguration gFacConfiguration = jobExecutionContext.getGFacConfiguration(); - List handlers = null; - if(gFacConfiguration != null){ - handlers = jobExecutionContext.getGFacConfiguration().getOutHandlers(); - }else { - try { - jobExecutionContext = createJEC(jobExecutionContext.getExperimentID(), jobExecutionContext.getTaskData().getTaskID()); - } catch (Exception e) { - log.error("Error constructing job execution context during outhandler invocation"); - throw new GFacException(e); - } - schedule(jobExecutionContext); - } - for (GFacHandlerConfig handlerClassName : handlers) { - Class handlerClass; - GFacHandler handler; - try { - handlerClass = Class.forName(handlerClassName.getClassName().trim()).asSubclass(GFacHandler.class); - handler = handlerClass.newInstance(); - handler.initProperties(handlerClassName.getProperties()); - } 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); - } catch (Exception e) { - // TODO: Better error reporting. - throw new GFacException("Error Executing a OutFlow Handler", e); - } - } - } - - - public AiravataAPI getAiravataAPI() { - return airavataAPI; - } - - public AiravataRegistry2 getAiravataRegistry2() { - return airavataRegistry2; - } - - public static List getDaemonHandlers() { - return daemonHandlers; - } - - public static String getErrorSent() { - return ERROR_SENT; - } - - public File getGfacConfigFile() { - return gfacConfigFile; - } - - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AbstractHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AbstractHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AbstractHandler.java deleted file mode 100644 index 3524cdb..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AbstractHandler.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * - * 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.gfac.context.JobExecutionContext; -import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory; -import org.apache.airavata.registry.cpi.Registry; - -public abstract class AbstractHandler implements GFacHandler { - protected Registry registry = null; - - public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException { - registry = jobExecutionContext.getRegistry(); - if(registry == null){ - registry = RegistryFactory.getDefaultRegistry(); - } - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java deleted file mode 100644 index 7cc5a47..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/AppDescriptorCheckHandler.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * - * 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.Constants; -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.Map; -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); - } - //FIXME: Move this input/output to application descrpitor - /* - * Input and Output Directory - */ - if (appDesc.getInputDataDirectory() == null || "".equals(appDesc.getInputDataDirectory())) { - appDesc.setInputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + Constants.INPUT_DATA_DIR_VAR_NAME); - } - if (appDesc.getOutputDataDirectory() == null || "".equals(appDesc.getOutputDataDirectory())) { - appDesc.setOutputDataDirectory(appDesc.getStaticWorkingDirectory() + File.separator + Constants.OUTPUT_DATA_DIR_VAR_NAME); - } - - /* - * 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); - } - - public void initProperties(Map properties) throws GFacHandlerException { - - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandler.java deleted file mode 100644 index 8f86a48..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandler.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * - * 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.gfac.GFacException; -import org.apache.airavata.gfac.context.JobExecutionContext; - -import java.util.Map; - -public interface GFacHandler { - - public void initProperties(Map properties) throws GFacHandlerException; - - public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException; -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerConfig.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerConfig.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerConfig.java deleted file mode 100644 index 585cce6..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerConfig.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * 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 java.util.Map; - -public class GFacHandlerConfig { - - public GFacHandlerConfig(Map properties, String className) { - this.properties = properties; - this.className = className; - } - - private Map properties; - - private String className; - - public void setProperties(Map properties) { - this.properties = properties; - } - - public void setClassName(String className) { - this.className = className; - } - - public Map getProperties() { - return properties; - } - - public String getClassName() { - return className; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java deleted file mode 100644 index 775e515..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/GFacHandlerException.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * 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.gfac.GFacException; -import org.apache.airavata.gfac.context.JobExecutionContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class GFacHandlerException extends GFacException { - private static final Logger log = LoggerFactory.getLogger(GFacHandlerException.class); - - public GFacHandlerException(String message) { - super(message, new Throwable(message)); - log.error(message); - } - - public GFacHandlerException(String s, Throwable throwable) { - super(s, throwable); - log.error(s,throwable); - } - - public GFacHandlerException(String message, Exception e, String... additionExceptiondata) { - super(message, e); - log.error(message,e); - } - public GFacHandlerException(Exception e) { - super(e); - log.error(e.getMessage(),e); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/ThreadedHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/ThreadedHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/ThreadedHandler.java deleted file mode 100644 index fadf120..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/handler/ThreadedHandler.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * - * 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; - -/** - * This handler can be used to run in a separate thread in handler chain or as a daemon - * for the gfac instance you are running. If this is configured as another - * handler in the execution chain this will get invoked in asynchronous mode in a separate - * thread for each request, so you have to make sure the thread is returning properly. - */ -public abstract class ThreadedHandler extends AbstractHandler implements Runnable{ - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/GFacNotifier.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/GFacNotifier.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/GFacNotifier.java deleted file mode 100644 index 0828c1b..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/GFacNotifier.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * - * 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.notification; - -import com.google.common.eventbus.EventBus; -import org.apache.airavata.gfac.notification.events.GFacEvent; - -public class GFacNotifier { - private EventBus eventBus; - - public GFacNotifier(){ - eventBus = new EventBus(); - } - - public void registerListener(Object listener){ - eventBus.register(listener); - } - - public void publish(GFacEvent event){ - eventBus.post(event); - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/ExecutionFailEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/ExecutionFailEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/ExecutionFailEvent.java deleted file mode 100644 index db96228..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/ExecutionFailEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * 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.notification.events; - -public class ExecutionFailEvent extends GFacEvent { - private Throwable cause; - - public ExecutionFailEvent(Throwable cause){ - this.eventType = ExecutionFailEvent.class.getSimpleName(); - this.cause = cause; - } - - public Throwable getCauseForFailure(){ - return cause; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishExecutionEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishExecutionEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishExecutionEvent.java deleted file mode 100644 index 0a0a7e4..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishExecutionEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * 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.notification.events; - -public class FinishExecutionEvent extends GFacEvent{ - - public FinishExecutionEvent(){ - this.eventType = FinishExecutionEvent.class.getSimpleName(); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishScheduleEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishScheduleEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishScheduleEvent.java deleted file mode 100644 index d710b74..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/FinishScheduleEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * 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.notification.events; - -public class FinishScheduleEvent extends GFacEvent { - - public FinishScheduleEvent(){ - this.eventType = FinishScheduleEvent.class.getSimpleName(); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/GFacEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/GFacEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/GFacEvent.java deleted file mode 100644 index 21fc8af..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/GFacEvent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * - * 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.notification.events; - -import org.apache.airavata.gfac.context.JobExecutionContext; - -public abstract class GFacEvent { - - protected JobExecutionContext executionContext; - - protected String eventType; - - public JobExecutionContext getJobExecutionContext(){ - return executionContext; - } - - public String getEventType(){ - return eventType; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/JobIDEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/JobIDEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/JobIDEvent.java deleted file mode 100644 index 32cb1cc..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/JobIDEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * 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.notification.events; - -public class JobIDEvent extends GFacEvent { - String statusMessage; - - public JobIDEvent(String message) { - statusMessage = message; - this.eventType = JobIDEvent.class.getSimpleName(); - } - - public String getStatusMessage() { - return statusMessage; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartExecutionEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartExecutionEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartExecutionEvent.java deleted file mode 100644 index 08feaaa..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartExecutionEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * 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.notification.events; - -public class StartExecutionEvent extends GFacEvent { - - public StartExecutionEvent(){ - this.eventType = StartExecutionEvent.class.getSimpleName(); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartScheduleEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartScheduleEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartScheduleEvent.java deleted file mode 100644 index 5934371..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StartScheduleEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * 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.notification.events; - -public class StartScheduleEvent extends GFacEvent { - - public StartScheduleEvent(){ - this.eventType = StartScheduleEvent.class.getSimpleName(); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java deleted file mode 100644 index 7ba2af3..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/StatusChangeEvent.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * 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.notification.events; - -public class StatusChangeEvent extends GFacEvent { - String statusMessage; - public StatusChangeEvent(String message){ - statusMessage = message; - this.eventType = StatusChangeEvent.class.getSimpleName(); - } - - public String getStatusMessage() { - return statusMessage; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/UnicoreJobIDEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/UnicoreJobIDEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/UnicoreJobIDEvent.java deleted file mode 100644 index a04e3ab..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/events/UnicoreJobIDEvent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * 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.notification.events; - -public class UnicoreJobIDEvent extends GFacEvent { - String statusMessage; - - public UnicoreJobIDEvent(String message) { - statusMessage = message; - this.eventType = UnicoreJobIDEvent.class.getSimpleName(); - } - - public String getStatusMessage() { - return statusMessage; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java deleted file mode 100644 index c59204c..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/LoggingListener.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * 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.notification.listeners; - -import com.google.common.eventbus.Subscribe; -import org.apache.airavata.gfac.notification.events.*; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class LoggingListener { - private static Logger log = LoggerFactory.getLogger("gfac-logginglistener"); - - @Subscribe - public void logGFacEvent(GFacEvent e){ - log.info("GFac event of type " + e.getEventType() + " received."); - } - - @Subscribe - 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()); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java deleted file mode 100644 index d2d813a..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/notification/listeners/WorkflowTrackingListener.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * - * 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.notification.listeners; - -import com.google.common.eventbus.Subscribe; -import org.apache.airavata.gfac.notification.events.*; -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.InvocationEntity; -import org.apache.airavata.workflow.tracking.common.WorkflowTrackingContext; - -import java.net.URI; -import java.util.Properties; - -public class WorkflowTrackingListener { - - private Notifier notifier; - - private String topic; - - private URI workflowID; - - private WorkflowTrackingContext context; - - private InvocationEntity initiator; - - private InvocationEntity receiver; - - private DurationObj duration; - - private org.apache.airavata.workflow.tracking.common.InvocationContext invocationContext; - - public WorkflowTrackingListener(String workflowID, String workflowNodeID, String brokerURL, String topic){ - this.topic = topic; - this.workflowID = URI.create(this.topic); - this.notifier = NotifierFactory.createNotifier(); - URI initiatorWorkflowID = URI.create(workflowID); - URI initiatorServiceID = URI.create(topic); - String initiatorWorkflowNodeID = workflowNodeID; - Integer initiatorWorkflowTimeStep = null; - this.context = this.notifier.createTrackingContext(new Properties(), brokerURL, initiatorWorkflowID, initiatorServiceID, - initiatorWorkflowNodeID, initiatorWorkflowTimeStep); - this.context.setTopic(topic); - this.initiator = this.notifier.createEntity(initiatorWorkflowID, initiatorServiceID, initiatorWorkflowNodeID, - initiatorWorkflowTimeStep); - - URI receiverWorkflowID = this.workflowID; - URI receiverServiceID = this.workflowID; - String receiverWorkflowNodeID = null; - Integer receiverWorkflowTimeStep = null; - - setReceiver(this.notifier.createEntity(receiverWorkflowID, receiverServiceID, receiverWorkflowNodeID, - receiverWorkflowTimeStep)); - // send start workflow - this.invocationContext = this.notifier.workflowInvoked(this.context, this.initiator); - } - - - - @Subscribe - public void startExecution(StartExecutionEvent e) { - this.duration = this.notifier.computationStarted(); - } - - @Subscribe - public void finishExecution(FinishExecutionEvent e) { - this.duration = this.notifier.computationFinished(this.context, this.duration); - } - - @Subscribe - public void statusChanged(StatusChangeEvent event) { - this.notifier.info(this.context, event.getStatusMessage()); - } - - @Subscribe - public void startSchedule(StartScheduleEvent e){ - this.notifier.info(this.context,e.getEventType()); - } - - @Subscribe - public void executionFail(ExecutionFailEvent e) { - this.notifier.sendingFault(this.context, this.invocationContext, e.getCauseForFailure().getMessage()); - } - - - @Subscribe - public void info(String... data) { - this.notifier.info(this.context, data); - } - - @Subscribe - public void warning(String... data) { - } - - @Subscribe - public void exception(String... data) { - } - - @Subscribe - public void finishSchedule(FinishScheduleEvent e){ - this.notifier.info(this.context,e.getEventType()); - } - - - public InvocationEntity getReceiver() { - return receiver; - } - - public void setReceiver(InvocationEntity receiver) { - this.receiver = receiver; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobData.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobData.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobData.java deleted file mode 100644 index c504a55..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobData.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * - * 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.persistence; - -/** - * User: AmilaJ (amilaj@apache.org) - * Date: 6/18/13 - * Time: 2:34 PM - */ - -public class JobData { - - private String jobId; - private int state; - - public JobData(String id, int state) { - this.jobId = id; - this.state = state; - } - - public String getJobId() { - return jobId; - } - - public void setJobId(String jobId) { - this.jobId = jobId; - } - - public int getState() { - return state; - } - - public void setState(int state) { - this.state = state; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobPersistenceManager.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobPersistenceManager.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobPersistenceManager.java deleted file mode 100644 index 9aaedc0..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/persistence/JobPersistenceManager.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * - * 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.persistence; - - -import org.apache.airavata.gfac.GFacException; - -import java.util.List; - -/** - * User: AmilaJ (amilaj@apache.org) - * Date: 6/18/13 - * Time: 2:23 PM - */ - -/** - * Responsible persisting job data. This data is useful during a restart. - * When restarting Airavata can resume monitoring currently executing jobs. - */ -public interface JobPersistenceManager { - - /** - * Updates the job state in the persisting storage. - * @param jobData Job data to update. - * @throws GFacException If an error occurred while updating job data. - */ - void updateJobStatus (JobData jobData) throws GFacException; - - /** - * Get all running jobs. - * @return Job ids which are not failed nor completed. - * @throws GFacException If an error occurred while querying job data. - */ - List getRunningJobs() throws GFacException; - - /** - * Get all failed job ids. - * @return Failed job ids. - * @throws GFacException If an error occurred while querying job data. - */ - List getFailedJobs() throws GFacException; - - /** - * Get all un-submitted job ids. - * @return Un-submitted job ids. - * @throws GFacException If an error occurred while querying job data. - */ - List getUnSubmittedJobs() throws GFacException; - - /** - * Get all successfully completed job ids. - * @return Successfully completed job ids. - * @throws GFacException If an error occurred while querying job data. - */ - List getSuccessfullyCompletedJobs() throws GFacException; - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java deleted file mode 100644 index 0b712b0..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/AbstractProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * 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.provider; - -import java.util.List; - -import org.apache.airavata.gfac.GFacException; -import org.apache.airavata.gfac.context.JobExecutionContext; -import org.apache.airavata.model.workspace.experiment.JobDetails; -import org.apache.airavata.model.workspace.experiment.JobStatus; -import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory; -import org.apache.airavata.registry.cpi.Registry; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public abstract class AbstractProvider implements GFacProvider{ - private final Logger log = LoggerFactory.getLogger(this.getClass()); - - protected Registry registry = null; - protected JobDetails details; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider - protected JobStatus status; //todo we need to remove this and add methods to fill Job details, this is not a property of a provider - protected JobExecutionContext jobExecutionContext; - - public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException { - log.debug("Initializing " + this.getClass().getName()); - registry = RegistryFactory.getDefaultRegistry(); - details = new JobDetails(); - status = new JobStatus(); - this.jobExecutionContext=jobExecutionContext; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java deleted file mode 100644 index 85d1dc5..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * - * 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.provider; - -import java.util.Map; - -import org.apache.airavata.gfac.GFacException; -import org.apache.airavata.gfac.context.JobExecutionContext; - -public interface GFacProvider{ - - void initProperties(Map properties) throws GFacProviderException,GFacException; - /** - * Initialize environment required for invoking the execute method of the provider. If environment setup is - * done during the in handler execution, validation of environment will go here. - * @param jobExecutionContext containing job execution related information. - * @throws GFacProviderException in case of a error initializing the environment. - */ - void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException; - - /** - * Invoke the providers intended functionality using information and data in job execution context. - * @param jobExecutionContext containing job execution related information. - * @throws GFacProviderException in case of a error executing the job. - */ - void execute(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException; - - /** - * Cleans up the acquired resources during initialization and execution of the job. - * @param jobExecutionContext containing job execution related information. - * @throws GFacProviderException in case of a error cleaning resources. - */ - void dispose(JobExecutionContext jobExecutionContext) throws GFacProviderException,GFacException; - - /** - * Cancels all jobs relevant to an experiment. - * @param jobId The experiment id - * @param jobExecutionContext The job execution context, contains runtime information. - * @throws GFacException If an error occurred while cancelling the job. - */ - public void cancelJob(String jobId, JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException; - - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderConfig.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderConfig.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderConfig.java deleted file mode 100644 index 5a7b2e3..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderConfig.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * 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.provider; - -import java.util.Map; - -public class GFacProviderConfig { - - public GFacProviderConfig(Map properties, String className) { - this.properties = properties; - this.className = className; - } - - private Map properties; - - private String className; - - public void setProperties(Map properties) { - this.properties = properties; - } - - public void setClassName(String className) { - this.className = className; - } - - public Map getProperties() { - return properties; - } - - public String getClassName() { - return className; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java deleted file mode 100644 index 8eafb1e..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProviderException.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * 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.provider; - -import org.apache.airavata.gfac.context.JobExecutionContext; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -public class GFacProviderException extends Exception { - private static final Logger log = LoggerFactory.getLogger(GFacProviderException.class); - - private String aditionalInfo[] = null; - - public GFacProviderException(String message) { - super(message); - log.error(message); - } - - - public GFacProviderException(String message, Throwable cause) { - super(message, cause); - log.error(message,cause); - } - - - public GFacProviderException(String message, Exception e, String... additionExceptiondata) { - super(message); - this.aditionalInfo = additionExceptiondata; - log.error(message,e); - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/DataIDType.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/DataIDType.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/DataIDType.java deleted file mode 100644 index e2dc268..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/DataIDType.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * - * 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.provider.utils; - -import org.apache.airavata.gfac.provider.GFacProviderException; -import org.xmlpull.v1.builder.XmlElement; - -import java.net.URI; -import java.net.URISyntaxException; -import java.util.ArrayList; - -/** - * Represents a DataID (A schema with real names), currently it only sends a one - * location value. - */ -public class DataIDType { - public static final String LOCATION_ATTRIBUTE = "location"; - - private URI dataID; - - private ArrayList dataLocations = new ArrayList(); - - public URI getRealLocation() { - if (dataLocations.size() > 0) { - return dataLocations.get(0); - } else { - return null; - } - } - - public DataIDType(XmlElement ele) throws GFacProviderException { - try { - String value = ele.requiredTextContent(); - if (value != null) { - this.dataID = new URI(value); - } else { - throw new GFacProviderException( - "Illegal InputMessage, No value content found for the parameter " - + ele.getName() + "/value. Invalid Local Argument"); - } - String location = ele.getAttributeValue(null, DataIDType.LOCATION_ATTRIBUTE); - if (location != null) { - addDataLocation(new URI(location)); - } - } catch (URISyntaxException e) { - throw new GFacProviderException("Invalid Local Argument", e); - } - } - - public DataIDType(URI dataID) { - super(); - this.dataID = dataID; - } - - public void addDataLocation(URI dataLocation) { - dataLocations.add(dataLocation); - } - - public ArrayList getDataLocations() { - return dataLocations; - } - - public URI getDataID() { - return dataID; - } - - public void fillData(XmlElement ele) { - ele.addChild(dataID.toString()); - URI location = getRealLocation(); - if (location != null) { - ele.addAttribute(DataIDType.LOCATION_ATTRIBUTE, location.toString()); - } - } - -} - http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ProviderUtils.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ProviderUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ProviderUtils.java deleted file mode 100644 index 6d276d3..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ProviderUtils.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * 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.provider.utils; - -import org.apache.airavata.commons.gfac.type.ActualParameter; -import org.apache.airavata.commons.gfac.type.MappingFactory; -import org.apache.airavata.gfac.context.JobExecutionContext; -import org.apache.airavata.gfac.context.MessageContext; -import org.apache.airavata.gfac.provider.GFacProviderException; -import org.apache.airavata.schemas.gfac.InputParameterType; - -import java.util.ArrayList; -import java.util.List; - -public class ProviderUtils { - - public static List getInputParameters(JobExecutionContext jobExecutionContext) throws GFacProviderException { - List parameters = new ArrayList(); - MessageContext inMessageContext = jobExecutionContext.getInMessageContext(); - InputParameterType[] inputParamDefinitionArray = jobExecutionContext.getApplicationContext(). - getServiceDescription().getType().getInputParametersArray(); - for (InputParameterType inputParam : inputParamDefinitionArray) { - String parameterName = inputParam.getParameterName(); - ActualParameter parameter = (ActualParameter)inMessageContext.getParameter(parameterName); - if(parameter == null){ - throw new GFacProviderException("Cannot find required input parameter " + parameterName + "."); - } - - parameters.add(MappingFactory.toString(parameter)); - } - - return parameters; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceRequirement.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceRequirement.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceRequirement.java deleted file mode 100644 index 9ca05dd..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/utils/ResourceRequirement.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * - * 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.provider.utils; - -public interface ResourceRequirement extends Cloneable { - - /** - * States whether this resource requirement is active - * and should be written into the job description. - * @return - */ - public boolean isEnabled(); - - public void setEnabled(boolean enabled); -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/HostScheduler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/HostScheduler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/HostScheduler.java deleted file mode 100644 index 982ea3d..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/HostScheduler.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * - * 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.scheduler; - -import org.apache.airavata.commons.gfac.type.HostDescription; - -import java.util.List; - -public interface HostScheduler { - /** - * This method will pick a host among set of hosts based on the algorithm users wants to implement, For a single instance - * of Airavata users can pick one Scheduler. - * @param registeredHosts - * @return - */ - public HostDescription schedule(List registeredHosts); -} http://git-wip-us.apache.org/repos/asf/airavata/blob/39370c52/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/impl/SimpleHostScheduler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/impl/SimpleHostScheduler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/impl/SimpleHostScheduler.java deleted file mode 100644 index cbbcbc7..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/scheduler/impl/SimpleHostScheduler.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * - * 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.scheduler.impl; - -import org.apache.airavata.commons.gfac.type.HostDescription; -import org.apache.airavata.gfac.scheduler.HostScheduler; - -import java.util.List; - -public class SimpleHostScheduler implements HostScheduler{ - public HostDescription schedule(List registeredHosts) { - //todo implement an algorithm to pick a host among different hosts, ideally this could be configurable in an xml - return registeredHosts.get(0); - } -}