|
63 | 63 | (with-local-cluster [cluster :supervisors 4]
|
64 | 64 | (let [nimbus (:nimbus cluster)
|
65 | 65 | topology (thrift/mk-topology
|
66 |
| - {1 (thrift/mk-spout-spec (TestWordSpout. false))} |
67 |
| - {2 (thrift/mk-shell-bolt-spec {1 :shuffle} "python" "tester.py" ["word"] :parallelism-hint 1)} |
| 66 | + {"1" (thrift/mk-spout-spec (TestWordSpout. false))} |
| 67 | + {"2" (thrift/mk-shell-bolt-spec {"1" :shuffle} "python" "tester.py" ["word"] :parallelism-hint 1)} |
68 | 68 | )]
|
69 | 69 | (submit-local-topology nimbus
|
70 | 70 | "test"
|
|
81 | 81 | (with-simulated-time-local-cluster [cluster :supervisors 4
|
82 | 82 | :daemon-conf {STORM-LOCAL-MODE-ZMQ zmq-on?}]
|
83 | 83 | (let [topology (thrift/mk-topology
|
84 |
| - {1 (thrift/mk-spout-spec (TestWordSpout. true) :parallelism-hint 3)} |
85 |
| - {2 (thrift/mk-bolt-spec {1 ["word"]} (TestWordCounter.) :parallelism-hint 4) |
86 |
| - 3 (thrift/mk-bolt-spec {1 :global} (TestGlobalCount.)) |
87 |
| - 4 (thrift/mk-bolt-spec {2 :global} (TestAggregatesCounter.)) |
| 84 | + {"1" (thrift/mk-spout-spec (TestWordSpout. true) :parallelism-hint 3)} |
| 85 | + {"2" (thrift/mk-bolt-spec {"1" ["word"]} (TestWordCounter.) :parallelism-hint 4) |
| 86 | + "3" (thrift/mk-bolt-spec {"1" :global} (TestGlobalCount.)) |
| 87 | + "4" (thrift/mk-bolt-spec {"2" :global} (TestAggregatesCounter.)) |
88 | 88 | })
|
89 | 89 | results (complete-topology cluster
|
90 | 90 | topology
|
91 |
| - :mock-sources {1 [["nathan"] ["bob"] ["joey"] ["nathan"]]} |
| 91 | + :mock-sources {"1" [["nathan"] ["bob"] ["joey"] ["nathan"]]} |
92 | 92 | :storm-conf {TOPOLOGY-DEBUG true
|
93 | 93 | TOPOLOGY-WORKERS 2})]
|
94 | 94 | (is (ms= [["nathan"] ["bob"] ["joey"] ["nathan"]]
|
95 |
| - (read-tuples results 1))) |
| 95 | + (read-tuples results "1"))) |
96 | 96 | (is (ms= [["nathan" 1] ["nathan" 2] ["bob" 1] ["joey" 1]]
|
97 |
| - (read-tuples results 2))) |
| 97 | + (read-tuples results "2"))) |
98 | 98 | (is (= [[1] [2] [3] [4]]
|
99 |
| - (read-tuples results 3))) |
| 99 | + (read-tuples results "3"))) |
100 | 100 | (is (= [[1] [2] [3] [4]]
|
101 |
| - (read-tuples results 4))) |
| 101 | + (read-tuples results "4"))) |
102 | 102 | ))))
|
103 | 103 |
|
104 | 104 | (deftest test-shuffle
|
105 | 105 | (with-simulated-time-local-cluster [cluster :supervisors 4]
|
106 | 106 | (let [topology (thrift/mk-topology
|
107 |
| - {1 (thrift/mk-spout-spec (TestWordSpout. true) :parallelism-hint 4)} |
108 |
| - {2 (thrift/mk-bolt-spec {1 :shuffle} (TestGlobalCount.) |
| 107 | + {"1" (thrift/mk-spout-spec (TestWordSpout. true) :parallelism-hint 4)} |
| 108 | + {"2" (thrift/mk-bolt-spec {"1" :shuffle} (TestGlobalCount.) |
109 | 109 | :parallelism-hint 6)
|
110 | 110 | })
|
111 | 111 | results (complete-topology cluster
|
112 | 112 | topology
|
113 | 113 | ;; important for test that
|
114 | 114 | ;; #tuples = multiple of 4 and 6
|
115 |
| - :mock-sources {1 [["a"] ["b"] |
| 115 | + :mock-sources {"1" [["a"] ["b"] |
116 | 116 | ["a"] ["b"]
|
117 | 117 | ["a"] ["b"]
|
118 | 118 | ["a"] ["b"]
|
|
127 | 127 | ]}
|
128 | 128 | )]
|
129 | 129 | (is (ms= (apply concat (repeat 6 [[1] [2] [3] [4]]))
|
130 |
| - (read-tuples results 2))) |
| 130 | + (read-tuples results "2"))) |
131 | 131 | )))
|
132 | 132 |
|
133 | 133 | (defbolt lalala-bolt1 ["word"] [tuple collector]
|
|
165 | 165 | (with-simulated-time-local-cluster [cluster :supervisors 4]
|
166 | 166 | (let [nimbus (:nimbus cluster)
|
167 | 167 | topology (thrift/mk-topology
|
168 |
| - {1 (thrift/mk-spout-spec (TestWordSpout. false))} |
169 |
| - {2 (thrift/mk-bolt-spec {1 :shuffle} |
| 168 | + {"1" (thrift/mk-spout-spec (TestWordSpout. false))} |
| 169 | + {"2" (thrift/mk-bolt-spec {"1" :shuffle} |
170 | 170 | lalala-bolt1)
|
171 |
| - 3 (thrift/mk-bolt-spec {1 :shuffle} |
| 171 | + "3" (thrift/mk-bolt-spec {"1" :shuffle} |
172 | 172 | lalala-bolt2)
|
173 |
| - 4 (thrift/mk-bolt-spec {1 :shuffle} |
| 173 | + "4" (thrift/mk-bolt-spec {"1" :shuffle} |
174 | 174 | (lalala-bolt3 "_nathan_"))}
|
175 | 175 | )
|
176 | 176 | results (complete-topology cluster
|
177 | 177 | topology
|
178 |
| - :mock-sources {1 [["david"] |
| 178 | + :mock-sources {"1" [["david"] |
179 | 179 | ["adam"]
|
180 | 180 | ]}
|
181 | 181 | )]
|
182 |
| - (is (ms= [["davidlalala"] ["adamlalala"]] (read-tuples results 2))) |
183 |
| - (is (ms= [["davidlalala"] ["adamlalala"]] (read-tuples results 3))) |
184 |
| - (is (ms= [["david_nathan_lalala"] ["adam_nathan_lalala"]] (read-tuples results 4))) |
| 182 | + (is (ms= [["davidlalala"] ["adamlalala"]] (read-tuples results "2"))) |
| 183 | + (is (ms= [["davidlalala"] ["adamlalala"]] (read-tuples results "3"))) |
| 184 | + (is (ms= [["david_nathan_lalala"] ["adam_nathan_lalala"]] (read-tuples results "4"))) |
185 | 185 | )))
|
186 | 186 |
|
187 | 187 | (defn ack-tracking-feeder [fields]
|
|
230 | 230 | [feeder2 checker2] (ack-tracking-feeder ["num"])
|
231 | 231 | [feeder3 checker3] (ack-tracking-feeder ["num"])
|
232 | 232 | tracked (mk-tracked-topology
|
233 |
| - {1 [feeder1] |
234 |
| - 2 [feeder2] |
235 |
| - 3 [feeder3]} |
236 |
| - {4 [{1 :shuffle} (branching-bolt 2)] |
237 |
| - 5 [{2 :shuffle} (branching-bolt 4)] |
238 |
| - 6 [{3 :shuffle} (branching-bolt 1)] |
239 |
| - 7 [{4 :shuffle |
240 |
| - 5 :shuffle |
241 |
| - 6 :shuffle} (agg-bolt 3)] |
242 |
| - 8 [{7 :shuffle} (branching-bolt 2)] |
243 |
| - 9 [{8 :shuffle} ack-bolt]} |
| 233 | + {"1" [feeder1] |
| 234 | + "2" [feeder2] |
| 235 | + "3" [feeder3]} |
| 236 | + {"4" [{"1" :shuffle} (branching-bolt 2)] |
| 237 | + "5" [{"2" :shuffle} (branching-bolt 4)] |
| 238 | + "6" [{"3" :shuffle} (branching-bolt 1)] |
| 239 | + "7" [{"4" :shuffle |
| 240 | + "5" :shuffle |
| 241 | + "6" :shuffle} (agg-bolt 3)] |
| 242 | + "8" [{"7" :shuffle} (branching-bolt 2)] |
| 243 | + "9" [{"8" :shuffle} ack-bolt]} |
244 | 244 | )]
|
245 | 245 | (submit-local-topology (:nimbus cluster)
|
246 | 246 | "test"
|
|
275 | 275 | (with-tracked-cluster [cluster]
|
276 | 276 | (let [[feeder checker] (ack-tracking-feeder ["num"])
|
277 | 277 | tracked (mk-tracked-topology
|
278 |
| - {1 [feeder]} |
279 |
| - {2 [{1 :shuffle} identity-bolt] |
280 |
| - 3 [{1 :shuffle} identity-bolt] |
281 |
| - 4 [{2 :shuffle |
282 |
| - 3 :shuffle} (agg-bolt 4)]})] |
| 278 | + {"1" [feeder]} |
| 279 | + {"2" [{"1" :shuffle} identity-bolt] |
| 280 | + "3" [{"1" :shuffle} identity-bolt] |
| 281 | + "4" [{"2" :shuffle |
| 282 | + "3" :shuffle} (agg-bolt 4)]})] |
283 | 283 | (submit-local-topology (:nimbus cluster)
|
284 | 284 | "test"
|
285 | 285 | {}
|
|
301 | 301 | (with-tracked-cluster [cluster]
|
302 | 302 | (let [[feeder checker] (ack-tracking-feeder ["num"])
|
303 | 303 | tracked (mk-tracked-topology
|
304 |
| - {1 [feeder]} |
305 |
| - {2 [{1 :shuffle} dup-anchor] |
306 |
| - 3 [{2 :shuffle} ack-bolt]})] |
| 304 | + {"1" [feeder]} |
| 305 | + {"2" [{"1" :shuffle} dup-anchor] |
| 306 | + "3" [{"2" :shuffle} ack-bolt]})] |
307 | 307 | (submit-local-topology (:nimbus cluster)
|
308 | 308 | "test"
|
309 | 309 | {}
|
|
0 commit comments