Commit 71e42e09 authored by 赵威's avatar 赵威

send email

parent 020e8d40
...@@ -8,7 +8,7 @@ import redis ...@@ -8,7 +8,7 @@ import redis
from pyspark import SparkConf from pyspark import SparkConf
from pyspark.sql import SparkSession from pyspark.sql import SparkSession
from tool import get_jerry_test, get_tag3_user_log, write_user_portrait from tool import (get_jerry_test, get_tag3_user_log, send_email, write_user_portrait)
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}] # [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}]
...@@ -114,6 +114,7 @@ def consume_kafka(): ...@@ -114,6 +114,7 @@ def consume_kafka():
.set("spark.driver.maxResultSize", "8g") \ .set("spark.driver.maxResultSize", "8g") \
.set("spark.sql.avro.compression.codec", "snappy") .set("spark.sql.avro.compression.codec", "snappy")
try:
spark = SparkSession.builder.config(conf=sparkConf).enableHiveSupport().getOrCreate() spark = SparkSession.builder.config(conf=sparkConf).enableHiveSupport().getOrCreate()
spark.sparkContext.setLogLevel("WARN") spark.sparkContext.setLogLevel("WARN")
spark.sparkContext.addPyFile("/srv/apps/ffm-baseline_git/eda/smart_rank/tool.py") spark.sparkContext.addPyFile("/srv/apps/ffm-baseline_git/eda/smart_rank/tool.py")
...@@ -123,6 +124,8 @@ def consume_kafka(): ...@@ -123,6 +124,8 @@ def consume_kafka():
# result.foreach(print) # result.foreach(print)
result.collect() result.collect()
spark.stop() spark.stop()
except Exception as e:
send_email("tag3_update_user_portrait_offline", "tag3_update_user_portrait_offline", 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