You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@storm.apache.org by d2r <gi...@git.apache.org> on 2014/06/12 23:52:33 UTC

[GitHub] incubator-storm pull request: STORM-132 sort supervisor by free sl...

Github user d2r commented on a diff in the pull request:

    https://github.com/apache/incubator-storm/pull/36#discussion_r13728675
  
    --- Diff: storm-core/src/clj/backtype/storm/scheduler/EvenScheduler.clj ---
    @@ -22,7 +22,12 @@
         :implements [backtype.storm.scheduler.IScheduler]))
     
     (defn sort-slots [all-slots]
    -  (let [split-up (vals (group-by first all-slots))]
    +  (let [split-up
    +         (map second
    +           (reverse
    +             (sort
    +               (for [[host ports] (group-by first all-slots)]
    +                 [(count ports) ports]))))]
    --- End diff --
    
    Could we do something like this?
    ```
    (sort #(> (count %1) (count %2)) (vals (group-by first all-slots)))
    ```
    It would be nice to move this into its own function, so we can write a quick unit test for it.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---