flink-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From se...@apache.org
Subject [3/4] flink git commit: [runtime] Extend environment logging on startup
Date Mon, 02 Mar 2015 18:43:56 GMT
[runtime] Extend environment logging on startup


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

Branch: refs/heads/master
Commit: caa29417d5bf6b234af06d7ccf31acb1d8e32fd9
Parents: 861ebe7
Author: Stephan Ewen <sewen@apache.org>
Authored: Fri Feb 27 13:44:28 2015 +0100
Committer: Stephan Ewen <sewen@apache.org>
Committed: Mon Mar 2 18:36:47 2015 +0100

----------------------------------------------------------------------
 .../org/apache/flink/client/WebFrontend.java    |  2 +-
 .../runtime/util/EnvironmentInformation.java    | 20 +++++++++++++++-----
 .../flink/runtime/jobmanager/JobManager.scala   |  8 +++++---
 .../flink/runtime/taskmanager/TaskManager.scala |  2 +-
 .../util/EnvironmentInformationTest.java        | 15 +++++++++++++++
 .../yarn/appMaster/YarnTaskManagerRunner.java   |  2 +-
 6 files changed, 38 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/caa29417/flink-clients/src/main/java/org/apache/flink/client/WebFrontend.java
----------------------------------------------------------------------
diff --git a/flink-clients/src/main/java/org/apache/flink/client/WebFrontend.java b/flink-clients/src/main/java/org/apache/flink/client/WebFrontend.java
index 45f4391..9587ab2 100644
--- a/flink-clients/src/main/java/org/apache/flink/client/WebFrontend.java
+++ b/flink-clients/src/main/java/org/apache/flink/client/WebFrontend.java
@@ -43,7 +43,7 @@ public class WebFrontend {
 	 */
 	public static void main(String[] args) {
 
-		EnvironmentInformation.logEnvironmentInfo(LOG, "Web Client");
+		EnvironmentInformation.logEnvironmentInfo(LOG, "Web Client", args);
 		EnvironmentInformation.checkJavaVersion();
 
 		// check the arguments

http://git-wip-us.apache.org/repos/asf/flink/blob/caa29417/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
b/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
index 1fb6422..793e158 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/util/EnvironmentInformation.java
@@ -208,7 +208,7 @@ public class EnvironmentInformation {
 	 * @param log The logger to log the information to.
 	 * @param componentName The component name to mention in the log.
 	 */
-	public static void logEnvironmentInfo(Logger log, String componentName) {
+	public static void logEnvironmentInfo(Logger log, String componentName, String[] commandLineArgs)
{
 		if (log.isInfoEnabled()) {
 			RevisionInformation rev = getRevisionInformation();
 			String version = getVersion();
@@ -227,19 +227,29 @@ public class EnvironmentInformation {
 					+ "Rev:" + rev.commitId + ", " + "Date:" + rev.commitDate + ")");
 			log.info(" Current user: " + user);
 			log.info(" JVM: " + jvmVersion);
+			log.info(" Maximum heap size: " + maxHeapMegabytes + " MiBytes");
+			log.info(" JAVA_HOME: " + (javaHome == null ? "(not set)" : javaHome));
 
 			if (options.length == 0) {
-				log.info(" Startup Options: (none)");
+				log.info(" JVM Options: (none)");
 			}
 			else {
-				log.info(" Startup Options:");
+				log.info(" JVM Options:");
 				for (String s: options) {
 					log.info("    " + s);
 				}
 			}
 
-			log.info(" Maximum heap size: " + maxHeapMegabytes + " MiBytes");
-			log.info(" JAVA_HOME: " + (javaHome == null ? "not set" : javaHome));
+			if (commandLineArgs == null || commandLineArgs.length == 0) {
+				log.info(" Program Arguments: (none)");
+			}
+			else {
+				log.info(" Program Arguments:");
+				for (String s: commandLineArgs) {
+					log.info("    " + s);
+				}
+			}
+
 			log.info("--------------------------------------------------------------------------------");
 		}
 	}

http://git-wip-us.apache.org/repos/asf/flink/blob/caa29417/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
b/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
index 85ebdce..7238e3d 100644
--- a/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
+++ b/flink-runtime/src/main/scala/org/apache/flink/runtime/jobmanager/JobManager.scala
@@ -608,7 +608,7 @@ object JobManager {
   def main(args: Array[String]): Unit = {
 
     // startup checks and logging
-    EnvironmentInformation.logEnvironmentInfo(LOG, "JobManager")
+    EnvironmentInformation.logEnvironmentInfo(LOG, "JobManager", args)
     EnvironmentInformation.checkJavaVersion()
 
     // parsing the command line arguments
@@ -759,10 +759,12 @@ object JobManager {
       opt[String]("configDir") action { (arg, c) => c.copy(configDir = arg) } text (
         "The configuration directory.")
       opt[String]("executionMode") optional() action { (arg, c) =>
-        if(arg.equals("local")){
+        if (arg.equalsIgnoreCase("local")){
           c.copy(executionMode = LOCAL)
-        }else{
+        } else if (arg.equalsIgnoreCase("cluster")) {
           c.copy(executionMode = CLUSTER)
+        } else {
+          throw new Exception("Unknown execution mode: " + arg)
         }
       } text {
         "The execution mode of the JobManager (CLUSTER / LOCAL)"

http://git-wip-us.apache.org/repos/asf/flink/blob/caa29417/flink-runtime/src/main/scala/org/apache/flink/runtime/taskmanager/TaskManager.scala
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/scala/org/apache/flink/runtime/taskmanager/TaskManager.scala
b/flink-runtime/src/main/scala/org/apache/flink/runtime/taskmanager/TaskManager.scala
index 182f8cf..3d47258 100644
--- a/flink-runtime/src/main/scala/org/apache/flink/runtime/taskmanager/TaskManager.scala
+++ b/flink-runtime/src/main/scala/org/apache/flink/runtime/taskmanager/TaskManager.scala
@@ -743,7 +743,7 @@ object TaskManager {
    */
   def main(args: Array[String]): Unit = {
     // startup checks and logging
-    EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager")
+    EnvironmentInformation.logEnvironmentInfo(LOG, "TaskManager", args)
     EnvironmentInformation.checkJavaVersion()
 
     // try to parse the command line arguments

http://git-wip-us.apache.org/repos/asf/flink/blob/caa29417/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java
b/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java
index 64a676c..8da7b14 100644
--- a/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java
+++ b/flink-runtime/src/test/java/org/apache/flink/runtime/util/EnvironmentInformationTest.java
@@ -21,6 +21,8 @@ package org.apache.flink.runtime.util;
 import static org.junit.Assert.*;
 
 import org.junit.Test;
+import org.mockito.Mockito;
+import org.slf4j.Logger;
 
 public class EnvironmentInformationTest {
 
@@ -58,4 +60,17 @@ public class EnvironmentInformationTest {
 			fail(e.getMessage());
 		}
 	}
+
+	@Test
+	public void testLogEnvironmentInformation() {
+		try {
+			Logger mockLogger = Mockito.mock(Logger.class);
+			EnvironmentInformation.logEnvironmentInfo(mockLogger, "test", new String[0]);
+			EnvironmentInformation.logEnvironmentInfo(mockLogger, "test", null);
+		}
+		catch (Exception e) {
+			e.printStackTrace();
+			fail(e.getMessage());
+		}
+	}
 }

http://git-wip-us.apache.org/repos/asf/flink/blob/caa29417/flink-yarn/src/main/java/org/apache/flink/yarn/appMaster/YarnTaskManagerRunner.java
----------------------------------------------------------------------
diff --git a/flink-yarn/src/main/java/org/apache/flink/yarn/appMaster/YarnTaskManagerRunner.java
b/flink-yarn/src/main/java/org/apache/flink/yarn/appMaster/YarnTaskManagerRunner.java
index bed8f19..214798c 100644
--- a/flink-yarn/src/main/java/org/apache/flink/yarn/appMaster/YarnTaskManagerRunner.java
+++ b/flink-yarn/src/main/java/org/apache/flink/yarn/appMaster/YarnTaskManagerRunner.java
@@ -46,7 +46,7 @@ public class YarnTaskManagerRunner {
 
 	public static void main(final String[] args) throws IOException {
 
-		EnvironmentInformation.logEnvironmentInfo(LOG, "YARN TaskManager");
+		EnvironmentInformation.logEnvironmentInfo(LOG, "YARN TaskManager", args);
 		EnvironmentInformation.checkJavaVersion();
 
 		// try to parse the command line arguments


Mime
View raw message