feat(spider-grpc): Add gRPC for scheduler service; Add gRPC scheduler client in execution manager.#342
feat(spider-grpc): Add gRPC for scheduler service; Add gRPC scheduler client in execution manager.#342sitaowang1998 wants to merge 16 commits into
Conversation
|
Warning Review limit reached
More reviews will be available in 2 minutes and 53 seconds. Learn how PR review limits work. Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file). ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (1)
WalkthroughIntroduces ChangesScheduler gRPC client and common proto types
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
components/spider-execution-manager/src/client/grpc/scheduler.rs (1)
121-184: ⚡ Quick winConsider adding test coverage for the NoTask variant and malformed task ID conversion.
The existing tests cover assignment success, missing result, and missing task ID, but two code paths remain untested:
- The
NoTaskvariant (line 105) that returnsOk(None)- The error path when
TaskId::try_fromfails due to a malformed task ID (e.g.,common::TaskId { kind: None })Adding these tests would improve confidence in the protocol validation logic.
📋 Suggested additional tests
+ #[test] + fn scheduler_response_to_result_returns_none_for_no_task() { + let response = NextTaskResponse { + result: Some(next_task_response::Result::NoTask(common::Void {})), + }; + + let result = scheduler_response_to_result(response) + .expect("scheduler response conversion should succeed"); + + assert!(result.is_none()); + } + + #[test] + fn scheduler_response_to_result_rejects_malformed_task_id() { + let response = NextTaskResponse { + result: Some(next_task_response::Result::Assignment( + SchedulerAssignment { + job_id: 11, + task_id: Some(common::TaskId { kind: None }), + resource_group_id: 13, + session_id: 17, + }, + )), + }; + + let result = scheduler_response_to_result(response); + + assert!(result.is_err()); + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@components/spider-execution-manager/src/client/grpc/scheduler.rs` around lines 121 - 184, Add two new test cases to the tests module in scheduler.rs to improve coverage of untested code paths. First, create a test that verifies scheduler_response_to_result correctly returns Ok(None) when the NoTask variant is provided in the response result. Second, create a test that verifies scheduler_response_to_result returns an error when TaskId::try_from fails due to a malformed task ID (such as a common::TaskId with kind set to None). Both tests should follow the naming convention and assertion patterns of the existing test functions like scheduler_response_to_result_rejects_missing_result and scheduler_response_to_result_rejects_empty_assignment_task_id.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@components/spider-proto/common/common.proto`:
- Line 3: The proto compilation is failing because Buf cannot locate the module
root for the proto files in components/spider-proto/. To fix this, create a
buf.yaml configuration file in the components/spider-proto/ directory to declare
it as a Buf module, or alternatively create a buf.work.yaml at the repository
root to include components/spider-proto/ as a workspace module. This will allow
Buf to properly resolve proto imports and enable downstream files to
successfully import common.TaskId and common.Void from the common package
declaration.
---
Nitpick comments:
In `@components/spider-execution-manager/src/client/grpc/scheduler.rs`:
- Around line 121-184: Add two new test cases to the tests module in
scheduler.rs to improve coverage of untested code paths. First, create a test
that verifies scheduler_response_to_result correctly returns Ok(None) when the
NoTask variant is provided in the response result. Second, create a test that
verifies scheduler_response_to_result returns an error when TaskId::try_from
fails due to a malformed task ID (such as a common::TaskId with kind set to
None). Both tests should follow the naming convention and assertion patterns of
the existing test functions like
scheduler_response_to_result_rejects_missing_result and
scheduler_response_to_result_rejects_empty_assignment_task_id.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
Run ID: c217c818-67d2-4373-98f1-3da1177d00fb
⛔ Files ignored due to path filters (3)
components/spider-proto-rust/src/generated/common.rsis excluded by!**/generated/**components/spider-proto-rust/src/generated/scheduler.rsis excluded by!**/generated/**components/spider-proto-rust/src/generated/storage.rsis excluded by!**/generated/**
📒 Files selected for processing (11)
components/spider-execution-manager/src/client/grpc/mod.rscomponents/spider-execution-manager/src/client/grpc/scheduler.rscomponents/spider-execution-manager/src/client/grpc/storage.rscomponents/spider-proto-rust/build.rscomponents/spider-proto-rust/src/error.rscomponents/spider-proto-rust/src/id.rscomponents/spider-proto-rust/src/lib.rscomponents/spider-proto/common/common.protocomponents/spider-proto/scheduler/scheduler.protocomponents/spider-proto/storage/storage.protocomponents/spider-scheduler/src/storage_client/grpc.rs
Description
This PR:
Checklist
breaking change.
Validation performed
Summary by CodeRabbit