edits based on knusbaum
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/0f774026 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/0f774026 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/0f774026 Branch: refs/heads/master Commit: 0f774026af15798ab4cb482704911a782cb62b9b Parents: c9421cd Author: Boyang Jerry Peng <[email protected]> Authored: Thu Feb 11 16:47:50 2016 -0600 Committer: Boyang Jerry Peng <[email protected]> Committed: Fri Feb 12 10:57:14 2016 -0600 ---------------------------------------------------------------------- .../src/clj/org/apache/storm/daemon/supervisor.clj | 12 ++++++------ .../storm/container/cgroup/CgroupManager.java | 2 +- .../storm/container/cgroup/CgroupOperation.java | 3 ++- .../apache/storm/container/cgroup/CgroupUtils.java | 17 ++++++++--------- .../test/clj/org/apache/storm/supervisor_test.clj | 2 +- 5 files changed, 18 insertions(+), 18 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/0f774026/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj ---------------------------------------------------------------------- diff --git a/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj b/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj index 8680f20..cb6bafc 100644 --- a/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj +++ b/storm-core/src/clj/org/apache/storm/daemon/supervisor.clj @@ -310,7 +310,7 @@ (log-debug "Removing path " path) (.delete (File. path)) (catch Exception e))))) ;; on windows, the supervisor may still holds the lock on the worker directory - (try-cleanup-worker conf id)) + (try-cleanup-worker conf supervisor id)) (log-message "Shut down " (:supervisor-id supervisor) ":" id)) (def SUPERVISOR-ZK-ACLS @@ -354,11 +354,11 @@ :download-lock (Object.) :stormid->profiler-actions (atom {}) :resource-isolation-manager (if (conf STORM-RESOURCE-ISOLATION-PLUGIN-ENABLE) - (let [resource-isolation-manager (Utils/newInstance (conf STORM-RESOURCE-ISOLATION-PLUGIN))] - (.prepare resource-isolation-manager conf) - (log-message "Using resource isolation plugin " (conf STORM-RESOURCE-ISOLATION-PLUGIN)) - resource-isolation-manager) - nil) + (let [resource-isolation-manager (Utils/newInstance (conf STORM-RESOURCE-ISOLATION-PLUGIN))] + (.prepare resource-isolation-manager conf) + (log-message "Using resource isolation plugin " (conf STORM-RESOURCE-ISOLATION-PLUGIN)) + resource-isolation-manager) + nil) }) (defn required-topo-files-exist? http://git-wip-us.apache.org/repos/asf/storm/blob/0f774026/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupManager.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupManager.java b/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupManager.java index 8b775be..875474a 100644 --- a/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupManager.java +++ b/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupManager.java @@ -103,7 +103,7 @@ public class CgroupManager implements ResourceIsolationInterface { } /** - * User cfs_period & cfs_quota to control the upper limit use of cpu core e.g. + * Use cfs_period & cfs_quota to control the upper limit use of cpu core e.g. * If making a process to fully use two cpu cores, set cfs_period_us to * 100000 and set cfs_quota_us to 200000 */ http://git-wip-us.apache.org/repos/asf/storm/blob/0f774026/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupOperation.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupOperation.java b/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupOperation.java index 3626d04..00ac9fd 100755 --- a/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupOperation.java +++ b/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupOperation.java @@ -22,7 +22,8 @@ import java.util.List; import java.util.Set; /** - * An interface to manage cgroups + * An interface to implement the basic functions to manage cgroups such as mount and mounting a hiearchy + * and creating cgroups. Also contains functions to access basic information of cgroups. */ public interface CgroupOperation { http://git-wip-us.apache.org/repos/asf/storm/blob/0f774026/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupUtils.java ---------------------------------------------------------------------- diff --git a/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupUtils.java b/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupUtils.java index c41b491..5a4744c 100644 --- a/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupUtils.java +++ b/storm-core/src/jvm/org/apache/storm/container/cgroup/CgroupUtils.java @@ -41,16 +41,15 @@ public class CgroupUtils { public static void deleteDir(String dir) { File d = new File(dir); - if (d.exists()) { - if (d.isDirectory()) { - if (!d.delete()) { - throw new RuntimeException("Cannot delete dir " + dir); - } - } else { - throw new RuntimeException("dir " + dir + " is not a directory!"); - } - } else { + if (!d.exists()) { LOG.warn("dir {} does not exist!", dir); + return; + } + if (!d.isDirectory()) { + throw new RuntimeException("dir " + dir + " is not a directory!"); + } + if (!d.delete()) { + throw new RuntimeException("Cannot delete dir " + dir); } } http://git-wip-us.apache.org/repos/asf/storm/blob/0f774026/storm-core/test/clj/org/apache/storm/supervisor_test.clj ---------------------------------------------------------------------- diff --git a/storm-core/test/clj/org/apache/storm/supervisor_test.clj b/storm-core/test/clj/org/apache/storm/supervisor_test.clj index a7c6b5a..956abe8 100644 --- a/storm-core/test/clj/org/apache/storm/supervisor_test.clj +++ b/storm-core/test/clj/org/apache/storm/supervisor_test.clj @@ -400,7 +400,7 @@ (Matchers/any) (Matchers/any) (Matchers/any))))))) - + (testing "testing topology.classpath is added to classpath" (let [topo-cp (str Utils/FILE_PATH_SEPARATOR "any" Utils/FILE_PATH_SEPARATOR "path") exp-args (exp-args-fn [] [] (Utils/addToClasspath mock-cp [topo-cp]))
