http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/main/resources/service.properties ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/main/resources/service.properties b/modules/gfac/gfac-local/src/main/resources/service.properties deleted file mode 100644 index 391bfea..0000000 --- a/modules/gfac/gfac-local/src/main/resources/service.properties +++ /dev/null @@ -1,58 +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. -# -# - - -# -# Class which implemented Scheduler interface. It will be used to determine a Provider -# -scheduler.class= org.apache.airavata.core.gfac.scheduler.impl.SchedulerImpl - -# -# Data Service Plugins classes -# -datachain.classes= org.apache.airavata.core.gfac.extension.data.RegistryDataService - -# -# Pre execution Plugins classes. For example, GridFTP Input Staging -# -prechain.classes= org.apache.airavata.core.gfac.extension.pre.GridFtpInputStaging -prechain.classes= org.apache.airavata.core.gfac.extension.pre.HttpInputStaging - -# -# Post execution Plugins classes. For example, GridFTP Output Staging -# -postchain.classes= org.apache.airavata.core.gfac.extension.post.GridFtpOutputStaging -postchain.classes= org.apache.airavata.core.gfac.extension.post.OutputRegister - -# -# SSH private key location. It will be used by SSHProvider -# -# ssh.key=/home/user/.ssh/id_rsa -# ssh.keypass= -# ssh.username=usernameAtHost - -# -# MyProxy credential. It will be used by GridFTP Plugins and GramProvider. -# -# myproxy.server=myproxy.teragrid.org -# myproxy.user=username -# myproxy.pass=password -# myproxy.life=3600 \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java b/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java deleted file mode 100644 index aeb8158..0000000 --- a/modules/gfac/gfac-local/src/test/java/org/apache/airavata/core/gfac/services/impl/LocalProviderTest.java +++ /dev/null @@ -1,184 +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.core.gfac.services.impl; -// -//import java.io.File; -//import java.net.URL; -//import java.util.ArrayList; -//import java.util.List; -// -//import org.apache.airavata.common.utils.MonitorPublisher; -//import org.apache.airavata.commons.gfac.type.ActualParameter; -//import org.apache.airavata.commons.gfac.type.ApplicationDescription; -//import org.apache.airavata.commons.gfac.type.HostDescription; -//import org.apache.airavata.commons.gfac.type.ServiceDescription; -//import org.apache.airavata.gfac.GFacConfiguration; -//import org.apache.airavata.gfac.GFacException; -//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.provider.GFacProviderException; -//import org.apache.airavata.gfac.local.handler.LocalDirectorySetupHandler; -//import org.apache.airavata.gfac.local.provider.impl.LocalProvider; -//import org.apache.airavata.model.workspace.experiment.ExecutionUnit; -//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.persistance.registry.jpa.impl.LoggingRegistryImpl; -//import org.apache.airavata.schemas.gfac.ApplicationDeploymentDescriptionType; -//import org.apache.airavata.schemas.gfac.InputParameterType; -//import org.apache.airavata.schemas.gfac.OutputParameterType; -//import org.apache.airavata.schemas.gfac.StringParameterType; -//import org.apache.commons.lang.SystemUtils; -//import org.testng.annotations.BeforeTest; -//import org.testng.annotations.Test; -// -//import com.google.common.eventbus.EventBus; -// -//public class LocalProviderTest { -// private JobExecutionContext jobExecutionContext; -// @BeforeTest -// public void setUp() throws Exception { -// -// URL resource = this.getClass().getClassLoader().getResource(org.apache.airavata.common.utils.Constants.GFAC_CONFIG_XML); -// File configFile = new File(resource.getPath()); -// GFacConfiguration gFacConfiguration = GFacConfiguration.create(configFile, null); -// //have to set InFlwo Handlers and outFlowHandlers -// ApplicationContext applicationContext = new ApplicationContext(); -// HostDescription host = new HostDescription(); -// host.getType().setHostName("localhost"); -// host.getType().setHostAddress("localhost"); -// applicationContext.setHostDescription(host); -// /* -// * App -// */ -// ApplicationDescription appDesc = new ApplicationDescription(); -// ApplicationDeploymentDescriptionType app = appDesc.getType(); -// ApplicationDeploymentDescriptionType.ApplicationName name = ApplicationDeploymentDescriptionType.ApplicationName.Factory.newInstance(); -// name.setStringValue("EchoLocal"); -// app.setApplicationName(name); -// -// /* -// * Use bat file if it is compiled on Windows -// */ -// if (SystemUtils.IS_OS_WINDOWS) { -// URL url = this.getClass().getClassLoader().getResource("echo.bat"); -// app.setExecutableLocation(url.getFile()); -// } else { -// //for unix and Mac -// app.setExecutableLocation("/bin/echo"); -// } -// -// /* -// * Default tmp location -// */ -// String tempDir = System.getProperty("java.io.tmpdir"); -// if (tempDir == null) { -// tempDir = "/tmp"; -// } -// -// app.setScratchWorkingDirectory(tempDir); -// app.setStaticWorkingDirectory(tempDir); -// app.setInputDataDirectory(tempDir + File.separator + "input"); -// app.setOutputDataDirectory(tempDir + File.separator + "output"); -// app.setStandardOutput(tempDir + File.separator + "echo.stdout"); -// app.setStandardError(tempDir + File.separator + "echo.stderr"); -// -// applicationContext.setApplicationDeploymentDescription(appDesc); -// -// /* -// * Service -// */ -// ServiceDescription serv = new ServiceDescription(); -// serv.getType().setName("SimpleEcho"); -// -// List<InputParameterType> inputList = new ArrayList<InputParameterType>(); -// InputParameterType input = InputParameterType.Factory.newInstance(); -// input.setParameterName("echo_input"); -// input.setParameterType(StringParameterType.Factory.newInstance()); -// inputList.add(input); -// InputParameterType[] inputParamList = inputList.toArray(new InputParameterType[inputList -// .size()]); -// -// List<OutputParameterType> outputList = new ArrayList<OutputParameterType>(); -// OutputParameterType output = OutputParameterType.Factory.newInstance(); -// output.setParameterName("echo_output"); -// output.setParameterType(StringParameterType.Factory.newInstance()); -// outputList.add(output); -// OutputParameterType[] outputParamList = outputList -// .toArray(new OutputParameterType[outputList.size()]); -// -// serv.getType().setInputParametersArray(inputParamList); -// serv.getType().setOutputParametersArray(outputParamList); -// -// jobExecutionContext = new JobExecutionContext(gFacConfiguration, serv.getType().getName()); -// jobExecutionContext.setApplicationContext(applicationContext); -// /* -// * Host -// */ -// applicationContext.setServiceDescription(serv); -// -// MessageContext inMessage = new MessageContext(); -// ActualParameter echo_input = new ActualParameter(); -// ((StringParameterType) echo_input.getType()).setValue("echo_output=hello"); -// inMessage.addParameter("echo_input", echo_input); -// -// jobExecutionContext.setInMessageContext(inMessage); -// -// MessageContext outMessage = new MessageContext(); -// ActualParameter echo_out = new ActualParameter(); -// outMessage.addParameter("echo_output", echo_out); -// -// jobExecutionContext.setOutMessageContext(outMessage); -// -// jobExecutionContext.setExperimentID("test123"); -// jobExecutionContext.setExperiment(new Experiment("test123","project1","admin","testExp")); -// jobExecutionContext.setTaskData(new TaskDetails(jobExecutionContext.getExperimentID())); -// jobExecutionContext.setRegistry(new LoggingRegistryImpl()); -// jobExecutionContext.setWorkflowNodeDetails(new WorkflowNodeDetails(jobExecutionContext.getExperimentID(),"none", ExecutionUnit.APPLICATION)); -// -// -// } -// -// @Test -// public void testLocalDirectorySetupHandler() throws GFacException { -// LocalDirectorySetupHandler localDirectorySetupHandler = new LocalDirectorySetupHandler(); -// localDirectorySetupHandler.invoke(jobExecutionContext); -// -// ApplicationDescription applicationDeploymentDescription = jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription(); -// ApplicationDeploymentDescriptionType app = applicationDeploymentDescription.getType(); -// junit.framework.Assert.assertTrue(new File(app.getStaticWorkingDirectory()).exists()); -// junit.framework.Assert.assertTrue(new File(app.getScratchWorkingDirectory()).exists()); -// junit.framework.Assert.assertTrue(new File(app.getInputDataDirectory()).exists()); -// junit.framework.Assert.assertTrue(new File(app.getOutputDataDirectory()).exists()); -// } -// -// @Test -// public void testLocalProvider() throws GFacException,GFacProviderException { -// LocalDirectorySetupHandler localDirectorySetupHandler = new LocalDirectorySetupHandler(); -// localDirectorySetupHandler.invoke(jobExecutionContext); -// LocalProvider localProvider = new LocalProvider(); -// localProvider.setMonitorPublisher(new MonitorPublisher(new EventBus())); -// localProvider.initialize(jobExecutionContext); -// localProvider.execute(jobExecutionContext); -// localProvider.dispose(jobExecutionContext); -// } -//} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/test/resources/PBSTemplate.xslt ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/test/resources/PBSTemplate.xslt b/modules/gfac/gfac-local/src/test/resources/PBSTemplate.xslt deleted file mode 100644 index e749e9c..0000000 --- a/modules/gfac/gfac-local/src/test/resources/PBSTemplate.xslt +++ /dev/null @@ -1,73 +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. --> -<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ns="http://airavata.apache.org/gsi/ssh/2012/12"> -<xsl:output method="text" /> -<xsl:template match="/ns:JobDescriptor"> -#! /bin/sh -# PBS batch job script built by Globus job manager -# <xsl:choose> - <xsl:when test="ns:shellName"> -##PBS -S <xsl:value-of select="ns:shellName"/> - </xsl:when></xsl:choose> - <xsl:choose> - <xsl:when test="ns:queueName"> -#PBS -q <xsl:value-of select="ns:queueName"/> - </xsl:when> - </xsl:choose> - <xsl:choose> - <xsl:when test="ns:mailOptions"> -#PBS -m <xsl:value-of select="ns:mailOptions"/> - </xsl:when> - </xsl:choose> - <xsl:choose> -<xsl:when test="ns:acountString"> -#PBS -A <xsl:value-of select="ns:acountString"/> - </xsl:when> - </xsl:choose> - <xsl:choose> - <xsl:when test="ns:maxWallTime"> -#PBS -l walltime=<xsl:value-of select="ns:maxWallTime"/> - </xsl:when> - </xsl:choose> - <xsl:choose> - <xsl:when test="ns:standardOutFile"> -#PBS -o <xsl:value-of select="ns:standardOutFile"/> - </xsl:when> - </xsl:choose> - <xsl:choose> - <xsl:when test="ns:standardOutFile"> -#PBS -e <xsl:value-of select="ns:standardErrorFile"/> - </xsl:when> - </xsl:choose> - <xsl:choose> - <xsl:when test="(ns:nodes) and (ns:processesPerNode)"> -#PBS -l nodes=<xsl:value-of select="ns:nodes"/>:ppn=<xsl:value-of select="ns:processesPerNode"/> -<xsl:text>
</xsl:text> - </xsl:when> - </xsl:choose> -<xsl:for-each select="ns:exports/ns:name"> -<xsl:value-of select="."/>=<xsl:value-of select="./@value"/><xsl:text>
</xsl:text> -export<xsl:text> </xsl:text><xsl:value-of select="."/> -<xsl:text>
</xsl:text> -</xsl:for-each> -<xsl:for-each select="ns:preJobCommands/ns:command"> - <xsl:value-of select="."/><xsl:text> </xsl:text> - </xsl:for-each> -cd <xsl:text> </xsl:text><xsl:value-of select="ns:workingDirectory"/><xsl:text>
</xsl:text> - <xsl:choose><xsl:when test="ns:jobSubmitterCommand"> -<xsl:value-of select="ns:jobSubmitterCommand"/><xsl:text> </xsl:text></xsl:when></xsl:choose><xsl:value-of select="ns:executablePath"/><xsl:text> </xsl:text> -<xsl:for-each select="ns:inputs/ns:input"> - <xsl:value-of select="."/><xsl:text> </xsl:text> - </xsl:for-each> -<xsl:for-each select="ns:postJobCommands/ns:command"> - <xsl:value-of select="."/><xsl:text> </xsl:text> -</xsl:for-each> - -</xsl:template> - -</xsl:stylesheet> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-local/src/test/resources/logging.properties ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-local/src/test/resources/logging.properties b/modules/gfac/gfac-local/src/test/resources/logging.properties deleted file mode 100644 index 0584d38..0000000 --- a/modules/gfac/gfac-local/src/test/resources/logging.properties +++ /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. -# -# -#default/fallback log4j configuration -# - -# Set root logger level to WARN and its only appender to A1. -log4j.rootLogger=INFO, A1, A2 - -# A1 is set to be a rolling file appender with default params -log4j.appender.A1=org.apache.log4j.RollingFileAppender -log4j.appender.A1.File=target/seclogs.txt - -# A1 uses PatternLayout. -log4j.appender.A1.layout=org.apache.log4j.PatternLayout -log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c %x - %m%n - -# A2 is a console appender -log4j.appender.A2=org.apache.log4j.ConsoleAppender - -# A2 uses PatternLayout. -log4j.appender.A2.layout=org.apache.log4j.PatternLayout -log4j.appender.A2.layout.ConversionPattern=%d [%t] %-5p %c{1} %x - %m%n - -log4j.logger.unicore.security=INFO - http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-email-monitor/pom.xml ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/pom.xml b/modules/gfac/gfac-monitor/gfac-email-monitor/pom.xml deleted file mode 100644 index 2778f51..0000000 --- a/modules/gfac/gfac-monitor/gfac-email-monitor/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>airavata-gfac-monitor</artifactId> - <groupId>org.apache.airavata</groupId> - <version>0.16-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>airavata-gfac-email-monitor</artifactId> - <dependencies> - <dependency> - <groupId>javax.mail</groupId> - <artifactId>mail</artifactId> - <version>1.4.7</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-gfac-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-common-utils</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-data-models</artifactId> - <version>${project.version}</version> - </dependency> - </dependencies> - - -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailBasedMonitor.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailBasedMonitor.java b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailBasedMonitor.java deleted file mode 100644 index e418774..0000000 --- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailBasedMonitor.java +++ /dev/null @@ -1,345 +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.monitor.email; - -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.common.logger.AiravataLogger; -import org.apache.airavata.common.logger.AiravataLoggerFactory; -import org.apache.airavata.common.utils.ServerSettings; -import org.apache.airavata.gfac.core.context.JobExecutionContext; -import org.apache.airavata.gfac.core.cpi.BetterGfacImpl; -import org.apache.airavata.gfac.core.utils.GFacThreadPoolExecutor; -import org.apache.airavata.gfac.core.utils.OutHandlerWorker; -import org.apache.airavata.gfac.monitor.email.parser.EmailParser; -import org.apache.airavata.gfac.monitor.email.parser.LSFEmailParser; -import org.apache.airavata.gfac.monitor.email.parser.PBSEmailParser; -import org.apache.airavata.gfac.monitor.email.parser.SLURMEmailParser; -import org.apache.airavata.gfac.monitor.email.parser.UGEEmailParser; -import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManagerType; -import org.apache.airavata.model.messaging.event.JobIdentifier; -import org.apache.airavata.model.messaging.event.JobStatusChangeRequestEvent; -import org.apache.airavata.model.workspace.experiment.JobState; -import org.apache.airavata.model.workspace.experiment.JobStatus; - -import javax.mail.Address; -import javax.mail.Flags; -import javax.mail.Folder; -import javax.mail.Message; -import javax.mail.MessagingException; -import javax.mail.NoSuchProviderException; -import javax.mail.Session; -import javax.mail.Store; -import javax.mail.search.FlagTerm; -import javax.mail.search.SearchTerm; -import java.util.ArrayList; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.ConcurrentHashMap; - -public class EmailBasedMonitor implements Runnable{ - private static final AiravataLogger log = AiravataLoggerFactory.getLogger(EmailBasedMonitor.class); - - public static final int COMPARISON = 6; // after and equal - public static final String IMAPS = "imaps"; - public static final String POP3 = "pop3"; - private boolean stopMonitoring = false; - - private Session session ; - private Store store; - private Folder emailFolder; - private Properties properties; - private Map<String, JobExecutionContext> jobMonitorMap = new ConcurrentHashMap<String, JobExecutionContext>(); - private String host, emailAddress, password, storeProtocol, folderName ; - private Date monitorStartDate; - private Map<ResourceJobManagerType, EmailParser> emailParserMap = new HashMap<ResourceJobManagerType, EmailParser>(); - - public EmailBasedMonitor(ResourceJobManagerType type) throws AiravataException { - init(); - } - - private void init() throws AiravataException { - host = ServerSettings.getEmailBasedMonitorHost(); - emailAddress = ServerSettings.getEmailBasedMonitorAddress(); - password = ServerSettings.getEmailBasedMonitorPassword(); - storeProtocol = ServerSettings.getEmailBasedMonitorStoreProtocol(); - folderName = ServerSettings.getEmailBasedMonitorFolderName(); - if (!(storeProtocol.equals(IMAPS) || storeProtocol.equals(POP3))) { - throw new AiravataException("Unsupported store protocol , expected " + - IMAPS + " or " + POP3 + " but found " + storeProtocol); - } - properties = new Properties(); - properties.put("mail.store.protocol", storeProtocol); - } - - public void addToJobMonitorMap(JobExecutionContext jobExecutionContext) { - String monitorId = jobExecutionContext.getJobDetails().getJobID(); - if (monitorId == null || monitorId.isEmpty()) { - monitorId = jobExecutionContext.getJobDetails().getJobName(); - } - addToJobMonitorMap(monitorId, jobExecutionContext); - } - - public void addToJobMonitorMap(String monitorId, JobExecutionContext jobExecutionContext) { - log.info("[EJM]: Added monitor Id : " + monitorId + " to email based monitor map"); - jobMonitorMap.put(monitorId, jobExecutionContext); - } - - private JobStatusResult parse(Message message) throws MessagingException, AiravataException { - Address fromAddress = message.getFrom()[0]; - String addressStr = fromAddress.toString(); - ResourceJobManagerType jobMonitorType = getJobMonitorType(addressStr); - EmailParser emailParser = emailParserMap.get(jobMonitorType); - if (emailParser == null) { - switch (jobMonitorType) { - case PBS: - emailParser = new PBSEmailParser(); - break; - case SLURM: - emailParser = new SLURMEmailParser(); - break; - case LSF: - emailParser = new LSFEmailParser(); - break; - case UGE: - emailParser = new UGEEmailParser(); - break; - default: - throw new AiravataException("[EJM]: Un-handle resource job manager type: " + jobMonitorType.toString() + " for email monitoring --> " + addressStr); - } - - emailParserMap.put(jobMonitorType, emailParser); - } - return emailParser.parseEmail(message); - } - - private ResourceJobManagerType getJobMonitorType(String addressStr) throws AiravataException { - System.out.println("*********** address ******** : " + addressStr); - switch (addressStr) { - case "[email protected]": // trestles , gordan - case "[email protected]": // bigred2 - case "root <[email protected]>": // bigred2 - case "root <[email protected]>": // alamo - return ResourceJobManagerType.PBS; - case "SDSC Admin <[email protected]>": // comet - case "[email protected]": // stampede - case "slurm user <[email protected]>": - return ResourceJobManagerType.SLURM; -// case "lsf": -// return ResourceJobManagerType.LSF; - default: - if (addressStr.contains("ls4.tacc.utexas.edu>")) { // lonestar - return ResourceJobManagerType.UGE; - } else { - throw new AiravataException("[EJM]: Couldn't identify Resource job manager type from address " + addressStr); - } - } - - } - - @Override - public void run() { - try { - session = Session.getDefaultInstance(properties); - store = session.getStore(storeProtocol); - store.connect(host, emailAddress, password); - emailFolder = store.getFolder(folderName); - // first time we search for all unread messages. - SearchTerm unseenBefore = new FlagTerm(new Flags(Flags.Flag.SEEN), false); - while (!(stopMonitoring || ServerSettings.isStopAllThreads())) { - Thread.sleep(ServerSettings.getEmailMonitorPeriod());// sleep a bit - get a rest till job finishes - if (jobMonitorMap.isEmpty()) { - log.info("[EJM]: Job Monitor Map is empty, no need to retrieve emails"); - continue; - } else { - log.info("[EJM]: " + jobMonitorMap.size() + " job/s in job monitor map"); - } - if (!store.isConnected()) { - store.connect(); - emailFolder = store.getFolder(folderName); - } - log.info("[EJM]: Retrieving unseen emails"); - emailFolder.open(Folder.READ_WRITE); - Message[] searchMessages = emailFolder.search(unseenBefore); - if (searchMessages == null || searchMessages.length == 0) { - log.info("[EJM]: No new email messages"); - } else { - log.info("[EJM]: "+searchMessages.length + " new email/s received"); - } - processMessages(searchMessages); - emailFolder.close(false); - } - } catch (MessagingException e) { - log.error("[EJM]: Couldn't connect to the store ", e); - } catch (InterruptedException e) { - log.error("[EJM]: Interrupt exception while sleep ", e); - } catch (AiravataException e) { - log.error("[EJM]: UnHandled arguments ", e); - } finally { - try { - emailFolder.close(false); - store.close(); - } catch (MessagingException e) { - log.error("[EJM]: Store close operation failed, couldn't close store", e); - } - } - } - - private void processMessages(Message[] searchMessages) throws MessagingException { - List<Message> processedMessages = new ArrayList<>(); - List<Message> unreadMessages = new ArrayList<>(); - for (Message message : searchMessages) { - try { - JobStatusResult jobStatusResult = parse(message); - JobExecutionContext jEC = jobMonitorMap.get(jobStatusResult.getJobId()); - if (jEC == null) { - jEC = jobMonitorMap.get(jobStatusResult.getJobName()); - } - if (jEC != null) { - process(jobStatusResult, jEC); - processedMessages.add(message); - } else { - // we can get JobExecutionContext null in multiple Gfac instances environment, - // where this job is not submitted by this Gfac instance hence we ignore this message. - unreadMessages.add(message); -// log.info("JobExecutionContext is not found for job Id " + jobStatusResult.getJobId()); - } - } catch (AiravataException e) { - log.error("[EJM]: Error parsing email message =====================================>", e); - try { - writeEnvelopeOnError(message); - } catch (MessagingException e1) { - log.error("[EJM]: Error printing envelop of the email"); - } - unreadMessages.add(message); - } catch (MessagingException e) { - log.error("[EJM]: Error while retrieving sender address from message : " + message.toString()); - unreadMessages.add(message); - } - } - if (!processedMessages.isEmpty()) { - Message[] seenMessages = new Message[processedMessages.size()]; - processedMessages.toArray(seenMessages); - try { - emailFolder.setFlags(seenMessages, new Flags(Flags.Flag.SEEN), true); - } catch (MessagingException e) { - if (!store.isConnected()) { - store.connect(); - emailFolder.setFlags(seenMessages, new Flags(Flags.Flag.SEEN), true); - } - } - - } - if (!unreadMessages.isEmpty()) { - Message[] unseenMessages = new Message[unreadMessages.size()]; - unreadMessages.toArray(unseenMessages); - try { - emailFolder.setFlags(unseenMessages, new Flags(Flags.Flag.SEEN), false); - } catch (MessagingException e) { - if (!store.isConnected()) { - store.connect(); - emailFolder.setFlags(unseenMessages, new Flags(Flags.Flag.SEEN), false); - - } - } - } - } - - private void process(JobStatusResult jobStatusResult, JobExecutionContext jEC){ - JobState resultState = jobStatusResult.getState(); - jEC.getJobDetails().setJobStatus(new JobStatus(resultState)); - boolean runOutHandlers = false; - String jobDetails = "JobName : " + jobStatusResult.getJobName() + ", JobId : " + jobStatusResult.getJobId(); - // TODO - Handle all other valid JobStates - if (resultState == JobState.COMPLETE) { - jobMonitorMap.remove(jobStatusResult.getJobId()); - runOutHandlers = true; - log.info("[EJM]: Job Complete email received , removed job from job monitoring. " + jobDetails); - }else if (resultState == JobState.QUEUED) { - // nothing special thing to do, update the status change to rabbit mq at the end of this method. - log.info("[EJM]: Job Queued email received, " + jobDetails); - }else if (resultState == JobState.ACTIVE) { - // nothing special thing to do, update the status change to rabbit mq at the end of this method. - log.info("[EJM]: Job Active email received, " + jobDetails); - }else if (resultState == JobState.FAILED) { - jobMonitorMap.remove(jobStatusResult.getJobId()); - runOutHandlers = true; - log.info("[EJM]: Job failed email received , removed job from job monitoring. " + jobDetails); - }else if (resultState == JobState.CANCELED) { - jobMonitorMap.remove(jobStatusResult.getJobId()); - runOutHandlers = false; // Do we need to run out handlers in canceled case? - log.info("[EJM]: Job canceled mail received, removed job from job monitoring. " + jobDetails); - - } - log.info("[EJM]: Publishing status changes to amqp. " + jobDetails); - publishJobStatusChange(jEC); - - if (runOutHandlers) { - log.info("[EJM]: Calling Out Handler chain of " + jobDetails); - GFacThreadPoolExecutor.getCachedThreadPool().execute(new OutHandlerWorker(jEC)); - } - } - - private void publishJobStatusChange(JobExecutionContext jobExecutionContext) { - JobStatusChangeRequestEvent jobStatus = new JobStatusChangeRequestEvent(); - JobIdentifier jobIdentity = new JobIdentifier(jobExecutionContext.getJobDetails().getJobID(), - jobExecutionContext.getTaskData().getTaskID(), - jobExecutionContext.getWorkflowNodeDetails().getNodeInstanceId(), - jobExecutionContext.getExperimentID(), - jobExecutionContext.getGatewayID()); - jobStatus.setJobIdentity(jobIdentity); - jobStatus.setState(jobExecutionContext.getJobDetails().getJobStatus().getJobState()); - // we have this JobStatus class to handle amqp monitoring - log.debugId(jobStatus.getJobIdentity().getJobId(), "[EJM]: Published job status(" + - jobExecutionContext.getJobDetails().getJobStatus().getJobState().toString() + ") change request, " + - "experiment {} , task {}", jobStatus.getJobIdentity().getExperimentId(), - jobStatus.getJobIdentity().getTaskId()); - - jobExecutionContext.getMonitorPublisher().publish(jobStatus); - } - - private void writeEnvelopeOnError(Message m) throws MessagingException { - Address[] a; - // FROM - if ((a = m.getFrom()) != null) { - for (int j = 0; j < a.length; j++) - log.error("FROM: " + a[j].toString()); - } - // TO - if ((a = m.getRecipients(Message.RecipientType.TO)) != null) { - for (int j = 0; j < a.length; j++) - log.error("TO: " + a[j].toString()); - } - // SUBJECT - if (m.getSubject() != null) - log.error("SUBJECT: " + m.getSubject()); - } - - public void stopMonitoring() { - stopMonitoring = true; - } - - public void setDate(Date date) { - this.monitorStartDate = date; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailMonitorFactory.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailMonitorFactory.java b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailMonitorFactory.java deleted file mode 100644 index 3a75331..0000000 --- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/EmailMonitorFactory.java +++ /dev/null @@ -1,49 +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.monitor.email; - -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.model.appcatalog.computeresource.ResourceJobManagerType; - -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; - -public class EmailMonitorFactory { - - private static EmailBasedMonitor emailBasedMonitor; - private static Date startMonitorDate = Calendar.getInstance().getTime(); - - public static EmailBasedMonitor getEmailBasedMonitor(ResourceJobManagerType resourceJobManagerType) throws AiravataException { - if (emailBasedMonitor == null) { - synchronized (EmailMonitorFactory.class){ - if (emailBasedMonitor == null) { - emailBasedMonitor = new EmailBasedMonitor(resourceJobManagerType); - emailBasedMonitor.setDate(startMonitorDate); - new Thread(emailBasedMonitor).start(); - } - } - } - return emailBasedMonitor; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/JobStatusResult.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/JobStatusResult.java b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/JobStatusResult.java deleted file mode 100644 index 321b9cc..0000000 --- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/JobStatusResult.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.monitor.email; - -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-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/EmailParser.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/EmailParser.java b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/EmailParser.java deleted file mode 100644 index d82ce50..0000000 --- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/EmailParser.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.monitor.email.parser; - -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.gfac.monitor.email.JobStatusResult; - -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-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/LSFEmailParser.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/LSFEmailParser.java b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/LSFEmailParser.java deleted file mode 100644 index 042f671..0000000 --- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/LSFEmailParser.java +++ /dev/null @@ -1,74 +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.monitor.email.parser; - -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.gfac.monitor.email.JobStatusResult; -import org.apache.airavata.model.workspace.experiment.JobState; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.mail.Message; -import javax.mail.MessagingException; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class LSFEmailParser implements EmailParser { - private static final Logger log = LoggerFactory.getLogger(LSFEmailParser.class); - //[email protected] - private static final String SIGNAL = "signal"; - private static final String LONESTAR_REGEX = "Job (?<" + JOBID + ">\\d+) \\(.*\\) (?<" + STATUS - + ">.*)\\s[a-zA-Z =]+(?<" + EXIT_STATUS + ">\\d+)\\sSignal[ ]*=[ ]*(?<" + SIGNAL + ">[a-zA-z]*)"; - - @Override - public JobStatusResult parseEmail(Message message) throws MessagingException, AiravataException { - JobStatusResult jobStatusResult = new JobStatusResult(); - try { - String content = ((String) message.getContent()); - Pattern pattern = Pattern.compile(LONESTAR_REGEX); - Matcher matcher = pattern.matcher(content); - if (matcher.find()) { - jobStatusResult.setJobId(matcher.group(JOBID)); - String status = matcher.group(STATUS); - jobStatusResult.setState(getJobState(status, content)); - return jobStatusResult; - } else { - log.error("[EJM]: No matched found for content => \n" + content); - } - } catch (IOException e) { - throw new AiravataException("i[EJM]: Error while reading content of the email message"); - } - return jobStatusResult; - } - - private JobState getJobState(String status, String content) { - switch (status) { - case "Aborted": - return JobState.FAILED; - case "Success": - return JobState.COMPLETE; - default: - return JobState.UNKNOWN; - } - - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/PBSEmailParser.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/PBSEmailParser.java b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/PBSEmailParser.java deleted file mode 100644 index 841ecc4..0000000 --- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/PBSEmailParser.java +++ /dev/null @@ -1,104 +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.monitor.email.parser; - -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.gfac.monitor.email.JobStatusResult; -import org.apache.airavata.model.workspace.experiment.JobState; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.mail.Message; -import javax.mail.MessagingException; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class PBSEmailParser implements EmailParser { - - private static final Logger log = LoggerFactory.getLogger(PBSEmailParser.class); - - - private static final String REGEX = "[a-zA-Z ]*:[ ]*(?<" + JOBID + ">[a-zA-Z0-9-\\.]*)\\s+[a-zA-Z ]*:[ ]*(?<"+ - JOBNAME + ">[a-zA-Z0-9-\\.]*)\\s+.*\\s+(?<" + STATUS + ">[a-zA-Z\\ ]*)"; - private static final String REGEX_EXIT_STATUS = "Exit_status=(?<" + EXIT_STATUS + ">[\\d]+)"; - public static final String BEGUN_EXECUTION = "Begun execution"; - public static final String EXECUTION_TERMINATED = "Execution terminated"; - public static final String ABORTED_BY_PBS_SERVER = "Aborted by PBS Server"; - - @Override - public JobStatusResult parseEmail(Message message) throws MessagingException, AiravataException { - JobStatusResult jobStatusResult = new JobStatusResult(); -// log.info("Parsing -> " + message.getSubject()); - try { - String content = ((String) message.getContent()); - Pattern pattern = Pattern.compile(REGEX); - Matcher matcher = pattern.matcher(content); - if (matcher.find()) { - jobStatusResult.setJobId(matcher.group(JOBID)); - jobStatusResult.setJobName(matcher.group(JOBNAME)); - String statusLine = matcher.group(STATUS); - jobStatusResult.setState(getJobState(statusLine, content)); - return jobStatusResult; - } else { - log.error("[EJM]: No matched found for content => \n" + content); - } - - } catch (IOException e) { - throw new AiravataException("[EJM]: Error while reading content of the email message"); - } - return jobStatusResult; - } - - private JobState getJobState(String statusLine, String content) { - switch (statusLine) { - case BEGUN_EXECUTION: - return JobState.ACTIVE; - case EXECUTION_TERMINATED: - int exitStatus = getExitStatus(content); - if (exitStatus == 0) { - // TODO - Remove rabbitmq client script line from the script. - return JobState.COMPLETE; - } else if (exitStatus == 271) { - return JobState.CANCELED; - } else { - return JobState.FAILED; - } - case ABORTED_BY_PBS_SERVER: - return JobState.FAILED; - default: - return JobState.UNKNOWN; - } - } - - private int getExitStatus(String content) { - Pattern pattern = Pattern.compile(REGEX_EXIT_STATUS); - Matcher matcher = pattern.matcher(content); - if (matcher.find()) { - String group = matcher.group(EXIT_STATUS); - if (group != null && !group.trim().isEmpty()) { - return Integer.valueOf(group.trim()); - } - } - return -1; - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/SLURMEmailParser.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/SLURMEmailParser.java b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/SLURMEmailParser.java deleted file mode 100644 index 75ffe98..0000000 --- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/SLURMEmailParser.java +++ /dev/null @@ -1,82 +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.monitor.email.parser; - -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.gfac.monitor.email.JobStatusResult; -import org.apache.airavata.model.workspace.experiment.JobState; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.mail.Message; -import javax.mail.MessagingException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class SLURMEmailParser implements EmailParser { - - private static final Logger log = LoggerFactory.getLogger(SLURMEmailParser.class); - - private static final String REGEX = "[A-Z]*\\s[a-zA-Z]*_[a-z]*=(?<" + JOBID + ">\\d*)[ ]*[a-zA-Z]*=(?<"+ - JOBNAME + ">[a-zA-Z0-9-]*)[ ]*(?<" + STATUS + ">[]a-zA-Z]*),.*"; - - public static final String BEGAN = "Began"; - public static final String ENDED = "Ended"; - public static final String FAILED = "Failed"; - private static final Pattern cancelledStatePattern = Pattern.compile("CANCELLED"); - private static final Pattern pattern = Pattern.compile(REGEX); - - @Override - public JobStatusResult parseEmail(Message message) throws MessagingException, AiravataException{ - JobStatusResult jobStatusResult = new JobStatusResult(); - String subject = message.getSubject(); - Matcher matcher = pattern.matcher(subject); - if (matcher.find()) { - jobStatusResult.setJobId(matcher.group(JOBID)); - jobStatusResult.setJobName(matcher.group(JOBNAME)); - jobStatusResult.setState(getJobState(matcher.group(STATUS), subject)); - return jobStatusResult; - } else { - log.error("[EJM]: No matched found for subject -> " + subject); - } - return jobStatusResult; - } - - private JobState getJobState(String state, String subject) { - switch (state.trim()) { - case BEGAN: - return JobState.ACTIVE; - case ENDED: - Matcher matcher = cancelledStatePattern.matcher(subject); - if (matcher.find()) { - return JobState.CANCELED; - } - return JobState.COMPLETE; - case FAILED: - return JobState.FAILED; - default: - log.error("[EJM]: Job State " + state + " isn't handle by SLURM parser"); - return JobState.UNKNOWN; - - } - } - -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/UGEEmailParser.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/UGEEmailParser.java b/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/UGEEmailParser.java deleted file mode 100644 index 02209f4..0000000 --- a/modules/gfac/gfac-monitor/gfac-email-monitor/src/main/java/org/apache/airavata/gfac/monitor/email/parser/UGEEmailParser.java +++ /dev/null @@ -1,102 +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.monitor.email.parser; - -import org.apache.airavata.common.exception.AiravataException; -import org.apache.airavata.gfac.monitor.email.JobStatusResult; -import org.apache.airavata.model.workspace.experiment.JobState; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import javax.mail.Message; -import javax.mail.MessagingException; -import java.io.IOException; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -public class UGEEmailParser implements EmailParser{ - - private static final Logger log = LoggerFactory.getLogger(UGEEmailParser.class); - private static final String REGEX = "[\\w]*[ ]*(?<"+ JOBID + ">[\\d]*)[ ]*\\((?<" + JOBNAME - + ">[a-zA-Z0-9]*)\\)[ ]*(?<" + STATUS + ">[a-zA-Z]*)"; - public static final String STARTED = "Started"; - public static final String COMPLETE = "Complete"; - public static final String FAILED = "Failed"; - private static final String REGEX_EXIT_STATUS = "Exit Status[ ]*=[ ]*(?<" + EXIT_STATUS + ">[\\d]+)"; - public static final String ABORTED = "Aborted"; - - - @Override - public JobStatusResult parseEmail(Message message) throws MessagingException, AiravataException { - JobStatusResult jobStatusResult = new JobStatusResult(); - - String subject = message.getSubject(); - Pattern pattern = Pattern.compile(REGEX); - Matcher matcher = pattern.matcher(subject); - try { - if (matcher.find()) { - jobStatusResult.setJobId(matcher.group(JOBID)); - jobStatusResult.setJobName(matcher.group(JOBNAME)); - String content = (String) message.getContent(); - jobStatusResult.setState(getJobState(matcher.group(STATUS), content)); - } else { - log.error("[EJM]: No matched found for subject => \n" + subject); - } - } catch (IOException e) { - throw new AiravataException("[EJM]: Error while reading content of the email message"); - } - return jobStatusResult; - } - - private JobState getJobState(String status, String content) { - switch (status) { - case STARTED: - return JobState.ACTIVE; - case COMPLETE: - int exitStatus = getExitStatus(content); - if (exitStatus == 0) { - return JobState.COMPLETE; - } else { - log.info("[EJM]: Job returns with Exit Status = " + exitStatus + " , Marked as Failed"); - return JobState.FAILED; - } - case FAILED: - return JobState.FAILED; - case ABORTED: - return JobState.FAILED; - default: - return JobState.UNKNOWN; - - } - } - - private int getExitStatus(String content) { - Pattern statusPattern = Pattern.compile(REGEX_EXIT_STATUS); - Matcher statusMatcher = statusPattern.matcher(content); - if (statusMatcher.find()) { - String group = statusMatcher.group(EXIT_STATUS); - if (group != null && !group.trim().isEmpty()) { - return Integer.valueOf(group.trim()); - } - } - return -1; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml b/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml deleted file mode 100644 index 3a98baa..0000000 --- a/modules/gfac/gfac-monitor/gfac-hpc-monitor/pom.xml +++ /dev/null @@ -1,158 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> - <parent> - <artifactId>airavata-gfac-monitor</artifactId> - <groupId>org.apache.airavata</groupId> - <version>0.16-SNAPSHOT</version> - </parent> - <modelVersion>4.0.0</modelVersion> - - <artifactId>airavata-gfac-hpc-monitor</artifactId> - <name>Airavata GFac Grid Job Monitor</name> - <description>The Grid related monitoring implementation</description> - <url>http://airavata.apache.org/</url> - - <dependencies> - <!-- Logging --> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-api</artifactId> - </dependency> - - <!-- GFAC schemas --> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-gfac-core</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-gfac-gsissh</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-gfac-ssh</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-registry-cpi</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-jpa-registry</artifactId> - <version>${project.version}</version> - </dependency> - <!-- Workflow Tracking --> - <!--<dependency>--> - <!--<groupId>org.apache.airavata</groupId>--> - <!--<artifactId>airavata-workflow-tracking</artifactId>--> - <!--<version>${project.version}</version>--> - <!--</dependency>--> - <!-- Credential Store --> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-credential-store</artifactId> - <version>${project.version}</version> - </dependency> - <!-- Test --> - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - <version>6.1.1</version> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>jcl-over-slf4j</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.slf4j</groupId> - <artifactId>slf4j-log4j12</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-server-configuration</artifactId> - <scope>test</scope> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-client-configuration</artifactId> - <scope>test</scope> - </dependency> - - <!-- Guava --> - <dependency> - <groupId>com.google.guava</groupId> - <artifactId>guava</artifactId> - <version>12.0</version> - </dependency> - <!-- gsi-ssh api dependencies --> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>gsissh</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>org.apache.airavata</groupId> - <artifactId>airavata-data-models</artifactId> - <version>${project.version}</version> - </dependency> - <dependency> - <groupId>com.jcraft</groupId> - <artifactId>jsch</artifactId> - <version>0.1.50</version> - </dependency> - <dependency> - <groupId>org.apache.xmlbeans</groupId> - <artifactId>xmlbeans</artifactId> - <version>${xmlbeans.version}</version> - </dependency> - <!-- this is the dependency for amqp implementation --> - <dependency> - <groupId>com.fasterxml.jackson.core</groupId> - <artifactId>jackson-databind</artifactId> - <version>2.0.0</version> - </dependency> - </dependencies> - - <build> - <plugins> - <plugin> - <groupId>org.apache.maven.plugins</groupId> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <skip>false</skip> - <forkMode>always</forkMode> - <failIfNoTests>false</failIfNoTests> - </configuration> - </plugin> - <plugin> - <groupId>org.jsonschema2pojo</groupId> - <artifactId>jsonschema2pojo-maven-plugin</artifactId> - <version>0.4.0</version> - <configuration> - <sourceDirectory>${basedir}/src/main/resources/schema</sourceDirectory> - <targetPackage>org.apache.airavata</targetPackage> - </configuration> - <executions> - <execution> - <goals> - <goal>generate</goal> - </goals> - </execution> - </executions> - </plugin> - </plugins> - </build> - -</project> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java deleted file mode 100644 index ae463a7..0000000 --- a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/HPCMonitorID.java +++ /dev/null @@ -1,107 +0,0 @@ -package org.apache.airavata.gfac.monitor;/* - * - * 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. - * -*/ - -import org.apache.airavata.gfac.GFacException; -import org.apache.airavata.gfac.SecurityContext; -import org.apache.airavata.gfac.core.context.JobExecutionContext; -import org.apache.airavata.gfac.core.monitor.MonitorID; -import org.apache.airavata.gfac.gsissh.security.GSISecurityContext; -import org.apache.airavata.gfac.ssh.security.SSHSecurityContext; -import org.apache.airavata.gsi.ssh.api.ServerInfo; -import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo; -import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo; -import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.sql.Timestamp; -import java.util.Date; - -public class HPCMonitorID extends MonitorID { - private final static Logger logger = LoggerFactory.getLogger(HPCMonitorID.class); - - - private AuthenticationInfo authenticationInfo = null; - - public HPCMonitorID(ComputeResourceDescription computeResourceDescription, String jobID, String taskID, String workflowNodeID, - String experimentID, String userName,String jobName) { - super(computeResourceDescription, jobID, taskID, workflowNodeID, experimentID, userName,jobName); - setComputeResourceDescription(computeResourceDescription); - setJobStartedTime(new Timestamp((new Date()).getTime())); - setUserName(userName); - setJobID(jobID); - setTaskID(taskID); - setExperimentID(experimentID); - setWorkflowNodeID(workflowNodeID); - } - - public HPCMonitorID(AuthenticationInfo authenticationInfo, JobExecutionContext jobExecutionContext) { - super(jobExecutionContext); - this.authenticationInfo = authenticationInfo; - if (this.authenticationInfo != null) { - try { - String hostAddress = jobExecutionContext.getHostName(); - SecurityContext securityContext = jobExecutionContext.getSecurityContext(hostAddress); - ServerInfo serverInfo = null; - if (securityContext != null) { - if (securityContext instanceof GSISecurityContext){ - serverInfo = (((GSISecurityContext) securityContext).getPbsCluster()).getServerInfo(); - if (serverInfo.getUserName() != null) { - setUserName(serverInfo.getUserName()); - } - } - if (securityContext instanceof SSHSecurityContext){ - serverInfo = (((SSHSecurityContext) securityContext).getPbsCluster()).getServerInfo(); - if (serverInfo.getUserName() != null) { - setUserName(serverInfo.getUserName()); - } - } - } - } catch (GFacException e) { - logger.error("Error while getting security context", e); - } - } - } - - public HPCMonitorID(ComputeResourceDescription computeResourceDescription, String jobID, String taskID, String workflowNodeID, String experimentID, String userName, AuthenticationInfo authenticationInfo) { - setComputeResourceDescription(computeResourceDescription); - setJobStartedTime(new Timestamp((new Date()).getTime())); - this.authenticationInfo = authenticationInfo; - // if we give myproxyauthenticationInfo, so we try to use myproxy user as the user - if (this.authenticationInfo != null) { - if (this.authenticationInfo instanceof MyProxyAuthenticationInfo) { - setUserName(((MyProxyAuthenticationInfo) this.authenticationInfo).getUserName()); - } - } - setJobID(jobID); - setTaskID(taskID); - setExperimentID(experimentID); - setWorkflowNodeID(workflowNodeID); - } - - public AuthenticationInfo getAuthenticationInfo() { - return authenticationInfo; - } - - public void setAuthenticationInfo(AuthenticationInfo authenticationInfo) { - this.authenticationInfo = authenticationInfo; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java deleted file mode 100644 index f29e3e6..0000000 --- a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java +++ /dev/null @@ -1,88 +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.monitor; - -import org.apache.airavata.gfac.core.context.JobExecutionContext; -import org.apache.airavata.gfac.core.monitor.MonitorID; -import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException; -import org.apache.airavata.model.appcatalog.computeresource.ComputeResourceDescription; -import org.apache.airavata.model.appcatalog.computeresource.DataMovementProtocol; -import org.apache.airavata.model.appcatalog.computeresource.JobSubmissionProtocol; - -import java.util.ArrayList; -import java.util.List; - -public class HostMonitorData { -// private HostDescription host; - private ComputeResourceDescription computeResourceDescription; - private JobSubmissionProtocol jobSubmissionProtocol; - private DataMovementProtocol dataMovementProtocol; - - private List<MonitorID> monitorIDs; - - public HostMonitorData(JobExecutionContext jobExecutionContext) { - this.computeResourceDescription = jobExecutionContext.getApplicationContext().getComputeResourceDescription(); - this.jobSubmissionProtocol = jobExecutionContext.getPreferredJobSubmissionProtocol(); - this.dataMovementProtocol = jobExecutionContext.getPreferredDataMovementProtocol(); - this.monitorIDs = new ArrayList<MonitorID>(); - } - - public HostMonitorData(JobExecutionContext jobExecutionContext, List<MonitorID> monitorIDs) { - this.computeResourceDescription = jobExecutionContext.getApplicationContext().getComputeResourceDescription(); - this.jobSubmissionProtocol = jobExecutionContext.getPreferredJobSubmissionProtocol(); - this.dataMovementProtocol = jobExecutionContext.getPreferredDataMovementProtocol(); - this.monitorIDs = monitorIDs; - } - - public ComputeResourceDescription getComputeResourceDescription() { - return computeResourceDescription; - } - - public void setComputeResourceDescription(ComputeResourceDescription computeResourceDescription) { - this.computeResourceDescription = computeResourceDescription; - } - - public List<MonitorID> getMonitorIDs() { - return monitorIDs; - } - - public void setMonitorIDs(List<MonitorID> monitorIDs) { - this.monitorIDs = monitorIDs; - } - - /** - * this method get called by CommonUtils and it will check the right place before adding - * so there will not be a mismatch between this.host and monitorID.host - * @param monitorID - * @throws org.apache.airavata.gfac.monitor.exception.AiravataMonitorException - */ - public void addMonitorIDForHost(MonitorID monitorID)throws AiravataMonitorException { - monitorIDs.add(monitorID); - } - - public JobSubmissionProtocol getJobSubmissionProtocol() { - return jobSubmissionProtocol; - } - - public DataMovementProtocol getDataMovementProtocol() { - return dataMovementProtocol; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/UserMonitorData.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/UserMonitorData.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/UserMonitorData.java deleted file mode 100644 index 022d17c..0000000 --- a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/UserMonitorData.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.monitor; - -import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.List; - -/** - * This is the datastructure to keep the user centric job data, rather keeping - * the individual jobs we keep the jobs based on the each user - */ -public class UserMonitorData { - private final static Logger logger = LoggerFactory.getLogger(UserMonitorData.class); - - private String userName; - - private List<HostMonitorData> hostMonitorData; - - - public UserMonitorData(String userName) { - this.userName = userName; - hostMonitorData = new ArrayList<HostMonitorData>(); - } - - public UserMonitorData(String userName, List<HostMonitorData> hostMonitorDataList) { - this.hostMonitorData = hostMonitorDataList; - this.userName = userName; - } - - public List<HostMonitorData> getHostMonitorData() { - return hostMonitorData; - } - - public void setHostMonitorData(List<HostMonitorData> hostMonitorData) { - this.hostMonitorData = hostMonitorData; - } - - public String getUserName() { - return userName; - } - - public void setUserName(String userName) { - this.userName = userName; - } - - /* - This method will add element to the MonitorID list, user should not - duplicate it, we do not check it because its going to be used by airavata - so we have to use carefully and this method will add a host if its a new host - */ - public void addHostMonitorData(HostMonitorData hostMonitorData) throws AiravataMonitorException { - this.hostMonitorData.add(hostMonitorData); - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/command/ExperimentCancelRequest.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/command/ExperimentCancelRequest.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/command/ExperimentCancelRequest.java deleted file mode 100644 index f19decf..0000000 --- a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/command/ExperimentCancelRequest.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.monitor.command; - -public class ExperimentCancelRequest { - private String experimentId; - - public ExperimentCancelRequest(String experimentId) { - this.experimentId = 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-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/command/TaskCancelRequest.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/command/TaskCancelRequest.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/command/TaskCancelRequest.java deleted file mode 100644 index b45e01c..0000000 --- a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/command/TaskCancelRequest.java +++ /dev/null @@ -1,52 +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.monitor.command; - -public class TaskCancelRequest { - private String experimentId; - private String nodeId; - private String taskId; - - public TaskCancelRequest(String experimentId, String nodeId, String taskId) { - this.experimentId = experimentId; - this.setNodeId(nodeId); - this.taskId = taskId; - } - public String getExperimentId() { - return experimentId; - } - public void setExperimentId(String experimentId) { - this.experimentId = experimentId; - } - public String getTaskId() { - return taskId; - } - public void setTaskId(String taskId) { - this.taskId = taskId; - } - public String getNodeId() { - return nodeId; - } - public void setNodeId(String nodeId) { - this.nodeId = nodeId; - } -} http://git-wip-us.apache.org/repos/asf/airavata/blob/7b809747/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java ---------------------------------------------------------------------- diff --git a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java b/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java deleted file mode 100644 index b4ac3a9..0000000 --- a/modules/gfac/gfac-monitor/gfac-hpc-monitor/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.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.monitor.core; - -import org.apache.airavata.common.utils.MonitorPublisher; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * This is the abstract Monitor which needs to be used by - * any Monitoring implementation which expect nto consume - * to store the status to registry. Because they have to - * use the MonitorPublisher to publish the monitoring statuses - * to the Event Bus. All the Monitor statuses publish to the eventbus - * will be saved to the Registry. - */ -public abstract class AiravataAbstractMonitor implements Monitor { - private final static Logger logger = LoggerFactory.getLogger(AiravataAbstractMonitor.class); - -}
