Commit 94338b4a authored by 张彦钊's avatar 张彦钊

change test file

parent 8ce75a7b
......@@ -22,13 +22,12 @@ import datetime
def gbk_decoder(s):
if s is None:
return None
else:
try:
data = msgpack.loads(s,encoding='utf-8')
return data
except:
data = json.loads(s)
return data
except Exception as e:
print(e)
return None
def maidian(x):
......@@ -97,8 +96,9 @@ def write_redis(device_id,cid_list):
def model(rdd):
try:
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))
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))
except Exception as e:
print("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