Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
A
airflow-dags-hub
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
唐香港
airflow-dags-hub
Commits
945dc687
Commit
945dc687
authored
Sep 18, 2019
by
唐香港
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update airflow_heartbeat_detection.py
parent
5380ae20
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
2 deletions
+6
-2
airflow_heartbeat_detection.py
dags/airflow/airflow_heartbeat_detection.py
+6
-2
No files found.
dags/airflow/airflow_heartbeat_detection.py
View file @
945dc687
...
@@ -10,6 +10,10 @@ import os,logging
...
@@ -10,6 +10,10 @@ import os,logging
DINGDING
=
'https://oapi.dingtalk.com/robot/send?access_token=dac084248b38ef564c30e7f7d0c3901f3967c8e5ffdb33efe188495d5b058fdd'
DINGDING
=
'https://oapi.dingtalk.com/robot/send?access_token=dac084248b38ef564c30e7f7d0c3901f3967c8e5ffdb33efe188495d5b058fdd'
DING_PATH
=
'/opt/bitnami/airflow/dags/*/script/ding.sh'
DING_PATH
=
'/opt/bitnami/airflow/dags/*/script/ding.sh'
logging
.
basicConfig
(
level
=
logging
.
INFO
)
logger
=
logging
.
getLogger
(
__name__
)
default_args
=
{
default_args
=
{
'owner'
:
'tangxianggang'
,
'owner'
:
'tangxianggang'
,
'depends_on_past'
:
False
,
'depends_on_past'
:
False
,
...
@@ -25,7 +29,7 @@ dag = DAG(
...
@@ -25,7 +29,7 @@ dag = DAG(
)
)
def
heartbeat_alarm
(
**
kwargs
):
def
heartbeat_alarm
(
**
kwargs
):
logg
ing
.
info
(
'start heartbeat alarm'
)
logg
er
.
info
(
'start heartbeat alarm'
)
title
=
'airflow_heartbeat_detection'
title
=
'airflow_heartbeat_detection'
msg
=
'
\n
- I am airflow, I will notify you once every 130 minutes.
\
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...'
If I have not notified after 130 minutes, I have already hanged up.SOS...'
...
@@ -37,7 +41,7 @@ def heartbeat_alarm(**kwargs):
...
@@ -37,7 +41,7 @@ def heartbeat_alarm(**kwargs):
\n
> **For more details, please check the airflow task log.**
\n
> **For more details, please check the airflow task log.**
'''
%
(
kwargs
[
'task_instance'
]
.
dag_id
,
kwargs
[
'task_instance'
]
.
task_id
,
msg
)
'''
%
(
kwargs
[
'task_instance'
]
.
dag_id
,
kwargs
[
'task_instance'
]
.
task_id
,
msg
)
logg
ing
.
info
(
'message :
\n
'
+
message
)
logg
er
.
info
(
'message :
\n
'
+
message
)
cmd
=
" bash "
+
DING_PATH
+
"
\'
%
s
\'
\'
%
s
\'
\'
%
s
\'
"
%
(
title
,
message
,
DINGDING
)
cmd
=
" bash "
+
DING_PATH
+
"
\'
%
s
\'
\'
%
s
\'
\'
%
s
\'
"
%
(
title
,
message
,
DINGDING
)
os
.
system
(
cmd
)
os
.
system
(
cmd
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment