Commit d577dbc1 authored by 张彦钊's avatar 张彦钊

change test file

parent 2412d089
......@@ -37,8 +37,8 @@ def Json(x):
#rdd transform
def model(rdd):
try:
rdd = rdd.filter(lambda x:Json(x)).repartition(10).map(lambda x:get_data(x))
# .repartition(10)
rdd = rdd.filter(lambda x:Json(x)).repartition(10).map(lambda x:get_data(x).na.drop().groupByKey())\
.map(lambda x:write_redis(x[0],x[1]))
return rdd
except:
print("fail")
......@@ -81,6 +81,7 @@ def write_redis(device_id,cid_list):
else:
r.set(key, json.dumps(cids))
r.expire(key, 7*24*60*60)
return "good"
except Exception as e:
print("insert redis fail")
print(e)
......
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