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

    https://github.com/apache/storm/pull/1199#discussion_r55765520
  
    --- Diff: 
storm-core/test/clj/integration/org/apache/storm/trident/integration_test.clj 
---
    @@ -281,6 +285,86 @@
                             (.stateQuery word-counts (fields "word1") 
(MapGet.) (fields "count"))))))
          )))
     
    +
    +(deftest test-set-component-resources
    +  (t/with-local-cluster [cluster]
    +    (with-drpc [drpc]
    +      (letlocals
    +        (bind topo (TridentTopology.))
    +        (bind feeder (feeder-spout ["sentence"]))
    +        (bind add-bang (proxy [BaseFunction] []
    +                         (execute [tuple collector]
    +                           (. collector emit (str (. tuple getString 0) 
"!")))))
    +        (bind word-counts
    +          (.. topo
    +              (newStream "words" feeder)
    +              (parallelismHint 5)
    +              (setCPULoad 20)
    +              (setMemoryLoad 512 256)
    +              (each (fields "sentence") (Split.) (fields "word"))
    +              (setCPULoad 10)
    +              (setMemoryLoad 512)
    +              (each (fields "word") add-bang (fields "word!"))
    +              (parallelismHint 10)
    +              (setCPULoad 50)
    +              (setMemoryLoad 1024)
    +              (groupBy (fields "word!"))
    +              (persistentAggregate (memory-map-state) (Count.) (fields 
"count"))
    +              (setCPULoad 100)
    +              (setMemoryLoad 2048)))
    +        (with-topology [cluster topo storm-topo]
    +;          (log-message "\n")
    +;          (log-message "Getting json confs from bolts:")
    +;;          (log-message "Bolts: " (. storm-topo get_bolts) "(" (. 
storm-topo get_bolts_size) ")")
    +;          (doall (map (fn [[k v]] (log-message k ":" (.. v get_common 
get_json_conf))) (. storm-topo get_bolts)))
    +
    +          (let [parse-fn (fn [[k v]]
    +                           [k (clojurify-structure (. (JSONParser.) parse 
(.. v get_common get_json_conf)))])
    +                json-confs (into {} (map parse-fn (. storm-topo 
get_bolts)))]
    +            (testing "spout memory"
    +              (is (= (-> (json-confs "spout-words")
    +                         (get 
TOPOLOGY-COMPONENT-RESOURCES-ONHEAP-MEMORY-MB))
    +                     512.0))
    +
    +              (is (= (-> (json-confs "spout-words")
    +                         (get 
TOPOLOGY-COMPONENT-RESOURCES-OFFHEAP-MEMORY-MB))
    +                   256.0))
    +
    +              (is (= (-> (json-confs "$spoutcoord-spout-words")
    +                         (get 
TOPOLOGY-COMPONENT-RESOURCES-ONHEAP-MEMORY-MB))
    +                     512.0))
    +
    +              (is (= (-> (json-confs "$spoutcoord-spout-words")
    +                         (get 
TOPOLOGY-COMPONENT-RESOURCES-OFFHEAP-MEMORY-MB))
    +                     256.0)))
    +
    +            (testing "spout CPU"
    +              (is (= (-> (json-confs "spout-words")
    +                         (get TOPOLOGY-COMPONENT-CPU-PCORE-PERCENT))
    +                     20.0))
    +
    +              (is (= (-> (json-confs "$spoutcoord-spout-words")
    +                       (get TOPOLOGY-COMPONENT-CPU-PCORE-PERCENT))
    +                     20.0)))
    +
    +            (testing "bolt combinations"
    +              (is (= (-> (json-confs "b-1")
    +                         (get 
TOPOLOGY-COMPONENT-RESOURCES-ONHEAP-MEMORY-MB))
    +                     1536.0))
    --- End diff --
    
    can you put a comment on how this number of calculated (i.e. 1024 + 512)


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to