Revert "[Dashboard] Start the new dashboard (#9860)" (#10116)

This reverts commit 739933e5b8.
This commit is contained in:
Robert Nishihara
2020-08-14 14:06:57 -07:00
committed by GitHub
parent 7ffb37f711
commit 36e626e95d
34 changed files with 103 additions and 1077 deletions
-6
View File
@@ -328,12 +328,6 @@ RAY_CONFIG(bool, put_small_object_in_memory_store, false)
/// pipelining task submission.
RAY_CONFIG(uint32_t, max_tasks_in_flight_per_worker, 1)
/// Interval to restart dashboard agent after the process exit.
RAY_CONFIG(uint32_t, agent_restart_interval_ms, 1000)
/// Wait timeout for dashboard agent register.
RAY_CONFIG(uint32_t, agent_register_timeout_ms, 30 * 1000)
/// The maximum number of resource shapes included in the resource
/// load reported by each raylet.
RAY_CONFIG(int64_t, max_resource_shapes_per_load_report, 100)
@@ -249,9 +249,9 @@ void GcsActorScheduler::LeaseWorkerFromNode(std::shared_ptr<GcsActor> actor,
void GcsActorScheduler::RetryLeasingWorkerFromNode(
std::shared_ptr<GcsActor> actor, std::shared_ptr<rpc::GcsNodeInfo> node) {
RAY_UNUSED(execute_after(
io_context_, [this, node, actor] { DoRetryLeasingWorkerFromNode(actor, node); },
RayConfig::instance().gcs_lease_worker_retry_interval_ms()));
execute_after(io_context_,
[this, node, actor] { DoRetryLeasingWorkerFromNode(actor, node); },
RayConfig::instance().gcs_lease_worker_retry_interval_ms());
}
void GcsActorScheduler::DoRetryLeasingWorkerFromNode(
@@ -370,9 +370,9 @@ void GcsActorScheduler::CreateActorOnWorker(std::shared_ptr<GcsActor> actor,
void GcsActorScheduler::RetryCreatingActorOnWorker(
std::shared_ptr<GcsActor> actor, std::shared_ptr<GcsLeasedWorker> worker) {
RAY_UNUSED(execute_after(
io_context_, [this, actor, worker] { DoRetryCreatingActorOnWorker(actor, worker); },
RayConfig::instance().gcs_create_actor_retry_interval_ms()));
execute_after(io_context_,
[this, actor, worker] { DoRetryCreatingActorOnWorker(actor, worker); },
RayConfig::instance().gcs_create_actor_retry_interval_ms());
}
void GcsActorScheduler::DoRetryCreatingActorOnWorker(
-23
View File
@@ -83,11 +83,6 @@ cc_proto_library(
deps = [":gcs_service_proto"],
)
python_grpc_compile(
name = "gcs_service_py_proto",
deps = [":gcs_service_proto"],
)
proto_library(
name = "object_manager_proto",
srcs = ["object_manager.proto"],
@@ -134,21 +129,3 @@ cc_proto_library(
name = "event_cc_proto",
deps = [":event_proto"],
)
# Agent manager gRPC lib.
proto_library(
name = "agent_manager_proto",
srcs = ["agent_manager.proto"],
deps = [],
)
python_grpc_compile(
name = "agent_manager_py_proto",
deps = [":agent_manager_proto"],
)
cc_proto_library(
name = "agent_manager_cc_proto",
deps = [":agent_manager_proto"],
)
-38
View File
@@ -1,38 +0,0 @@
// Copyright 2017 The Ray Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
syntax = "proto3";
package ray.rpc;
enum AgentRpcStatus {
// OK.
AGENT_RPC_STATUS_OK = 0;
// Failed.
AGENT_RPC_STATUS_FAILED = 1;
}
message RegisterAgentRequest {
int32 agent_pid = 1;
int32 agent_port = 2;
string agent_ip_address = 3;
}
message RegisterAgentReply {
AgentRpcStatus status = 1;
}
service AgentManagerService {
rpc RegisterAgent(RegisterAgentRequest) returns (RegisterAgentReply);
}
-96
View File
@@ -1,96 +0,0 @@
// Copyright 2017 The Ray Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#include "ray/raylet/agent_manager.h"
#include <thread>
#include "ray/common/ray_config.h"
#include "ray/util/logging.h"
#include "ray/util/process.h"
namespace ray {
namespace raylet {
void AgentManager::HandleRegisterAgent(const rpc::RegisterAgentRequest &request,
rpc::RegisterAgentReply *reply,
rpc::SendReplyCallback send_reply_callback) {
agent_ip_address_ = request.agent_ip_address();
agent_port_ = request.agent_port();
agent_pid_ = request.agent_pid();
RAY_LOG(INFO) << "HandleRegisterAgent, ip: " << agent_ip_address_
<< ", port: " << agent_port_ << ", pid: " << agent_pid_;
reply->set_status(rpc::AGENT_RPC_STATUS_OK);
send_reply_callback(ray::Status::OK(), nullptr, nullptr);
}
void AgentManager::StartAgent() {
if (options_.agent_commands.empty()) {
RAY_LOG(INFO) << "Not starting agent, the agent command is empty.";
return;
}
if (RAY_LOG_ENABLED(DEBUG)) {
std::stringstream stream;
stream << "Starting agent process with command:";
for (const auto &arg : options_.agent_commands) {
stream << " " << arg;
}
RAY_LOG(DEBUG) << stream.str();
}
// Launch the process to create the agent.
std::error_code ec;
std::vector<const char *> argv;
for (const std::string &arg : options_.agent_commands) {
argv.push_back(arg.c_str());
}
argv.push_back(NULL);
Process child(argv.data(), nullptr, ec);
if (!child.IsValid() || ec) {
// The worker failed to start. This is a fatal error.
RAY_LOG(FATAL) << "Failed to start agent with return value " << ec << ": "
<< ec.message();
RAY_UNUSED(delay_executor_([this] { StartAgent(); },
RayConfig::instance().agent_restart_interval_ms()));
return;
}
std::thread monitor_thread([this, child]() mutable {
RAY_LOG(INFO) << "Monitor agent process with pid " << child.GetId()
<< ", register timeout "
<< RayConfig::instance().agent_register_timeout_ms() << "ms.";
auto timer = delay_executor_(
[this, child]() mutable {
if (agent_pid_ != child.GetId()) {
RAY_LOG(WARNING) << "Agent process with pid " << child.GetId()
<< " has not registered, restart it.";
child.Kill();
}
},
RayConfig::instance().agent_register_timeout_ms());
int exit_code = child.Wait();
timer->cancel();
RAY_LOG(WARNING) << "Agent process with pid " << child.GetId()
<< " exit, return value " << exit_code;
RAY_UNUSED(delay_executor_([this] { StartAgent(); },
RayConfig::instance().agent_restart_interval_ms()));
});
monitor_thread.detach();
}
} // namespace raylet
} // namespace ray
-74
View File
@@ -1,74 +0,0 @@
// Copyright 2017 The Ray Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include <string>
#include <utility>
#include <vector>
#include "ray/rpc/agent_manager/agent_manager_client.h"
#include "ray/rpc/agent_manager/agent_manager_server.h"
namespace ray {
namespace raylet {
typedef std::function<std::shared_ptr<boost::asio::deadline_timer>(std::function<void()>,
uint32_t delay_ms)>
DelayExecutorFn;
class AgentManager : public rpc::AgentManagerServiceHandler {
public:
struct Options {
std::vector<std::string> agent_commands;
};
explicit AgentManager(Options options, DelayExecutorFn delay_executor)
: options_(std::move(options)), delay_executor_(std::move(delay_executor)) {
StartAgent();
}
void HandleRegisterAgent(const rpc::RegisterAgentRequest &request,
rpc::RegisterAgentReply *reply,
rpc::SendReplyCallback send_reply_callback) override;
private:
void StartAgent();
private:
Options options_;
pid_t agent_pid_ = 0;
int agent_port_ = 0;
std::string agent_ip_address_;
DelayExecutorFn delay_executor_;
};
class DefaultAgentManagerServiceHandler : public rpc::AgentManagerServiceHandler {
public:
explicit DefaultAgentManagerServiceHandler(std::unique_ptr<AgentManager> &delegate)
: delegate_(delegate) {}
void HandleRegisterAgent(const rpc::RegisterAgentRequest &request,
rpc::RegisterAgentReply *reply,
rpc::SendReplyCallback send_reply_callback) override {
RAY_CHECK(delegate_ != nullptr);
delegate_->HandleRegisterAgent(request, reply, send_reply_callback);
}
private:
std::unique_ptr<AgentManager> &delegate_;
};
} // namespace raylet
} // namespace ray
-7
View File
@@ -44,7 +44,6 @@ DEFINE_string(static_resource_list, "", "The static resource list of this node."
DEFINE_string(config_list, "", "The raylet config list of this node.");
DEFINE_string(python_worker_command, "", "Python worker command.");
DEFINE_string(java_worker_command, "", "Java worker command.");
DEFINE_string(agent_command, "", "Dashboard agent command.");
DEFINE_string(redis_password, "", "The password of redis.");
DEFINE_string(temp_dir, "", "Temporary directory.");
DEFINE_string(session_dir, "", "The path of this ray session directory.");
@@ -83,7 +82,6 @@ int main(int argc, char *argv[]) {
const std::string config_list = FLAGS_config_list;
const std::string python_worker_command = FLAGS_python_worker_command;
const std::string java_worker_command = FLAGS_java_worker_command;
const std::string agent_command = FLAGS_agent_command;
const std::string redis_password = FLAGS_redis_password;
const std::string temp_dir = FLAGS_temp_dir;
const std::string session_dir = FLAGS_session_dir;
@@ -186,11 +184,6 @@ int main(int argc, char *argv[]) {
RAY_CHECK(0) << "Either Python worker command or Java worker command should be "
"provided.";
}
if (!agent_command.empty()) {
node_manager_config.agent_command = agent_command;
} else {
RAY_LOG(DEBUG) << "Agent command is empty.";
}
node_manager_config.heartbeat_period_ms =
RayConfig::instance().raylet_heartbeat_timeout_milliseconds();
-14
View File
@@ -25,7 +25,6 @@
#include "ray/gcs/pb_util.h"
#include "ray/raylet/format/node_manager_generated.h"
#include "ray/stats/stats.h"
#include "ray/util/asio_util.h"
#include "ray/util/sample.h"
namespace {
@@ -165,9 +164,6 @@ NodeManager::NodeManager(boost::asio::io_service &io_service,
actor_registry_(),
node_manager_server_("NodeManager", config.node_manager_port),
node_manager_service_(io_service, *this),
agent_manager_service_handler_(
new DefaultAgentManagerServiceHandler(agent_manager_)),
agent_manager_service_(io_service, *agent_manager_service_handler_),
client_call_manager_(io_service),
new_scheduler_enabled_(RayConfig::instance().new_scheduler_enabled()) {
RAY_LOG(INFO) << "Initializing NodeManager with ID " << self_node_id_;
@@ -212,18 +208,8 @@ NodeManager::NodeManager(boost::asio::io_service &io_service,
RAY_CHECK_OK(store_client_.Connect(config.store_socket_name.c_str()));
// Run the node manger rpc server.
node_manager_server_.RegisterService(node_manager_service_);
node_manager_server_.RegisterService(agent_manager_service_);
node_manager_server_.Run();
AgentManager::Options options;
options.agent_commands = ParseCommandLine(config.agent_command);
agent_manager_.reset(
new AgentManager(std::move(options),
/*delay_executor=*/
[this](std::function<void()> task, uint32_t delay_ms) {
return execute_after(io_service_, task, delay_ms);
}));
RAY_CHECK_OK(SetupPlasmaSubscription());
}
-9
View File
@@ -27,7 +27,6 @@
#include "ray/common/task/scheduling_resources.h"
#include "ray/object_manager/object_manager.h"
#include "ray/raylet/actor_registration.h"
#include "ray/raylet/agent_manager.h"
#include "ray/raylet/scheduling/scheduling_ids.h"
#include "ray/raylet/scheduling/cluster_resource_scheduler.h"
#include "ray/raylet/scheduling/cluster_task_manager.h"
@@ -74,8 +73,6 @@ struct NodeManagerConfig {
int maximum_startup_concurrency;
/// The commands used to start the worker process, grouped by language.
WorkerCommandMap worker_commands;
/// The command used to start agent.
std::string agent_command;
/// The time between heartbeats in milliseconds.
uint64_t heartbeat_period_ms;
/// The time between debug dumps in milliseconds, or -1 to disable.
@@ -707,18 +704,12 @@ class NodeManager : public rpc::NodeManagerServiceHandler {
/// restore the actor.
std::unordered_map<ActorID, ActorCheckpointID> checkpoint_id_to_restore_;
std::unique_ptr<AgentManager> agent_manager_;
/// The RPC server.
rpc::GrpcServer node_manager_server_;
/// The node manager RPC service.
rpc::NodeManagerGrpcService node_manager_service_;
/// The agent manager RPC service.
std::unique_ptr<rpc::AgentManagerServiceHandler> agent_manager_service_handler_;
rpc::AgentManagerGrpcService agent_manager_service_;
/// The `ClientCallManager` object that is shared by all `NodeManagerClient`s
/// as well as all `CoreWorkerClient`s.
rpc::ClientCallManager client_call_manager_;
@@ -1,50 +0,0 @@
// Copyright 2017 The Ray Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "ray/rpc/client_call.h"
#include "ray/rpc/grpc_client.h"
#include "src/ray/protobuf/agent_manager.grpc.pb.h"
namespace ray {
namespace rpc {
/// Client used for communicating with a remote agent manager server.
class AgentManagerClient {
public:
/// Constructor.
///
/// \param[in] address Address of the agent manager server.
/// \param[in] port Port of the agent manager server.
/// \param[in] client_call_manager The `ClientCallManager` used for managing requests.
AgentManagerClient(const std::string &address, const int port,
ClientCallManager &client_call_manager) {
grpc_client_ = std::unique_ptr<GrpcClient<AgentManagerService>>(
new GrpcClient<AgentManagerService>(address, port, client_call_manager));
};
/// Register agent service to the agent manager server
///
/// \param request The request message
/// \param callback The callback function that handles reply
VOID_RPC_CLIENT_METHOD(AgentManagerService, RegisterAgent, grpc_client_, )
private:
/// The RPC client.
std::unique_ptr<GrpcClient<AgentManagerService>> grpc_client_;
};
} // namespace rpc
} // namespace ray
@@ -1,73 +0,0 @@
// Copyright 2017 The Ray Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
#pragma once
#include "ray/rpc/grpc_server.h"
#include "ray/rpc/server_call.h"
#include "src/ray/protobuf/agent_manager.grpc.pb.h"
#include "src/ray/protobuf/agent_manager.pb.h"
namespace ray {
namespace rpc {
#define RAY_AGENT_MANAGER_RPC_HANDLERS \
RPC_SERVICE_HANDLER(AgentManagerService, RegisterAgent)
/// Implementations of the `AgentManagerGrpcService`, check interface in
/// `src/ray/protobuf/agent_manager.proto`.
class AgentManagerServiceHandler {
public:
virtual ~AgentManagerServiceHandler() = default;
/// Handle a `RegisterAgent` request.
/// The implementation can handle this request asynchronously. When handling is done,
/// the `send_reply_callback` should be called.
///
/// \param[in] request The request message.
/// \param[out] reply The reply message.
/// \param[in] send_reply_callback The callback to be called when the request is done.
virtual void HandleRegisterAgent(const RegisterAgentRequest &request,
RegisterAgentReply *reply,
SendReplyCallback send_reply_callback) = 0;
};
/// The `GrpcService` for `AgentManagerGrpcService`.
class AgentManagerGrpcService : public GrpcService {
public:
/// Construct a `AgentManagerGrpcService`.
///
/// \param[in] port See `GrpcService`.
/// \param[in] handler The service handler that actually handle the requests.
AgentManagerGrpcService(boost::asio::io_service &io_service,
AgentManagerServiceHandler &service_handler)
: GrpcService(io_service), service_handler_(service_handler){};
protected:
grpc::Service &GetGrpcService() override { return service_; }
void InitServerCallFactories(
const std::unique_ptr<grpc::ServerCompletionQueue> &cq,
std::vector<std::unique_ptr<ServerCallFactory>> *server_call_factories) override {
RAY_AGENT_MANAGER_RPC_HANDLERS
}
private:
/// The grpc async service object.
AgentManagerService::AsyncService service_;
/// The service handler that actually handle the requests.
AgentManagerServiceHandler &service_handler_;
};
} // namespace rpc
} // namespace ray
+2 -4
View File
@@ -16,9 +16,8 @@
#include <boost/asio.hpp>
inline std::shared_ptr<boost::asio::deadline_timer> execute_after(
boost::asio::io_context &io_context, const std::function<void()> &fn,
uint32_t delay_milliseconds) {
inline void execute_after(boost::asio::io_context &io_context,
const std::function<void()> &fn, uint32_t delay_milliseconds) {
auto timer = std::make_shared<boost::asio::deadline_timer>(io_context);
timer->expires_from_now(boost::posix_time::milliseconds(delay_milliseconds));
timer->async_wait([timer, fn](const boost::system::error_code &error) {
@@ -26,5 +25,4 @@ inline std::shared_ptr<boost::asio::deadline_timer> execute_after(
fn();
}
});
return timer;
}