feat(computing-unit-managing-service): add admin endpoint to list all computing units#6484
Draft
kunwp1 wants to merge 2 commits into
Draft
feat(computing-unit-managing-service): add admin endpoint to list all computing units#6484kunwp1 wants to merge 2 commits into
kunwp1 wants to merge 2 commits into
Conversation
… computing units Add an ADMIN-only GET /computing-unit/admin/list that returns every non-terminated computing unit across all users, backing the admin Computing Units dashboard. Row assembly is extracted into a pure buildDashboardUnits function so it is unit-testable without a database or Kubernetes. Register the resource and extend the service's startup access-control coverage check.
Contributor
Automated Reviewer SuggestionsBased on the
|
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #6484 +/- ##
============================================
+ Coverage 69.77% 69.85% +0.07%
- Complexity 3379 3401 +22
============================================
Files 1142 1143 +1
Lines 44828 44889 +61
Branches 4948 4957 +9
============================================
+ Hits 31277 31355 +78
+ Misses 11895 11868 -27
- Partials 1656 1666 +10
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…nd batch k8s calls Centralize computing-unit listing logic in ComputingUnitHelpers so the per-user and admin listing endpoints share one implementation: - Add resolveOwnerInfo, partitionLiveUnits, reconcileVanishedKubernetesUnits, and buildDashboardUnit; both listing endpoints now route through them. - Remove the byte-identical private getComputingUnitStatus/getComputingUnitMetrics from ComputingUnitManagingResource; single-unit callers use the shared helpers. - Add bulk KubernetesClient.getAllPodPhases / getAllPodMetrics (one namespace-wide list()/top() each) and a shared containerUsage helper; listComputingUnits now resolves pod status/metrics in bulk instead of per-unit (previously podExists was probed twice per unit and top() was re-fetched per unit). - Admin endpoint filters active units in SQL and reconciles vanished pods via the shared helper. Behavior of the API responses is unchanged; per-user reconciliation now runs over cuid-deduplicated units, reducing redundant DB updates without adding new ones.
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 PR?
Adds an ADMIN-only endpoint that returns every non-terminated computing unit across all users. Needed for adding admin Computing Units dashboard.
The endpoint queries all units via
WorkflowComputingUnitDao, excludes rows with a non-nullterminate_time, joinsUserDaofor each owner's name and avatar, and reusesComputingUnitHelpers.getComputingUnitStatus/getComputingUnitMetricsfor status and metrics.The new resource is registered in
ComputingUnitManagingService.accessPrivilegeis reported asWRITEfor admin rows (an admin can manage any unit it can see), andisOwnerreflects whether the requesting admin happens to own the unit.Any related issues, documentation, discussions?
Closes #6477. Part of #6476 (Admin Computing Units Dashboard). Originates from discussion #6322.
How was this PR tested?
Added
AdminComputingUnitResourceSpecRan
sbt 'ComputingUnitManagingService/testOnly org.apache.texera.service.resource.AdminComputingUnitResourceSpec org.apache.texera.service.ComputingUnitManagingServiceRunSpec'(all green) andsbt 'ComputingUnitManagingService/scalafmtCheck; ComputingUnitManagingService/Test/scalafmtCheck'(clean).Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Code, Claude Opus 4.8