You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by mx...@apache.org on 2015/10/02 11:56:17 UTC

[2/4] flink git commit: [FLINK-2776][cli] print job id when submitting a job

[FLINK-2776][cli] print job id when submitting a job


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

Branch: refs/heads/master
Commit: fc7369e1e1862d2019a737c1ae811ccf6eca3c3e
Parents: 19fd5bd
Author: Maximilian Michels <mx...@apache.org>
Authored: Mon Sep 28 21:12:08 2015 +0200
Committer: Maximilian Michels <mx...@apache.org>
Committed: Fri Oct 2 11:52:02 2015 +0200

----------------------------------------------------------------------
 .../org/apache/flink/client/CliFrontend.java    | 30 +++++++-------------
 .../flink/yarn/YARNSessionFIFOITCase.java       |  9 +++++-
 2 files changed, 18 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/fc7369e1/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
index f0e6c4f..d071cdb 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/CliFrontend.java
@@ -647,20 +647,13 @@ public class CliFrontend {
 			program.deleteExtractedLibraries();
 		}
 
-		if (result != null) {
-			// if the job has been submitted to a detached YARN cluster, there won't be any
-			// exec results, but the object will be set (for the job id)
-			if (yarnCluster != null && yarnCluster.isDetached()) {
+		if (yarnCluster != null && yarnCluster.isDetached()) {
+			yarnCluster.stopAfterJob(result.getJobID());
+			yarnCluster.disconnect();
+		}
 
-				yarnCluster.stopAfterJob(result.getJobID());
-				yarnCluster.disconnect();
-				if (!webFrontend) {
-					System.out.println("The Job has been submitted with JobID " + result.getJobID());
-				}
-				return 0;
-			} else {
-				throw new RuntimeException("Error while starting job. No Job ID set.");
-			}
+		if (!webFrontend) {
+			System.out.println("Job has been submitted with JobID " + result.getJobID());
 		}
 
 		return 0;
@@ -683,17 +676,14 @@ public class CliFrontend {
 
 		LOG.info("Program execution finished");
 
-		if (result != null) {
-			if (!webFrontend) {
-				System.out.println("Job Runtime: " + result.getNetRuntime() + " ms");
-			}
+		if (!webFrontend) {
+			System.out.println("Job with JobID " + result.getJobID() + " has finished.");
+			System.out.println("Job Runtime: " + result.getNetRuntime() + " ms");
 			Map<String, Object> accumulatorsResult = result.getAllAccumulatorResults();
-			if (accumulatorsResult.size() > 0 && !webFrontend) {
+			if (accumulatorsResult.size() > 0) {
 				System.out.println("Accumulator Results: ");
 				System.out.println(AccumulatorHelper.getResultsFormated(accumulatorsResult));
 			}
-		} else {
-			LOG.info("The Job did not return an execution result");
 		}
 
 		return 0;

http://git-wip-us.apache.org/repos/asf/flink/blob/fc7369e1/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YARNSessionFIFOITCase.java
----------------------------------------------------------------------
diff --git a/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YARNSessionFIFOITCase.java b/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YARNSessionFIFOITCase.java
index cd2bdc6..9d72c90 100644
--- a/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YARNSessionFIFOITCase.java
+++ b/flink-yarn-tests/src/main/java/org/apache/flink/yarn/YARNSessionFIFOITCase.java
@@ -487,11 +487,18 @@ public class YARNSessionFIFOITCase extends YarnTestBase {
 						"-ytm", "1024",
 						"-ys", "2", // test requesting slots from YARN.
 						"--yarndetached", job, tmpInFile.getAbsoluteFile().toString() , tmpOutFolder.getAbsoluteFile().toString()},
-				"The Job has been submitted with JobID",
+				"Job has been submitted with JobID",
 				RunTypes.CLI_FRONTEND);
 
 		// it should usually be 2, but on slow machines, the number varies
 		Assert.assertTrue("There should be at most 2 containers running", getRunningContainers() <= 2);
+		// give the runner some time to detach
+		for (int attempt = 0; runner.isAlive() && attempt < 5; attempt++) {
+			try {
+				Thread.sleep(500);
+			} catch (InterruptedException e) {
+			}
+		}
 		Assert.assertFalse("The runner should detach.", runner.isAlive());
 		LOG.info("CLI Frontend has returned, so the job is running");