This is an automated email from the ASF dual-hosted git repository.

yao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/kyuubi.git


The following commit(s) were added to refs/heads/master by this push:
     new d2ead6bb24 [KYUUBI #6593] `bin/kyuubi` supports `kill` command
d2ead6bb24 is described below

commit d2ead6bb243996f86d5f7f7475cadd3bc2c5dfd8
Author: Bruce Wong <[email protected]>
AuthorDate: Tue Aug 13 20:01:47 2024 +0800

    [KYUUBI #6593] `bin/kyuubi` supports `kill` command
    
    # :mag: Description
    ## Issue References ๐Ÿ”—
    
    This pull request fixes #6593
    
    ## Describe Your Solution ๐Ÿ”ง
    
    The `kill -9 $PID` command directly forces Kyuubi to be shut down.
    
    ## Types of changes :bookmark:
    
    - [ ] Bugfix (non-breaking change which fixes an issue)
    - [x] New feature (non-breaking change which adds functionality)
    - [ ] Breaking change (fix or feature that would cause existing 
functionality to change)
    
    ## Test Plan ๐Ÿงช
    
    #### Behavior With This Pull Request :tada:
    ```
    (base) $ bin/kyuubi kill
    Stopping org.apache.kyuubi.server.KyuubiServer forcefully.
    
                __  __                            __
               /` \/` \                          /` \       __
               \ \ \/ /    __  __  __  __   __ __\ \ \____ /\_\
                \ \ , <   /` \/` \/` \/` \/` \/` \\ \ \__` \/` \
                 \ \ \ \`\\ \ \_\ \\ \_\  \\ \_\  \\ \ \L\  \ \ \
                  \ \_\ \_ \/`____ \ \____/ \ \____`\ \_,__/ \ \_\
                   \/_/\/_/ `/___/> \/___/   \/___/  \/___/   \/_/
                               /\___/
                               \/__\/
    
    Bye!
    ```
    
    ---
    
    # Checklist ๐Ÿ“
    
    - [x] This patch was not authored or co-authored using [Generative 
Tooling](https://www.apache.org/legal/generative-tooling.html)
    
    **Be nice. Be informative.**
    
    Closes #6611 from BruceWong96/kyuubi_kill_command.
    
    Closes #6593
    
    00f8c4c59 [Kent Yao] Update bin/kyuubi
    b27cd1a43 [Bruce Wong] fix indent.
    d2f3fc44f [Bruce Wong] add kyuubi kill command.
    
    Lead-authored-by: Bruce Wong <[email protected]>
    Co-authored-by: Kent Yao <[email protected]>
    Signed-off-by: Kent Yao <[email protected]>
---
 bin/kyuubi | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/bin/kyuubi b/bin/kyuubi
index 7dd5bb4eee..da4f96a3e5 100755
--- a/bin/kyuubi
+++ b/bin/kyuubi
@@ -26,6 +26,7 @@ function usage() {
   echo "    restart      - Restart Kyuubi server as a daemon"
   echo "    run          - Run a Kyuubi server in the foreground"
   echo "    stop         - Stop the Kyuubi daemon"
+  echo "    kill         - Stop the Kyuubi daemon forcefully"
   echo "    status       - Show status of the Kyuubi daemon"
   echo "    -h | --help  - Show this help message"
 }
@@ -107,7 +108,7 @@ if [[ -n ${YARN_CONF_DIR} ]]; then
   KYUUBI_CLASSPATH="${KYUUBI_CLASSPATH}:${YARN_CONF_DIR}"
 fi
 
-if [[ "$1" =~ ^(start|restart|run|stop|status)$ ]]; then
+if [[ "$1" =~ ^(start|restart|run|stop|kill|status)$ ]]; then
     command=$1
     shift
 fi
@@ -215,6 +216,18 @@ function stop_kyuubi() {
   fi
 }
 
+function kill_kyuubi() {
+  if [ -f ${pid} ]; then
+    TARGET_ID="$(cat "$pid")"
+    echo "Stopping $CLASS forcefully."
+    kill -9 $TARGET_ID
+    kyuubi_logo
+    echo "Bye!"
+  else
+    echo "no $CLASS to stop"
+  fi
+}
+
 function check_kyuubi() {
   if [[ -f ${pid} ]]; then
     TARGET_ID="$(cat "$pid")"
@@ -247,6 +260,10 @@ case $command in
     stop_kyuubi
     ;;
 
+  (kill)
+    kill_kyuubi
+    ;;
+
   (status)
     check_kyuubi
     ;;

Reply via email to