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 2013/09/04 21:49:04 UTC
svn commit: r1520124 - in /airavata/sandbox/gsissh/src:
main/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApi.java
test/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApiTest.java
Author: lahiru
Date: Wed Sep 4 19:49:04 2013
New Revision: 1520124
URL: http://svn.apache.org/r1520124
Log:
fixing test failure.
Modified:
airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApi.java
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/impl/DefaultSSHApi.java
URL: http://svn.apache.org/viewvc/airavata/sandbox/gsissh/src/main/java/org/apache/airavata/gsi/ssh/impl/DefaultSSHApi.java?rev=1520124&r1=1520123&r2=1520124&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:49:04 2013
@@ -214,9 +214,7 @@ public class DefaultSSHApi implements SS
Source text = new StreamSource(new ByteArrayInputStream(jobDescriptor.toXML().getBytes()));
transformer.transform(text, new StreamResult(results));
- System.out.println("***********************************");
- System.out.println(results.toString());
- System.out.println("***********************************");
+ log.info("generated PBS:" + results.toString());
// creating a temporary file using pbs script generated above
int number = new SecureRandom().nextInt();
@@ -228,7 +226,7 @@ public class DefaultSSHApi implements SS
//reusing submitAsyncJobWithPBS method to submit a job
String jobID = this.submitAsyncJobWithPBS(serverInfo, authenticationInfo, tempPBSFile.getAbsolutePath(), jobDescriptor);
- return jobID.replace("\n","");
+ return jobID.replace("\n", "");
} catch (TransformerConfigurationException e) {
throw new SSHApiException("Error parsing PBS transformation", e);
} catch (TransformerException e) {
@@ -332,9 +330,9 @@ public class DefaultSSHApi implements SS
}
if (line.length >= 2) {
header = line[0].trim();
- // System.out.println("Header = " + header);
+ log.info("Header = " + header);
value = line[1].trim();
-// System.out.println("value = " + value);
+ log.info("value = " + value);
if (header.equals("Variable_List")) {
while (info[i + 1].startsWith("\t")) {
@@ -342,40 +340,39 @@ public class DefaultSSHApi implements SS
i++;
}
value = value.replaceAll("\t", "");
-// jobDescriptor.VariablesList=value;
-// jobDescriptor.analyzeVariableList(value);
- } else if ("Job Id".equals(header)){
+ jobDescriptor.setVariableList(value);
+ } 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 ("Account_Name".equals(header)){
+ } else if ("Account_Name".equals(header)) {
jobDescriptor.setAcountString(value);
- }else if ("job_state".equals(header)){
+ } else if ("job_state".equals(header)) {
jobDescriptor.setStatus(value);
- }else if ("Job_Owner".equals(header)) {
- jobDescriptor.setOwner(value);
+ } else if ("Job_Owner".equals(header)) {
+ jobDescriptor.setOwner(value);
} else if ("resources_used.cput".equals(header)) {
- jobDescriptor.setUsedCPUTime(value);
+ jobDescriptor.setUsedCPUTime(value);
} else if ("resources_used.mem".equals(header)) {
- jobDescriptor.setUsedMemory(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.setCompTime(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);
@@ -401,10 +398,8 @@ public class DefaultSSHApi implements SS
break;
}
value = value.replaceAll("\t", "");
-// jobDescriptor.setSubmitArgs (value);
+ jobDescriptor.setSubmitArgs(value);
}
-
-
}
}
return jobDescriptor;
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=1520124&r1=1520123&r2=1520124&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:49:04 2013
@@ -49,9 +49,9 @@ public class DefaultSSHApiTest {
@BeforeTest
public void setUp() throws Exception {
- System.setProperty("myproxy.user", "ogce");
- System.setProperty("myproxy.password", "Jdas7wph");
- System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
+// System.setProperty("myproxy.user", "ogce");
+// System.setProperty("myproxy.password", "");
+// System.setProperty("basedir", "/Users/lahirugunathilake/work/airavata/sandbox/gsissh");
myProxyUserName = System.getProperty("myproxy.user");
myProxyPassword = System.getProperty("myproxy.password");
@@ -210,52 +210,23 @@ public class DefaultSSHApiTest {
@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 {
// Create authentication