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:48 UTC

[9/9] flink git commit: [hotfix] [runtime] Add toString() methods to SlotSharingManager and contained slot classes.

[hotfix] [runtime] Add toString() methods to SlotSharingManager and contained slot classes.


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

Branch: refs/heads/master
Commit: 6ce67c14f7682df7f3c1153b7f8cc5897a5a630c
Parents: 00400e9
Author: Stephan Ewen <se...@apache.org>
Authored: Sat May 5 17:25:15 2018 +0200
Committer: Till Rohrmann <tr...@apache.org>
Committed: Thu May 10 16:18:31 2018 +0200

----------------------------------------------------------------------
 .../jobmaster/slotpool/SlotSharingManager.java  | 56 +++++++++++++++++++-
 1 file changed, 54 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/6ce67c14/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotSharingManager.java
----------------------------------------------------------------------
diff --git a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotSharingManager.java b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotSharingManager.java
index 8fcf813..e3338fc 100644
--- a/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotSharingManager.java
+++ b/flink-runtime/src/main/java/org/apache/flink/runtime/jobmaster/slotpool/SlotSharingManager.java
@@ -28,6 +28,7 @@ import org.apache.flink.runtime.jobmaster.SlotOwner;
 import org.apache.flink.runtime.jobmaster.SlotRequestId;
 import org.apache.flink.runtime.taskmanager.TaskManagerLocation;
 import org.apache.flink.util.AbstractID;
+import org.apache.flink.util.ExceptionUtils;
 import org.apache.flink.util.FlinkException;
 import org.apache.flink.util.Preconditions;
 
@@ -213,6 +214,19 @@ public class SlotSharingManager {
 		return null;
 	}
 
+	@Override
+	public String toString() {
+		final StringBuilder builder = new StringBuilder("{\n\tgroupId=").append(slotSharingGroupId).append('\n');
+
+		synchronized (lock) {
+			builder.append("\tunresolved=").append(unresolvedRootSlots).append('\n');
+			builder.append("\tresolved=").append(resolvedRootSlots).append('\n');
+			builder.append("\tall=").append(allTaskSlots).append('\n');
+		}
+
+		return builder.append('}').toString();
+	}
+
 	// ------------------------------------------------------------------------
 	// Inner classes: TaskSlot hierarchy and helper classes
 	// ------------------------------------------------------------------------
@@ -499,6 +513,25 @@ public class SlotSharingManager {
 				}
 			}
 		}
+
+		@Override
+		public String toString() {
+			String physicalSlotDescription = "";
+			try {
+				physicalSlotDescription = String.valueOf(slotContextFuture.getNow(null));
+			}
+			catch (Exception e) {
+				physicalSlotDescription = '(' + ExceptionUtils.stripCompletionException(e).getMessage() + ')';
+			}
+
+			return "MultiTaskSlot{"
+					+ "requestId=" + getSlotRequestId()
+					+ ", allocatedRequestId=" + allocatedSlotRequestId
+					+ ", groupId=" + getGroupId()
+					+ ", physicalSlot=" + physicalSlotDescription
+					+ ", children=" + children.values().toString()
+					+ '}';
+		}
 	}
 
 	/**
@@ -540,8 +573,6 @@ public class SlotSharingManager {
 		public void release(Throwable cause) {
 			singleLogicalSlotFuture.completeExceptionally(cause);
 
-			boolean pendingLogicalSlotRelease = false;
-
 			if (singleLogicalSlotFuture.isDone() && !singleLogicalSlotFuture.isCompletedExceptionally()) {
 				// we have a single task slot which we first have to release
 				final SingleLogicalSlot singleLogicalSlot = singleLogicalSlotFuture.getNow(null);
@@ -551,6 +582,27 @@ public class SlotSharingManager {
 
 			parent.releaseChild(getGroupId());
 		}
+
+		@Override
+		public String toString() {
+			String logicalSlotString = "(pending)";
+			try {
+				LogicalSlot slot = singleLogicalSlotFuture.getNow(null);
+				if (slot != null) {
+					logicalSlotString = "(requestId=" + slot.getSlotRequestId()
+							+ ", allocationId=" + slot.getAllocationId() + ')';
+				}
+			}
+			catch (Exception e) {
+				logicalSlotString = '(' + ExceptionUtils.stripCompletionException(e).getMessage() + ')';
+			}
+
+			return "SingleTaskSlot{"
+					+ "logicalSlot=" + logicalSlotString
+					+ ", request=" + getSlotRequestId()
+					+ ", group=" + getGroupId()
+					+ '}';
+		}
 	}
 
 	// ------------------------------------------------------------------------