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:32 UTC
[5/8] merging monitoring with gfac-core, later this will be separated
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);