kaxil commented on a change in pull request #5815: [AIRFLOW-5210] Make finding 
template files more efficient
URL: https://github.com/apache/airflow/pull/5815#discussion_r313788497
 
 

 ##########
 File path: airflow/models/baseoperator.py
 ##########
 @@ -717,26 +717,27 @@ def prepare_template(self):
 
     def resolve_template_files(self):
         # Getting the content of files for template_field / template_ext
-        for attr in self.template_fields:
-            content = getattr(self, attr, None)
-            if content is None:
-                continue
-            elif isinstance(content, str) and \
-                    any([content.endswith(ext) for ext in self.template_ext]):
-                env = self.get_template_env()
-                try:
-                    setattr(self, attr, env.loader.get_source(env, content)[0])
-                except Exception as e:
-                    self.log.exception(e)
-            elif isinstance(content, list):
-                env = self.dag.get_template_env()
-                for i in range(len(content)):
-                    if isinstance(content[i], str) and \
-                            any([content[i].endswith(ext) for ext in 
self.template_ext]):
-                        try:
-                            content[i] = env.loader.get_source(env, 
content[i])[0]
-                        except Exception as e:
-                            self.log.exception(e)
+        if self.template_ext:
 
 Review comment:
   Wouldn't this stop rendering of template fields as well?

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to