GayathriSrividya opened a new pull request, #67862: URL: https://github.com/apache/airflow/pull/67862
When \`airflow dags test\` is used and the DAG has an \`on_failure_callback\` (or similar callback) that uses a \`BaseNotifier\`, the context passed to the callback contains a \`SerializedDAG\` object rather than a real \`DAG\`. \`SerializedDAG\` does not inherit from \`Templater\` and therefore has no \`get_template_env\` method. \`Templater.get_template_env\` called \`dag.get_template_env(force_sandboxed=False)\` unconditionally whenever \`dag\` was truthy, raising: \`\`\` AttributeError: 'SerializedDAG' object has no attribute 'get_template_env' \`\`\` **Fix:** guard the call with \`hasattr(dag, "get_template_env")\` so that a dag object lacking the method (such as \`SerializedDAG\`) falls back to \`SandboxedEnvironment\` instead of crashing. closes: #64649 --- Thanks to @mscsy0104 and @Quantum0uasar for investigating this issue and outlining the fix approach in the issue thread. -- 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]
