Commit 36a30fc9 authored by 张彦钊's avatar 张彦钊

change test file

parent f1b94ff6
...@@ -126,7 +126,8 @@ def group_redis(device_id,cid_list): ...@@ -126,7 +126,8 @@ def group_redis(device_id,cid_list):
def group_write(rdd): def group_write(rdd):
return rdd.groupByKey().map(lambda x: x[0]).collect() rdd.groupByKey().foreachPartition(group_redis)
return "good"
...@@ -144,6 +145,6 @@ kafkaParams = {"metadata.broker.list": "172.16.44.25:9092,172.16.44.31:9092,172. ...@@ -144,6 +145,6 @@ kafkaParams = {"metadata.broker.list": "172.16.44.25:9092,172.16.44.31:9092,172.
stream = KafkaUtils.createDirectStream(ssc, ["gm-maidian-data"], kafkaParams) stream = KafkaUtils.createDirectStream(ssc, ["gm-maidian-data"], kafkaParams)
transformstream = stream.transform(lambda x:model(x)).foreachRDD(group_write) transformstream = stream.transform(lambda x:model(x)).foreachRDD(group_write)
# transformstream.pprint() # transformstream.pprint()
print(transformstream) # print(transformstream)
ssc.start() ssc.start()
ssc.awaitTermination() ssc.awaitTermination()
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment