airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject svn commit: r1520111 - in /airavata/sandbox/gsissh/src: main/java/org/apache/airavata/gsi/ssh/api/job/ main/java/org/apache/airavata/gsi/ssh/impl/ main/resources/schemas/ test/java/org/apache/airavata/gsi/ssh/impl/
Date Wed, 04 Sep 2013 19:12:12 GMT
Author: lahiru
Date: Wed Sep  4 19:12:12 2013
New Revision: 1520111

URL: http://svn.apache.org/r1520111
Log:
adding more parameters to jobDescriptor.

Modified:
    airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/JobDescriptor.java
    airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApi.java
    airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java
    airavata/sandbox/gsissh/src/main/resources/schemas/PBSJobDescriptor.xsd
    airavata/sandbox/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTest.java

Modified: airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/JobDescriptor.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/JobDescriptor.java?rev=1520111&r1=1520110&r2=1520111&view=diff
==============================================================================
--- airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/JobDescriptor.java
(original)
+++ airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/api/job/JobDescriptor.java
Wed Sep  4 19:12:12 2013
@@ -20,17 +20,10 @@
 */
 package org.apache.airavata.gsi.ssh.api.job;
 
-import org.apache.airavata.gsi.ssh.api.CommandInfo;
 import org.apache.airavata.gsi.ssh.api.CommandOutput;
