Skip to content

Commit

Permalink
check connected (ray-project#6565)
Browse files Browse the repository at this point in the history
  • Loading branch information
edoakes authored Dec 21, 2019
1 parent f06d742 commit 932cb3c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/ray/core_worker/core_worker.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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());
}
}
}

Expand Down
3 changes: 3 additions & 0 deletions src/ray/core_worker/core_worker.h
Original file line number Diff line number Diff line change
Expand Up @@ -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_;

Expand Down

0 comments on commit 932cb3c

Please sign in to comment.