Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable rendering of fair sharing for cluster queues #4071

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions cmd/experimental/kueue-viz/backend/handlers/cluster_queues.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ func fetchClusterQueues(dynamicClient dynamic.Interface) ([]map[string]interface

var cohort string
var resourceGroups []interface{}
fairSharing := make([]interface{}, 0)
if specExists {
cohort, _ = spec["cohort"].(string)
resourceGroups, _ = spec["resourceGroups"].([]interface{})
Expand All @@ -71,6 +72,10 @@ func fetchClusterQueues(dynamicClient dynamic.Interface) ([]map[string]interface
admittedWorkloads, _ = status["admittedWorkloads"].(int64)
pendingWorkloads, _ = status["pendingWorkloads"].(int64)
reservingWorkloads, _ = status["reservingWorkloads"].(int64)

if fairSharingSlice, ok := status["fairSharing"].([]interface{}); ok {
fairSharing = fairSharingSlice
}
}

// Extract flavors from resourceGroups
Expand Down Expand Up @@ -101,6 +106,7 @@ func fetchClusterQueues(dynamicClient dynamic.Interface) ([]map[string]interface
"pendingWorkloads": pendingWorkloads,
"reservingWorkloads": reservingWorkloads,
"flavors": flavors,
"fairSharing": fairSharing,
})
}

Expand Down Expand Up @@ -155,6 +161,20 @@ func fetchClusterQueueDetails(dynamicClient dynamic.Interface, clusterQueueName

// Attach the queues information to the ClusterQueue details
clusterQueueDetails := clusterQueue.Object

status, statusExists := clusterQueue.Object["status"].(map[string]interface{})
if statusExists {
fairSharingDetails := map[string]interface{}{}
if fairSharing, ok := status["Fair Sharing"].(map[string]interface{}); ok {
if weightedShare, exists := fairSharing["Weighted Share"]; exists {
fairSharingDetails["weightedShare"] = weightedShare
}
}
clusterQueueDetails["fairSharing"] = []interface{}{fairSharingDetails}
} else {
clusterQueueDetails["fairSharing"] = []interface{}{}
}

clusterQueueDetails["queues"] = queuesUsingClusterQueue

return clusterQueueDetails, nil
Expand Down
26 changes: 26 additions & 0 deletions cmd/experimental/kueue-viz/frontend/src/ClusterQueueDetail.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,32 @@ const ClusterQueueDetail = () => {
</Grid>
</Grid>

{/* Fair Sharing Section */}
<Typography variant="h5" gutterBottom style={{ marginTop: '20px' }}>
Fair Sharing
</Typography>
{clusterQueue.fairSharing && clusterQueue.fairSharing.length > 0 ? (
<TableContainer component={Paper} style={{ marginTop: '20px' }}>
<Table>
<TableHead>
<TableRow>
<TableCell>Weight</TableCell>
<TableCell>Share</TableCell>
</TableRow>
</TableHead>
<TableBody>
{clusterQueue.fairSharing.map((item, index) => (
<TableRow key={index}>
<TableCell>{item.weight}</TableCell>
</TableRow>
))}
</TableBody>
</Table>
</TableContainer>
) : (
<Typography>No fair sharing details available</Typography>
)}

{/* Flavor Fungibility Section */}
<Typography variant="h5" gutterBottom style={{ marginTop: '20px' }}>
Flavor Fungibility
Expand Down