[CELEBORN-2376] Filter empty ResourceConsumption entries in WorkerInfo toString output#3754
Open
gaoyajun02 wants to merge 1 commit into
Open
[CELEBORN-2376] Filter empty ResourceConsumption entries in WorkerInfo toString output#3754gaoyajun02 wants to merge 1 commit into
gaoyajun02 wants to merge 1 commit into
Conversation
…ng output Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment on lines
269
to
+273
| val userResourceConsumptionString = | ||
| if (userResourceConsumption == null || userResourceConsumption.isEmpty) { | ||
| "empty" | ||
| } else if (userResourceConsumption != null) { | ||
| userResourceConsumption.asScala.map { case (userIdentifier, resourceConsumption) => | ||
| s"\n UserIdentifier: ${userIdentifier}, ResourceConsumption: ${resourceConsumption}" | ||
| }.mkString("") | ||
| val nonEmpty = userResourceConsumption.asScala.filterNot(_._2.isEmpty) |
Comment on lines
+273
to
+277
| val nonEmpty = userResourceConsumption.asScala.filterNot(_._2.isEmpty) | ||
| if (nonEmpty.isEmpty) { | ||
| "empty" | ||
| } else { | ||
| nonEmpty.map { case (userIdentifier, resourceConsumption) => |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
Added an
isEmpty()method toResourceConsumptionthat returnstruewhen all four counters (diskBytesWritten,diskFileCount,hdfsBytesWritten,hdfsFileCount) are zero andsubResourceConsumptionsis empty.WorkerInfo.toStringnow uses this method to skip users with no active resource consumption, so that only entries with non-zero usage are included in the output. An additional guard handles the edge case where all entries are filtered out, falling back to"empty"rather than producing a blank string.Why are the changes needed?
In clusters with many registered users,
WorkerInfo.toString— surfaced in both HTTP API responses and log output — can include a large number of entries like:UserIdentifier: tenant1.user1, ResourceConsumption(diskBytesWritten: 0 B, diskFileCount: 0, hdfsBytesWritten: 0 B, hdfsFileCount: 0, subResourceConsumptions: empty)
These zero-value entries carry no operational information and add noise that makes it harder to identify active workloads at a glance. Filtering them out keeps the output focused on users with actual resource usage.
Does this PR resolve a correctness bug?
Does this PR introduce any user-facing change?
WorkerInfo.toStringoutput (returned byGET /api/v1/workersand visible in Worker logs) will no longer include users whose resource consumption is entirely zero.How was this patch tested?
Covered by existing unit tests.