Commit 8d037651 authored by 张彦钊's avatar 张彦钊

change test file

parent f11d3e62
...@@ -85,7 +85,8 @@ def write_redis(device_id,cid_list): ...@@ -85,7 +85,8 @@ def write_redis(device_id,cid_list):
cids = json.dumps(list(set(eval(r.get(key)).extend(cids)))) cids = json.dumps(list(set(eval(r.get(key)).extend(cids))))
r.set(key, json.dumps(cids)) r.set(key, json.dumps(cids))
except e:
except Exception as e:
print("insert redis fail") print("insert redis fail")
print(e) print(e)
...@@ -94,8 +95,9 @@ def model(rdd): ...@@ -94,8 +95,9 @@ def model(rdd):
try: try:
rdd.repartition(10).filter(lambda x: maidian(x)).map(lambda x:get_data(x)).na.drop().\ rdd.repartition(10).filter(lambda x: maidian(x)).map(lambda x:get_data(x)).na.drop().\
groupByKey().map(lambda x,y:write_redis(x,y)) groupByKey().map(lambda x,y:write_redis(x,y))
except: except Exception as e:
print("fail") print("fail")
print(e)
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -63,7 +63,7 @@ def write_redis(device_id,cid_list): ...@@ -63,7 +63,7 @@ def write_redis(device_id,cid_list):
cids = json.dumps(list(set(eval(r.get(key)).extend(cids)))) cids = json.dumps(list(set(eval(r.get(key)).extend(cids))))
r.set(key, json.dumps(cids)) r.set(key, json.dumps(cids))
except e: except Exception as e:
print("insert redis fail") print("insert redis fail")
print(e) print(e)
if __name__ == '__main__': if __name__ == '__main__':
......
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