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

zhouky pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/incubator-celeborn.git


The following commit(s) were added to refs/heads/main by this push:
     new e137d0e1e [CELEBORN-887] Option --config should take effect in 
celeborn-daemon.sh script
e137d0e1e is described below

commit e137d0e1e7282170ea7d90983f01fd8ee18c4def
Author: Cheng Pan <[email protected]>
AuthorDate: Fri Aug 11 21:57:21 2023 +0800

    [CELEBORN-887] Option --config should take effect in celeborn-daemon.sh 
script
    
    ### What changes were proposed in this pull request?
    I find a little difficult to use `celeborn-daemon.sh` to get instance 
status, so I polish the usage and fix --config load.
    
    ### Why are the changes needed?
    Ditto
    
    ### Does this PR introduce _any_ user-facing change?
    Polish the `celeborn-daemon.sh` usage
    
    ### How was this patch tested?
    Manually test.
    
    Closes #1805 from onebox-li/improve-script.
    
    Lead-authored-by: Cheng Pan <[email protected]>
    Co-authored-by: Leo Li <[email protected]>
    Signed-off-by: zky.zhoukeyong <[email protected]>
---
 sbin/celeborn-daemon.sh | 34 +++++++++++++++++++++-------------
 1 file changed, 21 insertions(+), 13 deletions(-)

diff --git a/sbin/celeborn-daemon.sh b/sbin/celeborn-daemon.sh
index fce71bb27..379562108 100755
--- a/sbin/celeborn-daemon.sh
+++ b/sbin/celeborn-daemon.sh
@@ -28,20 +28,23 @@
 #   CELEBORN_NO_DAEMONIZE   If set, will run the proposed command in the 
foreground. It will not output a PID file.
 ##
 
-usage="Usage: celeborn-daemon.sh [--config <conf-dir>] (start|stop|status) 
<celeborn-command> <celeborn-instance-number> <args...>"
+usage() {
+  echo "Usage: celeborn-daemon.sh [--config <conf-dir>] 
(start|stop|restart|status) <celeborn-class-name> <celeborn-instance-number> 
[args]"
+  echo ""
+  echo "Options:"
+  echo "  <conf-dir>                  Override CELEBORN_CONF_DIR"
+  echo "  <celeborn-class-name>       The main class name of the celeborn 
command to run"
+  echo "                              Example: 
org.apache.celeborn.service.deploy.master.Master for celeborn master"
+  echo "                                       
org.apache.celeborn.service.deploy.worker.Worker for celeborn worker"
+  echo "  <celeborn-instance-number>  The instance number of the celeborn 
command to run"
+}
 
 # if no args specified, show usage
 if [ $# -le 1 ]; then
-  echo $usage
+  usage
   exit 1
 fi
 
-if [ -z "${CELEBORN_HOME}" ]; then
-  export CELEBORN_HOME="$(cd "`dirname "$0"`"/..; pwd)"
-fi
-
-. "${CELEBORN_HOME}/sbin/load-celeborn-env.sh"
-
 # get arguments
 
 # Check if --config is passed as an argument. It is an optional parameter.
@@ -54,7 +57,7 @@ then
   if [ ! -d "$conf_dir" ]
   then
     echo "ERROR : $conf_dir is not a directory"
-    echo $usage
+    usage
     exit 1
   else
     export CELEBORN_CONF_DIR="$conf_dir"
@@ -69,8 +72,13 @@ shift
 instance=$1
 shift
 
-celeborn_rotate_log ()
-{
+if [ -z "${CELEBORN_HOME}" ]; then
+  export CELEBORN_HOME="$(cd "`dirname "$0"`"/..; pwd)"
+fi
+
+. "${CELEBORN_HOME}/sbin/load-celeborn-env.sh"
+
+celeborn_rotate_log() {
     log=$1;
     num=5;
     if [ -n "$2" ]; then
@@ -192,7 +200,7 @@ case $option in
         do
           sleep 1s
           ((wait_time++))
-          echo "waiting for worker graceful shutdown, wait for ${wait_time}s"
+          echo "waiting for server shutdown, wait for ${wait_time}s"
         done
         if [[ $(ps -p "$TARGET_ID" -o comm=) == "" ]]; then
           run_command class "$@"
@@ -228,7 +236,7 @@ case $option in
     ;;
 
   (*)
-    echo $usage
+    usage
     exit 1
     ;;
 

Reply via email to