airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lah...@apache.org
Subject git commit: Providing monitoring to the sample CreateLaunchExperiment.java - AIRAVATA-1028
Date Tue, 04 Mar 2014 15:17:18 GMT
Repository: airavata
Updated Branches:
  refs/heads/master c897d30b3 -> adc3cc532


Providing monitoring to the sample CreateLaunchExperiment.java - AIRAVATA-1028


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/adc3cc53
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/adc3cc53
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/adc3cc53

Branch: refs/heads/master
Commit: adc3cc53203c84c90a401d050b54424a090d1483
Parents: c897d30
Author: lahiru <lahiru@apache.org>
Authored: Tue Mar 4 10:17:08 2014 -0500
Committer: lahiru <lahiru@apache.org>
Committed: Tue Mar 4 10:17:08 2014 -0500

----------------------------------------------------------------------
 .../client/samples/CreateLaunchExperiment.java  | 35 ++++++++++++++++----
 1 file changed, 29 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/adc3cc53/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
----------------------------------------------------------------------
diff --git a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
index 8abe3b2..fd90bf6 100644
--- a/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
+++ b/airavata-api/airavata-client-sdks/java-client-samples/src/main/java/org/apache/airavata/client/samples/CreateLaunchExperiment.java
@@ -24,6 +24,7 @@ package org.apache.airavata.client.samples;
 import org.apache.airavata.api.error.ExperimentNotFoundException;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.common.utils.ClientSettings;
+import org.apache.airavata.model.workspace.experiment.*;
 import org.apache.airavata.schemas.gfac.DataType;
 import org.apache.airavata.api.Airavata;
 import org.apache.airavata.api.client.AiravataClientFactory;
@@ -36,16 +37,14 @@ import org.apache.airavata.client.api.exception.AiravataAPIInvocationException;
 import org.apache.airavata.client.tools.DocumentCreator;
 import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.model.util.ExperimentModelUtil;
-import org.apache.airavata.model.workspace.experiment.ComputationalResourceScheduling;
-import org.apache.airavata.model.workspace.experiment.DataObjectType;
-import org.apache.airavata.model.workspace.experiment.UserConfigurationData;
 import org.apache.thrift.TException;
-import org.apache.airavata.model.workspace.experiment.Experiment;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 
 public class CreateLaunchExperiment {
 
@@ -59,12 +58,36 @@ public class CreateLaunchExperiment {
     public static void main(String[] args) {
         try {
             AiravataUtils.setExecutionAsClient();
-            Airavata.Client airavata = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST,
THRIFT_SERVER_PORT);
+            final Airavata.Client airavata = AiravataClientFactory.createAiravataClient(THRIFT_SERVER_HOST,
THRIFT_SERVER_PORT);
             System.out.println("API version is " + airavata.GetAPIVersion());
             addDescriptors();
-            String expId = createExperiment(airavata);
+            final String expId = createExperiment(airavata);
             System.out.println("Experiment ID : " + expId);
             launchExperiment(airavata, expId);
+
+            Thread monitor = (new Thread(){
+                 public void run() {
+                     Map<String, JobStatus> jobStatuses = null;
+                     while (true) {
+                         try {
+                             jobStatuses = airavata.getJobStatuses(expId);
+                             Set<String> strings = jobStatuses.keySet();
+                             for (String key : strings) {
+                                 System.out.println("Job ID:" + key + jobStatuses.get(key).getJobState().toString());
+                             }
+                         } catch (Exception e) {
+                             e.printStackTrace();  //To change body of catch statement use
File | Settings | File Templates.
+                         }
+                     }
+                 }
+            });
+            monitor.start();
+            try {
+                monitor.join();
+            } catch (InterruptedException e) {
+                e.printStackTrace();  //To change body of catch statement use File | Settings
| File Templates.
+            }
+
 //            Experiment experiment = airavata.getExperiment(expId);
 //            System.out.println("retrieved exp id : " + experiment.getExperimentID());
         } catch (TException e) {


Mime
View raw message