Commit 1d40d754 authored by 高雅喆's avatar 高雅喆

update

parent c28f89fe
...@@ -142,10 +142,11 @@ if __name__ == '__main__': ...@@ -142,10 +142,11 @@ if __name__ == '__main__':
device_ids_lst_rdd = spark.sparkContext.parallelize(device_ids_lst) device_ids_lst_rdd = spark.sparkContext.parallelize(device_ids_lst)
gm_kv_cli = redis.Redis(host="172.16.40.135", port=5379, db=6, socket_timeout=2000) gm_kv_cli = redis.Redis(host="172.16.40.135", port=5379, db=6, socket_timeout=2000)
result = device_ids_lst_rdd.repartition(100).map(lambda x: get_user_tag_score(x, all_log_df)).toDF("cl_id","tag_list") result = device_ids_lst_rdd.repartition(100).map(lambda x: get_user_tag_score(x, all_log_df)).toDF()
stat_date = datetime.datetime.today().strftime('%Y-%m-%d') result.show()
result_last = result.withColumn("stat_date", lit(stat_date)) # stat_date = datetime.datetime.today().strftime('%Y-%m-%d')
result_last.show() # result_last = result.withColumn("stat_date", lit(stat_date))
# result_last.show()
# result_last.write.format("jdbc").options( # result_last.write.format("jdbc").options(
# url='jdbc:mysql://172.16.40.158/jerry_test', # url='jdbc:mysql://172.16.40.158/jerry_test',
# driver='com.mysql.jdbc.Driver', # driver='com.mysql.jdbc.Driver',
......
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