You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by tr...@apache.org on 2018/05/10 14:21:47 UTC

[8/9] flink git commit: [FLINK-9330] [runtime] Add periodic logging of SlotPool status

[FLINK-9330] [runtime] Add periodic logging of SlotPool status

Only happens if log level for the SlotPool is set to DEBUG


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

Branch: refs/heads/master
Commit: 6b892a6394a3e8e99dbc9b24276edafa2c8285e1
Parents: 1a91bce
Author: Stephan Ewen <se...@apache.org>
Authored: Sat May 5 18:18:36 2018 +0200
Committer: Till Rohrmann <tr...@apache.org>
Committed: Thu May 10 16:18:31 2018 +0200

----------------------------------------------------------------------
 .../flink/runtime/jobmaster/slotpool/SlotPool.java      | 12 ++++++++++++
 1 file changed, 12 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/6b892a63/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java
index 6ea74d1..ebb9aae 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotPool.java
@@ -92,6 +92,9 @@ import static org.apache.flink.util.Preconditions.checkNotNull;
  */
 public class SlotPool extends RpcEndpoint implements SlotPoolGateway, AllocatedSlotActions {
 
+	/** The interval (in milliseconds) in which the SlotPool writes its slot distribution on debug level. */
+	private static final int STATUS_LOG_INTERVAL_MS = 60_000;
+
 	private final JobID jobId;
 
 	private final ProviderAndOwner providerAndOwner;
@@ -198,6 +201,10 @@ public class SlotPool extends RpcEndpoint implements SlotPoolGateway, AllocatedS
 		}
 
 		scheduleRunAsync(this::checkIdleSlot, idleSlotTimeout);
+
+		if (log.isDebugEnabled()) {
+			scheduleRunAsync(this::scheduledLogStatus, STATUS_LOG_INTERVAL_MS, TimeUnit.MILLISECONDS);
+		}
 	}
 
 	@Override
@@ -1138,6 +1145,11 @@ public class SlotPool extends RpcEndpoint implements SlotPoolGateway, AllocatedS
 	//  Methods for tests
 	// ------------------------------------------------------------------------
 
+	private void scheduledLogStatus() {
+		log.debug(printStatus());
+		scheduleRunAsync(this::scheduledLogStatus, STATUS_LOG_INTERVAL_MS, TimeUnit.MILLISECONDS);
+	}
+
 	private String printStatus() {
 		validateRunsInMainThread();