gopidesupavan commented on code in PR #60999:
URL: https://github.com/apache/airflow/pull/60999#discussion_r2969379804
##########
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:
This duplicates zip detection with `self.folder.endswith(".zip")`, which
means relative `template_searchpath` still won't be resolved for valid archives
like `dags.ZIP` even if the loader side is fixed. It would be safer to reuse
the same zip-path detection helper here so the DAG searchpath resolution and
the loader stay consistent.
--
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]