Skip to content

Commit

Permalink
[KYUUBI #6593] bin/kyuubi supports kill command
Browse files Browse the repository at this point in the history
# 🔍 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 🔖

- [ ] 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 🎉
```
(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

00f8c4c [Kent Yao] Update bin/kyuubi
b27cd1a [Bruce Wong] fix indent.
d2f3fc4 [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]>
  • Loading branch information
BruceWong96 and yaooqinn committed Aug 13, 2024
1 parent cd390ba commit d2ead6b
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion bin/kyuubi
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")"
Expand Down Expand Up @@ -247,6 +260,10 @@ case $command in
stop_kyuubi
;;

(kill)
kill_kyuubi
;;

(status)
check_kyuubi
;;
Expand Down

0 comments on commit d2ead6b

Please sign in to comment.