http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java deleted file mode 100644 index c764b63..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/cpi/GFacImpl.java +++ /dev/null @@ -1,798 +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.core.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 javax.xml.parsers.ParserConfigurationException; -//import javax.xml.xpath.XPathExpressionException; -// -//import org.apache.airavata.client.api.AiravataAPI; -//import org.apache.airavata.common.exception.ApplicationSettingsException; -//import org.apache.airavata.common.utils.MonitorPublisher; -//import org.apache.airavata.common.utils.ServerSettings; -//import org.apache.airavata.common.utils.listener.AbstractActivityListener; -//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.core.context.ApplicationContext; -//import org.apache.airavata.gfac.core.context.JobExecutionContext; -//import org.apache.airavata.gfac.core.context.MessageContext; -//import org.apache.airavata.gfac.core.handler.GFacHandler; -//import org.apache.airavata.gfac.core.handler.GFacHandlerConfig; -//import org.apache.airavata.gfac.core.handler.GFacHandlerException; -//import org.apache.airavata.gfac.core.handler.ThreadedHandler; -//import org.apache.airavata.gfac.core.monitor.ExperimentIdentity; -//import org.apache.airavata.gfac.core.monitor.JobIdentity; -//import org.apache.airavata.gfac.core.monitor.MonitorID; -//import org.apache.airavata.gfac.core.monitor.TaskIdentity; -////import org.apache.airavata.api.server.listener.ExperimentStatusChangedEvent; -//import org.apache.airavata.gfac.core.monitor.state.JobStatusChangeRequest; -//import org.apache.airavata.gfac.core.monitor.state.TaskStatusChangeRequest; -//import org.apache.airavata.gfac.core.monitor.state.TaskStatusChangedEvent; -//import org.apache.airavata.gfac.core.notification.events.ExecutionFailEvent; -//import org.apache.airavata.gfac.core.notification.listeners.LoggingListener; -//import org.apache.airavata.gfac.core.notification.listeners.WorkflowTrackingListener; -//import org.apache.airavata.gfac.core.provider.GFacProvider; -//import org.apache.airavata.gfac.core.scheduler.HostScheduler; -//import org.apache.airavata.gfac.core.states.GfacExperimentState; -//import org.apache.airavata.gfac.core.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.ExperimentState; -//import org.apache.airavata.model.workspace.experiment.JobState; -//import org.apache.airavata.model.workspace.experiment.TaskDetails; -//import org.apache.airavata.model.workspace.experiment.TaskState; -//import org.apache.airavata.registry.api.AiravataRegistry2; -//import org.apache.airavata.registry.cpi.Registry; -//import org.apache.airavata.registry.cpi.RegistryModelType; -//import org.apache.zookeeper.ZooKeeper; -//import org.slf4j.Logger; -//import org.slf4j.LoggerFactory; -//import org.xml.sax.SAXException; -// -//import com.google.common.eventbus.EventBus; -// -///** -// * 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 ZooKeeper zk; -// -// private static List<ThreadedHandler> daemonHandlers; -// -// private File gfacConfigFile; -// -// private List<AbstractActivityListener> activityListeners; -// -// private static MonitorPublisher monitorPublisher; -// -// /** -// * 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<ThreadedHandler>(); -// activityListeners = new ArrayList<AbstractActivityListener>(); -// monitorPublisher = new MonitorPublisher(new EventBus()); // This is a EventBus common for gfac -// startStatusUpdators(); -// startDaemonHandlers(); -// } -// -// private void startStatusUpdators() { -// try { -// String[] listenerClassList = ServerSettings.getActivityListeners(); -// for (String listenerClass : listenerClassList) { -// Class<? extends AbstractActivityListener> aClass = Class.forName(listenerClass).asSubclass(AbstractActivityListener.class); -// AbstractActivityListener abstractActivityListener = aClass.newInstance(); -// activityListeners.add(abstractActivityListener); -// abstractActivityListener.setup(getMonitorPublisher(), registry); -// log.info("Registering listener: " + listenerClass); -// getMonitorPublisher().registerListener(abstractActivityListener); -// } -// }catch (ClassNotFoundException e) { -// log.error("Error loading the listener classes configured in airavata-server.properties",e); -// } catch (InstantiationException e) { -// log.error("Error loading the listener classes configured in airavata-server.properties",e); -// } catch (IllegalAccessException e) { -// log.error("Error loading the listener classes configured in airavata-server.properties",e); -// } catch (ApplicationSettingsException e){ -// log.error("Error loading the listener classes configured in airavata-server.properties",e); -// } -// } -// private void startDaemonHandlers() { -// List<GFacHandlerConfig> 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<ThreadedHandler>(); -// 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 boolean submitJob(String experimentID,String taskID, String gatewayID) throws GFacException { -// JobExecutionContext jobExecutionContext = null; -// try { -// jobExecutionContext = createJEC(experimentID, taskID, gatewayID); -// 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, String gatewayID) throws Exception { -// JobExecutionContext jobExecutionContext; -// TaskDetails taskData = (TaskDetails) registry.get(RegistryModelType.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: " + serviceName ); -// } -// -// ServiceDescription serviceDescription = airavataRegistry2.getServiceDescriptor(serviceName); -// if (serviceDescription == null ) { -// throw new GFacException("Error executing the job because there is not Application Name in this Experiment: " + serviceName ); -// } -// String hostName; -// HostDescription hostDescription = null; -// if(taskData.getTaskScheduling().getResourceHostId() != null){ -// hostName = taskData.getTaskScheduling().getResourceHostId(); -// hostDescription = airavataRegistry2.getHostDescriptor(hostName); -// }else{ -// List<HostDescription> registeredHosts = new ArrayList<HostDescription>(); -// Map<String, ApplicationDescription> applicationDescriptors = airavataRegistry2.getApplicationDescriptors(serviceName); -// for (String hostDescName : applicationDescriptors.keySet()) { -// registeredHosts.add(airavataRegistry2.getHostDescriptor(hostDescName)); -// } -// Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class); -// HostScheduler hostScheduler = aClass.newInstance(); -// //TODO cleanup -// hostDescription = registeredHosts.get(0);//hostScheduler.schedule(registeredHosts); -// hostName = hostDescription.getType().getHostName(); -// } -// if(hostDescription == null){ -// throw new GFacException("Error executing the job as the host is not registered " + hostName); -// } -// 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); -// -// // setting experiment/task/workflownode related information -// Experiment experiment = (Experiment) registry.get(RegistryModelType.EXPERIMENT, experimentID); -// jobExecutionContext.setExperiment(experiment); -// jobExecutionContext.setExperimentID(experimentID); -// jobExecutionContext.setWorkflowNodeDetails(experiment.getWorkflowNodeDetailsList().get(0)); -// jobExecutionContext.setTaskData(taskData); -// -// // setting the registry -// jobExecutionContext.setRegistry(registry); -// -// ApplicationContext applicationContext = new ApplicationContext(); -// applicationContext.setApplicationDeploymentDescription(applicationDescription); -// applicationContext.setHostDescription(hostDescription); -// applicationContext.setServiceDescription(serviceDescription); -// jobExecutionContext.setApplicationContext(applicationContext); -// -// List<DataObjectType> experimentInputs = taskData.getApplicationInputs(); -// jobExecutionContext.setInMessageContext(new MessageContext(GFacUtils.getInMessageContext(experimentInputs, -// serviceDescription.getType().getInputParametersArray()))); -// -// List<DataObjectType> outputData = taskData.getApplicationOutputs(); -// jobExecutionContext.setOutMessageContext(new MessageContext(GFacUtils.getInMessageContext(outputData, -// serviceDescription.getType().getOutputParametersArray()))); -// -// jobExecutionContext.setProperty(Constants.PROP_TOPIC, experimentID); -// jobExecutionContext.setGfac(this); -// return jobExecutionContext; -// } -// -// private boolean 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 true; -// } -// -// -// public boolean cancel(String experimentID, String taskID, String gatewayID) throws GFacException { -// JobExecutionContext jobExecutionContext = null; -// try { -// jobExecutionContext = createJEC(experimentID, taskID, gatewayID); -// return cancel(jobExecutionContext); -// } catch (Exception e) { -// log.error("Error inovoking the job with experiment ID: " + experimentID); -// throw new GFacException(e); -// } -// } -// -// private boolean cancel(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()); -// try { -// Scheduler.schedule(jobExecutionContext); -// GFacProvider provider = jobExecutionContext.getProvider(); -// if (provider != null) { -// initProvider(provider, jobExecutionContext); -// cancelProvider(provider, jobExecutionContext); -// disposeProvider(provider, jobExecutionContext); -// } -// }catch (Exception e) { -// try { -// monitorPublisher.publish(new JobStatusChangeRequest(new MonitorID(jobExecutionContext), -// new JobIdentity(jobExecutionContext.getExperimentID(), -// jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(), -// jobExecutionContext.getTaskData().getTaskID(), jobExecutionContext.getJobDetails().getJobID()), JobState.FAILED)); -// } catch (NullPointerException e1) { -// log.error("Error occured during updating the statuses of Experiments,tasks or Job statuses to failed, " + -// "NullPointerException occurred because at this point there might not have Job Created", e1, e); -// // Updating status if job id is not set -//// monitorPublisher -//// .publish(new ExperimentStatusChangedEvent(new ExperimentIdentity(jobExecutionContext.getExperimentID()), ExperimentState.FAILED)); -// // Updating the task status if there's any task associated -// monitorPublisher.publish(new TaskStatusChangedEvent(new TaskIdentity(jobExecutionContext.getExperimentID(), jobExecutionContext -// .getWorkflowNodeDetails().getNodeInstanceId(), jobExecutionContext.getTaskData().getTaskID()), TaskState.FAILED)); -// -// } -// jobExecutionContext.setProperty(ERROR_SENT, "true"); -// jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(e.getCause())); -// throw new GFacException(e.getMessage(), e); -// } -// return true; -// } -// -// 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); -//// } -//// }catch (ClassNotFoundException e) { -//// log.error("Error loading the listener classes configured in airavata-server.properties",e); -//// } catch (InstantiationException e) { -//// log.error("Error loading the listener classes configured in airavata-server.properties",e); -//// } catch (IllegalAccessException e) { -//// log.error("Error loading the listener classes configured in airavata-server.properties",e); -//// } catch (ApplicationSettingsException e){ -//// log.error("Error loading the listener classes configured in airavata-server.properties",e); -//// } -//// } -//// private void startDaemonHandlers() { -//// List<GFacHandlerConfig> 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<ThreadedHandler>(); -//// 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 boolean submitJob(String experimentID,String taskID, String gatewayID) throws GFacException { -//// JobExecutionContext jobExecutionContext = null; -//// try { -//// jobExecutionContext = createJEC(experimentID, taskID, gatewayID); -//// 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, String gatewayID) throws Exception { -//// JobExecutionContext jobExecutionContext; -//// TaskDetails taskData = (TaskDetails) registry.get(RegistryModelType.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: " + serviceName ); -//// } -//// -//// ServiceDescription serviceDescription = airavataRegistry2.getServiceDescriptor(serviceName); -//// if (serviceDescription == null ) { -//// throw new GFacException("Error executing the job because there is not Application Name in this Experiment: " + serviceName ); -//// } -//// String hostName; -//// HostDescription hostDescription = null; -//// if(taskData.getTaskScheduling().getResourceHostId() != null){ -//// hostName = taskData.getTaskScheduling().getResourceHostId(); -//// hostDescription = airavataRegistry2.getHostDescriptor(hostName); -//// }else{ -//// List<HostDescription> registeredHosts = new ArrayList<HostDescription>(); -//// Map<String, ApplicationDescription> applicationDescriptors = airavataRegistry2.getApplicationDescriptors(serviceName); -//// for (String hostDescName : applicationDescriptors.keySet()) { -//// registeredHosts.add(airavataRegistry2.getHostDescriptor(hostDescName)); -//// } -//// Class<? extends HostScheduler> aClass = Class.forName(ServerSettings.getHostScheduler()).asSubclass(HostScheduler.class); -//// HostScheduler hostScheduler = aClass.newInstance(); -//// //TODO cleanup -//// hostDescription = registeredHosts.get(0);//hostScheduler.schedule(registeredHosts); -//// hostName = hostDescription.getType().getHostName(); -//// } -//// if(hostDescription == null){ -//// throw new GFacException("Error executing the job as the host is not registered " + hostName); -//// } -//// 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); -//// -//// // setting experiment/task/workflownode related information -//// Experiment experiment = (Experiment) registry.get(RegistryModelType.EXPERIMENT, experimentID); -//// jobExecutionContext.setExperiment(experiment); -//// jobExecutionContext.setExperimentID(experimentID); -//// jobExecutionContext.setWorkflowNodeDetails(experiment.getWorkflowNodeDetailsList().get(0)); -//// jobExecutionContext.setTaskData(taskData); -//// -//// // setting the registry -//// jobExecutionContext.setRegistry(registry); -//// -//// ApplicationContext applicationContext = new ApplicationContext(); -//// applicationContext.setApplicationDeploymentDescription(applicationDescription); -//// applicationContext.setHostDescription(hostDescription); -//// applicationContext.setServiceDescription(serviceDescription); -//// jobExecutionContext.setApplicationContext(applicationContext); -//// -//// List<DataObjectType> experimentInputs = taskData.getApplicationInputs(); -//// jobExecutionContext.setInMessageContext(new MessageContext(GFacUtils.getInMessageContext(experimentInputs, -//// serviceDescription.getType().getInputParametersArray()))); -//// -//// List<DataObjectType> outputData = taskData.getApplicationOutputs(); -//// jobExecutionContext.setOutMessageContext(new MessageContext(GFacUtils.getInMessageContext(outputData, -//// serviceDescription.getType().getOutputParametersArray()))); -//// -//// jobExecutionContext.setProperty(Constants.PROP_TOPIC, experimentID); -//// jobExecutionContext.setGfac(this); -//// return jobExecutionContext; -//// } -//// -//// private boolean 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 true; -//// } -//// -//// -//// public boolean cancel(String experimentID, String taskID, String gatewayID) throws GFacException { -//// JobExecutionContext jobExecutionContext = null; -//// try { -//// jobExecutionContext = createJEC(experimentID, taskID, gatewayID); -//// return cancel(jobExecutionContext); -//// } catch (Exception e) { -//// log.error("Error inovoking the job with experiment ID: " + experimentID); -//// throw new GFacException(e); -//// } -//// } -//// -//// private boolean cancel(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()); -//// try { -//// Scheduler.schedule(jobExecutionContext); -//// GFacProvider provider = jobExecutionContext.getProvider(); -//// if (provider != null) { -//// initProvider(provider, jobExecutionContext); -//// cancelProvider(provider, jobExecutionContext); -//// disposeProvider(provider, jobExecutionContext); -//// } -//// }catch (Exception e) { -//// try { -//// monitorPublisher.publish(new JobStatusChangeRequest(new MonitorID(jobExecutionContext), -//// new JobIdentity(jobExecutionContext.getExperimentID(), -//// jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(), -//// jobExecutionContext.getTaskData().getTaskID(), jobExecutionContext.getJobDetails().getJobID()), JobState.FAILED)); -//// } catch (NullPointerException e1) { -//// log.error("Error occured during updating the statuses of Experiments,tasks or Job statuses to failed, " + -//// "NullPointerException occurred because at this point there might not have Job Created", e1, e); -//// // Updating status if job id is not set -////// monitorPublisher -////// .publish(new ExperimentStatusChangedEvent(new ExperimentIdentity(jobExecutionContext.getExperimentID()), ExperimentState.FAILED)); -//// // Updating the task status if there's any task associated -//// monitorPublisher.publish(new TaskStatusChangedEvent(new TaskIdentity(jobExecutionContext.getExperimentID(), jobExecutionContext -//// .getWorkflowNodeDetails().getNodeInstanceId(), jobExecutionContext.getTaskData().getTaskID()), TaskState.FAILED)); -//// -//// } -//// jobExecutionContext.setProperty(ERROR_SENT, "true"); -//// jobExecutionContext.getNotifier().publish(new ExecutionFailEvent(e.getCause())); -//// throw new GFacException(e.getMessage(), e); -//// } -//// return true; -//// } -//// -//// 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) { -//// try { -//// monitorPublisher.publish(new JobStatusChangeRequest(new MonitorID(jobExecutionContext), -//// new JobIdentity(jobExecutionContext.getExperimentID(), -//// jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(), -//// jobExecutionContext.getTaskData().getTaskID(), jobExecutionContext.getJobDetails().getJobID()), JobState.FAILED)); -//// } catch (NullPointerException e1) { -//// log.error("Error occured during updating the statuses of Experiments,tasks or Job statuses to failed, " + -//// "NullPointerException occurred because at this point there might not have Job Created", e1, e); -//// // Updating status if job id is not set -////// monitorPublisher -////// .publish(new ExperimentStatusChangedEvent(new ExperimentIdentity(jobExecutionContext.getExperimentID()), ExperimentState.FAILED)); -//// // Updating the task status if there's any task associated -//// monitorPublisher.publish(new TaskStatusChangedEvent(new TaskIdentity(jobExecutionContext.getExperimentID(), jobExecutionContext -//// .getWorkflowNodeDetails().getNodeInstanceId(), jobExecutionContext.getTaskData().getTaskID()), TaskState.FAILED)); -//// -//// } -//// 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 cancelProvider(GFacProvider provider, JobExecutionContext jobExecutionContext) throws GFacException { -//// try { -//// provider.cancelJob(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<GFacHandlerConfig> handlers = jobExecutionContext.getGFacConfiguration().getInHandlers(); -//// for (GFacHandlerConfig handlerClassName : handlers) { -//// Class<? extends GFacHandler> 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 reInvokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException { -//// this.invokeOutFlowHandlers(jobExecutionContext); -//// } -//// -//// public void invokeOutFlowHandlers(JobExecutionContext jobExecutionContext) throws GFacException { -//// GFacConfiguration gFacConfiguration = jobExecutionContext.getGFacConfiguration(); -//// List<GFacHandlerConfig> handlers = null; -//// if(gFacConfiguration != null){ -//// handlers = jobExecutionContext.getGFacConfiguration().getOutHandlers(); -//// }else { -//// try { -//// jobExecutionContext = createJEC(jobExecutionContext.getExperimentID(), -//// jobExecutionContext.getTaskData().getTaskID(), jobExecutionContext.getGatewayID()); -//// } catch (Exception e) { -//// log.error("Error constructing job execution context during outhandler invocation"); -//// throw new GFacException(e); -//// } -//// schedule(jobExecutionContext); -//// } -//// for (GFacHandlerConfig handlerClassName : handlers) { -//// Class<? extends GFacHandler> 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); -//// } -//// } -//// -//// monitorPublisher.publish(GfacExperimentState.COMPLETED); -//// // At this point all the execution is finished so we update the task and experiment statuses. -//// // Handler authors does not have to worry about updating experiment or task statuses. -////// monitorPublisher.publish(new -////// ExperimentStatusChangedEvent(new ExperimentIdentity(jobExecutionContext.getExperimentID()), -////// ExperimentState.COMPLETED)); -//// // Updating the task status if there's any task associated -//// monitorPublisher.publish(new TaskStatusChangeRequest( -//// new TaskIdentity(jobExecutionContext.getExperimentID(), -//// jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(), -//// jobExecutionContext.getTaskData().getTaskID()), TaskState.COMPLETED -//// )); -//// } -//// -//// -//// public AiravataAPI getAiravataAPI() { -//// return airavataAPI; -//// } -//// -//// public AiravataRegistry2 getAiravataRegistry2() { -//// return airavataRegistry2; -//// } -//// -//// public static List<ThreadedHandler> getDaemonHandlers() { -//// return daemonHandlers; -//// } -//// -//// public static String getErrorSent() { -//// return ERROR_SENT; -//// } -//// -//// public File getGfacConfigFile() { -//// return gfacConfigFile; -//// } -//// -//// public static MonitorPublisher getMonitorPublisher() { -//// return monitorPublisher; -//// } -//// -//// public Registry getRegistry() { -//// return registry; -//// } -////}
http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java index ecf826d..aa98ef6 100644 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AbstractHandler.java @@ -24,7 +24,7 @@ import org.apache.airavata.common.utils.MonitorPublisher; import org.apache.airavata.gfac.core.context.JobExecutionContext; import org.apache.airavata.gfac.core.cpi.BetterGfacImpl; import org.apache.airavata.gfac.core.states.GfacHandlerState; -import org.apache.airavata.gfac.core.utils.GFacUtils; +import org.apache.airavata.gfac.core.GFacUtils; import org.apache.airavata.model.appcatalog.appinterface.OutputDataObjectType; import org.apache.airavata.model.messaging.event.TaskIdentifier; import org.apache.airavata.model.messaging.event.TaskOutputChangeEvent; http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java index c6ada52..3685bb8 100644 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/handler/AppDescriptorCheckHandler.java @@ -22,7 +22,7 @@ package org.apache.airavata.gfac.core.handler; import org.apache.airavata.gfac.core.context.JobExecutionContext; import org.apache.airavata.gfac.core.states.GfacHandlerState; -import org.apache.airavata.gfac.core.utils.GFacUtils; +import org.apache.airavata.gfac.core.GFacUtils; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java deleted file mode 100644 index d5b917b..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataJobStatusUpdator.java +++ /dev/null @@ -1,123 +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.core.monitor; - -import com.google.common.eventbus.Subscribe; -import org.apache.airavata.common.logger.AiravataLogger; -import org.apache.airavata.common.logger.AiravataLoggerFactory; -import org.apache.airavata.common.utils.AiravataUtils; -import org.apache.airavata.common.utils.MonitorPublisher; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.common.utils.listener.AbstractActivityListener; -import org.apache.airavata.messaging.core.MessageContext; -import org.apache.airavata.messaging.core.Publisher; -import org.apache.airavata.model.messaging.event.JobStatusChangeEvent; -import org.apache.airavata.model.messaging.event.JobStatusChangeRequestEvent; -import org.apache.airavata.model.messaging.event.MessageType; -import org.apache.airavata.model.workspace.experiment.JobDetails; -import org.apache.airavata.model.workspace.experiment.JobState; -import org.apache.airavata.registry.cpi.CompositeIdentifier; -import org.apache.airavata.registry.cpi.Registry; -import org.apache.airavata.registry.cpi.RegistryModelType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Calendar; - -public class AiravataJobStatusUpdator implements AbstractActivityListener { - private final static Logger logger = LoggerFactory.getLogger(AiravataJobStatusUpdator.class); - private Registry airavataRegistry; - - private MonitorPublisher monitorPublisher; - private Publisher publisher; - - - public Registry getAiravataRegistry() { - return airavataRegistry; - } - - public void setAiravataRegistry(Registry airavataRegistry) { - this.airavataRegistry = airavataRegistry; - } - - - @Subscribe - public void updateRegistry(JobStatusChangeRequestEvent jobStatus) throws Exception{ - /* Here we need to parse the jobStatus message and update - the registry accordingly, for now we are just printing to standard Out - */ - JobState state = jobStatus.getState(); - if (state != null) { - try { - String taskID = jobStatus.getJobIdentity().getTaskId(); - String jobID = jobStatus.getJobIdentity().getJobId(); - String expId = jobStatus.getJobIdentity().getExperimentId(); - updateJobStatus(expId,taskID, jobID, state); - logger.debug("expId - {}: Publishing job status for " + jobStatus.getJobIdentity().getJobId() + ":" - + state.toString(),jobStatus.getJobIdentity().getExperimentId()); - JobStatusChangeEvent event = new JobStatusChangeEvent(jobStatus.getState(), jobStatus.getJobIdentity()); - monitorPublisher.publish(event); - String messageId = AiravataUtils.getId("JOB"); - MessageContext msgCntxt = new MessageContext(event, MessageType.JOB, messageId, jobStatus.getJobIdentity().getGatewayId()); - msgCntxt.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); - publisher.publish(msgCntxt); - } catch (Exception e) { - logger.error("expId - " + jobStatus.getJobIdentity().getExperimentId() + ": Error persisting data" - + e.getLocalizedMessage(), e); - throw new Exception("Error persisting job status..", e); - } - } - } - - public void updateJobStatus(String expId, String taskId, String jobID, JobState state) throws Exception { - logger.info("expId - {}: Updating job status for " + jobID + ":" + state.toString(), expId); - CompositeIdentifier ids = new CompositeIdentifier(taskId, jobID); - JobDetails details = (JobDetails) airavataRegistry.get(RegistryModelType.JOB_DETAIL, ids); - if (details == null) { - details = new JobDetails(); - } - org.apache.airavata.model.workspace.experiment.JobStatus status = new org.apache.airavata.model.workspace.experiment.JobStatus(); - if (JobState.CANCELED.equals(details.getJobStatus().getJobState()) || - JobState.CANCELING.equals(details.getJobStatus().getJobState())) { - status.setJobState(details.getJobStatus().getJobState()); - } else { - status.setJobState(state); - } - status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis()); - details.setJobStatus(status); - details.setJobID(jobID); - logger.debug("expId - {}: Updated job status for " + jobID + ":" + details.getJobStatus().toString(), expId); - airavataRegistry.update(RegistryModelType.JOB_STATUS, status, ids); - } - - @SuppressWarnings("unchecked") - public void setup(Object... configurations) { - for (Object configuration : configurations) { - if (configuration instanceof Registry){ - this.airavataRegistry=(Registry)configuration; - } else if (configuration instanceof MonitorPublisher){ - this.monitorPublisher=(MonitorPublisher) configuration; - } else if (configuration instanceof Publisher){ - this.publisher=(Publisher) configuration; - } - } - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java deleted file mode 100644 index 90392d6..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataTaskStatusUpdator.java +++ /dev/null @@ -1,162 +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.core.monitor; - -import com.google.common.eventbus.Subscribe; -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.common.utils.AiravataUtils; -import org.apache.airavata.common.utils.MonitorPublisher; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.common.utils.listener.AbstractActivityListener; -import org.apache.airavata.messaging.core.MessageContext; -import org.apache.airavata.messaging.core.Publisher; -import org.apache.airavata.model.messaging.event.*; -import org.apache.airavata.model.workspace.experiment.TaskDetails; -import org.apache.airavata.model.workspace.experiment.TaskState; -import org.apache.airavata.registry.cpi.Registry; -import org.apache.airavata.registry.cpi.RegistryModelType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Calendar; - -public class AiravataTaskStatusUpdator implements AbstractActivityListener { - private final static Logger logger = LoggerFactory.getLogger(AiravataTaskStatusUpdator.class); - private Registry airavataRegistry; - private MonitorPublisher monitorPublisher; - private Publisher publisher; - - public Registry getAiravataRegistry() { - return airavataRegistry; - } - - public void setAiravataRegistry(Registry airavataRegistry) { - this.airavataRegistry = airavataRegistry; - } - - @Subscribe - public void setupTaskStatus(TaskStatusChangeRequestEvent taskStatus) throws Exception{ - try { - updateTaskStatus(taskStatus.getTaskIdentity().getTaskId(), taskStatus.getState()); - logger.debug("expId - {}: Publishing task status for " + taskStatus.getTaskIdentity().getTaskId() + ":" - + taskStatus.getState().toString(), taskStatus.getTaskIdentity().getExperimentId()); - TaskStatusChangeEvent event = new TaskStatusChangeEvent(taskStatus.getState(), taskStatus.getTaskIdentity()); - monitorPublisher.publish(event); - String messageId = AiravataUtils.getId("TASK"); - MessageContext msgCntxt = new MessageContext(event, MessageType.TASK, messageId, taskStatus.getTaskIdentity().getGatewayId()); - msgCntxt.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); - publisher.publish(msgCntxt); - } catch (Exception e) { - String msg = "Error persisting data task status to database..."; - logger.error(msg + e.getLocalizedMessage(), e); - throw new Exception(msg, e); - } - } - - @Subscribe - public void setupTaskStatus(JobStatusChangeEvent jobStatus) throws Exception{ - TaskState state=TaskState.UNKNOWN; - switch(jobStatus.getState()){ - case ACTIVE: - state=TaskState.EXECUTING; break; - case CANCELED: - state=TaskState.CANCELED; break; - case COMPLETE: case FAILED: - state=TaskState.POST_PROCESSING; break; - case HELD: case SUSPENDED: case QUEUED: - state=TaskState.WAITING; break; - case SETUP: - state=TaskState.PRE_PROCESSING; break; - case SUBMITTED: - state=TaskState.STARTED; break; - case UN_SUBMITTED: - state=TaskState.CANCELED; break; - case CANCELING: - state=TaskState.CANCELING; break; - default: - return; - } - try { - updateTaskStatus(jobStatus.getJobIdentity().getTaskId(), state); - logger.debug("expId - {}: Publishing task status for " + jobStatus.getJobIdentity().getTaskId() + ":" - + state.toString(), jobStatus.getJobIdentity().getExperimentId()); - TaskIdentifier taskIdentity = new TaskIdentifier(jobStatus.getJobIdentity().getTaskId(), - jobStatus.getJobIdentity().getWorkflowNodeId(), - jobStatus.getJobIdentity().getExperimentId(), - jobStatus.getJobIdentity().getGatewayId()); - TaskStatusChangeEvent event = new TaskStatusChangeEvent(state, taskIdentity); - monitorPublisher.publish(event); - String messageId = AiravataUtils.getId("TASK"); - MessageContext msgCntxt = new MessageContext(event, MessageType.TASK, messageId,jobStatus.getJobIdentity().getGatewayId()); - msgCntxt.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); - publisher.publish(msgCntxt); - - } catch (Exception e) { - logger.error("expId - " + jobStatus.getJobIdentity().getExperimentId() + ": Error persisting data" + e.getLocalizedMessage(), e); - throw new Exception("Error persisting task status..", e); - } - } - - public TaskState updateTaskStatus(String taskId, TaskState state) throws Exception { - TaskDetails details = (TaskDetails)airavataRegistry.get(RegistryModelType.TASK_DETAIL, taskId); - if(details == null) { - logger.error("Task details cannot be null at this point"); - throw new Exception("Task details cannot be null at this point"); - } - org.apache.airavata.model.workspace.experiment.TaskStatus status = new org.apache.airavata.model.workspace.experiment.TaskStatus(); - if(!TaskState.CANCELED.equals(details.getTaskStatus().getExecutionState()) - && !TaskState.CANCELING.equals(details.getTaskStatus().getExecutionState())){ - status.setExecutionState(state); - }else{ - status.setExecutionState(details.getTaskStatus().getExecutionState()); - } - status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis()); - details.setTaskStatus(status); - logger.debug("Updating task status for "+taskId+":"+details.getTaskStatus().toString()); - - airavataRegistry.update(RegistryModelType.TASK_STATUS, status, taskId); - return status.getExecutionState(); - } - - public void setup(Object... configurations) { - for (Object configuration : configurations) { - if (configuration instanceof Registry){ - this.airavataRegistry=(Registry)configuration; - } else if (configuration instanceof MonitorPublisher){ - this.monitorPublisher=(MonitorPublisher) configuration; - } else if (configuration instanceof Publisher){ - this.publisher=(Publisher) configuration; - } - } - } - - - @Subscribe - public void taskOutputChanged(TaskOutputChangeEvent taskOutputEvent) throws AiravataException { - String taskId = taskOutputEvent.getTaskIdentity().getTaskId(); - logger.debug("Task Output changed event received for workflow node : " + - taskOutputEvent.getTaskIdentity().getWorkflowNodeId() + ", task : " + taskId); - // TODO - do we need to update the output to the registry? , we do it in the workflowInterpreter too. - MessageContext messageContext = new MessageContext(taskOutputEvent, MessageType.TASKOUTPUT, taskOutputEvent.getTaskIdentity().getTaskId(), taskOutputEvent.getTaskIdentity().getGatewayId()); - messageContext.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); - publisher.publish(messageContext); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java deleted file mode 100644 index c32742a..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/AiravataWorkflowNodeStatusUpdator.java +++ /dev/null @@ -1,130 +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.core.monitor; - -import com.google.common.eventbus.Subscribe; -import org.apache.airavata.common.utils.AiravataUtils; -import org.apache.airavata.common.utils.MonitorPublisher; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.common.utils.listener.AbstractActivityListener; -import org.apache.airavata.messaging.core.MessageContext; -import org.apache.airavata.messaging.core.Publisher; -import org.apache.airavata.model.messaging.event.MessageType; -import org.apache.airavata.model.messaging.event.TaskStatusChangeEvent; -import org.apache.airavata.model.messaging.event.WorkflowIdentifier; -import org.apache.airavata.model.messaging.event.WorkflowNodeStatusChangeEvent; -import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails; -import org.apache.airavata.model.workspace.experiment.WorkflowNodeState; -import org.apache.airavata.model.workspace.experiment.WorkflowNodeStatus; -import org.apache.airavata.registry.cpi.Registry; -import org.apache.airavata.registry.cpi.RegistryModelType; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.Calendar; - -public class AiravataWorkflowNodeStatusUpdator implements AbstractActivityListener { - private final static Logger logger = LoggerFactory.getLogger(AiravataWorkflowNodeStatusUpdator.class); - - private Registry airavataRegistry; - private MonitorPublisher monitorPublisher; - private Publisher publisher; - - - - - public Registry getAiravataRegistry() { - return airavataRegistry; - } - - public void setAiravataRegistry(Registry airavataRegistry) { - this.airavataRegistry = airavataRegistry; - } - - @Subscribe - public void setupWorkflowNodeStatus(TaskStatusChangeEvent taskStatus) throws Exception{ - WorkflowNodeState state=WorkflowNodeState.UNKNOWN; - switch(taskStatus.getState()){ - case CANCELED: - state=WorkflowNodeState.CANCELED; break; - case COMPLETED: - state=WorkflowNodeState.COMPLETED; break; - case CONFIGURING_WORKSPACE: - state=WorkflowNodeState.INVOKED; break; - case FAILED: - state=WorkflowNodeState.FAILED; break; - case EXECUTING: case WAITING: case PRE_PROCESSING: case POST_PROCESSING: case OUTPUT_DATA_STAGING: case INPUT_DATA_STAGING: - state=WorkflowNodeState.EXECUTING; break; - case STARTED: - state=WorkflowNodeState.INVOKED; break; - case CANCELING: - state=WorkflowNodeState.CANCELING; break; - default: - return; - } - try { - String expId = taskStatus.getTaskIdentity().getExperimentId(); - updateWorkflowNodeStatus(expId, taskStatus.getTaskIdentity().getWorkflowNodeId(), state); - logger.debug("expId - {}: Publishing workflow node status for " + taskStatus.getTaskIdentity().getWorkflowNodeId() - + ":" + state.toString(), taskStatus.getTaskIdentity().getExperimentId()); - WorkflowIdentifier workflowIdentity = new WorkflowIdentifier(taskStatus.getTaskIdentity().getWorkflowNodeId(), - taskStatus.getTaskIdentity().getExperimentId(), - taskStatus.getTaskIdentity().getGatewayId()); - WorkflowNodeStatusChangeEvent event = new WorkflowNodeStatusChangeEvent(state, workflowIdentity); - monitorPublisher.publish(event); - String messageId = AiravataUtils.getId("WFNODE"); - MessageContext msgCntxt = new MessageContext(event, MessageType.WORKFLOWNODE, messageId, taskStatus.getTaskIdentity().getGatewayId()); - msgCntxt.setUpdatedTime(AiravataUtils.getCurrentTimestamp()); - - publisher.publish(msgCntxt); - } catch (Exception e) { - logger.error("expId - " + taskStatus.getTaskIdentity().getExperimentId() + ": Error persisting data" - + e.getLocalizedMessage(), e); - throw new Exception("Error persisting workflow node status..", e); - } - } - - public void updateWorkflowNodeStatus(String experimentId, String workflowNodeId, WorkflowNodeState state) throws Exception { - logger.info("expId - {}: Updating workflow node status for "+workflowNodeId+":"+state.toString(), experimentId); - WorkflowNodeDetails details = (WorkflowNodeDetails)airavataRegistry.get(RegistryModelType.WORKFLOW_NODE_DETAIL, workflowNodeId); - if(details == null) { - details = new WorkflowNodeDetails(); - details.setNodeInstanceId(workflowNodeId); - } - WorkflowNodeStatus status = new WorkflowNodeStatus(); - status.setWorkflowNodeState(state); - status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis()); - details.setWorkflowNodeStatus(status); - airavataRegistry.update(RegistryModelType.WORKFLOW_NODE_STATUS, status, workflowNodeId); - } - - public void setup(Object... configurations) { - for (Object configuration : configurations) { - if (configuration instanceof Registry){ - this.airavataRegistry=(Registry)configuration; - } else if (configuration instanceof MonitorPublisher){ - this.monitorPublisher=(MonitorPublisher) configuration; - } else if (configuration instanceof Publisher){ - this.publisher=(Publisher) configuration; - } - } - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/EmailParser.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/EmailParser.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/EmailParser.java new file mode 100644 index 0000000..0961fa4 --- /dev/null +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/EmailParser.java @@ -0,0 +1,35 @@ +/* + * + * 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.core.monitor; + +import org.apache.airavata.common.exception.AiravataException; + +import javax.mail.Message; +import javax.mail.MessagingException; + +public interface EmailParser { + static final String STATUS = "status"; + static final String JOBID = "jobId"; + static final String JOBNAME = "jobName"; + static final String EXIT_STATUS = "exitStatus"; + + JobStatusResult parseEmail(Message message) throws MessagingException, AiravataException; +} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java deleted file mode 100644 index dd1d9d8..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/ExperimentIdentity.java +++ /dev/null @@ -1,36 +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.core.monitor; -// -//public class ExperimentIdentity { -// private String experimentID; -// public ExperimentIdentity(String experimentId) { -// setExperimentID(experimentId); -// } -// public String getExperimentID() { -// return experimentID; -// } -// -// public void setExperimentID(String experimentID) { -// this.experimentID = experimentID; -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.java deleted file mode 100644 index 881dacd..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobIdentity.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.core.monitor; -// -//public class JobIdentity extends TaskIdentity { -// private String jobId; -// -// public JobIdentity(String experimentId, String workflowNodeId, String taskId, String jobId) { -// super(experimentId,workflowNodeId,taskId); -// setJobId(jobId); -// } -// -// public String getJobId() { -// return jobId; -// } -// -// public void setJobId(String jobId) { -// this.jobId = jobId; -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobStatusResult.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobStatusResult.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobStatusResult.java new file mode 100644 index 0000000..c1ea026 --- /dev/null +++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/JobStatusResult.java @@ -0,0 +1,55 @@ +/* + * + * 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.core.monitor; + +import org.apache.airavata.model.workspace.experiment.JobState; + +public class JobStatusResult { + private JobState state; + private String jobId; + + public String getJobName() { + return jobName; + } + + public void setJobName(String jobName) { + this.jobName = jobName; + } + + private String jobName; + + public JobState getState() { + return state; + } + + public void setState(JobState state) { + this.state = state; + } + + public String getJobId() { + return jobId; + } + + public void setJobId(String jobId) { + this.jobId = jobId; + } +} + http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java deleted file mode 100644 index 369b7a0..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/TaskIdentity.java +++ /dev/null @@ -1,38 +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.core.monitor; -// -//public class TaskIdentity extends WorkflowNodeIdentity { -// private String taskId; -// -// public TaskIdentity(String experimentId, String workflowNodeId, String taskId) { -// super(experimentId,workflowNodeId); -// setTaskId(taskId); -// } -// public String getTaskId() { -// return taskId; -// } -// -// public void setTaskId(String taskId) { -// this.taskId = taskId; -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.java deleted file mode 100644 index ba6f828..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/WorkflowNodeIdentity.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.core.monitor; -// -//public class WorkflowNodeIdentity extends ExperimentIdentity { -// private String workflowNodeID; -// public WorkflowNodeIdentity(String experimentId, String workflowNodeId) { -// super(experimentId); -// setWorkflowNodeID(workflowNodeId); -// } -// public String getWorkflowNodeID() { -// return workflowNodeID; -// } -// -// public void setWorkflowNodeID(String workflowNodeID) { -// this.workflowNodeID = workflowNodeID; -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java deleted file mode 100644 index 2530ff8..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangeRequest.java +++ /dev/null @@ -1,81 +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.core.monitor.state; -// -//import org.apache.airavata.common.utils.listener.AbstractStateChangeRequest; -//import org.apache.airavata.gfac.core.monitor.JobIdentity; -//import org.apache.airavata.gfac.core.monitor.MonitorID; -//import org.apache.airavata.model.workspace.experiment.JobState; -// -///** -// * This is the primary job state object used in -// * through out the monitor module. This use airavata-data-model JobState enum -// * Ideally after processing each event or monitoring message from remote system -// * Each monitoring implementation has to return this object with a state and -// * the monitoring ID -// */ -//public class JobStatusChangeRequest extends AbstractStateChangeRequest { -// private JobState state; -// private JobIdentity identity; -// -// private MonitorID monitorID; -// -// // this constructor can be used in Qstat monitor to handle errors -// public JobStatusChangeRequest() { -// } -// -// public JobStatusChangeRequest(MonitorID monitorID) { -// setIdentity(new JobIdentity(monitorID.getExperimentID(),monitorID.getWorkflowNodeID(), -// monitorID.getTaskID(),monitorID.getJobID())); -// setMonitorID(monitorID); -// this.state = monitorID.getStatus(); -// } -// public JobStatusChangeRequest(MonitorID monitorID, JobIdentity jobId, JobState state) { -// setIdentity(jobId); -// setMonitorID(monitorID); -// this.state = state; -// } -// -// public JobState getState() { -// return state; -// } -// -// public void setState(JobState state) { -// this.state = state; -// } -// -// public JobIdentity getIdentity() { -// return identity; -// } -// -// public void setIdentity(JobIdentity identity) { -// this.identity = identity; -// } -// -// public MonitorID getMonitorID() { -// return monitorID; -// } -// -// public void setMonitorID(MonitorID monitorID) { -// this.monitorID = monitorID; -// } -// -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangedEvent.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangedEvent.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangedEvent.java deleted file mode 100644 index b5ccf1c..0000000 --- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/core/monitor/state/JobStatusChangedEvent.java +++ /dev/null @@ -1,81 +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.core.monitor.state; -// -//import org.apache.airavata.common.utils.listener.AbstractStateChangeRequest; -//import org.apache.airavata.gfac.core.monitor.JobIdentity; -//import org.apache.airavata.gfac.core.monitor.MonitorID; -//import org.apache.airavata.model.workspace.experiment.JobState; -// -///** -// * This is the primary job state object used in -// * through out the monitor module. This use airavata-data-model JobState enum -// * Ideally after processing each event or monitoring message from remote system -// * Each monitoring implementation has to return this object with a state and -// * the monitoring ID -// */ -//public class JobStatusChangedEvent extends AbstractStateChangeRequest { -// private JobState state; -// private JobIdentity identity; -// -// private MonitorID monitorID; -// -// // this constructor can be used in Qstat monitor to handle errors -// public JobStatusChangedEvent() { -// } -// -// public JobStatusChangedEvent(MonitorID monitorID) { -// setIdentity(new JobIdentity(monitorID.getExperimentID(),monitorID.getWorkflowNodeID(), -// monitorID.getTaskID(),monitorID.getJobID())); -// setMonitorID(monitorID); -// this.state = monitorID.getStatus(); -// } -// public JobStatusChangedEvent(MonitorID monitorID, JobIdentity jobId, JobState state) { -// setIdentity(jobId); -// setMonitorID(monitorID); -// this.state = state; -// } -// -// public JobState getState() { -// return state; -// } -// -// public void setState(JobState state) { -// this.state = state; -// } -// -// public JobIdentity getIdentity() { -// return identity; -// } -// -// public void setIdentity(JobIdentity identity) { -// this.identity = identity; -// } -// -// public MonitorID getMonitorID() { -// return monitorID; -// } -// -// public void setMonitorID(MonitorID monitorID) { -// this.monitorID = monitorID; -// } -// -//}
