Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
{#
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
#}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Airflow Notification</title>
<style>
body { margin: 0; padding: 0; background-color: #0d1117; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; color: #e6edf3; }
.wrapper { max-width: 680px; margin: 32px auto; background-color: #161b22; border: 1px solid #30363d; border-radius: 8px; overflow: hidden; }
.header-failure { background-color: #da3633; padding: 20px 28px; }
.header-sla { background-color: #e3b341; padding: 20px 28px; }
.header-failure h1, .header-sla h1 { margin: 0; font-size: 18px; font-weight: 600; color: #ffffff; }
.header-failure p, .header-sla p { margin: 4px 0 0; font-size: 13px; color: rgba(255,255,255,0.85); }
.body { padding: 24px 28px; }
.section-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.8px; color: #8b949e; margin: 0 0 12px; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }
.detail-card { background-color: #0d1117; border: 1px solid #30363d; border-radius: 6px; padding: 12px 14px; }
.detail-card .label { font-size: 11px; color: #8b949e; margin-bottom: 4px; }
.detail-card .value { font-size: 14px; font-weight: 500; color: #e6edf3; word-break: break-all; }
.exception-block { background-color: #0d1117; border: 1px solid #f85149; border-left: 3px solid #f85149; border-radius: 6px; padding: 14px 16px; margin-bottom: 24px; }
.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; }
.sla-block { background-color: #0d1117; border: 1px solid #e3b341; border-left: 3px solid #e3b341; border-radius: 6px; padding: 14px 16px; margin-bottom: 24px; }
.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; }
.actions { display: flex; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.btn { display: inline-block; padding: 9px 18px; border-radius: 6px; font-size: 13px; font-weight: 500; text-decoration: none; }
.btn-primary { background-color: #1f6feb; color: #ffffff; }
.btn-secondary { background-color: #21262d; color: #c9d1d9; border: 1px solid #30363d; }
.footer { background-color: #0d1117; border-top: 1px solid #30363d; padding: 14px 28px; font-size: 12px; color: #8b949e; }
</style>
</head>
<body>
<div class="wrapper">

{% if ti is defined %}
<div class="header-failure">
<h1>&#9888; Task Failure Alert</h1>
<p>{{ ti.dag_id }} &rsaquo; {{ ti.task_id }}</p>
</div>
<div class="body">
<p class="section-title">Task Details</p>
<div class="details-grid">
<div class="detail-card">
<div class="label">DAG</div>
<div class="value">{{ ti.dag_id }}</div>
</div>
<div class="detail-card">
<div class="label">Task</div>
<div class="value">{{ ti.task_id }}</div>
</div>
<div class="detail-card">
<div class="label">Run ID</div>
<div class="value">{{ ti.run_id }}</div>
</div>
<div class="detail-card">
<div class="label">Attempt</div>
<div class="value">{{ ti.try_number }} of {{ ti.max_tries + 1 }}</div>
</div>
<div class="detail-card">
<div class="label">State</div>
<div class="value">{{ ti.state }}</div>
</div>
<div class="detail-card">
<div class="label">Host</div>
<div class="value">{{ ti.hostname }}</div>
</div>
</div>

<div class="actions">
{% if ti.log_url %}
<a href="{{ ti.log_url }}" class="btn btn-primary">View Log</a>
{% endif %}
{% if ti.mark_success_url is defined and ti.mark_success_url %}
<a href="{{ ti.mark_success_url }}" class="btn btn-secondary">Mark Success</a>
{% endif %}
</div>
</div>

{% elif slas is defined %}
<div class="header-sla">
<h1>&#8987; SLA Missed</h1>
<p>{{ dag.dag_id }}</p>
</div>
<div class="body">
<p class="section-title">SLA Details</p>
<div class="details-grid">
<div class="detail-card">
<div class="label">DAG</div>
<div class="value">{{ dag.dag_id }}</div>
</div>
<div class="detail-card">
<div class="label">Tasks</div>
<div class="value">{{ task_list }}</div>
</div>
<div class="detail-card">
<div class="label">Blocking Tasks</div>
<div class="value">{{ blocking_task_list }}</div>
</div>
</div>

<p class="section-title">SLA Misses</p>
<div class="sla-block">
<pre>{{ slas }}</pre>
</div>

<p class="section-title">Blocking Task Instances</p>
<div class="sla-block">
<pre>{{ blocking_tis }}</pre>
</div>
</div>
{% endif %}

<div class="footer">
Sent by Apache Airflow
{% if ti is defined %}&mdash; {{ ti.hostname }}{% endif %}
</div>
</div>
</body>
</html>
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand All @@ -17,7 +15,7 @@
under the License.
#}
{% if ti is defined %}
DAG {{ ti.dag_id }} - Task {{ ti.task_id }} - Run ID {{ ti.run_id }} in State {{ ti.state }}
[Airflow] Task Failed: {{ ti.dag_id }}.{{ ti.task_id }} | Run: {{ ti.run_id }}
{% elif slas is defined %}
SLA Missed for DAG {{ dag.dag_id }} - Task {{ slas[0].task_id }}
[Airflow] SLA Missed: {{ dag.dag_id }}.{{ slas[0].task_id }}
{% endif %}
Loading