Skip to content

feat: cinfo --list-reasons/-R#817

Open
edragain2nd wants to merge 1 commit intoPKUHPC:masterfrom
edragain2nd:feat/cinfo-R
Open

feat: cinfo --list-reasons/-R#817
edragain2nd wants to merge 1 commit intoPKUHPC:masterfrom
edragain2nd:feat/cinfo-R

Conversation

@edragain2nd
Copy link
Collaborator

@edragain2nd edragain2nd commented Feb 5, 2026

Summary by CodeRabbit

  • New Features

    • Node state reason information is now included in cluster status queries, providing better visibility into node conditions.
  • Bug Fixes

    • Health check failure messages are now standardized for clearer and more consistent error reporting.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 5, 2026

📝 Walkthrough

Walkthrough

This PR extends the public protobuf schema by adding a state_reason field to TrimmedCranedInfo and implements backend logic to collect and propagate per-craned-node state reasons through cluster query responses. Additionally, it standardizes health-check failure reason messages.

Changes

Cohort / File(s) Summary
Protobuf Schema Extension
protos/PublicDefs.proto
Added state_reason string field (field 6) to TrimmedCranedInfo nested message to expose per-node state reasons in public API responses.
State Reason Collection & Propagation
src/CraneCtld/CranedMetaContainer.cpp
Implemented logic to accumulate state reasons during cluster query, collect and deduplicate reasons for nodes in each craned list, and set semicolon-delimited reason strings in response data.
CranedMeta Initialization
src/CraneCtld/CtldPublicDefs.h
Added explicit default initializer ("") to CranedMeta.state_reason field declaration.
Standardized Health-Check Messages
src/Craned/Core/CtldClient.cpp
Replaced dynamic reason formatting with fixed user-facing strings ("CPU count mismatch", "Mem mismatch", "Device not found") in three node drain failure paths.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • feat: craned health check #635: Introduces state_reason field and per-node state reason propagation into TrimmedCranedInfo/QueryCranedInfo responses that this PR directly extends and implements.

Suggested labels

enhancement

Suggested reviewers

  • L-Xiafeng
  • RileyWen
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat: cinfo --list-reasons/-R' directly references the main feature being added - a new command-line option for listing reasons in the cinfo command, which aligns with the changeset's focus on propagating state_reason information.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@edragain2nd edragain2nd requested a review from L-Xiafeng February 6, 2026 04:18
craned_list->set_count(craned_name_lists[i][j][k].size());
craned_list->set_craned_list_regex(
util::HostNameListToStr(craned_name_lists[i][j][k]));
std::vector<std::string> reasons;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reason不一样的不应该聚合在一起吧

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants