Repository: airavata Updated Branches: refs/heads/master bad1273b1 -> b7b80180a
Changing the sample to monitor the status- AIRAVATA-1039 Project: http://git-wip-us.apache.org/repos/asf/airavata/repo Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/b7b80180 Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/b7b80180 Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/b7b80180 Branch: refs/heads/master Commit: b7b80180a47e95fae2a01e182e894e38cb4a1bf1 Parents: bad1273 Author: lahiru <[email protected]> Authored: Tue Mar 4 14:45:24 2014 -0500 Committer: lahiru <[email protected]> Committed: Tue Mar 4 14:45:24 2014 -0500 ---------------------------------------------------------------------- .../client/samples/CreateLaunchExperiment.java | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/airavata/blob/b7b80180/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 1773700..c232fa0 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 @@ -64,7 +64,7 @@ public class CreateLaunchExperiment { final String expId = createExperiment(airavata); System.out.println("Experiment ID : " + expId); launchExperiment(airavata, expId); - + System.out.println("Launched successfully"); Thread monitor = (new Thread(){ public void run() { Map<String, JobStatus> jobStatuses = null; @@ -73,7 +73,17 @@ public class CreateLaunchExperiment { jobStatuses = airavata.getJobStatuses(expId); Set<String> strings = jobStatuses.keySet(); for (String key : strings) { - System.out.println("Job ID:" + key + jobStatuses.get(key).getJobState().toString()); + JobStatus jobStatus = jobStatuses.get(key); + if(jobStatus == null){ + return; + }else { + if (JobState.COMPLETE.equals(jobStatus.getJobState())) { + System.out.println("Job completed Job ID: " + key); + return; + }else{ + 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. @@ -81,7 +91,7 @@ public class CreateLaunchExperiment { } } }); -// monitor.start(); + monitor.start(); try { monitor.join(); } catch (InterruptedException e) {
