Remove MS_DEBUGGER_HOST

This commit is contained in:
maning202007 2021-07-29 10:16:38 +08:00
parent 615b33e970
commit 9cdd3bbfba
2 changed files with 2 additions and 30 deletions

View File

@ -147,22 +147,8 @@ void Debugger::EnableDebugger() {
}
if (debugger_enabled_) {
// configure grpc host
std::string env_host_str = common::GetEnv("MS_DEBUGGER_HOST");
std::string host;
if (!env_host_str.empty()) {
if (CheckIp(env_host_str)) {
MS_LOG(INFO) << "Getenv MS_DEBUGGER_HOST: " << env_host_str;
host = env_host_str;
} else {
debugger_enabled_ = false;
MS_EXCEPTION(ValueError) << "Environment variable MS_DEBUGGER_HOST isn't a valid IP address. "
"Please set environment variable MS_DEBUGGER_HOST=x.x.x.x to a valid IP";
}
} else {
MS_LOG(INFO) << "Environment variable MS_DEBUGGER_HOST doesn't exist. Using default debugger host: localhost";
host = "localhost";
}
std::string host = "localhost";
// configure grpc port
std::string env_port_str = common::GetEnv("MS_DEBUGGER_PORT");
std::string port;
@ -1134,17 +1120,6 @@ bool Debugger::CheckPort(const std::string &port) const {
return true;
}
bool Debugger::CheckIp(const std::string &host) const {
std::regex reg_ip(
"(25[0-4]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])"
"[.](25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])"
"[.](25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])"
"[.](25[0-4]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[1-9])");
std::smatch smat;
std::string host_str = host;
return std::regex_match(host_str, smat, reg_ip);
}
uint32_t Debugger::GetFirstRunGraphId() const { return rungraph_id_list_.front(); }
void Debugger::LoadSingleAnfnode(const AnfNodePtr &anf_node, const size_t output_index) {

View File

@ -235,9 +235,6 @@ class Debugger : public std::enable_shared_from_this<Debugger> {
// Check if the port is valid
bool CheckPort(const std::string &port) const;
// Check if the IP is valid
bool CheckIp(const std::string &host) const;
void LoadSingleAnfnode(const AnfNodePtr &anf_node, const size_t output_index);
// class members