From 79cd5770b4d5429329f90252f4cb92243ab7afdb Mon Sep 17 00:00:00 2001 From: Tao He Date: Wed, 14 Jun 2023 19:16:50 +0800 Subject: [PATCH] Use local metadata backend to avoid the requirements of etcd for local sessions (#2889) Mitigate #2887. Signed-off-by: Tao He --- analytical_engine/core/launcher.cc | 3 +++ coordinator/gscoordinator/local_launcher.py | 20 ++++++++++++++++---- python/graphscope/nx/classes/graph.py | 5 ++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/analytical_engine/core/launcher.cc b/analytical_engine/core/launcher.cc index 93c95349e34e..5372e61a1c73 100644 --- a/analytical_engine/core/launcher.cc +++ b/analytical_engine/core/launcher.cc @@ -86,6 +86,9 @@ void VineyardServer::Start() { " --size " + FLAGS_vineyard_shared_mem + " --etcd_endpoint " + FLAGS_etcd_endpoint + " --etcd_prefix vineyard.gsa." + std::to_string(ts); + if (comm_spec_.worker_num() == comm_spec_.local_num()) { + cmd += " --meta local"; + } auto env = boost::this_process::environment(); // Set verbosity level to 2 can get rid of most of vineyard server's // debugging output diff --git a/coordinator/gscoordinator/local_launcher.py b/coordinator/gscoordinator/local_launcher.py index c7e27af2da51..c08e77bf73db 100644 --- a/coordinator/gscoordinator/local_launcher.py +++ b/coordinator/gscoordinator/local_launcher.py @@ -362,8 +362,12 @@ def launch_etcd(self): else: self._etcd_peer_port = get_free_port() + if isinstance(self._hosts, (list, tuple)): + hosts = self._hosts + else: + hosts = self._hosts.split(",") local_hostname = "127.0.0.1" - if len(self._hosts) > 1: + if len(hosts) > 1: try: local_hostname = socket.gethostname() socket.gethostbyname( @@ -452,8 +456,11 @@ def launch_vineyard(self): cmd.extend(["--socket", self.vineyard_socket]) cmd.extend(["--rpc_socket_port", str(self._vineyard_rpc_port)]) cmd.extend(["--size", self._shared_mem]) - cmd.extend(["-etcd_endpoint", self._etcd_endpoint]) - cmd.extend(["-etcd_prefix", f"vineyard.gsa.{ts}"]) + if len(hosts) == 1: + cmd.extend(["--meta", "local"]) + else: + cmd.extend(["-etcd_endpoint", self._etcd_endpoint]) + cmd.extend(["-etcd_prefix", f"vineyard.gsa.{ts}"]) env = os.environ.copy() env["GLOG_v"] = str(self._glog_level) env.update(mpi_env) @@ -550,7 +557,12 @@ def configure_etcd_endpoint(self): def start(self): try: # create etcd - self.configure_etcd_endpoint() + if isinstance(self._hosts, (list, tuple)): + hosts = self._hosts + else: + hosts = self._hosts.split(",") + if len(hosts) > 1: + self.configure_etcd_endpoint() # create vineyard self.launch_vineyard() except Exception: # pylint: disable=broad-except diff --git a/python/graphscope/nx/classes/graph.py b/python/graphscope/nx/classes/graph.py index fed902879c75..4f1cda4252d7 100644 --- a/python/graphscope/nx/classes/graph.py +++ b/python/graphscope/nx/classes/graph.py @@ -388,7 +388,10 @@ def __del__(self): return if self.cache.enable_iter_cache: - self.cache.shutdown() + try: + self.cache.shutdown() + except: # noqa: E722, pylint: disable=bare-except + pass self.cache.shutdown_executor() if not self._is_client_view and self._unload_op is not None: