Commit 50095d7c authored by 唐香港's avatar 唐香港

Update airflow_heartbeat_detection.py

parent b7d7f744
......@@ -10,6 +10,9 @@ import os,logging
DINGDING = 'https://oapi.dingtalk.com/robot/send?access_token=4e00d7f7b3b8686ea7d37bd01264f86e197294f9f995ef8e12cc853760a30c60'
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 +28,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 +40,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