You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2023/06/20 09:12:27 UTC

[GitHub] [airflow] uranusjr commented on a diff in pull request #32011: Flash an error msg instead of failure in `rendered-templates` when map index is not found

uranusjr commented on code in PR #32011:
URL: https://github.com/apache/airflow/pull/32011#discussion_r1234978334


##########
airflow/www/views.py:
##########
@@ -1419,7 +1419,11 @@ def rendered_templates(self, session):
             ti.dag_run = DagRun(dag_id=dag_id, execution_date=dttm)
         else:
             ti = dag_run.get_task_instance(task_id=task_id, map_index=map_index, session=session)
-            ti.refresh_from_task(raw_task)
+            if ti:
+                ti.refresh_from_task(raw_task)
+            else:
+                # When there is no task instance with the given map_index
+                ti = TaskInstance(raw_task, map_index=map_index)

Review Comment:
   I would prefer this to just raise directly. It is very awkward to instantiate a task instance just to fail later.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org