You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2014/04/23 21:42:28 UTC
[1/8] merging monitoring with gfac-core, later this will be separated
Repository: airavata
Updated Branches:
refs/heads/master 0364b6540 -> b02308493
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java b/tools/job-monitor/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
deleted file mode 100644
index f2b9ccd..0000000
--- a/tools/job-monitor/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
+++ /dev/null
@@ -1,179 +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.job;
-
-import com.google.common.eventbus.EventBus;
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gsi.ssh.api.Cluster;
-import org.apache.airavata.gsi.ssh.api.SSHApiException;
-import org.apache.airavata.gsi.ssh.api.ServerInfo;
-import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gsi.ssh.impl.PBSCluster;
-import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.UserMonitorData;
-import org.apache.airavata.job.monitor.event.MonitorPublisher;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.impl.push.amqp.AMQPMonitor;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.Test;
-
-import javax.validation.constraints.AssertTrue;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-public class AMQPMonitorTest {
-
- private String myProxyUserName;
- private String myProxyPassword;
- private String certificateLocation;
- private String pbsFilePath;
- private String workingDirectory;
- private HostDescription hostDescription;
- private MonitorPublisher monitorPublisher;
- private BlockingQueue<MonitorID> finishQueue;
- private BlockingQueue<MonitorID> pushQueue;
- private Thread pushThread;
- private String proxyFilePath;
- @Before
- public void setUp() throws Exception {
- System.setProperty("myproxy.username", "ogce");
- System.setProperty("myproxy.password", "OpenGwy14");
- System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
- System.setProperty("gsi.working.directory", "/home1/01437/ogce");
- System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
- System.setProperty("proxy.file.path", "/Users/lahirugunathilake/Downloads/x509up_u503876");
- myProxyUserName = System.getProperty("myproxy.username");
- myProxyPassword = System.getProperty("myproxy.password");
- workingDirectory = System.getProperty("gsi.working.directory");
- certificateLocation = System.getProperty("trusted.cert.location");
- proxyFilePath = System.getProperty("proxy.file.path");
- System.setProperty("connection.name", "xsede");
- if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) {
- System.out.println(">>>>>> Please run tests with my proxy user name and password. " +
- "E.g :- mvn clean install -Dmyproxy.user=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<");
- throw new Exception("Need my proxy user name password to run tests.");
- }
-
- monitorPublisher = new MonitorPublisher(new EventBus());
- pushQueue = new LinkedBlockingQueue<MonitorID>();
- finishQueue = new LinkedBlockingQueue<MonitorID>();
-
-
- AMQPMonitor amqpMonitor = new
- AMQPMonitor(monitorPublisher,
- pushQueue, finishQueue,proxyFilePath,"xsede",
- Arrays.asList("info1.dyn.teragrid.org,info2.dyn.teragrid.org".split(",")));
- try {
- pushThread = (new Thread(amqpMonitor));
- pushThread.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- hostDescription = new HostDescription(GsisshHostType.type);
- hostDescription.getType().setHostAddress("login1.stampede.tacc.utexas.edu");
- hostDescription.getType().setHostName("stampede-host");
- ((GsisshHostType) hostDescription.getType()).setJobManager("slurm");
- ((GsisshHostType) hostDescription.getType()).setInstalledPath("/usr/bin/");
- ((GsisshHostType) hostDescription.getType()).setPort(2222);
- ((GsisshHostType) hostDescription.getType()).setMonitorMode("push");
- }
-
- @Test
- public void testAMQPMonitor() throws SSHApiException {
- /* now have to submit a job to some machine and add that job to the queue */
- //Create authentication
- GSIAuthenticationInfo authenticationInfo
- = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
- 7512, 17280000, certificateLocation);
-
- // Server info
- ServerInfo serverInfo = new ServerInfo("ogce", "login1.stampede.tacc.utexas.edu",2222);
-
-
- Cluster pbsCluster = new
- PBSCluster(serverInfo, authenticationInfo, org.apache.airavata.gsi.ssh.util.CommonUtils.getPBSJobManager("/usr/bin/"));
-
-
- // Execute command
- System.out.println("Target PBS file path: " + workingDirectory);
- // constructing the job object
- JobDescriptor jobDescriptor = new JobDescriptor();
- jobDescriptor.setWorkingDirectory(workingDirectory);
- jobDescriptor.setShellName("/bin/bash");
- jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
- jobDescriptor.setExecutablePath("/bin/echo");
- jobDescriptor.setAllEnvExport(true);
- jobDescriptor.setMailOptions("n");
- jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
- jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
- jobDescriptor.setNodes(1);
- jobDescriptor.setProcessesPerNode(1);
- jobDescriptor.setQueueName("normal");
- jobDescriptor.setMaxWallTime("60");
- jobDescriptor.setAcountString("TG-STA110014S");
- List<String> inputs = new ArrayList<String>();
- jobDescriptor.setOwner("ogce");
- inputs.add("Hello World");
- jobDescriptor.setInputValues(inputs);
- //finished construction of job object
- System.out.println(jobDescriptor.toXML());
- String jobID = pbsCluster.submitBatchJob(jobDescriptor);
- System.out.println(jobID);
- try {
- pushQueue.add(new MonitorID(hostDescription, jobID,null,null,null, "ogce"));
- } catch (Exception e) {
- e.printStackTrace();
- }
- try {
- pushThread.join();
- } catch (InterruptedException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- class InnerClassAMQP{
- @Subscribe
- private void getStatus(JobStatusChangeRequest status){
- Assert.assertNotNull(status);
- pushThread.interrupt();
- }
- }
- monitorPublisher.registerListener(new InnerClassAMQP());
-// try {
-// pushThread.join(5000);
-// Iterator<MonitorID> iterator = pushQueue.iterator();
-// MonitorID next = iterator.next();
-// org.junit.Assert.assertNotNull(next.getStatus());
-// } catch (Exception e) {
-// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
-// }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java b/tools/job-monitor/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
deleted file mode 100644
index 564df5f..0000000
--- a/tools/job-monitor/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
+++ /dev/null
@@ -1,168 +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.job;
-
-import com.google.common.eventbus.EventBus;
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gsi.ssh.api.Cluster;
-import org.apache.airavata.gsi.ssh.api.SSHApiException;
-import org.apache.airavata.gsi.ssh.api.ServerInfo;
-import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gsi.ssh.impl.PBSCluster;
-import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.util.CommonUtils;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.UserMonitorData;
-import org.apache.airavata.job.monitor.event.MonitorPublisher;
-import org.apache.airavata.job.monitor.impl.pull.qstat.QstatMonitor;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.junit.Assert;
-import org.testng.annotations.Test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-public class QstatMonitorTestWithMyProxyAuth {
- private String myProxyUserName;
- private String myProxyPassword;
- private String certificateLocation;
- private String pbsFilePath;
- private String workingDirectory;
- private HostDescription hostDescription;
- private MonitorPublisher monitorPublisher;
- private BlockingQueue<UserMonitorData> pullQueue;
- private Thread monitorThread;
-
- @org.testng.annotations.BeforeClass
- public void setUp() throws Exception {
- System.setProperty("myproxy.username", "ogce");
- System.setProperty("myproxy.password", "OpenGwy14");
- System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
- System.setProperty("gsi.working.directory", "/home/ogce");
- System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
- myProxyUserName = System.getProperty("myproxy.username");
- myProxyPassword = System.getProperty("myproxy.password");
- workingDirectory = System.getProperty("gsi.working.directory");
- certificateLocation = System.getProperty("trusted.cert.location");
- if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) {
- System.out.println(">>>>>> Please run tests with my proxy user name and password. " +
- "E.g :- mvn clean install -Dmyproxy.username=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<");
- throw new Exception("Need my proxy user name password to run tests.");
- }
-
- monitorPublisher = new MonitorPublisher(new EventBus());
- class InnerClassQstat {
-
- @Subscribe
- private void getStatus(JobStatusChangeRequest status) {
- Assert.assertNotNull(status);
- System.out.println(status.getState().toString());
- monitorThread.interrupt();
- }
- }
- monitorPublisher.registerListener(this);
- pullQueue = new LinkedBlockingQueue<UserMonitorData>();
- QstatMonitor qstatMonitor = new
- QstatMonitor(pullQueue, monitorPublisher);
- try {
- monitorThread = (new Thread(qstatMonitor));
- monitorThread.start();
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- hostDescription = new HostDescription(GsisshHostType.type);
- hostDescription.getType().setHostAddress("trestles.sdsc.edu");
- hostDescription.getType().setHostName("gsissh-gordon");
- ((GsisshHostType) hostDescription.getType()).setPort(22);
- ((GsisshHostType)hostDescription.getType()).setInstalledPath("/opt/torque/bin/");
- }
-
- @Test
- public void testQstatMonitor() throws SSHApiException {
- /* now have to submit a job to some machine and add that job to the queue */
- //Create authentication
- GSIAuthenticationInfo authenticationInfo
- = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
- 7512, 17280000, certificateLocation);
-
- // Server info
- ServerInfo serverInfo = new ServerInfo("ogce", hostDescription.getType().getHostAddress());
-
-
- Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/bin/"));
-
-
- // Execute command
- System.out.println("Target PBS file path: " + workingDirectory);
- // constructing the job object
- JobDescriptor jobDescriptor = new JobDescriptor();
- jobDescriptor.setWorkingDirectory(workingDirectory);
- jobDescriptor.setShellName("/bin/bash");
- jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
- jobDescriptor.setExecutablePath("/bin/echo");
- jobDescriptor.setAllEnvExport(true);
- jobDescriptor.setMailOptions("n");
- jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
- jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
- jobDescriptor.setNodes(1);
- jobDescriptor.setProcessesPerNode(1);
- jobDescriptor.setQueueName("normal");
- jobDescriptor.setMaxWallTime("60");
- jobDescriptor.setAcountString("sds128");
- List<String> inputs = new ArrayList<String>();
- jobDescriptor.setOwner("ogce");
- inputs.add("Hello World");
- jobDescriptor.setInputValues(inputs);
- //finished construction of job object
- System.out.println(jobDescriptor.toXML());
- for (int i = 0; i < 1; i++) {
- String jobID = pbsCluster.submitBatchJob(jobDescriptor);
- System.out.println("Job submitted successfully, Job ID: " + jobID);
- MonitorID monitorID = new MonitorID(hostDescription, jobID,null,null,null, "ogce");
- monitorID.setAuthenticationInfo(authenticationInfo);
- try {
- org.apache.airavata.job.monitor.util.CommonUtils.addMonitortoQueue(pullQueue, monitorID);
- } catch (Exception e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- try {
-
- monitorThread.join();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Subscribe
- public void testCaseShutDown(JobStatusChangeRequest status) {
- Assert.assertNotNull(status.getState());
- monitorThread.stop();
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/test/resources/gsissh.properties
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/test/resources/gsissh.properties b/tools/job-monitor/src/test/resources/gsissh.properties
deleted file mode 100644
index 3fdf76d..0000000
--- a/tools/job-monitor/src/test/resources/gsissh.properties
+++ /dev/null
@@ -1,26 +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.
-#
-
-###########################################################################
-# Specifies system level configurations as a key/value pairs.
-###########################################################################
-
-StrictHostKeyChecking=no
-ssh.session.timeout=360000
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/test/resources/monitor.properties
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/test/resources/monitor.properties b/tools/job-monitor/src/test/resources/monitor.properties
deleted file mode 100644
index a4d68cf..0000000
--- a/tools/job-monitor/src/test/resources/monitor.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-amqp.hosts=info1.dyn.teragrid.org,info2.dyn.teragrid.org
-proxy.file.path=/Users/lahirugunathilake/Downloads/x509up_u503876
-connection.name=xsede_private
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/pom.xml
----------------------------------------------------------------------
diff --git a/tools/pom.xml b/tools/pom.xml
index 86bacc9..0bdcea2 100644
--- a/tools/pom.xml
+++ b/tools/pom.xml
@@ -33,7 +33,6 @@
<module>phoebus-integration</module>
<module>registry-tool</module>
<module>gsissh</module>
- <module>job-monitor</module>
</modules>
</profile>
</profiles>
[2/8] merging monitoring with gfac-core, later this will be separated
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/PBSTemplate.xslt
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/PBSTemplate.xslt b/tools/job-monitor/src/main/resources/PBSTemplate.xslt
deleted file mode 100644
index e4398e0..0000000
--- a/tools/job-monitor/src/main/resources/PBSTemplate.xslt
+++ /dev/null
@@ -1,77 +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
-# <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:jobName">
-#PBS -N <xsl:value-of select="ns:jobName"/>
- </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/b0230849/tools/job-monitor/src/main/resources/gsissh.properties
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/gsissh.properties b/tools/job-monitor/src/main/resources/gsissh.properties
deleted file mode 100644
index 3fdf76d..0000000
--- a/tools/job-monitor/src/main/resources/gsissh.properties
+++ /dev/null
@@ -1,26 +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.
-#
-
-###########################################################################
-# Specifies system level configurations as a key/value pairs.
-###########################################################################
-
-StrictHostKeyChecking=no
-ssh.session.timeout=360000
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/AccessPolicy.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/AccessPolicy.json b/tools/job-monitor/src/main/resources/schema/AccessPolicy.json
deleted file mode 100644
index 8f6cfe1..0000000
--- a/tools/job-monitor/src/main/resources/schema/AccessPolicy.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AccessPolicy.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Policy.json"}],
- "properties": {
- "EndpointID": {
- "type": "string",
- "description": "The ID of the Endpoint this AccessPolicy is for"
- }
- },
- "required": ["EndpointID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Activity.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Activity.json b/tools/job-monitor/src/main/resources/schema/Activity.json
deleted file mode 100644
index 8bd2495..0000000
--- a/tools/job-monitor/src/main/resources/schema/Activity.json
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Activity.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "UserDomainID": {
- "type": "string",
- "description": "An ID"
- },
- "EndpointID": {
- "type": "string",
- "description": "The ID of the Endpoint managing Activity"
- },
- "ShareID": {
- "type": "string",
- "description": "The ID of the Share servicing this Activity"
- },
- "ResourceID": {
- "type": "string",
- "description": "The ID of the Resource executing this Activity"
- },
- "ActivityID": {
- "type": "array",
- "description": "The IDs of other Activities related to this one",
- "items": {
- "type": "string"
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/AdminDomain.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/AdminDomain.json b/tools/job-monitor/src/main/resources/schema/AdminDomain.json
deleted file mode 100644
index 8ed4606..0000000
--- a/tools/job-monitor/src/main/resources/schema/AdminDomain.json
+++ /dev/null
@@ -1,51 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AdminDomain.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json"}],
- "properties": {
- "Distributed": {
- "type": "boolean",
- "description": "true if the services managed by the AdminDomain are geographically distributed"
- },
- "Owner": {
- "type": "array",
- "description": "Identification of persons or legal entities that own the resources in this AdminDomain",
- "items": {
- "type": "string"
- }
- },
- "ServiceID": {
- "type": "array",
- "description": "IDs of Services in this AdminDomain",
- "items": {
- "type": "string"
- }
- },
- "ChildDomainID": {
- "type": "array",
- "description": "IDs of AdminDomains aggregated by this AdminDomain",
- "items": {
- "type": "string"
- }
- },
- "ParentDomainID": {
- "type": "string",
- "description": "The ID of the AdminDomain that this AdminDomain participates in"
- },
- "ComputingServiceID": {
- "type": "array",
- "description": "IDs of ComputingServices in this AdminDomain",
- "items": {
- "type": "string"
- }
- },
- "StorageServiceID": {
- "type": "array",
- "description": "IDs of StorageServices in this AdminDomain",
- "items": {
- "type": "string"
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ApplicationEnvironment.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ApplicationEnvironment.json b/tools/job-monitor/src/main/resources/schema/ApplicationEnvironment.json
deleted file mode 100644
index 89c78e0..0000000
--- a/tools/job-monitor/src/main/resources/schema/ApplicationEnvironment.json
+++ /dev/null
@@ -1,86 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationEnvironment.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "AppName": {
- "type": "string",
- "description": "The name of the application"
- },
- "AppVersion": {
- "type": "string",
- "description": "The version of the application"
- },
- "State": {
- "type": "string",
- "description": "The current installation state of the application - AppEnvState_t"
- },
- "RemovalDate": {
- "type": "string",
- "description": "The date/time after which the application may be removed - DateTime_t"
- },
- "License": {
- "type": "string",
- "description": "The license under which the application is usable - License_t"
- },
- "Description": {
- "type": "string",
- "description": "A human-readable description of the application"
- },
- "BestBenchmark": {
- "type": "array",
- "description": "The type(s) of the benchmarks which best describe the sensitivity of this application to the performance of the ExecutionEnvironment - Benchmark_t",
- "items": {
- "type": "string"
- }
- },
- "ParallelSupport": {
- "type": "string",
- "description": "The type of supported parallel execution - ParallelSupport_t"
- },
- "MaxSlots": {
- "type": "integer",
- "description": "The maximum number of concurrent slots that may be used to run the application"
- },
- "MaxJobs": {
- "type": "integer",
- "description": "The maximum number of concurrent jobs that can run the application"
- },
- "MaxUserSeats": {
- "type": "integer",
- "description": "The maximum number of concurrent users that can run the application"
- },
- "FreeSlots": {
- "type": "integer",
- "description": "The maximum number slots currently available to run the application"
- },
- "FreeJobs": {
- "type": "integer",
- "description": "The maximum number of additional jobs that can run the application"
- },
- "FreeUserSeats": {
- "type": "integer",
- "description": "The maximum number of additional users that can run the application"
- },
- "ExecutionEnvironmentID": {
- "type": "array",
- "description": "ID(s) of ExecutionEnvironments where this ApplicationEnvironment can be used",
- "items": {
- "type": "string"
- }
- },
- "ComputingManagerID": {
- "type": "string",
- "description": "ID of the ComputingManager this ApplicationEnvironment is associated with"
- },
- "ApplicationHandleID": {
- "type": "array",
- "description": "ID(s) of the ApplicationHandles that can be used to refer to this environment",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["AppName","ComputingManagerID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ApplicationHandle.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ApplicationHandle.json b/tools/job-monitor/src/main/resources/schema/ApplicationHandle.json
deleted file mode 100644
index e7972e9..0000000
--- a/tools/job-monitor/src/main/resources/schema/ApplicationHandle.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationHandle.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Type": {
- "type": "string",
- "description": "The type of method used to set up an ApplicationEnvironment - ApplicationHandle_t (open enumeration)"
- },
- "Value": {
- "type": "string",
- "description": "How to set up the ApplicationEnvironment in the context of the Type"
- },
- "ApplicationEnvironmentID": {
- "type": "string",
- "description": "The ID of the ApplicationEnvironment this ApplicationHandle refers to"
- }
- },
- "required": ["Type","Value","ApplicationEnvironmentID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Benchmark.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Benchmark.json b/tools/job-monitor/src/main/resources/schema/Benchmark.json
deleted file mode 100644
index 2b64261..0000000
--- a/tools/job-monitor/src/main/resources/schema/Benchmark.json
+++ /dev/null
@@ -1,21 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Benchmark.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Type": {
- "type": "string",
- "description": "The type of the benchmark - Benchmark_t (open enumeration)"
- },
- "Value": {
- "type": "number",
- "description": "The value of the benchmark"
- },
- "ComputingManagerID": {
- "type": "string",
- "description": "The ID of the ComputingManager this benchmark is for"
- }
- },
- "required": ["Type","Value"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ComputingActivity.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ComputingActivity.json b/tools/job-monitor/src/main/resources/schema/ComputingActivity.json
deleted file mode 100644
index 5fcae72..0000000
--- a/tools/job-monitor/src/main/resources/schema/ComputingActivity.json
+++ /dev/null
@@ -1,165 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingActivity.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Activity.json"}],
- "properties": {
- "Type": {
- "type": "string",
- "description": "closed enumeration ComputingActivityType_t",
- "enum": ["collectionelement","parallelelement","single","workflownode"]
- },
- "IDFromEndpoint": {
- "type": "string",
- "description": "The ID assigned by the ComputingEndpoint"
- },
- "LocalIDFromManager": {
- "type": "string",
- "description": "The local ID assigned by the ComputingManager"
- },
- "State": {
- "type": "array",
- "description": "open enumeration ComputingActivityState_t",
- "items": {
- "type": "string"
- },
- "minItems": 1
- },
- "RestartState": {
- "type": "array",
- "description": "open enumeration ComputingActivityState_t",
- "items": {
- "type": "string"
- }
- },
- "ExitCode": {
- "type": "integer",
- "description": "The exit code as returned by the main executable code or script of the job"
- },
- "ComputingManagerExitCode": {
- "type": "string",
- "description": "The exit code provided by the ComputingManager"
- },
- "Error": {
- "type": "array",
- "description": "The error messages as provided by the software components involved in the management of the job",
- "items": {
- "type": "string"
- }
- },
- "WaitingPosition": {
- "type": "integer",
- "description": "The position of the job in the queue, if the job is waiting"
- },
- "Owner": {
- "type": "string",
- "description": "The Grid identity of the job's owner"
- },
- "LocalOwner": {
- "type": "string",
- "description": "The local user name of the job's owner"
- },
- "RequestedTotalWallTime": {
- "type": "integer",
- "description": "The total wall clock time requested by the job"
- },
- "RequestedTotalCPUTime": {
- "type": "integer",
- "description": "The total CPU time requested by the job"
- },
- "RequestedSlots": {
- "type": "integer",
- "description": "The number of slots requested for the job"
- },
- "RequestedApplicationEnvironment": {
- "type": "array",
- "description": "The AppName and Version of the requested ApplicationEnvironments",
- "items": {
- "type": "string"
- }
- },
- "StdIn": {
- "type": "string",
- "description": "The name of the file used for standard input"
- },
- "StdOut": {
- "type": "string",
- "description": "The name of the file used for standard output"
- },
- "StdErr": {
- "type": "string",
- "description": "The name of the file used for standard error"
- },
- "LogDir": {
- "type": "string",
- "description": "The name of the directory which contains job logs"
- },
- "ExecutionNode": {
- "type": "array",
- "description": "Hostnames associated with the ExecutionEnvironments running the job",
- "items": {
- "type": "string"
- }
- },
- "Queue": {
- "type": "string",
- "description": "The name of the ComputingManager queue that held the job before execution"
- },
- "UsedTotalWallTime": {
- "type": "integer",
- "description": "The total wall clock time consumed by the job so far (slots*seconds)"
- },
- "UsedTotalCpuTime": {
- "type": "integer",
- "description": "The total CPU time consumed by the job so far (seconds)"
- },
- "UsedMainMemory": {
- "type": "integer",
- "description": "The physical RAM currently used by the job (MB)"
- },
- "SubmissionTime": {
- "type": "string",
- "description": "The time when the job was submitted to the ComputingEndpoint (DateTime_t)"
- },
- "ComputingManagerSubmissionTime": {
- "type": "string",
- "description": "The time when the job was submitted to the ComputingManager (DateTime_t)"
- },
- "StartTime": {
- "type": "string",
- "description": "The time when the ComputingManager started the job (DateTime_t)"
- },
- "EndTime": {
- "type": "string",
- "description": "The time when the job ended in the Grid layer (DateTime_t)"
- },
- "ComputingManagerEndTime": {
- "type": "string",
- "description": "The time when the job ended according to the ComputingManager (DateTime_t)"
- },
- "WorkingAreaEraseTime": {
- "type": "string",
- "description": "The time when working area will be removed from storage (DateTime_t)"
- },
- "ProxyExpirationTime": {
- "type": "string",
- "description": "The expiration time of the Grid proxy associated with the job (DateTime_t)"
- },
- "SubmissionHost": {
- "type": "string",
- "description": "The name of the host from which the job was submitted"
- },
- "SubmissionClientName": {
- "type": "string",
- "description": "The name of the software client used to submit the job"
- },
- "OtherMessages": {
- "type": "array",
- "description": "Optional messages provided by either the Grid layer or the ComputingManager",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["State","Owner"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ComputingEndpoint.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ComputingEndpoint.json b/tools/job-monitor/src/main/resources/schema/ComputingEndpoint.json
deleted file mode 100644
index f94f889..0000000
--- a/tools/job-monitor/src/main/resources/schema/ComputingEndpoint.json
+++ /dev/null
@@ -1,44 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingEndpoint.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Endpoint.json"}],
- "properties": {
- "Staging": {
- "type": "string",
- "description": "Supported file staging functionality - Staging_t",
- "enum": ["none","stagingin","staginginout","stagingout"]
- },
- "JobDescription": {
- "type": "array",
- "description": "Supported job description languages - JobDescription_t (open Enumeration)",
- "items": {
- "type": "string"
- }
- },
- "TotalJobs": {
- "type": "integer",
- "description": "The total number of Grid jobs known to the system"
- },
- "RunningJobs": {
- "type": "integer",
- "description": "The number of Grid jobs which are running in an ExecutionEnvironment"
- },
- "WaitingJobs": {
- "type": "integer",
- "description": "The number of Grid jobs which are waiting to start executing"
- },
- "StagingJobs": {
- "type": "integer",
- "description": "The number of Grid jobs staging files before or after execution"
- },
- "SuspendedJobs": {
- "type": "integer",
- "description": "The number of Grid jobs that started to execute, but are now suspended"
- },
- "PreLRMSWaitingJobs": {
- "type": "integer",
- "description": "The number of Grid jobs managed by the Grid software, but not yet passed to the LRMS"
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ComputingManager.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ComputingManager.json b/tools/job-monitor/src/main/resources/schema/ComputingManager.json
deleted file mode 100644
index aecb114..0000000
--- a/tools/job-monitor/src/main/resources/schema/ComputingManager.json
+++ /dev/null
@@ -1,117 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingManager.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
- "properties": {
- "Reservation": {
- "type": "boolean",
- "description": "Whether advance reservation is supported (no value implies undefined in ExtendedBoolean_t)"
- },
- "BulkSubmission": {
- "type": "boolean",
- "description": "Whether multiple jobs can be submitted at once (no value implies undefined in ExtendedBoolean_t)"
- },
- "TotalPhysicalCPUs": {
- "type": "integer",
- "description": "The total number of physical CPUs managed by this ComputingManager"
- },
- "TotalLogicalCPUs": {
- "type": "integer",
- "description": "The total number of logical CPUs managed by this ComputingManager"
- },
- "TotalSlots": {
- "type": "integer",
- "description": "The total number of slots managed by this ComputingManager"
- },
- "SlotsUsedByLocalJobs": {
- "type": "integer",
- "description": "The number of slots currently used by jobs submitted via a non-Grid interface"
- },
- "SlotsUsedByGridJobs": {
- "type": "integer",
- "description": "The number of slots currently used by jobs submitted via a non-Grid interface"
- },
- "Homogeneous": {
- "type": "boolean",
- "description": "Whether this ComputingManager manages only one type of ExecutionEnvironment"
- },
- "NetworkInfo": {
- "type": "array",
- "description": "The types of internal network connections between ExecutionEnvironments (NetworkInfo_t)",
- "items": {
- "type": "string"
- }
- },
- "LocalCPUDistribution": {
- "type": "boolean",
- "description": "Classification of the managed ExecutionEnvironments aggregated by the number of logical CPUs"
- },
- "WorkingAreaShared": {
- "type": "boolean",
- "description": "True if the working area is shared across different ExecutionEnvironments"
- },
- "WorkingAreaGuaranteed": {
- "type": "boolean",
- "description": "True if the job is guaranteed all of WorkingAreaTotal"
- },
- "WorkingAreaTotal": {
- "type": "integer",
- "description": "Total size of the working area available to single slot jobs (GB)"
- },
- "WorkingAreaFree": {
- "type": "integer",
- "description": "The amount of free space in the working area (GB)"
- },
- "WorkingAreaLifeTime": {
- "type": "integer",
- "description": "The minimum guaranteed lifetime of files created in the working area (seconds)"
- },
- "WorkingAreaMultiSlotTotal": {
- "type": "integer",
- "description": "The total size of the working area across all ExecutionEnvironments (GB)"
- },
- "WorkingAreaMultiSlotFree": {
- "type": "integer",
- "description": "The available space in the working area across all ExecutionEnvironments (GB)"
- },
- "WorkingAreaMultiSlotLifeTime": {
- "type": "integer",
- "description": "The minimum guaranteed lifetime of files created in the working area (seconds)"
- },
- "CacheTotal": {
- "type": "integer",
- "description": "If local caching of input files is supported, the total size of the area they may be stored in"
- },
- "CacheFree": {
- "type": "integer",
- "description": "If local caching of input files is supported, the available size of the area they may be stored in"
- },
- "TmpDir": {
- "type": "string",
- "description": "The absolute path of a temporary directory local to an ExecutionEnvironment"
- },
- "ScratchDir": {
- "type": "string",
- "description": "The absolute path of a shared directory available for application data"
- },
- "ApplicationDir": {
- "type": "string",
- "description": "The absolute path of a directory available for installation of persistent application software"
- },
- "ApplicationEnvironmentID": {
- "type": "array",
- "description": "ID(s) of ApplicationEnvironments provided by this ComputingManager",
- "items": {
- "type": "string"
- }
- },
- "BenchmarkID": {
- "type": "array",
- "description": "ID(s) of Benchmarks associated with this ComputingManager",
- "items": {
- "type": "string"
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ComputingService.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ComputingService.json b/tools/job-monitor/src/main/resources/schema/ComputingService.json
deleted file mode 100644
index 9cfde1b..0000000
--- a/tools/job-monitor/src/main/resources/schema/ComputingService.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingService.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Service.json"}],
- "properties": {
- "TotalJobs": {
- "type": "integer",
- "description": "The total number of Grid jobs known to the system"
- },
- "RunningJobs": {
- "type": "integer",
- "description": "The number of Grid jobs which are running in an ExecutionEnvironment"
- },
- "WaitingJobs": {
- "type": "integer",
- "description": "The number of Grid jobs which are waiting to start executing"
- },
- "StagingJobs": {
- "type": "integer",
- "description": "The number of Grid jobs staging files before or after execution"
- },
- "SuspendedJobs": {
- "type": "integer",
- "description": "The number of Grid jobs that started to execute, but are now suspended"
- },
- "PreLRMSWaitingJobs": {
- "type": "integer",
- "description": "The number of Grid jobs managed by the Grid software, but not yet passed to the LRMS"
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ComputingShare.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ComputingShare.json b/tools/job-monitor/src/main/resources/schema/ComputingShare.json
deleted file mode 100644
index 340c83e..0000000
--- a/tools/job-monitor/src/main/resources/schema/ComputingShare.json
+++ /dev/null
@@ -1,182 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingShare.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
- "properties": {
- "MappingQueue": {
- "type": "string",
- "description": "The name of the queue in the LRMS where jobs in this share are submitted"
- },
- "MaxWallTime": {
- "type": "integer",
- "description": "The maximum wall clock time that a single-slot job can run (seconds)"
- },
- "MaxMultiSlotWallTime": {
- "type": "integer",
- "description": "The maximum wall clock time that a multi-slot job can run (seconds)"
- },
- "DefaultWallTime": {
- "type": "integer",
- "description": "The default wall clock per slot assumed by the LRMS if a maximum time is not specified (seconds)"
- },
- "MaxCPUTime": {
- "type": "integer",
- "description": "The maximum pre-slot CPU time that a job can request (seconds)"
- },
- "MaxTotalCPUTime": {
- "type": "integer",
- "description": "The maximum amount of CPU time that a job can request across all slots assigned to it (seconds)"
- },
- "MinCPUTime": {
- "type": "integer",
- "description": "The minimum pre-slot CPU time that a job can request (seconds)"
- },
- "DefaultCPUTime": {
- "type": "integer",
- "description": "The default CPU time limit assumed by the LRMS if a maximum time is not specified (seconds)"
- },
- "MaxTotalJobs": {
- "type": "integer",
- "description": "The maximum number of jobs that can be in this Share"
- },
- "MaxRunningJobs": {
- "type": "integer",
- "description": "The maximum number of jobs that can be running in this Share"
- },
- "MaxWaitingJobs": {
- "type": "integer",
- "description": "The maximum number of jobs that can be waiting in this Share"
- },
- "MaxPreLRMSWaitingJobs": {
- "type": "integer",
- "description": "The maximum number of jobs that can be waiting in the Grid layer for this Share"
- },
- "MaxUserRunningJobs": {
- "type": "integer",
- "description": "The maximum number of jobs that can be running in this Share per user"
- },
- "MaxSlotsPerJob": {
- "type": "integer",
- "description": "The maximum number of slots that can be allocated to a single job in this Share"
- },
- "MaxStageInStreams": {
- "type": "integer",
- "description": "The maximum number of streams available to stage files in"
- },
- "MaxStageOutStreams": {
- "type": "integer",
- "description": "The maximum number of streams available to stage files out"
- },
- "ScheduingPolicy": {
- "type": "string",
- "description": "The scheduling policy used by the share - SchedulingPolicy_t (open enumeration)"
- },
- "MaxMainMemory": {
- "type": "integer",
- "description": "The maximum amount of physical RAM that a job can use (MB)"
- },
- "GuaranteedMainMemory": {
- "type": "integer",
- "description": "The amount of physical RAM that a job will have available (MB)"
- },
- "MaxVirtualMemory": {
- "type": "integer",
- "description": "The maximum amount memory (RAM+swap) that a job can use (MB)"
- },
- "GuaranteedVirtualMemory": {
- "type": "integer",
- "description": "The amount of memory (RAM+swap) that a job will have available (MB)"
- },
- "MaxDiskSpace": {
- "type": "integer",
- "description": "The maximum disk space that a job can use in the working area (GB)"
- },
- "DefaultStorageServiceID": {
- "type": "string",
- "description": "The ID of the default StorageService used to store files"
- },
- "Preemption": {
- "type": "boolean",
- "description": "Whether jobs can be preempted and resumed (no value implies undefined in ExtendedBoolean_t)"
- },
- "ServingState": {
- "type": "string",
- "description": "How the Share is currently serving jobs",
- "enum": ["closed","draining","production","queueing"]
- },
- "TotalJobs": {
- "type": "integer",
- "description": "The total number of jobs in any state"
- },
- "RunningJobs": {
- "type": "integer",
- "description": "The number of running jobs submitted through Grid or non-Grid interfaces"
- },
- "LocalRunningJobs": {
- "type": "integer",
- "description": "The number of running jobs submitted using non-Grid interfaces"
- },
- "WaitingJobs": {
- "type": "integer",
- "description": "The number of waiting jobs submitted through Grid or non-Grid interfaces"
- },
- "LocalWaitingJobs": {
- "type": "integer",
- "description": "The number of waiting jobs submitted using non-Grid interfaces"
- },
- "SuspendedJobs": {
- "type": "integer",
- "description": "The number of suspended jobs submitted through Grid or non-Grid interfaces"
- },
- "LocalSuspendedJobs": {
- "type": "integer",
- "description": "The number of suspended jobs submitted using non-Grid interfaces"
- },
- "StagingJobs": {
- "type": "integer",
- "description": "The number of jobs staging files before or after execution"
- },
- "PreLRMSWaitingJobs": {
- "type": "integer",
- "description": "The number of Grid jobs which have not yet been passed to the LRMS"
- },
- "EstimatedAverageWaitingTime": {
- "type": "integer",
- "description": "An estimate of the average time a job will wait before it starts to execute (seconds)"
- },
- "EstimatedWorstWaitingTime": {
- "type": "integer",
- "description": "An estimate of the worst-case time a job will wait before it starts to execute (seconds)"
- },
- "FreeSlots": {
- "type": "integer",
- "description": "The number of slots which are currently available for use"
- },
- "FreeSlotsWithDuration": {
- "type": "string",
- "description": "The number of slots which are currently available for use and how long they are available"
- },
- "UsedSlots": {
- "type": "integer",
- "description": "The number of slots currently in use"
- },
- "RequestedSlots": {
- "type": "integer",
- "description": "The number of slots needd to execute all waiting and staging jobs"
- },
- "ReservationPolicy": {
- "type": "string",
- "description": "The policy used for advance reservation - ReservationPolicy_t",
- "enum": ["mandatory","none","optional"]
- },
- "Tag": {
- "type": "array",
- "description": "UserDomain-defined tags for this Share",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["ServingState"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Contact.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Contact.json b/tools/job-monitor/src/main/resources/schema/Contact.json
deleted file mode 100644
index 436b262..0000000
--- a/tools/job-monitor/src/main/resources/schema/Contact.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Contact.json",
- "description": "A GLUE 2 Contact",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Detail": {
- "type": "string",
- "description": "A URI embedding the contact information"
- },
- "Type": {
- "type": "string",
- "description": "closed enumeration ContactType_t",
- "enum": ["general","security","sysadmin","usersupport"]
- },
- "ServiceID": {
- "type": "array",
- "description": "The IDs of Services associated with this Contact",
- "items": {
- "type": "string"
- }
- },
- "DomainID": {
- "type": "array",
- "description": "The IDs of Domains associated with this Contact",
- "items": {
- "type": "string"
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/DataStore.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/DataStore.json b/tools/job-monitor/src/main/resources/schema/DataStore.json
deleted file mode 100644
index 8f15447..0000000
--- a/tools/job-monitor/src/main/resources/schema/DataStore.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/DataStore.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Resource.json"}],
- "properties": {
- "Type": {
- "type": "string",
- "description": "The type of storage medium - DataStoreType_t (disk,optical,tape,...)"
- },
- "Latency": {
- "type": "string",
- "description": "The latency category under normal operating conditions - AccessLatency_t",
- "enum": ["nearline","offline","online"]
- },
- "TotalSize": {
- "type": "integer",
- "description": "The total amount of storage (GB)"
- },
- "FreeSize": {
- "type": "integer",
- "description": "The amount of available storage (GB)"
- },
- "UsedSize": {
- "type": "integer",
- "description": "The amount of used storage (GB)"
- }
- },
- "required": ["Type","Latency"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Domain.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Domain.json b/tools/job-monitor/src/main/resources/schema/Domain.json
deleted file mode 100644
index 5bd996b..0000000
--- a/tools/job-monitor/src/main/resources/schema/Domain.json
+++ /dev/null
@@ -1,30 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Description": {
- "type": "string",
- "description": "A description of the Domain"
- },
- "WWW": {
- "type": "array",
- "description": "URLs of web pages with more information about the Domain",
- "items": {
- "type": "string"
- }
- },
- "ContactID": {
- "type": "array",
- "description": "IDs of Contacts for this Domain",
- "items": {
- "type": "string"
- }
- },
- "LocationID": {
- "type": "string",
- "description": "The ID of the primary Location for this Domain"
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Endpoint.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Endpoint.json b/tools/job-monitor/src/main/resources/schema/Endpoint.json
deleted file mode 100644
index b75b02a..0000000
--- a/tools/job-monitor/src/main/resources/schema/Endpoint.json
+++ /dev/null
@@ -1,147 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Endpoint.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "URL": {
- "type": "string",
- "description": "Network location of the endpoint"
- },
- "Capability": {
- "type": "array",
- "description": "Capability_t (open enumeration)",
- "items": {
- "type": "string"
- }
- },
- "Technology": {
- "type": "string",
- "description": "EndpointTechnology_t"
- },
- "InterfaceName": {
- "type": "string",
- "description": "InterfaceName_t"
- },
- "InterfaceVersion": {
- "type": "string",
- "description": "The version of the primary interface protocol (free format)"
- },
- "InterfaceExtension": {
- "type": "array",
- "description": "URIs identifying supported extensions to the interface protocol",
- "items": {
- "type": "string"
- }
- },
- "WSDL": {
- "type": "array",
- "description": "URLs of WSDL document(s) describing the interface",
- "items": {
- "type": "string"
- }
- },
- "SupportedProfile": {
- "type": "array",
- "description": "URI(s) identifying supported profiles for the Endpoint",
- "items": {
- "type": "string"
- }
- },
- "Semantics": {
- "type": "array",
- "description": "URL(s) of documents providing human-readable descriptions of the semantics of the Endpoint",
- "items": {
- "type": "string"
- }
- },
- "Implementor": {
- "type": "string",
- "description": "The name of the main organization implementing the Endpoint"
- },
- "ImplementationName": {
- "type": "string",
- "description": "The name of the implementation of the Endpoint"
- },
- "ImplementationVersion": {
- "type": "string",
- "description": "The version of the implementation of the Endpoint"
- },
- "QualityLevel": {
- "type": "string",
- "description": "QualityLevel_t",
- "enum": ["development","pre-production","production","testing"]
- },
- "HealthState": {
- "type": "string",
- "description": "The operational status of the Endpoint",
- "enum": ["critical","ok","other","unknown","warning"]
- },
- "HealthStateInfo": {
- "type": "string",
- "description": "A human-readable explanation of the HealthState of this Endpoint"
- },
- "ServingState": {
- "type": "string",
- "description": "If the endpoint is accepting and serving requests",
- "enum": ["closed","draining","production","queueing"]
- },
- "StartTime": {
- "type": "string",
- "description": "The start time of the Service associated with this Endpoint (DateTime_t)"
- },
- "IssuerCA": {
- "type": "string",
- "description": "The DN of the CA issuing the certificate presented by this Endpoint"
- },
- "TrustedCA": {
- "type": "array",
- "description": "DN(s) of CAs trusted by this Endpoint",
- "items": {
- "type": "string"
- }
- },
- "DowntimeAnnounce": {
- "type": "string",
- "description": "When the next scheduled downtime was announced (DateTime_t)"
- },
- "DowntimeStart": {
- "type": "string",
- "description": "When the next scheduled downtime will start (DateTime_t)"
- },
- "DowntimeEnd": {
- "type": "string",
- "description": "When the next scheduled downtime will end (DateTime_t)"
- },
- "DowntimeInfo": {
- "type": "string",
- "description": "Human-readable of the next scheduled downtime"
- },
- "ServiceID": {
- "type": "string",
- "description": "The ID of the Service associated with this Endpoint"
- },
- "ShareID": {
- "type": "array",
- "description": "The IDs of the Shares accessible from this Endpoint",
- "items": {
- "type": "string"
- }
- },
- "AccessPolicyID": {
- "type": "array",
- "description": "IDs of AccessPolicies associated with this Endpoint",
- "items": {
- "type": "string"
- }
- },
- "ActivityID": {
- "type": "array",
- "description": "IDs of Activities being managed through this Endpoint",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["InterfaceName","QualityLevel","HealthState","ServingState","ServiceID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Entity.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Entity.json b/tools/job-monitor/src/main/resources/schema/Entity.json
deleted file mode 100644
index 5d1ae46..0000000
--- a/tools/job-monitor/src/main/resources/schema/Entity.json
+++ /dev/null
@@ -1,35 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json",
- "type": "object",
- "properties": {
- "CreationTime": {
- "type": "string",
- "description": "The creation time of this entity in the format: CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]"
- },
- "Validity": {
- "type": "integer",
- "description": "The number of seconds after CreationTime that this entity should be considered relevant"
- },
- "ID": {
- "type": "string",
- "description": "A globally unique identifier for this entity"
- },
- "Name": {
- "type": "string",
- "description": "A human-readable name"
- },
- "OtherInfo": {
- "type": "array",
- "description": "Placeholder for information that does not fit in any other attribute",
- "items": {
- "type": "string"
- }
- },
- "Extension": {
- "type": "object",
- "description": "Key/value pairs enabling the association of extra information not captured by the model"
- }
- },
- "required": ["ID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ExecutionEnvironment.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ExecutionEnvironment.json b/tools/job-monitor/src/main/resources/schema/ExecutionEnvironment.json
deleted file mode 100644
index 77bf876..0000000
--- a/tools/job-monitor/src/main/resources/schema/ExecutionEnvironment.json
+++ /dev/null
@@ -1,115 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ExecutionEnvironment.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Resource.json"}],
- "properties": {
- "Platform": {
- "type": "string",
- "description": "The platform architecture - Platform_t (open enumeration)"
- },
- "VirtualMachine": {
- "type": "boolean",
- "description": "True if the ExecutionEnvironment is a virtual machine"
- },
- "TotalInstances": {
- "type": "integer",
- "description": "The total number of ExecutionEnvironment instances"
- },
- "UsedInstances": {
- "type": "integer",
- "description": "The number of ExecutionEnvironment instances in use"
- },
- "UnavailableInstances": {
- "type": "integer",
- "description": "The number of ExecutionEnvironment instances that are unavailable"
- },
- "PhysicalCPUs": {
- "type": "integer",
- "description": "The number of physical CPUs in one ExecutionEnvironment instance"
- },
- "LogicalCPUs": {
- "type": "integer",
- "description": "The number of logical CPUs in one ExecutionEnvironment instance"
- },
- "CPUMultiplicity": {
- "type": "string",
- "description": "Information about the CPUs and cores in an execution environment",
- "enum": ["multicpu-multicore","multicpu-singlecore","singlecpu-multicore","singlecpu-singlecore"]
- },
- "CPUVendor": {
- "type": "string",
- "description": "The name of the manufacturer of the CPU"
- },
- "CPUModel": {
- "type": "string",
- "description": "The model of the CPU, as defined by the vendor"
- },
- "CPUVersion": {
- "type": "string",
- "description": "The specific version name of the CPU, as defined by the vendor"
- },
- "CPUClockSpeed": {
- "type": "integer",
- "description": "The clock speed of the CPU (MHz)"
- },
- "CPUTimeScalingFactor": {
- "type": "float",
- "description": "The factor used by the ComputingManager to scale the CPU time limit"
- },
- "WallTimeScalingFactor": {
- "type": "float",
- "description": "The factor used by the ComputingManager to scale the wallclock time limit"
- },
- "MainMemorySize": {
- "type": "integer",
- "description": "The total amount of physical RAM in one ExecutionEnvironment instance (MB)"
- },
- "VirtualMemorySize": {
- "type": "integer",
- "description": "The total amount of virtual memory (RAM+swap) in one ExecutionEnvironment instance (MB)"
- },
- "OSFamily": {
- "type": "string",
- "description": "The general family of the operating system - OSFamily_t (open enumeration)"
- },
- "OSName": {
- "type": "string",
- "description": "The specific name of the operating system - OSName_t (open enumeration)"
- },
- "OSVersion": {
- "type": "string",
- "description": "The version of the operating system, as defined by the vendor"
- },
- "ConnectivityIn": {
- "type": "boolean",
- "description": "True if direct inbound network connectiity is available to a running job"
- },
- "ConnectivityOut": {
- "type": "boolean",
- "description": "True if direct outbound network connectiity is available to a running job"
- },
- "NetworkInfo": {
- "type": "array",
- "description": "The types of internal network connections between ExecutionEnvironments - NetworkInfo_t (open enumeration)",
- "items": {
- "type": "string"
- }
- },
- "ApplicationEnvironmentID": {
- "type": "array",
- "description": "ID(s) of ApplicationEnvironments available in this ExecutionEnvironment",
- "items": {
- "type": "string"
- }
- },
- "BenchmarkID": {
- "type": "array",
- "description": "ID(s) of Benchmarks associated with this ExecutionEnvironment",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["Platform","MainMemorySize","OSFamily","ConnectivityIn","ConnectivityOut"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Glue2.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Glue2.json b/tools/job-monitor/src/main/resources/schema/Glue2.json
deleted file mode 100644
index bb80505..0000000
--- a/tools/job-monitor/src/main/resources/schema/Glue2.json
+++ /dev/null
@@ -1,246 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Glue2.json",
- "description": "A GLUE 2 document",
- "type": "object",
- "properties": {
- "Entity": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}]
- }
- },
- "Location": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Location.json"}]
- }
- },
- "Contact": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Contact.json"}]
- }
- },
- "Domain": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json"}]
- }
- },
- "AdminDomain": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AdminDomain.json"}]
- }
- },
- "UserDomain": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/UserDomain.json"}]
- }
- },
- "Service": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Service.json"}]
- }
- },
- "Endpoint": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Endpoint.json"}]
- }
- },
- "Share": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}]
- }
- },
- "Manager": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Manager.json"}]
- }
- },
- "Resource": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Resource.json"}]
- }
- },
- "Activity": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Activity.json"}]
- }
- },
- "Policy": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Policy.json"}]
- }
- },
- "AccessPolicy": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AccessPolicy.json"}]
- }
- },
- "MappingPolicy": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/MappingPolicy.json"}]
- }
- },
- "ComputingService": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingService.json"}]
- }
- },
- "ComputingEndpoint": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingEndpoint.json"}]
- }
- },
- "ComputingShare": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingShare.json"}]
- }
- },
- "ComputingManager": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingManager.json"}]
- }
- },
- "Benchmark": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Benchmark.json"}]
- }
- },
- "ExecutionEnvironment": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ExecutionEnvironment.json"}]
- }
- },
- "ApplicationEnvironment": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationEnvironment.json"}]
- }
- },
- "ApplicationHandle": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationHandle.json"}]
- }
- },
- "ComputingActivity": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingActivity.json"}]
- }
- },
- "ToStorageService": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ToStorageService.json"}]
- }
- },
- "StorageService": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageService.json"}]
- }
- },
- "StorageServiceCapacity": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageServiceCapacity.json"}]
- }
- },
- "StorageAccessProtocol": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageAccessProtocol.json"}]
- }
- },
- "StorageEndpoint": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageEndpoint.json"}]
- }
- },
- "StorageShare": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageShare.json"}]
- }
- },
- "StorageShareCapacity": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageShareCapacity.json"}]
- }
- },
- "StorageManager": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageManager.json"}]
- }
- },
- "DataStore": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/DataStore.json"}]
- }
- },
- "ToComputingService": {
- "type": "array",
- "items": {
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ToComputingService.json"}]
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Location.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Location.json b/tools/job-monitor/src/main/resources/schema/Location.json
deleted file mode 100644
index 8491cc0..0000000
--- a/tools/job-monitor/src/main/resources/schema/Location.json
+++ /dev/null
@@ -1,47 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Location.json",
- "description": "A GLUE 2 Location",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Address": {
- "type": "string",
- "description": "A free format street address"
- },
- "Place": {
- "type": "string",
- "description": "Name of town/city"
- },
- "Country": {
- "type": "string",
- "description": "Name of country"
- },
- "PostalCode": {
- "type": "string",
- "description": "Postal code"
- },
- "Latitude": {
- "type": "number",
- "description": "Position north (positive) or south (negative) of the equator in degrees"
- },
- "Longitude": {
- "type": "number",
- "description": "Position east (positive) or west (negative) of the primary meridian in degrees"
- },
- "ServiceID": {
- "type": "array",
- "description": "The IDs of Services at this location",
- "items": {
- "type": "string"
- }
- },
- "DomainID": {
- "type": "array",
- "description": "The IDs of Domains at this location",
- "items": {
- "type": "string"
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Manager.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Manager.json b/tools/job-monitor/src/main/resources/schema/Manager.json
deleted file mode 100644
index d1df50a..0000000
--- a/tools/job-monitor/src/main/resources/schema/Manager.json
+++ /dev/null
@@ -1,28 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Manager.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "ProductName": {
- "type": "string",
- "description": "The name of the software product which implements the Manager"
- },
- "ProductVersion": {
- "type": "string",
- "description": "The version of the software product which implements the Manager"
- },
- "ServiceID": {
- "type": "string",
- "description": "The ID of the Service this Share participates in"
- },
- "ResourceID": {
- "type": "array",
- "description": "ID(s) of Resources associated with this Share",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["ProductName","ServiceID","ResourceID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/MappingPolicy.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/MappingPolicy.json b/tools/job-monitor/src/main/resources/schema/MappingPolicy.json
deleted file mode 100644
index 268844d..0000000
--- a/tools/job-monitor/src/main/resources/schema/MappingPolicy.json
+++ /dev/null
@@ -1,13 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/MappingPolicy.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Policy.json"}],
- "properties": {
- "ShareID": {
- "type": "string",
- "description": "The ID of the Share this MappingPolicy is for"
- }
- },
- "required": ["ShareID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Policy.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Policy.json b/tools/job-monitor/src/main/resources/schema/Policy.json
deleted file mode 100644
index f936699..0000000
--- a/tools/job-monitor/src/main/resources/schema/Policy.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Policy.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Scheme": {
- "type": "string",
- "description": "PolicyScheme_t (open enumeration)"
- },
- "Rule": {
- "type": "array",
- "description": "Policy rules",
- "items": {
- "type": "string"
- }
- },
- "UserDomainID": {
- "type": "array",
- "description": "The ID(s) of the UserDomains this Policy applies to",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["Scheme","Rule","UserDomainID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Resource.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Resource.json b/tools/job-monitor/src/main/resources/schema/Resource.json
deleted file mode 100644
index 88d08ad..0000000
--- a/tools/job-monitor/src/main/resources/schema/Resource.json
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Resource.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "ManagerID": {
- "type": "string",
- "description": "The ID of the Manager for this Resource"
- },
- "ShareID": {
- "type": "array",
- "description": "The ID(s) of the Shares this Resource is part of",
- "items": {
- "type": "string"
- }
- },
- "ActivityID": {
- "type": "array",
- "description": "The ID(s) of Activities consuming from this Share",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["ManagerID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Service.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Service.json b/tools/job-monitor/src/main/resources/schema/Service.json
deleted file mode 100644
index 4662407..0000000
--- a/tools/job-monitor/src/main/resources/schema/Service.json
+++ /dev/null
@@ -1,75 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Service.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Capability": {
- "type": "array",
- "description": "Capability_t (open enumeration)",
- "items": {
- "type": "string"
- }
- },
- "Type": {
- "type": "string",
- "description": "ServiceType_t (open enumeration)"
- },
- "QualityLevel": {
- "type": "string",
- "description": "QualityLevel_t",
- "enum": ["development","pre-production","production","testing"]
- },
- "StatusInfo": {
- "type": "array",
- "description": "URLs of web pages providing additional information",
- "items": {
- "type": "string"
- }
- },
- "Complexity": {
- "type": "string",
- "description": "A human-readable description of the number of endpoint types, shares, and resources"
- },
- "EndpointID": {
- "type": "array",
- "description": "The IDs of Endpoints for this Service",
- "items": {
- "type": "string"
- }
- },
- "ShareID": {
- "type": "array",
- "description": "The IDs of the Shares offered by this Service",
- "items": {
- "type": "string"
- }
- },
- "ManagerID": {
- "type": "array",
- "description": "The IDs of the Managers of this Service",
- "items": {
- "type": "string"
- }
- },
- "ContactID": {
- "type": "array",
- "description": "The IDs of Contacts for this Service",
- "items": {
- "type": "string"
- }
- },
- "LocationID": {
- "type": "string",
- "description": "The ID of the primary Location of this Service"
- },
- "ServiceID": {
- "type": "array",
- "description": "The IDs of Services related to this Service",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["Type","QualityLevel"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/Share.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/Share.json b/tools/job-monitor/src/main/resources/schema/Share.json
deleted file mode 100644
index 258fc1b..0000000
--- a/tools/job-monitor/src/main/resources/schema/Share.json
+++ /dev/null
@@ -1,45 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Description": {
- "type": "string",
- "description": "A human-readable description of the Share"
- },
- "EndpointID": {
- "type": "array",
- "description": "The ID(s) of the Endpoints that can be used to access this Share",
- "items": {
- "type": "string"
- }
- },
- "ResourceID": {
- "type": "array",
- "description": "The ID(s) of the Resources associated with this Share",
- "items": {
- "type": "string"
- }
- },
- "ServiceID": {
- "type": "string",
- "description": "The ID of the Service this Share participates in"
- },
- "ActivityID": {
- "type": "array",
- "description": "The ID(s) of Activities consuming from this Share",
- "items": {
- "type": "string"
- }
- },
- "MappingPolicyID": {
- "type": "array",
- "description": "ID(s) of MappingPolicies associated with this Share",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["ServiceID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/StorageAccessProtocol.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/StorageAccessProtocol.json b/tools/job-monitor/src/main/resources/schema/StorageAccessProtocol.json
deleted file mode 100644
index 05a830b..0000000
--- a/tools/job-monitor/src/main/resources/schema/StorageAccessProtocol.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageAccessProtocol.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Type": {
- "type": "string",
- "description": "The type of the protocol - StorageAccessProtocol_t"
- },
- "Version": {
- "type": "string",
- "description": "The version of the protocol supported"
- },
- "MaxStreams": {
- "type": "integer",
- "description": "The maximum number of parallel network streams which can be usef for a single transfer"
- },
- "StorageServiceID": {
- "type": "string",
- "description": "The ID of the StorageService this protocol is available for"
- },
- "ToComputingServiceID": {
- "type": "array",
- "description": "The ID(s) ToComputingService objects that describe connectivity to ComputingServices",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["Type","Version","StorageServiceID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/StorageEndpoint.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/StorageEndpoint.json b/tools/job-monitor/src/main/resources/schema/StorageEndpoint.json
deleted file mode 100644
index 38b27c4..0000000
--- a/tools/job-monitor/src/main/resources/schema/StorageEndpoint.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageEndpoint.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Endpoint.json"}],
- "properties": {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/StorageManager.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/StorageManager.json b/tools/job-monitor/src/main/resources/schema/StorageManager.json
deleted file mode 100644
index f3984f6..0000000
--- a/tools/job-monitor/src/main/resources/schema/StorageManager.json
+++ /dev/null
@@ -1,8 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageManager.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
- "properties": {
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/StorageService.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/StorageService.json b/tools/job-monitor/src/main/resources/schema/StorageService.json
deleted file mode 100644
index a03d111..0000000
--- a/tools/job-monitor/src/main/resources/schema/StorageService.json
+++ /dev/null
@@ -1,22 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageService.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Service.json"}],
- "properties": {
- "StorageAccessProtocolID": {
- "type": "array",
- "description": "The ID(s) of the StorageAccessProtocols supported by this service",
- "items": {
- "type": "string"
- }
- },
- "StorageServiceCapacityID": {
- "type": "array",
- "description": "The ID(s) of the StorageServiceCapacities for this Service",
- "items": {
- "type": "string"
- }
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/StorageServiceCapacity.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/StorageServiceCapacity.json b/tools/job-monitor/src/main/resources/schema/StorageServiceCapacity.json
deleted file mode 100644
index a25c204..0000000
--- a/tools/job-monitor/src/main/resources/schema/StorageServiceCapacity.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageServiceCapacity.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Type": {
- "type": "string",
- "description": "The type of storage capacity - StorageCapacity_t"
- },
- "TotalSize": {
- "type": "integer",
- "description": "The total amount of storage of this type (GB)"
- },
- "FreeSize": {
- "type": "integer",
- "description": "The amount of currently available storage of this type (GB)"
- },
- "UsedSize": {
- "type": "integer",
- "description": "The amount storage of this type in use (GB)"
- },
- "ReservedSize": {
- "type": "integer",
- "description": "The amount storage of this type which is not in use, but has been reserved for use in use (GB)"
- },
- "StorageServiceID": {
- "type": "string",
- "description": "The ID of the StorageService this capacity describes"
- }
- },
- "required": ["Type","StorageServiceID"]
-}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/StorageShare.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/StorageShare.json b/tools/job-monitor/src/main/resources/schema/StorageShare.json
deleted file mode 100644
index 9703118..0000000
--- a/tools/job-monitor/src/main/resources/schema/StorageShare.json
+++ /dev/null
@@ -1,65 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageShare.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
- "properties": {
- "ServingState": {
- "type": "string",
- "description": "How the Share is currently serving jobs",
- "enum": ["closed","draining","production","queueing"]
- },
- "Path": {
- "type": "string",
- "description": "A default namespace where files are logically placed when they are stored in this Share"
- },
- "AccessMode": {
- "type": "array",
- "description": "The type of access allowed for this share - AccessMode_t (undefined)",
- "items": {
- "type": "string"
- }
- },
- "SharingID": {
- "type": "string",
- "description": "A local identifier common to the set of StorageShares which use the same underling extents"
- },
- "AccessLatency": {
- "type": "string",
- "description": "The maximum latency category under normal operating conditions",
- "enum": ["nearline","offline","online"]
- },
- "RetentionPolicy": {
- "type": "string",
- "description": "The quality of data retention - RetentionPolicy_t"
- },
- "ExpirationMode": {
- "type": "array",
- "description": "Supported file lifetime modes",
- "items": {
- "type": "string",
- "enum": ["neverexpire","releasewhenexpired","warnwhenexpired"]
- }
- },
- "DefaultLifeTime": {
- "type": "integer",
- "description": "The default lifetime assigned to a new file"
- },
- "MaximumLifeTime": {
- "type": "integer",
- "description": "The maximum lifetime that can be requested for a file"
- },
- "Tag": {
- "type": "string",
- "description": "An identifier defined by a UserDomain"
- },
- "StorageShareCapacityID": {
- "type": "array",
- "description": "ID of the StorageShareCapacities associated with this share",
- "items": {
- "type": "string"
- }
- }
- },
- "required": ["ServingState","SharingID","AccessLatency"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/StorageShareCapacity.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/StorageShareCapacity.json b/tools/job-monitor/src/main/resources/schema/StorageShareCapacity.json
deleted file mode 100644
index f392c94..0000000
--- a/tools/job-monitor/src/main/resources/schema/StorageShareCapacity.json
+++ /dev/null
@@ -1,33 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageShareCapacity.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "Type": {
- "type": "string",
- "description": "The type of storage capacity - StorageCapacity_t"
- },
- "TotalSize": {
- "type": "integer",
- "description": "The total amount of storage (GB)"
- },
- "FreeSize": {
- "type": "integer",
- "description": "The amount of available storage (GB)"
- },
- "UsedSize": {
- "type": "integer",
- "description": "The amount of used storage (GB)"
- },
- "ReservedSize": {
- "type": "integer",
- "description": "The amount storage which is not occupied, but has been reserved for use (GB)"
- },
- "StorageShareID": {
- "type": "string",
- "description": "The ID of the StorageShare related to this capacity"
- }
- },
- "required": ["Type","StorageShareID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ToComputingService.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ToComputingService.json b/tools/job-monitor/src/main/resources/schema/ToComputingService.json
deleted file mode 100644
index 6d81b80..0000000
--- a/tools/job-monitor/src/main/resources/schema/ToComputingService.json
+++ /dev/null
@@ -1,32 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ToComputingService.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "NetworkInfo": {
- "type": "string",
- "description": "Type of network connections between the Storage and Computing services (NetworkInfo_t)"
- },
- "Bandwidth": {
- "type": "integer",
- "description": "The normal bandwidth available between the Storage and Computing services (Mb/s)"
- },
- "StorageAccessProtocolID": {
- "type": "array",
- "description": "IDs of the protocols that can be used to access the StorageService",
- "items": {
- "type": "string"
- }
- },
- "ComputingServiceID": {
- "type": "string",
- "description": "The ID of the ComputingService"
- },
- "StorageServiceID": {
- "type": "string",
- "description": "The ID of the StorageService"
- }
- },
- "required": ["ComputingServiceID","StorageServiceID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/ToStorageService.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/ToStorageService.json b/tools/job-monitor/src/main/resources/schema/ToStorageService.json
deleted file mode 100644
index 644f3d1..0000000
--- a/tools/job-monitor/src/main/resources/schema/ToStorageService.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ToStorageService.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
- "properties": {
- "LocalPath": {
- "type": "string",
- "description": "The path within the ComputingService that is used to access the StorageService"
- },
- "RemotePath": {
- "type": "string",
- "description": "The path in the StorageService which is associated with the LocalPath"
- },
- "ComputingServiceID": {
- "type": "string",
- "description": "The ID of the ComputingService"
- },
- "StorageServiceID": {
- "type": "string",
- "description": "The ID of the StorageService"
- }
- },
- "required": ["LocalPath","RemotePath","ComputingServiceID","StorageServiceID"]
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/resources/schema/UserDomain.json
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/resources/schema/UserDomain.json b/tools/job-monitor/src/main/resources/schema/UserDomain.json
deleted file mode 100644
index 7acda31..0000000
--- a/tools/job-monitor/src/main/resources/schema/UserDomain.json
+++ /dev/null
@@ -1,58 +0,0 @@
-{
- "$schema": "http://json-schema.org/draft-04/schema#",
- "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/UserDomain.json",
- "type": "object",
- "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json"}],
- "properties": {
- "Level": {
- "type": "integer",
- "description": "the number of hops to reach the root of the hierarchy of UserDomains"
- },
- "UserManagerID": {
- "type": "array",
- "description": "ID for the Endpoint of a Service managing users in this UserDomain",
- "items": {
- "type": "string"
- }
- },
- "Member": {
- "type": "array",
- "description": "Identifiers for users in this UserDomain",
- "items": {
- "type": "string"
- }
- },
- "PolicyID": {
- "type": "array",
- "description": "IDs for Policies associated with this UserDomain",
- "items": {
- "type": "string"
- }
- },
- "ChildDomainID": {
- "type": "array",
- "description": "IDs of UserDomains aggregated by this UserDomain",
- "items": {
- "type": "string"
- }
- },
- "ParentDomainID": {
- "type": "string",
- "description": "The ID of the UserDomain that this UserDomain participates in"
- },
- "AccessPolicyID": {
- "type": "array",
- "description": "IDs of AccessPolicies associated with this UserDomain",
- "items": {
- "type": "string"
- }
- },
- "MappingPolicyID": {
- "type": "array",
- "description": "IDs of MappingPolicies associated with this UserDomain",
- "items": {
- "type": "string"
- }
- }
- }
-}
[8/8] git commit: merging monitoring with gfac-core,
later this will be separated
Posted by la...@apache.org.
merging monitoring with gfac-core, later this will be separated
Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/b0230849
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/b0230849
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/b0230849
Branch: refs/heads/master
Commit: b02308493b0d9c9497ce25fac70da0aef910a822
Parents: 0364b65
Author: lahiru <la...@apache.org>
Authored: Wed Apr 23 15:42:00 2014 -0400
Committer: lahiru <la...@apache.org>
Committed: Wed Apr 23 15:42:00 2014 -0400
----------------------------------------------------------------------
.../main/resources/airavata-server.properties | 6 +-
modules/distribution/server/pom.xml | 10 -
.../org/apache/airavata/gfac/cpi/GFacImpl.java | 41 +--
.../gfac/monitor/AbstractActivityListener.java | 27 ++
.../AiravataExperimentStatusUpdator.java | 81 +++++
.../gfac/monitor/AiravataJobStatusUpdator.java | 145 ++++++++
.../gfac/monitor/AiravataTaskStatusUpdator.java | 113 ++++++
.../AiravataWorkflowNodeStatusUpdator.java | 112 ++++++
.../gfac/monitor/ExperimentIdentity.java | 36 ++
.../airavata/gfac/monitor/HostMonitorData.java | 69 ++++
.../airavata/gfac/monitor/JobIdentity.java | 39 +++
.../apache/airavata/gfac/monitor/MonitorID.java | 225 ++++++++++++
.../airavata/gfac/monitor/MonitorManager.java | 347 +++++++++++++++++++
.../airavata/gfac/monitor/TaskIdentity.java | 38 ++
.../airavata/gfac/monitor/UserMonitorData.java | 76 ++++
.../gfac/monitor/WorkflowNodeIdentity.java | 37 ++
.../command/ExperimentCancelRequest.java | 38 ++
.../gfac/monitor/command/TaskCancelRequest.java | 52 +++
.../monitor/core/AiravataAbstractMonitor.java | 46 +++
.../gfac/monitor/core/MessageParser.java | 43 +++
.../airavata/gfac/monitor/core/Monitor.java | 30 ++
.../airavata/gfac/monitor/core/PullMonitor.java | 64 ++++
.../airavata/gfac/monitor/core/PushMonitor.java | 60 ++++
.../gfac/monitor/event/MonitorPublisher.java | 47 +++
.../exception/AiravataMonitorException.java | 37 ++
.../gfac/monitor/impl/LocalJobMonitor.java | 59 ++++
.../monitor/impl/pull/qstat/QstatMonitor.java | 262 ++++++++++++++
.../impl/pull/qstat/ResourceConnection.java | 151 ++++++++
.../monitor/impl/push/amqp/AMQPMonitor.java | 263 ++++++++++++++
.../monitor/impl/push/amqp/BasicConsumer.java | 86 +++++
.../impl/push/amqp/JSONMessageParser.java | 78 +++++
.../impl/push/amqp/UnRegisterWorker.java | 68 ++++
.../state/AbstractStateChangeRequest.java | 27 ++
.../state/ExperimentStatusChangeRequest.java | 63 ++++
.../monitor/state/JobStatusChangeRequest.java | 74 ++++
.../gfac/monitor/state/JobStatusInfo.java | 48 +++
.../gfac/monitor/state/PublisherMessage.java | 26 ++
.../monitor/state/TaskStatusChangeRequest.java | 61 ++++
.../state/WorkflowNodeStatusChangeRequest.java | 63 ++++
.../monitor/state/impl/AmazonJobStatusInfo.java | 39 +++
.../monitor/state/impl/GridJobStatusInfo.java | 40 +++
.../gfac/monitor/util/AMQPConnectionUtil.java | 77 ++++
.../airavata/gfac/monitor/util/CommonUtils.java | 172 +++++++++
.../airavata/gfac/monitor/util/X509Helper.java | 161 +++++++++
.../airavata/gfac/provider/GFacProvider.java | 4 +-
.../gfac/provider/impl/AbstractProvider.java | 10 +-
.../gfac/provider/impl/GSISSHProvider.java | 3 -
.../src/main/resources/schema/AccessPolicy.json | 13 +
.../src/main/resources/schema/Activity.json | 31 ++
.../src/main/resources/schema/AdminDomain.json | 51 +++
.../schema/ApplicationEnvironment.json | 86 +++++
.../resources/schema/ApplicationHandle.json | 21 ++
.../src/main/resources/schema/Benchmark.json | 21 ++
.../resources/schema/ComputingActivity.json | 165 +++++++++
.../resources/schema/ComputingEndpoint.json | 44 +++
.../main/resources/schema/ComputingManager.json | 117 +++++++
.../main/resources/schema/ComputingService.json | 32 ++
.../main/resources/schema/ComputingShare.json | 182 ++++++++++
.../src/main/resources/schema/Contact.json | 32 ++
.../src/main/resources/schema/DataStore.json | 30 ++
.../src/main/resources/schema/Domain.json | 30 ++
.../src/main/resources/schema/Endpoint.json | 147 ++++++++
.../src/main/resources/schema/Entity.json | 35 ++
.../resources/schema/ExecutionEnvironment.json | 115 ++++++
.../src/main/resources/schema/Glue2.json | 246 +++++++++++++
.../src/main/resources/schema/Location.json | 47 +++
.../src/main/resources/schema/Manager.json | 28 ++
.../main/resources/schema/MappingPolicy.json | 13 +
.../src/main/resources/schema/Policy.json | 27 ++
.../src/main/resources/schema/Resource.json | 27 ++
.../src/main/resources/schema/Service.json | 75 ++++
.../src/main/resources/schema/Share.json | 45 +++
.../resources/schema/StorageAccessProtocol.json | 32 ++
.../main/resources/schema/StorageEndpoint.json | 8 +
.../main/resources/schema/StorageManager.json | 8 +
.../main/resources/schema/StorageService.json | 22 ++
.../schema/StorageServiceCapacity.json | 33 ++
.../src/main/resources/schema/StorageShare.json | 65 ++++
.../resources/schema/StorageShareCapacity.json | 33 ++
.../resources/schema/ToComputingService.json | 32 ++
.../main/resources/schema/ToStorageService.json | 25 ++
.../src/main/resources/schema/UserDomain.json | 58 ++++
.../apache/airavata/job/AMQPMonitorTest.java | 175 ++++++++++
.../job/QstatMonitorTestWithMyProxyAuth.java | 167 +++++++++
modules/gfac/gfac-monitor/pom.xml | 80 -----
.../job/monitor/AbstractActivityListener.java | 27 --
.../airavata/job/monitor/MonitorManager.java | 347 -------------------
.../command/ExperimentCancelRequest.java | 38 --
.../job/monitor/command/TaskCancelRequest.java | 52 ---
.../src/main/resources/PBSTemplate.xslt | 77 ----
.../src/main/resources/gsissh.properties | 26 --
.../airavata/job/monitor/AMQPMonitorTest.java | 144 --------
.../QstatMonitorTestWithMyProxyAuth.java | 165 ---------
.../src/test/resources/gsissh.properties | 26 --
.../src/test/resources/monitor.properties | 3 -
modules/gfac/gfac-ssh/pom.xml | 2 +-
.../gfac/handler/AdvancedSCPInputHandler.java | 13 +-
.../gfac/handler/AdvancedSCPOutputHandler.java | 19 +-
.../gfac/handler/SCPDirectorySetupHandler.java | 10 +
.../airavata/gfac/handler/SCPInputHandler.java | 11 +-
.../airavata/gfac/handler/SCPOutputHandler.java | 11 +-
.../gfac/provider/impl/SSHProvider.java | 13 +-
.../apache/airavata/gfac/util/GFACSSHUtils.java | 88 +++++
modules/gfac/pom.xml | 1 -
.../airavata-orchestrator-service/pom.xml | 7 +-
.../server/OrchestratorServerHandler.java | 136 ++------
.../src/test/resources/monitor.properties | 4 +-
modules/orchestrator/orchestrator-core/pom.xml | 5 -
.../core/context/OrchestratorContext.java | 2 +-
.../airavata/orchestrator/cpi/Orchestrator.java | 9 +-
.../cpi/impl/SimpleOrchestratorImpl.java | 142 +++++++-
.../orchestrator/core/NewOrchestratorTest.java | 20 +-
.../core/OrchestratorTestWithMyProxyAuth.java | 100 +++---
tools/job-monitor/pom.xml | 162 ---------
.../job/monitor/ExperimentIdentity.java | 36 --
.../airavata/job/monitor/HostMonitorData.java | 69 ----
.../airavata/job/monitor/JobIdentity.java | 39 ---
.../airavata/job/monitor/TaskIdentity.java | 38 --
.../airavata/job/monitor/UserMonitorData.java | 76 ----
.../job/monitor/WorkflowNodeIdentity.java | 37 --
.../monitor/core/AiravataAbstractMonitor.java | 46 ---
.../job/monitor/core/MessageParser.java | 47 ---
.../airavata/job/monitor/core/Monitor.java | 30 --
.../airavata/job/monitor/core/PullMonitor.java | 64 ----
.../airavata/job/monitor/core/PushMonitor.java | 61 ----
.../job/monitor/event/MonitorPublisher.java | 48 ---
.../exception/AiravataMonitorException.java | 37 --
.../job/monitor/impl/LocalJobMonitor.java | 59 ----
.../monitor/impl/pull/qstat/QstatMonitor.java | 262 --------------
.../impl/pull/qstat/ResourceConnection.java | 152 --------
.../job/monitor/impl/push/amqp/AMQPMonitor.java | 268 --------------
.../monitor/impl/push/amqp/BasicConsumer.java | 93 -----
.../impl/push/amqp/JSONMessageParser.java | 82 -----
.../impl/push/amqp/UnRegisterWorker.java | 68 ----
.../state/AbstractStateChangeRequest.java | 27 --
.../state/ExperimentStatusChangeRequest.java | 63 ----
.../monitor/state/JobStatusChangeRequest.java | 74 ----
.../job/monitor/state/JobStatusInfo.java | 48 ---
.../job/monitor/state/PublisherMessage.java | 26 --
.../monitor/state/TaskStatusChangeRequest.java | 61 ----
.../state/WorkflowNodeStatusChangeRequest.java | 63 ----
.../monitor/state/impl/AmazonJobStatusInfo.java | 39 ---
.../monitor/state/impl/GridJobStatusInfo.java | 40 ---
.../job/monitor/util/AMQPConnectionUtil.java | 78 -----
.../airavata/job/monitor/util/CommonUtils.java | 174 ----------
.../airavata/job/monitor/util/X509Helper.java | 170 ---------
.../src/main/resources/PBSTemplate.xslt | 77 ----
.../src/main/resources/gsissh.properties | 26 --
.../src/main/resources/schema/AccessPolicy.json | 13 -
.../src/main/resources/schema/Activity.json | 31 --
.../src/main/resources/schema/AdminDomain.json | 51 ---
.../schema/ApplicationEnvironment.json | 86 -----
.../resources/schema/ApplicationHandle.json | 21 --
.../src/main/resources/schema/Benchmark.json | 21 --
.../resources/schema/ComputingActivity.json | 165 ---------
.../resources/schema/ComputingEndpoint.json | 44 ---
.../main/resources/schema/ComputingManager.json | 117 -------
.../main/resources/schema/ComputingService.json | 32 --
.../main/resources/schema/ComputingShare.json | 182 ----------
.../src/main/resources/schema/Contact.json | 32 --
.../src/main/resources/schema/DataStore.json | 30 --
.../src/main/resources/schema/Domain.json | 30 --
.../src/main/resources/schema/Endpoint.json | 147 --------
.../src/main/resources/schema/Entity.json | 35 --
.../resources/schema/ExecutionEnvironment.json | 115 ------
.../src/main/resources/schema/Glue2.json | 246 -------------
.../src/main/resources/schema/Location.json | 47 ---
.../src/main/resources/schema/Manager.json | 28 --
.../main/resources/schema/MappingPolicy.json | 13 -
.../src/main/resources/schema/Policy.json | 27 --
.../src/main/resources/schema/Resource.json | 27 --
.../src/main/resources/schema/Service.json | 75 ----
.../src/main/resources/schema/Share.json | 45 ---
.../resources/schema/StorageAccessProtocol.json | 32 --
.../main/resources/schema/StorageEndpoint.json | 8 -
.../main/resources/schema/StorageManager.json | 8 -
.../main/resources/schema/StorageService.json | 22 --
.../schema/StorageServiceCapacity.json | 33 --
.../src/main/resources/schema/StorageShare.json | 65 ----
.../resources/schema/StorageShareCapacity.json | 33 --
.../resources/schema/ToComputingService.json | 32 --
.../main/resources/schema/ToStorageService.json | 25 --
.../src/main/resources/schema/UserDomain.json | 58 ----
.../apache/airavata/job/AMQPMonitorTest.java | 179 ----------
.../job/QstatMonitorTestWithMyProxyAuth.java | 168 ---------
.../src/test/resources/gsissh.properties | 26 --
.../src/test/resources/monitor.properties | 3 -
tools/pom.xml | 1 -
188 files changed, 6288 insertions(+), 6355 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/configuration/server/src/main/resources/airavata-server.properties
----------------------------------------------------------------------
diff --git a/modules/configuration/server/src/main/resources/airavata-server.properties b/modules/configuration/server/src/main/resources/airavata-server.properties
index 4a65a71..7169ea8 100644
--- a/modules/configuration/server/src/main/resources/airavata-server.properties
+++ b/modules/configuration/server/src/main/resources/airavata-server.properties
@@ -256,13 +256,13 @@ TwoPhase=true
###---------------------------Monitoring module Configurations---------------------------###
#This will be the primary monitoring tool which runs in airavata, in future there will be multiple monitoring
#mechanisms and one would be able to start a monitor
-monitors=org.apache.airavata.job.monitor.impl.pull.qstat.QstatMonitor,org.apache.airavata.job.monitor.impl.LocalJobMonitor
-#,org.apache.airavata.job.monitor.impl.push.amqp.AMQPMonitor
+monitors=org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor,org.apache.airavata.gfac.monitor.impl.LocalJobMonitor
+#,org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor
#This is the amqp related configuration and this lists down the Rabbitmq host, this is an xsede specific configuration
amqp.hosts=info1.dyn.teragrid.org,info2.dyn.teragrid.org
proxy.file.path=/Users/lahirugunathilake/Downloads/x509up_u503876
connection.name=xsede
-activity.listeners=org.apache.airavata.job.monitor.AiravataJobStatusUpdator,org.apache.airavata.job.monitor.AiravataTaskStatusUpdator,org.apache.airavata.job.monitor.AiravataWorkflowNodeStatusUpdator,org.apache.airavata.job.monitor.AiravataExperimentStatusUpdator
+activity.listeners=org.apache.airavata.gfac.monitor.AiravataJobStatusUpdator,org.apache.airavata.gfac.monitor.AiravataTaskStatusUpdator,org.apache.airavata.gfac.monitor.AiravataWorkflowNodeStatusUpdator,org.apache.airavata.gfac.monitor.AiravataExperimentStatusUpdator
###---------------------------Orchestrator module Configurations---------------------------###
job.submitter=org.apache.airavata.orchestrator.core.impl.EmbeddedGFACJobSubmitter
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/distribution/server/pom.xml
----------------------------------------------------------------------
diff --git a/modules/distribution/server/pom.xml b/modules/distribution/server/pom.xml
index 6629860..0ff7f4e 100644
--- a/modules/distribution/server/pom.xml
+++ b/modules/distribution/server/pom.xml
@@ -331,16 +331,6 @@
</dependency>
<dependency>
<groupId>org.apache.airavata</groupId>
- <artifactId>job-monitor-tool</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>gfac-monitor</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
<artifactId>airavata-api-server</artifactId>
<version>${project.version}</version>
</dependency>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
index 064c9ba..14ea519 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/cpi/GFacImpl.java
@@ -51,7 +51,6 @@ import org.apache.airavata.gfac.notification.listeners.WorkflowTrackingListener;
import org.apache.airavata.gfac.provider.GFacProvider;
import org.apache.airavata.gfac.scheduler.HostScheduler;
import org.apache.airavata.gfac.utils.GFacUtils;
-import org.apache.airavata.gfac.context.security.SSHSecurityContext;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.gsi.ssh.api.ServerInfo;
@@ -64,10 +63,10 @@ import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthentica
import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
import org.apache.airavata.gsi.ssh.util.CommonUtils;
-import org.apache.airavata.job.monitor.AbstractActivityListener;
-import org.apache.airavata.job.monitor.MonitorManager;
-import org.apache.airavata.job.monitor.command.ExperimentCancelRequest;
-import org.apache.airavata.job.monitor.command.TaskCancelRequest;
+import org.apache.airavata.gfac.monitor.AbstractActivityListener;
+import org.apache.airavata.gfac.monitor.MonitorManager;
+import org.apache.airavata.gfac.monitor.command.ExperimentCancelRequest;
+import org.apache.airavata.gfac.monitor.command.TaskCancelRequest;
import org.apache.airavata.model.workspace.experiment.DataObjectType;
import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.TaskDetails;
@@ -451,41 +450,9 @@ public class GFacImpl implements GFac, AbstractActivityListener {
// if (this.configuration.getAmazonSecurityContext() != null) {
// jobExecutionContext.addSecurityContext(AmazonSecurityContext.AMAZON_SECURITY_CONTEXT,
// this.configuration.getAmazonSecurityContext());
- } else if (registeredHost.getType() instanceof SSHHostType) {
- String sshUserName = configurationProperties.getProperty(Constants.SSH_USER_NAME);
- String sshPrivateKey = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY);
- String sshPrivateKeyPass = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS);
- String sshPassword = configurationProperties.getProperty(Constants.SSH_PASSWORD);
- String sshPublicKey = configurationProperties.getProperty(Constants.SSH_PUBLIC_KEY);
- SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
- AuthenticationInfo authenticationInfo = null;
- // we give higher preference to the password over keypair ssh authentication
- if (sshPassword != null) {
- authenticationInfo = new DefaultPasswordAuthenticationInfo(sshPassword);
- } else {
- authenticationInfo = new DefaultPublicKeyFileAuthentication(sshPublicKey, sshPrivateKey, sshPrivateKeyPass);
- }
- ServerInfo serverInfo = new ServerInfo(sshUserName, registeredHost.getType().getHostAddress());
-
- Cluster pbsCluster = null;
- try {
- String installedParentPath = "/";
- if(((SSHHostType) registeredHost.getType()).getHpcResource()){
- installedParentPath = ((HpcApplicationDeploymentType)
- jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
- }
- pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
- CommonUtils.getPBSJobManager(installedParentPath));
- } catch (SSHApiException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- sshSecurityContext.setPbsCluster(pbsCluster);
- sshSecurityContext.setUsername(sshUserName);
- jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, sshSecurityContext);
}
}
- @Override
public void setup(Object... configurations) {
for (Object configuration : configurations) {
if (configuration instanceof MonitorManager){
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AbstractActivityListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AbstractActivityListener.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AbstractActivityListener.java
new file mode 100644
index 0000000..63f89df
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AbstractActivityListener.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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;
+
+
+public interface AbstractActivityListener {
+ public void setup(Object... configurations);
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataExperimentStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataExperimentStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataExperimentStatusUpdator.java
new file mode 100644
index 0000000..a70b14f
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataExperimentStatusUpdator.java
@@ -0,0 +1,81 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ *
+*/
+package org.apache.airavata.gfac.monitor;
+
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.monitor.state.ExperimentStatusChangeRequest;
+import org.apache.airavata.model.workspace.experiment.Experiment;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+
+public class AiravataExperimentStatusUpdator implements AbstractActivityListener {
+ private final static Logger logger = LoggerFactory.getLogger(AiravataExperimentStatusUpdator.class);
+
+ private Registry airavataRegistry;
+
+ public Registry getAiravataRegistry() {
+ return airavataRegistry;
+ }
+
+ public void setAiravataRegistry(Registry airavataRegistry) {
+ this.airavataRegistry = airavataRegistry;
+ }
+
+ @Subscribe
+ public void updateRegistry(ExperimentStatusChangeRequest experimentStatus) {
+ ExperimentState state = experimentStatus.getState();
+ if (state != null) {
+ try {
+ String experimentID = experimentStatus.getIdentity().getExperimentID();
+ updateExperimentStatus(experimentID, state);
+ } catch (Exception e) {
+ logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ public void updateExperimentStatus(String experimentId, ExperimentState state) throws Exception {
+ Experiment details = (Experiment)airavataRegistry.get(DataType.EXPERIMENT, experimentId);
+ if(details == null) {
+ details = new Experiment();
+ details.setExperimentID(experimentId);
+ }
+ org.apache.airavata.model.workspace.experiment.ExperimentStatus status = new org.apache.airavata.model.workspace.experiment.ExperimentStatus();
+ status.setExperimentState(state);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ details.setExperimentStatus(status);
+ airavataRegistry.update(DataType.EXPERIMENT, details, experimentId);
+ }
+
+ @Override
+ public void setup(Object... configurations) {
+ for (Object configuration : configurations) {
+ if (configuration instanceof Registry){
+ this.airavataRegistry=(Registry)configuration;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataJobStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataJobStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataJobStatusUpdator.java
new file mode 100644
index 0000000..99c8733
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataJobStatusUpdator.java
@@ -0,0 +1,145 @@
+/*
+ *
+ * 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 com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.monitor.state.TaskStatusChangeRequest;
+import org.apache.airavata.model.workspace.experiment.JobDetails;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.apache.airavata.model.workspace.experiment.TaskState;
+import org.apache.airavata.registry.cpi.CompositeIdentifier;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Calendar;
+import java.util.concurrent.BlockingQueue;
+
+public class AiravataJobStatusUpdator implements AbstractActivityListener {
+ private final static Logger logger = LoggerFactory.getLogger(AiravataJobStatusUpdator.class);
+
+ private Registry airavataRegistry;
+
+ private MonitorPublisher monitorPublisher;
+
+ private BlockingQueue<MonitorID> jobsToMonitor;
+
+ public Registry getAiravataRegistry() {
+ return airavataRegistry;
+ }
+
+ public void setAiravataRegistry(Registry airavataRegistry) {
+ this.airavataRegistry = airavataRegistry;
+ }
+
+ public BlockingQueue<MonitorID> getJobsToMonitor() {
+ return jobsToMonitor;
+ }
+
+ public void setJobsToMonitor(BlockingQueue<MonitorID> jobsToMonitor) {
+ this.jobsToMonitor = jobsToMonitor;
+ }
+
+ @Subscribe
+ public void updateRegistry(JobStatusChangeRequest jobStatus) {
+ /* 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.getIdentity().getTaskId();
+ String jobID = jobStatus.getIdentity().getJobId();
+ updateJobStatus(taskID, jobID, state);
+ } catch (Exception e) {
+ logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+ }
+ logger.info("Job ID:" + jobStatus.getIdentity().getJobId() + " is "+state.toString());
+ switch (state) {
+ case COMPLETE: case UNKNOWN: case CANCELED:case FAILED:case SUSPENDED:
+ jobsToMonitor.remove(jobStatus.getMonitorID());
+ break;
+ default:
+ break;
+ }
+ }
+ }
+
+ @Subscribe
+ public void setupTaskStatus(JobStatusChangeRequest jobStatus){
+ TaskState state=TaskState.UNKNOWN;
+ switch(jobStatus.getState()){
+ case ACTIVE:
+ state=TaskState.EXECUTING; break;
+ case CANCELED:
+ state=TaskState.CANCELED; break;
+ case COMPLETE:
+ state=TaskState.COMPLETED; break;
+ case FAILED:
+ state=TaskState.FAILED; 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:
+ break;
+ }
+ logger.debug("Publishing Task Status "+state.toString());
+ monitorPublisher.publish(new TaskStatusChangeRequest(jobStatus.getIdentity(),state));
+ }
+
+ public void updateJobStatus(String taskId, String jobID, JobState state) throws Exception {
+ CompositeIdentifier ids = new CompositeIdentifier(taskId, jobID);
+ JobDetails details = (JobDetails)airavataRegistry.get(DataType.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();
+ status.setJobState(state);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ details.setJobStatus(status);
+ details.setJobID(jobID);
+ airavataRegistry.update(DataType.JOB_DETAIL, details, ids);
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void setup(Object... configurations) {
+ for (Object configuration : configurations) {
+ if (configuration instanceof Registry){
+ this.airavataRegistry=(Registry)configuration;
+ } else if (configuration instanceof BlockingQueue<?>){
+ this.jobsToMonitor=(BlockingQueue<MonitorID>) configuration;
+ } else if (configuration instanceof MonitorPublisher){
+ this.monitorPublisher=(MonitorPublisher) configuration;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataTaskStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataTaskStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataTaskStatusUpdator.java
new file mode 100644
index 0000000..e8dd7a0
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataTaskStatusUpdator.java
@@ -0,0 +1,113 @@
+/*
+ *
+ * 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 com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.state.TaskStatusChangeRequest;
+import org.apache.airavata.gfac.monitor.state.WorkflowNodeStatusChangeRequest;
+import org.apache.airavata.model.workspace.experiment.TaskDetails;
+import org.apache.airavata.model.workspace.experiment.TaskState;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
+import org.apache.airavata.registry.cpi.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+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;
+
+ public Registry getAiravataRegistry() {
+ return airavataRegistry;
+ }
+
+ public void setAiravataRegistry(Registry airavataRegistry) {
+ this.airavataRegistry = airavataRegistry;
+ }
+
+ @Subscribe
+ public void updateRegistry(TaskStatusChangeRequest taskStatus) {
+ TaskState state = taskStatus.getState();
+ if (state != null) {
+ try {
+ String taskID = taskStatus.getIdentity().getTaskId();
+ updateTaskStatus(taskID, state);
+ } catch (Exception e) {
+ logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ @Subscribe
+ public void setupWorkflowNodeStatus(TaskStatusChangeRequest taskStatus){
+ 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:
+ break;
+ }
+ logger.debug("Publishing Experiment Status "+state.toString());
+ monitorPublisher.publish(new WorkflowNodeStatusChangeRequest(taskStatus.getIdentity(),state));
+ }
+
+ public void updateTaskStatus(String taskId, TaskState state) throws Exception {
+ TaskDetails details = (TaskDetails)airavataRegistry.get(DataType.TASK_DETAIL, taskId);
+ if(details == null) {
+ details = new TaskDetails();
+ details.setTaskID(taskId);
+ }
+ org.apache.airavata.model.workspace.experiment.TaskStatus status = new org.apache.airavata.model.workspace.experiment.TaskStatus();
+ status.setExecutionState(state);
+ status.setTimeOfStateChange(Calendar.getInstance().getTimeInMillis());
+ details.setTaskStatus(status);
+ airavataRegistry.update(DataType.TASK_DETAIL, details, taskId);
+ }
+
+ @Override
+ 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;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataWorkflowNodeStatusUpdator.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataWorkflowNodeStatusUpdator.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataWorkflowNodeStatusUpdator.java
new file mode 100644
index 0000000..2375d72
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/AiravataWorkflowNodeStatusUpdator.java
@@ -0,0 +1,112 @@
+/*
+ *
+ * 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 com.google.common.eventbus.Subscribe;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.state.ExperimentStatusChangeRequest;
+import org.apache.airavata.gfac.monitor.state.WorkflowNodeStatusChangeRequest;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+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.DataType;
+import org.apache.airavata.registry.cpi.Registry;
+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;
+
+ public Registry getAiravataRegistry() {
+ return airavataRegistry;
+ }
+
+ public void setAiravataRegistry(Registry airavataRegistry) {
+ this.airavataRegistry = airavataRegistry;
+ }
+
+ @Subscribe
+ public void updateRegistry(WorkflowNodeStatusChangeRequest workflowNodeStatus) {
+ WorkflowNodeState state = workflowNodeStatus.getState();
+ if (state != null) {
+ try {
+ String workflowNodeID = workflowNodeStatus.getIdentity().getWorkflowNodeID();
+ updateWorkflowNodeStatus(workflowNodeID, state);
+ } catch (Exception e) {
+ logger.error("Error persisting data" + e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ @Subscribe
+ public void setupExperimentStatus(WorkflowNodeStatusChangeRequest nodeStatus){
+ ExperimentState state=ExperimentState.UNKNOWN;
+ switch(nodeStatus.getState()){
+ case CANCELED:
+ state=ExperimentState.CANCELED; break;
+ case COMPLETED:
+ state=ExperimentState.COMPLETED; break;
+ case INVOKED:
+ state=ExperimentState.LAUNCHED; break;
+ case FAILED:
+ state=ExperimentState.FAILED; break;
+ case EXECUTING:
+ state=ExperimentState.EXECUTING; break;
+ case CANCELING:
+ state=ExperimentState.CANCELING; break;
+ default:
+ break;
+ }
+ logger.debug("Publishing Experiment Status "+state.toString());
+ monitorPublisher.publish(new ExperimentStatusChangeRequest(nodeStatus.getIdentity(),state));
+ }
+
+ public void updateWorkflowNodeStatus(String workflowNodeId, WorkflowNodeState state) throws Exception {
+ WorkflowNodeDetails details = (WorkflowNodeDetails)airavataRegistry.get(DataType.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(DataType.WORKFLOW_NODE_DETAIL, details, workflowNodeId);
+ }
+
+ @Override
+ 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;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/ExperimentIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/ExperimentIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/ExperimentIdentity.java
new file mode 100644
index 0000000..ba8efeb
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/ExperimentIdentity.java
@@ -0,0 +1,36 @@
+/*
+ *
+ * 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;
+
+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/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java
new file mode 100644
index 0000000..e57087d
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/HostMonitorData.java
@@ -0,0 +1,69 @@
+/*
+ *
+ * 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.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class HostMonitorData {
+ private HostDescription host;
+
+ private List<MonitorID> monitorIDs;
+
+ public HostMonitorData(HostDescription host) {
+ this.host = host;
+ monitorIDs = new ArrayList<MonitorID>();
+ }
+
+ public HostMonitorData(HostDescription host, List<MonitorID> monitorIDs) {
+ this.host = host;
+ this.monitorIDs = monitorIDs;
+ }
+
+ public HostDescription getHost() {
+ return host;
+ }
+
+ public void setHost(HostDescription host) {
+ this.host = host;
+ }
+
+ 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);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/JobIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/JobIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/JobIdentity.java
new file mode 100644
index 0000000..84c4a55
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/JobIdentity.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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;
+
+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/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/MonitorID.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/MonitorID.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/MonitorID.java
new file mode 100644
index 0000000..c022bef
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/MonitorID.java
@@ -0,0 +1,225 @@
+/*
+ *
+ * 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.commons.gfac.type.HostDescription;
+import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.util.Date;
+import java.util.Map;
+
+/*
+This is the object which contains the data to identify a particular
+Job to start the monitoring
+*/
+public class MonitorID {
+ private final static Logger logger = LoggerFactory.getLogger(MonitorID.class);
+
+ private String userName;
+
+ private Timestamp jobStartedTime;
+
+ private Timestamp lastMonitored;
+
+ private HostDescription host;
+
+ private AuthenticationInfo authenticationInfo = null;
+
+ private Map<String, Object> parameters;
+
+ private String experimentID;
+
+ private String workflowNodeID;
+
+ private String taskID;
+
+ private String jobID;
+
+ private int failedCount = 0;
+
+ private JobState state;
+
+ public MonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID, String experimentID, String userName) {
+ this.host = host;
+ this.jobStartedTime = new Timestamp((new Date()).getTime());
+ this.userName = userName;
+ this.jobID = jobID;
+ this.taskID = taskID;
+ this.experimentID = experimentID;
+ }
+
+ public MonitorID(HostDescription host, String jobID,String taskID, String workflowNodeID, String experimentID, String userName,AuthenticationInfo authenticationInfo) {
+ this.host = host;
+ this.jobStartedTime = new Timestamp((new Date()).getTime());
+ this.authenticationInfo = authenticationInfo;
+ this.userName = userName;
+ // if we give myproxyauthenticationInfo, so we try to use myproxy user as the user
+ if(this.authenticationInfo != null){
+ if(this.authenticationInfo instanceof MyProxyAuthenticationInfo){
+ this.userName = ((MyProxyAuthenticationInfo)this.authenticationInfo).getUserName();
+ }
+ }
+ this.jobID = jobID;
+ this.taskID = taskID;
+ this.experimentID = experimentID;
+ }
+ public HostDescription getHost() {
+ return host;
+ }
+
+ public void setHost(HostDescription host) {
+ this.host = host;
+ }
+
+ public Timestamp getLastMonitored() {
+ return lastMonitored;
+ }
+
+ public void setLastMonitored(Timestamp lastMonitored) {
+ this.lastMonitored = lastMonitored;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getJobID() {
+ return jobID;
+ }
+
+ public void setJobID(String jobID) {
+ this.jobID = jobID;
+ }
+
+ public Timestamp getJobStartedTime() {
+ return jobStartedTime;
+ }
+
+ public void setJobStartedTime(Timestamp jobStartedTime) {
+ this.jobStartedTime = jobStartedTime;
+ }
+
+ public AuthenticationInfo getAuthenticationInfo() {
+ return authenticationInfo;
+ }
+
+ public void setAuthenticationInfo(AuthenticationInfo authenticationInfo) {
+ this.authenticationInfo = authenticationInfo;
+ }
+
+ public void addParameter(String key,Object value) {
+ this.parameters.put(key, value);
+ }
+
+ public Object getParameter(String key) {
+ return this.parameters.get(key);
+ }
+
+ public Map<String, Object> getParameters() {
+ return parameters;
+ }
+
+ public void setParameters(Map<String, Object> parameters) {
+ this.parameters = parameters;
+ }
+
+ 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 int getFailedCount() {
+ return failedCount;
+ }
+
+ public void setFailedCount(int failedCount) {
+ this.failedCount = failedCount;
+ }
+
+ public JobState getStatus() {
+ return state;
+ }
+
+ public void setStatus(JobState status) {
+ // this logic is going to be useful for fast finishing jobs
+ // because in some machines job state vanishes quicckly when the job is done
+ // during that case job state comes as unknown.so we handle it here.
+ if (this.state != null && status.equals(JobState.UNKNOWN)) {
+ if (getFailedCount() > 2) {
+ switch (this.state) {
+ case ACTIVE:
+ this.state = JobState.COMPLETE;
+ break;
+ case QUEUED:
+ this.state = JobState.COMPLETE;
+ break;
+ }
+ } else {
+ try {
+ // when state becomes unknown we sleep for a while
+ Thread.sleep(10000);
+ } catch (InterruptedException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ setFailedCount(getFailedCount() + 1);
+ }
+ } else {
+ // normal scenario
+ this.state = status;
+ }
+ }
+
+ public String getWorkflowNodeID() {
+ return workflowNodeID;
+ }
+
+ public void setWorkflowNodeID(String workflowNodeID) {
+ this.workflowNodeID = workflowNodeID;
+ }
+
+// public String getWorkflowNodeID() {
+// return workflowNodeID;
+// }
+//
+// public void setWorkflowNodeID(String workflowNodeID) {
+// this.workflowNodeID = workflowNodeID;
+// }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/MonitorManager.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/MonitorManager.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/MonitorManager.java
new file mode 100644
index 0000000..b703a0a
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/MonitorManager.java
@@ -0,0 +1,347 @@
+/*
+ *
+ * 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 com.google.common.eventbus.EventBus;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.gfac.monitor.core.Monitor;
+import org.apache.airavata.gfac.monitor.core.PullMonitor;
+import org.apache.airavata.gfac.monitor.core.PushMonitor;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.gfac.monitor.impl.LocalJobMonitor;
+import org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor;
+import org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor;
+import org.apache.airavata.gfac.monitor.util.CommonUtils;
+import org.apache.airavata.persistance.registry.jpa.impl.RegistryImpl;
+import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.schemas.gfac.GlobusHostType;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.apache.airavata.schemas.gfac.SSHHostType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+/*
+this is the manager class for monitoring system of airavata,
+This simply handle the monitoring flow of the system.
+Keeps available jobs to monitor in a queue and once they are done
+remove them from the queue, this will be done by AiravataJobUpdator.
+ */
+public class MonitorManager {
+ private final static Logger logger = LoggerFactory.getLogger(MonitorManager.class);
+
+ private final static String ACTIVITY_LISTENERS = "activity.listeners";
+
+ private List<PullMonitor> pullMonitors; //todo though we have a List we only support one at a time
+
+ private List<PushMonitor> pushMonitors; //todo we need to support multiple monitors dynamically
+
+ private BlockingQueue<UserMonitorData> pullQueue;
+
+ private BlockingQueue<MonitorID> pushQueue;
+
+ private BlockingQueue<MonitorID> localJobQueue;
+
+ private BlockingQueue<MonitorID> finishQueue;
+
+ private MonitorPublisher monitorPublisher;
+
+ private Monitor localJobMonitor;
+
+ private Registry registry;
+
+ /**
+ * This will initialize the major monitoring system.
+ */
+ public MonitorManager() {
+ this(new RegistryImpl());
+ }
+
+ public MonitorManager(Registry registry) {
+ pullMonitors = new ArrayList<PullMonitor>();
+ pushMonitors = new ArrayList<PushMonitor>();
+ pullQueue = new LinkedBlockingQueue<UserMonitorData>();
+ pushQueue = new LinkedBlockingQueue<MonitorID>();
+ finishQueue = new LinkedBlockingQueue<MonitorID>();
+ localJobQueue = new LinkedBlockingQueue<MonitorID>();
+ monitorPublisher = new MonitorPublisher(new EventBus());
+ this.registry = registry;
+ loadActivityMonitors();
+ }
+
+ private void loadActivityMonitors(){
+ try {
+ String activityListenersString = ServerSettings.getSetting(ACTIVITY_LISTENERS);
+ if (activityListenersString!=null){
+ String[] activityListenerClasses = activityListenersString.split(",");
+ for (String activityListenerClassName : activityListenerClasses) {
+ try {
+ activityListenerClassName=activityListenerClassName.trim();
+ Class<?> classInstance = MonitorManager.class
+ .getClassLoader().loadClass(activityListenerClassName);
+ AbstractActivityListener monitor=(AbstractActivityListener)classInstance.newInstance();
+ registerListener(monitor);
+ } catch (ClassNotFoundException e) {
+ logger.error("Error while locating activity monitor implementation \""+activityListenerClassName+"\"!!!",e);
+ } catch (InstantiationException e) {
+ logger.error("Error while initiating activity monitor instance \""+activityListenerClassName+"\"!!!",e);
+ } catch (IllegalAccessException e) {
+ logger.error("Error while initiating activity monitor instance \""+activityListenerClassName+"\"!!!",e);
+ } catch (ClassCastException e){
+ logger.error("Invalid activity monitor \""+activityListenerClassName+"\"!!!",e);
+ }
+ }
+ }
+ } catch (ApplicationSettingsException e1) {
+ logger.warn("Error in reading activity monitors!!!", e1);
+ }
+
+ }
+ /**
+ * This can be use to add an empty AMQPMonitor object to the monitor system
+ * and tihs method will take care of the initialization
+ * todo may be we need to move this to some other class
+ * @param monitor
+ */
+ public void addAMQPMonitor(AMQPMonitor monitor) {
+ monitor.setPublisher(this.getMonitorPublisher());
+ monitor.setFinishQueue(this.getFinishQueue());
+ monitor.setRunningQueue(this.getPushQueue());
+ addPushMonitor(monitor);
+ }
+
+
+ /**
+ * This can be use to add an empty AMQPMonitor object to the monitor system
+ * and tihs method will take care of the initialization
+ * todo may be we need to move this to some other class
+ * @param monitor
+ */
+ public void addLocalMonitor(LocalJobMonitor monitor) {
+ monitor.setPublisher(this.getMonitorPublisher());
+ monitor.setJobQueue(this.getLocalJobQueue());
+ localJobMonitor = monitor;
+ }
+
+ /**
+ * This can be used to adda a QstatMonitor and it will take care of
+ * the initialization of QstatMonitor
+ * //todo may be we need to move this to some other class
+ * @param qstatMonitor
+ */
+ public void addQstatMonitor(QstatMonitor qstatMonitor) {
+ qstatMonitor.setPublisher(this.getMonitorPublisher());
+ qstatMonitor.setQueue(this.getPullQueue());
+ addPullMonitor(qstatMonitor);
+
+ }
+
+ /**
+ * To deal with the statuses users can write their own listener and implement their own logic
+ *
+ * @param listener Any class can be written and if you want the JobStatus object to be taken from the bus, just
+ * have to put @subscribe as an annotation to your method to recieve the JobStatus object from the bus.
+ */
+ public void registerListener(Object listener) {
+ monitorPublisher.registerListener(listener);
+ if (listener instanceof AbstractActivityListener){
+ ((AbstractActivityListener)listener).setup(registry, getFinishQueue(), getMonitorPublisher(), this);
+ }
+ }
+
+ public void registerListener(AbstractActivityListener listener) {
+ registerListener((Object)listener);
+ }
+
+ /**
+ * To remove listeners of changing statuses
+ *
+ * @param listener Any class can be written and if you want the JobStatus object to be taken from the bus, just
+ * have to put @subscribe as an annotation to your method to recieve the JobStatus object from the bus.
+ */
+ public void unregisterListener(Object listener) {
+ monitorPublisher.unregisterListener(listener);
+ }
+
+ /**
+ * todo write
+ *
+ * @param monitor
+ */
+ public void addPushMonitor(PushMonitor monitor) {
+ pushMonitors.add(monitor);
+ }
+
+ /**
+ * todo write
+ *
+ * @param monitor
+ */
+ public void addPullMonitor(PullMonitor monitor) {
+ pullMonitors.add(monitor);
+ }
+
+
+ /**
+ * Adding this method will trigger the thread in launchMonitor and notify it
+ * This is going to be useful during the startup of the launching process
+ * @param monitorID
+ * @throws AiravataMonitorException
+ * @throws InterruptedException
+ */
+ public void addAJobToMonitor(MonitorID monitorID) throws AiravataMonitorException, InterruptedException {
+
+ if (monitorID.getHost().getType() instanceof GsisshHostType) {
+ GsisshHostType host = (GsisshHostType) monitorID.getHost().getType();
+ if ("".equals(host.getMonitorMode()) || host.getMonitorMode() == null
+ || Constants.PULL.equals(host.getMonitorMode())) {
+ CommonUtils.addMonitortoQueue(pullQueue, monitorID);
+ } else if (Constants.PUSH.equals(host.getMonitorMode())) {
+ pushQueue.put(monitorID);
+ finishQueue.put(monitorID);
+ }
+ } else if(monitorID.getHost().getType() instanceof GlobusHostType){
+ logger.error("Monitoring does not support GlubusHostType resources");
+ } else if(monitorID.getHost().getType() instanceof SSHHostType) {
+ logger.error("Monitoring does not support GlubusHostType resources");
+ localJobQueue.add(monitorID);
+ } else {
+ // we assume this is a type of localJobtype
+ localJobQueue.add(monitorID);
+ }
+ }
+
+ /**
+ * This method should be invoked before adding any elements to monitorQueue
+ * In this method we assume that we give higher preference to Push
+ * Monitorig mechanism if there's any configured, otherwise Pull
+ * monitoring will be launched.
+ * Ex: If there's a reasource which doesn't support Push, we have
+ * to live with Pull MOnitoring.
+ *
+ * @throws AiravataMonitorException
+ */
+ public void launchMonitor() throws AiravataMonitorException {
+ //no push monitor is configured so we launch pull monitor
+ if(localJobMonitor != null){
+ (new Thread(localJobMonitor)).start();
+ }
+
+ for (PullMonitor monitor : pullMonitors) {
+ (new Thread(monitor)).start();
+ }
+
+ //todo fix this
+ for (PushMonitor monitor : pushMonitors) {
+ (new Thread(monitor)).start();
+ }
+ }
+
+ /**
+ * This method should be invoked before adding any elements to monitorQueue
+ * In this method we assume that we give higher preference to Push
+ * Monitorig mechanism if there's any configured, otherwise Pull
+ * monitoring will be launched.
+ * Ex: If there's a reasource which doesn't support Push, we have
+ * to live with Pull MOnitoring.
+ *
+ * @throws AiravataMonitorException
+ */
+ public void stopMonitor() throws AiravataMonitorException {
+ //no push monitor is configured so we launch pull monitor
+ if(localJobMonitor != null){
+ (new Thread(localJobMonitor)).interrupt();
+ }
+
+ for (PullMonitor monitor : pullMonitors) {
+ (new Thread(monitor)).interrupt();
+ }
+
+ //todo fix this
+ for (PushMonitor monitor : pushMonitors) {
+ (new Thread(monitor)).interrupt();
+ }
+ }
+ /* getter setters for the private variables */
+
+ public List<PullMonitor> getPullMonitors() {
+ return pullMonitors;
+ }
+
+ public void setPullMonitors(List<PullMonitor> pullMonitors) {
+ this.pullMonitors = pullMonitors;
+ }
+
+ public List<PushMonitor> getPushMonitors() {
+ return pushMonitors;
+ }
+
+ public void setPushMonitors(List<PushMonitor> pushMonitors) {
+ this.pushMonitors = pushMonitors;
+ }
+
+ public BlockingQueue<UserMonitorData> getPullQueue() {
+ return pullQueue;
+ }
+
+ public void setPullQueue(BlockingQueue<UserMonitorData> pullQueue) {
+ this.pullQueue = pullQueue;
+ }
+
+ public MonitorPublisher getMonitorPublisher() {
+ return monitorPublisher;
+ }
+
+ public void setMonitorPublisher(MonitorPublisher monitorPublisher) {
+ this.monitorPublisher = monitorPublisher;
+ }
+
+ public BlockingQueue<MonitorID> getFinishQueue() {
+ return finishQueue;
+ }
+
+ public void setFinishQueue(BlockingQueue<MonitorID> finishQueue) {
+ this.finishQueue = finishQueue;
+ }
+
+ public BlockingQueue<MonitorID> getPushQueue() {
+ return pushQueue;
+ }
+
+ public void setPushQueue(BlockingQueue<MonitorID> pushQueue) {
+ this.pushQueue = pushQueue;
+ }
+
+ public BlockingQueue<MonitorID> getLocalJobQueue() {
+ return localJobQueue;
+ }
+
+ public void setLocalJobQueue(BlockingQueue<MonitorID> localJobQueue) {
+ this.localJobQueue = localJobQueue;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/TaskIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/TaskIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/TaskIdentity.java
new file mode 100644
index 0000000..c6d386e
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/TaskIdentity.java
@@ -0,0 +1,38 @@
+/*
+ *
+ * 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;
+
+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/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/UserMonitorData.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/UserMonitorData.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/UserMonitorData.java
new file mode 100644
index 0000000..022d17c
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/UserMonitorData.java
@@ -0,0 +1,76 @@
+/*
+ *
+ * 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/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/WorkflowNodeIdentity.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/WorkflowNodeIdentity.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/WorkflowNodeIdentity.java
new file mode 100644
index 0000000..e569c52
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/WorkflowNodeIdentity.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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;
+
+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/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/command/ExperimentCancelRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/command/ExperimentCancelRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/command/ExperimentCancelRequest.java
new file mode 100644
index 0000000..f19decf
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/command/ExperimentCancelRequest.java
@@ -0,0 +1,38 @@
+/*
+ *
+ * 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/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/command/TaskCancelRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/command/TaskCancelRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/command/TaskCancelRequest.java
new file mode 100644
index 0000000..b45e01c
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/command/TaskCancelRequest.java
@@ -0,0 +1,52 @@
+/*
+ *
+ * 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/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java
new file mode 100644
index 0000000..1f85921
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/AiravataAbstractMonitor.java
@@ -0,0 +1,46 @@
+/*
+ *
+ * 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.gfac.monitor.event.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 to 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);
+ protected MonitorPublisher publisher;
+
+ public MonitorPublisher getPublisher() {
+ return publisher;
+ }
+
+ public void setPublisher(MonitorPublisher publisher) {
+ this.publisher = publisher;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/MessageParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/MessageParser.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/MessageParser.java
new file mode 100644
index 0000000..a003f55
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/MessageParser.java
@@ -0,0 +1,43 @@
+/*
+ *
+ * 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.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.model.workspace.experiment.JobState;
+
+/**
+ * This is an interface to implement messageparser, it could be
+ * pull based or push based still monitor has to parse the content of
+ * the message it gets from remote monitoring system and finalize
+ * them to internal job state, Ex: JSON parser for AMQP and Qstat reader
+ * for pull based monitor.
+ */
+public interface MessageParser {
+ /**
+ * This method is to implement how to parse the incoming message
+ * and implement a logic to finalize the status of the job,
+ * we have to makesure the correct message is given to the messageparser
+ * parse method, it will not do any filtering
+ * @param message content of the message
+ * @return
+ */
+ JobState parseMessage(String message)throws AiravataMonitorException;
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/Monitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/Monitor.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/Monitor.java
new file mode 100644
index 0000000..d2fede5
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/Monitor.java
@@ -0,0 +1,30 @@
+/*
+ *
+ * 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;
+
+
+/**
+ * This is the primary interface for Monitors,
+ * This can be used to implement different methods of monitoring
+ */
+public interface Monitor extends Runnable {
+
+}
[4/8] merging monitoring with gfac-core, later this will be separated
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
index 10287a5..0b6619e 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPOutputHandler.java
@@ -31,12 +31,14 @@ import java.util.Set;
import net.schmizz.sshj.connection.ConnectionException;
import net.schmizz.sshj.transport.TransportException;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.context.security.GSISecurityContext;
import org.apache.airavata.gfac.context.security.SSHSecurityContext;
import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.util.GFACSSHUtils;
import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gfac.utils.OutputUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
@@ -54,7 +56,14 @@ public class SCPOutputHandler extends AbstractHandler{
private static final Logger log = LoggerFactory.getLogger(SCPOutputHandler.class);
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException, GFacException {
-
+ if(jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null){
+ try {
+ GFACSSHUtils.addSecurityContext(jobExecutionContext);
+ } catch (ApplicationSettingsException e) {
+ log.error(e.getMessage());
+ throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
+ }
+ }
super.invoke(jobExecutionContext);
DataTransferDetails detail = new DataTransferDetails();
TransferStatus status = new TransferStatus();
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java
index 12e2ad1..78cf25c 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/provider/impl/SSHProvider.java
@@ -32,6 +32,7 @@ import java.util.Map.Entry;
import java.util.Random;
import java.util.Set;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.Constants;
@@ -39,7 +40,9 @@ import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.context.MessageContext;
import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gfac.handler.GFacHandlerException;
import org.apache.airavata.gfac.provider.GFacProviderException;
+import org.apache.airavata.gfac.util.GFACSSHUtils;
import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.CommandExecutor;
@@ -70,7 +73,15 @@ public class SSHProvider extends AbstractProvider{
public void initialize(JobExecutionContext jobExecutionContext) throws GFacProviderException, GFacException {
super.initialize(jobExecutionContext);
- taskID = jobExecutionContext.getTaskData().getTaskID();
+ if(jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null){
+ try {
+ GFACSSHUtils.addSecurityContext(jobExecutionContext);
+ } catch (ApplicationSettingsException e) {
+ log.error(e.getMessage());
+ throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
+ }
+ }
+ taskID = jobExecutionContext.getTaskData().getTaskID();
if (!((SSHHostType) jobExecutionContext.getApplicationContext().getHostDescription().getType()).getHpcResource()) {
jobID = "SSH_" + jobExecutionContext.getApplicationContext().getHostDescription().getType().getHostAddress() + "_" + Calendar.getInstance().getTimeInMillis();
cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/util/GFACSSHUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/util/GFACSSHUtils.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/util/GFACSSHUtils.java
new file mode 100644
index 0000000..29def62
--- /dev/null
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/util/GFACSSHUtils.java
@@ -0,0 +1,88 @@
+/*
+ *
+ * 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.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.Constants;
+import org.apache.airavata.gfac.GFacException;
+import org.apache.airavata.gfac.RequestData;
+import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gsi.ssh.api.Cluster;
+import org.apache.airavata.gsi.ssh.api.SSHApiException;
+import org.apache.airavata.gsi.ssh.api.ServerInfo;
+import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.PBSCluster;
+import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPasswordAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.DefaultPublicKeyFileAuthentication;
+import org.apache.airavata.gsi.ssh.util.CommonUtils;
+import org.apache.airavata.schemas.gfac.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Properties;
+
+public class GFACSSHUtils {
+ private final static Logger logger = LoggerFactory.getLogger(GFACSSHUtils.class);
+
+ public static void addSecurityContext(JobExecutionContext jobExecutionContext) throws GFacException, ApplicationSettingsException {
+ HostDescription registeredHost = jobExecutionContext.getApplicationContext().getHostDescription();
+ if (registeredHost.getType() instanceof GlobusHostType || registeredHost.getType() instanceof UnicoreHostType
+ || registeredHost.getType() instanceof GsisshHostType) {
+ logger.error("This is a wrong method to invoke to non ssh host types,please check your gfac-config.xml");
+ } else if (registeredHost.getType() instanceof SSHHostType) {
+ Properties configurationProperties = ServerSettings.getProperties();
+ String sshUserName = configurationProperties.getProperty(Constants.SSH_USER_NAME);
+ String sshPrivateKey = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY);
+ String sshPrivateKeyPass = configurationProperties.getProperty(Constants.SSH_PRIVATE_KEY_PASS);
+ String sshPassword = configurationProperties.getProperty(Constants.SSH_PASSWORD);
+ String sshPublicKey = configurationProperties.getProperty(Constants.SSH_PUBLIC_KEY);
+ SSHSecurityContext sshSecurityContext = new SSHSecurityContext();
+ AuthenticationInfo authenticationInfo = null;
+ // we give higher preference to the password over keypair ssh authentication
+ if (sshPassword != null) {
+ authenticationInfo = new DefaultPasswordAuthenticationInfo(sshPassword);
+ } else {
+ authenticationInfo = new DefaultPublicKeyFileAuthentication(sshPublicKey, sshPrivateKey, sshPrivateKeyPass);
+ }
+ ServerInfo serverInfo = new ServerInfo(sshUserName, registeredHost.getType().getHostAddress());
+
+ Cluster pbsCluster = null;
+ try {
+ String installedParentPath = "/";
+ if (((SSHHostType) registeredHost.getType()).getHpcResource()) {
+ installedParentPath = ((HpcApplicationDeploymentType)
+ jobExecutionContext.getApplicationContext().getApplicationDeploymentDescription().getType()).getInstalledParentPath();
+ }
+ pbsCluster = new PBSCluster(serverInfo, authenticationInfo,
+ CommonUtils.getPBSJobManager(installedParentPath));
+ } catch (SSHApiException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ sshSecurityContext.setPbsCluster(pbsCluster);
+ sshSecurityContext.setUsername(sshUserName);
+ jobExecutionContext.addSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT, sshSecurityContext);
+ }
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/pom.xml b/modules/gfac/pom.xml
index 2d2293b..438623f 100644
--- a/modules/gfac/pom.xml
+++ b/modules/gfac/pom.xml
@@ -33,7 +33,6 @@
<module>gfac-core</module>
<module>gfac-ec2</module>
<module>gfac-ssh</module>
- <module>gfac-monitor</module>
</modules>
</profile>
</profiles>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/orchestrator/airavata-orchestrator-service/pom.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/pom.xml b/modules/orchestrator/airavata-orchestrator-service/pom.xml
index 2dcf045..549f707 100644
--- a/modules/orchestrator/airavata-orchestrator-service/pom.xml
+++ b/modules/orchestrator/airavata-orchestrator-service/pom.xml
@@ -41,12 +41,7 @@
<artifactId>airavata-orchestrator-core</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>gfac-monitor</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
+ <dependency>
<groupId>org.apache.airavata</groupId>
<artifactId>airavata-model-utils</artifactId>
<version>${project.version}</version>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
index 26f447e..c3491be 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
+++ b/modules/orchestrator/airavata-orchestrator-service/src/main/java/org/apache/airavata/orchestrator/server/OrchestratorServerHandler.java
@@ -24,25 +24,13 @@ package org.apache.airavata.orchestrator.server;
import java.util.Arrays;
import java.util.List;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.commons.gfac.type.HostDescription;
import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.MonitorManager;
-import org.apache.airavata.job.monitor.core.Monitor;
-import org.apache.airavata.job.monitor.core.PullMonitor;
-import org.apache.airavata.job.monitor.core.PushMonitor;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.impl.LocalJobMonitor;
-import org.apache.airavata.job.monitor.impl.pull.qstat.QstatMonitor;
-import org.apache.airavata.job.monitor.impl.push.amqp.AMQPMonitor;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.MonitorManager;
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.orchestrator.core.exception.OrchestratorException;
-import org.apache.airavata.orchestrator.core.utils.OrchestratorUtils;
import org.apache.airavata.orchestrator.cpi.OrchestratorService;
import org.apache.airavata.orchestrator.cpi.orchestrator_cpi_serviceConstants;
import org.apache.airavata.orchestrator.cpi.impl.SimpleOrchestratorImpl;
@@ -51,7 +39,6 @@ import org.apache.airavata.registry.cpi.DataType;
import org.apache.airavata.registry.cpi.Registry;
import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.TaskDetailConstants;
import org.apache.airavata.registry.cpi.utils.Constants.FieldConstants.WorkflowNodeConstants;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
import org.apache.thrift.TException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -79,66 +66,12 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
public OrchestratorServerHandler() {
try {
// first constructing the monitorManager and orchestrator, then fill the required properties
- monitorManager = new MonitorManager();
orchestrator = new SimpleOrchestratorImpl();
registry = RegistryFactory.getDefaultRegistry();
-
- // Filling monitorManager properties
- // we can keep a single user to do all the monitoring authentication for required machine..
- String myProxyUser = ServerSettings.getSetting("myproxy.username");
- String myProxyPass = ServerSettings.getSetting("myproxy.password");
- String certPath = ServerSettings.getSetting("trusted.cert.location");
- String myProxyServer = ServerSettings.getSetting("myproxy.server");
- authenticationInfo = new MyProxyAuthenticationInfo(myProxyUser, myProxyPass, myProxyServer,
- 7512, 17280000, certPath);
-
- // loading Monitor configuration
- String monitors = ServerSettings.getSetting("monitors");
- if(monitors == null) {
- log.error("No Monitor is configured, so job monitoring will not monitor any job");
- return;
- }
- List<String> monitorList = Arrays.asList(monitors.split(","));
- List<String> list = Arrays.asList(ServerSettings.getSetting("amqp.hosts").split(","));
- String proxyPath = ServerSettings.getSetting("proxy.file.path");
- String connectionName = ServerSettings.getSetting("connection.name");
-
- for (String monitorClass : monitorList) {
- Class<? extends Monitor> aClass = Class.forName(monitorClass).asSubclass(Monitor.class);
- Monitor monitor = aClass.newInstance();
- if (monitor instanceof PullMonitor) {
- if (monitor instanceof QstatMonitor) {
- monitorManager.addQstatMonitor((QstatMonitor) monitor);
- }
- } else if (monitor instanceof PushMonitor) {
- if (monitor instanceof AMQPMonitor) {
- ((AMQPMonitor) monitor).initialize(proxyPath, connectionName, list);
- monitorManager.addAMQPMonitor((AMQPMonitor) monitor);
- }
- } else if(monitor instanceof LocalJobMonitor){
- monitorManager.addLocalMonitor((LocalJobMonitor)monitor);
- } else {
- log.error("Wrong class is given to primary Monitor");
- }
- }
-
- monitorManager.registerListener(orchestrator);
- // Now Monitor Manager is properly configured, now we have to start the monitoring system.
- // This will initialize all the required threads and required queues
- monitorManager.launchMonitor();
- } catch (OrchestratorException e) {
- e.printStackTrace();
- } catch (ClassNotFoundException e) {
- e.printStackTrace();
- } catch (InstantiationException e) {
+ orchestrator.initialize();
+ }catch (OrchestratorException e) {
e.printStackTrace();
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- } catch (AiravataMonitorException e) {
- e.printStackTrace();
- } catch (ApplicationSettingsException e) {
- e.printStackTrace();
- }
+ }
}
/**
@@ -163,49 +96,20 @@ public class OrchestratorServerHandler implements OrchestratorService.Iface {
}
List<String> ids = registry.getIds(DataType.WORKFLOW_NODE_DETAIL,WorkflowNodeConstants.EXPERIMENT_ID,experimentId);
for (String workflowNodeId : ids) {
- List<Object> taskDetailList = registry.get(DataType.TASK_DETAIL,TaskDetailConstants.NODE_ID,workflowNodeId);
- for (Object o : taskDetailList) {
- TaskDetails taskID=(TaskDetails)o;
- //iterate through all the generated tasks and performs the job submisssion+monitoring
- String jobID = null;
- Experiment experiment = (Experiment) registry.get(DataType.EXPERIMENT, experimentId);
- if (experiment == null) {
- log.error("Error retrieving the Experiment by the given experimentID: " + experimentId);
- return false;
- }
- String userName = experiment.getUserName();
-
- HostDescription hostDescription = OrchestratorUtils.getHostDescription(orchestrator, taskID);
-
- // creating monitorID to register with monitoring queue
- // this is a special case because amqp has to be in place before submitting the job
- if ((hostDescription instanceof GsisshHostType) &&
- Constants.PUSH.equals(((GsisshHostType) hostDescription).getMonitorMode())) {
- monitorID = new MonitorID(hostDescription, null, taskID.getTaskID(), workflowNodeId, experimentId, userName);
- monitorManager.addAJobToMonitor(monitorID);
- jobID = orchestrator.launchExperiment(experimentId, taskID.getTaskID());
- if("none".equals(jobID)) {
- log.error("Job submission Failed, so we remove the job from monitoring");
-
- }else{
- log.info("Job Launched to the resource by GFAC and jobID returned : " + jobID);
- }
- } else {
- // Launching job for each task
- // if the monitoring is pull mode then we add the monitorID for each task after submitting
- // the job with the jobID, otherwise we don't need the jobID
- jobID = orchestrator.launchExperiment(experimentId, taskID.getTaskID());
- log.info("Job Launched to the resource by GFAC and jobID returned : " + jobID);
- monitorID = new MonitorID(hostDescription, jobID, taskID.getTaskID(), workflowNodeId, experimentId, userName, authenticationInfo);
- if("none".equals(jobID)) {
- log.error("Job submission Failed, so we remove the job from monitoring");
-
- }else{
- monitorManager.addAJobToMonitor(monitorID);
- }
- }
- }
- }
+ WorkflowNodeDetails workflowNodeDetail = (WorkflowNodeDetails)registry.get(DataType.WORKFLOW_NODE_DETAIL, workflowNodeId);
+ List<Object> taskDetailList = registry.get(DataType.TASK_DETAIL, TaskDetailConstants.NODE_ID, workflowNodeId);
+ for (Object o : taskDetailList) {
+ TaskDetails taskID = (TaskDetails) o;
+ //iterate through all the generated tasks and performs the job submisssion+monitoring
+ Experiment experiment = (Experiment) registry.get(DataType.EXPERIMENT, experimentId);
+ if (experiment == null) {
+ log.error("Error retrieving the Experiment by the given experimentID: " + experimentId);
+ return false;
+ }
+ orchestrator.launchExperiment(experiment, workflowNodeDetail, taskID);
+ }
+ }
+
} catch (Exception e) {
throw new TException(e);
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/orchestrator/airavata-orchestrator-service/src/test/resources/monitor.properties
----------------------------------------------------------------------
diff --git a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/monitor.properties b/modules/orchestrator/airavata-orchestrator-service/src/test/resources/monitor.properties
index ee4596e..02ccf24 100644
--- a/modules/orchestrator/airavata-orchestrator-service/src/test/resources/monitor.properties
+++ b/modules/orchestrator/airavata-orchestrator-service/src/test/resources/monitor.properties
@@ -1,5 +1,5 @@
-primaryMonitor=org.apache.airavata.job.monitor.impl.push.amqp.AMQPMonitor
-secondaryMonitor=org.apache.airavata.job.monitor.impl.pull.qstat.QstatMonitor
+primaryMonitor=org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor
+secondaryMonitor=org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor
amqp.hosts=info1.dyn.teragrid.org,info2.dyn.teragrid.org
connection.name=xsede_private
trusted.certificate.location=/Users/chathuri/dev/airavata/cert/certificates
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/orchestrator/orchestrator-core/pom.xml
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/pom.xml b/modules/orchestrator/orchestrator-core/pom.xml
index e718c93..b228284 100644
--- a/modules/orchestrator/orchestrator-core/pom.xml
+++ b/modules/orchestrator/orchestrator-core/pom.xml
@@ -70,11 +70,6 @@ the License. -->
<artifactId>airavata-model-utils</artifactId>
<version>${project.version}</version>
</dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>gfac-monitor</artifactId>
- <version>${project.version}</version>
- </dependency>
<dependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java
index e81b76e..fad5e58 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/core/context/OrchestratorContext.java
@@ -23,7 +23,7 @@ package org.apache.airavata.orchestrator.core.context;
import java.util.ArrayList;
import java.util.List;
-import org.apache.airavata.job.monitor.MonitorManager;
+import org.apache.airavata.gfac.monitor.MonitorManager;
import org.apache.airavata.orchestrator.core.OrchestratorConfiguration;
import org.apache.airavata.orchestrator.core.gfac.GFACInstance;
import org.apache.airavata.registry.api.AiravataRegistry2;
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/Orchestrator.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/Orchestrator.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/Orchestrator.java
index 3fd655f..d02155e 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/Orchestrator.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/Orchestrator.java
@@ -20,7 +20,9 @@
*/
package org.apache.airavata.orchestrator.cpi;
+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.orchestrator.core.exception.OrchestratorException;
import java.util.List;
@@ -36,11 +38,12 @@ public interface Orchestrator {
* experimentID as the handler to the experiment, during the launchExperiment
* We just have to give the experimentID
*
- * @param experimentID
+ * @param experiment
* @return jobID
* @throws OrchestratorException
*/
- String launchExperiment(String experimentID, String taskID) throws OrchestratorException;
+ String launchExperiment(Experiment experiment, WorkflowNodeDetails workflowNodeDetail,
+ TaskDetails taskID) throws OrchestratorException;
/**
@@ -64,4 +67,6 @@ public interface Orchestrator {
//todo have to add another method to handle failed or jobs to be recovered by orchestrator
//todo if you don't add these this is not an orchestrator, its just an intemediate component which invoke gfac
+
+ void initialize() throws OrchestratorException;
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
index 463e08e..fa3b5f3 100644
--- a/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
+++ b/modules/orchestrator/orchestrator-core/src/main/java/org/apache/airavata/orchestrator/cpi/impl/SimpleOrchestratorImpl.java
@@ -21,14 +21,28 @@
package org.apache.airavata.orchestrator.cpi.impl;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import java.util.concurrent.ExecutorService;
-import org.apache.airavata.job.monitor.AbstractActivityListener;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.MonitorManager;
-import org.apache.airavata.job.monitor.command.ExperimentCancelRequest;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.Constants;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
+import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
+import org.apache.airavata.gfac.monitor.AbstractActivityListener;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.MonitorManager;
+import org.apache.airavata.gfac.monitor.command.ExperimentCancelRequest;
+import org.apache.airavata.gfac.monitor.core.Monitor;
+import org.apache.airavata.gfac.monitor.core.PullMonitor;
+import org.apache.airavata.gfac.monitor.core.PushMonitor;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.gfac.monitor.impl.LocalJobMonitor;
+import org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor;
+import org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor;
+import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
import org.apache.airavata.model.util.ExperimentModelUtil;
import org.apache.airavata.model.workspace.experiment.Experiment;
import org.apache.airavata.model.workspace.experiment.JobState;
@@ -36,10 +50,13 @@ import org.apache.airavata.model.workspace.experiment.TaskDetails;
import org.apache.airavata.model.workspace.experiment.WorkflowNodeDetails;
import org.apache.airavata.orchestrator.core.exception.OrchestratorException;
import org.apache.airavata.orchestrator.core.job.JobSubmitter;
+import org.apache.airavata.orchestrator.core.utils.OrchestratorUtils;
import org.apache.airavata.orchestrator.core.validator.JobMetadataValidator;
+import org.apache.airavata.persistance.registry.jpa.model.WorkflowNodeDetail;
import org.apache.airavata.registry.cpi.ChildDataType;
import org.apache.airavata.registry.cpi.DataType;
import org.apache.airavata.registry.cpi.Registry;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -54,6 +71,9 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator implements Abst
private JobMetadataValidator jobMetadataValidator = null;
+ private MonitorManager monitorManager = null;
+
+ private AuthenticationInfo authenticationInfo = null;
public SimpleOrchestratorImpl() throws OrchestratorException {
try {
@@ -62,7 +82,7 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator implements Abst
Class<? extends JobSubmitter> aClass = Class.forName(submitterClass.trim()).asSubclass(JobSubmitter.class);
jobSubmitter = aClass.newInstance();
jobSubmitter.initialize(this.orchestratorContext);
-
+ monitorManager = new MonitorManager();
String validatorClzz = this.orchestratorContext.getOrchestratorConfiguration().getValidatorClass();
if (this.orchestratorConfiguration.isEnableValidation()) {
if (validatorClzz == null) {
@@ -82,19 +102,50 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator implements Abst
}
}
- public String launchExperiment(String experimentID, String taskID) throws OrchestratorException {
+ public String launchExperiment(Experiment experiment, WorkflowNodeDetails workflowNode, TaskDetails task) throws OrchestratorException {
// we give higher priority to userExperimentID
//todo support multiple validators
String jobID = null;
- if (this.orchestratorConfiguration.isEnableValidation()) {
- if (jobMetadataValidator.validate(experimentID)) {
- logger.info("validation Successful for the experiment: " + experimentID);
+ String experimentId = experiment.getExperimentID();
+ String taskId = task.getTaskID();
+ String workflowNodeId = workflowNode.getNodeInstanceId();
+ String userName = experiment.getUserName();
+ // creating monitorID to register with monitoring queue
+ // this is a special case because amqp has to be in place before submitting the job
+ HostDescription hostDescription = OrchestratorUtils.getHostDescription(this, task);
+
+ // creating monitorID to register with monitoring queue
+ // this is a special case because amqp has to be in place before submitting the job
+ try {
+ if ((hostDescription instanceof GsisshHostType) &&
+ Constants.PUSH.equals(((GsisshHostType) hostDescription).getMonitorMode())) {
+ MonitorID monitorID = new MonitorID(hostDescription, null, taskId, workflowNodeId, experimentId, userName);
+ monitorManager.addAJobToMonitor(monitorID);
+ jobSubmitter.submit(experimentId, taskId);
+ if ("none".equals(jobID)) {
+ logger.error("Job submission Failed, so we remove the job from monitoring");
+
+ } else {
+ logger.info("Job Launched to the resource by GFAC and jobID returned : " + jobID);
+ }
} else {
- throw new OrchestratorException("Validation Failed, so Job will not be submitted to GFAC");
+ // Launching job for each task
+ // if the monitoring is pull mode then we add the monitorID for each task after submitting
+ // the job with the jobID, otherwise we don't need the jobID
+ jobSubmitter.submit(experimentId, taskId);
+ logger.info("Job Launched to the resource by GFAC and jobID returned : " + jobID);
+ MonitorID monitorID = new MonitorID(hostDescription, jobID, taskId, workflowNodeId, experimentId, userName, authenticationInfo);
+ if ("none".equals(jobID)) {
+ logger.error("Job submission Failed, so we remove the job from monitoring");
+
+ } else {
+ monitorManager.addAJobToMonitor(monitorID);
+ }
}
+ } catch (Exception e) {
+ throw new OrchestratorException("Error launching the job", e);
}
- jobID = jobSubmitter.submit(experimentID, taskID);
return jobID;
}
@@ -163,7 +214,15 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator implements Abst
this.jobSubmitter = jobSubmitter;
}
- @Override
+ public AuthenticationInfo getAuthenticationInfo() {
+ return authenticationInfo;
+ }
+
+ public void setAuthenticationInfo(AuthenticationInfo authenticationInfo) {
+ this.authenticationInfo = authenticationInfo;
+ }
+
+ @Override
public void setup(Object... configurations) {
for (Object config : configurations) {
if (config instanceof MonitorManager){
@@ -177,4 +236,61 @@ public class SimpleOrchestratorImpl extends AbstractOrchestrator implements Abst
}
}
+ public void initialize() throws OrchestratorException {
+ // Filling monitorManager properties
+ // we can keep a single user to do all the monitoring authentication for required machine..
+ try{
+ String myProxyUser = ServerSettings.getSetting("myproxy.username");
+ String myProxyPass = ServerSettings.getSetting("myproxy.password");
+ String certPath = ServerSettings.getSetting("trusted.cert.location");
+ String myProxyServer = ServerSettings.getSetting("myproxy.server");
+ setAuthenticationInfo(new MyProxyAuthenticationInfo(myProxyUser, myProxyPass, myProxyServer,
+ 7512, 17280000, certPath));
+
+ // loading Monitor configuration
+ String monitors = ServerSettings.getSetting("monitors");
+ if(monitors == null) {
+ logger.error("No Monitor is configured, so job monitoring will not monitor any job");
+ return;
+ }
+ List<String> monitorList = Arrays.asList(monitors.split(","));
+ List<String> list = Arrays.asList(ServerSettings.getSetting("amqp.hosts").split(","));
+ String proxyPath = ServerSettings.getSetting("proxy.file.path");
+ String connectionName = ServerSettings.getSetting("connection.name");
+
+ for (String monitorClass : monitorList) {
+ Class<? extends Monitor> aClass = Class.forName(monitorClass).asSubclass(Monitor.class);
+ Monitor monitor = aClass.newInstance();
+ if (monitor instanceof PullMonitor) {
+ if (monitor instanceof QstatMonitor) {
+ monitorManager.addQstatMonitor((QstatMonitor) monitor);
+ }
+ } else if (monitor instanceof PushMonitor) {
+ if (monitor instanceof AMQPMonitor) {
+ ((AMQPMonitor) monitor).initialize(proxyPath, connectionName, list);
+ monitorManager.addAMQPMonitor((AMQPMonitor) monitor);
+ }
+ } else if(monitor instanceof LocalJobMonitor){
+ monitorManager.addLocalMonitor((LocalJobMonitor)monitor);
+ } else {
+ logger.error("Wrong class is given to primary Monitor");
+ }
+ }
+
+ monitorManager.registerListener(this);
+ // Now Monitor Manager is properly configured, now we have to start the monitoring system.
+ // This will initialize all the required threads and required queues
+ monitorManager.launchMonitor();
+ } catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ } catch (InstantiationException e) {
+ e.printStackTrace();
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ } catch (AiravataMonitorException e) {
+ e.printStackTrace();
+ } catch (ApplicationSettingsException e) {
+ e.printStackTrace();
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/NewOrchestratorTest.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/NewOrchestratorTest.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/NewOrchestratorTest.java
index e161da6..59ff255 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/NewOrchestratorTest.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/NewOrchestratorTest.java
@@ -51,7 +51,6 @@ public class NewOrchestratorTest extends BaseOrchestratorTest {
private static final Logger log = LoggerFactory.getLogger(NewOrchestratorTest.class);
private Orchestrator orchestrator;
- private String experimentID;
private List<TaskDetails> tasks;
@BeforeTest
@@ -59,7 +58,6 @@ public class NewOrchestratorTest extends BaseOrchestratorTest {
AiravataUtils.setExecutionAsServer();
super.setUp();
orchestrator = new SimpleOrchestratorImpl();
- createJobRequestWithDocuments(getAiravataAPI());
// System.setProperty("myproxy.user", "ogce");
// System.setProperty("myproxy.pass", "");
// System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
@@ -68,8 +66,11 @@ public class NewOrchestratorTest extends BaseOrchestratorTest {
// System.setProperty("trusted.cert.location",System.getProperty("gsi.working.directory"));
}
- private void createJobRequestWithDocuments(AiravataAPI airavataAPI) throws Exception{
- // creating host description
+
+
+ @Test
+ public void localHostTest() throws Exception {
+ // creating host description
List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
DataObjectType input = new DataObjectType();
input.setKey("echo_input");
@@ -88,6 +89,7 @@ public class NewOrchestratorTest extends BaseOrchestratorTest {
ExperimentModelUtil.createSimpleExperiment("project1", "admin", "echoExperiment", "SimpleEcho0", "SimpleEcho0", exInputs);
simpleExperiment.setExperimentOutputs(exOut);
+ WorkflowNodeDetails test = ExperimentModelUtil.createWorkflowNode("test", null);
ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("localhost", 1, 1, 1, "normal", 0, 0, 1, "sds128");
scheduling.setResourceHostId("localhost");
UserConfigurationData userConfigurationData = new UserConfigurationData();
@@ -97,14 +99,10 @@ public class NewOrchestratorTest extends BaseOrchestratorTest {
simpleExperiment.setUserConfigurationData(userConfigurationData);
Registry defaultRegistry = RegistryFactory.getDefaultRegistry();
- experimentID = (String)defaultRegistry.add(ParentDataType.EXPERIMENT, simpleExperiment);
- tasks = orchestrator.createTasks(experimentID);
- }
-
- @Test
- public void localHostTest() throws Exception {
+ String experimentId = (String)defaultRegistry.add(ParentDataType.EXPERIMENT, simpleExperiment);
+ tasks = orchestrator.createTasks(experimentId);
for(TaskDetails details:tasks) {
- orchestrator.launchExperiment(experimentID, details.getTaskID());
+ orchestrator.launchExperiment(simpleExperiment,test, details);
}
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
index 9fafe98..3a3fa04 100644
--- a/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
+++ b/modules/orchestrator/orchestrator-core/src/test/java/org/apache/airavata/orchestrator/core/OrchestratorTestWithMyProxyAuth.java
@@ -49,65 +49,63 @@ import java.util.List;
public class OrchestratorTestWithMyProxyAuth extends BaseOrchestratorTest {
private static final Logger log = LoggerFactory.getLogger(NewOrchestratorTest.class);
- private Orchestrator orchestrator;
+ private Orchestrator orchestrator;
- private String experimentID;
+ private String experimentID;
- private List<TaskDetails> tasks;
+ private List<TaskDetails> tasks;
- @BeforeTest
- public void setUp() throws Exception {
- AiravataUtils.setExecutionAsServer();
- super.setUp();
- orchestrator = new SimpleOrchestratorImpl();
- createJobRequestWithDocuments();
+ @BeforeTest
+ public void setUp() throws Exception {
+ AiravataUtils.setExecutionAsServer();
+ super.setUp();
+ orchestrator = new SimpleOrchestratorImpl();
// System.setProperty("myproxy.user", "ogce");
// System.setProperty("myproxy.pass", "");
// System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
- // this is the same propertySystem.getProperty("myproxy.user");
+ // this is the same propertySystem.getProperty("myproxy.user");
// System.setProperty("myproxy.pass",System.getProperty("myproxy.password"));
// System.setProperty("trusted.cert.location",System.getProperty("gsi.working.directory"));
- }
-
- private void createJobRequestWithDocuments() throws Exception{
- List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
- DataObjectType input = new DataObjectType();
- input.setKey("echo_input");
- input.setType(DataType.STRING.toString());
- input.setValue("echo_output=Hello World");
- exInputs.add(input);
-
- List<DataObjectType> exOut = new ArrayList<DataObjectType>();
- DataObjectType output = new DataObjectType();
- output.setKey("echo_output");
- output.setType(DataType.STRING.toString());
- output.setValue("");
- exOut.add(output);
-
- Experiment simpleExperiment =
- ExperimentModelUtil.createSimpleExperiment("project1", "admin", "echoExperiment", "SimpleEcho2", "SimpleEcho2", exInputs);
- simpleExperiment.setExperimentOutputs(exOut);
-
- ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "normal", 0, 0, 1, "sds128");
- scheduling.setResourceHostId("gsissh-trestles");
- UserConfigurationData userConfigurationData = new UserConfigurationData();
- userConfigurationData.setAiravataAutoSchedule(false);
- userConfigurationData.setOverrideManualScheduledParams(false);
- userConfigurationData.setComputationalResourceScheduling(scheduling);
- simpleExperiment.setUserConfigurationData(userConfigurationData);
-
- Registry registry = RegistryFactory.getDefaultRegistry();
- experimentID = (String) registry.add(ParentDataType.EXPERIMENT, simpleExperiment);
- tasks = orchestrator.createTasks(experimentID);
-
- }
-
- @Test
- public void noDescriptorTest() throws Exception {
- for(TaskDetails taskDetail:tasks) {
- orchestrator.launchExperiment(experimentID, taskDetail.getTaskID());
- }
- }
+ }
+
+ @Test
+ public void noDescriptorTest() throws Exception {
+ List<DataObjectType> exInputs = new ArrayList<DataObjectType>();
+ DataObjectType input = new DataObjectType();
+ input.setKey("echo_input");
+ input.setType(DataType.STRING.toString());
+ input.setValue("echo_output=Hello World");
+ exInputs.add(input);
+
+ List<DataObjectType> exOut = new ArrayList<DataObjectType>();
+ DataObjectType output = new DataObjectType();
+ output.setKey("echo_output");
+ output.setType(DataType.STRING.toString());
+ output.setValue("");
+ exOut.add(output);
+
+ Experiment simpleExperiment =
+ ExperimentModelUtil.createSimpleExperiment("project1", "admin", "echoExperiment", "SimpleEcho2", "SimpleEcho2", exInputs);
+ simpleExperiment.setExperimentOutputs(exOut);
+
+ ComputationalResourceScheduling scheduling = ExperimentModelUtil.createComputationResourceScheduling("trestles.sdsc.edu", 1, 1, 1, "normal", 0, 0, 1, "sds128");
+ scheduling.setResourceHostId("gsissh-trestles");
+ UserConfigurationData userConfigurationData = new UserConfigurationData();
+ userConfigurationData.setAiravataAutoSchedule(false);
+ userConfigurationData.setOverrideManualScheduledParams(false);
+ userConfigurationData.setComputationalResourceScheduling(scheduling);
+ simpleExperiment.setUserConfigurationData(userConfigurationData);
+
+ WorkflowNodeDetails test = ExperimentModelUtil.createWorkflowNode("test", null);
+ Registry registry = RegistryFactory.getDefaultRegistry();
+ experimentID = (String) registry.add(ParentDataType.EXPERIMENT, simpleExperiment);
+ tasks = orchestrator.createTasks(experimentID);
+
+ for (TaskDetails taskDetail: tasks)
+ {
+ orchestrator.launchExperiment(simpleExperiment,test, taskDetail);
+ }
+ }
}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/pom.xml
----------------------------------------------------------------------
diff --git a/tools/job-monitor/pom.xml b/tools/job-monitor/pom.xml
deleted file mode 100644
index 4fc6ced..0000000
--- a/tools/job-monitor/pom.xml
+++ /dev/null
@@ -1,162 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--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. -->
-
-<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>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata</artifactId>
- <version>0.12-SNAPSHOT</version>
- <relativePath>../../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>job-monitor-tool</artifactId>
- <name>Airavata Job Monitor</name>
- <description>This component handle the Airavata Job monitoring funcationality</description>
- <url>http://airavata.apache.org/</url>
-
- <dependencies>
- <dependency>
- <groupId>org.jglobus</groupId>
- <artifactId>gss</artifactId>
- <version>${jglobus.version}</version>
- </dependency>
- <dependency>
- <groupId>org.jglobus</groupId>
- <artifactId>myproxy</artifactId>
- <version>${jglobus.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk16</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- <!--dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk15on</artifactId>
- <version>1.48</version>
- </dependency>
- <dependency>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcpkix-jdk15on</artifactId>
- <version>1.48</version>
- </dependency-->
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
-
- <dependency>
- <groupId>com.rabbitmq</groupId>
- <artifactId>amqp-client</artifactId>
- <version>3.2.3</version>
- </dependency>
- <!-- SSH -->
- <dependency>
- <groupId>net.schmizz</groupId>
- <artifactId>sshj</artifactId>
- <version>0.8.0</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>
-
-
- <!-- Guava -->
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- <version>12.0</version>
- </dependency>
-
- <!-- gsi-ssh api and other util dependencies -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>gsissh</artifactId>
- <version>${project.version}</version>
- </dependency>
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata-gfac-schema-utils</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.ogce</groupId>
- <artifactId>bcgss</artifactId>
- <version>146</version>
- </dependency>
- <dependency>
- <groupId>org.apache.xmlbeans</groupId>
- <artifactId>xmlbeans</artifactId>
- <version>${xmlbeans.version}</version>
- </dependency>
- <dependency>
- <groupId>com.fasterxml.jackson.core</groupId>
- <artifactId>jackson-databind</artifactId>
- <version>2.0.0</version>
- </dependency>
- </dependencies>
-
- <build>
- <plugins>
- <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>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/ExperimentIdentity.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/ExperimentIdentity.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/ExperimentIdentity.java
deleted file mode 100644
index 652ad1d..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/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.job.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/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/HostMonitorData.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/HostMonitorData.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/HostMonitorData.java
deleted file mode 100644
index 6e5fde9..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/HostMonitorData.java
+++ /dev/null
@@ -1,69 +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.job.monitor;
-
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class HostMonitorData {
- private HostDescription host;
-
- private List<MonitorID> monitorIDs;
-
- public HostMonitorData(HostDescription host) {
- this.host = host;
- monitorIDs = new ArrayList<MonitorID>();
- }
-
- public HostMonitorData(HostDescription host, List<MonitorID> monitorIDs) {
- this.host = host;
- this.monitorIDs = monitorIDs;
- }
-
- public HostDescription getHost() {
- return host;
- }
-
- public void setHost(HostDescription host) {
- this.host = host;
- }
-
- 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 AiravataMonitorException
- */
- public void addMonitorIDForHost(MonitorID monitorID)throws AiravataMonitorException{
- monitorIDs.add(monitorID);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/JobIdentity.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/JobIdentity.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/JobIdentity.java
deleted file mode 100644
index 5753d9d..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/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.job.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/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/TaskIdentity.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/TaskIdentity.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/TaskIdentity.java
deleted file mode 100644
index f7bc785..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/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.job.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/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/UserMonitorData.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/UserMonitorData.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/UserMonitorData.java
deleted file mode 100644
index 13c177a..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/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.job.monitor;
-
-import org.apache.airavata.job.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/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/WorkflowNodeIdentity.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/WorkflowNodeIdentity.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/WorkflowNodeIdentity.java
deleted file mode 100644
index a8fe09f..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/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.job.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/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/AiravataAbstractMonitor.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/AiravataAbstractMonitor.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/AiravataAbstractMonitor.java
deleted file mode 100644
index 2e85b32..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/AiravataAbstractMonitor.java
+++ /dev/null
@@ -1,46 +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.job.monitor.core;
-
-import org.apache.airavata.job.monitor.event.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 to 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);
- MonitorPublisher publisher;
-
- public MonitorPublisher getPublisher() {
- return publisher;
- }
-
- public void setPublisher(MonitorPublisher publisher) {
- this.publisher = publisher;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/MessageParser.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/MessageParser.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/MessageParser.java
deleted file mode 100644
index b4a06c9..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/MessageParser.java
+++ /dev/null
@@ -1,47 +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.job.monitor.core;
-
-import org.apache.airavata.job.monitor.HostMonitorData;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.UserMonitorData;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.model.workspace.experiment.JobState;
-
-/**
- * This is an interface to implement messageparser, it could be
- * pull based or push based still monitor has to parse the content of
- * the message it gets from remote monitoring system and finalize
- * them to internal job state, Ex: JSON parser for AMQP and Qstat reader
- * for pull based monitor.
- */
-public interface MessageParser {
- /**
- * This method is to implement how to parse the incoming message
- * and implement a logic to finalize the status of the job,
- * we have to makesure the correct message is given to the messageparser
- * parse method, it will not do any filtering
- * @param message content of the message
- * @return
- */
- JobState parseMessage(String message)throws AiravataMonitorException;
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/Monitor.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/Monitor.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/Monitor.java
deleted file mode 100644
index 9627bbc..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/Monitor.java
+++ /dev/null
@@ -1,30 +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.job.monitor.core;
-
-
-/**
- * This is the primary interface for Monitors,
- * This can be used to implement different methods of monitoring
- */
-public interface Monitor extends Runnable {
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/PullMonitor.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/PullMonitor.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/PullMonitor.java
deleted file mode 100644
index 4b904b1..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/PullMonitor.java
+++ /dev/null
@@ -1,64 +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.job.monitor.core;
-
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-
-/**
- * PullMonitors can implement this interface
- * Since the pull and push based monitoring required different
- * operations, PullMonitor will be useful.
- * This will allow users to program Pull monitors separately
- */
-public abstract class PullMonitor extends AiravataAbstractMonitor{
-
- private int pollingFrequence;
- /**
- * This method will can invoke when PullMonitor needs to start
- * and it has to invoke in the frequency specified below,
- * @return if the start process is successful return true else false
- */
- public abstract boolean startPulling() throws AiravataMonitorException;
-
- /**
- * This is the method to stop the polling process
- * @return if the stopping process is successful return true else false
- */
- public abstract boolean stopPulling()throws AiravataMonitorException;
-
- /**
- * this method can be used to set the polling frequencey or otherwise
- * can implement a polling mechanism, and implement how to do
- * @param frequence
- */
- public void setPollingFrequence(int frequence){
- this.pollingFrequence = frequence;
- }
-
- /**
- * this method can be used to get the polling frequencey or otherwise
- * can implement a polling mechanism, and implement how to do
- * @return
- */
- public int getPollingFrequence(){
- return this.pollingFrequence;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/PushMonitor.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/PushMonitor.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/PushMonitor.java
deleted file mode 100644
index f172ece..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/core/PushMonitor.java
+++ /dev/null
@@ -1,61 +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.job.monitor.core;
-
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.UserMonitorData;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-
-/**
- * PushMonitors can implement this interface
- * Since the pull and push based monitoring required different
- * operations, PullMonitor will be useful.
- * This interface will allow users to program Push monitors separately
- */
-public abstract class PushMonitor extends AiravataAbstractMonitor {
- /**
- * This method can be invoked to register a listener with the
- * remote monitoring system, ideally inside this method users will be
- * writing some client listener code for the remote monitoring system,
- * this will be a simple wrapper around any client for the remote Monitor.
- * @param monitorID
- * @return
- */
- public abstract boolean registerListener(MonitorID monitorID)throws AiravataMonitorException;
-
- /**
- * This method can be invoked to unregister a listener with the
- * remote monitoring system, ideally inside this method users will be
- * writing some client listener code for the remote monitoring system,
- * this will be a simple wrapper around any client for the remote Monitor.
- * @param monitorID
- * @return
- */
- public abstract boolean unRegisterListener(MonitorID monitorID)throws AiravataMonitorException;
-
- /**
- * This can be used to stop the registration thread
- * @return
- * @throws AiravataMonitorException
- */
- public abstract boolean stopRegister()throws AiravataMonitorException;
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/event/MonitorPublisher.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/event/MonitorPublisher.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/event/MonitorPublisher.java
deleted file mode 100644
index 3064781..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/event/MonitorPublisher.java
+++ /dev/null
@@ -1,48 +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.job.monitor.event;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.eventbus.EventBus;
-
-public class MonitorPublisher{
- private final static Logger logger = LoggerFactory.getLogger(MonitorPublisher.class);
- private EventBus eventBus;
-
- public MonitorPublisher(EventBus eventBus) {
- this.eventBus = eventBus;
- }
-
- public void registerListener(Object listener) {
- eventBus.register(listener);
- }
-
- public void unregisterListener(Object listener) {
- eventBus.unregister(listener);
- }
-
- public void publish(Object o) {
- eventBus.post(o);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/exception/AiravataMonitorException.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/exception/AiravataMonitorException.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/exception/AiravataMonitorException.java
deleted file mode 100644
index 5a13be2..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/exception/AiravataMonitorException.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.job.monitor.exception;
-
-public class AiravataMonitorException extends Exception {
- private static final long serialVersionUID = -2849422320139467602L;
-
- public AiravataMonitorException(Throwable e) {
- super(e);
- }
-
- public AiravataMonitorException(String message) {
- super(message, null);
- }
-
- public AiravataMonitorException(String message, Throwable e) {
- super(message, e);
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/LocalJobMonitor.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/LocalJobMonitor.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/LocalJobMonitor.java
deleted file mode 100644
index ec4cb40..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/LocalJobMonitor.java
+++ /dev/null
@@ -1,59 +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.job.monitor.impl;
-
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.job.monitor.JobIdentity;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.core.AiravataAbstractMonitor;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.model.workspace.experiment.JobState;
-
-import java.util.concurrent.BlockingQueue;
-
-/**
- * This monitor can be used to monitor a job which runs locally,
- * Since its a local job job doesn't have states, once it get executed
- * then the job starts running
- */
-public class LocalJobMonitor extends AiravataAbstractMonitor {
- // Though we have a qeuue here, it not going to be used in local jobs
- BlockingQueue<MonitorID> jobQueue;
-
- public void run() {
- do {
- try {
- MonitorID take = jobQueue.take();
- getPublisher().publish(new JobStatusChangeRequest(take, new JobIdentity(take.getExperimentID(), take.getWorkflowNodeID(), take.getTaskID(), take.getJobID()), JobState.COMPLETE));
- } catch (Exception e) {
- e.printStackTrace();
- }
- } while (!ServerSettings.isStopAllThreads());
- }
-
- public BlockingQueue<MonitorID> getJobQueue() {
- return jobQueue;
- }
-
- public void setJobQueue(BlockingQueue<MonitorID> jobQueue) {
- this.jobQueue = jobQueue;
- }
-}
[5/8] merging monitoring with gfac-core, later this will be separated
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/StorageManager.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/StorageManager.json b/modules/gfac/gfac-core/src/main/resources/schema/StorageManager.json
new file mode 100644
index 0000000..f3984f6
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/StorageManager.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageManager.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
+ "properties": {
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/StorageService.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/StorageService.json b/modules/gfac/gfac-core/src/main/resources/schema/StorageService.json
new file mode 100644
index 0000000..a03d111
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/StorageService.json
@@ -0,0 +1,22 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageService.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Service.json"}],
+ "properties": {
+ "StorageAccessProtocolID": {
+ "type": "array",
+ "description": "The ID(s) of the StorageAccessProtocols supported by this service",
+ "items": {
+ "type": "string"
+ }
+ },
+ "StorageServiceCapacityID": {
+ "type": "array",
+ "description": "The ID(s) of the StorageServiceCapacities for this Service",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/StorageServiceCapacity.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/StorageServiceCapacity.json b/modules/gfac/gfac-core/src/main/resources/schema/StorageServiceCapacity.json
new file mode 100644
index 0000000..a25c204
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/StorageServiceCapacity.json
@@ -0,0 +1,33 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageServiceCapacity.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Type": {
+ "type": "string",
+ "description": "The type of storage capacity - StorageCapacity_t"
+ },
+ "TotalSize": {
+ "type": "integer",
+ "description": "The total amount of storage of this type (GB)"
+ },
+ "FreeSize": {
+ "type": "integer",
+ "description": "The amount of currently available storage of this type (GB)"
+ },
+ "UsedSize": {
+ "type": "integer",
+ "description": "The amount storage of this type in use (GB)"
+ },
+ "ReservedSize": {
+ "type": "integer",
+ "description": "The amount storage of this type which is not in use, but has been reserved for use in use (GB)"
+ },
+ "StorageServiceID": {
+ "type": "string",
+ "description": "The ID of the StorageService this capacity describes"
+ }
+ },
+ "required": ["Type","StorageServiceID"]
+}
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/StorageShare.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/StorageShare.json b/modules/gfac/gfac-core/src/main/resources/schema/StorageShare.json
new file mode 100644
index 0000000..9703118
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/StorageShare.json
@@ -0,0 +1,65 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageShare.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
+ "properties": {
+ "ServingState": {
+ "type": "string",
+ "description": "How the Share is currently serving jobs",
+ "enum": ["closed","draining","production","queueing"]
+ },
+ "Path": {
+ "type": "string",
+ "description": "A default namespace where files are logically placed when they are stored in this Share"
+ },
+ "AccessMode": {
+ "type": "array",
+ "description": "The type of access allowed for this share - AccessMode_t (undefined)",
+ "items": {
+ "type": "string"
+ }
+ },
+ "SharingID": {
+ "type": "string",
+ "description": "A local identifier common to the set of StorageShares which use the same underling extents"
+ },
+ "AccessLatency": {
+ "type": "string",
+ "description": "The maximum latency category under normal operating conditions",
+ "enum": ["nearline","offline","online"]
+ },
+ "RetentionPolicy": {
+ "type": "string",
+ "description": "The quality of data retention - RetentionPolicy_t"
+ },
+ "ExpirationMode": {
+ "type": "array",
+ "description": "Supported file lifetime modes",
+ "items": {
+ "type": "string",
+ "enum": ["neverexpire","releasewhenexpired","warnwhenexpired"]
+ }
+ },
+ "DefaultLifeTime": {
+ "type": "integer",
+ "description": "The default lifetime assigned to a new file"
+ },
+ "MaximumLifeTime": {
+ "type": "integer",
+ "description": "The maximum lifetime that can be requested for a file"
+ },
+ "Tag": {
+ "type": "string",
+ "description": "An identifier defined by a UserDomain"
+ },
+ "StorageShareCapacityID": {
+ "type": "array",
+ "description": "ID of the StorageShareCapacities associated with this share",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["ServingState","SharingID","AccessLatency"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/StorageShareCapacity.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/StorageShareCapacity.json b/modules/gfac/gfac-core/src/main/resources/schema/StorageShareCapacity.json
new file mode 100644
index 0000000..f392c94
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/StorageShareCapacity.json
@@ -0,0 +1,33 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageShareCapacity.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Type": {
+ "type": "string",
+ "description": "The type of storage capacity - StorageCapacity_t"
+ },
+ "TotalSize": {
+ "type": "integer",
+ "description": "The total amount of storage (GB)"
+ },
+ "FreeSize": {
+ "type": "integer",
+ "description": "The amount of available storage (GB)"
+ },
+ "UsedSize": {
+ "type": "integer",
+ "description": "The amount of used storage (GB)"
+ },
+ "ReservedSize": {
+ "type": "integer",
+ "description": "The amount storage which is not occupied, but has been reserved for use (GB)"
+ },
+ "StorageShareID": {
+ "type": "string",
+ "description": "The ID of the StorageShare related to this capacity"
+ }
+ },
+ "required": ["Type","StorageShareID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ToComputingService.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ToComputingService.json b/modules/gfac/gfac-core/src/main/resources/schema/ToComputingService.json
new file mode 100644
index 0000000..6d81b80
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ToComputingService.json
@@ -0,0 +1,32 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ToComputingService.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "NetworkInfo": {
+ "type": "string",
+ "description": "Type of network connections between the Storage and Computing services (NetworkInfo_t)"
+ },
+ "Bandwidth": {
+ "type": "integer",
+ "description": "The normal bandwidth available between the Storage and Computing services (Mb/s)"
+ },
+ "StorageAccessProtocolID": {
+ "type": "array",
+ "description": "IDs of the protocols that can be used to access the StorageService",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ComputingServiceID": {
+ "type": "string",
+ "description": "The ID of the ComputingService"
+ },
+ "StorageServiceID": {
+ "type": "string",
+ "description": "The ID of the StorageService"
+ }
+ },
+ "required": ["ComputingServiceID","StorageServiceID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ToStorageService.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ToStorageService.json b/modules/gfac/gfac-core/src/main/resources/schema/ToStorageService.json
new file mode 100644
index 0000000..644f3d1
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ToStorageService.json
@@ -0,0 +1,25 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ToStorageService.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "LocalPath": {
+ "type": "string",
+ "description": "The path within the ComputingService that is used to access the StorageService"
+ },
+ "RemotePath": {
+ "type": "string",
+ "description": "The path in the StorageService which is associated with the LocalPath"
+ },
+ "ComputingServiceID": {
+ "type": "string",
+ "description": "The ID of the ComputingService"
+ },
+ "StorageServiceID": {
+ "type": "string",
+ "description": "The ID of the StorageService"
+ }
+ },
+ "required": ["LocalPath","RemotePath","ComputingServiceID","StorageServiceID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/UserDomain.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/UserDomain.json b/modules/gfac/gfac-core/src/main/resources/schema/UserDomain.json
new file mode 100644
index 0000000..7acda31
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/UserDomain.json
@@ -0,0 +1,58 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/UserDomain.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json"}],
+ "properties": {
+ "Level": {
+ "type": "integer",
+ "description": "the number of hops to reach the root of the hierarchy of UserDomains"
+ },
+ "UserManagerID": {
+ "type": "array",
+ "description": "ID for the Endpoint of a Service managing users in this UserDomain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "Member": {
+ "type": "array",
+ "description": "Identifiers for users in this UserDomain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "PolicyID": {
+ "type": "array",
+ "description": "IDs for Policies associated with this UserDomain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ChildDomainID": {
+ "type": "array",
+ "description": "IDs of UserDomains aggregated by this UserDomain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ParentDomainID": {
+ "type": "string",
+ "description": "The ID of the UserDomain that this UserDomain participates in"
+ },
+ "AccessPolicyID": {
+ "type": "array",
+ "description": "IDs of AccessPolicies associated with this UserDomain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "MappingPolicyID": {
+ "type": "array",
+ "description": "IDs of MappingPolicies associated with this UserDomain",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
new file mode 100644
index 0000000..d61083b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/AMQPMonitorTest.java
@@ -0,0 +1,175 @@
+/*
+ *
+ * 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.job;
+
+import com.google.common.eventbus.EventBus;
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gsi.ssh.api.Cluster;
+import org.apache.airavata.gsi.ssh.api.SSHApiException;
+import org.apache.airavata.gsi.ssh.api.ServerInfo;
+import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
+import org.apache.airavata.gsi.ssh.impl.PBSCluster;
+import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.impl.push.amqp.AMQPMonitor;
+import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class AMQPMonitorTest {
+
+ private String myProxyUserName;
+ private String myProxyPassword;
+ private String certificateLocation;
+ private String pbsFilePath;
+ private String workingDirectory;
+ private HostDescription hostDescription;
+ private MonitorPublisher monitorPublisher;
+ private BlockingQueue<MonitorID> finishQueue;
+ private BlockingQueue<MonitorID> pushQueue;
+ private Thread pushThread;
+ private String proxyFilePath;
+ @Before
+ public void setUp() throws Exception {
+ System.setProperty("myproxy.username", "ogce");
+ System.setProperty("myproxy.password", "OpenGwy14");
+ System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
+ System.setProperty("gsi.working.directory", "/home1/01437/ogce");
+ System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
+ System.setProperty("proxy.file.path", "/Users/lahirugunathilake/Downloads/x509up_u503876");
+ myProxyUserName = System.getProperty("myproxy.username");
+ myProxyPassword = System.getProperty("myproxy.password");
+ workingDirectory = System.getProperty("gsi.working.directory");
+ certificateLocation = System.getProperty("trusted.cert.location");
+ proxyFilePath = System.getProperty("proxy.file.path");
+ System.setProperty("connection.name", "xsede");
+ if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) {
+ System.out.println(">>>>>> Please run tests with my proxy user name and password. " +
+ "E.g :- mvn clean install -Dmyproxy.user=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<");
+ throw new Exception("Need my proxy user name password to run tests.");
+ }
+
+ monitorPublisher = new MonitorPublisher(new EventBus());
+ pushQueue = new LinkedBlockingQueue<MonitorID>();
+ finishQueue = new LinkedBlockingQueue<MonitorID>();
+
+
+ AMQPMonitor amqpMonitor = new
+ AMQPMonitor(monitorPublisher,
+ pushQueue, finishQueue,proxyFilePath,"xsede",
+ Arrays.asList("info1.dyn.teragrid.org,info2.dyn.teragrid.org".split(",")));
+ try {
+ pushThread = (new Thread(amqpMonitor));
+ pushThread.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ hostDescription = new HostDescription(GsisshHostType.type);
+ hostDescription.getType().setHostAddress("login1.stampede.tacc.utexas.edu");
+ hostDescription.getType().setHostName("stampede-host");
+ ((GsisshHostType) hostDescription.getType()).setJobManager("slurm");
+ ((GsisshHostType) hostDescription.getType()).setInstalledPath("/usr/bin/");
+ ((GsisshHostType) hostDescription.getType()).setPort(2222);
+ ((GsisshHostType) hostDescription.getType()).setMonitorMode("push");
+ }
+
+ @Test
+ public void testAMQPMonitor() throws SSHApiException {
+ /* now have to submit a job to some machine and add that job to the queue */
+ //Create authentication
+ GSIAuthenticationInfo authenticationInfo
+ = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+ 7512, 17280000, certificateLocation);
+
+ // Server info
+ ServerInfo serverInfo = new ServerInfo("ogce", "login1.stampede.tacc.utexas.edu",2222);
+
+
+ Cluster pbsCluster = new
+ PBSCluster(serverInfo, authenticationInfo, org.apache.airavata.gsi.ssh.util.CommonUtils.getPBSJobManager("/usr/bin/"));
+
+
+ // Execute command
+ System.out.println("Target PBS file path: " + workingDirectory);
+ // constructing the job object
+ JobDescriptor jobDescriptor = new JobDescriptor();
+ jobDescriptor.setWorkingDirectory(workingDirectory);
+ jobDescriptor.setShellName("/bin/bash");
+ jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
+ jobDescriptor.setExecutablePath("/bin/echo");
+ jobDescriptor.setAllEnvExport(true);
+ jobDescriptor.setMailOptions("n");
+ jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
+ jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
+ jobDescriptor.setNodes(1);
+ jobDescriptor.setProcessesPerNode(1);
+ jobDescriptor.setQueueName("normal");
+ jobDescriptor.setMaxWallTime("60");
+ jobDescriptor.setAcountString("TG-STA110014S");
+ List<String> inputs = new ArrayList<String>();
+ jobDescriptor.setOwner("ogce");
+ inputs.add("Hello World");
+ jobDescriptor.setInputValues(inputs);
+ //finished construction of job object
+ System.out.println(jobDescriptor.toXML());
+ String jobID = pbsCluster.submitBatchJob(jobDescriptor);
+ System.out.println(jobID);
+ try {
+ pushQueue.add(new MonitorID(hostDescription, jobID,null,null,null, "ogce"));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ try {
+ pushThread.join();
+ } catch (InterruptedException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ class InnerClassAMQP{
+ @Subscribe
+ private void getStatus(JobStatusChangeRequest status){
+ Assert.assertNotNull(status);
+ pushThread.interrupt();
+ }
+ }
+ monitorPublisher.registerListener(new InnerClassAMQP());
+// try {
+// pushThread.join(5000);
+// Iterator<MonitorID> iterator = pushQueue.iterator();
+// MonitorID next = iterator.next();
+// org.junit.Assert.assertNotNull(next.getStatus());
+// } catch (Exception e) {
+// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+// }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
new file mode 100644
index 0000000..0c9dca8
--- /dev/null
+++ b/modules/gfac/gfac-core/src/test/java/org/apache/airavata/job/QstatMonitorTestWithMyProxyAuth.java
@@ -0,0 +1,167 @@
+/*
+ *
+ * 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.job;
+
+import com.google.common.eventbus.EventBus;
+import com.google.common.eventbus.Subscribe;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gsi.ssh.api.Cluster;
+import org.apache.airavata.gsi.ssh.api.SSHApiException;
+import org.apache.airavata.gsi.ssh.api.ServerInfo;
+import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
+import org.apache.airavata.gsi.ssh.impl.PBSCluster;
+import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
+import org.apache.airavata.gsi.ssh.util.CommonUtils;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.UserMonitorData;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.impl.pull.qstat.QstatMonitor;
+import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.junit.Assert;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+import java.util.concurrent.LinkedBlockingQueue;
+
+public class QstatMonitorTestWithMyProxyAuth {
+ private String myProxyUserName;
+ private String myProxyPassword;
+ private String certificateLocation;
+ private String pbsFilePath;
+ private String workingDirectory;
+ private HostDescription hostDescription;
+ private MonitorPublisher monitorPublisher;
+ private BlockingQueue<UserMonitorData> pullQueue;
+ private Thread monitorThread;
+
+ @org.testng.annotations.BeforeClass
+ public void setUp() throws Exception {
+ System.setProperty("myproxy.username", "ogce");
+ System.setProperty("myproxy.password", "OpenGwy14");
+ System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
+ System.setProperty("gsi.working.directory", "/home/ogce");
+ System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
+ myProxyUserName = System.getProperty("myproxy.username");
+ myProxyPassword = System.getProperty("myproxy.password");
+ workingDirectory = System.getProperty("gsi.working.directory");
+ certificateLocation = System.getProperty("trusted.cert.location");
+ if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) {
+ System.out.println(">>>>>> Please run tests with my proxy user name and password. " +
+ "E.g :- mvn clean install -Dmyproxy.username=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<");
+ throw new Exception("Need my proxy user name password to run tests.");
+ }
+
+ monitorPublisher = new MonitorPublisher(new EventBus());
+ class InnerClassQstat {
+
+ @Subscribe
+ private void getStatus(JobStatusChangeRequest status) {
+ Assert.assertNotNull(status);
+ System.out.println(status.getState().toString());
+ monitorThread.interrupt();
+ }
+ }
+ monitorPublisher.registerListener(this);
+ pullQueue = new LinkedBlockingQueue<UserMonitorData>();
+ QstatMonitor qstatMonitor = new
+ QstatMonitor(pullQueue, monitorPublisher);
+ try {
+ monitorThread = (new Thread(qstatMonitor));
+ monitorThread.start();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ hostDescription = new HostDescription(GsisshHostType.type);
+ hostDescription.getType().setHostAddress("trestles.sdsc.edu");
+ hostDescription.getType().setHostName("gsissh-gordon");
+ ((GsisshHostType) hostDescription.getType()).setPort(22);
+ ((GsisshHostType)hostDescription.getType()).setInstalledPath("/opt/torque/bin/");
+ }
+
+ @Test
+ public void testQstatMonitor() throws SSHApiException {
+ /* now have to submit a job to some machine and add that job to the queue */
+ //Create authentication
+ GSIAuthenticationInfo authenticationInfo
+ = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+ 7512, 17280000, certificateLocation);
+
+ // Server info
+ ServerInfo serverInfo = new ServerInfo("ogce", hostDescription.getType().getHostAddress());
+
+
+ Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/bin/"));
+
+
+ // Execute command
+ System.out.println("Target PBS file path: " + workingDirectory);
+ // constructing the job object
+ JobDescriptor jobDescriptor = new JobDescriptor();
+ jobDescriptor.setWorkingDirectory(workingDirectory);
+ jobDescriptor.setShellName("/bin/bash");
+ jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
+ jobDescriptor.setExecutablePath("/bin/echo");
+ jobDescriptor.setAllEnvExport(true);
+ jobDescriptor.setMailOptions("n");
+ jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
+ jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
+ jobDescriptor.setNodes(1);
+ jobDescriptor.setProcessesPerNode(1);
+ jobDescriptor.setQueueName("normal");
+ jobDescriptor.setMaxWallTime("60");
+ jobDescriptor.setAcountString("sds128");
+ List<String> inputs = new ArrayList<String>();
+ jobDescriptor.setOwner("ogce");
+ inputs.add("Hello World");
+ jobDescriptor.setInputValues(inputs);
+ //finished construction of job object
+ System.out.println(jobDescriptor.toXML());
+ for (int i = 0; i < 1; i++) {
+ String jobID = pbsCluster.submitBatchJob(jobDescriptor);
+ System.out.println("Job submitted successfully, Job ID: " + jobID);
+ MonitorID monitorID = new MonitorID(hostDescription, jobID,null,null,null, "ogce");
+ monitorID.setAuthenticationInfo(authenticationInfo);
+ try {
+ org.apache.airavata.gfac.monitor.util.CommonUtils.addMonitortoQueue(pullQueue, monitorID);
+ } catch (Exception e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+ try {
+
+ monitorThread.join();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Subscribe
+ public void testCaseShutDown(JobStatusChangeRequest status) {
+ Assert.assertNotNull(status.getState());
+ monitorThread.stop();
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-monitor/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/pom.xml b/modules/gfac/gfac-monitor/pom.xml
deleted file mode 100644
index 3fe60fc..0000000
--- a/modules/gfac/gfac-monitor/pom.xml
+++ /dev/null
@@ -1,80 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-
-<!--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. -->
-
-<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>
- <groupId>org.apache.airavata</groupId>
- <artifactId>airavata</artifactId>
- <version>0.12-SNAPSHOT</version>
- <relativePath>../../../pom.xml</relativePath>
- </parent>
-
- <modelVersion>4.0.0</modelVersion>
- <artifactId>gfac-monitor</artifactId>
- <name>GFAC Job Monitor</name>
- <description>This component handle the Airavata Job monitoring funcationality and consume the job-monitor tool</description>
- <url>http://airavata.apache.org/</url>
-
- <dependencies>
- <!-- Logging -->
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </dependency>
- <!-- monitoring tool from tools/job-monitor -->
- <dependency>
- <groupId>org.apache.airavata</groupId>
- <artifactId>job-monitor-tool</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>
- <exclusions>
- <exclusion>
- <groupId>org.bouncycastle</groupId>
- <artifactId>bcprov-jdk16</artifactId>
- </exclusion>
- </exclusions>
- </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>
- </dependencies>
-</project>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/AbstractActivityListener.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/AbstractActivityListener.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/AbstractActivityListener.java
deleted file mode 100644
index 49927e6..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/AbstractActivityListener.java
+++ /dev/null
@@ -1,27 +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.job.monitor;
-
-
-public interface AbstractActivityListener {
- public void setup(Object...configurations);
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/MonitorManager.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/MonitorManager.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/MonitorManager.java
deleted file mode 100644
index 9a1b68b..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/MonitorManager.java
+++ /dev/null
@@ -1,347 +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.job.monitor;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-import java.util.concurrent.LinkedBlockingQueue;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.Constants;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.job.monitor.core.Monitor;
-import org.apache.airavata.job.monitor.core.PullMonitor;
-import org.apache.airavata.job.monitor.core.PushMonitor;
-import org.apache.airavata.job.monitor.event.MonitorPublisher;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.impl.LocalJobMonitor;
-import org.apache.airavata.job.monitor.impl.pull.qstat.QstatMonitor;
-import org.apache.airavata.job.monitor.impl.push.amqp.AMQPMonitor;
-import org.apache.airavata.job.monitor.util.CommonUtils;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryImpl;
-import org.apache.airavata.registry.cpi.Registry;
-import org.apache.airavata.schemas.gfac.GlobusHostType;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.apache.airavata.schemas.gfac.SSHHostType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.eventbus.EventBus;
-
-/*
-this is the manager class for monitoring system of airavata,
-This simply handle the monitoring flow of the system.
-Keeps available jobs to monitor in a queue and once they are done
-remove them from the queue, this will be done by AiravataJobUpdator.
- */
-public class MonitorManager {
- private final static Logger logger = LoggerFactory.getLogger(MonitorManager.class);
-
- private final static String ACTIVITY_LISTENERS = "activity.listeners";
-
- private List<PullMonitor> pullMonitors; //todo though we have a List we only support one at a time
-
- private List<PushMonitor> pushMonitors; //todo we need to support multiple monitors dynamically
-
- private BlockingQueue<UserMonitorData> pullQueue;
-
- private BlockingQueue<MonitorID> pushQueue;
-
- private BlockingQueue<MonitorID> localJobQueue;
-
- private BlockingQueue<MonitorID> finishQueue;
-
- private MonitorPublisher monitorPublisher;
-
- private Monitor localJobMonitor;
-
- private Registry registry;
-
- /**
- * This will initialize the major monitoring system.
- */
- public MonitorManager() {
- this(new RegistryImpl());
- }
-
- public MonitorManager(Registry registry) {
- pullMonitors = new ArrayList<PullMonitor>();
- pushMonitors = new ArrayList<PushMonitor>();
- pullQueue = new LinkedBlockingQueue<UserMonitorData>();
- pushQueue = new LinkedBlockingQueue<MonitorID>();
- finishQueue = new LinkedBlockingQueue<MonitorID>();
- localJobQueue = new LinkedBlockingQueue<MonitorID>();
- monitorPublisher = new MonitorPublisher(new EventBus());
- this.registry = registry;
- loadActivityMonitors();
- }
-
- private void loadActivityMonitors(){
- try {
- String activityListenersString = ServerSettings.getSetting(ACTIVITY_LISTENERS);
- if (activityListenersString!=null){
- String[] activityListenerClasses = activityListenersString.split(",");
- for (String activityListenerClassName : activityListenerClasses) {
- try {
- activityListenerClassName=activityListenerClassName.trim();
- Class<?> classInstance = MonitorManager.class
- .getClassLoader().loadClass(activityListenerClassName);
- AbstractActivityListener monitor=(AbstractActivityListener)classInstance.newInstance();
- registerListener(monitor);
- } catch (ClassNotFoundException e) {
- logger.error("Error while locating activity monitor implementation \""+activityListenerClassName+"\"!!!",e);
- } catch (InstantiationException e) {
- logger.error("Error while initiating activity monitor instance \""+activityListenerClassName+"\"!!!",e);
- } catch (IllegalAccessException e) {
- logger.error("Error while initiating activity monitor instance \""+activityListenerClassName+"\"!!!",e);
- } catch (ClassCastException e){
- logger.error("Invalid activity monitor \""+activityListenerClassName+"\"!!!",e);
- }
- }
- }
- } catch (ApplicationSettingsException e1) {
- logger.warn("Error in reading activity monitors!!!", e1);
- }
-
- }
- /**
- * This can be use to add an empty AMQPMonitor object to the monitor system
- * and tihs method will take care of the initialization
- * todo may be we need to move this to some other class
- * @param monitor
- */
- public void addAMQPMonitor(AMQPMonitor monitor) {
- monitor.setPublisher(this.getMonitorPublisher());
- monitor.setFinishQueue(this.getFinishQueue());
- monitor.setRunningQueue(this.getPushQueue());
- addPushMonitor(monitor);
- }
-
-
- /**
- * This can be use to add an empty AMQPMonitor object to the monitor system
- * and tihs method will take care of the initialization
- * todo may be we need to move this to some other class
- * @param monitor
- */
- public void addLocalMonitor(LocalJobMonitor monitor) {
- monitor.setPublisher(this.getMonitorPublisher());
- monitor.setJobQueue(this.getLocalJobQueue());
- localJobMonitor = monitor;
- }
-
- /**
- * This can be used to adda a QstatMonitor and it will take care of
- * the initialization of QstatMonitor
- * //todo may be we need to move this to some other class
- * @param qstatMonitor
- */
- public void addQstatMonitor(QstatMonitor qstatMonitor) {
- qstatMonitor.setPublisher(this.getMonitorPublisher());
- qstatMonitor.setQueue(this.getPullQueue());
- addPullMonitor(qstatMonitor);
-
- }
-
- /**
- * To deal with the statuses users can write their own listener and implement their own logic
- *
- * @param listener Any class can be written and if you want the JobStatus object to be taken from the bus, just
- * have to put @subscribe as an annotation to your method to recieve the JobStatus object from the bus.
- */
- public void registerListener(Object listener) {
- monitorPublisher.registerListener(listener);
- if (listener instanceof AbstractActivityListener){
- ((AbstractActivityListener)listener).setup(registry, getFinishQueue(), getMonitorPublisher(), this);
- }
- }
-
- public void registerListener(AbstractActivityListener listener) {
- registerListener((Object)listener);
- }
-
- /**
- * To remove listeners of changing statuses
- *
- * @param listener Any class can be written and if you want the JobStatus object to be taken from the bus, just
- * have to put @subscribe as an annotation to your method to recieve the JobStatus object from the bus.
- */
- public void unregisterListener(Object listener) {
- monitorPublisher.unregisterListener(listener);
- }
-
- /**
- * todo write
- *
- * @param monitor
- */
- public void addPushMonitor(PushMonitor monitor) {
- pushMonitors.add(monitor);
- }
-
- /**
- * todo write
- *
- * @param monitor
- */
- public void addPullMonitor(PullMonitor monitor) {
- pullMonitors.add(monitor);
- }
-
- /**
- * Adding this method will trigger the thread in launchMonitor and notify it
- * This is going to be useful during the startup of the launching process
- *
- * @param monitorID
- * @throws AiravataMonitorException
- */
- public void addAJobToMonitor(MonitorID monitorID) throws AiravataMonitorException, InterruptedException {
-
- if (monitorID.getHost().getType() instanceof GsisshHostType) {
- GsisshHostType host = (GsisshHostType) monitorID.getHost().getType();
- if ("".equals(host.getMonitorMode()) || host.getMonitorMode() == null
- || Constants.PULL.equals(host.getMonitorMode())) {
- CommonUtils.addMonitortoQueue(pullQueue, monitorID);
- } else if (Constants.PUSH.equals(host.getMonitorMode())) {
- pushQueue.put(monitorID);
- finishQueue.put(monitorID);
- }
- } else if(monitorID.getHost().getType() instanceof GlobusHostType){
- logger.error("Monitoring does not support GlubusHostType resources");
- } else if(monitorID.getHost().getType() instanceof SSHHostType) {
- logger.error("Monitoring does not support GlubusHostType resources");
- localJobQueue.add(monitorID);
- } else {
- // we assume this is a type of localJobtype
- localJobQueue.add(monitorID);
- }
- }
-
- /**
- * This method should be invoked before adding any elements to monitorQueue
- * In this method we assume that we give higher preference to Push
- * Monitorig mechanism if there's any configured, otherwise Pull
- * monitoring will be launched.
- * Ex: If there's a reasource which doesn't support Push, we have
- * to live with Pull MOnitoring.
- *
- * @throws AiravataMonitorException
- */
- public void launchMonitor() throws AiravataMonitorException {
- //no push monitor is configured so we launch pull monitor
- if(localJobMonitor != null){
- (new Thread(localJobMonitor)).start();
- }
-
- for (PullMonitor monitor : pullMonitors) {
- (new Thread(monitor)).start();
- }
-
- //todo fix this
- for (PushMonitor monitor : pushMonitors) {
- (new Thread(monitor)).start();
- }
- }
-
- /**
- * This method should be invoked before adding any elements to monitorQueue
- * In this method we assume that we give higher preference to Push
- * Monitorig mechanism if there's any configured, otherwise Pull
- * monitoring will be launched.
- * Ex: If there's a reasource which doesn't support Push, we have
- * to live with Pull MOnitoring.
- *
- * @throws AiravataMonitorException
- */
- public void stopMonitor() throws AiravataMonitorException {
- //no push monitor is configured so we launch pull monitor
- if(localJobMonitor != null){
- (new Thread(localJobMonitor)).interrupt();
- }
-
- for (PullMonitor monitor : pullMonitors) {
- (new Thread(monitor)).interrupt();
- }
-
- //todo fix this
- for (PushMonitor monitor : pushMonitors) {
- (new Thread(monitor)).interrupt();
- }
- }
- /* getter setters for the private variables */
-
- public List<PullMonitor> getPullMonitors() {
- return pullMonitors;
- }
-
- public void setPullMonitors(List<PullMonitor> pullMonitors) {
- this.pullMonitors = pullMonitors;
- }
-
- public List<PushMonitor> getPushMonitors() {
- return pushMonitors;
- }
-
- public void setPushMonitors(List<PushMonitor> pushMonitors) {
- this.pushMonitors = pushMonitors;
- }
-
- public BlockingQueue<UserMonitorData> getPullQueue() {
- return pullQueue;
- }
-
- public void setPullQueue(BlockingQueue<UserMonitorData> pullQueue) {
- this.pullQueue = pullQueue;
- }
-
- public MonitorPublisher getMonitorPublisher() {
- return monitorPublisher;
- }
-
- public void setMonitorPublisher(MonitorPublisher monitorPublisher) {
- this.monitorPublisher = monitorPublisher;
- }
-
- public BlockingQueue<MonitorID> getFinishQueue() {
- return finishQueue;
- }
-
- public void setFinishQueue(BlockingQueue<MonitorID> finishQueue) {
- this.finishQueue = finishQueue;
- }
-
- public BlockingQueue<MonitorID> getPushQueue() {
- return pushQueue;
- }
-
- public void setPushQueue(BlockingQueue<MonitorID> pushQueue) {
- this.pushQueue = pushQueue;
- }
-
- public BlockingQueue<MonitorID> getLocalJobQueue() {
- return localJobQueue;
- }
-
- public void setLocalJobQueue(BlockingQueue<MonitorID> localJobQueue) {
- this.localJobQueue = localJobQueue;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/command/ExperimentCancelRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/command/ExperimentCancelRequest.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/command/ExperimentCancelRequest.java
deleted file mode 100644
index 7a8183e..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/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.job.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/b0230849/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/command/TaskCancelRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/command/TaskCancelRequest.java b/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/monitor/command/TaskCancelRequest.java
deleted file mode 100644
index 5648265..0000000
--- a/modules/gfac/gfac-monitor/src/main/java/org/apache/airavata/job/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.job.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/b0230849/modules/gfac/gfac-monitor/src/main/resources/PBSTemplate.xslt
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/resources/PBSTemplate.xslt b/modules/gfac/gfac-monitor/src/main/resources/PBSTemplate.xslt
deleted file mode 100644
index e4398e0..0000000
--- a/modules/gfac/gfac-monitor/src/main/resources/PBSTemplate.xslt
+++ /dev/null
@@ -1,77 +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
-# <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:jobName">
-#PBS -N <xsl:value-of select="ns:jobName"/>
- </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/b0230849/modules/gfac/gfac-monitor/src/main/resources/gsissh.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/main/resources/gsissh.properties b/modules/gfac/gfac-monitor/src/main/resources/gsissh.properties
deleted file mode 100644
index 3fdf76d..0000000
--- a/modules/gfac/gfac-monitor/src/main/resources/gsissh.properties
+++ /dev/null
@@ -1,26 +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.
-#
-
-###########################################################################
-# Specifies system level configurations as a key/value pairs.
-###########################################################################
-
-StrictHostKeyChecking=no
-ssh.session.timeout=360000
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/monitor/AMQPMonitorTest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/monitor/AMQPMonitorTest.java b/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/monitor/AMQPMonitorTest.java
deleted file mode 100644
index 495e666..0000000
--- a/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/monitor/AMQPMonitorTest.java
+++ /dev/null
@@ -1,144 +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.job.monitor;
-
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gsi.ssh.api.Cluster;
-import org.apache.airavata.gsi.ssh.api.SSHApiException;
-import org.apache.airavata.gsi.ssh.api.ServerInfo;
-import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gsi.ssh.impl.PBSCluster;
-import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.impl.push.amqp.AMQPMonitor;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.junit.Before;
-import org.junit.Test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-public class AMQPMonitorTest {
- private MonitorManager monitorManager;
-
- private String myProxyUserName;
- private String myProxyPassword;
- private String certificateLocation;
- private String pbsFilePath;
- private String workingDirectory;
- private HostDescription hostDescription;
- private String proxyFilePath;
-
-
- @Before
- public void setUp() throws Exception {
- System.setProperty("myproxy.username", "ogce");
- System.setProperty("myproxy.password", "OpenGwy14");
- System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
- System.setProperty("gsi.working.directory", "/home/ogce");
- System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
- myProxyUserName = System.getProperty("myproxy.username");
- myProxyPassword = System.getProperty("myproxy.password");
- workingDirectory = System.getProperty("gsi.working.directory");
- certificateLocation = System.getProperty("trusted.cert.location");
- proxyFilePath = System.getProperty("proxy.file.path");
- System.setProperty("connection.name", "xsede");
- if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) {
- System.out.println(">>>>>> Please run tests with my proxy user name and password. " +
- "E.g :- mvn clean install -Dmyproxy.user=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<");
- throw new Exception("Need my proxy user name password to run tests.");
- }
-
- monitorManager = new MonitorManager();
- AMQPMonitor amqpMonitor = new
- AMQPMonitor(monitorManager.getMonitorPublisher(),
- monitorManager.getPushQueue(), monitorManager.getFinishQueue(),proxyFilePath,"xsede",
- Arrays.asList("info1.dyn.teragrid.org,info2.dyn.teragrid.org".split(",")));
- try {
- monitorManager.addPushMonitor(amqpMonitor);
- monitorManager.launchMonitor();
- } catch (AiravataMonitorException e) {
- e.printStackTrace();
- }
-
- hostDescription = new HostDescription(GsisshHostType.type);
- hostDescription.getType().setHostAddress("stampede.tacc.xsede.org");
- hostDescription.getType().setHostName("stampede-host");
- ((GsisshHostType) hostDescription.getType()).setJobManager("slurm");
- ((GsisshHostType) hostDescription.getType()).setInstalledPath("/usr/bin/");
- ((GsisshHostType) hostDescription.getType()).setPort(2222);
- ((GsisshHostType) hostDescription.getType()).setMonitorMode("push");
- }
-
- @Test
- public void testAMQPMonitor() throws SSHApiException {
- /* now have to submit a job to some machine and add that job to the queue */
- //Create authentication
- GSIAuthenticationInfo authenticationInfo
- = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
- 7512, 17280000, certificateLocation);
-
- // Server info
- ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
-
-
- Cluster pbsCluster = new
- PBSCluster(serverInfo, authenticationInfo, org.apache.airavata.gsi.ssh.util.CommonUtils.getPBSJobManager("/opt/torque/bin/"));
-
-
- // Execute command
- System.out.println("Target PBS file path: " + workingDirectory);
- // constructing the job object
- JobDescriptor jobDescriptor = new JobDescriptor();
- jobDescriptor.setWorkingDirectory(workingDirectory);
- jobDescriptor.setShellName("/bin/bash");
- jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
- jobDescriptor.setExecutablePath("/bin/echo");
- jobDescriptor.setAllEnvExport(true);
- jobDescriptor.setMailOptions("n");
- jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
- jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
- jobDescriptor.setNodes(1);
- jobDescriptor.setProcessesPerNode(1);
- jobDescriptor.setQueueName("normal");
- jobDescriptor.setMaxWallTime("60");
- jobDescriptor.setAcountString("sds128");
- List<String> inputs = new ArrayList<String>();
- jobDescriptor.setOwner("ogce");
- inputs.add("Hello World");
- jobDescriptor.setInputValues(inputs);
- //finished construction of job object
- System.out.println(jobDescriptor.toXML());
- String jobID = pbsCluster.submitBatchJob(jobDescriptor);
- System.out.println(jobID);
- try {
- monitorManager.addAJobToMonitor(new MonitorID(hostDescription, jobID,null,null, null, "ogce"));
- } catch (AiravataMonitorException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- } catch (InterruptedException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/monitor/QstatMonitorTestWithMyProxyAuth.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/monitor/QstatMonitorTestWithMyProxyAuth.java b/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/monitor/QstatMonitorTestWithMyProxyAuth.java
deleted file mode 100644
index 5d7314a..0000000
--- a/modules/gfac/gfac-monitor/src/test/java/org/apache/airavata/job/monitor/QstatMonitorTestWithMyProxyAuth.java
+++ /dev/null
@@ -1,165 +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.job.monitor;
-
-import com.google.common.eventbus.Subscribe;
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gsi.ssh.api.Cluster;
-import org.apache.airavata.gsi.ssh.api.SSHApiException;
-import org.apache.airavata.gsi.ssh.api.ServerInfo;
-import org.apache.airavata.gsi.ssh.api.authentication.GSIAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gsi.ssh.impl.PBSCluster;
-import org.apache.airavata.gsi.ssh.impl.authentication.MyProxyAuthenticationInfo;
-import org.apache.airavata.gsi.ssh.util.CommonUtils;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.impl.pull.qstat.QstatMonitor;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.persistance.registry.jpa.impl.RegistryFactory;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.junit.Assert;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.Test;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.BlockingQueue;
-
-public class QstatMonitorTestWithMyProxyAuth {
- private MonitorManager monitorManager;
- private String myProxyUserName;
- private String myProxyPassword;
- private String certificateLocation;
- private String pbsFilePath;
- private String workingDirectory;
- private HostDescription hostDescription;
-
- @BeforeClass
- public void setUp() throws Exception {
-// System.setProperty("myproxy.username", "ogce");
-// System.setProperty("myproxy.password", "");
-// System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
-// System.setProperty("gsi.working.directory", "/home/ogce");
-// System.setProperty("trusted.cert.location", "/Users/lahirugunathilake/Downloads/certificates");
- myProxyUserName = System.getProperty("myproxy.username");
- myProxyPassword = System.getProperty("myproxy.password");
- workingDirectory = System.getProperty("gsi.working.directory");
- certificateLocation = System.getProperty("trusted.cert.location");
- if (myProxyUserName == null || myProxyPassword == null || workingDirectory == null) {
- System.out.println(">>>>>> Please run tests with my proxy user name and password. " +
- "E.g :- mvn clean install -Dmyproxy.username=xxx -Dmyproxy.password=xxx -Dgsi.working.directory=/path<<<<<<<");
- throw new Exception("Need my proxy user name password to run tests.");
- }
-
- monitorManager = new MonitorManager(RegistryFactory.getLoggingRegistry());
- QstatMonitor qstatMonitor = new
- QstatMonitor(monitorManager.getPullQueue(), monitorManager.getMonitorPublisher());
-
- monitorManager.getMonitorPublisher().registerListener(this);
- try {
- monitorManager.addPullMonitor(qstatMonitor);
- monitorManager.launchMonitor();
- } catch (AiravataMonitorException e) {
- e.printStackTrace();
- }
-
- hostDescription = new HostDescription(GsisshHostType.type);
- hostDescription.getType().setHostAddress("trestles.sdsc.edu");
- hostDescription.getType().setHostName("gsissh-gordon");
- ((GsisshHostType) hostDescription.getType()).setPort(22);
- ((GsisshHostType)hostDescription.getType()).setInstalledPath("/opt/torque/bin/");
- }
-
- @Test
- public void testQstatMonitor() throws SSHApiException {
- /* now have to submit a job to some machine and add that job to the queue */
- //Create authentication
- GSIAuthenticationInfo authenticationInfo
- = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
- 7512, 17280000, certificateLocation);
-
- // Server info
- ServerInfo serverInfo = new ServerInfo("ogce", hostDescription.getType().getHostAddress());
-
-
- Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/bin/"));
-
-
- // Execute command
- System.out.println("Target PBS file path: " + workingDirectory);
- // constructing the job object
- JobDescriptor jobDescriptor = new JobDescriptor();
- jobDescriptor.setWorkingDirectory(workingDirectory);
- jobDescriptor.setShellName("/bin/bash");
- jobDescriptor.setJobName("GSI_SSH_SLEEP_JOB");
- jobDescriptor.setExecutablePath("/bin/echo");
- jobDescriptor.setAllEnvExport(true);
- jobDescriptor.setMailOptions("n");
- jobDescriptor.setStandardOutFile(workingDirectory + File.separator + "application.out");
- jobDescriptor.setStandardErrorFile(workingDirectory + File.separator + "application.err");
- jobDescriptor.setNodes(1);
- jobDescriptor.setProcessesPerNode(1);
- jobDescriptor.setQueueName("normal");
- jobDescriptor.setMaxWallTime("60");
- jobDescriptor.setAcountString("sds128");
- List<String> inputs = new ArrayList<String>();
- jobDescriptor.setOwner("ogce");
- inputs.add("Hello World");
- jobDescriptor.setInputValues(inputs);
- //finished construction of job object
- System.out.println(jobDescriptor.toXML());
- for (int i = 0; i < 1; i++) {
- String jobID = pbsCluster.submitBatchJob(jobDescriptor);
- System.out.println("Job submitted successfully, Job ID: " + jobID);
- MonitorID monitorID = new MonitorID(hostDescription, jobID,null,null,null, "ogce");
- monitorID.setAuthenticationInfo(authenticationInfo);
- try {
- monitorManager.addAJobToMonitor(monitorID);
- } catch (AiravataMonitorException e) {
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- try {
- Thread.sleep(5000);
- BlockingQueue<UserMonitorData> pullQueue = monitorManager.getPullQueue();
- Iterator<UserMonitorData> iterator = pullQueue.iterator();
- UserMonitorData next = iterator.next();
- MonitorID monitorID = next.getHostMonitorData().get(0).getMonitorIDs().get(0);
- org.junit.Assert.assertNotNull(monitorID.getStatus());
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- @Subscribe
- public void testCaseShutDown(JobStatusChangeRequest status) {
- Assert.assertNotNull(status.getState());
- try {
- monitorManager.stopMonitor();
- } catch (AiravataMonitorException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-monitor/src/test/resources/gsissh.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/test/resources/gsissh.properties b/modules/gfac/gfac-monitor/src/test/resources/gsissh.properties
deleted file mode 100644
index 3fdf76d..0000000
--- a/modules/gfac/gfac-monitor/src/test/resources/gsissh.properties
+++ /dev/null
@@ -1,26 +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.
-#
-
-###########################################################################
-# Specifies system level configurations as a key/value pairs.
-###########################################################################
-
-StrictHostKeyChecking=no
-ssh.session.timeout=360000
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-monitor/src/test/resources/monitor.properties
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-monitor/src/test/resources/monitor.properties b/modules/gfac/gfac-monitor/src/test/resources/monitor.properties
deleted file mode 100644
index a4d68cf..0000000
--- a/modules/gfac/gfac-monitor/src/test/resources/monitor.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-amqp.hosts=info1.dyn.teragrid.org,info2.dyn.teragrid.org
-proxy.file.path=/Users/lahirugunathilake/Downloads/x509up_u503876
-connection.name=xsede_private
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-ssh/pom.xml
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/pom.xml b/modules/gfac/gfac-ssh/pom.xml
index ab8afc2..d3df765 100644
--- a/modules/gfac/gfac-ssh/pom.xml
+++ b/modules/gfac/gfac-ssh/pom.xml
@@ -19,7 +19,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>airavata-gfac-ssh</artifactId>
- <name>Airavata GFac SSH providers and handler implementation</name>
+ <name>Airavata GFac SSH implementation</name>
<description>This is the extension of </description>
<url>http://airavata.apache.org/</url>
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPInputHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPInputHandler.java
index 361bac7..1fa6d86 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPInputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPInputHandler.java
@@ -20,12 +20,15 @@
*/
package org.apache.airavata.gfac.handler;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.StringUtil;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.context.MessageContext;
+import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gfac.util.GFACSSHUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.gsi.ssh.api.ServerInfo;
@@ -81,6 +84,14 @@ public class AdvancedSCPInputHandler extends AbstractHandler{
}
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException, GFacException {
+ if(jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null){
+ try {
+ GFACSSHUtils.addSecurityContext(jobExecutionContext);
+ } catch (ApplicationSettingsException e) {
+ log.error(e.getMessage());
+ throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
+ }
+ }
ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext()
.getApplicationDeploymentDescription().getType();
@@ -100,7 +111,7 @@ public class AdvancedSCPInputHandler extends AbstractHandler{
// not really dealing with monitoring or job submission, so we pa
pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/torque-4.2.3.1/bin/"));
String parentPath = inputPath + File.separator + jobExecutionContext.getExperimentID() + File.separator + jobExecutionContext.getTaskData().getTaskID();
- (new File(parentPath)).mkdirs();
+ (new File(parentPath)).mkdirs();
MessageContext input = jobExecutionContext.getInMessageContext();
Set<String> parameters = input.getParameters().keySet();
for (String paramName : parameters) {
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPOutputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPOutputHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPOutputHandler.java
index 080d3c7..a0d3272 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPOutputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/AdvancedSCPOutputHandler.java
@@ -20,8 +20,11 @@
*/
package org.apache.airavata.gfac.handler;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.JobExecutionContext;
+import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gfac.util.GFACSSHUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
import org.apache.airavata.gsi.ssh.api.ServerInfo;
@@ -81,6 +84,14 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
@Override
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException, GFacException {
+ if(jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null){
+ try {
+ GFACSSHUtils.addSecurityContext(jobExecutionContext);
+ } catch (ApplicationSettingsException e) {
+ log.error(e.getMessage());
+ throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
+ }
+ }
ApplicationDeploymentDescriptionType app = jobExecutionContext.getApplicationContext()
.getApplicationDeploymentDescription().getType();
String standardError = app.getStandardError();
@@ -99,12 +110,12 @@ public class AdvancedSCPOutputHandler extends AbstractHandler {
try {
Cluster pbsCluster = new PBSCluster(serverInfo, authenticationInfo, CommonUtils.getPBSJobManager("/opt/torque/torque-4.2.3.1/bin/"));
outputPath = outputPath + File.separator + jobExecutionContext.getExperimentID() + "-" + jobExecutionContext.getTaskData().getTaskID()
- + File.separator;
+ + File.separator;
pbsCluster.makeDirectory(outputPath);
pbsCluster.scpTo(outputPath, standardError);
- pbsCluster.scpTo(outputPath,standardOutput);
- for(String files:jobExecutionContext.getOutputFiles()){
- pbsCluster.scpTo(outputPath,files);
+ pbsCluster.scpTo(outputPath, standardOutput);
+ for (String files : jobExecutionContext.getOutputFiles()) {
+ pbsCluster.scpTo(outputPath, files);
}
} catch (SSHApiException e) {
log.error("Error transfering files to remote host : " + hostName + " with the user: " + userName);
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java
index a068b77..51a2054 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPDirectorySetupHandler.java
@@ -24,10 +24,12 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.context.security.GSISecurityContext;
import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gfac.util.GFACSSHUtils;
import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
@@ -45,6 +47,14 @@ public class SCPDirectorySetupHandler extends AbstractHandler{
private static final Logger log = LoggerFactory.getLogger(SCPDirectorySetupHandler.class);
public void invoke(JobExecutionContext jobExecutionContext) throws GFacException {
+ if(jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null){
+ try {
+ GFACSSHUtils.addSecurityContext(jobExecutionContext);
+ } catch (ApplicationSettingsException e) {
+ log.error(e.getMessage());
+ throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
+ }
+ }
log.info("Setup SSH job directorties");
super.invoke(jobExecutionContext);
makeDirectory(jobExecutionContext);
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
index 4bf352b..bf22ad6 100644
--- a/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
+++ b/modules/gfac/gfac-ssh/src/main/java/org/apache/airavata/gfac/handler/SCPInputHandler.java
@@ -28,6 +28,7 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
import org.apache.airavata.common.utils.StringUtil;
import org.apache.airavata.commons.gfac.type.ActualParameter;
import org.apache.airavata.commons.gfac.type.MappingFactory;
@@ -36,6 +37,7 @@ import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.context.MessageContext;
import org.apache.airavata.gfac.context.security.GSISecurityContext;
import org.apache.airavata.gfac.context.security.SSHSecurityContext;
+import org.apache.airavata.gfac.util.GFACSSHUtils;
import org.apache.airavata.gfac.utils.GFacUtils;
import org.apache.airavata.gsi.ssh.api.Cluster;
import org.apache.airavata.gsi.ssh.api.SSHApiException;
@@ -58,7 +60,14 @@ public class SCPInputHandler extends AbstractHandler {
public void invoke(JobExecutionContext jobExecutionContext) throws GFacHandlerException, GFacException {
-
+ if(jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT) == null){
+ try {
+ GFACSSHUtils.addSecurityContext(jobExecutionContext);
+ } catch (ApplicationSettingsException e) {
+ log.error(e.getMessage());
+ throw new GFacHandlerException("Error while creating SSHSecurityContext", e, e.getLocalizedMessage());
+ }
+ }
log.info("Invoking SCPInputHandler");
super.invoke(jobExecutionContext);
[3/8] merging monitoring with gfac-core, later this will be separated
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
deleted file mode 100644
index b75b1c8..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/QstatMonitor.java
+++ /dev/null
@@ -1,262 +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.job.monitor.impl.pull.qstat;
-
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.gsi.ssh.api.SSHApiException;
-import org.apache.airavata.job.monitor.HostMonitorData;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.UserMonitorData;
-import org.apache.airavata.job.monitor.core.PullMonitor;
-import org.apache.airavata.job.monitor.event.MonitorPublisher;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.job.monitor.util.CommonUtils;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.sql.Timestamp;
-import java.util.*;
-import java.util.concurrent.BlockingQueue;
-
-/**
- * This monitor is based on qstat command which can be run
- * in grid resources and retrieve the job status.
- */
-public class QstatMonitor extends PullMonitor {
- private final static Logger logger = LoggerFactory.getLogger(QstatMonitor.class);
-
- // I think this should use DelayedBlocking Queue to do the monitoring*/
- private BlockingQueue<UserMonitorData> queue;
-
- private boolean startPulling = false;
-
- private Map<String, ResourceConnection> connections;
-
- private MonitorPublisher publisher;
-
- public QstatMonitor(){
- connections = new HashMap<String, ResourceConnection>();
- }
- public QstatMonitor(BlockingQueue<UserMonitorData> queue, MonitorPublisher publisher) {
- this.queue = queue;
- this.publisher = publisher;
- connections = new HashMap<String, ResourceConnection>();
- }
-
- public void run() {
- /* implement a logic to pick each monitorID object from the queue and do the
- monitoring
- */
- this.startPulling = true;
- while (this.startPulling && !ServerSettings.isStopAllThreads()) {
- try {
- startPulling();
- // After finishing one iteration of the full queue this thread sleeps 1 second
- Thread.sleep(10000);
- } catch (Exception e){
- // we catch all the exceptions here because no matter what happens we do not stop running this
- // thread, but ideally we should report proper error messages, but this is handled in startPulling
- // method, incase something happen in Thread.sleep we handle it with this catch block.
- e.printStackTrace();
- logger.error(e.getMessage());
- }
- }
- // thread is going to return so we close all the connections
- Iterator<String> iterator = connections.keySet().iterator();
- while(iterator.hasNext()){
- String next = iterator.next();
- ResourceConnection resourceConnection = connections.get(next);
- try {
- resourceConnection.getCluster().disconnect();
- } catch (SSHApiException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- }
-
- /**
- * This method will can invoke when PullMonitor needs to start
- * and it has to invoke in the frequency specified below,
- *
- * @return if the start process is successful return true else false
- */
- public boolean startPulling() throws AiravataMonitorException {
- // take the top element in the queue and pull the data and put that element
- // at the tail of the queue
- //todo this polling will not work with multiple usernames but with single user
- // and multiple hosts, currently monitoring will work
- UserMonitorData take = null;
- JobStatusChangeRequest jobStatus = new JobStatusChangeRequest();
- MonitorID currentMonitorID = null;
- HostDescription currentHostDescription = null;
- try {
- take = this.queue.take();
- List<MonitorID> completedJobs = new ArrayList<MonitorID>();
- List<HostMonitorData> hostMonitorData = take.getHostMonitorData();
- for (HostMonitorData iHostMonitorData : hostMonitorData) {
- if (iHostMonitorData.getHost().getType() instanceof GsisshHostType) {
- currentHostDescription = iHostMonitorData.getHost();
- GsisshHostType gsisshHostType = (GsisshHostType) iHostMonitorData.getHost().getType();
- String hostName = gsisshHostType.getHostAddress();
- ResourceConnection connection = null;
- if (connections.containsKey(hostName)) {
- logger.debug("We already have this connection so not going to create one");
- connection = connections.get(hostName);
- } else {
- connection = new ResourceConnection(take.getUserName(), iHostMonitorData, gsisshHostType.getInstalledPath());
- connections.put(hostName, connection);
- }
- List<MonitorID> monitorID = iHostMonitorData.getMonitorIDs();
- Map<String, JobState> jobStatuses = connection.getJobStatuses(take.getUserName(), monitorID);
- for (MonitorID iMonitorID : monitorID) {
- currentMonitorID = iMonitorID;
- iMonitorID.setStatus(jobStatuses.get(iMonitorID.getJobID()));
- jobStatus.setMonitorID(iMonitorID);
- jobStatus.setState(iMonitorID.getStatus());
- // we have this JobStatus class to handle amqp monitoring
-
- publisher.publish(jobStatus);
- // if the job is completed we do not have to put the job to the queue again
- iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
-
- // After successful monitoring perform following actions to cleanup the queue, if necessary
- if (jobStatus.getState().equals(JobState.COMPLETE)) {
- completedJobs.add(iMonitorID);
- } else if (iMonitorID.getFailedCount() > 2 && iMonitorID.getStatus().equals(JobState.UNKNOWN)) {
- logger.error("Tried to monitor the job with ID " + iMonitorID.getJobID() + " But failed 3 times, so skip this Job from Monitor");
- iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
- completedJobs.add(iMonitorID);
- } else {
- // Evey
- iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
- // if the job is complete we remove it from the Map, if any of these maps
- // get empty this userMonitorData will get delete from the queue
- }
- }
- } else {
- logger.debug("Qstat Monitor doesn't handle non-gsissh hosts");
- }
- }
- // We have finished all the HostMonitorData object in userMonitorData, now we need to put it back
- // now the userMonitorData goes back to the tail of the queue
- queue.put(take);
- // cleaning up the completed jobs, this method will remove some of the userMonitorData from the queue if
- // they become empty
- for(MonitorID completedJob:completedJobs){
- CommonUtils.removeMonitorFromQueue(queue,completedJob);
- }
- } catch (InterruptedException e) {
- if (!this.queue.contains(take)) {
- try {
- this.queue.put(take);
- } catch (InterruptedException e1) {
- e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- logger.error("Error handling the job with Job ID:" + currentMonitorID.getJobID());
- throw new AiravataMonitorException(e);
- } catch (SSHApiException e) {
- logger.error(e.getMessage());
- if (e.getMessage().contains("Unknown Job Id Error")) {
- // in this case job is finished or may be the given job ID is wrong
- jobStatus.setState(JobState.UNKNOWN);
- publisher.publish(jobStatus);
- } else if (e.getMessage().contains("illegally formed job identifier")) {
- logger.error("Wrong job ID is given so dropping the job from monitoring system");
- } else if (!this.queue.contains(take)) { // we put the job back to the queue only if its state is not unknown
- if (currentMonitorID == null) {
- logger.error("Monitoring the jobs failed, for user: " + take.getUserName()
- + " in Host: " + currentHostDescription.getType().getHostAddress());
- } else {
- if (currentMonitorID != null) {
- if (currentMonitorID.getFailedCount() < 2) {
- try {
- currentMonitorID.setFailedCount(currentMonitorID.getFailedCount() + 1);
- this.queue.put(take);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- } else {
- logger.error(e.getMessage());
- logger.error("Tried to monitor the job 3 times, so dropping of the the Job with ID: " + currentMonitorID.getJobID());
- }
- }
- }
- }
- throw new AiravataMonitorException("Error retrieving the job status", e);
- } catch (Exception e) {
- if (currentMonitorID != null) {
- if (currentMonitorID.getFailedCount() < 3) {
- try {
- currentMonitorID.setFailedCount(currentMonitorID.getFailedCount() + 1);
- this.queue.put(take);
- // if we get a wrong status we wait for a while and request again
- Thread.sleep(10000);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }
- } else {
- logger.error(e.getMessage());
- logger.error("Tryied to monitor the job 3 times, so dropping of the the Job with ID: " + currentMonitorID.getJobID());
- }
- }
- throw new AiravataMonitorException("Error retrieving the job status", e);
- }
-
-
- return true;
- }
-
-
- /**
- * This is the method to stop the polling process
- *
- * @return if the stopping process is successful return true else false
- */
- public boolean stopPulling() {
- this.startPulling = false;
- return true;
- }
-
- public MonitorPublisher getPublisher() {
- return publisher;
- }
-
- public void setPublisher(MonitorPublisher publisher) {
- this.publisher = publisher;
- }
-
- public BlockingQueue<UserMonitorData> getQueue() {
- return queue;
- }
-
- public void setQueue(BlockingQueue<UserMonitorData> queue) {
- this.queue = queue;
- }
-
- public boolean authenticate() {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
deleted file mode 100644
index 8da5054..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/pull/qstat/ResourceConnection.java
+++ /dev/null
@@ -1,152 +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.job.monitor.impl.pull.qstat;
-
-import org.apache.airavata.gsi.ssh.api.SSHApiException;
-import org.apache.airavata.gsi.ssh.api.ServerInfo;
-import org.apache.airavata.gsi.ssh.api.authentication.*;
-import org.apache.airavata.gsi.ssh.api.job.JobManagerConfiguration;
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-import org.apache.airavata.gsi.ssh.impl.PBSCluster;
-import org.apache.airavata.gsi.ssh.util.CommonUtils;
-import org.apache.airavata.job.monitor.HostMonitorData;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.UserMonitorData;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-import java.util.TreeMap;
-
-
-public class ResourceConnection {
- private static final Logger log = LoggerFactory.getLogger(ResourceConnection.class);
-
- private PBSCluster cluster;
-
- public ResourceConnection(MonitorID monitorID, String installedPath) throws SSHApiException {
- AuthenticationInfo authenticationInfo = monitorID.getAuthenticationInfo();
- String hostAddress = monitorID.getHost().getType().getHostAddress();
- String userName = monitorID.getUserName();
- String jobManager = ((GsisshHostType)monitorID.getHost().getType()).getJobManager();
- JobManagerConfiguration jConfig = null;
- if (jobManager == null) {
- log.error("No Job Manager is configured, so we are picking pbs as the default job manager");
- jConfig = CommonUtils.getPBSJobManager(installedPath);
- } else {
- if (org.apache.airavata.job.monitor.util.CommonUtils.isPBSHost(monitorID.getHost())) {
- jConfig = CommonUtils.getPBSJobManager(installedPath);
- } else if(org.apache.airavata.job.monitor.util.CommonUtils.isSlurm(monitorID.getHost())) {
- jConfig = CommonUtils.getSLURMJobManager(installedPath);
- } else if(org.apache.airavata.job.monitor.util.CommonUtils.isSGE(monitorID.getHost())) {
- jConfig = CommonUtils.getSGEJobManager(installedPath);
- }
- //todo support br2 etc
- }
- ServerInfo serverInfo = new ServerInfo(userName, hostAddress, ((GsisshHostType)monitorID.getHost().getType()).getPort());
- cluster = new PBSCluster(serverInfo, authenticationInfo, jConfig);
- }
-
- public ResourceConnection(String userName, HostMonitorData hostMonitorData, String installedPath) throws SSHApiException {
- AuthenticationInfo authenticationInfo = hostMonitorData.getMonitorIDs().get(0).getAuthenticationInfo();
- String hostAddress = hostMonitorData.getHost().getType().getHostAddress();
- String jobManager = ((GsisshHostType)hostMonitorData.getHost().getType()).getJobManager();
- JobManagerConfiguration jConfig = null;
- if (jobManager == null) {
- log.error("No Job Manager is configured, so we are picking pbs as the default job manager");
- jConfig = CommonUtils.getPBSJobManager(installedPath);
- } else {
- if (org.apache.airavata.job.monitor.util.CommonUtils.isPBSHost(hostMonitorData.getHost())) {
- jConfig = CommonUtils.getPBSJobManager(installedPath);
- } else if(org.apache.airavata.job.monitor.util.CommonUtils.isSlurm(hostMonitorData.getHost())) {
- jConfig = CommonUtils.getSLURMJobManager(installedPath);
- }else if(org.apache.airavata.job.monitor.util.CommonUtils.isSGE(hostMonitorData.getHost())) {
- jConfig = CommonUtils.getSGEJobManager(installedPath);
- }
- //todo support br2 etc
- }
- ServerInfo serverInfo = new ServerInfo(userName, hostAddress, ((GsisshHostType)hostMonitorData.getHost().getType()).getPort());
- cluster = new PBSCluster(serverInfo, authenticationInfo, jConfig);
- }
- public JobState getJobStatus(MonitorID monitorID) throws SSHApiException {
- String jobID = monitorID.getJobID();
- //todo so currently we execute the qstat for each job but we can use user based monitoring
- //todo or we should concatenate all the commands and execute them in one go and parse the response
- return getStatusFromString(cluster.getJobStatus(jobID).toString());
- }
-
- public Map<String,JobState> getJobStatuses(String userName,List<MonitorID> monitorIDs) throws SSHApiException {
- Map<String,JobStatus> treeMap = new TreeMap<String,JobStatus>();
- Map<String,JobState> treeMap1 = new TreeMap<String,JobState>();
- // creating a sorted map with all the jobIds and with the predefined
- // status as UNKNOWN
- for (MonitorID monitorID : monitorIDs) {
- treeMap.put(monitorID.getJobID(), JobStatus.U);
- }
- //todo so currently we execute the qstat for each job but we can use user based monitoring
- //todo or we should concatenate all the commands and execute them in one go and parse the response
- cluster.getJobStatuses(userName,treeMap);
- for(String key:treeMap.keySet()){
- treeMap1.put(key,getStatusFromString(treeMap.get(key).toString()));
- }
- return treeMap1;
- }
- private JobState getStatusFromString(String status) {
- log.info("parsing the job status returned : " + status);
- if(status != null){
- if("C".equals(status) || "CD".equals(status)|| "E".equals(status) || "CG".equals(status)){
- return JobState.COMPLETE;
- }else if("H".equals(status) || "h".equals(status)){
- return JobState.HELD;
- }else if("Q".equals(status) || "qw".equals(status)){
- return JobState.QUEUED;
- }else if("R".equals(status) || "CF".equals(status) || "r".equals(status)){
- return JobState.ACTIVE;
- }else if ("T".equals(status)) {
- return JobState.HELD;
- } else if ("W".equals(status) || "PD".equals(status)) {
- return JobState.QUEUED;
- } else if ("S".equals(status)) {
- return JobState.SUSPENDED;
- }else if("CA".equals(status)){
- return JobState.CANCELED;
- }else if ("F".equals(status) || "NF".equals(status) || "TO".equals(status)) {
- return JobState.FAILED;
- }else if ("PR".equals(status) || "Er".equals(status)) {
- return JobState.FAILED;
- }else if ("U".equals(status)){
- return JobState.UNKNOWN;
- }
- }
- return JobState.UNKNOWN;
- }
-
- public PBSCluster getCluster() {
- return cluster;
- }
-
- public void setCluster(PBSCluster cluster) {
- this.cluster = cluster;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/AMQPMonitor.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/AMQPMonitor.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/AMQPMonitor.java
deleted file mode 100644
index dc6d193..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/AMQPMonitor.java
+++ /dev/null
@@ -1,268 +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.job.monitor.impl.push.amqp;
-
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.BlockingQueue;
-
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.job.monitor.JobIdentity;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.core.PushMonitor;
-import org.apache.airavata.job.monitor.event.MonitorPublisher;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.job.monitor.util.AMQPConnectionUtil;
-import org.apache.airavata.job.monitor.util.CommonUtils;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.eventbus.EventBus;
-import com.google.common.eventbus.Subscribe;
-import com.rabbitmq.client.Channel;
-import com.rabbitmq.client.Connection;
-
-/**
- * This is the implementation for AMQP based finishQueue, this uses
- * rabbitmq client to recieve AMQP based monitoring data from
- * mostly excede resources.
- */
-public class AMQPMonitor extends PushMonitor {
- private final static Logger logger = LoggerFactory.getLogger(AMQPMonitor.class);
-
-
- /* this will keep all the channels available in the system, we do not create
- channels for all the jobs submitted, but we create channels for each user for each
- host.
- */
- private Map<String, Channel> availableChannels;
-
- private MonitorPublisher publisher;
-
- private MonitorPublisher localPublisher;
-
- private BlockingQueue<MonitorID> runningQueue;
-
- private BlockingQueue<MonitorID> finishQueue;
-
- private String connectionName;
-
- private String proxyPath;
-
- private List<String> amqpHosts;
-
- private boolean startRegister;
-
- public AMQPMonitor(){
-
- }
- public AMQPMonitor(MonitorPublisher publisher, BlockingQueue<MonitorID> runningQueue,
- BlockingQueue<MonitorID> finishQueue,
- String proxyPath,String connectionName,List<String> hosts) {
- this.publisher = publisher;
- this.runningQueue = runningQueue; // these will be initialized by the MonitorManager
- this.finishQueue = finishQueue; // these will be initialized by the MonitorManager
- this.availableChannels = new HashMap<String, Channel>();
- this.connectionName = connectionName;
- this.proxyPath = proxyPath;
- this.amqpHosts = hosts;
- this.localPublisher = new MonitorPublisher(new EventBus());
- this.localPublisher.registerListener(this);
- }
-
- public void initialize(String proxyPath, String connectionName, List<String> hosts) {
- this.availableChannels = new HashMap<String, Channel>();
- this.connectionName = connectionName;
- this.proxyPath = proxyPath;
- this.amqpHosts = hosts;
- this.localPublisher = new MonitorPublisher(new EventBus());
- this.localPublisher.registerListener(this);
- }
-
- @Override
- public boolean registerListener(MonitorID monitorID) throws AiravataMonitorException {
- // we subscribe to read user-host based subscription
- HostDescription host = monitorID.getHost();
- String hostAddress = host.getType().getHostAddress();
- // in amqp case there are no multiple jobs per each host, because once a job is put in to the queue it
- // will be picked by the Monitor, so jobs will not stay in this queueu but jobs will stay in finishQueue
- String channelID = CommonUtils.getChannelID(monitorID);
- if(availableChannels.get(channelID) == null){
- try {
- //todo need to fix this rather getting it from a file
- Connection connection = AMQPConnectionUtil.connect(amqpHosts, connectionName, proxyPath);
- Channel channel = null;
- channel = connection.createChannel();
- availableChannels.put(channelID, channel);
- String queueName = channel.queueDeclare().getQueue();
-
- BasicConsumer consumer = new
- BasicConsumer(new JSONMessageParser(), localPublisher); // here we use local publisher
- channel.basicConsume(queueName, true, consumer);
- String filterString = CommonUtils.getRoutingKey(monitorID.getUserName(), hostAddress);
- // here we queuebind to a particular user in a particular machine
- channel.queueBind(queueName, "glue2.computing_activity", filterString);
- logger.info("Using filtering string to monitor: " + filterString);
- } catch (IOException e) {
- logger.error("Error creating the connection to finishQueue the job:" + monitorID.getUserName());
- }
- }
- return true;
- }
-
- public void run() {
- // before going to the while true mode we start unregister thread
- startRegister = true; // this will be unset by someone else
- while (startRegister || !ServerSettings.isStopAllThreads()) {
- try {
- MonitorID take = runningQueue.take();
- this.registerListener(take);
- } catch (AiravataMonitorException e) { // catch any exceptino inside the loop
- e.printStackTrace();
- } catch (InterruptedException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- } catch (Exception e){
- e.printStackTrace();
- }
- }
- Set<String> strings = availableChannels.keySet();
- for(String key:strings) {
- Channel channel = availableChannels.get(key);
- try {
- channel.close();
- } catch (IOException e) {
- e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
- }
- }
- }
-
- @Subscribe
- public boolean unRegisterListener(MonitorID monitorID) throws AiravataMonitorException {
- Iterator<MonitorID> iterator = finishQueue.iterator();
- MonitorID next = null;
- while(iterator.hasNext()){
- next = iterator.next();
- if(next.getJobID().endsWith(monitorID.getJobID())){
- break;
- }
- }
- if(next == null) {
- logger.error("Job has removed from the queue, old obsolete message recieved");
- return false;
- }
- String channelID = CommonUtils.getChannelID(next);
- if (JobState.FAILED.equals(monitorID.getStatus()) || JobState.COMPLETE.equals(monitorID.getStatus())) {
- finishQueue.remove(next);
-
- // if this is the last job in the queue at this point with the same username and same host we
- // close the channel and close the connection and remove it from availableChannels
- if (CommonUtils.isTheLastJobInQueue(finishQueue, next)) {
- logger.info("There are no jobs to monitor for common ChannelID:" + channelID + " , so we unsubscribe it" +
- ", incase new job created we do subscribe again");
- Channel channel = availableChannels.get(channelID);
- if (channel == null) {
- logger.error("Already Unregistered the listener");
- throw new AiravataMonitorException("Already Unregistered the listener");
- } else {
- try {
- channel.queueUnbind(channel.queueDeclare().getQueue(), "glue2.computing_activity", CommonUtils.getRoutingKey(next));
- channel.close();
- channel.getConnection().close();
- availableChannels.remove(channelID);
- } catch (IOException e) {
- logger.error("Error unregistering the listener");
- throw new AiravataMonitorException("Error unregistering the listener");
- }
- }
- }
- }
- next.setStatus(monitorID.getStatus());
- publisher.publish(new JobStatusChangeRequest(next, new JobIdentity(next.getExperimentID(), next.getWorkflowNodeID(), next.getTaskID(), next.getJobID()),next.getStatus()));
- return true;
- }
- @Override
- public boolean stopRegister() throws AiravataMonitorException {
- return false; //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public Map<String, Channel> getAvailableChannels() {
- return availableChannels;
- }
-
- public void setAvailableChannels(Map<String, Channel> availableChannels) {
- this.availableChannels = availableChannels;
- }
-
- public MonitorPublisher getPublisher() {
- return publisher;
- }
-
- public void setPublisher(MonitorPublisher publisher) {
- this.publisher = publisher;
- }
-
- public BlockingQueue<MonitorID> getRunningQueue() {
- return runningQueue;
- }
-
- public void setRunningQueue(BlockingQueue<MonitorID> runningQueue) {
- this.runningQueue = runningQueue;
- }
-
- public BlockingQueue<MonitorID> getFinishQueue() {
- return finishQueue;
- }
-
- public void setFinishQueue(BlockingQueue<MonitorID> finishQueue) {
- this.finishQueue = finishQueue;
- }
-
- public String getProxyPath() {
- return proxyPath;
- }
-
- public void setProxyPath(String proxyPath) {
- this.proxyPath = proxyPath;
- }
-
- public List<String> getAmqpHosts() {
- return amqpHosts;
- }
-
- public void setAmqpHosts(List<String> amqpHosts) {
- this.amqpHosts = amqpHosts;
- }
-
- public boolean isStartRegister() {
- return startRegister;
- }
-
- public void setStartRegister(boolean startRegister) {
- this.startRegister = startRegister;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/BasicConsumer.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/BasicConsumer.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/BasicConsumer.java
deleted file mode 100644
index 5a2d40d..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/BasicConsumer.java
+++ /dev/null
@@ -1,93 +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.job.monitor.impl.push.amqp;
-
-import com.rabbitmq.client.AMQP;
-import com.rabbitmq.client.Consumer;
-import com.rabbitmq.client.Envelope;
-import com.rabbitmq.client.ShutdownSignalException;
-import org.apache.airavata.job.monitor.HostMonitorData;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.UserMonitorData;
-import org.apache.airavata.job.monitor.core.MessageParser;
-import org.apache.airavata.job.monitor.event.MonitorPublisher;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
-import java.util.Map;
-
-public class BasicConsumer implements Consumer {
- private final static Logger logger = LoggerFactory.getLogger(AMQPMonitor.class);
-
- private MessageParser parser;
-
- private MonitorPublisher publisher;
-
- public BasicConsumer(MessageParser parser, MonitorPublisher publisher) {
- this.parser = parser;
- this.publisher = publisher;
- }
-
- public void handleCancel(java.lang.String consumerTag) {
- }
-
- public void handleCancelOk(java.lang.String consumerTag) {
- }
-
- public void handleConsumeOk(java.lang.String consumerTag) {
- }
-
- public void handleDelivery(java.lang.String consumerTag,
- Envelope envelope,
- AMQP.BasicProperties properties,
- byte[] body) {
-
- logger.debug("job update for: " + envelope.getRoutingKey());
- String message = new String(body);
- message = message.replaceAll("(?m)^", " ");
- // Here we parse the message and get the job status and push it
- // to the Event bus, this will be picked by
-// AiravataJobStatusUpdator and store in to registry
-
- logger.debug("************************************************************");
- logger.debug("AMQP Message recieved \n" + message);
- logger.debug("************************************************************");
- try {
- String jobID = envelope.getRoutingKey().split("\\.")[0];
- MonitorID monitorID = new MonitorID(null, jobID, null, null, null, null);
- monitorID.setStatus(parser.parseMessage(message));
- publisher.publish(monitorID);
- } catch (AiravataMonitorException e) {
- e.printStackTrace();
- }
- }
-
- public void handleRecoverOk(java.lang.String consumerTag) {
- }
-
- public void handleShutdownSignal(java.lang.String consumerTag, ShutdownSignalException sig) {
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/JSONMessageParser.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/JSONMessageParser.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/JSONMessageParser.java
deleted file mode 100644
index cdff685..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/JSONMessageParser.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.job.monitor.impl.push.amqp;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-import org.apache.airavata.ComputingActivity;
-import org.apache.airavata.job.monitor.HostMonitorData;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.UserMonitorData;
-import org.apache.airavata.job.monitor.core.MessageParser;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.List;
-
-public class JSONMessageParser implements MessageParser {
- private final static Logger logger = LoggerFactory.getLogger(JSONMessageParser.class);
-
- public JobState parseMessage(String message)throws AiravataMonitorException{
- /*todo write a json message parser here*/
- logger.debug(message);
- ObjectMapper objectMapper = new ObjectMapper();
- try {
- ComputingActivity computingActivity = objectMapper.readValue(message.getBytes(), ComputingActivity.class);
- logger.info(computingActivity.getIDFromEndpoint());
- List<String> stateList = computingActivity.getState();
- JobState jobState = null;
- for (String aState : stateList) {
- jobState = getStatusFromString(aState);
- }
- // we get the last value of the state array
- return jobState;
- } catch (IOException e) {
- throw new AiravataMonitorException(e);
- }
- }
-
-private JobState getStatusFromString(String status) {
- logger.info("parsing the job status returned : " + status);
- if(status != null){
- if("ipf:finished".equals(status)){
- return JobState.COMPLETE;
- }else if("ipf:pending".equals(status)|| "ipf:starting".equals(status)){
- return JobState.QUEUED;
- }else if("ipf:running".equals(status) || "ipf:finishing".equals(status)){
- return JobState.ACTIVE;
- }else if ("ipf:held".equals(status) || "ipf:teminating".equals(status) || "ipf:teminated".equals(status)) {
- return JobState.HELD;
- } else if ("ipf:suspending".equals(status)) {
- return JobState.SUSPENDED;
- }else if ("ipf:failed".equals(status)) {
- return JobState.FAILED;
- }else if ("ipf:unknown".equals(status)){
- return JobState.UNKNOWN;
- }
- }
- return JobState.UNKNOWN;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/UnRegisterWorker.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/UnRegisterWorker.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/UnRegisterWorker.java
deleted file mode 100644
index becb4d7..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/impl/push/amqp/UnRegisterWorker.java
+++ /dev/null
@@ -1,68 +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.job.monitor.impl.push.amqp;
-
-import com.google.common.eventbus.Subscribe;
-import com.rabbitmq.client.Channel;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
-import org.apache.airavata.job.monitor.util.CommonUtils;
-import org.apache.airavata.model.workspace.experiment.JobState;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.IOException;
-import java.util.Map;
-
-public class UnRegisterWorker{
- private final static Logger logger = LoggerFactory.getLogger(UnRegisterWorker.class);
- private Map<String, Channel> availableChannels;
-
- public UnRegisterWorker(Map<String, Channel> channels) {
- this.availableChannels = channels;
- }
-
- @Subscribe
- private boolean unRegisterListener(JobStatusChangeRequest jobStatus) throws AiravataMonitorException {
- MonitorID monitorID = jobStatus.getMonitorID();
- String channelID = CommonUtils.getChannelID(monitorID);
- if (JobState.FAILED.equals(jobStatus.getState()) || JobState.COMPLETE.equals(jobStatus.getState())){
- Channel channel = availableChannels.get(channelID);
- if (channel == null) {
- logger.error("Already Unregistered the listener");
- throw new AiravataMonitorException("Already Unregistered the listener");
- } else {
- try {
- channel.queueUnbind(channel.queueDeclare().getQueue(), "glue2.computing_activity", CommonUtils.getRoutingKey(monitorID));
- channel.close();
- channel.getConnection().close();
- availableChannels.remove(channelID);
- } catch (IOException e) {
- logger.error("Error unregistering the listener");
- throw new AiravataMonitorException("Error unregistering the listener");
- }
- }
- }
- return true;
- }
-}
-
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/AbstractStateChangeRequest.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/AbstractStateChangeRequest.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/AbstractStateChangeRequest.java
deleted file mode 100644
index bacd8df..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/AbstractStateChangeRequest.java
+++ /dev/null
@@ -1,27 +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.job.monitor.state;
-
-
-public abstract class AbstractStateChangeRequest implements PublisherMessage{
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/ExperimentStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/ExperimentStatusChangeRequest.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/ExperimentStatusChangeRequest.java
deleted file mode 100644
index 9bee5ca..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/ExperimentStatusChangeRequest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.job.monitor.state;
-
-import org.apache.airavata.job.monitor.ExperimentIdentity;
-import org.apache.airavata.model.workspace.experiment.ExperimentState;
-
-/**
- * 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 ExperimentStatusChangeRequest extends AbstractStateChangeRequest{
- private ExperimentState state;
- private ExperimentIdentity identity;
-
- // this constructor can be used in Qstat monitor to handle errors
- public ExperimentStatusChangeRequest() {
- }
-
- public ExperimentStatusChangeRequest(ExperimentIdentity experimentIdentity, ExperimentState state) {
- this.state = state;
- setIdentity(experimentIdentity);
- }
-
- public ExperimentState getState() {
- return state;
- }
-
- public void setState(ExperimentState state) {
- this.state = state;
- }
-
- public ExperimentIdentity getIdentity() {
- return identity;
- }
-
- public void setIdentity(ExperimentIdentity identity) {
- this.identity = identity;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatusChangeRequest.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatusChangeRequest.java
deleted file mode 100644
index 0db9da6..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatusChangeRequest.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.job.monitor.state;
-
-import org.apache.airavata.job.monitor.JobIdentity;
-import org.apache.airavata.job.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, 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/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatusInfo.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatusInfo.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatusInfo.java
deleted file mode 100644
index 10d5ca2..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/JobStatusInfo.java
+++ /dev/null
@@ -1,48 +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.job.monitor.state;
-
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-
-/**
- * Based on the job status monitoring we can gather
- * different informaation about the job, its not simply
- * the job status, so we need a way to implement
- * different job statusinfo object to keep job status
- */
-public interface JobStatusInfo {
-
- /**
- * This method can be used to get JobStatusInfo data and
- * decide the finalJobState
- *
- * @param jobState
- */
- void setJobStatus(JobStatus jobState);
-
- /**
- * After setting the jobState by processing jobinformation
- * this method can be used to get the JobStatus
- * @return
- */
- JobStatus getJobStatus();
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/PublisherMessage.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/PublisherMessage.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/PublisherMessage.java
deleted file mode 100644
index 055deb1..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/PublisherMessage.java
+++ /dev/null
@@ -1,26 +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.job.monitor.state;
-
-public interface PublisherMessage {
-// public String getType();
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/TaskStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/TaskStatusChangeRequest.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/TaskStatusChangeRequest.java
deleted file mode 100644
index e8e58db..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/TaskStatusChangeRequest.java
+++ /dev/null
@@ -1,61 +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.job.monitor.state;
-
-import org.apache.airavata.job.monitor.TaskIdentity;
-import org.apache.airavata.model.workspace.experiment.TaskState;
-
-/**
- * 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 TaskStatusChangeRequest extends AbstractStateChangeRequest{
- private TaskState state;
- private TaskIdentity identity;
- // this constructor can be used in Qstat monitor to handle errors
- public TaskStatusChangeRequest() {
- }
-
- public TaskStatusChangeRequest(TaskIdentity taskIdentity, TaskState state) {
- this.state = state;
- setIdentity(taskIdentity);
- }
-
- public TaskState getState() {
- return state;
- }
-
- public void setState(TaskState state) {
- this.state = state;
- }
-
- public TaskIdentity getIdentity() {
- return identity;
- }
-
- public void setIdentity(TaskIdentity identity) {
- this.identity = identity;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/WorkflowNodeStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/WorkflowNodeStatusChangeRequest.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/WorkflowNodeStatusChangeRequest.java
deleted file mode 100644
index 7e58e35..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/WorkflowNodeStatusChangeRequest.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
-*/
-package org.apache.airavata.job.monitor.state;
-
-import org.apache.airavata.job.monitor.WorkflowNodeIdentity;
-import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
-
-/**
- * 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 WorkflowNodeStatusChangeRequest extends AbstractStateChangeRequest{
- private WorkflowNodeState state;
- private WorkflowNodeIdentity identity;
-
- // this constructor can be used in Qstat monitor to handle errors
- public WorkflowNodeStatusChangeRequest() {
- }
-
- public WorkflowNodeStatusChangeRequest(WorkflowNodeIdentity identity, WorkflowNodeState state) {
- this.state = state;
- setIdentity(identity);
- }
-
- public WorkflowNodeState getState() {
- return state;
- }
-
- public void setState(WorkflowNodeState state) {
- this.state = state;
- }
-
- public WorkflowNodeIdentity getIdentity() {
- return identity;
- }
-
- public void setIdentity(WorkflowNodeIdentity identity) {
- this.identity = identity;
- }
-
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/impl/AmazonJobStatusInfo.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/impl/AmazonJobStatusInfo.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/impl/AmazonJobStatusInfo.java
deleted file mode 100644
index 385c430..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/impl/AmazonJobStatusInfo.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.job.monitor.state.impl;
-
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-import org.apache.airavata.job.monitor.state.JobStatusInfo;
-
-/**
- * This can be used to store job status information about
- * amazon jobs, this data could be very different from
- * a typical grid job
- */
-public class AmazonJobStatusInfo implements JobStatusInfo {
- public void setJobStatus(JobStatus jobState) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public JobStatus getJobStatus() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/impl/GridJobStatusInfo.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/impl/GridJobStatusInfo.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/impl/GridJobStatusInfo.java
deleted file mode 100644
index 3c3b421..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/state/impl/GridJobStatusInfo.java
+++ /dev/null
@@ -1,40 +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.job.monitor.state.impl;
-
-import org.apache.airavata.gsi.ssh.impl.JobStatus;
-import org.apache.airavata.job.monitor.state.JobStatusInfo;
-
-
-/**
- * This can be used to keep information about a Grid job
- * which we can get from qstat polling or from amqp based
- * monitoring in Grid machines
- */
-public class GridJobStatusInfo implements JobStatusInfo {
- public void setJobStatus(JobStatus jobState) {
- //To change body of implemented methods use File | Settings | File Templates.
- }
-
- public JobStatus getJobStatus() {
- return null; //To change body of implemented methods use File | Settings | File Templates.
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/AMQPConnectionUtil.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/AMQPConnectionUtil.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/AMQPConnectionUtil.java
deleted file mode 100644
index ea27f97..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/AMQPConnectionUtil.java
+++ /dev/null
@@ -1,78 +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.job.monitor.util;
-
-import com.rabbitmq.client.Connection;
-import com.rabbitmq.client.ConnectionFactory;
-import com.rabbitmq.client.DefaultSaslConfig;
-
-import javax.net.ssl.KeyManagerFactory;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.TrustManagerFactory;
-import java.security.KeyStore;
-import java.util.Collections;
-import java.util.List;
-import java.util.Vector;
-
-public class AMQPConnectionUtil {
- public static Connection connect(List<String>hosts,String vhost, String proxyFile) {
- Collections.shuffle(hosts);
- for (String host : hosts) {
- Connection connection = connect(host, vhost, proxyFile);
- if (host != null) {
- System.out.println("connected to " + host);
- return connection;
- }
- }
- return null;
- }
-
- public static Connection connect(String host, String vhost, String proxyFile) {
- Connection connection;
- try {
- String keyPassPhrase = "test123";
- KeyStore ks = X509Helper.keyStoreFromPEM(proxyFile, keyPassPhrase);
- KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
- kmf.init(ks, keyPassPhrase.toCharArray());
-
- KeyStore tks = X509Helper.trustKeyStoreFromCertDir();
- TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
- tmf.init(tks);
-
- SSLContext c = SSLContext.getInstance("SSLv3");
- c.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
-
- ConnectionFactory factory = new ConnectionFactory();
- factory.setHost(host);
- factory.setPort(5671);
- factory.useSslProtocol(c);
- factory.setVirtualHost(vhost);
- factory.setSaslConfig(DefaultSaslConfig.EXTERNAL);
-
- connection = factory.newConnection();
- } catch (Exception e) {
- e.printStackTrace();
- return null;
- }
- return connection;
- }
-
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/CommonUtils.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/CommonUtils.java
deleted file mode 100644
index 42d4b8e..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/CommonUtils.java
+++ /dev/null
@@ -1,174 +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.job.monitor.util;
-
-import org.apache.airavata.commons.gfac.type.HostDescription;
-import org.apache.airavata.job.monitor.HostMonitorData;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.UserMonitorData;
-import org.apache.airavata.job.monitor.exception.AiravataMonitorException;
-import org.apache.airavata.job.monitor.impl.push.amqp.AMQPMonitor;
-import org.apache.airavata.schemas.gfac.GsisshHostType;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.BlockingQueue;
-
-public class CommonUtils {
- private final static Logger logger = LoggerFactory.getLogger(CommonUtils.class);
-
- public static boolean isPBSHost(HostDescription host){
- if("pbs".equals(((GsisshHostType)host.getType()).getJobManager()) ||
- "".equals(((GsisshHostType)host.getType()).getJobManager())){
- return true;
- }else{
- // default is pbs so we return true
- return false;
- }
- }
- public static boolean isSlurm(HostDescription host){
- if("slurm".equals(((GsisshHostType)host.getType()).getJobManager())){
- return true;
- }else{
- // default is pbs so we return true
- return false;
- }
- }
- public static boolean isSGE(HostDescription host){
- if("sge".equals(((GsisshHostType)host.getType()).getJobManager())){
- return true;
- }else{
- // default is pbs so we return true
- return false;
- }
- }
- public static String getChannelID(MonitorID monitorID) {
- return monitorID.getUserName() + "-" + monitorID.getHost().getType().getHostName();
- }
-
- public static String getRoutingKey(MonitorID monitorID) {
- return "*." + monitorID.getUserName() + "." + monitorID.getHost().getType().getHostAddress();
- }
-
- public static String getChannelID(String userName,String hostAddress) {
- return userName + "-" + hostAddress;
- }
-
- public static String getRoutingKey(String userName,String hostAddress) {
- return "*." + userName + "." + hostAddress;
- }
-
- public static void addMonitortoQueue(BlockingQueue<UserMonitorData> queue, MonitorID monitorID) throws AiravataMonitorException {
- Iterator<UserMonitorData> iterator = queue.iterator();
- while (iterator.hasNext()) {
- UserMonitorData next = iterator.next();
- if (next.getUserName().equals(monitorID.getUserName())) {
- // then this is the right place to update
- List<HostMonitorData> monitorIDs = next.getHostMonitorData();
- for (HostMonitorData host : monitorIDs) {
- if (host.getHost().equals(monitorID.getHost())) {
- // ok we found right place to add this monitorID
- host.addMonitorIDForHost(monitorID);
- return;
- }
- }
- // there is a userMonitor object for this user name but no Hosts for this host
- // so we have to create new Hosts
- HostMonitorData hostMonitorData = new HostMonitorData(monitorID.getHost());
- hostMonitorData.addMonitorIDForHost(monitorID);
- next.addHostMonitorData(hostMonitorData);
- return;
- }
- }
- HostMonitorData hostMonitorData = new HostMonitorData(monitorID.getHost());
- hostMonitorData.addMonitorIDForHost(monitorID);
-
- UserMonitorData userMonitorData = new UserMonitorData(monitorID.getUserName());
- userMonitorData.addHostMonitorData(hostMonitorData);
- try {
- queue.put(userMonitorData);
- } catch (InterruptedException e) {
- throw new AiravataMonitorException(e);
- }
- }
- public static boolean isTheLastJobInQueue(BlockingQueue<MonitorID> queue,MonitorID monitorID){
- Iterator<MonitorID> iterator = queue.iterator();
- while(iterator.hasNext()){
- MonitorID next = iterator.next();
- if(monitorID.getUserName().equals(next.getUserName()) && CommonUtils.isEqual(monitorID.getHost(),next.getHost())){
- return false;
- }
- }
- return true;
- }
- public static void removeMonitorFromQueue(BlockingQueue<UserMonitorData> queue,MonitorID monitorID) throws AiravataMonitorException {
- Iterator<UserMonitorData> iterator = queue.iterator();
- while(iterator.hasNext()){
- UserMonitorData next = iterator.next();
- if(next.getUserName().equals(monitorID.getUserName())){
- // then this is the right place to update
- List<HostMonitorData> hostMonitorData = next.getHostMonitorData();
- for(HostMonitorData iHostMonitorID:hostMonitorData){
- if(iHostMonitorID.getHost().equals(monitorID.getHost())) {
- List<MonitorID> monitorIDs = iHostMonitorID.getMonitorIDs();
- for(MonitorID iMonitorID:monitorIDs){
- if(iMonitorID.getJobID().equals(monitorID.getJobID())) {
- // OK we found the object, we cannot do list.remove(object) states of two objects
- // could be different, thats why we check the jobID
- monitorIDs.remove(iMonitorID);
- if(monitorIDs.size()==0) {
- hostMonitorData.remove(iHostMonitorID);
- if (hostMonitorData.size() == 0) {
- // no useful data so we have to remove the element from the queue
- queue.remove(next);
- }
- }
- return;
- }
- }
- }
- }
- }
- }
- throw new AiravataMonitorException("Cannot find the given MonitorID in the queue with userName " +
- monitorID.getUserName() + " and jobID " + monitorID.getJobID());
-
- }
-
- public static boolean isEqual(HostDescription host1,HostDescription host2) {
- if ((host1.getType() instanceof GsisshHostType) && (host2.getType() instanceof GsisshHostType)) {
- GsisshHostType hostType1 = (GsisshHostType)host1.getType();
- GsisshHostType hostType2 = (GsisshHostType)host2.getType();
- if(hostType1.getHostAddress().equals(hostType2.getHostAddress())
- && hostType1.getJobManager().equals(hostType2.getJobManager())
- && (hostType1.getPort() == hostType2.getPort())
- && hostType1.getMonitorMode().equals(hostType2.getMonitorMode())){
- return true;
- }
- } else {
- logger.error("This method is only impmlemented to handle Gsissh host types");
- }
- return false;
- }
-}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/X509Helper.java
----------------------------------------------------------------------
diff --git a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/X509Helper.java b/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/X509Helper.java
deleted file mode 100644
index 962dc81..0000000
--- a/tools/job-monitor/src/main/java/org/apache/airavata/job/monitor/util/X509Helper.java
+++ /dev/null
@@ -1,170 +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.job.monitor.util;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.security.KeyPair;
-import java.security.KeyStore;
-import java.security.KeyStoreException;
-import java.security.NoSuchAlgorithmException;
-import java.security.PrivateKey;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-import java.security.cert.CertificateParsingException;
-import java.security.cert.X509Certificate;
-import java.security.spec.InvalidKeySpecException;
-
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.bouncycastle.jce.provider.BouncyCastleProvider;
-import org.bouncycastle.openssl.PEMReader;
-
-public class X509Helper {
-
- static {
- // parsing of RSA key fails without this
- java.security.Security.addProvider(new BouncyCastleProvider());
- }
-
-
-
- public static KeyStore keyStoreFromPEM(String proxyFile,
- String keyPassPhrase) throws IOException,
- CertificateException,
- NoSuchAlgorithmException,
- InvalidKeySpecException,
- KeyStoreException {
- return keyStoreFromPEM(proxyFile,proxyFile,keyPassPhrase);
- }
-
- public static KeyStore keyStoreFromPEM(String certFile,
- String keyFile,
- String keyPassPhrase) throws IOException,
- CertificateException,
- NoSuchAlgorithmException,
- InvalidKeySpecException,
- KeyStoreException {
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- X509Certificate cert = (X509Certificate)cf.generateCertificate(new FileInputStream(certFile));
- //System.out.println(cert.toString());
-
- // this works for proxy files, too, since it skips over the certificate
- BufferedReader reader = new BufferedReader(new FileReader(keyFile));
- String line = null;
- StringBuilder builder = new StringBuilder();
- boolean inKey = false;
- while((line=reader.readLine()) != null) {
- if (line.contains("-----BEGIN RSA PRIVATE KEY-----")) {
- inKey = true;
- }
- if (inKey) {
- builder.append(line);
- builder.append(System.getProperty("line.separator"));
- }
- if (line.contains("-----END RSA PRIVATE KEY-----")) {
- inKey = false;
- }
- }
- String privKeyPEM = builder.toString();
- //System.out.println(privKeyPEM);
-
- // using BouncyCastle
- PEMReader pemParser = new PEMReader(new StringReader(privKeyPEM));
- Object object = pemParser.readObject();
-
- PrivateKey privKey = null;
- if(object instanceof KeyPair){
- privKey = ((KeyPair)object).getPrivate();
- }
- // PEMParser from BouncyCastle is good for reading PEM files, but I didn't want to add that dependency
- /*
- // Base64 decode the data
- byte[] encoded = javax.xml.bind.DatatypeConverter.parseBase64Binary(privKeyPEM);
-
- // PKCS8 decode the encoded RSA private key
- java.security.spec.PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded);
- KeyFactory kf = KeyFactory.getInstance("RSA");
- PrivateKey privKey = kf.generatePrivate(keySpec);
- //RSAPrivateKey privKey = (RSAPrivateKey)kf.generatePrivate(keySpec);
- */
- //System.out.println(privKey.toString());
-
- KeyStore keyStore = KeyStore.getInstance("PKCS12");
- keyStore.load(null,null);
-
- KeyStore.PrivateKeyEntry entry =
- new KeyStore.PrivateKeyEntry(privKey,
- new java.security.cert.Certificate[] {(java.security.cert.Certificate)cert});
- KeyStore.PasswordProtection prot = new KeyStore.PasswordProtection(keyPassPhrase.toCharArray());
- keyStore.setEntry(cert.getSubjectX500Principal().getName(), entry, prot);
-
- return keyStore;
- }
-
-
- public static KeyStore trustKeyStoreFromCertDir() throws IOException,
- KeyStoreException,
- CertificateException,
- NoSuchAlgorithmException, ApplicationSettingsException {
- return trustKeyStoreFromCertDir(ServerSettings.getSetting("trusted.cert.location"));
- }
-
- public static KeyStore trustKeyStoreFromCertDir(String certDir) throws IOException,
- KeyStoreException,
- CertificateException,
- NoSuchAlgorithmException {
- KeyStore ks = KeyStore.getInstance("JKS");
- ks.load(null,null);
-
- File dir = new File(certDir);
- for(File file : dir.listFiles()) {
- if (!file.isFile()) {
- continue;
- }
- if (!file.getName().endsWith(".0")) {
- continue;
- }
-
- try {
- //System.out.println("reading file "+file.getName());
- CertificateFactory cf = CertificateFactory.getInstance("X.509");
- X509Certificate cert = (X509Certificate) cf.generateCertificate(new FileInputStream(file));
- //System.out.println(cert.toString());
-
- KeyStore.TrustedCertificateEntry entry = new KeyStore.TrustedCertificateEntry(cert);
-
- ks.setEntry(cert.getSubjectX500Principal().getName(), entry, null);
- } catch (KeyStoreException e) {
- } catch (CertificateParsingException e) {
- continue;
- }
-
- }
-
- return ks;
- }
-}
-
[6/8] merging monitoring with gfac-core, later this will be separated
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
new file mode 100644
index 0000000..30f1ae4
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/CommonUtils.java
@@ -0,0 +1,172 @@
+/*
+ *
+ * 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.util;
+
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.monitor.HostMonitorData;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.UserMonitorData;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.BlockingQueue;
+
+public class CommonUtils {
+ private final static Logger logger = LoggerFactory.getLogger(CommonUtils.class);
+
+ public static boolean isPBSHost(HostDescription host){
+ if("pbs".equals(((GsisshHostType)host.getType()).getJobManager()) ||
+ "".equals(((GsisshHostType)host.getType()).getJobManager())){
+ return true;
+ }else{
+ // default is pbs so we return true
+ return false;
+ }
+ }
+ public static boolean isSlurm(HostDescription host){
+ if("slurm".equals(((GsisshHostType)host.getType()).getJobManager())){
+ return true;
+ }else{
+ // default is pbs so we return true
+ return false;
+ }
+ }
+ public static boolean isSGE(HostDescription host){
+ if("sge".equals(((GsisshHostType)host.getType()).getJobManager())){
+ return true;
+ }else{
+ // default is pbs so we return true
+ return false;
+ }
+ }
+ public static String getChannelID(MonitorID monitorID) {
+ return monitorID.getUserName() + "-" + monitorID.getHost().getType().getHostName();
+ }
+
+ public static String getRoutingKey(MonitorID monitorID) {
+ return "*." + monitorID.getUserName() + "." + monitorID.getHost().getType().getHostAddress();
+ }
+
+ public static String getChannelID(String userName,String hostAddress) {
+ return userName + "-" + hostAddress;
+ }
+
+ public static String getRoutingKey(String userName,String hostAddress) {
+ return "*." + userName + "." + hostAddress;
+ }
+
+ public static void addMonitortoQueue(BlockingQueue<UserMonitorData> queue, MonitorID monitorID) throws AiravataMonitorException {
+ Iterator<UserMonitorData> iterator = queue.iterator();
+ while (iterator.hasNext()) {
+ UserMonitorData next = iterator.next();
+ if (next.getUserName().equals(monitorID.getUserName())) {
+ // then this is the right place to update
+ List<HostMonitorData> monitorIDs = next.getHostMonitorData();
+ for (HostMonitorData host : monitorIDs) {
+ if (host.getHost().equals(monitorID.getHost())) {
+ // ok we found right place to add this monitorID
+ host.addMonitorIDForHost(monitorID);
+ return;
+ }
+ }
+ // there is a userMonitor object for this user name but no Hosts for this host
+ // so we have to create new Hosts
+ HostMonitorData hostMonitorData = new HostMonitorData(monitorID.getHost());
+ hostMonitorData.addMonitorIDForHost(monitorID);
+ next.addHostMonitorData(hostMonitorData);
+ return;
+ }
+ }
+ HostMonitorData hostMonitorData = new HostMonitorData(monitorID.getHost());
+ hostMonitorData.addMonitorIDForHost(monitorID);
+
+ UserMonitorData userMonitorData = new UserMonitorData(monitorID.getUserName());
+ userMonitorData.addHostMonitorData(hostMonitorData);
+ try {
+ queue.put(userMonitorData);
+ } catch (InterruptedException e) {
+ throw new AiravataMonitorException(e);
+ }
+ }
+ public static boolean isTheLastJobInQueue(BlockingQueue<MonitorID> queue,MonitorID monitorID){
+ Iterator<MonitorID> iterator = queue.iterator();
+ while(iterator.hasNext()){
+ MonitorID next = iterator.next();
+ if(monitorID.getUserName().equals(next.getUserName()) && CommonUtils.isEqual(monitorID.getHost(), next.getHost())){
+ return false;
+ }
+ }
+ return true;
+ }
+ public static void removeMonitorFromQueue(BlockingQueue<UserMonitorData> queue,MonitorID monitorID) throws AiravataMonitorException {
+ Iterator<UserMonitorData> iterator = queue.iterator();
+ while(iterator.hasNext()){
+ UserMonitorData next = iterator.next();
+ if(next.getUserName().equals(monitorID.getUserName())){
+ // then this is the right place to update
+ List<HostMonitorData> hostMonitorData = next.getHostMonitorData();
+ for(HostMonitorData iHostMonitorID:hostMonitorData){
+ if(iHostMonitorID.getHost().equals(monitorID.getHost())) {
+ List<MonitorID> monitorIDs = iHostMonitorID.getMonitorIDs();
+ for(MonitorID iMonitorID:monitorIDs){
+ if(iMonitorID.getJobID().equals(monitorID.getJobID())) {
+ // OK we found the object, we cannot do list.remove(object) states of two objects
+ // could be different, thats why we check the jobID
+ monitorIDs.remove(iMonitorID);
+ if(monitorIDs.size()==0) {
+ hostMonitorData.remove(iHostMonitorID);
+ if (hostMonitorData.size() == 0) {
+ // no useful data so we have to remove the element from the queue
+ queue.remove(next);
+ }
+ }
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ throw new AiravataMonitorException("Cannot find the given MonitorID in the queue with userName " +
+ monitorID.getUserName() + " and jobID " + monitorID.getJobID());
+
+ }
+
+ public static boolean isEqual(HostDescription host1,HostDescription host2) {
+ if ((host1.getType() instanceof GsisshHostType) && (host2.getType() instanceof GsisshHostType)) {
+ GsisshHostType hostType1 = (GsisshHostType)host1.getType();
+ GsisshHostType hostType2 = (GsisshHostType)host2.getType();
+ if(hostType1.getHostAddress().equals(hostType2.getHostAddress())
+ && hostType1.getJobManager().equals(hostType2.getJobManager())
+ && (hostType1.getPort() == hostType2.getPort())
+ && hostType1.getMonitorMode().equals(hostType2.getMonitorMode())){
+ return true;
+ }
+ } else {
+ logger.error("This method is only impmlemented to handle Gsissh host types");
+ }
+ return false;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java
new file mode 100644
index 0000000..c29490a
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/X509Helper.java
@@ -0,0 +1,161 @@
+/*
+ *
+ * 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.util;
+
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.bouncycastle.jce.provider.BouncyCastleProvider;
+import org.bouncycastle.openssl.PEMReader;
+
+import java.io.*;
+import java.security.*;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.CertificateParsingException;
+import java.security.cert.X509Certificate;
+import java.security.spec.InvalidKeySpecException;
+
+public class X509Helper {
+
+ static {
+ // parsing of RSA key fails without this
+ java.security.Security.addProvider(new BouncyCastleProvider());
+ }
+
+
+
+ public static KeyStore keyStoreFromPEM(String proxyFile,
+ String keyPassPhrase) throws IOException,
+ CertificateException,
+ NoSuchAlgorithmException,
+ InvalidKeySpecException,
+ KeyStoreException {
+ return keyStoreFromPEM(proxyFile,proxyFile,keyPassPhrase);
+ }
+
+ public static KeyStore keyStoreFromPEM(String certFile,
+ String keyFile,
+ String keyPassPhrase) throws IOException,
+ CertificateException,
+ NoSuchAlgorithmException,
+ InvalidKeySpecException,
+ KeyStoreException {
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ X509Certificate cert = (X509Certificate)cf.generateCertificate(new FileInputStream(certFile));
+ //System.out.println(cert.toString());
+
+ // this works for proxy files, too, since it skips over the certificate
+ BufferedReader reader = new BufferedReader(new FileReader(keyFile));
+ String line = null;
+ StringBuilder builder = new StringBuilder();
+ boolean inKey = false;
+ while((line=reader.readLine()) != null) {
+ if (line.contains("-----BEGIN RSA PRIVATE KEY-----")) {
+ inKey = true;
+ }
+ if (inKey) {
+ builder.append(line);
+ builder.append(System.getProperty("line.separator"));
+ }
+ if (line.contains("-----END RSA PRIVATE KEY-----")) {
+ inKey = false;
+ }
+ }
+ String privKeyPEM = builder.toString();
+ //System.out.println(privKeyPEM);
+
+ // using BouncyCastle
+ PEMReader pemParser = new PEMReader(new StringReader(privKeyPEM));
+ Object object = pemParser.readObject();
+
+ PrivateKey privKey = null;
+ if(object instanceof KeyPair){
+ privKey = ((KeyPair)object).getPrivate();
+ }
+ // PEMParser from BouncyCastle is good for reading PEM files, but I didn't want to add that dependency
+ /*
+ // Base64 decode the data
+ byte[] encoded = javax.xml.bind.DatatypeConverter.parseBase64Binary(privKeyPEM);
+
+ // PKCS8 decode the encoded RSA private key
+ java.security.spec.PKCS8EncodedKeySpec keySpec = new PKCS8EncodedKeySpec(encoded);
+ KeyFactory kf = KeyFactory.getInstance("RSA");
+ PrivateKey privKey = kf.generatePrivate(keySpec);
+ //RSAPrivateKey privKey = (RSAPrivateKey)kf.generatePrivate(keySpec);
+ */
+ //System.out.println(privKey.toString());
+
+ KeyStore keyStore = KeyStore.getInstance("PKCS12");
+ keyStore.load(null,null);
+
+ KeyStore.PrivateKeyEntry entry =
+ new KeyStore.PrivateKeyEntry(privKey,
+ new java.security.cert.Certificate[] {(java.security.cert.Certificate)cert});
+ KeyStore.PasswordProtection prot = new KeyStore.PasswordProtection(keyPassPhrase.toCharArray());
+ keyStore.setEntry(cert.getSubjectX500Principal().getName(), entry, prot);
+
+ return keyStore;
+ }
+
+
+ public static KeyStore trustKeyStoreFromCertDir() throws IOException,
+ KeyStoreException,
+ CertificateException,
+ NoSuchAlgorithmException, ApplicationSettingsException {
+ return trustKeyStoreFromCertDir(ServerSettings.getSetting("trusted.cert.location"));
+ }
+
+ public static KeyStore trustKeyStoreFromCertDir(String certDir) throws IOException,
+ KeyStoreException,
+ CertificateException,
+ NoSuchAlgorithmException {
+ KeyStore ks = KeyStore.getInstance("JKS");
+ ks.load(null,null);
+
+ File dir = new File(certDir);
+ for(File file : dir.listFiles()) {
+ if (!file.isFile()) {
+ continue;
+ }
+ if (!file.getName().endsWith(".0")) {
+ continue;
+ }
+
+ try {
+ //System.out.println("reading file "+file.getName());
+ CertificateFactory cf = CertificateFactory.getInstance("X.509");
+ X509Certificate cert = (X509Certificate) cf.generateCertificate(new FileInputStream(file));
+ //System.out.println(cert.toString());
+
+ KeyStore.TrustedCertificateEntry entry = new KeyStore.TrustedCertificateEntry(cert);
+
+ ks.setEntry(cert.getSubjectX500Principal().getName(), entry, null);
+ } catch (KeyStoreException e) {
+ } catch (CertificateParsingException e) {
+ continue;
+ }
+
+ }
+
+ return ks;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
index 5c33ec1..cf77fab 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/GFacProvider.java
@@ -25,8 +25,8 @@ import java.util.Map;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.JobExecutionContext;
-import org.apache.airavata.job.monitor.AbstractActivityListener;
-import org.apache.airavata.job.monitor.command.TaskCancelRequest;
+import org.apache.airavata.gfac.monitor.AbstractActivityListener;
+import org.apache.airavata.gfac.monitor.command.TaskCancelRequest;
import com.google.common.eventbus.Subscribe;
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/AbstractProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/AbstractProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/AbstractProvider.java
index 5966233..a3f8879 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/AbstractProvider.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/AbstractProvider.java
@@ -27,11 +27,11 @@ import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.provider.GFacProvider;
import org.apache.airavata.gfac.provider.GFacProviderException;
-import org.apache.airavata.job.monitor.JobIdentity;
-import org.apache.airavata.job.monitor.MonitorID;
-import org.apache.airavata.job.monitor.command.TaskCancelRequest;
-import org.apache.airavata.job.monitor.event.MonitorPublisher;
-import org.apache.airavata.job.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.monitor.JobIdentity;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.command.TaskCancelRequest;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
import org.apache.airavata.model.workspace.experiment.JobDetails;
import org.apache.airavata.model.workspace.experiment.JobState;
import org.apache.airavata.model.workspace.experiment.JobStatus;
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
index 69ad519..5fbaa5d 100644
--- a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/provider/impl/GSISSHProvider.java
@@ -25,7 +25,6 @@ import java.util.Map;
import org.apache.airavata.gfac.GFacException;
import org.apache.airavata.gfac.context.JobExecutionContext;
import org.apache.airavata.gfac.context.security.GSISecurityContext;
-import org.apache.airavata.gfac.context.security.SSHSecurityContext;
import org.apache.airavata.gfac.notification.events.StartExecutionEvent;
import org.apache.airavata.gfac.provider.GFacProviderException;
import org.apache.airavata.gfac.utils.GFacUtils;
@@ -65,8 +64,6 @@ public class GSISSHProvider extends AbstractProvider{
Cluster cluster = null;
if (jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT) != null) {
cluster = ((GSISecurityContext) jobExecutionContext.getSecurityContext(GSISecurityContext.GSI_SECURITY_CONTEXT)).getPbsCluster();
- } else {
- cluster = ((SSHSecurityContext) jobExecutionContext.getSecurityContext(SSHSecurityContext.SSH_SECURITY_CONTEXT)).getPbsCluster();
}
if (cluster == null) {
throw new GFacProviderException("Security context is not set properly");
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/AccessPolicy.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/AccessPolicy.json b/modules/gfac/gfac-core/src/main/resources/schema/AccessPolicy.json
new file mode 100644
index 0000000..8f6cfe1
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/AccessPolicy.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AccessPolicy.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Policy.json"}],
+ "properties": {
+ "EndpointID": {
+ "type": "string",
+ "description": "The ID of the Endpoint this AccessPolicy is for"
+ }
+ },
+ "required": ["EndpointID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Activity.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Activity.json b/modules/gfac/gfac-core/src/main/resources/schema/Activity.json
new file mode 100644
index 0000000..8bd2495
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Activity.json
@@ -0,0 +1,31 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Activity.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "UserDomainID": {
+ "type": "string",
+ "description": "An ID"
+ },
+ "EndpointID": {
+ "type": "string",
+ "description": "The ID of the Endpoint managing Activity"
+ },
+ "ShareID": {
+ "type": "string",
+ "description": "The ID of the Share servicing this Activity"
+ },
+ "ResourceID": {
+ "type": "string",
+ "description": "The ID of the Resource executing this Activity"
+ },
+ "ActivityID": {
+ "type": "array",
+ "description": "The IDs of other Activities related to this one",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/AdminDomain.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/AdminDomain.json b/modules/gfac/gfac-core/src/main/resources/schema/AdminDomain.json
new file mode 100644
index 0000000..8ed4606
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/AdminDomain.json
@@ -0,0 +1,51 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AdminDomain.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json"}],
+ "properties": {
+ "Distributed": {
+ "type": "boolean",
+ "description": "true if the services managed by the AdminDomain are geographically distributed"
+ },
+ "Owner": {
+ "type": "array",
+ "description": "Identification of persons or legal entities that own the resources in this AdminDomain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ServiceID": {
+ "type": "array",
+ "description": "IDs of Services in this AdminDomain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ChildDomainID": {
+ "type": "array",
+ "description": "IDs of AdminDomains aggregated by this AdminDomain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ParentDomainID": {
+ "type": "string",
+ "description": "The ID of the AdminDomain that this AdminDomain participates in"
+ },
+ "ComputingServiceID": {
+ "type": "array",
+ "description": "IDs of ComputingServices in this AdminDomain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "StorageServiceID": {
+ "type": "array",
+ "description": "IDs of StorageServices in this AdminDomain",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ApplicationEnvironment.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ApplicationEnvironment.json b/modules/gfac/gfac-core/src/main/resources/schema/ApplicationEnvironment.json
new file mode 100644
index 0000000..89c78e0
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ApplicationEnvironment.json
@@ -0,0 +1,86 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationEnvironment.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "AppName": {
+ "type": "string",
+ "description": "The name of the application"
+ },
+ "AppVersion": {
+ "type": "string",
+ "description": "The version of the application"
+ },
+ "State": {
+ "type": "string",
+ "description": "The current installation state of the application - AppEnvState_t"
+ },
+ "RemovalDate": {
+ "type": "string",
+ "description": "The date/time after which the application may be removed - DateTime_t"
+ },
+ "License": {
+ "type": "string",
+ "description": "The license under which the application is usable - License_t"
+ },
+ "Description": {
+ "type": "string",
+ "description": "A human-readable description of the application"
+ },
+ "BestBenchmark": {
+ "type": "array",
+ "description": "The type(s) of the benchmarks which best describe the sensitivity of this application to the performance of the ExecutionEnvironment - Benchmark_t",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ParallelSupport": {
+ "type": "string",
+ "description": "The type of supported parallel execution - ParallelSupport_t"
+ },
+ "MaxSlots": {
+ "type": "integer",
+ "description": "The maximum number of concurrent slots that may be used to run the application"
+ },
+ "MaxJobs": {
+ "type": "integer",
+ "description": "The maximum number of concurrent jobs that can run the application"
+ },
+ "MaxUserSeats": {
+ "type": "integer",
+ "description": "The maximum number of concurrent users that can run the application"
+ },
+ "FreeSlots": {
+ "type": "integer",
+ "description": "The maximum number slots currently available to run the application"
+ },
+ "FreeJobs": {
+ "type": "integer",
+ "description": "The maximum number of additional jobs that can run the application"
+ },
+ "FreeUserSeats": {
+ "type": "integer",
+ "description": "The maximum number of additional users that can run the application"
+ },
+ "ExecutionEnvironmentID": {
+ "type": "array",
+ "description": "ID(s) of ExecutionEnvironments where this ApplicationEnvironment can be used",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ComputingManagerID": {
+ "type": "string",
+ "description": "ID of the ComputingManager this ApplicationEnvironment is associated with"
+ },
+ "ApplicationHandleID": {
+ "type": "array",
+ "description": "ID(s) of the ApplicationHandles that can be used to refer to this environment",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["AppName","ComputingManagerID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ApplicationHandle.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ApplicationHandle.json b/modules/gfac/gfac-core/src/main/resources/schema/ApplicationHandle.json
new file mode 100644
index 0000000..e7972e9
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ApplicationHandle.json
@@ -0,0 +1,21 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationHandle.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Type": {
+ "type": "string",
+ "description": "The type of method used to set up an ApplicationEnvironment - ApplicationHandle_t (open enumeration)"
+ },
+ "Value": {
+ "type": "string",
+ "description": "How to set up the ApplicationEnvironment in the context of the Type"
+ },
+ "ApplicationEnvironmentID": {
+ "type": "string",
+ "description": "The ID of the ApplicationEnvironment this ApplicationHandle refers to"
+ }
+ },
+ "required": ["Type","Value","ApplicationEnvironmentID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Benchmark.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Benchmark.json b/modules/gfac/gfac-core/src/main/resources/schema/Benchmark.json
new file mode 100644
index 0000000..2b64261
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Benchmark.json
@@ -0,0 +1,21 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Benchmark.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Type": {
+ "type": "string",
+ "description": "The type of the benchmark - Benchmark_t (open enumeration)"
+ },
+ "Value": {
+ "type": "number",
+ "description": "The value of the benchmark"
+ },
+ "ComputingManagerID": {
+ "type": "string",
+ "description": "The ID of the ComputingManager this benchmark is for"
+ }
+ },
+ "required": ["Type","Value"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ComputingActivity.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ComputingActivity.json b/modules/gfac/gfac-core/src/main/resources/schema/ComputingActivity.json
new file mode 100644
index 0000000..5fcae72
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ComputingActivity.json
@@ -0,0 +1,165 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingActivity.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Activity.json"}],
+ "properties": {
+ "Type": {
+ "type": "string",
+ "description": "closed enumeration ComputingActivityType_t",
+ "enum": ["collectionelement","parallelelement","single","workflownode"]
+ },
+ "IDFromEndpoint": {
+ "type": "string",
+ "description": "The ID assigned by the ComputingEndpoint"
+ },
+ "LocalIDFromManager": {
+ "type": "string",
+ "description": "The local ID assigned by the ComputingManager"
+ },
+ "State": {
+ "type": "array",
+ "description": "open enumeration ComputingActivityState_t",
+ "items": {
+ "type": "string"
+ },
+ "minItems": 1
+ },
+ "RestartState": {
+ "type": "array",
+ "description": "open enumeration ComputingActivityState_t",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ExitCode": {
+ "type": "integer",
+ "description": "The exit code as returned by the main executable code or script of the job"
+ },
+ "ComputingManagerExitCode": {
+ "type": "string",
+ "description": "The exit code provided by the ComputingManager"
+ },
+ "Error": {
+ "type": "array",
+ "description": "The error messages as provided by the software components involved in the management of the job",
+ "items": {
+ "type": "string"
+ }
+ },
+ "WaitingPosition": {
+ "type": "integer",
+ "description": "The position of the job in the queue, if the job is waiting"
+ },
+ "Owner": {
+ "type": "string",
+ "description": "The Grid identity of the job's owner"
+ },
+ "LocalOwner": {
+ "type": "string",
+ "description": "The local user name of the job's owner"
+ },
+ "RequestedTotalWallTime": {
+ "type": "integer",
+ "description": "The total wall clock time requested by the job"
+ },
+ "RequestedTotalCPUTime": {
+ "type": "integer",
+ "description": "The total CPU time requested by the job"
+ },
+ "RequestedSlots": {
+ "type": "integer",
+ "description": "The number of slots requested for the job"
+ },
+ "RequestedApplicationEnvironment": {
+ "type": "array",
+ "description": "The AppName and Version of the requested ApplicationEnvironments",
+ "items": {
+ "type": "string"
+ }
+ },
+ "StdIn": {
+ "type": "string",
+ "description": "The name of the file used for standard input"
+ },
+ "StdOut": {
+ "type": "string",
+ "description": "The name of the file used for standard output"
+ },
+ "StdErr": {
+ "type": "string",
+ "description": "The name of the file used for standard error"
+ },
+ "LogDir": {
+ "type": "string",
+ "description": "The name of the directory which contains job logs"
+ },
+ "ExecutionNode": {
+ "type": "array",
+ "description": "Hostnames associated with the ExecutionEnvironments running the job",
+ "items": {
+ "type": "string"
+ }
+ },
+ "Queue": {
+ "type": "string",
+ "description": "The name of the ComputingManager queue that held the job before execution"
+ },
+ "UsedTotalWallTime": {
+ "type": "integer",
+ "description": "The total wall clock time consumed by the job so far (slots*seconds)"
+ },
+ "UsedTotalCpuTime": {
+ "type": "integer",
+ "description": "The total CPU time consumed by the job so far (seconds)"
+ },
+ "UsedMainMemory": {
+ "type": "integer",
+ "description": "The physical RAM currently used by the job (MB)"
+ },
+ "SubmissionTime": {
+ "type": "string",
+ "description": "The time when the job was submitted to the ComputingEndpoint (DateTime_t)"
+ },
+ "ComputingManagerSubmissionTime": {
+ "type": "string",
+ "description": "The time when the job was submitted to the ComputingManager (DateTime_t)"
+ },
+ "StartTime": {
+ "type": "string",
+ "description": "The time when the ComputingManager started the job (DateTime_t)"
+ },
+ "EndTime": {
+ "type": "string",
+ "description": "The time when the job ended in the Grid layer (DateTime_t)"
+ },
+ "ComputingManagerEndTime": {
+ "type": "string",
+ "description": "The time when the job ended according to the ComputingManager (DateTime_t)"
+ },
+ "WorkingAreaEraseTime": {
+ "type": "string",
+ "description": "The time when working area will be removed from storage (DateTime_t)"
+ },
+ "ProxyExpirationTime": {
+ "type": "string",
+ "description": "The expiration time of the Grid proxy associated with the job (DateTime_t)"
+ },
+ "SubmissionHost": {
+ "type": "string",
+ "description": "The name of the host from which the job was submitted"
+ },
+ "SubmissionClientName": {
+ "type": "string",
+ "description": "The name of the software client used to submit the job"
+ },
+ "OtherMessages": {
+ "type": "array",
+ "description": "Optional messages provided by either the Grid layer or the ComputingManager",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["State","Owner"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ComputingEndpoint.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ComputingEndpoint.json b/modules/gfac/gfac-core/src/main/resources/schema/ComputingEndpoint.json
new file mode 100644
index 0000000..f94f889
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ComputingEndpoint.json
@@ -0,0 +1,44 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingEndpoint.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Endpoint.json"}],
+ "properties": {
+ "Staging": {
+ "type": "string",
+ "description": "Supported file staging functionality - Staging_t",
+ "enum": ["none","stagingin","staginginout","stagingout"]
+ },
+ "JobDescription": {
+ "type": "array",
+ "description": "Supported job description languages - JobDescription_t (open Enumeration)",
+ "items": {
+ "type": "string"
+ }
+ },
+ "TotalJobs": {
+ "type": "integer",
+ "description": "The total number of Grid jobs known to the system"
+ },
+ "RunningJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs which are running in an ExecutionEnvironment"
+ },
+ "WaitingJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs which are waiting to start executing"
+ },
+ "StagingJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs staging files before or after execution"
+ },
+ "SuspendedJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs that started to execute, but are now suspended"
+ },
+ "PreLRMSWaitingJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs managed by the Grid software, but not yet passed to the LRMS"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ComputingManager.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ComputingManager.json b/modules/gfac/gfac-core/src/main/resources/schema/ComputingManager.json
new file mode 100644
index 0000000..aecb114
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ComputingManager.json
@@ -0,0 +1,117 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingManager.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
+ "properties": {
+ "Reservation": {
+ "type": "boolean",
+ "description": "Whether advance reservation is supported (no value implies undefined in ExtendedBoolean_t)"
+ },
+ "BulkSubmission": {
+ "type": "boolean",
+ "description": "Whether multiple jobs can be submitted at once (no value implies undefined in ExtendedBoolean_t)"
+ },
+ "TotalPhysicalCPUs": {
+ "type": "integer",
+ "description": "The total number of physical CPUs managed by this ComputingManager"
+ },
+ "TotalLogicalCPUs": {
+ "type": "integer",
+ "description": "The total number of logical CPUs managed by this ComputingManager"
+ },
+ "TotalSlots": {
+ "type": "integer",
+ "description": "The total number of slots managed by this ComputingManager"
+ },
+ "SlotsUsedByLocalJobs": {
+ "type": "integer",
+ "description": "The number of slots currently used by jobs submitted via a non-Grid interface"
+ },
+ "SlotsUsedByGridJobs": {
+ "type": "integer",
+ "description": "The number of slots currently used by jobs submitted via a non-Grid interface"
+ },
+ "Homogeneous": {
+ "type": "boolean",
+ "description": "Whether this ComputingManager manages only one type of ExecutionEnvironment"
+ },
+ "NetworkInfo": {
+ "type": "array",
+ "description": "The types of internal network connections between ExecutionEnvironments (NetworkInfo_t)",
+ "items": {
+ "type": "string"
+ }
+ },
+ "LocalCPUDistribution": {
+ "type": "boolean",
+ "description": "Classification of the managed ExecutionEnvironments aggregated by the number of logical CPUs"
+ },
+ "WorkingAreaShared": {
+ "type": "boolean",
+ "description": "True if the working area is shared across different ExecutionEnvironments"
+ },
+ "WorkingAreaGuaranteed": {
+ "type": "boolean",
+ "description": "True if the job is guaranteed all of WorkingAreaTotal"
+ },
+ "WorkingAreaTotal": {
+ "type": "integer",
+ "description": "Total size of the working area available to single slot jobs (GB)"
+ },
+ "WorkingAreaFree": {
+ "type": "integer",
+ "description": "The amount of free space in the working area (GB)"
+ },
+ "WorkingAreaLifeTime": {
+ "type": "integer",
+ "description": "The minimum guaranteed lifetime of files created in the working area (seconds)"
+ },
+ "WorkingAreaMultiSlotTotal": {
+ "type": "integer",
+ "description": "The total size of the working area across all ExecutionEnvironments (GB)"
+ },
+ "WorkingAreaMultiSlotFree": {
+ "type": "integer",
+ "description": "The available space in the working area across all ExecutionEnvironments (GB)"
+ },
+ "WorkingAreaMultiSlotLifeTime": {
+ "type": "integer",
+ "description": "The minimum guaranteed lifetime of files created in the working area (seconds)"
+ },
+ "CacheTotal": {
+ "type": "integer",
+ "description": "If local caching of input files is supported, the total size of the area they may be stored in"
+ },
+ "CacheFree": {
+ "type": "integer",
+ "description": "If local caching of input files is supported, the available size of the area they may be stored in"
+ },
+ "TmpDir": {
+ "type": "string",
+ "description": "The absolute path of a temporary directory local to an ExecutionEnvironment"
+ },
+ "ScratchDir": {
+ "type": "string",
+ "description": "The absolute path of a shared directory available for application data"
+ },
+ "ApplicationDir": {
+ "type": "string",
+ "description": "The absolute path of a directory available for installation of persistent application software"
+ },
+ "ApplicationEnvironmentID": {
+ "type": "array",
+ "description": "ID(s) of ApplicationEnvironments provided by this ComputingManager",
+ "items": {
+ "type": "string"
+ }
+ },
+ "BenchmarkID": {
+ "type": "array",
+ "description": "ID(s) of Benchmarks associated with this ComputingManager",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ComputingService.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ComputingService.json b/modules/gfac/gfac-core/src/main/resources/schema/ComputingService.json
new file mode 100644
index 0000000..9cfde1b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ComputingService.json
@@ -0,0 +1,32 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingService.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Service.json"}],
+ "properties": {
+ "TotalJobs": {
+ "type": "integer",
+ "description": "The total number of Grid jobs known to the system"
+ },
+ "RunningJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs which are running in an ExecutionEnvironment"
+ },
+ "WaitingJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs which are waiting to start executing"
+ },
+ "StagingJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs staging files before or after execution"
+ },
+ "SuspendedJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs that started to execute, but are now suspended"
+ },
+ "PreLRMSWaitingJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs managed by the Grid software, but not yet passed to the LRMS"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ComputingShare.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ComputingShare.json b/modules/gfac/gfac-core/src/main/resources/schema/ComputingShare.json
new file mode 100644
index 0000000..340c83e
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ComputingShare.json
@@ -0,0 +1,182 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingShare.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}],
+ "properties": {
+ "MappingQueue": {
+ "type": "string",
+ "description": "The name of the queue in the LRMS where jobs in this share are submitted"
+ },
+ "MaxWallTime": {
+ "type": "integer",
+ "description": "The maximum wall clock time that a single-slot job can run (seconds)"
+ },
+ "MaxMultiSlotWallTime": {
+ "type": "integer",
+ "description": "The maximum wall clock time that a multi-slot job can run (seconds)"
+ },
+ "DefaultWallTime": {
+ "type": "integer",
+ "description": "The default wall clock per slot assumed by the LRMS if a maximum time is not specified (seconds)"
+ },
+ "MaxCPUTime": {
+ "type": "integer",
+ "description": "The maximum pre-slot CPU time that a job can request (seconds)"
+ },
+ "MaxTotalCPUTime": {
+ "type": "integer",
+ "description": "The maximum amount of CPU time that a job can request across all slots assigned to it (seconds)"
+ },
+ "MinCPUTime": {
+ "type": "integer",
+ "description": "The minimum pre-slot CPU time that a job can request (seconds)"
+ },
+ "DefaultCPUTime": {
+ "type": "integer",
+ "description": "The default CPU time limit assumed by the LRMS if a maximum time is not specified (seconds)"
+ },
+ "MaxTotalJobs": {
+ "type": "integer",
+ "description": "The maximum number of jobs that can be in this Share"
+ },
+ "MaxRunningJobs": {
+ "type": "integer",
+ "description": "The maximum number of jobs that can be running in this Share"
+ },
+ "MaxWaitingJobs": {
+ "type": "integer",
+ "description": "The maximum number of jobs that can be waiting in this Share"
+ },
+ "MaxPreLRMSWaitingJobs": {
+ "type": "integer",
+ "description": "The maximum number of jobs that can be waiting in the Grid layer for this Share"
+ },
+ "MaxUserRunningJobs": {
+ "type": "integer",
+ "description": "The maximum number of jobs that can be running in this Share per user"
+ },
+ "MaxSlotsPerJob": {
+ "type": "integer",
+ "description": "The maximum number of slots that can be allocated to a single job in this Share"
+ },
+ "MaxStageInStreams": {
+ "type": "integer",
+ "description": "The maximum number of streams available to stage files in"
+ },
+ "MaxStageOutStreams": {
+ "type": "integer",
+ "description": "The maximum number of streams available to stage files out"
+ },
+ "ScheduingPolicy": {
+ "type": "string",
+ "description": "The scheduling policy used by the share - SchedulingPolicy_t (open enumeration)"
+ },
+ "MaxMainMemory": {
+ "type": "integer",
+ "description": "The maximum amount of physical RAM that a job can use (MB)"
+ },
+ "GuaranteedMainMemory": {
+ "type": "integer",
+ "description": "The amount of physical RAM that a job will have available (MB)"
+ },
+ "MaxVirtualMemory": {
+ "type": "integer",
+ "description": "The maximum amount memory (RAM+swap) that a job can use (MB)"
+ },
+ "GuaranteedVirtualMemory": {
+ "type": "integer",
+ "description": "The amount of memory (RAM+swap) that a job will have available (MB)"
+ },
+ "MaxDiskSpace": {
+ "type": "integer",
+ "description": "The maximum disk space that a job can use in the working area (GB)"
+ },
+ "DefaultStorageServiceID": {
+ "type": "string",
+ "description": "The ID of the default StorageService used to store files"
+ },
+ "Preemption": {
+ "type": "boolean",
+ "description": "Whether jobs can be preempted and resumed (no value implies undefined in ExtendedBoolean_t)"
+ },
+ "ServingState": {
+ "type": "string",
+ "description": "How the Share is currently serving jobs",
+ "enum": ["closed","draining","production","queueing"]
+ },
+ "TotalJobs": {
+ "type": "integer",
+ "description": "The total number of jobs in any state"
+ },
+ "RunningJobs": {
+ "type": "integer",
+ "description": "The number of running jobs submitted through Grid or non-Grid interfaces"
+ },
+ "LocalRunningJobs": {
+ "type": "integer",
+ "description": "The number of running jobs submitted using non-Grid interfaces"
+ },
+ "WaitingJobs": {
+ "type": "integer",
+ "description": "The number of waiting jobs submitted through Grid or non-Grid interfaces"
+ },
+ "LocalWaitingJobs": {
+ "type": "integer",
+ "description": "The number of waiting jobs submitted using non-Grid interfaces"
+ },
+ "SuspendedJobs": {
+ "type": "integer",
+ "description": "The number of suspended jobs submitted through Grid or non-Grid interfaces"
+ },
+ "LocalSuspendedJobs": {
+ "type": "integer",
+ "description": "The number of suspended jobs submitted using non-Grid interfaces"
+ },
+ "StagingJobs": {
+ "type": "integer",
+ "description": "The number of jobs staging files before or after execution"
+ },
+ "PreLRMSWaitingJobs": {
+ "type": "integer",
+ "description": "The number of Grid jobs which have not yet been passed to the LRMS"
+ },
+ "EstimatedAverageWaitingTime": {
+ "type": "integer",
+ "description": "An estimate of the average time a job will wait before it starts to execute (seconds)"
+ },
+ "EstimatedWorstWaitingTime": {
+ "type": "integer",
+ "description": "An estimate of the worst-case time a job will wait before it starts to execute (seconds)"
+ },
+ "FreeSlots": {
+ "type": "integer",
+ "description": "The number of slots which are currently available for use"
+ },
+ "FreeSlotsWithDuration": {
+ "type": "string",
+ "description": "The number of slots which are currently available for use and how long they are available"
+ },
+ "UsedSlots": {
+ "type": "integer",
+ "description": "The number of slots currently in use"
+ },
+ "RequestedSlots": {
+ "type": "integer",
+ "description": "The number of slots needd to execute all waiting and staging jobs"
+ },
+ "ReservationPolicy": {
+ "type": "string",
+ "description": "The policy used for advance reservation - ReservationPolicy_t",
+ "enum": ["mandatory","none","optional"]
+ },
+ "Tag": {
+ "type": "array",
+ "description": "UserDomain-defined tags for this Share",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["ServingState"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Contact.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Contact.json b/modules/gfac/gfac-core/src/main/resources/schema/Contact.json
new file mode 100644
index 0000000..436b262
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Contact.json
@@ -0,0 +1,32 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Contact.json",
+ "description": "A GLUE 2 Contact",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Detail": {
+ "type": "string",
+ "description": "A URI embedding the contact information"
+ },
+ "Type": {
+ "type": "string",
+ "description": "closed enumeration ContactType_t",
+ "enum": ["general","security","sysadmin","usersupport"]
+ },
+ "ServiceID": {
+ "type": "array",
+ "description": "The IDs of Services associated with this Contact",
+ "items": {
+ "type": "string"
+ }
+ },
+ "DomainID": {
+ "type": "array",
+ "description": "The IDs of Domains associated with this Contact",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/DataStore.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/DataStore.json b/modules/gfac/gfac-core/src/main/resources/schema/DataStore.json
new file mode 100644
index 0000000..8f15447
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/DataStore.json
@@ -0,0 +1,30 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/DataStore.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Resource.json"}],
+ "properties": {
+ "Type": {
+ "type": "string",
+ "description": "The type of storage medium - DataStoreType_t (disk,optical,tape,...)"
+ },
+ "Latency": {
+ "type": "string",
+ "description": "The latency category under normal operating conditions - AccessLatency_t",
+ "enum": ["nearline","offline","online"]
+ },
+ "TotalSize": {
+ "type": "integer",
+ "description": "The total amount of storage (GB)"
+ },
+ "FreeSize": {
+ "type": "integer",
+ "description": "The amount of available storage (GB)"
+ },
+ "UsedSize": {
+ "type": "integer",
+ "description": "The amount of used storage (GB)"
+ }
+ },
+ "required": ["Type","Latency"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Domain.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Domain.json b/modules/gfac/gfac-core/src/main/resources/schema/Domain.json
new file mode 100644
index 0000000..5bd996b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Domain.json
@@ -0,0 +1,30 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Description": {
+ "type": "string",
+ "description": "A description of the Domain"
+ },
+ "WWW": {
+ "type": "array",
+ "description": "URLs of web pages with more information about the Domain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ContactID": {
+ "type": "array",
+ "description": "IDs of Contacts for this Domain",
+ "items": {
+ "type": "string"
+ }
+ },
+ "LocationID": {
+ "type": "string",
+ "description": "The ID of the primary Location for this Domain"
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Endpoint.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Endpoint.json b/modules/gfac/gfac-core/src/main/resources/schema/Endpoint.json
new file mode 100644
index 0000000..b75b02a
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Endpoint.json
@@ -0,0 +1,147 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Endpoint.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "URL": {
+ "type": "string",
+ "description": "Network location of the endpoint"
+ },
+ "Capability": {
+ "type": "array",
+ "description": "Capability_t (open enumeration)",
+ "items": {
+ "type": "string"
+ }
+ },
+ "Technology": {
+ "type": "string",
+ "description": "EndpointTechnology_t"
+ },
+ "InterfaceName": {
+ "type": "string",
+ "description": "InterfaceName_t"
+ },
+ "InterfaceVersion": {
+ "type": "string",
+ "description": "The version of the primary interface protocol (free format)"
+ },
+ "InterfaceExtension": {
+ "type": "array",
+ "description": "URIs identifying supported extensions to the interface protocol",
+ "items": {
+ "type": "string"
+ }
+ },
+ "WSDL": {
+ "type": "array",
+ "description": "URLs of WSDL document(s) describing the interface",
+ "items": {
+ "type": "string"
+ }
+ },
+ "SupportedProfile": {
+ "type": "array",
+ "description": "URI(s) identifying supported profiles for the Endpoint",
+ "items": {
+ "type": "string"
+ }
+ },
+ "Semantics": {
+ "type": "array",
+ "description": "URL(s) of documents providing human-readable descriptions of the semantics of the Endpoint",
+ "items": {
+ "type": "string"
+ }
+ },
+ "Implementor": {
+ "type": "string",
+ "description": "The name of the main organization implementing the Endpoint"
+ },
+ "ImplementationName": {
+ "type": "string",
+ "description": "The name of the implementation of the Endpoint"
+ },
+ "ImplementationVersion": {
+ "type": "string",
+ "description": "The version of the implementation of the Endpoint"
+ },
+ "QualityLevel": {
+ "type": "string",
+ "description": "QualityLevel_t",
+ "enum": ["development","pre-production","production","testing"]
+ },
+ "HealthState": {
+ "type": "string",
+ "description": "The operational status of the Endpoint",
+ "enum": ["critical","ok","other","unknown","warning"]
+ },
+ "HealthStateInfo": {
+ "type": "string",
+ "description": "A human-readable explanation of the HealthState of this Endpoint"
+ },
+ "ServingState": {
+ "type": "string",
+ "description": "If the endpoint is accepting and serving requests",
+ "enum": ["closed","draining","production","queueing"]
+ },
+ "StartTime": {
+ "type": "string",
+ "description": "The start time of the Service associated with this Endpoint (DateTime_t)"
+ },
+ "IssuerCA": {
+ "type": "string",
+ "description": "The DN of the CA issuing the certificate presented by this Endpoint"
+ },
+ "TrustedCA": {
+ "type": "array",
+ "description": "DN(s) of CAs trusted by this Endpoint",
+ "items": {
+ "type": "string"
+ }
+ },
+ "DowntimeAnnounce": {
+ "type": "string",
+ "description": "When the next scheduled downtime was announced (DateTime_t)"
+ },
+ "DowntimeStart": {
+ "type": "string",
+ "description": "When the next scheduled downtime will start (DateTime_t)"
+ },
+ "DowntimeEnd": {
+ "type": "string",
+ "description": "When the next scheduled downtime will end (DateTime_t)"
+ },
+ "DowntimeInfo": {
+ "type": "string",
+ "description": "Human-readable of the next scheduled downtime"
+ },
+ "ServiceID": {
+ "type": "string",
+ "description": "The ID of the Service associated with this Endpoint"
+ },
+ "ShareID": {
+ "type": "array",
+ "description": "The IDs of the Shares accessible from this Endpoint",
+ "items": {
+ "type": "string"
+ }
+ },
+ "AccessPolicyID": {
+ "type": "array",
+ "description": "IDs of AccessPolicies associated with this Endpoint",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ActivityID": {
+ "type": "array",
+ "description": "IDs of Activities being managed through this Endpoint",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["InterfaceName","QualityLevel","HealthState","ServingState","ServiceID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Entity.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Entity.json b/modules/gfac/gfac-core/src/main/resources/schema/Entity.json
new file mode 100644
index 0000000..5d1ae46
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Entity.json
@@ -0,0 +1,35 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json",
+ "type": "object",
+ "properties": {
+ "CreationTime": {
+ "type": "string",
+ "description": "The creation time of this entity in the format: CCYY-MM-DDThh:mm:ss[Z|(+|-)hh:mm]"
+ },
+ "Validity": {
+ "type": "integer",
+ "description": "The number of seconds after CreationTime that this entity should be considered relevant"
+ },
+ "ID": {
+ "type": "string",
+ "description": "A globally unique identifier for this entity"
+ },
+ "Name": {
+ "type": "string",
+ "description": "A human-readable name"
+ },
+ "OtherInfo": {
+ "type": "array",
+ "description": "Placeholder for information that does not fit in any other attribute",
+ "items": {
+ "type": "string"
+ }
+ },
+ "Extension": {
+ "type": "object",
+ "description": "Key/value pairs enabling the association of extra information not captured by the model"
+ }
+ },
+ "required": ["ID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/ExecutionEnvironment.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/ExecutionEnvironment.json b/modules/gfac/gfac-core/src/main/resources/schema/ExecutionEnvironment.json
new file mode 100644
index 0000000..77bf876
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/ExecutionEnvironment.json
@@ -0,0 +1,115 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ExecutionEnvironment.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Resource.json"}],
+ "properties": {
+ "Platform": {
+ "type": "string",
+ "description": "The platform architecture - Platform_t (open enumeration)"
+ },
+ "VirtualMachine": {
+ "type": "boolean",
+ "description": "True if the ExecutionEnvironment is a virtual machine"
+ },
+ "TotalInstances": {
+ "type": "integer",
+ "description": "The total number of ExecutionEnvironment instances"
+ },
+ "UsedInstances": {
+ "type": "integer",
+ "description": "The number of ExecutionEnvironment instances in use"
+ },
+ "UnavailableInstances": {
+ "type": "integer",
+ "description": "The number of ExecutionEnvironment instances that are unavailable"
+ },
+ "PhysicalCPUs": {
+ "type": "integer",
+ "description": "The number of physical CPUs in one ExecutionEnvironment instance"
+ },
+ "LogicalCPUs": {
+ "type": "integer",
+ "description": "The number of logical CPUs in one ExecutionEnvironment instance"
+ },
+ "CPUMultiplicity": {
+ "type": "string",
+ "description": "Information about the CPUs and cores in an execution environment",
+ "enum": ["multicpu-multicore","multicpu-singlecore","singlecpu-multicore","singlecpu-singlecore"]
+ },
+ "CPUVendor": {
+ "type": "string",
+ "description": "The name of the manufacturer of the CPU"
+ },
+ "CPUModel": {
+ "type": "string",
+ "description": "The model of the CPU, as defined by the vendor"
+ },
+ "CPUVersion": {
+ "type": "string",
+ "description": "The specific version name of the CPU, as defined by the vendor"
+ },
+ "CPUClockSpeed": {
+ "type": "integer",
+ "description": "The clock speed of the CPU (MHz)"
+ },
+ "CPUTimeScalingFactor": {
+ "type": "float",
+ "description": "The factor used by the ComputingManager to scale the CPU time limit"
+ },
+ "WallTimeScalingFactor": {
+ "type": "float",
+ "description": "The factor used by the ComputingManager to scale the wallclock time limit"
+ },
+ "MainMemorySize": {
+ "type": "integer",
+ "description": "The total amount of physical RAM in one ExecutionEnvironment instance (MB)"
+ },
+ "VirtualMemorySize": {
+ "type": "integer",
+ "description": "The total amount of virtual memory (RAM+swap) in one ExecutionEnvironment instance (MB)"
+ },
+ "OSFamily": {
+ "type": "string",
+ "description": "The general family of the operating system - OSFamily_t (open enumeration)"
+ },
+ "OSName": {
+ "type": "string",
+ "description": "The specific name of the operating system - OSName_t (open enumeration)"
+ },
+ "OSVersion": {
+ "type": "string",
+ "description": "The version of the operating system, as defined by the vendor"
+ },
+ "ConnectivityIn": {
+ "type": "boolean",
+ "description": "True if direct inbound network connectiity is available to a running job"
+ },
+ "ConnectivityOut": {
+ "type": "boolean",
+ "description": "True if direct outbound network connectiity is available to a running job"
+ },
+ "NetworkInfo": {
+ "type": "array",
+ "description": "The types of internal network connections between ExecutionEnvironments - NetworkInfo_t (open enumeration)",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ApplicationEnvironmentID": {
+ "type": "array",
+ "description": "ID(s) of ApplicationEnvironments available in this ExecutionEnvironment",
+ "items": {
+ "type": "string"
+ }
+ },
+ "BenchmarkID": {
+ "type": "array",
+ "description": "ID(s) of Benchmarks associated with this ExecutionEnvironment",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["Platform","MainMemorySize","OSFamily","ConnectivityIn","ConnectivityOut"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Glue2.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Glue2.json b/modules/gfac/gfac-core/src/main/resources/schema/Glue2.json
new file mode 100644
index 0000000..bb80505
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Glue2.json
@@ -0,0 +1,246 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Glue2.json",
+ "description": "A GLUE 2 document",
+ "type": "object",
+ "properties": {
+ "Entity": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}]
+ }
+ },
+ "Location": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Location.json"}]
+ }
+ },
+ "Contact": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Contact.json"}]
+ }
+ },
+ "Domain": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Domain.json"}]
+ }
+ },
+ "AdminDomain": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AdminDomain.json"}]
+ }
+ },
+ "UserDomain": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/UserDomain.json"}]
+ }
+ },
+ "Service": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Service.json"}]
+ }
+ },
+ "Endpoint": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Endpoint.json"}]
+ }
+ },
+ "Share": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json"}]
+ }
+ },
+ "Manager": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Manager.json"}]
+ }
+ },
+ "Resource": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Resource.json"}]
+ }
+ },
+ "Activity": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Activity.json"}]
+ }
+ },
+ "Policy": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Policy.json"}]
+ }
+ },
+ "AccessPolicy": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/AccessPolicy.json"}]
+ }
+ },
+ "MappingPolicy": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/MappingPolicy.json"}]
+ }
+ },
+ "ComputingService": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingService.json"}]
+ }
+ },
+ "ComputingEndpoint": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingEndpoint.json"}]
+ }
+ },
+ "ComputingShare": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingShare.json"}]
+ }
+ },
+ "ComputingManager": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingManager.json"}]
+ }
+ },
+ "Benchmark": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Benchmark.json"}]
+ }
+ },
+ "ExecutionEnvironment": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ExecutionEnvironment.json"}]
+ }
+ },
+ "ApplicationEnvironment": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationEnvironment.json"}]
+ }
+ },
+ "ApplicationHandle": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ApplicationHandle.json"}]
+ }
+ },
+ "ComputingActivity": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ComputingActivity.json"}]
+ }
+ },
+ "ToStorageService": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ToStorageService.json"}]
+ }
+ },
+ "StorageService": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageService.json"}]
+ }
+ },
+ "StorageServiceCapacity": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageServiceCapacity.json"}]
+ }
+ },
+ "StorageAccessProtocol": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageAccessProtocol.json"}]
+ }
+ },
+ "StorageEndpoint": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageEndpoint.json"}]
+ }
+ },
+ "StorageShare": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageShare.json"}]
+ }
+ },
+ "StorageShareCapacity": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageShareCapacity.json"}]
+ }
+ },
+ "StorageManager": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageManager.json"}]
+ }
+ },
+ "DataStore": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/DataStore.json"}]
+ }
+ },
+ "ToComputingService": {
+ "type": "array",
+ "items": {
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/ToComputingService.json"}]
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Location.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Location.json b/modules/gfac/gfac-core/src/main/resources/schema/Location.json
new file mode 100644
index 0000000..8491cc0
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Location.json
@@ -0,0 +1,47 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Location.json",
+ "description": "A GLUE 2 Location",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Address": {
+ "type": "string",
+ "description": "A free format street address"
+ },
+ "Place": {
+ "type": "string",
+ "description": "Name of town/city"
+ },
+ "Country": {
+ "type": "string",
+ "description": "Name of country"
+ },
+ "PostalCode": {
+ "type": "string",
+ "description": "Postal code"
+ },
+ "Latitude": {
+ "type": "number",
+ "description": "Position north (positive) or south (negative) of the equator in degrees"
+ },
+ "Longitude": {
+ "type": "number",
+ "description": "Position east (positive) or west (negative) of the primary meridian in degrees"
+ },
+ "ServiceID": {
+ "type": "array",
+ "description": "The IDs of Services at this location",
+ "items": {
+ "type": "string"
+ }
+ },
+ "DomainID": {
+ "type": "array",
+ "description": "The IDs of Domains at this location",
+ "items": {
+ "type": "string"
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Manager.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Manager.json b/modules/gfac/gfac-core/src/main/resources/schema/Manager.json
new file mode 100644
index 0000000..d1df50a
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Manager.json
@@ -0,0 +1,28 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Manager.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "ProductName": {
+ "type": "string",
+ "description": "The name of the software product which implements the Manager"
+ },
+ "ProductVersion": {
+ "type": "string",
+ "description": "The version of the software product which implements the Manager"
+ },
+ "ServiceID": {
+ "type": "string",
+ "description": "The ID of the Service this Share participates in"
+ },
+ "ResourceID": {
+ "type": "array",
+ "description": "ID(s) of Resources associated with this Share",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["ProductName","ServiceID","ResourceID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/MappingPolicy.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/MappingPolicy.json b/modules/gfac/gfac-core/src/main/resources/schema/MappingPolicy.json
new file mode 100644
index 0000000..268844d
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/MappingPolicy.json
@@ -0,0 +1,13 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/MappingPolicy.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Policy.json"}],
+ "properties": {
+ "ShareID": {
+ "type": "string",
+ "description": "The ID of the Share this MappingPolicy is for"
+ }
+ },
+ "required": ["ShareID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Policy.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Policy.json b/modules/gfac/gfac-core/src/main/resources/schema/Policy.json
new file mode 100644
index 0000000..f936699
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Policy.json
@@ -0,0 +1,27 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Policy.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Scheme": {
+ "type": "string",
+ "description": "PolicyScheme_t (open enumeration)"
+ },
+ "Rule": {
+ "type": "array",
+ "description": "Policy rules",
+ "items": {
+ "type": "string"
+ }
+ },
+ "UserDomainID": {
+ "type": "array",
+ "description": "The ID(s) of the UserDomains this Policy applies to",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["Scheme","Rule","UserDomainID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Resource.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Resource.json b/modules/gfac/gfac-core/src/main/resources/schema/Resource.json
new file mode 100644
index 0000000..88d08ad
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Resource.json
@@ -0,0 +1,27 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Resource.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "ManagerID": {
+ "type": "string",
+ "description": "The ID of the Manager for this Resource"
+ },
+ "ShareID": {
+ "type": "array",
+ "description": "The ID(s) of the Shares this Resource is part of",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ActivityID": {
+ "type": "array",
+ "description": "The ID(s) of Activities consuming from this Share",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["ManagerID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Service.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Service.json b/modules/gfac/gfac-core/src/main/resources/schema/Service.json
new file mode 100644
index 0000000..4662407
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Service.json
@@ -0,0 +1,75 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Service.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Capability": {
+ "type": "array",
+ "description": "Capability_t (open enumeration)",
+ "items": {
+ "type": "string"
+ }
+ },
+ "Type": {
+ "type": "string",
+ "description": "ServiceType_t (open enumeration)"
+ },
+ "QualityLevel": {
+ "type": "string",
+ "description": "QualityLevel_t",
+ "enum": ["development","pre-production","production","testing"]
+ },
+ "StatusInfo": {
+ "type": "array",
+ "description": "URLs of web pages providing additional information",
+ "items": {
+ "type": "string"
+ }
+ },
+ "Complexity": {
+ "type": "string",
+ "description": "A human-readable description of the number of endpoint types, shares, and resources"
+ },
+ "EndpointID": {
+ "type": "array",
+ "description": "The IDs of Endpoints for this Service",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ShareID": {
+ "type": "array",
+ "description": "The IDs of the Shares offered by this Service",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ManagerID": {
+ "type": "array",
+ "description": "The IDs of the Managers of this Service",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ContactID": {
+ "type": "array",
+ "description": "The IDs of Contacts for this Service",
+ "items": {
+ "type": "string"
+ }
+ },
+ "LocationID": {
+ "type": "string",
+ "description": "The ID of the primary Location of this Service"
+ },
+ "ServiceID": {
+ "type": "array",
+ "description": "The IDs of Services related to this Service",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["Type","QualityLevel"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/Share.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/Share.json b/modules/gfac/gfac-core/src/main/resources/schema/Share.json
new file mode 100644
index 0000000..258fc1b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/Share.json
@@ -0,0 +1,45 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Share.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Description": {
+ "type": "string",
+ "description": "A human-readable description of the Share"
+ },
+ "EndpointID": {
+ "type": "array",
+ "description": "The ID(s) of the Endpoints that can be used to access this Share",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ResourceID": {
+ "type": "array",
+ "description": "The ID(s) of the Resources associated with this Share",
+ "items": {
+ "type": "string"
+ }
+ },
+ "ServiceID": {
+ "type": "string",
+ "description": "The ID of the Service this Share participates in"
+ },
+ "ActivityID": {
+ "type": "array",
+ "description": "The ID(s) of Activities consuming from this Share",
+ "items": {
+ "type": "string"
+ }
+ },
+ "MappingPolicyID": {
+ "type": "array",
+ "description": "ID(s) of MappingPolicies associated with this Share",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["ServiceID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/StorageAccessProtocol.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/StorageAccessProtocol.json b/modules/gfac/gfac-core/src/main/resources/schema/StorageAccessProtocol.json
new file mode 100644
index 0000000..05a830b
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/StorageAccessProtocol.json
@@ -0,0 +1,32 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageAccessProtocol.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Entity.json"}],
+ "properties": {
+ "Type": {
+ "type": "string",
+ "description": "The type of the protocol - StorageAccessProtocol_t"
+ },
+ "Version": {
+ "type": "string",
+ "description": "The version of the protocol supported"
+ },
+ "MaxStreams": {
+ "type": "integer",
+ "description": "The maximum number of parallel network streams which can be usef for a single transfer"
+ },
+ "StorageServiceID": {
+ "type": "string",
+ "description": "The ID of the StorageService this protocol is available for"
+ },
+ "ToComputingServiceID": {
+ "type": "array",
+ "description": "The ID(s) ToComputingService objects that describe connectivity to ComputingServices",
+ "items": {
+ "type": "string"
+ }
+ }
+ },
+ "required": ["Type","Version","StorageServiceID"]
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/resources/schema/StorageEndpoint.json
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/resources/schema/StorageEndpoint.json b/modules/gfac/gfac-core/src/main/resources/schema/StorageEndpoint.json
new file mode 100644
index 0000000..38b27c4
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/resources/schema/StorageEndpoint.json
@@ -0,0 +1,8 @@
+{
+ "$schema": "http://json-schema.org/draft-04/schema#",
+ "id": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/StorageEndpoint.json",
+ "type": "object",
+ "allOf": [{"$ref": "http://schemas.ogf.org/glue/2013/05/spec_2.0_r1/Endpoint.json"}],
+ "properties": {
+ }
+}
[7/8] merging monitoring with gfac-core, later this will be separated
Posted by la...@apache.org.
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/PullMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/PullMonitor.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/PullMonitor.java
new file mode 100644
index 0000000..efdf89c
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/PullMonitor.java
@@ -0,0 +1,64 @@
+/*
+ *
+ * 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.gfac.monitor.exception.AiravataMonitorException;
+
+/**
+ * PullMonitors can implement this interface
+ * Since the pull and push based monitoring required different
+ * operations, PullMonitor will be useful.
+ * This will allow users to program Pull monitors separately
+ */
+public abstract class PullMonitor extends AiravataAbstractMonitor {
+
+ private int pollingFrequence;
+ /**
+ * This method will can invoke when PullMonitor needs to start
+ * and it has to invoke in the frequency specified below,
+ * @return if the start process is successful return true else false
+ */
+ public abstract boolean startPulling() throws AiravataMonitorException;
+
+ /**
+ * This is the method to stop the polling process
+ * @return if the stopping process is successful return true else false
+ */
+ public abstract boolean stopPulling()throws AiravataMonitorException;
+
+ /**
+ * this method can be used to set the polling frequencey or otherwise
+ * can implement a polling mechanism, and implement how to do
+ * @param frequence
+ */
+ public void setPollingFrequence(int frequence){
+ this.pollingFrequence = frequence;
+ }
+
+ /**
+ * this method can be used to get the polling frequencey or otherwise
+ * can implement a polling mechanism, and implement how to do
+ * @return
+ */
+ public int getPollingFrequence(){
+ return this.pollingFrequence;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/PushMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/PushMonitor.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/PushMonitor.java
new file mode 100644
index 0000000..8e13252
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/core/PushMonitor.java
@@ -0,0 +1,60 @@
+/*
+ *
+ * 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.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+
+/**
+ * PushMonitors can implement this interface
+ * Since the pull and push based monitoring required different
+ * operations, PullMonitor will be useful.
+ * This interface will allow users to program Push monitors separately
+ */
+public abstract class PushMonitor extends AiravataAbstractMonitor {
+ /**
+ * This method can be invoked to register a listener with the
+ * remote monitoring system, ideally inside this method users will be
+ * writing some client listener code for the remote monitoring system,
+ * this will be a simple wrapper around any client for the remote Monitor.
+ * @param monitorID
+ * @return
+ */
+ public abstract boolean registerListener(MonitorID monitorID)throws AiravataMonitorException;
+
+ /**
+ * This method can be invoked to unregister a listener with the
+ * remote monitoring system, ideally inside this method users will be
+ * writing some client listener code for the remote monitoring system,
+ * this will be a simple wrapper around any client for the remote Monitor.
+ * @param monitorID
+ * @return
+ */
+ public abstract boolean unRegisterListener(MonitorID monitorID)throws AiravataMonitorException;
+
+ /**
+ * This can be used to stop the registration thread
+ * @return
+ * @throws org.apache.airavata.gfac.monitor.exception.AiravataMonitorException
+ */
+ public abstract boolean stopRegister()throws AiravataMonitorException;
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/event/MonitorPublisher.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/event/MonitorPublisher.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/event/MonitorPublisher.java
new file mode 100644
index 0000000..52487fe
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/event/MonitorPublisher.java
@@ -0,0 +1,47 @@
+/*
+ *
+ * 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.event;
+
+import com.google.common.eventbus.EventBus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class MonitorPublisher{
+ private final static Logger logger = LoggerFactory.getLogger(MonitorPublisher.class);
+ private EventBus eventBus;
+
+ public MonitorPublisher(EventBus eventBus) {
+ this.eventBus = eventBus;
+ }
+
+ public void registerListener(Object listener) {
+ eventBus.register(listener);
+ }
+
+ public void unregisterListener(Object listener) {
+ eventBus.unregister(listener);
+ }
+
+ public void publish(Object o) {
+ eventBus.post(o);
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/exception/AiravataMonitorException.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/exception/AiravataMonitorException.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/exception/AiravataMonitorException.java
new file mode 100644
index 0000000..3acef66
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/exception/AiravataMonitorException.java
@@ -0,0 +1,37 @@
+/*
+ *
+ * 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.exception;
+
+public class AiravataMonitorException extends Exception {
+ private static final long serialVersionUID = -2849422320139467602L;
+
+ public AiravataMonitorException(Throwable e) {
+ super(e);
+ }
+
+ public AiravataMonitorException(String message) {
+ super(message, null);
+ }
+
+ public AiravataMonitorException(String message, Throwable e) {
+ super(message, e);
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/LocalJobMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/LocalJobMonitor.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/LocalJobMonitor.java
new file mode 100644
index 0000000..a64b484
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/LocalJobMonitor.java
@@ -0,0 +1,59 @@
+/*
+ *
+ * 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.impl;
+
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.gfac.monitor.JobIdentity;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.core.AiravataAbstractMonitor;
+import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.model.workspace.experiment.JobState;
+
+import java.util.concurrent.BlockingQueue;
+
+/**
+ * This monitor can be used to monitor a job which runs locally,
+ * Since its a local job job doesn't have states, once it get executed
+ * then the job starts running
+ */
+public class LocalJobMonitor extends AiravataAbstractMonitor {
+ // Though we have a qeuue here, it not going to be used in local jobs
+ BlockingQueue<MonitorID> jobQueue;
+
+ public void run() {
+ do {
+ try {
+ MonitorID take = jobQueue.take();
+ getPublisher().publish(new JobStatusChangeRequest(take, new JobIdentity(take.getExperimentID(), take.getWorkflowNodeID(), take.getTaskID(), take.getJobID()), JobState.COMPLETE));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } while (!ServerSettings.isStopAllThreads());
+ }
+
+ public BlockingQueue<MonitorID> getJobQueue() {
+ return jobQueue;
+ }
+
+ public void setJobQueue(BlockingQueue<MonitorID> jobQueue) {
+ this.jobQueue = jobQueue;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/QstatMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/QstatMonitor.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/QstatMonitor.java
new file mode 100644
index 0000000..4e2e18e
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/QstatMonitor.java
@@ -0,0 +1,262 @@
+/*
+ *
+ * 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.impl.pull.qstat;
+
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.monitor.HostMonitorData;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.UserMonitorData;
+import org.apache.airavata.gfac.monitor.core.PullMonitor;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.monitor.util.CommonUtils;
+import org.apache.airavata.gsi.ssh.api.SSHApiException;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.sql.Timestamp;
+import java.util.*;
+import java.util.concurrent.BlockingQueue;
+
+/**
+ * This monitor is based on qstat command which can be run
+ * in grid resources and retrieve the job status.
+ */
+public class QstatMonitor extends PullMonitor {
+ private final static Logger logger = LoggerFactory.getLogger(QstatMonitor.class);
+
+ // I think this should use DelayedBlocking Queue to do the monitoring*/
+ private BlockingQueue<UserMonitorData> queue;
+
+ private boolean startPulling = false;
+
+ private Map<String, ResourceConnection> connections;
+
+ private MonitorPublisher publisher;
+
+ public QstatMonitor(){
+ connections = new HashMap<String, ResourceConnection>();
+ }
+ public QstatMonitor(BlockingQueue<UserMonitorData> queue, MonitorPublisher publisher) {
+ this.queue = queue;
+ this.publisher = publisher;
+ connections = new HashMap<String, ResourceConnection>();
+ }
+
+ public void run() {
+ /* implement a logic to pick each monitorID object from the queue and do the
+ monitoring
+ */
+ this.startPulling = true;
+ while (this.startPulling && !ServerSettings.isStopAllThreads()) {
+ try {
+ startPulling();
+ // After finishing one iteration of the full queue this thread sleeps 1 second
+ Thread.sleep(10000);
+ } catch (Exception e){
+ // we catch all the exceptions here because no matter what happens we do not stop running this
+ // thread, but ideally we should report proper error messages, but this is handled in startPulling
+ // method, incase something happen in Thread.sleep we handle it with this catch block.
+ e.printStackTrace();
+ logger.error(e.getMessage());
+ }
+ }
+ // thread is going to return so we close all the connections
+ Iterator<String> iterator = connections.keySet().iterator();
+ while(iterator.hasNext()){
+ String next = iterator.next();
+ ResourceConnection resourceConnection = connections.get(next);
+ try {
+ resourceConnection.getCluster().disconnect();
+ } catch (SSHApiException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+ }
+
+ /**
+ * This method will can invoke when PullMonitor needs to start
+ * and it has to invoke in the frequency specified below,
+ *
+ * @return if the start process is successful return true else false
+ */
+ public boolean startPulling() throws AiravataMonitorException {
+ // take the top element in the queue and pull the data and put that element
+ // at the tail of the queue
+ //todo this polling will not work with multiple usernames but with single user
+ // and multiple hosts, currently monitoring will work
+ UserMonitorData take = null;
+ JobStatusChangeRequest jobStatus = new JobStatusChangeRequest();
+ MonitorID currentMonitorID = null;
+ HostDescription currentHostDescription = null;
+ try {
+ take = this.queue.take();
+ List<MonitorID> completedJobs = new ArrayList<MonitorID>();
+ List<HostMonitorData> hostMonitorData = take.getHostMonitorData();
+ for (HostMonitorData iHostMonitorData : hostMonitorData) {
+ if (iHostMonitorData.getHost().getType() instanceof GsisshHostType) {
+ currentHostDescription = iHostMonitorData.getHost();
+ GsisshHostType gsisshHostType = (GsisshHostType) iHostMonitorData.getHost().getType();
+ String hostName = gsisshHostType.getHostAddress();
+ ResourceConnection connection = null;
+ if (connections.containsKey(hostName)) {
+ logger.debug("We already have this connection so not going to create one");
+ connection = connections.get(hostName);
+ } else {
+ connection = new ResourceConnection(take.getUserName(), iHostMonitorData, gsisshHostType.getInstalledPath());
+ connections.put(hostName, connection);
+ }
+ List<MonitorID> monitorID = iHostMonitorData.getMonitorIDs();
+ Map<String, JobState> jobStatuses = connection.getJobStatuses(take.getUserName(), monitorID);
+ for (MonitorID iMonitorID : monitorID) {
+ currentMonitorID = iMonitorID;
+ iMonitorID.setStatus(jobStatuses.get(iMonitorID.getJobID()));
+ jobStatus.setMonitorID(iMonitorID);
+ jobStatus.setState(iMonitorID.getStatus());
+ // we have this JobStatus class to handle amqp monitoring
+
+ publisher.publish(jobStatus);
+ // if the job is completed we do not have to put the job to the queue again
+ iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
+
+ // After successful monitoring perform following actions to cleanup the queue, if necessary
+ if (jobStatus.getState().equals(JobState.COMPLETE)) {
+ completedJobs.add(iMonitorID);
+ } else if (iMonitorID.getFailedCount() > 2 && iMonitorID.getStatus().equals(JobState.UNKNOWN)) {
+ logger.error("Tried to monitor the job with ID " + iMonitorID.getJobID() + " But failed 3 times, so skip this Job from Monitor");
+ iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
+ completedJobs.add(iMonitorID);
+ } else {
+ // Evey
+ iMonitorID.setLastMonitored(new Timestamp((new Date()).getTime()));
+ // if the job is complete we remove it from the Map, if any of these maps
+ // get empty this userMonitorData will get delete from the queue
+ }
+ }
+ } else {
+ logger.debug("Qstat Monitor doesn't handle non-gsissh hosts");
+ }
+ }
+ // We have finished all the HostMonitorData object in userMonitorData, now we need to put it back
+ // now the userMonitorData goes back to the tail of the queue
+ queue.put(take);
+ // cleaning up the completed jobs, this method will remove some of the userMonitorData from the queue if
+ // they become empty
+ for(MonitorID completedJob:completedJobs){
+ CommonUtils.removeMonitorFromQueue(queue, completedJob);
+ }
+ } catch (InterruptedException e) {
+ if (!this.queue.contains(take)) {
+ try {
+ this.queue.put(take);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+ logger.error("Error handling the job with Job ID:" + currentMonitorID.getJobID());
+ throw new AiravataMonitorException(e);
+ } catch (SSHApiException e) {
+ logger.error(e.getMessage());
+ if (e.getMessage().contains("Unknown Job Id Error")) {
+ // in this case job is finished or may be the given job ID is wrong
+ jobStatus.setState(JobState.UNKNOWN);
+ publisher.publish(jobStatus);
+ } else if (e.getMessage().contains("illegally formed job identifier")) {
+ logger.error("Wrong job ID is given so dropping the job from monitoring system");
+ } else if (!this.queue.contains(take)) { // we put the job back to the queue only if its state is not unknown
+ if (currentMonitorID == null) {
+ logger.error("Monitoring the jobs failed, for user: " + take.getUserName()
+ + " in Host: " + currentHostDescription.getType().getHostAddress());
+ } else {
+ if (currentMonitorID != null) {
+ if (currentMonitorID.getFailedCount() < 2) {
+ try {
+ currentMonitorID.setFailedCount(currentMonitorID.getFailedCount() + 1);
+ this.queue.put(take);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ } else {
+ logger.error(e.getMessage());
+ logger.error("Tried to monitor the job 3 times, so dropping of the the Job with ID: " + currentMonitorID.getJobID());
+ }
+ }
+ }
+ }
+ throw new AiravataMonitorException("Error retrieving the job status", e);
+ } catch (Exception e) {
+ if (currentMonitorID != null) {
+ if (currentMonitorID.getFailedCount() < 3) {
+ try {
+ currentMonitorID.setFailedCount(currentMonitorID.getFailedCount() + 1);
+ this.queue.put(take);
+ // if we get a wrong status we wait for a while and request again
+ Thread.sleep(10000);
+ } catch (InterruptedException e1) {
+ e1.printStackTrace();
+ }
+ } else {
+ logger.error(e.getMessage());
+ logger.error("Tryied to monitor the job 3 times, so dropping of the the Job with ID: " + currentMonitorID.getJobID());
+ }
+ }
+ throw new AiravataMonitorException("Error retrieving the job status", e);
+ }
+
+
+ return true;
+ }
+
+
+ /**
+ * This is the method to stop the polling process
+ *
+ * @return if the stopping process is successful return true else false
+ */
+ public boolean stopPulling() {
+ this.startPulling = false;
+ return true;
+ }
+
+ public MonitorPublisher getPublisher() {
+ return publisher;
+ }
+
+ public void setPublisher(MonitorPublisher publisher) {
+ this.publisher = publisher;
+ }
+
+ public BlockingQueue<UserMonitorData> getQueue() {
+ return queue;
+ }
+
+ public void setQueue(BlockingQueue<UserMonitorData> queue) {
+ this.queue = queue;
+ }
+
+ public boolean authenticate() {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
new file mode 100644
index 0000000..7a37b88
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/pull/qstat/ResourceConnection.java
@@ -0,0 +1,151 @@
+/*
+ *
+ * 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.impl.pull.qstat;
+
+import org.apache.airavata.gfac.monitor.HostMonitorData;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gsi.ssh.api.SSHApiException;
+import org.apache.airavata.gsi.ssh.api.ServerInfo;
+import org.apache.airavata.gsi.ssh.api.authentication.AuthenticationInfo;
+import org.apache.airavata.gsi.ssh.api.job.JobManagerConfiguration;
+import org.apache.airavata.gsi.ssh.impl.JobStatus;
+import org.apache.airavata.gsi.ssh.impl.PBSCluster;
+import org.apache.airavata.gsi.ssh.util.CommonUtils;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.apache.airavata.schemas.gfac.GsisshHostType;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.util.List;
+import java.util.Map;
+import java.util.TreeMap;
+
+
+public class ResourceConnection {
+ private static final Logger log = LoggerFactory.getLogger(ResourceConnection.class);
+
+ private PBSCluster cluster;
+
+ public ResourceConnection(MonitorID monitorID, String installedPath) throws SSHApiException {
+ AuthenticationInfo authenticationInfo = monitorID.getAuthenticationInfo();
+ String hostAddress = monitorID.getHost().getType().getHostAddress();
+ String userName = monitorID.getUserName();
+ String jobManager = ((GsisshHostType)monitorID.getHost().getType()).getJobManager();
+ JobManagerConfiguration jConfig = null;
+ if (jobManager == null) {
+ log.error("No Job Manager is configured, so we are picking pbs as the default job manager");
+ jConfig = CommonUtils.getPBSJobManager(installedPath);
+ } else {
+ if (org.apache.airavata.gfac.monitor.util.CommonUtils.isPBSHost(monitorID.getHost())) {
+ jConfig = CommonUtils.getPBSJobManager(installedPath);
+ } else if(org.apache.airavata.gfac.monitor.util.CommonUtils.isSlurm(monitorID.getHost())) {
+ jConfig = CommonUtils.getSLURMJobManager(installedPath);
+ } else if(org.apache.airavata.gfac.monitor.util.CommonUtils.isSGE(monitorID.getHost())) {
+ jConfig = CommonUtils.getSGEJobManager(installedPath);
+ }
+ //todo support br2 etc
+ }
+ ServerInfo serverInfo = new ServerInfo(userName, hostAddress, ((GsisshHostType)monitorID.getHost().getType()).getPort());
+ cluster = new PBSCluster(serverInfo, authenticationInfo, jConfig);
+ }
+
+ public ResourceConnection(String userName, HostMonitorData hostMonitorData, String installedPath) throws SSHApiException {
+ AuthenticationInfo authenticationInfo = hostMonitorData.getMonitorIDs().get(0).getAuthenticationInfo();
+ String hostAddress = hostMonitorData.getHost().getType().getHostAddress();
+ String jobManager = ((GsisshHostType)hostMonitorData.getHost().getType()).getJobManager();
+ JobManagerConfiguration jConfig = null;
+ if (jobManager == null) {
+ log.error("No Job Manager is configured, so we are picking pbs as the default job manager");
+ jConfig = CommonUtils.getPBSJobManager(installedPath);
+ } else {
+ if (org.apache.airavata.gfac.monitor.util.CommonUtils.isPBSHost(hostMonitorData.getHost())) {
+ jConfig = CommonUtils.getPBSJobManager(installedPath);
+ } else if(org.apache.airavata.gfac.monitor.util.CommonUtils.isSlurm(hostMonitorData.getHost())) {
+ jConfig = CommonUtils.getSLURMJobManager(installedPath);
+ }else if(org.apache.airavata.gfac.monitor.util.CommonUtils.isSGE(hostMonitorData.getHost())) {
+ jConfig = CommonUtils.getSGEJobManager(installedPath);
+ }
+ //todo support br2 etc
+ }
+ ServerInfo serverInfo = new ServerInfo(userName, hostAddress, ((GsisshHostType)hostMonitorData.getHost().getType()).getPort());
+ cluster = new PBSCluster(serverInfo, authenticationInfo, jConfig);
+ }
+ public JobState getJobStatus(MonitorID monitorID) throws SSHApiException {
+ String jobID = monitorID.getJobID();
+ //todo so currently we execute the qstat for each job but we can use user based monitoring
+ //todo or we should concatenate all the commands and execute them in one go and parse the response
+ return getStatusFromString(cluster.getJobStatus(jobID).toString());
+ }
+
+ public Map<String,JobState> getJobStatuses(String userName,List<MonitorID> monitorIDs) throws SSHApiException {
+ Map<String,JobStatus> treeMap = new TreeMap<String,JobStatus>();
+ Map<String,JobState> treeMap1 = new TreeMap<String,JobState>();
+ // creating a sorted map with all the jobIds and with the predefined
+ // status as UNKNOWN
+ for (MonitorID monitorID : monitorIDs) {
+ treeMap.put(monitorID.getJobID(), JobStatus.U);
+ }
+ //todo so currently we execute the qstat for each job but we can use user based monitoring
+ //todo or we should concatenate all the commands and execute them in one go and parse the response
+ cluster.getJobStatuses(userName,treeMap);
+ for(String key:treeMap.keySet()){
+ treeMap1.put(key,getStatusFromString(treeMap.get(key).toString()));
+ }
+ return treeMap1;
+ }
+ private JobState getStatusFromString(String status) {
+ log.info("parsing the job status returned : " + status);
+ if(status != null){
+ if("C".equals(status) || "CD".equals(status)|| "E".equals(status) || "CG".equals(status)){
+ return JobState.COMPLETE;
+ }else if("H".equals(status) || "h".equals(status)){
+ return JobState.HELD;
+ }else if("Q".equals(status) || "qw".equals(status)){
+ return JobState.QUEUED;
+ }else if("R".equals(status) || "CF".equals(status) || "r".equals(status)){
+ return JobState.ACTIVE;
+ }else if ("T".equals(status)) {
+ return JobState.HELD;
+ } else if ("W".equals(status) || "PD".equals(status)) {
+ return JobState.QUEUED;
+ } else if ("S".equals(status)) {
+ return JobState.SUSPENDED;
+ }else if("CA".equals(status)){
+ return JobState.CANCELED;
+ }else if ("F".equals(status) || "NF".equals(status) || "TO".equals(status)) {
+ return JobState.FAILED;
+ }else if ("PR".equals(status) || "Er".equals(status)) {
+ return JobState.FAILED;
+ }else if ("U".equals(status)){
+ return JobState.UNKNOWN;
+ }
+ }
+ return JobState.UNKNOWN;
+ }
+
+ public PBSCluster getCluster() {
+ return cluster;
+ }
+
+ public void setCluster(PBSCluster cluster) {
+ this.cluster = cluster;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/AMQPMonitor.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/AMQPMonitor.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/AMQPMonitor.java
new file mode 100644
index 0000000..fbf6e21
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/AMQPMonitor.java
@@ -0,0 +1,263 @@
+/*
+ *
+ * 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.impl.push.amqp;
+
+import com.google.common.eventbus.EventBus;
+import com.google.common.eventbus.Subscribe;
+import com.rabbitmq.client.Channel;
+import com.rabbitmq.client.Connection;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.commons.gfac.type.HostDescription;
+import org.apache.airavata.gfac.monitor.JobIdentity;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.core.PushMonitor;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.monitor.util.AMQPConnectionUtil;
+import org.apache.airavata.gfac.monitor.util.CommonUtils;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.*;
+import java.util.concurrent.BlockingQueue;
+
+/**
+ * This is the implementation for AMQP based finishQueue, this uses
+ * rabbitmq client to recieve AMQP based monitoring data from
+ * mostly excede resources.
+ */
+public class AMQPMonitor extends PushMonitor {
+ private final static Logger logger = LoggerFactory.getLogger(AMQPMonitor.class);
+
+
+ /* this will keep all the channels available in the system, we do not create
+ channels for all the jobs submitted, but we create channels for each user for each
+ host.
+ */
+ private Map<String, Channel> availableChannels;
+
+ private MonitorPublisher publisher;
+
+ private MonitorPublisher localPublisher;
+
+ private BlockingQueue<MonitorID> runningQueue;
+
+ private BlockingQueue<MonitorID> finishQueue;
+
+ private String connectionName;
+
+ private String proxyPath;
+
+ private List<String> amqpHosts;
+
+ private boolean startRegister;
+
+ public AMQPMonitor(){
+
+ }
+ public AMQPMonitor(MonitorPublisher publisher, BlockingQueue<MonitorID> runningQueue,
+ BlockingQueue<MonitorID> finishQueue,
+ String proxyPath,String connectionName,List<String> hosts) {
+ this.publisher = publisher;
+ this.runningQueue = runningQueue; // these will be initialized by the MonitorManager
+ this.finishQueue = finishQueue; // these will be initialized by the MonitorManager
+ this.availableChannels = new HashMap<String, Channel>();
+ this.connectionName = connectionName;
+ this.proxyPath = proxyPath;
+ this.amqpHosts = hosts;
+ this.localPublisher = new MonitorPublisher(new EventBus());
+ this.localPublisher.registerListener(this);
+ }
+
+ public void initialize(String proxyPath, String connectionName, List<String> hosts) {
+ this.availableChannels = new HashMap<String, Channel>();
+ this.connectionName = connectionName;
+ this.proxyPath = proxyPath;
+ this.amqpHosts = hosts;
+ this.localPublisher = new MonitorPublisher(new EventBus());
+ this.localPublisher.registerListener(this);
+ }
+
+ @Override
+ public boolean registerListener(MonitorID monitorID) throws AiravataMonitorException {
+ // we subscribe to read user-host based subscription
+ HostDescription host = monitorID.getHost();
+ String hostAddress = host.getType().getHostAddress();
+ // in amqp case there are no multiple jobs per each host, because once a job is put in to the queue it
+ // will be picked by the Monitor, so jobs will not stay in this queueu but jobs will stay in finishQueue
+ String channelID = CommonUtils.getChannelID(monitorID);
+ if(availableChannels.get(channelID) == null){
+ try {
+ //todo need to fix this rather getting it from a file
+ Connection connection = AMQPConnectionUtil.connect(amqpHosts, connectionName, proxyPath);
+ Channel channel = null;
+ channel = connection.createChannel();
+ availableChannels.put(channelID, channel);
+ String queueName = channel.queueDeclare().getQueue();
+
+ BasicConsumer consumer = new
+ BasicConsumer(new JSONMessageParser(), localPublisher); // here we use local publisher
+ channel.basicConsume(queueName, true, consumer);
+ String filterString = CommonUtils.getRoutingKey(monitorID.getUserName(), hostAddress);
+ // here we queuebind to a particular user in a particular machine
+ channel.queueBind(queueName, "glue2.computing_activity", filterString);
+ logger.info("Using filtering string to monitor: " + filterString);
+ } catch (IOException e) {
+ logger.error("Error creating the connection to finishQueue the job:" + monitorID.getUserName());
+ }
+ }
+ return true;
+ }
+
+ public void run() {
+ // before going to the while true mode we start unregister thread
+ startRegister = true; // this will be unset by someone else
+ while (startRegister || !ServerSettings.isStopAllThreads()) {
+ try {
+ MonitorID take = runningQueue.take();
+ this.registerListener(take);
+ } catch (AiravataMonitorException e) { // catch any exceptino inside the loop
+ e.printStackTrace();
+ } catch (InterruptedException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ } catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+ Set<String> strings = availableChannels.keySet();
+ for(String key:strings) {
+ Channel channel = availableChannels.get(key);
+ try {
+ channel.close();
+ } catch (IOException e) {
+ e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
+ }
+ }
+ }
+
+ @Subscribe
+ public boolean unRegisterListener(MonitorID monitorID) throws AiravataMonitorException {
+ Iterator<MonitorID> iterator = finishQueue.iterator();
+ MonitorID next = null;
+ while(iterator.hasNext()){
+ next = iterator.next();
+ if(next.getJobID().endsWith(monitorID.getJobID())){
+ break;
+ }
+ }
+ if(next == null) {
+ logger.error("Job has removed from the queue, old obsolete message recieved");
+ return false;
+ }
+ String channelID = CommonUtils.getChannelID(next);
+ if (JobState.FAILED.equals(monitorID.getStatus()) || JobState.COMPLETE.equals(monitorID.getStatus())) {
+ finishQueue.remove(next);
+
+ // if this is the last job in the queue at this point with the same username and same host we
+ // close the channel and close the connection and remove it from availableChannels
+ if (CommonUtils.isTheLastJobInQueue(finishQueue, next)) {
+ logger.info("There are no jobs to monitor for common ChannelID:" + channelID + " , so we unsubscribe it" +
+ ", incase new job created we do subscribe again");
+ Channel channel = availableChannels.get(channelID);
+ if (channel == null) {
+ logger.error("Already Unregistered the listener");
+ throw new AiravataMonitorException("Already Unregistered the listener");
+ } else {
+ try {
+ channel.queueUnbind(channel.queueDeclare().getQueue(), "glue2.computing_activity", CommonUtils.getRoutingKey(next));
+ channel.close();
+ channel.getConnection().close();
+ availableChannels.remove(channelID);
+ } catch (IOException e) {
+ logger.error("Error unregistering the listener");
+ throw new AiravataMonitorException("Error unregistering the listener");
+ }
+ }
+ }
+ }
+ next.setStatus(monitorID.getStatus());
+ publisher.publish(new JobStatusChangeRequest(next, new JobIdentity(next.getExperimentID(), next.getWorkflowNodeID(), next.getTaskID(), next.getJobID()),next.getStatus()));
+ return true;
+ }
+ @Override
+ public boolean stopRegister() throws AiravataMonitorException {
+ return false; //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public Map<String, Channel> getAvailableChannels() {
+ return availableChannels;
+ }
+
+ public void setAvailableChannels(Map<String, Channel> availableChannels) {
+ this.availableChannels = availableChannels;
+ }
+
+ public MonitorPublisher getPublisher() {
+ return publisher;
+ }
+
+ public void setPublisher(MonitorPublisher publisher) {
+ this.publisher = publisher;
+ }
+
+ public BlockingQueue<MonitorID> getRunningQueue() {
+ return runningQueue;
+ }
+
+ public void setRunningQueue(BlockingQueue<MonitorID> runningQueue) {
+ this.runningQueue = runningQueue;
+ }
+
+ public BlockingQueue<MonitorID> getFinishQueue() {
+ return finishQueue;
+ }
+
+ public void setFinishQueue(BlockingQueue<MonitorID> finishQueue) {
+ this.finishQueue = finishQueue;
+ }
+
+ public String getProxyPath() {
+ return proxyPath;
+ }
+
+ public void setProxyPath(String proxyPath) {
+ this.proxyPath = proxyPath;
+ }
+
+ public List<String> getAmqpHosts() {
+ return amqpHosts;
+ }
+
+ public void setAmqpHosts(List<String> amqpHosts) {
+ this.amqpHosts = amqpHosts;
+ }
+
+ public boolean isStartRegister() {
+ return startRegister;
+ }
+
+ public void setStartRegister(boolean startRegister) {
+ this.startRegister = startRegister;
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/BasicConsumer.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/BasicConsumer.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/BasicConsumer.java
new file mode 100644
index 0000000..1d60c45
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/BasicConsumer.java
@@ -0,0 +1,86 @@
+/*
+ *
+ * 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.impl.push.amqp;
+
+import com.rabbitmq.client.AMQP;
+import com.rabbitmq.client.Consumer;
+import com.rabbitmq.client.Envelope;
+import com.rabbitmq.client.ShutdownSignalException;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.core.MessageParser;
+import org.apache.airavata.gfac.monitor.event.MonitorPublisher;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class BasicConsumer implements Consumer {
+ private final static Logger logger = LoggerFactory.getLogger(AMQPMonitor.class);
+
+ private MessageParser parser;
+
+ private MonitorPublisher publisher;
+
+ public BasicConsumer(MessageParser parser, MonitorPublisher publisher) {
+ this.parser = parser;
+ this.publisher = publisher;
+ }
+
+ public void handleCancel(String consumerTag) {
+ }
+
+ public void handleCancelOk(String consumerTag) {
+ }
+
+ public void handleConsumeOk(String consumerTag) {
+ }
+
+ public void handleDelivery(String consumerTag,
+ Envelope envelope,
+ AMQP.BasicProperties properties,
+ byte[] body) {
+
+ logger.debug("job update for: " + envelope.getRoutingKey());
+ String message = new String(body);
+ message = message.replaceAll("(?m)^", " ");
+ // Here we parse the message and get the job status and push it
+ // to the Event bus, this will be picked by
+// AiravataJobStatusUpdator and store in to registry
+
+ logger.debug("************************************************************");
+ logger.debug("AMQP Message recieved \n" + message);
+ logger.debug("************************************************************");
+ try {
+ String jobID = envelope.getRoutingKey().split("\\.")[0];
+ MonitorID monitorID = new MonitorID(null, jobID, null, null, null, null);
+ monitorID.setStatus(parser.parseMessage(message));
+ publisher.publish(monitorID);
+ } catch (AiravataMonitorException e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void handleRecoverOk(String consumerTag) {
+ }
+
+ public void handleShutdownSignal(String consumerTag, ShutdownSignalException sig) {
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java
new file mode 100644
index 0000000..72c77d5
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/JSONMessageParser.java
@@ -0,0 +1,78 @@
+/*
+ *
+ * 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.impl.push.amqp;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+import org.apache.airavata.ComputingActivity;
+import org.apache.airavata.gfac.monitor.core.MessageParser;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.List;
+
+public class JSONMessageParser implements MessageParser {
+ private final static Logger logger = LoggerFactory.getLogger(JSONMessageParser.class);
+
+ public JobState parseMessage(String message)throws AiravataMonitorException {
+ /*todo write a json message parser here*/
+ logger.debug(message);
+ ObjectMapper objectMapper = new ObjectMapper();
+ try {
+ ComputingActivity computingActivity = objectMapper.readValue(message.getBytes(), ComputingActivity.class);
+ logger.info(computingActivity.getIDFromEndpoint());
+ List<String> stateList = computingActivity.getState();
+ JobState jobState = null;
+ for (String aState : stateList) {
+ jobState = getStatusFromString(aState);
+ }
+ // we get the last value of the state array
+ return jobState;
+ } catch (IOException e) {
+ throw new AiravataMonitorException(e);
+ }
+ }
+
+private JobState getStatusFromString(String status) {
+ logger.info("parsing the job status returned : " + status);
+ if(status != null){
+ if("ipf:finished".equals(status)){
+ return JobState.COMPLETE;
+ }else if("ipf:pending".equals(status)|| "ipf:starting".equals(status)){
+ return JobState.QUEUED;
+ }else if("ipf:running".equals(status) || "ipf:finishing".equals(status)){
+ return JobState.ACTIVE;
+ }else if ("ipf:held".equals(status) || "ipf:teminating".equals(status) || "ipf:teminated".equals(status)) {
+ return JobState.HELD;
+ } else if ("ipf:suspending".equals(status)) {
+ return JobState.SUSPENDED;
+ }else if ("ipf:failed".equals(status)) {
+ return JobState.FAILED;
+ }else if ("ipf:unknown".equals(status)){
+ return JobState.UNKNOWN;
+ }
+ }
+ return JobState.UNKNOWN;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
new file mode 100644
index 0000000..c6e1378
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/impl/push/amqp/UnRegisterWorker.java
@@ -0,0 +1,68 @@
+/*
+ *
+ * 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.impl.push.amqp;
+
+import com.google.common.eventbus.Subscribe;
+import com.rabbitmq.client.Channel;
+import org.apache.airavata.gfac.monitor.MonitorID;
+import org.apache.airavata.gfac.monitor.exception.AiravataMonitorException;
+import org.apache.airavata.gfac.monitor.state.JobStatusChangeRequest;
+import org.apache.airavata.gfac.monitor.util.CommonUtils;
+import org.apache.airavata.model.workspace.experiment.JobState;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import java.io.IOException;
+import java.util.Map;
+
+public class UnRegisterWorker{
+ private final static Logger logger = LoggerFactory.getLogger(UnRegisterWorker.class);
+ private Map<String, Channel> availableChannels;
+
+ public UnRegisterWorker(Map<String, Channel> channels) {
+ this.availableChannels = channels;
+ }
+
+ @Subscribe
+ private boolean unRegisterListener(JobStatusChangeRequest jobStatus) throws AiravataMonitorException {
+ MonitorID monitorID = jobStatus.getMonitorID();
+ String channelID = CommonUtils.getChannelID(monitorID);
+ if (JobState.FAILED.equals(jobStatus.getState()) || JobState.COMPLETE.equals(jobStatus.getState())){
+ Channel channel = availableChannels.get(channelID);
+ if (channel == null) {
+ logger.error("Already Unregistered the listener");
+ throw new AiravataMonitorException("Already Unregistered the listener");
+ } else {
+ try {
+ channel.queueUnbind(channel.queueDeclare().getQueue(), "glue2.computing_activity", CommonUtils.getRoutingKey(monitorID));
+ channel.close();
+ channel.getConnection().close();
+ availableChannels.remove(channelID);
+ } catch (IOException e) {
+ logger.error("Error unregistering the listener");
+ throw new AiravataMonitorException("Error unregistering the listener");
+ }
+ }
+ }
+ return true;
+ }
+}
+
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/AbstractStateChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/AbstractStateChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/AbstractStateChangeRequest.java
new file mode 100644
index 0000000..10048b0
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/AbstractStateChangeRequest.java
@@ -0,0 +1,27 @@
+/*
+ *
+ * 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.state;
+
+
+public abstract class AbstractStateChangeRequest implements PublisherMessage {
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java
new file mode 100644
index 0000000..eecf88d
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/ExperimentStatusChangeRequest.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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.state;
+
+import org.apache.airavata.gfac.monitor.ExperimentIdentity;
+import org.apache.airavata.model.workspace.experiment.ExperimentState;
+
+/**
+ * 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 ExperimentStatusChangeRequest extends AbstractStateChangeRequest {
+ private ExperimentState state;
+ private ExperimentIdentity identity;
+
+ // this constructor can be used in Qstat monitor to handle errors
+ public ExperimentStatusChangeRequest() {
+ }
+
+ public ExperimentStatusChangeRequest(ExperimentIdentity experimentIdentity, ExperimentState state) {
+ this.state = state;
+ setIdentity(experimentIdentity);
+ }
+
+ public ExperimentState getState() {
+ return state;
+ }
+
+ public void setState(ExperimentState state) {
+ this.state = state;
+ }
+
+ public ExperimentIdentity getIdentity() {
+ return identity;
+ }
+
+ public void setIdentity(ExperimentIdentity identity) {
+ this.identity = identity;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java
new file mode 100644
index 0000000..5ea9eb5
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusChangeRequest.java
@@ -0,0 +1,74 @@
+/*
+ *
+ * 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.state;
+
+import org.apache.airavata.gfac.monitor.JobIdentity;
+import org.apache.airavata.gfac.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, 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/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java
new file mode 100644
index 0000000..9a59b50
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/JobStatusInfo.java
@@ -0,0 +1,48 @@
+/*
+ *
+ * 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.state;
+
+import org.apache.airavata.gsi.ssh.impl.JobStatus;
+
+/**
+ * Based on the job status monitoring we can gather
+ * different informaation about the job, its not simply
+ * the job status, so we need a way to implement
+ * different job statusinfo object to keep job status
+ */
+public interface JobStatusInfo {
+
+ /**
+ * This method can be used to get JobStatusInfo data and
+ * decide the finalJobState
+ *
+ * @param jobState
+ */
+ void setJobStatus(JobStatus jobState);
+
+ /**
+ * After setting the jobState by processing jobinformation
+ * this method can be used to get the JobStatus
+ * @return
+ */
+ JobStatus getJobStatus();
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/PublisherMessage.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/PublisherMessage.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/PublisherMessage.java
new file mode 100644
index 0000000..cbfcb5a
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/PublisherMessage.java
@@ -0,0 +1,26 @@
+/*
+ *
+ * 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.state;
+
+public interface PublisherMessage {
+// public String getType();
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java
new file mode 100644
index 0000000..af20707
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/TaskStatusChangeRequest.java
@@ -0,0 +1,61 @@
+/*
+ *
+ * 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.state;
+
+import org.apache.airavata.gfac.monitor.TaskIdentity;
+import org.apache.airavata.model.workspace.experiment.TaskState;
+
+/**
+ * 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 TaskStatusChangeRequest extends AbstractStateChangeRequest {
+ private TaskState state;
+ private TaskIdentity identity;
+ // this constructor can be used in Qstat monitor to handle errors
+ public TaskStatusChangeRequest() {
+ }
+
+ public TaskStatusChangeRequest(TaskIdentity taskIdentity, TaskState state) {
+ this.state = state;
+ setIdentity(taskIdentity);
+ }
+
+ public TaskState getState() {
+ return state;
+ }
+
+ public void setState(TaskState state) {
+ this.state = state;
+ }
+
+ public TaskIdentity getIdentity() {
+ return identity;
+ }
+
+ public void setIdentity(TaskIdentity identity) {
+ this.identity = identity;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java
new file mode 100644
index 0000000..632f2e3
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/WorkflowNodeStatusChangeRequest.java
@@ -0,0 +1,63 @@
+/*
+ *
+ * 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.state;
+
+import org.apache.airavata.gfac.monitor.WorkflowNodeIdentity;
+import org.apache.airavata.model.workspace.experiment.WorkflowNodeState;
+
+/**
+ * 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 WorkflowNodeStatusChangeRequest extends AbstractStateChangeRequest {
+ private WorkflowNodeState state;
+ private WorkflowNodeIdentity identity;
+
+ // this constructor can be used in Qstat monitor to handle errors
+ public WorkflowNodeStatusChangeRequest() {
+ }
+
+ public WorkflowNodeStatusChangeRequest(WorkflowNodeIdentity identity, WorkflowNodeState state) {
+ this.state = state;
+ setIdentity(identity);
+ }
+
+ public WorkflowNodeState getState() {
+ return state;
+ }
+
+ public void setState(WorkflowNodeState state) {
+ this.state = state;
+ }
+
+ public WorkflowNodeIdentity getIdentity() {
+ return identity;
+ }
+
+ public void setIdentity(WorkflowNodeIdentity identity) {
+ this.identity = identity;
+ }
+
+
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java
new file mode 100644
index 0000000..19b051a
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/AmazonJobStatusInfo.java
@@ -0,0 +1,39 @@
+/*
+ *
+ * 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.state.impl;
+
+import org.apache.airavata.gfac.monitor.state.JobStatusInfo;
+import org.apache.airavata.gsi.ssh.impl.JobStatus;
+
+/**
+ * This can be used to store job status information about
+ * amazon jobs, this data could be very different from
+ * a typical grid job
+ */
+public class AmazonJobStatusInfo implements JobStatusInfo {
+ public void setJobStatus(JobStatus jobState) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public JobStatus getJobStatus() {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java
new file mode 100644
index 0000000..4612c3c
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/state/impl/GridJobStatusInfo.java
@@ -0,0 +1,40 @@
+/*
+ *
+ * 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.state.impl;
+
+import org.apache.airavata.gfac.monitor.state.JobStatusInfo;
+import org.apache.airavata.gsi.ssh.impl.JobStatus;
+
+
+/**
+ * This can be used to keep information about a Grid job
+ * which we can get from qstat polling or from amqp based
+ * monitoring in Grid machines
+ */
+public class GridJobStatusInfo implements JobStatusInfo {
+ public void setJobStatus(JobStatus jobState) {
+ //To change body of implemented methods use File | Settings | File Templates.
+ }
+
+ public JobStatus getJobStatus() {
+ return null; //To change body of implemented methods use File | Settings | File Templates.
+ }
+}
http://git-wip-us.apache.org/repos/asf/airavata/blob/b0230849/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java
new file mode 100644
index 0000000..b69cf52
--- /dev/null
+++ b/modules/gfac/gfac-core/src/main/java/org/apache/airavata/gfac/monitor/util/AMQPConnectionUtil.java
@@ -0,0 +1,77 @@
+/*
+ *
+ * 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.util;
+
+import com.rabbitmq.client.Connection;
+import com.rabbitmq.client.ConnectionFactory;
+import com.rabbitmq.client.DefaultSaslConfig;
+
+import javax.net.ssl.KeyManagerFactory;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.TrustManagerFactory;
+import java.security.KeyStore;
+import java.util.Collections;
+import java.util.List;
+
+public class AMQPConnectionUtil {
+ public static Connection connect(List<String>hosts,String vhost, String proxyFile) {
+ Collections.shuffle(hosts);
+ for (String host : hosts) {
+ Connection connection = connect(host, vhost, proxyFile);
+ if (host != null) {
+ System.out.println("connected to " + host);
+ return connection;
+ }
+ }
+ return null;
+ }
+
+ public static Connection connect(String host, String vhost, String proxyFile) {
+ Connection connection;
+ try {
+ String keyPassPhrase = "test123";
+ KeyStore ks = X509Helper.keyStoreFromPEM(proxyFile, keyPassPhrase);
+ KeyManagerFactory kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(ks, keyPassPhrase.toCharArray());
+
+ KeyStore tks = X509Helper.trustKeyStoreFromCertDir();
+ TrustManagerFactory tmf = TrustManagerFactory.getInstance("SunX509");
+ tmf.init(tks);
+
+ SSLContext c = SSLContext.getInstance("SSLv3");
+ c.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+ ConnectionFactory factory = new ConnectionFactory();
+ factory.setHost(host);
+ factory.setPort(5671);
+ factory.useSslProtocol(c);
+ factory.setVirtualHost(vhost);
+ factory.setSaslConfig(DefaultSaslConfig.EXTERNAL);
+
+ connection = factory.newConnection();
+ } catch (Exception e) {
+ e.printStackTrace();
+ return null;
+ }
+ return connection;
+ }
+
+}