airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From samin...@apache.org
Subject svn commit: r1395805 - /airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
Date Mon, 08 Oct 2012 23:02:13 GMT
Author: samindaw
Date: Mon Oct  8 23:02:12 2012
New Revision: 1395805

URL: http://svn.apache.org/viewvc?rev=1395805&view=rev
Log:
wait for the registry to contain experiment data before returning from the launch function
when launched in thread mode

Modified:
    airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java

Modified: airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
URL: http://svn.apache.org/viewvc/airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java?rev=1395805&r1=1395804&r2=1395805&view=diff
==============================================================================
--- airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
(original)
+++ airavata/trunk/modules/airavata-client/src/main/java/org/apache/airavata/client/AiravataClient.java
Mon Oct  8 23:02:12 2012
@@ -423,9 +423,11 @@ public class AiravataClient implements A
 	}
 	public String runWorkflow(final String topic, final NameValue[] inputs, final String user,
 			final String metadata, final String experimentName, final WorkflowContextHeaderBuilder
builder) throws Exception{
-		return runWorkflow(topic, inputs, user, metadata, experimentName, builder, false);
+		return runWorkflow(topic, inputs, user, metadata, experimentName, builder, true);
 	}
 	
+	private static int TIMEOUT_STEP=1000;
+	private static int MAX_TIMEOUT=60000;
 	public String runWorkflow(final String topic, final NameValue[] inputs, final String user,
 			final String metadata, final String experimentName, final WorkflowContextHeaderBuilder
builder, boolean launchOnThread) throws Exception{
 		if (launchOnThread) {
@@ -434,6 +436,11 @@ public class AiravataClient implements A
 					launchWorkflow(topic, inputs, user, metadata, experimentName, builder);
 				}
 			}).start();
+			int timeout=0;
+			while(!getRegistry().isExperimentExists(topic) && timeout<MAX_TIMEOUT){
+				Thread.sleep(TIMEOUT_STEP);
+				timeout+=MAX_TIMEOUT;
+			}
 		}else{
 			launchWorkflow(topic, inputs, user, metadata, experimentName, builder);
 		}



Mime
View raw message