[ https://issues.apache.org/jira/browse/STORM-1616?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15190147#comment-15190147 ]
ASF GitHub Bot commented on STORM-1616: --------------------------------------- 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) > Add RAS API for Trident > ----------------------- > > Key: STORM-1616 > URL: https://issues.apache.org/jira/browse/STORM-1616 > Project: Apache Storm > Issue Type: Bug > Reporter: Kyle Nusbaum > Assignee: Kyle Nusbaum > -- This message was sent by Atlassian JIRA (v6.3.4#6332)