You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "devgonvarun (via GitHub)" <gi...@apache.org> on 2025/08/19 22:22:31 UTC
[D] Dag Policy raising unusual AirflowClusterPolicyError [airflow]
GitHub user devgonvarun created a discussion: Dag Policy raising unusual AirflowClusterPolicyError
### Apache Airflow version
3.0.4
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
I am using [dag_policy](https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/cluster-policies.html#airflow.policies.dag_policy) for altering the schedule of my dags. But instead it leads to a dag import error with AirflowClusterPolicyError. I have not configured any [AirflowClusterPolicyViolation](https://airflow.apache.org/docs/apache-airflow/stable/_api/airflow/exceptions/index.html#airflow.exceptions.AirflowClusterPolicyViolation) in my cluster policies.
<img width="893" height="239" alt="Image" src="https://github.com/user-attachments/assets/8ccf3588-3eb5-4026-8349-2d523dc93486" />
### What you think should happen instead?
The dag schedule should be altered to my configured schedule in the dag_policy.
The same thing in Airflow 2.10.5 used to work without any errors.
```
#Airflow 2.10.5
def dag_policy(dag: DAG):
dag.schedule_interval = "@once"
```
### How to reproduce
Create a minimal dag_policy [cluster policy](https://airflow.apache.org/docs/apache-airflow/stable/administration-and-deployment/cluster-policies.html#cluster-policies)
```
# Airflow 3.0.4
def dag_policy(dag: DAG):
dag.schedule = "@once"
```
### Operating System
Debian GNU/Linux 12 (bookworm)
### Versions of Apache Airflow Providers
_No response_
### Deployment
Official Apache Airflow Helm Chart
### Deployment details
_No response_
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
GitHub link: https://github.com/apache/airflow/discussions/54688
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Dag Policy raising unusual AirflowClusterPolicyError [airflow]
Posted by "tirkarthi (via GitHub)" <gi...@apache.org>.
GitHub user tirkarthi added a comment to the discussion: Dag Policy raising unusual AirflowClusterPolicyError
I can see below logs in the dag processor. It seems the schedule attribute is a frozen attribute that cannot be set.
https://github.com/apache/airflow/blob/cdfddea9207154cec55d178381869c959a7def42/task-sdk/src/airflow/sdk/definitions/dag.py#L393
```json
tail -n 3 ~/airflow/logs/dag_processor/latest/example_dags/example_display_name.py.log | python -m json.tool --json-lines
{
"timestamp": "2025-08-19T14:18:25.123601Z",
"level": "info",
"event": "<DAG: example_display_name>",
"chan": "stdout",
"logger": "processor"
}
{
"timestamp": "2025-08-19T14:18:25.114862",
"level": "error",
"event": "",
"logger": "airflow.models.dagbag.DagBag",
"error_detail": [
{
"exc_type": "FrozenAttributeError",
"exc_value": "",
"exc_notes": [],
"syntax_error": null,
"is_cause": false,
"frames": [
{
"filename": "/home/karthikeyan/stuff/python/airflow/airflow-core/src/airflow/models/dagbag.py",
"lineno": 522,
"name": "bag_dag"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/airflow-core/src/airflow/settings.py",
"lineno": 177,
"name": "dag_policy"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/pluggy/_hooks.py",
"lineno": 512,
"name": "__call__"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/pluggy/_manager.py",
"lineno": 120,
"name": "_hookexec"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/pluggy/_callers.py",
"lineno": 167,
"name": "_multicall"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/pluggy/_callers.py",
"lineno": 121,
"name": "_multicall"
},
{
"filename": "/home/karthikeyan/airflow/config/airflow_local_settings.py",
"lineno": 7,
"name": "dag_policy"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/attr/_make.py",
"lineno": 1167,
"name": "__setattr__"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/attr/setters.py",
"lineno": 35,
"name": "frozen"
}
],
"is_group": false,
"exceptions": []
}
]
}
{
"timestamp": "2025-08-19T14:18:25.115501",
"level": "error",
"event": "Failed to bag_dag: /home/karthikeyan/stuff/python/airflow/airflow-core/src/airflow/example_dags/example_display_name.py",
"logger": "airflow.models.dagbag.DagBag",
"error_detail": [
{
"exc_type": "AirflowClusterPolicyError",
"exc_value": "",
"exc_notes": [],
"syntax_error": null,
"is_cause": false,
"frames": [
{
"filename": "/home/karthikeyan/stuff/python/airflow/airflow-core/src/airflow/models/dagbag.py",
"lineno": 497,
"name": "_process_modules"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/airflow-core/src/airflow/models/dagbag.py",
"lineno": 540,
"name": "bag_dag"
}
],
"is_group": false,
"exceptions": []
},
{
"exc_type": "FrozenAttributeError",
"exc_value": "",
"exc_notes": [],
"syntax_error": null,
"is_cause": false,
"frames": [
{
"filename": "/home/karthikeyan/stuff/python/airflow/airflow-core/src/airflow/models/dagbag.py",
"lineno": 522,
"name": "bag_dag"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/airflow-core/src/airflow/settings.py",
"lineno": 177,
"name": "dag_policy"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/pluggy/_hooks.py",
"lineno": 512,
"name": "__call__"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/pluggy/_manager.py",
"lineno": 120,
"name": "_hookexec"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/pluggy/_callers.py",
"lineno": 167,
"name": "_multicall"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/pluggy/_callers.py",
"lineno": 121,
"name": "_multicall"
},
{
"filename": "/home/karthikeyan/airflow/config/airflow_local_settings.py",
"lineno": 7,
"name": "dag_policy"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/attr/_make.py",
"lineno": 1167,
"name": "__setattr__"
},
{
"filename": "/home/karthikeyan/stuff/python/airflow/.venv/lib/python3.11/site-packages/attr/setters.py",
"lineno": 35,
"name": "frozen"
}
],
"is_group": false,
"exceptions": []
}
]
}
```
GitHub link: https://github.com/apache/airflow/discussions/54688#discussioncomment-14157290
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Dag Policy raising unusual AirflowClusterPolicyError [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
GitHub user potiuk added a comment to the discussion: Dag Policy raising unusual AirflowClusterPolicyError
Yep. Schedule cannot be modified.
GitHub link: https://github.com/apache/airflow/discussions/54688#discussioncomment-14157292
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org
Re: [D] Dag Policy raising unusual AirflowClusterPolicyError [airflow]
Posted by "potiuk (via GitHub)" <gi...@apache.org>.
GitHub user potiuk added a comment to the discussion: Dag Policy raising unusual AirflowClusterPolicyError
Converted to a discusion.
GitHub link: https://github.com/apache/airflow/discussions/54688#discussioncomment-14157294
----
This is an automatically sent email for commits@airflow.apache.org.
To unsubscribe, please send an email to: commits-unsubscribe@airflow.apache.org