From dceef479bb217eb5f5b7dfa5728c3c05c4ac7e86 Mon Sep 17 00:00:00 2001 From: "Wang, Fei" Date: Fri, 2 Aug 2024 15:06:19 +0800 Subject: [PATCH] [CELEBORN-1541] Enhance the readable address for internal port ### What changes were proposed in this pull request? If the internal port is not defined, do not show the internal port(-1) in the readable address. ### Why are the changes needed? If the workerInfo is applied for the RESTful request, such as curl `/api/v1/workers/exclude`, the internal port is always `-1`. It is not necessary to show the `-1` in the readable address. ### Does this PR introduce _any_ user-facing change? Just reduce the unnecessary info. ### How was this patch tested? Not needed. Closes #2659 from turboFei/internal_port. Authored-by: Wang, Fei Signed-off-by: mingji --- .../scala/org/apache/celeborn/common/meta/WorkerInfo.scala | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/src/main/scala/org/apache/celeborn/common/meta/WorkerInfo.scala b/common/src/main/scala/org/apache/celeborn/common/meta/WorkerInfo.scala index bc801b7c80d..1524ab2be99 100644 --- a/common/src/main/scala/org/apache/celeborn/common/meta/WorkerInfo.scala +++ b/common/src/main/scala/org/apache/celeborn/common/meta/WorkerInfo.scala @@ -156,7 +156,8 @@ class WorkerInfo( def readableAddress(): String = { s"Host:$host:RpcPort:$rpcPort:PushPort:$pushPort:" + - s"FetchPort:$fetchPort:ReplicatePort:$replicatePort:$internalPort" + s"FetchPort:$fetchPort:ReplicatePort:$replicatePort" + + (if (internalPort > 0) s":InternalPort:$internalPort" else "") } def toUniqueId(): String = {