MAPREDUCE-6804. Add timeout when starting JobHistoryServer in MiniMRYarnCluster. Contributed by Andras Bokor
Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/7ef290cf Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/7ef290cf Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/7ef290cf Branch: refs/heads/HADOOP-13345 Commit: 7ef290cfefdb03f89d08b3131dcd8440ecb37498 Parents: d656035 Author: Jason Lowe <jl...@apache.org> Authored: Wed Nov 16 15:23:12 2016 +0000 Committer: Jason Lowe <jl...@apache.org> Committed: Wed Nov 16 15:23:12 2016 +0000 ---------------------------------------------------------------------- .../org/apache/hadoop/mapreduce/v2/MiniMRYarnCluster.java | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hadoop/blob/7ef290cf/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/MiniMRYarnCluster.java ---------------------------------------------------------------------- diff --git a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/MiniMRYarnCluster.java b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/MiniMRYarnCluster.java index 2d3d6ed..06e37dd 100644 --- a/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/MiniMRYarnCluster.java +++ b/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-jobclient/src/test/java/org/apache/hadoop/mapreduce/v2/MiniMRYarnCluster.java @@ -45,6 +45,7 @@ import org.apache.hadoop.mapreduce.v2.util.MRWebAppUtil; import org.apache.hadoop.net.NetUtils; import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.service.Service; +import org.apache.hadoop.test.GenericTestUtils; import org.apache.hadoop.util.JarFinder; import org.apache.hadoop.yarn.conf.YarnConfiguration; import org.apache.hadoop.yarn.exceptions.YarnRuntimeException; @@ -255,11 +256,8 @@ public class MiniMRYarnCluster extends MiniYARNCluster { }; }.start(); - while (!jhsStarted) { - LOG.info("Waiting for HistoryServer to start..."); - Thread.sleep(1500); - } - //TODO Add a timeout. State.STOPPED check ? + GenericTestUtils.waitFor(() -> jhsStarted, 1500, 60_000); + if (historyServer.getServiceState() != STATE.STARTED) { throw new IOException("HistoryServer failed to start"); } --------------------------------------------------------------------- To unsubscribe, e-mail: common-commits-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org