|
| 1 | +{# |
| 2 | + Licensed to the Apache Software Foundation (ASF) under one |
| 3 | + or more contributor license agreements. See the NOTICE file |
| 4 | + distributed with this work for additional information |
| 5 | + regarding copyright ownership. The ASF licenses this file |
| 6 | + to you under the Apache License, Version 2.0 (the |
| 7 | + "License"); you may not use this file except in compliance |
| 8 | + with the License. You may obtain a copy of the License at |
| 9 | + http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | + Unless required by applicable law or agreed to in writing, |
| 11 | + software distributed under the License is distributed on an |
| 12 | + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 13 | + KIND, either express or implied. See the License for the |
| 14 | + specific language governing permissions and limitations |
| 15 | + under the License. |
| 16 | +#} |
| 17 | +<!DOCTYPE html> |
| 18 | +<html lang="en"> |
| 19 | +<head> |
| 20 | + <meta charset="UTF-8" /> |
| 21 | + <meta name="viewport" content="width=device-width, initial-scale=1.0"/> |
| 22 | + <title>Airflow Notification</title> |
| 23 | + <style> |
| 24 | + body { margin: 0; padding: 0; background-color: #0d1117; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #e6edf3; } |
| 25 | + .wrapper { max-width: 680px; margin: 32px auto; background-color: #161b22; border: 1px solid #30363d; border-radius: 8px; overflow: hidden; } |
| 26 | + .header-failure { background-color: #da3633; padding: 20px 28px; } |
| 27 | + .header-sla { background-color: #e3b341; padding: 20px 28px; } |
| 28 | + .header-failure h1, .header-sla h1 { margin: 0; font-size: 18px; font-weight: 600; color: #ffffff; } |
| 29 | + .header-failure p, .header-sla p { margin: 4px 0 0; font-size: 13px; color: rgba(255,255,255,0.85); } |
| 30 | + .body { padding: 24px 28px; } |
| 31 | + .section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: #8b949e; margin: 0 0 12px; } |
| 32 | + .details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; } |
| 33 | + .detail-card { background-color: #0d1117; border: 1px solid #30363d; border-radius: 6px; padding: 12px 14px; } |
| 34 | + .detail-card .label { font-size: 11px; color: #8b949e; margin-bottom: 4px; } |
| 35 | + .detail-card .value { font-size: 14px; font-weight: 500; color: #e6edf3; word-break: break-all; } |
| 36 | + .exception-block { background-color: #0d1117; border: 1px solid #f85149; border-left: 3px solid #f85149; border-radius: 6px; padding: 14px 16px; margin-bottom: 24px; } |
| 37 | + .exception-block pre { margin: 0; font-size: 12px; color: #f85149; white-space: pre-wrap; word-break: break-word; font-family: 'SF Mono', 'Fira Code', monospace; line-height: 1.5; } |
| 38 | + .sla-block { background-color: #0d1117; border: 1px solid #e3b341; border-left: 3px solid #e3b341; border-radius: 6px; padding: 14px 16px; margin-bottom: 24px; } |
| 39 | + .sla-block pre { margin: 0; font-size: 12px; color: #e3b341; white-space: pre-wrap; word-break: break-word; font-family: 'SF Mono', 'Fira Code', monospace; line-height: 1.5; } |
| 40 | + .actions { display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; } |
| 41 | + .btn { display: inline-block; padding: 9px 18px; border-radius: 6px; font-size: 13px; font-weight: 500; text-decoration: none; } |
| 42 | + .btn-primary { background-color: #1f6feb; color: #ffffff; } |
| 43 | + .btn-secondary { background-color: #21262d; color: #c9d1d9; border: 1px solid #30363d; } |
| 44 | + .footer { background-color: #0d1117; border-top: 1px solid #30363d; padding: 14px 28px; font-size: 12px; color: #8b949e; } |
| 45 | + </style> |
| 46 | +</head> |
| 47 | +<body> |
| 48 | + <div class="wrapper"> |
| 49 | + |
| 50 | + {% if ti is defined %} |
| 51 | + <div class="header-failure"> |
| 52 | + <h1>⚠ Task Failure Alert</h1> |
| 53 | + <p>{{ ti.dag_id }} › {{ ti.task_id }}</p> |
| 54 | + </div> |
| 55 | + <div class="body"> |
| 56 | + <p class="section-title">Task Details</p> |
| 57 | + <div class="details-grid"> |
| 58 | + <div class="detail-card"> |
| 59 | + <div class="label">DAG</div> |
| 60 | + <div class="value">{{ ti.dag_id }}</div> |
| 61 | + </div> |
| 62 | + <div class="detail-card"> |
| 63 | + <div class="label">Task</div> |
| 64 | + <div class="value">{{ ti.task_id }}</div> |
| 65 | + </div> |
| 66 | + <div class="detail-card"> |
| 67 | + <div class="label">Run ID</div> |
| 68 | + <div class="value">{{ ti.run_id }}</div> |
| 69 | + </div> |
| 70 | + <div class="detail-card"> |
| 71 | + <div class="label">Attempt</div> |
| 72 | + <div class="value">{{ ti.try_number }} of {{ ti.max_tries + 1 }}</div> |
| 73 | + </div> |
| 74 | + <div class="detail-card"> |
| 75 | + <div class="label">State</div> |
| 76 | + <div class="value">{{ ti.state }}</div> |
| 77 | + </div> |
| 78 | + <div class="detail-card"> |
| 79 | + <div class="label">Host</div> |
| 80 | + <div class="value">{{ ti.hostname }}</div> |
| 81 | + </div> |
| 82 | + </div> |
| 83 | + |
| 84 | + <div class="actions"> |
| 85 | + {% if ti.log_url %} |
| 86 | + <a href="{{ ti.log_url }}" class="btn btn-primary">View Log</a> |
| 87 | + {% endif %} |
| 88 | + {% if ti.mark_success_url is defined and ti.mark_success_url %} |
| 89 | + <a href="{{ ti.mark_success_url }}" class="btn btn-secondary">Mark Success</a> |
| 90 | + {% endif %} |
| 91 | + </div> |
| 92 | + </div> |
| 93 | + |
| 94 | + {% elif slas is defined %} |
| 95 | + <div class="header-sla"> |
| 96 | + <h1>⌛ SLA Missed</h1> |
| 97 | + <p>{{ dag.dag_id }}</p> |
| 98 | + </div> |
| 99 | + <div class="body"> |
| 100 | + <p class="section-title">SLA Details</p> |
| 101 | + <div class="details-grid"> |
| 102 | + <div class="detail-card"> |
| 103 | + <div class="label">DAG</div> |
| 104 | + <div class="value">{{ dag.dag_id }}</div> |
| 105 | + </div> |
| 106 | + <div class="detail-card"> |
| 107 | + <div class="label">Tasks</div> |
| 108 | + <div class="value">{{ task_list }}</div> |
| 109 | + </div> |
| 110 | + <div class="detail-card"> |
| 111 | + <div class="label">Blocking Tasks</div> |
| 112 | + <div class="value">{{ blocking_task_list }}</div> |
| 113 | + </div> |
| 114 | + </div> |
| 115 | + |
| 116 | + <p class="section-title">SLA Misses</p> |
| 117 | + <div class="sla-block"> |
| 118 | + <pre>{{ slas }}</pre> |
| 119 | + </div> |
| 120 | + |
| 121 | + <p class="section-title">Blocking Task Instances</p> |
| 122 | + <div class="sla-block"> |
| 123 | + <pre>{{ blocking_tis }}</pre> |
| 124 | + </div> |
| 125 | + </div> |
| 126 | + {% endif %} |
| 127 | + |
| 128 | + <div class="footer"> |
| 129 | + Sent by Apache Airflow |
| 130 | + {% if ti is defined %}— {{ ti.hostname }}{% endif %} |
| 131 | + </div> |
| 132 | + </div> |
| 133 | +</body> |
| 134 | +</html> |
0 commit comments