示例#1
0
 def stop(self, nodes):
     if self.keep_running:
         self.logger.info("Keeping [%d] nodes on this host running.",
                          len(nodes))
     else:
         self.logger.info("Shutting down [%d] nodes on this host.",
                          len(nodes))
     for node in nodes:
         process = node.process
         node_name = node.node_name
         node.telemetry.detach_from_node(node, running=True)
         if not self.keep_running:
             stop_watch = self._clock.stop_watch()
             stop_watch.start()
             try:
                 os.kill(process.pid, signal.SIGINT)
                 process.wait(10.0)
                 self.logger.info("Done shutdown node [%s] in [%.1f] s.",
                                  node_name, stop_watch.split_time())
             except ProcessLookupError:
                 self.logger.warning(
                     "No process found with PID [%s] for node [%s]",
                     process.pid, node_name)
             except subprocess.TimeoutExpired:
                 # kill -9
                 self.logger.warning(
                     "Node [%s] did not shut down after 10 seconds; now kill -QUIT node, to see threads:",
                     node_name)
                 try:
                     os.kill(process.pid, signal.SIGQUIT)
                 except OSError:
                     self.logger.warning(
                         "No process found with PID [%s] for node [%s]",
                         process.pid, node_name)
                     break
                 try:
                     process.wait(120.0)
                     self.logger.info(
                         "Done shutdown node [%s] in [%.1f] s.", node_name,
                         stop_watch.split_time())
                     break
                 except subprocess.TimeoutExpired:
                     pass
                 self.logger.info("kill -KILL node [%s]", node_name)
                 try:
                     process.kill()
                 except ProcessLookupError:
                     self.logger.warning(
                         "No process found with PID [%s] for node [%s]",
                         process.pid, node_name)
             node.telemetry.detach_from_node(node, running=False)
示例#2
0
    def stop(self, cluster):
        logger.info("Shutting down ES cluster")

        # Ask all nodes to shutdown:
        stop_watch = self._clock.stop_watch()
        stop_watch.start()
        for node in cluster.nodes:
            process = node.process
            node.telemetry.detach_from_node(node)

            os.kill(process.pid, signal.SIGINT)

            try:
                process.wait(10.0)
                logger.info("Done shutdown node (%.1f sec)" %
                            stop_watch.split_time())
            except subprocess.TimeoutExpired:
                # kill -9
                logger.warn(
                    "Server %s did not shut down itself after 10 seconds; now kill -QUIT node, to see threads:"
                    % node.node_name)
                try:
                    os.kill(process.pid, signal.SIGQUIT)
                except OSError:
                    logger.warn("  no such process")
                    return

                try:
                    process.wait(120.0)
                    logger.info("Done shutdown node (%.1f sec)" %
                                stop_watch.split_time())
                    return
                except subprocess.TimeoutExpired:
                    pass

                logger.info("kill -KILL node")
                try:
                    process.kill()
                except ProcessLookupError:
                    logger.warn("No such process")
        cluster.telemetry.detach_from_cluster(cluster)
        self._servers = []
示例#3
0
文件: launcher.py 项目: elastic/rally
    def stop(self, cluster):
        logger.info("Shutting down ES cluster")

        # Ask all nodes to shutdown:
        stop_watch = self._clock.stop_watch()
        stop_watch.start()
        for node in cluster.nodes:
            process = node.process
            node.telemetry.detach_from_node(node)

            os.kill(process.pid, signal.SIGINT)

            try:
                process.wait(10.0)
                logger.info("Done shutdown node (%.1f sec)" % stop_watch.split_time())
            except subprocess.TimeoutExpired:
                # kill -9
                logger.warn("Server %s did not shut down itself after 10 seconds; now kill -QUIT node, to see threads:" % node.node_name)
                try:
                    os.kill(process.pid, signal.SIGQUIT)
                except OSError:
                    logger.warn("  no such process")
                    return

                try:
                    process.wait(120.0)
                    logger.info("Done shutdown node (%.1f sec)" % stop_watch.split_time())
                    return
                except subprocess.TimeoutExpired:
                    pass

                logger.info("kill -KILL node")
                try:
                    process.kill()
                except ProcessLookupError:
                    logger.warn("No such process")
        cluster.telemetry.detach_from_cluster(cluster)
        self._servers = []
示例#4
0
 def stop(self, nodes):
     if self.keep_running:
         logger.info("Keeping [%d] nodes on this host running." % len(nodes))
     else:
         logger.info("Shutting down [%d] nodes on this host." % len(nodes))
     for node in nodes:
         process = node.process
         node_name = node.node_name
         node.telemetry.detach_from_node(node, running=True)
         if not self.keep_running:
             stop_watch = self._clock.stop_watch()
             stop_watch.start()
             os.kill(process.pid, signal.SIGINT)
             try:
                 process.wait(10.0)
                 logger.info("Done shutdown node [%s] in [%.1f] s." % (node_name, stop_watch.split_time()))
             except subprocess.TimeoutExpired:
                 # kill -9
                 logger.warning("Node [%s] did not shut down itself after 10 seconds; now kill -QUIT node, to see threads:" % node_name)
                 try:
                     os.kill(process.pid, signal.SIGQUIT)
                 except OSError:
                     logger.warning("No process found with PID [%s] for node [%s]" % (process.pid, node_name))
                     break
                 try:
                     process.wait(120.0)
                     logger.info("Done shutdown node [%s] in [%.1f] s." % (node_name, stop_watch.split_time()))
                     break
                 except subprocess.TimeoutExpired:
                     pass
                 logger.info("kill -KILL node [%s]" % node_name)
                 try:
                     process.kill()
                 except ProcessLookupError:
                     logger.warning("No process found with PID [%s] for node [%s]" % (process.pid, node_name))
             node.telemetry.detach_from_node(node, running=False)