Skip to content

Commit c6ff2db

Browse files
committed
add india messages
1 parent 1e09ab6 commit c6ff2db

File tree

7 files changed

+68
-14
lines changed

7 files changed

+68
-14
lines changed

terraform/modules/services/airflow/dags/india/elasticbeanstalk.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from airflow.operators.latest_only import LatestOnlyOperator
77
from airflow.operators.python import PythonOperator
88
from utils.elastic_beanstalk import scale_elastic_beanstalk_instance
9-
from utils.slack import on_failure_callback
9+
from utils.slack import slack_message_callback_no_action_required
1010

1111
default_args = {
1212
"owner": "airflow",
@@ -45,15 +45,15 @@
4545
python_callable=scale_elastic_beanstalk_instance,
4646
op_kwargs={"name": name, "number_of_instances": 2, "sleep_seconds": 60 * 5},
4747
task_concurrency=2,
48-
on_failure_callback=on_failure_callback,
48+
on_failure_callback=slack_message_callback_no_action_required,
4949
)
5050

5151
elb_1 = PythonOperator(
5252
task_id=f"scale_elb_1_{name}",
5353
python_callable=scale_elastic_beanstalk_instance,
5454
op_kwargs={"name": name, "number_of_instances": 1},
5555
task_concurrency=2,
56-
on_failure_callback=on_failure_callback,
56+
on_failure_callback=slack_message_callback_no_action_required,
5757
)
5858

5959
latest_only >> elb_2 >> elb_1

terraform/modules/services/airflow/dags/india/forecast-site-dag.py

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from datetime import datetime, timedelta, timezone
33
from airflow import DAG
44
from airflow.providers.amazon.aws.operators.ecs import EcsRunTaskOperator
5-
from utils.slack import on_failure_callback
5+
from utils.slack import slack_message_callback
66

77
from airflow.operators.latest_only import LatestOnlyOperator
88

@@ -24,6 +24,17 @@
2424

2525
region = "india"
2626

27+
forecast_ruvnl_error_message = (
28+
"❌ The task {{ ti.task_id }} failed. "
29+
"This would ideally be fixed before for DA actions at 09.00 IST"
30+
"Please see run book for appropriate actions."
31+
)
32+
33+
forecast_ad_error_message = (
34+
"❌ The task {{ ti.task_id }} failed. "
35+
"Please see run book for appropriate actions. "
36+
)
37+
2738
# hour the forecast can run, not include 7,8,19,20
2839
hours = "0,1,2,3,4,5,6,9,10,11,12,13,14,15,16,17,18,21,22,23"
2940

@@ -51,7 +62,7 @@
5162
"assignPublicIp": "ENABLED",
5263
},
5364
},
54-
on_failure_callback=on_failure_callback,
65+
on_failure_callback=slack_message_callback(forecast_ruvnl_error_message),
5566
task_concurrency=10,
5667
awslogs_group="/aws/ecs/forecast/forecast",
5768
awslogs_stream_prefix="streaming/forecast-forecast",
@@ -84,7 +95,7 @@
8495
"assignPublicIp": "ENABLED",
8596
},
8697
},
87-
on_failure_callback=on_failure_callback,
98+
on_failure_callback=slack_message_callback(forecast_ad_error_message),
8899
task_concurrency=10,
89100
awslogs_group="/aws/ecs/forecast/forecast-ad",
90101
awslogs_stream_prefix="streaming/forecast-ad-forecast",

terraform/modules/services/airflow/dags/india/nwp-dag.py

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from airflow.providers.amazon.aws.operators.ecs import EcsRunTaskOperator
55

66
from airflow.operators.latest_only import LatestOnlyOperator
7-
from utils.slack import on_failure_callback
7+
from utils.slack import slack_message_callback
88
from utils.s3 import determine_latest_zarr
99

1010
default_args = {
@@ -25,6 +25,29 @@
2525

2626
region = "india"
2727

28+
nwp_metoffice_error_message = (
29+
"❌ The task {{ ti.task_id }} failed."
30+
"The forecast will continue running until it runs out of data."
31+
"which doesnt need Metoffice data. "
32+
"Metoffice status link is <https://datahub.metoffice.gov.uk/support/service-status|here> "
33+
"Please see run book for appropriate actions. "
34+
)
35+
36+
nwp_ecmwf_error_message = (
37+
"❌ The task {{ ti.task_id }} failed."
38+
"The forecast will continue running until it runs out of data. "
39+
"ECMWF status link is <https://www.nco.ncep.noaa.gov/pmb/nwprod/prodstat/|here> "
40+
"Please see run book for appropriate actions. "
41+
)
42+
43+
nwp_gfs_error_message = (
44+
"❌ The task {{ ti.task_id }} failed."
45+
"The forecast will continue running until it runs out of data. "
46+
"ECMWF status link is <https://status.ecmwf.int/|here> "
47+
"Please see run book for appropriate actions. "
48+
)
49+
50+
2851
with DAG(
2952
f"{region}-nwp-consumer",
3053
schedule_interval="0 * * * *",
@@ -50,6 +73,7 @@
5073
},
5174
},
5275
task_concurrency=10,
76+
on_failure_callback=slack_message_callback(nwp_ecmwf_error_message),
5377
awslogs_group="/aws/ecs/consumer/nwp-consumer-ecmwf-india",
5478
awslogs_stream_prefix="streaming/nwp-consumer-ecmwf-india-consumer",
5579
awslogs_region="ap-south-1",
@@ -69,6 +93,7 @@
6993
},
7094
},
7195
task_concurrency=10,
96+
on_failure_callback=slack_message_callback(nwp_gfs_error_message),
7297
awslogs_group="/aws/ecs/consumer/nwp-consumer-gfs-india",
7398
awslogs_stream_prefix="streaming/nwp-consumer-gfs-india-consumer",
7499
awslogs_region="ap-south-1",
@@ -88,6 +113,7 @@
88113
},
89114
},
90115
task_concurrency=10,
116+
on_failure_callback=slack_message_callback(nwp_metoffice_error_message),
91117
awslogs_group="/aws/ecs/consumer/nwp-consumer-metoffice-india",
92118
awslogs_stream_prefix="streaming/nwp-consumer-metoffice-india-consumer",
93119
awslogs_region="ap-south-1",

terraform/modules/services/airflow/dags/india/runvnl-data-dag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
from datetime import datetime, timedelta, timezone
33
from airflow import DAG
44
from airflow.providers.amazon.aws.operators.ecs import EcsRunTaskOperator
5-
from utils.slack import on_failure_callback
5+
from utils.slack import slack_message_callback_no_action_required
66

77
from airflow.operators.latest_only import LatestOnlyOperator
88

@@ -48,7 +48,7 @@
4848
"assignPublicIp": "ENABLED",
4949
},
5050
},
51-
on_failure_callback=on_failure_callback,
51+
on_failure_callback=slack_message_callback_no_action_required,
5252
task_concurrency=10,
5353
awslogs_group="/aws/ecs/consumer/runvl-consumer",
5454
awslogs_stream_prefix="streaming/runvl-consumer-consumer",

terraform/modules/services/airflow/dags/india/satellite-dag.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from airflow.providers.amazon.aws.operators.ecs import EcsRunTaskOperator
55

66
from airflow.operators.latest_only import LatestOnlyOperator
7-
from utils.slack import on_failure_callback
7+
from utils.slack import slack_message_callback
88

99
default_args = {
1010
"owner": "airflow",
@@ -24,6 +24,13 @@
2424

2525
# Tasks can still be defined in terraform, or defined here
2626

27+
satellite_error_message = (
28+
"❌ The task {{ ti.task_id }} failed."
29+
"EUMETSAT status links are <https://uns.eumetsat.int/uns/|here> "
30+
"and <https://masif.eumetsat.int/ossi/webpages/level3.html?ossi_level3_filename=seviri_rss_hr.html&ossi_level2_filename=seviri_rss.html|here>. "
31+
"Please see run book for appropriate actions. "
32+
)
33+
2734
region = "india"
2835

2936
with DAG(
@@ -52,7 +59,7 @@
5259
},
5360
},
5461
task_concurrency=10,
55-
on_failure_callback=on_failure_callback,
62+
on_failure_callback=slack_message_callback(satellite_error_message),
5663
awslogs_group="/aws/ecs/consumer/sat-consumer",
5764
awslogs_stream_prefix="streaming/sat-consumer-consumer",
5865
awslogs_region="ap-south-1",

terraform/modules/services/airflow/dags/uk/forecast-gsp-dag.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,13 @@
3333

3434
forecast_pvnet_da_error_message = (
3535
"❌ The task {{ ti.task_id }} failed. "
36-
"This would ideally before for DA actions at 09.00"
36+
"This would ideally be fixed before for DA actions at 09.00"
3737
"Please see run book for appropriate actions."
3838
)
3939

4040
forecast_ecmwf_error_message = (
4141
"❌ The task {{ ti.task_id }} failed. This is only run after the main PVnet has failed. "
42-
"We have about 6 hours before this is needed. "
42+
"We have about 6 hours before the blend services need this. "
4343
"Please see run book for appropriate actions. "
4444
)
4545

terraform/modules/services/airflow/dags/utils/slack.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,21 @@
1313
)
1414
]
1515

16+
slack_message_callback_no_action_required = [
17+
send_slack_notification(
18+
text="⚠️ The task {{ ti.task_id }} failed,"
19+
" but its ok. No out of hours support is required.",
20+
channel=f"tech-ops-airflow-{env}",
21+
username="Airflow",
22+
)
23+
]
24+
1625
def slack_message_callback(message):
1726
return [
1827
send_slack_notification(
1928
text=message,
2029
channel=f"tech-ops-airflow-{env}",
2130
username="Airflow",
2231
)
23-
]
32+
]
33+

0 commit comments

Comments
 (0)