mirror of
https://github.com/vale981/ray
synced 2025-03-05 18:11:42 -05:00
GCS client add fetch operation before subscribe (#9564)
This commit is contained in:
parent
2554a1a997
commit
0cee75c86a
2 changed files with 19 additions and 5 deletions
|
@ -89,9 +89,18 @@ Status ServiceBasedJobInfoAccessor::AsyncSubscribeAll(
|
|||
|
||||
void ServiceBasedJobInfoAccessor::AsyncResubscribe(bool is_pubsub_server_restarted) {
|
||||
RAY_LOG(INFO) << "Reestablishing subscription for job info.";
|
||||
// If the pub-sub server has restarted, we need to resubscribe to the pub-sub server.
|
||||
if (subscribe_operation_ != nullptr && is_pubsub_server_restarted) {
|
||||
RAY_CHECK_OK(subscribe_operation_(nullptr));
|
||||
// If only the GCS sever has restarted, we only need to fetch data from the GCS server.
|
||||
// If the pub-sub server has also restarted, we need to resubscribe to the pub-sub
|
||||
// server first, then fetch data from the GCS server.
|
||||
if (is_pubsub_server_restarted) {
|
||||
if (subscribe_operation_ != nullptr) {
|
||||
RAY_CHECK_OK(subscribe_operation_(
|
||||
[this](const Status &status) { fetch_all_data_operation_(nullptr); }));
|
||||
}
|
||||
} else {
|
||||
if (fetch_all_data_operation_ != nullptr) {
|
||||
fetch_all_data_operation_(nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -868,11 +868,16 @@ TEST_F(ServiceBasedGcsClientTest, TestJobTableResubscribe) {
|
|||
};
|
||||
ASSERT_TRUE(SubscribeToAllJobs(subscribe));
|
||||
|
||||
ASSERT_TRUE(AddJob(job_table_data));
|
||||
WaitPendingDone(job_update_count, 1);
|
||||
RestartGcsServer();
|
||||
|
||||
ASSERT_TRUE(AddJob(job_table_data));
|
||||
ASSERT_TRUE(MarkJobFinished(job_id));
|
||||
// The GCS client will fetch data from the GCS server after the GCS server is restarted,
|
||||
// and the GCS server keeps a job record, so `job_update_count` plus one.
|
||||
WaitPendingDone(job_update_count, 2);
|
||||
|
||||
ASSERT_TRUE(MarkJobFinished(job_id));
|
||||
WaitPendingDone(job_update_count, 3);
|
||||
}
|
||||
|
||||
TEST_F(ServiceBasedGcsClientTest, TestActorTableResubscribe) {
|
||||
|
|
Loading…
Add table
Reference in a new issue