mirror of
https://github.com/vale981/ray
synced 2025-03-06 10:31:39 -05:00
check connected (#6565)
This commit is contained in:
parent
f06d7422db
commit
932cb3c297
2 changed files with 12 additions and 5 deletions
|
@ -156,6 +156,7 @@ CoreWorker::CoreWorker(const WorkerType worker_type, const Language language,
|
|||
WorkerID::FromBinary(worker_context_.GetWorkerID().Binary()),
|
||||
(worker_type_ == ray::WorkerType::WORKER), worker_context_.GetCurrentJobID(),
|
||||
language_, &local_raylet_id, core_worker_server_.GetPort()));
|
||||
connected_ = true;
|
||||
|
||||
// Set our own address.
|
||||
RAY_CHECK(!local_raylet_id.IsNil());
|
||||
|
@ -266,11 +267,14 @@ void CoreWorker::Shutdown() {
|
|||
|
||||
void CoreWorker::Disconnect() {
|
||||
io_service_.stop();
|
||||
if (gcs_client_) {
|
||||
gcs_client_->Disconnect();
|
||||
}
|
||||
if (local_raylet_client_) {
|
||||
RAY_IGNORE_EXPR(local_raylet_client_->Disconnect());
|
||||
if (connected_) {
|
||||
connected_ = false;
|
||||
if (gcs_client_) {
|
||||
gcs_client_->Disconnect();
|
||||
}
|
||||
if (local_raylet_client_) {
|
||||
RAY_IGNORE_EXPR(local_raylet_client_->Disconnect());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -560,6 +560,9 @@ class CoreWorker {
|
|||
/// Address of our RPC server.
|
||||
rpc::Address rpc_address_;
|
||||
|
||||
/// Whether or not this worker is connected to the raylet and GCS.
|
||||
bool connected_ = false;
|
||||
|
||||
// Client to the GCS shared by core worker interfaces.
|
||||
std::shared_ptr<gcs::RedisGcsClient> gcs_client_;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue