soooojinlee commented on code in PR #60999:
URL: https://github.com/apache/airflow/pull/60999#discussion_r2971732518
##########
task-sdk/src/airflow/sdk/definitions/dag.py:
##########
@@ -816,15 +816,28 @@ def resolve_template_files(self):
if hasattr(t, "resolve_template_files"):
t.resolve_template_files()
- def get_template_env(self, *, force_sandboxed: bool = False) ->
jinja2.Environment:
- """Build a Jinja2 environment."""
- from airflow.sdk.definitions._internal.templater import
create_template_env
+ def _get_resolved_searchpath(self) -> list[str]:
+ """
+ Return searchpath with relative paths resolved for zipped DAGs.
- # Collect directories to search for template files
+ For zipped DAGs, relative template_searchpath entries (e.g.,
``["templates"]``)
+ are resolved against the DAG folder (the zip file path).
+ """
searchpath = [self.folder]
if self.template_searchpath:
- searchpath += self.template_searchpath
+ is_zipped_dag = self.folder.endswith(".zip")
Review Comment:
Fixed. Now imports and uses the same `_has_zip_extension` helper from
`templater.py` for consistency.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]