You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by bb...@apache.org on 2022/02/23 23:41:22 UTC

[airflow] 01/02: add map_index to /taskinstance table

This is an automated email from the ASF dual-hosted git repository.

bbovenzi pushed a commit to branch show-taskinstance-map-index
in repository https://gitbox.apache.org/repos/asf/airflow.git

commit 27642d46b1dff62fd3c9c302cb72e13055e91d0d
Author: Brent Bovenzi <br...@gmail.com>
AuthorDate: Wed Feb 23 17:03:35 2022 -0500

    add map_index to /taskinstance table
---
 airflow/www/views.py | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/airflow/www/views.py b/airflow/www/views.py
index cd45952..f3a2468 100644
--- a/airflow/www/views.py
+++ b/airflow/www/views.py
@@ -4607,6 +4607,7 @@ class TaskInstanceModelView(AirflowPrivilegeVerifierModelView):
         'dag_id',
         'task_id',
         'run_id',
+        'map_index',
         'dag_run.execution_date',
         'operator',
         'start_date',
@@ -4680,10 +4681,18 @@ class TaskInstanceModelView(AirflowPrivilegeVerifierModelView):
             return td_format(timedelta(seconds=duration))
         return None
 
+    def format_map_index(self):
+        """Only show indices of mapped tasks"""
+        map_index = self.get('map_index')
+        if map_index < 0:
+            return ' '
+        return None
+
     formatters_columns = {
         'log_url': log_url_formatter,
         'task_id': wwwutils.task_instance_link,
         'run_id': wwwutils.dag_run_link,
+        'map_index': format_map_index,
         'hostname': wwwutils.nobr_f('hostname'),
         'state': wwwutils.state_f,
         'dag_run.execution_date': wwwutils.datetime_f('dag_run.execution_date'),