diff --git a/ops/ad_produce.py b/ops/ad_produce.py index a474a1a..64c8fb4 100644 --- a/ops/ad_produce.py +++ b/ops/ad_produce.py @@ -64,6 +64,7 @@ def sadd_adkey(key, line): def produce_task(): # log.info("start produce cache !") now = datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%S") + run_status = 1 all = [] get_data_sql = f"""select id, @@ -116,6 +117,7 @@ def produce_task(): item['ad_property'].update(temp) item['ad_property'] = json.dumps(item['ad_property']) except Exception: + run_status = 0 log.error(f"write {item}", exc_info=True) all.append(item) except Exception: @@ -154,4 +156,9 @@ def produce_task(): log.error(f"get ad_num from mysql failed! ad_num={line['ad_num']}") except Exception: log.error(f"split {line} failed!", exc_info=True) + run_status = 0 log.info(f"produce {len(all)} 2 redis!") #log.info("end produce cache!") + my_redis.set("ad_produce", run_status) + now = datetime.datetime.now() + timestamp = datetime.datetime.timestamp(now) + my_redis.set("ad_produce_time", timestamp)