Commit 945dc687 authored by 唐香港's avatar 唐香港

Update airflow_heartbeat_detection.py

parent 5380ae20
......@@ -10,6 +10,10 @@ import os,logging
DINGDING = 'https://oapi.dingtalk.com/robot/send?access_token=dac084248b38ef564c30e7f7d0c3901f3967c8e5ffdb33efe188495d5b058fdd'
DING_PATH = '/opt/bitnami/airflow/dags/*/script/ding.sh'
logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)
default_args = {
'owner': 'tangxianggang',
'depends_on_past': False,
......@@ -25,7 +29,7 @@ dag = DAG(
)
def heartbeat_alarm(**kwargs):
logging.info('start heartbeat alarm')
logger.info('start heartbeat alarm')
title = 'airflow_heartbeat_detection'
msg = '\n- I am airflow, I will notify you once every 130 minutes.\
If I have not notified after 130 minutes, I have already hanged up.SOS...'
......@@ -37,7 +41,7 @@ def heartbeat_alarm(**kwargs):
\n> **For more details, please check the airflow task log.**
''' % (kwargs['task_instance'].dag_id, kwargs['task_instance'].task_id, msg)
logging.info('message : \n' + message)
logger.info('message : \n' + message)
cmd = " bash " + DING_PATH + " \'%s\' \'%s\' \'%s\' " % (title, message, DINGDING)
os.system(cmd)
......
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