Skip to content

Commit ac3f9eb

Browse files
author
Nathan Marz
committed
added test of changing parallelism of workers and/or executors with rebalance
1 parent 365eaeb commit ac3f9eb

File tree

1 file changed

+56
-0
lines changed

1 file changed

+56
-0
lines changed

test/clj/backtype/storm/nimbus_test.clj

+56
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,62 @@
480480
))))
481481
)))
482482

483+
(deftest test-rebalance-change-parallelism
484+
(with-simulated-time-local-cluster [cluster :supervisors 4 :ports-per-supervisor 3
485+
:daemon-conf {SUPERVISOR-ENABLE false
486+
NIMBUS-MONITOR-FREQ-SECS 10
487+
TOPOLOGY-ACKER-EXECUTORS 0}]
488+
(letlocals
489+
(bind topology (thrift/mk-topology
490+
{"1" (thrift/mk-spout-spec (TestPlannerSpout. true)
491+
:parallelism-hint 6
492+
:conf {TOPOLOGY-TASKS 12})}
493+
{}))
494+
(bind state (:storm-cluster-state cluster))
495+
(submit-local-topology (:nimbus cluster)
496+
"test"
497+
{TOPOLOGY-WORKERS 3
498+
TOPOLOGY-MESSAGE-TIMEOUT-SECS 30} topology)
499+
(bind storm-id (get-storm-id state "test"))
500+
(bind checker (fn [distribution]
501+
(check-executor-distribution
502+
(slot-assignments cluster storm-id)
503+
distribution)))
504+
(checker [2 2 2])
505+
506+
(.rebalance (:nimbus cluster) "test"
507+
(doto (RebalanceOptions.)
508+
(.set_num_workers 6)
509+
))
510+
(advance-cluster-time cluster 29)
511+
(checker [2 2 2])
512+
(advance-cluster-time cluster 3)
513+
(checker [1 1 1 1 1 1])
514+
515+
(.rebalance (:nimbus cluster) "test"
516+
(doto (RebalanceOptions.)
517+
(.set_num_executors {"1" 1})
518+
))
519+
(advance-cluster-time cluster 29)
520+
(checker [1 1 1 1 1 1])
521+
(advance-cluster-time cluster 3)
522+
(checker [1])
523+
524+
(.rebalance (:nimbus cluster) "test"
525+
(doto (RebalanceOptions.)
526+
(.set_num_executors {"1" 8})
527+
(.set_num_workers 4)
528+
))
529+
(advance-cluster-time cluster 32)
530+
(checker [2 2 2 2])
531+
(check-consistency cluster "test")
532+
533+
(bind executor-info (->> (storm-component->executor-info cluster "test")
534+
(map-val #(map executor-id->tasks %))))
535+
(check-distribution (executor-info "1") [2 2 2 2 1 1 1 1])
536+
537+
)))
538+
483539
(deftest test-submit-invalid
484540
(with-simulated-time-local-cluster [cluster
485541
:daemon-conf {SUPERVISOR-ENABLE false

0 commit comments

Comments
 (0)