storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [3/6] storm git commit: STORM-657:make the shutdown-worker sleep time before kill -9 configurable
Date Wed, 11 Mar 2015 20:10:14 GMT
STORM-657:make the shutdown-worker sleep time before kill -9 configurable


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/b1c993b2
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/b1c993b2
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/b1c993b2

Branch: refs/heads/master
Commit: b1c993b288385f637fa26b840a11532c7b60a6c7
Parents: d8c98cb
Author: caofangkun <caofangkun@gmail.com>
Authored: Mon Feb 9 13:23:23 2015 +0800
Committer: caofangkun <caofangkun@gmail.com>
Committed: Mon Feb 9 13:23:23 2015 +0800

----------------------------------------------------------------------
 conf/defaults.yaml                                      | 2 ++
 storm-core/src/clj/backtype/storm/daemon/supervisor.clj | 5 ++++-
 storm-core/src/jvm/backtype/storm/Config.java           | 6 ++++++
 3 files changed, 12 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/b1c993b2/conf/defaults.yaml
----------------------------------------------------------------------
diff --git a/conf/defaults.yaml b/conf/defaults.yaml
index 35d20ff..b5de229 100644
--- a/conf/defaults.yaml
+++ b/conf/defaults.yaml
@@ -117,6 +117,8 @@ supervisor.run.worker.as.user: false
 supervisor.worker.start.timeout.secs: 120
 #how long between heartbeats until supervisor considers that worker dead and tries to restart
it
 supervisor.worker.timeout.secs: 30
+#how many seconds to sleep for before shutting down threads on worker
+supervisor.worker.shutdown.sleep.secs: 1
 #how frequently the supervisor checks on the status of the processes it's monitoring and
restarts if necessary
 supervisor.monitor.frequency.secs: 3
 #how frequently the supervisor heartbeats to the cluster state (for nimbus)

http://git-wip-us.apache.org/repos/asf/storm/blob/b1c993b2/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/daemon/supervisor.clj b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
index a5d5aef..7764310 100644
--- a/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
+++ b/storm-core/src/clj/backtype/storm/daemon/supervisor.clj
@@ -249,6 +249,7 @@
   (let [conf (:conf supervisor)
         pids (read-dir-contents (worker-pids-root conf id))
         thread-pid (@(:worker-thread-pids-atom supervisor) id)
+        shutdown-sleep-secs (conf SUPERVISOR-WORKER-SHUTDOWN-SLEEP-SECS)
         as-user (conf SUPERVISOR-RUN-WORKER-AS-USER)
         user (get-worker-user conf id)]
     (when thread-pid
@@ -257,7 +258,9 @@
       (if as-user
         (worker-launcher-and-wait conf user ["signal" pid "9"] :log-prefix (str "kill -15
" pid))
         (kill-process-with-sig-term pid)))
-    (if-not (empty? pids) (sleep-secs 1)) ;; allow 1 second for execution of cleanup threads
on worker.
+    (if-not (empty? pids) (do 
+                            (log-message "Sleep " shutdown-sleep-secs " seconds for execution
of cleanup threads on worker.")
+                            (sleep-secs shutdown-sleep-secs)))
     (doseq [pid pids]
       (if as-user
         (worker-launcher-and-wait conf user ["signal" pid "9"] :log-prefix (str "kill -9
" pid))

http://git-wip-us.apache.org/repos/asf/storm/blob/b1c993b2/storm-core/src/jvm/backtype/storm/Config.java
----------------------------------------------------------------------
diff --git a/storm-core/src/jvm/backtype/storm/Config.java b/storm-core/src/jvm/backtype/storm/Config.java
index 73a1976..2462d4e 100644
--- a/storm-core/src/jvm/backtype/storm/Config.java
+++ b/storm-core/src/jvm/backtype/storm/Config.java
@@ -734,6 +734,12 @@ public class Config extends HashMap<String, Object> {
     public static final Object SUPERVISOR_WORKER_TIMEOUT_SECS_SCHEMA = ConfigValidation.IntegerValidator;
 
     /**
+     * How many seconds to sleep for before shutting down threads on worker
+     */
+    public static final String SUPERVISOR_WORKER_SHUTDOWN_SLEEP_SECS = "supervisor.worker.shutdown.sleep.secs";
+    public static final Object SUPERVISOR_WORKER_SHUTDOWN_SLEEP_SECS_SCHEMA = ConfigValidation.IntegerValidator;
+
+    /**
      * How long a worker can go without heartbeating during the initial launch before
      * the supervisor tries to restart the worker process. This value override
      * supervisor.worker.timeout.secs during launch because there is additional


Mime
View raw message