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


##########
airflow/models/taskinstance.py:
##########
@@ -2502,6 +2509,15 @@ def signal_handler(signum, frame):
             # Execute the task
             with set_current_context(context):
                 result = self._execute_task(context, task_orig)
+
+                # DAG authors define map_index_template at the task level
+                if "map_index_template" in context and 
context["map_index_template"] is not None:
+                    if jinja_env is not None:
+                        self.rendered_map_index = 
jinja_env.from_string(context["map_index_template"]).render(
+                            context
+                        )
+                        self.log.info("Map index rendered as %s", 
self.rendered_map_index)

Review Comment:
   ```suggestion
                   if (template := context.get("map_index_template")) is not 
None:
                       if jinja_env is not None:
                           self.rendered_map_index = 
jinja_env.from_string(template).render(context)
                           self.log.info("Map index rendered as %s", 
self.rendered_map_index)
   ```
   
   Yay modern Python



-- 
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-unsubscr...@airflow.apache.org

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

Reply via email to