Skip to content

Commit

Permalink
[Edge]Worker UI link beautification (apache#43869)
Browse files Browse the repository at this point in the history
* links are easier to find for running and queued tasks on for edge worker

* Check for unknown state before checking last heartbeat

---------

Co-authored-by: Majoros Donat (XC-DX/EET2-Bp) <[email protected]>
  • Loading branch information
majorosdonat and Majoros Donat (XC-DX/EET2-Bp) authored Nov 11, 2024
1 parent 19b7398 commit 12c7dd4
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 10 deletions.
8 changes: 8 additions & 0 deletions providers/src/airflow/providers/edge/CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@
Changelog
---------

0.5.3pre0
.........

Misc
~~~~

* ``Adding some links to host and job overview pages.``

0.5.2pre0
.........

Expand Down
2 changes: 1 addition & 1 deletion providers/src/airflow/providers/edge/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

__all__ = ["__version__"]

__version__ = "0.5.2pre0"
__version__ = "0.5.3pre0"

if packaging.version.parse(packaging.version.parse(airflow_version).base_version) < packaging.version.parse(
"2.10.0"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ <h2>Edge Worker Hosts</h2>
<td>
{%- if host.state == "offline" -%}
<span class="label" style="color:white; background-color:black;" title="Current State: {{ host.state }}">{{ host.state }}</span>
{%- elif host.state == "unknown" -%}
<span class="label" style="color:white; background-color:red;" title="Current State: {{ host.state }}">{{ host.state }}</span>
{%- elif host.last_update.timestamp() <= five_min_ago.timestamp() -%}
Reported <span class="label" style="color:white; background-color:red;" title="Current State: {{ host.state }}">{{ host.state }}</span>
but no heartbeat
Expand All @@ -61,8 +63,6 @@ <h2>Edge Worker Hosts</h2>
<span class="label" style="color:black; background-color:gray;" title="Current State: {{ host.state }}">{{ host.state }}</span>
{%- elif host.state == "terminating" -%}
<span class="label" style="color:black; background-color:violet;" title="Current State: {{ host.state }}">{{ host.state }}</span>
{%- elif host.state == "unknown" -%}
<span class="label" style="color:white; background-color:red;" title="Current State: {{ host.state }}">{{ host.state }}</span>
{%- else -%}
<span class="label" style="color:white; background-color:hotpink;" title="Current State: {{ host.state }}">{{ host.state }}</span>
{%- endif -%}
Expand All @@ -71,7 +71,9 @@ <h2>Edge Worker Hosts</h2>
{% if host.queues %}
<ul>
{% for item in host.queues %}
<li>{{ item }}</li>
<li>
<a href="../taskinstance/list/?_flt_7_state=success&_flt_7_state=failed&_flt_3_queue={{ item }}#"">{{ item }}</a>
</li>
{% endfor %}
</ul>
{% else %}
Expand All @@ -80,7 +82,9 @@ <h2>Edge Worker Hosts</h2>
</td>
<td><time datetime="{{ host.first_online }}">{{ host.first_online }}</time></td>
<td>{% if host.last_update %}<time datetime="{{ host.last_update }}">{{ host.last_update }}</time>{% endif %}</td>
<td>{{ host.jobs_active }}</td>
<td>
<a href="../taskinstance/list/?_flt_3_hostname={{ host.worker_name }}&_flt_7_state=success&_flt_7_state=failed#">{{ host.jobs_active }}</a>
</td>
<!-- Stats are not collected (yet) leave the columns out until available
<td>{{ host.jobs_taken }}</td>
<td>{{ host.jobs_success }}</td>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ <h2>Edge Worker Jobs</h2>
<table class="table table-striped table-bordered">
<tr>
<th>DAG ID</th>
<th>Task ID</th>
<th>Run ID</th>
<th>Task ID</th>
<th>Map Index</th>
<th>Try Number</th>
<th>State</th>
Expand All @@ -46,14 +46,20 @@ <h2>Edge Worker Jobs</h2>
{% for job in jobs %}
<tr title="{{ job.command }}">
<td><a href="/dags/{{ job.dag_id }}/grid">{{ job.dag_id }}</a></td>
<td><a href="/dags/{{ job.dag_id }}/grid?dag_run_id={{ job.run_id | urlencode }}&task_id={{ job.task_id }}">{{ job.task_id }}</a></td>
<td><a href="/dags/{{ job.dag_id }}/grid?dag_run_id={{ job.run_id | urlencode }}">{{ job.run_id }}</a></td>
<td><a href="/dags/{{ job.dag_id }}/grid?dag_run_id={{ job.run_id | urlencode }}&task_id={{ job.task_id }}&tab=logs">{{ job.task_id }}</a></td>
<td>{% if job.map_index >= 0 %}{{ job.map_index }}{% else %}-{% endif %}</td>
<td>{{ job.try_number }}</td>
<td>{{ html_states[job.state] }}</td>
<td>{{ job.queue }}</td>
<td>
<a href="../taskinstance/list/?_flt_7_state=success&_flt_7_state=failed&_flt_3_queue={{ job.queue }}#"">{{ job.queue }}</a>
</td>
<td><time datetime="{{ job.queued_dttm }}">{{ job.queued_dttm }}</time></td>
<td>{% if job.edge_worker %}{{ job.edge_worker }}{% endif %}</td>
<td>
{% if job.edge_worker %}
<a href="../taskinstance/list/?_flt_3_hostname={{ job.edge_worker }}&_flt_7_state=success&_flt_7_state=failed#">{{ job.edge_worker }}</a>
{% endif %}
</td>
<td>{% if job.last_update %}<time datetime="{{ job.last_update }}">{{ job.last_update | string | truncate(20, False, "") }}</time>{% endif %}</td>
</tr>
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion providers/src/airflow/providers/edge/provider.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ source-date-epoch: 1729683247

# note that those versions are maintained by release manager - do not update them manually
versions:
- 0.5.2pre0
- 0.5.3pre0

dependencies:
- apache-airflow>=2.10.0
Expand Down

0 comments on commit 12c7dd4

Please sign in to comment.