You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by se...@apache.org on 2015/08/06 18:52:16 UTC

[2/5] flink git commit: [hotfix] Increase timeout for YARN tests to 180 seconds to prevent occasional CI failures.

[hotfix] Increase timeout for YARN tests to 180 seconds to prevent occasional CI failures.


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

Branch: refs/heads/master
Commit: a5b84b2b8284bcdaa649050b5090d79d8b58344c
Parents: 5a788ec
Author: Stephan Ewen <se...@apache.org>
Authored: Thu Aug 6 16:55:32 2015 +0200
Committer: Stephan Ewen <se...@apache.org>
Committed: Thu Aug 6 16:56:36 2015 +0200

----------------------------------------------------------------------
 .../org/apache/flink/yarn/YarnTestBase.java     | 36 ++++++++++++--------
 1 file changed, 21 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/a5b84b2b/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YarnTestBase.java
----------------------------------------------------------------------
diff --git a/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YarnTestBase.java b/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YarnTestBase.java
index 23b8940..2d22700 100644
--- a/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YarnTestBase.java
+++ b/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YarnTestBase.java
@@ -425,13 +425,15 @@ public abstract class YarnTestBase {
 		System.setErr(new PrintStream(errContent));
 
 
-		final int START_TIMEOUT_SECONDS = 60;
-
+		// we wait for at most three minutes
+		final int START_TIMEOUT_SECONDS = 180;
+		final long deadline = System.currentTimeMillis() + (START_TIMEOUT_SECONDS * 1000);
+		
 		Runner runner = new Runner(args, type);
 		runner.start();
 
 		boolean expectedStringSeen = false;
-		for(int second = 0; second <  START_TIMEOUT_SECONDS; second++) {
+		do {
 			sleep(1000);
 			String outContentString = outContent.toString();
 			String errContentString = errContent.toString();
@@ -448,8 +450,7 @@ public abstract class YarnTestBase {
 				}
 			}
 			// check output for correct TaskManager startup.
-			if(outContentString.contains(terminateAfterString)
-					|| errContentString.contains(terminateAfterString) ) {
+			if (outContentString.contains(terminateAfterString) || errContentString.contains(terminateAfterString) ) {
 				expectedStringSeen = true;
 				LOG.info("Found expected output in redirected streams");
 				// send "stop" command to command line interface
@@ -457,23 +458,28 @@ public abstract class YarnTestBase {
 				runner.sendStop();
 				// wait for the thread to stop
 				try {
-					runner.join(10000);
-				} catch (InterruptedException e) {
+					runner.join(30000);
+				}
+				catch (InterruptedException e) {
 					LOG.debug("Interrupted while stopping runner", e);
 				}
 				LOG.warn("RunWithArgs runner stopped.");
-				break;
 			}
-			// check if thread died
-			if(!runner.isAlive()) {
-				sendOutput();
-				if(runner.getReturnValue() != 0) {
-					Assert.fail("Runner thread died before the test was finished. Return value = " + runner.getReturnValue());
-				} else {
-					LOG.info("Runner stopped earlier than expected with return value = 0");
+			else {
+				// check if thread died
+				if (!runner.isAlive()) {
+					sendOutput();
+					if (runner.getReturnValue() != 0) {
+						Assert.fail("Runner thread died before the test was finished. Return value = "
+								+ runner.getReturnValue());
+					} else {
+						LOG.info("Runner stopped earlier than expected with return value = 0");
+					}
 				}
 			}
 		}
+		while (!expectedStringSeen && System.currentTimeMillis() < deadline);
+		
 		sendOutput();
 		Assert.assertTrue("During the timeout period of " + START_TIMEOUT_SECONDS + " seconds the " +
 				"expected string did not show up", expectedStringSeen);