You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by uc...@apache.org on 2014/11/20 12:04:12 UTC

incubator-flink git commit: [FLINK-1142] Log information about I/O manager temp dirs

Repository: incubator-flink
Updated Branches:
  refs/heads/master a03637820 -> 5c3dceb9c


[FLINK-1142] Log information about I/O manager temp dirs

This closes #219.


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

Branch: refs/heads/master
Commit: 5c3dceb9c87f8c53c88f489992da2c801288ad42
Parents: a036378
Author: Nils Engelbach <ni...@aol.com>
Authored: Fri Oct 31 09:05:02 2014 -0700
Committer: uce <uc...@apache.org>
Committed: Thu Nov 20 12:03:57 2014 +0100

----------------------------------------------------------------------
 .../flink/runtime/taskmanager/TaskManager.java  | 27 +++++++++++---------
 1 file changed, 15 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-flink/blob/5c3dceb9/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/TaskManager.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/TaskManager.java b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/TaskManager.java
index 93bece2..10cbb8a 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/TaskManager.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/taskmanager/TaskManager.java
@@ -102,6 +102,9 @@ import org.apache.flink.util.StringUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import static com.google.common.base.Preconditions.checkArgument;
+import static com.google.common.base.Preconditions.checkNotNull;
+
 /**
  * A task manager receives tasks from the job manager and executes them. After having executed them
  * (or in case of an execution error) it reports the execution result back to the job manager.
@@ -1120,21 +1123,21 @@ public class TaskManager implements TaskOperationProtocol {
 	 */
 	private static final void checkTempDirs(final String[] tempDirs) throws Exception {
 		for (int i = 0; i < tempDirs.length; ++i) {
-			final String dir = tempDirs[i];
-			if (dir == null) {
-				throw new Exception("Temporary file directory #" + (i + 1) + " is null.");
-			}
+			final String dir = checkNotNull(tempDirs[i], "Temporary file directory #" + (i + 1) + " is null.");
 
 			final File f = new File(dir);
 
-			if (!f.exists()) {
-				throw new Exception("Temporary file directory '" + f.getAbsolutePath() + "' does not exist.");
-			}
-			if (!f.isDirectory()) {
-				throw new Exception("Temporary file directory '" + f.getAbsolutePath() + "' is not a directory.");
-			}
-			if (!f.canWrite()) {
-				throw new Exception("Temporary file directory '" + f.getAbsolutePath() + "' is not writable.");
+			checkArgument(f.exists(), "Temporary file directory '" + f.getAbsolutePath() + "' does not exist.");
+			checkArgument(f.isDirectory(), "Temporary file directory '" + f.getAbsolutePath() + "' is not a directory.");
+			checkArgument(f.canWrite(), "Temporary file directory '" + f.getAbsolutePath() + "' is not writable.");
+
+			if (LOG.isInfoEnabled()) {
+				long totalSpaceGb = f.getTotalSpace() >>  30;
+				long usableSpaceGb = f.getUsableSpace() >> 30;
+				double usablePercentage = ((double) usableSpaceGb) / totalSpaceGb * 100;
+
+				LOG.info(String.format("Temporary file directory '%s': total %d GB, usable %d GB [%.2f%% usable]",
+						f.getAbsolutePath(), totalSpaceGb, usableSpaceGb, usablePercentage));
 			}
 		}
 	}