-import org.apache.airavata.gsi.ssh.x2012.x12.InputList;
-import org.apache.airavata.gsi.ssh.x2012.x12.JobDescriptorDocument;
-import org.apache.airavata.gsi.ssh.x2012.x12.PbsParams;
-import org.apache.airavata.gsi.ssh.x2012.x12.impl.PbsParamsImpl;
+import org.apache.airavata.gsi.ssh.x2012.x12.*;
 import org.apache.xmlbeans.XmlException;
 
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.List;
 
 /**
@@ -128,7 +121,7 @@ public class JobDescriptor {
         this.getJobDescriptorDocument().getJobDescriptor().setAcountString(name);
     }
 
-    public void setInputValues(List<String> inputValue){
+    public void setInputValues(List<String> inputValue) {
         InputList inputList = this.getJobDescriptorDocument().getJobDescriptor().addNewInputs();
         inputList.setInputArray(inputValue.toArray(new String[inputValue.size()]));
     }
@@ -140,12 +133,151 @@ public class JobDescriptor {
     public void setQueueName(String queueName) {
         this.getJobDescriptorDocument().getJobDescriptor().setQueueName(queueName);
     }
-     public void setStatus(String queueName) {
+
+    public void setStatus(String queueName) {
         this.getJobDescriptorDocument().getJobDescriptor().setStatus(queueName);
     }
 
+    public void setAfterAnyList(String[] afterAnyList) {
+        AfterAnyList afterAny = this.getJobDescriptorDocument().getJobDescriptor().addNewAfterAny();
+        afterAny.setAfterAnyArray(afterAnyList);
+    }
+
+    public void setAfterOKList(String[] afterOKList) {
+        AfterOKList afterAnyList = this.getJobDescriptorDocument().getJobDescriptor().addNewAfterOKList();
+        afterAnyList.setAfterOKListArray(afterOKList);
+    }
+    public void setCTime(String cTime) {
+        this.getJobDescriptorDocument().getJobDescriptor().setCTime(cTime);
+    }
+    public void setQTime(String qTime) {
+        this.getJobDescriptorDocument().getJobDescriptor().setQTime(qTime);
+    }
+    public void setMTime(String mTime) {
+        this.getJobDescriptorDocument().getJobDescriptor().setMTime(mTime);
+    }
+    public void setSTime(String sTime) {
+        this.getJobDescriptorDocument().getJobDescriptor().setSTime(sTime);
+    }
+    public void setCompTime(String compTime) {
+        this.getJobDescriptorDocument().getJobDescriptor().setCompTime(compTime);
+    }
+    public void setOwner(String owner) {
+        this.getJobDescriptorDocument().getJobDescriptor().setOwner(owner);
+    }
+    public void setExecuteNode(String executeNode) {
+        this.getJobDescriptorDocument().getJobDescriptor().setExecuteNode(executeNode);
+    }
+    public void setEllapsedTime(String ellapsedTime) {
+        this.getJobDescriptorDocument().getJobDescriptor().setEllapsedTime(ellapsedTime);
+    }
+
+    public void setUsedCPUTime(String usedCPUTime) {
+        this.getJobDescriptorDocument().getJobDescriptor().setUsedCPUTime(usedCPUTime);
+    }
+    public void setUsedMemory(String usedMemory) {
+        this.getJobDescriptorDocument().getJobDescriptor().setUsedMem(usedMemory);
+    }
+    public void setVariableList(String variableList) {
+        this.getJobDescriptorDocument().getJobDescriptor().setVariableList(variableList);
+    }
+    public void setSubmitArgs(String submitArgs) {
+        this.getJobDescriptorDocument().getJobDescriptor().setSubmitArgs(submitArgs);
+    }
+
+
 
-  public void getShellName() {
+    public String getExecutablePath() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getExecutablePath();
+    }
+
+    public boolean getAllEnvExport() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getAllEnvExport();
+    }
+
+    public String getMailOptions() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getMailOptions();
+    }
+
+    public String getStandardOutFile() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getStandardOutFile();
+    }
+
+    public String getStandardErrorFile() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getStandardErrorFile();
+    }
+
+    public int getNodes(int name) {
+        return this.getJobDescriptorDocument().getJobDescriptor().getNodes();
+    }
+
+    public int getProcessesPerNode() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getProcessesPerNode();
+    }
+
+    public String getMaxWallTime() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getMaxWallTime();
+    }
+
+    public String getAcountString() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getAcountString();
+    }
+
+    public String[] getInputValues() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getInputs().getInputArray();
+    }
+
+    public String getJobID() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getJobID();
+    }
+
+    public String getQueueName() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getQueueName();
+    }
+
+    public String getStatus() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getStatus();
+    }
+
+    public String[] getAfterAnyList() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getAfterAny().getAfterAnyArray();
+    }
+
+    public String[] getAfterOKList() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getAfterOKList().getAfterOKListArray();
+    }
+    public String getCTime() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getCTime();
+    }
+    public String getQTime() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getQTime();
+    }
+    public String getMTime() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getMTime();
+    }
+    public String getSTime() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getSTime();
+    }
+    public String getCompTime() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getCompTime();
+    }
+    public String getOwner() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getOwner();
+    }
+    public String getExecuteNode() {
+         return this.getJobDescriptorDocument().getJobDescriptor().getExecuteNode();
+    }
+    public String getEllapsedTime() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getEllapsedTime();
+    }
+
+    public String getUsedCPUTime() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getUsedCPUTime();
+    }
+    public String getUsedMemory() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getUsedMem();
+    }
+    public void getShellName() {
         this.getJobDescriptorDocument().getJobDescriptor().getShellName();
     }
 
@@ -153,9 +285,18 @@ public class JobDescriptor {
         return this.getJobDescriptorDocument().getJobDescriptor().getJobName();
     }
 
-    public String getJobId(){
+    public String getJobId() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getJobID();
+    }
+
+
+    public String getVariableList() {
+        return this.getJobDescriptorDocument().getJobDescriptor().getJobID();
+    }
+    public String getSubmitArgs() {
         return this.getJobDescriptorDocument().getJobDescriptor().getJobID();
     }
 
+
 }
 

Modified: airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApi.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApi.java?rev=1520111&r1=1520110&r2=1520111&view=diff
==============================================================================
--- airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApi.java
(original)
+++ airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApi.java
Wed Sep  4 19:12:12 2013
@@ -248,6 +248,9 @@ public class DefaultSSHApi implements SS
 
         StandardOutReader stdOutReader = new StandardOutReader();
         this.executeCommand(rawCommandInfo, serverInfo, authenticationInfo, stdOutReader);
+        if (!stdOutReader.getErrorifAvailable().equals("")) {
+            throw new SSHApiException(stdOutReader.getStandardError().toString());
+        }
         String result = stdOutReader.getStdOutput();
         String[] Nodes = result.split("\n");
         String[] line;
@@ -312,6 +315,9 @@ public class DefaultSSHApi implements SS
 
         StandardOutReader stdOutReader = new StandardOutReader();
         this.executeCommand(rawCommandInfo, serverInfo, authenticationInfo, stdOutReader);
+        if (!stdOutReader.getErrorifAvailable().equals("")) {
+            throw new SSHApiException(stdOutReader.getStandardError().toString());
+        }
         String result = stdOutReader.getStdOutput();
         String[] info = result.split("\n");
         JobDescriptor jobDescriptor = new JobDescriptor();
@@ -338,36 +344,38 @@ public class DefaultSSHApi implements SS
                     value = value.replaceAll("\t", "");
 //                        jobDescriptor.VariablesList=value;
 //                        jobDescriptor.analyzeVariableList(value);
-                } else if ("Job Id".equals(header))
+                } else if ("Job Id".equals(header)){
                     jobDescriptor.setJobID(value);
-                else if ("Job_Name".equals(header))
+                }else if ("Job_Name".equals(header)){
                     jobDescriptor.setJobName(value);
-
-                else if ("Job_Owner".equals(header)) {
-//                       jobDescriptor.setOwner(value);
+                }else if ("Account_Name".equals(header)){
+                    jobDescriptor.setAcountString(value);
+                }else if ("job_state".equals(header)){
+                    jobDescriptor.setStatus(value);
+                }else if ("Job_Owner".equals(header)) {
+                       jobDescriptor.setOwner(value);
                 } else if ("resources_used.cput".equals(header)) {
-//                       jobDescriptor.setUsedcput(value);
+                       jobDescriptor.setUsedCPUTime(value);
                 } else if ("resources_used.mem".equals(header)) {
-//                       jobDescriptor.setUsedMem(value);
+                       jobDescriptor.setUsedMemory(value);
                 } else if ("resources_used.walltime".equals(header)) {
-//                       jobDescriptor.setEllapsedTime(value);
-                } else if ("job_state".equals(header))
+                       jobDescriptor.setEllapsedTime(value);
+                } else if ("job_state".equals(header)){
                     jobDescriptor.setStatus(value);
-
-                else if ("queue".equals(header))
+                }else if ("queue".equals(header))
                     jobDescriptor.setQueueName(value);
                 else if ("ctime".equals(header)) {
-//                       jobDescriptor.setCtime(value);
+                       jobDescriptor.setCTime(value);
                 } else if ("qtime".equals(header)) {
-//                       jobDescriptor.setQtime(value);
+                       jobDescriptor.setQTime(value);
                 } else if ("mtime".equals(header)) {
-//                       jobDescriptor.setMtime(value);
+                       jobDescriptor.setMTime(value);
                 } else if ("start_time".equals(header)) {
-//                        jobDescriptor.setStime(value);
+                        jobDescriptor.setSTime(value);
                 } else if ("comp_time".equals(header)) {
-//                            jobDescriptor.setComp_time(value);
+                            jobDescriptor.setCompTime(value);
                 } else if ("exec_host".equals(header)) {
-//                       jobDescriptor.setExecuteNode(value);
+                       jobDescriptor.setExecuteNode(value);
                 } else if ("Output_Path".equals(header)) {
                     if (info[i + 1].contains("=") || info[i + 1].contains(":"))
                         jobDescriptor.setStandardOutFile(value);

Modified: airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java?rev=1520111&r1=1520110&r2=1520111&view=diff
==============================================================================
--- airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java
(original)
+++ airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/StandardOutReader.java
Wed Sep  4 19:12:12 2013
@@ -49,7 +49,6 @@ public class StandardOutReader implement
                     break;
                 }
                 try {
-                    Thread.sleep(1000);
                 } catch (Exception ignored) {
                 }
             }

Modified: airavata/sandbox/gsissh/src/main/resources/schemas/PBSJobDescriptor.xsd
URL: http://svn.apache.org/viewvc/airavata/sandbox/gsissh/src/main/resources/schemas/PBSJobDescriptor.xsd?rev=1520111&r1=1520110&r2=1520111&view=diff
==============================================================================
--- airavata/sandbox/gsissh/src/main/resources/schemas/PBSJobDescriptor.xsd (original)
+++ airavata/sandbox/gsissh/src/main/resources/schemas/PBSJobDescriptor.xsd Wed Sep  4 19:12:12
2013
@@ -33,6 +33,20 @@
             <element name="inputs" type="gsissh:inputList" minOccurs="1" maxOccurs="1"/>
             <element name="exports" type="gsissh:exportProperties" minOccurs="1" maxOccurs="1"/>
             <element name="status" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="afterAny" type="gsissh:afterAnyList" minOccurs="0" maxOccurs="1"/>
+            <element name="afterOKList" type="gsissh:afterOKList" minOccurs="0" maxOccurs="1"/>
+            <element name="cTime" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="qTime" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="mTime" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="sTime" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="compTime" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="owner" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="executeNode" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="ellapsedTime" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="usedCPUTime" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="usedMem" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="submitArgs" type="xsd:string" minOccurs="0" maxOccurs="1"/>
+            <element name="variableList" type="xsd:string" minOccurs="0" maxOccurs="1"/>
 		</sequence>
 	</complexType>
     <complexType name="inputList">
@@ -40,6 +54,18 @@
 			<element name="input" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
 		</sequence>
     </complexType>
+    <complexType name="afterAnyList">
+        <sequence>
+			<element name="afterAny" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
+		</sequence>
+    </complexType>
+
+    <complexType name="afterOKList">
+        <sequence>
+			<element name="afterOKList" type="xsd:string" minOccurs="0" maxOccurs="unbounded" />
+		</sequence>
+    </complexType>
+
     <complexType name="exportProperties">
 		<sequence>
 

Modified: airavata/sandbox/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTest.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTest.java?rev=1520111&r1=1520110&r2=1520111&view=diff
==============================================================================
--- airavata/sandbox/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTest.java
(original)
+++ airavata/sandbox/gsissh/src/test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTest.java
Wed Sep  4 19:12:12 2013
@@ -23,16 +23,11 @@ package org.apache.airavata.gsi.ssh.impl
 
 import org.apache.airavata.gsi.ssh.api.*;
 import org.apache.airavata.gsi.ssh.api.job.JobDescriptor;
-import org.apache.airavata.gsi.ssh.x2012.x12.ExportProperties;
-import org.apache.airavata.gsi.ssh.x2012.x12.InputList;
-import org.apache.commons.io.FilenameUtils;
 import org.testng.AssertJUnit;
 import org.testng.annotations.BeforeTest;
 import org.testng.annotations.Test;
 
 import java.io.File;
-import java.net.URI;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.List;
 import java.util.Random;
@@ -54,9 +49,9 @@ public class DefaultSSHApiTest {
 
     @BeforeTest
     public void setUp() throws Exception {
-//        System.setProperty("myproxy.user", "ogce");
-//        System.setProperty("myproxy.password", "");
-//        System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
+        System.setProperty("myproxy.user", "ogce");
+        System.setProperty("myproxy.password", "Jdas7wph");
+        System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
         myProxyUserName = System.getProperty("myproxy.user");
         myProxyPassword = System.getProperty("myproxy.password");
 
@@ -194,25 +189,72 @@ public class DefaultSSHApiTest {
 
 //        Cluster cluster = sshApi.getCluster(serverInfo, authenticationInfo);
         JobDescriptor jobById = sshApi.getJobById(serverInfo, authenticationInfo, jobID);
-        AssertJUnit.assertEquals(jobById.getJobId(),jobID);
+        AssertJUnit.assertEquals(jobById.getJobId(), jobID);
+        System.out.println(jobById.getAcountString());
+        System.out.println(jobById.getAllEnvExport());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getExecutablePath());
+        System.out.println(jobById.getEllapsedTime());
+        System.out.println(jobById.getQueueName());
+        System.out.println(jobById.getExecuteNode());
+        System.out.println(jobById.getJobName());
+        System.out.println(jobById.getCTime());
+        System.out.println(jobById.getSTime());
+        System.out.println(jobById.getMTime());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getOwner());
+        System.out.println(jobById.getQTime());
+        System.out.println(jobById.getUsedCPUTime());
+        System.out.println(jobById.getUsedMemory());
     }
 
     @Test
     public void testGetCluster()throws Exception{
-//        AuthenticationInfo authenticationInfo
-//                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
-//                7512, 17280000);
-//        // Server info
-//        ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
-//        // Get the API
-//        SSHApi sshApi = SSHApiFactory.createSSHApi(this.certificateLocation);
-//        Cluster cluster = sshApi.getCluster(serverInfo, authenticationInfo);
-//        System.out.println(cluster.getNodes()[0].getName());
-//        System.out.println(cluster.getNodes()[0].getNp());
-//        System.out.println(cluster.getNodes()[0].getState());
-//        System.out.println(cluster.getNodes()[0].getCores()[0].getId());
-//        System.out.println(cluster.getNodes()[0].getName());
+        AuthenticationInfo authenticationInfo
+                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+                7512, 17280000);
+        // Server info
+        ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
+        // Get the API
+        SSHApi sshApi = SSHApiFactory.createSSHApi(this.certificateLocation);
+        Cluster cluster = sshApi.getCluster(serverInfo, authenticationInfo);
+        System.out.println(cluster.getNodes()[0].getName());
+        System.out.println(cluster.getNodes()[0].getNp());
+        System.out.println(cluster.getNodes()[0].getState());
+        System.out.println(cluster.getNodes()[0].getCores()[0].getId());
+        System.out.println(cluster.getNodes()[0].getName());
+
+    }
+
+    @Test
+    public void testGetJob() throws Exception {
+        String jobID = "1584665";
+        AuthenticationInfo authenticationInfo
+                = new MyProxyAuthenticationInfo(myProxyUserName, myProxyPassword, "myproxy.teragrid.org",
+                7512, 17280000);
 
+        // Server info
+        ServerInfo serverInfo = new ServerInfo("ogce", "trestles.sdsc.edu");
+
+
+        // Get the API
+        SSHApi sshApi = SSHApiFactory.createSSHApi(this.certificateLocation);
+        JobDescriptor jobById = sshApi.getJobById(serverInfo, authenticationInfo, jobID);
+        System.out.println(jobById.getAcountString());
+        System.out.println(jobById.getAllEnvExport());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getExecutablePath());
+        System.out.println(jobById.getEllapsedTime());
+        System.out.println(jobById.getQueueName());
+        System.out.println(jobById.getJobName());
+        System.out.println(jobById.getCTime());
+        System.out.println(jobById.getSTime());
+        System.out.println(jobById.getMTime());
+        System.out.println(jobById.getCompTime());
+        System.out.println(jobById.getOwner());
+        System.out.println(jobById.getQTime());
+        System.out.println(jobById.getUsedCPUTime());
+        System.out.println(jobById.getUsedMemory());
     }
     @Test
     public void testsubmitAsyncJobWithFailure() throws Exception {



Mime
View raw message