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

    https://github.com/apache/storm/pull/921#discussion_r47691204
  
    --- Diff: storm-core/src/clj/backtype/storm/daemon/nimbus.clj ---
    @@ -540,12 +540,16 @@
             topology (read-storm-topology-as-nimbus storm-id blob-store)
             executor->component (->> (compute-executor->component nimbus 
storm-id)
                                      (map-key (fn [[start-task end-task]]
    -                                            (ExecutorDetails. (int 
start-task) (int end-task)))))]
    +                                            (ExecutorDetails. (int 
start-task) (int end-task)))))
    +        launch-time-secs (if storm-base (:launch-time-secs storm-base)
    +                           (throw
    +                             (NotAliveException. (str storm-id))))]
    --- End diff --
    
    We can throw the NotAliveException as soon as we know `storm-base` is 
`nil`, something like:
    
    ```Clojure
    (defn read-topology-details [nimbus storm-id]
      (let [blob-store (:blob-store nimbus)
            storm-base (or
                         (.storm-base (:storm-cluster-state nimbus) storm-id 
nil)
                         (throw (NotAliveException. storm-id)))
            topology-conf (read-storm-conf-as-nimbus storm-id blob-store)
            topology (read-storm-topology-as-nimbus storm-id blob-store)
            executor->component (->> (compute-executor->component nimbus 
storm-id)
                                     (map-key (fn [[start-task end-task]]
                                                (ExecutorDetails. (int 
start-task) (int end-task)))))]
        (TopologyDetails. storm-id
                          topology-conf
                          topology
                          (:num-workers storm-base)
                          executor->component
                          (:launch-time-secs storm-base))))
    ```
    
    This way we shortcut out of doing the extra work.
    
    The snippet above also removes the unused binding for `conf`.



---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to