You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@linkis.apache.org by pe...@apache.org on 2022/06/26 09:00:30 UTC

[incubator-linkis] branch dev-1.2.0 updated: [feat][Deployment] support waiting for entrance service to offline (#2317)

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

peacewong pushed a commit to branch dev-1.2.0
in repository https://gitbox.apache.org/repos/asf/incubator-linkis.git


The following commit(s) were added to refs/heads/dev-1.2.0 by this push:
     new 58c10c6b7 [feat][Deployment] support waiting for entrance service to offline (#2317)
58c10c6b7 is described below

commit 58c10c6b7f4c47e35782c0cdcbe7b4d7bee53224
Author: legendtkl <ta...@gmail.com>
AuthorDate: Sun Jun 26 17:00:24 2022 +0800

    [feat][Deployment] support waiting for entrance service to offline (#2317)
---
 .../assembly-combined/sbin/graceful-upgrade.sh      | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/assembly-combined-package/assembly-combined/sbin/graceful-upgrade.sh b/assembly-combined-package/assembly-combined/sbin/graceful-upgrade.sh
index 19e13c2b9..d5c2ddd48 100755
--- a/assembly-combined-package/assembly-combined/sbin/graceful-upgrade.sh
+++ b/assembly-combined-package/assembly-combined/sbin/graceful-upgrade.sh
@@ -96,8 +96,25 @@ IP=$2
 getPort
 echo $SERVER_PORT
 
+if [ "$SERVER_NAME" = "cg-entrance" ]; then
+  # mark entrance as offline
+  markOfflineUrl=$IP:$SERVER_PORT/api/rest_j/v1/entrance/operation/label/markoffline
+  curl "$markOfflineUrl"
+
+  # waiting the running tasks to finish
+  while :
+  do
+    metricUrl=$IP:$SERVER_PORT/api/rest_j/v1/entrance/operation/metrics/runningtask
+    res=`curl $metricUrl`
+    runningTaksNum=`jq ".data.runningTaskNumber" res`
+    if [ "$runningTaksNum" = "0" ]; then
+      break
+    fi
+    sleep 30s
+  done
+fi
+
 offlineUrl=$IP:$SERVER_PORT/api/rest_j/v1/offline
 echo "Begin to offline $SERVER_NAME with curl $offlineUrl"
-curl $offlineUrl
-
+curl "$offlineUrl"
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@linkis.apache.org
For additional commands, e-mail: commits-help@linkis.apache.org