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

[core] Erases PopWorkerRequest on registration timeout. #48858

Merged
merged 1 commit into from
Nov 22, 2024
Merged
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
3 changes: 2 additions & 1 deletion src/ray/raylet/worker_pool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,8 @@ void WorkerPool::MonitorPopWorkerRequestForRegistration(
auto &requests = state.pending_registration_requests;
auto it = std::find(requests.begin(), requests.end(), pop_worker_request);
if (it != requests.end()) {
// Fail the task...
// Pop and fail the task...
requests.erase(it);
PopWorkerStatus status = PopWorkerStatus::WorkerPendingRegistration;
PopWorkerCallbackAsync(pop_worker_request->callback, nullptr, status);
}
Expand Down
13 changes: 13 additions & 0 deletions src/ray/raylet/worker_pool_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1928,6 +1928,19 @@ TEST_F(WorkerPoolDriverRegisteredTest, PopWorkerStatus) {
worker_pool_->ClearProcesses();
}

TEST_F(WorkerPoolDriverRegisteredTest, WorkerPendingRegistrationErasesRequest) {
std::shared_ptr<WorkerInterface> popped_worker;
PopWorkerStatus status;
auto task_spec = ExampleTaskSpec();
// Create a task without push worker. It should time out (WorkerPendingRegistration).
popped_worker = worker_pool_->PopWorkerSync(task_spec, false, &status);
ASSERT_EQ(popped_worker, nullptr);
ASSERT_EQ(status, PopWorkerStatus::WorkerPendingRegistration);
// The request should be erased.
ASSERT_EQ(worker_pool_->NumPendingRegistrationRequests(), 0);
worker_pool_->ClearProcesses();
}

TEST_F(WorkerPoolDriverRegisteredTest, TestIOWorkerFailureAndSpawn) {
std::unordered_set<std::shared_ptr<WorkerInterface>> spill_worker_set;
auto spill_worker_callback =
Expand Down
Loading