<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.4.0</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">Task policies on airflow 2.4 are raising <code class="notranslate">ERROR [airflow.models.dagbag.DagBag] can't set attribute</code> error on trying to override the values.</p>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Override an attribute using task_policy<br>
on config/airflow_local_settings.py using the docker image apache/airflow:slim-2.4.0-python3.10</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="def task_policy(task):
    task.owner = &quot;newowner&quot;
    task.on_failure_callback = lambda context: print(context)
"><pre class="notranslate"><code class="notranslate">def task_policy(task):
    task.owner = "newowner"
    task.on_failure_callback = lambda context: print(context)

</code></pre></div>
<h3 dir="auto">Operating System</h3>
<p dir="auto">docker image apache/airflow:slim-2.4.0-python3.10</p>
<h3 dir="auto">Versions of Apache Airflow Providers</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Other Docker-based deployment</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Anything else</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Are you willing to submit PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>
<h3 dir="auto">Apache Airflow version</h3>
<p dir="auto">2.3.2 (latest released)</p>
<h3 dir="auto">What happened</h3>
<p dir="auto">Using cluster policies, I set a default <code class="notranslate">on_failure_callback</code>.<br>
This works great with all tasks expect with task new task mapping.</p>
<h3 dir="auto">What you think should happen instead</h3>
<p dir="auto">Policies should work on all tasks, including the dynamic mapping or generate an exception with the error.</p>
<h3 dir="auto">How to reproduce</h3>
<p dir="auto">Overwrite any parameters using the <code class="notranslate">task_policy</code>.</p>
<h3 dir="auto">Operating System</h3>
<p dir="auto">Official docker image</p>
<h3 dir="auto">Versions of Apache Airflow Providers</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Deployment</h3>
<p dir="auto">Other Docker-based deployment</p>
<h3 dir="auto">Deployment details</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Anything else</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Are you willing to submit PR?</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Yes I am willing to submit a PR!</li>
</ul>
<h3 dir="auto">Code of Conduct</h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox" checked=""> I agree to follow this project's <a href="https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md">Code of Conduct</a></li>
</ul>