def shutdownServer(self, index=0): logging.info("shutdownServer(index=%d) @ %s" % (index, self._servers[index])) adminaddr = self._servers[index] if adminaddr is not None: forker.shutdown_zeo_server(adminaddr) self._servers[index] = None
def tearDown(self): self._storage.close() for server in self._servers: forker.shutdown_zeo_server(server) if hasattr(os, "waitpid"): # Not in Windows Python until 2.3 for pid in self._pids: os.waitpid(pid, 0) StorageTestBase.StorageTestBase.tearDown(self)
def tearDown(self): self._storage.close() os.remove(self._conf_path) for server in self._servers: forker.shutdown_zeo_server(server) if hasattr(os, 'waitpid'): # Not in Windows Python until 2.3 for pid in self._pids: os.waitpid(pid, 0)
def tearDown(self): DemoStorageWrappedBase.tearDown(self) os.remove(self._conf_path) for server in self._servers: forker.shutdown_zeo_server(server) if hasattr(os, 'waitpid'): # Not in Windows Python until 2.3 for pid in self._pids: os.waitpid(pid, 0)
def tearDown(self): """Try to cause the tests to halt""" # logging.getLogger().setLevel(self._old_log_level) # logging.getLogger().removeHandler(self._log_handler) # logging.info("tearDown() %s" % self.id()) for p in self.conf_paths: os.remove(p) if getattr(self, '_storage', None) is not None: self._storage.close() if hasattr(self._storage, 'cleanup'): logging.debug("cleanup storage %s" % self._storage.__name__) self._storage.cleanup() for adminaddr in self._servers: if adminaddr is not None: forker.shutdown_zeo_server(adminaddr) for pid in self._pids: try: os.waitpid(pid, 0) except OSError: pass # The subprocess module may already have waited for c in self.caches: for i in 0, 1: for ext in "", ".trace", ".lock": path = "%s-%s.zec%s" % (c, "1", ext) # On Windows before 2.3, we don't have a way to wait for # the spawned server(s) to close, and they inherited # file descriptors for our open files. So long as those # processes are alive, we can't delete the files. Try # a few times then give up. need_to_delete = False if os.path.exists(path): need_to_delete = True for dummy in range(5): try: os.unlink(path) except: time.sleep(0.5) else: need_to_delete = False break if need_to_delete: os.unlink(path) # sometimes this is just gonna fail self.__super_tearDown()
def tearDown(self): """Try to cause the tests to halt""" logging.info("tearDown() %s" % self.id()) for p in self.conf_paths: os.remove(p) if getattr(self, '_storage', None) is not None: self._storage.close() if hasattr(self._storage, 'cleanup'): logging.debug("cleanup storage %s" % self._storage.__name__) self._storage.cleanup() for adminaddr in self._servers: if adminaddr is not None: forker.shutdown_zeo_server(adminaddr) if hasattr(os, 'waitpid'): # Not in Windows Python until 2.3 for pid in self._pids: os.waitpid(pid, 0) for c in self.caches: for i in 0, 1: for ext in "", ".trace": base = "%s-%s.zec%s" % (c, "1", ext) path = os.path.join(tempfile.tempdir, base) # On Windows before 2.3, we don't have a way to wait for # the spawned server(s) to close, and they inherited # file descriptors for our open files. So long as those # processes are alive, we can't delete the files. Try # a few times then give up. need_to_delete = False if os.path.exists(path): need_to_delete = True for dummy in range(5): try: os.unlink(path) except: time.sleep(0.5) else: need_to_delete = False break if need_to_delete: os.unlink(path) # sometimes this is just gonna fail self.__super_tearDown()
def run(self): # If this process doesn't exit in 330 seconds, commit suicide. # The client threads in the ConcurrentUpdate tests will run for # as long as 300 seconds. Set this timeout to 330 to minimize # chance that the server gives up before the clients. time.sleep(999) log(str(os.getpid()), "suicide thread invoking shutdown") # If the server hasn't shut down yet, the client may not be # able to connect to it. If so, try to kill the process to # force it to shutdown. if hasattr(os, "kill"): os.kill(pid, signal.SIGTERM) time.sleep(5) os.kill(pid, signal.SIGKILL) else: from ZEO.tests.forker import shutdown_zeo_server # Nott: If the -k option was given to zeoserver, then the # process will go away but the temp files won't get # cleaned up. shutdown_zeo_server(self._adminaddr)