Exceptions in task logs no longer contain source code
- Dominant language
- Python
- Stars
- 46.9k
- Forks
- 17.8k
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 483
Description
### Apache Airflow version
3.0.6
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
**Updated with better example**
Airflow 3 no longer captures all the lines from an Exception. It seems like it displays part of the traceback but not the actual lines of code. This makes debugging difficult.
### What you think should happen instead?
_No response_
### How to reproduce
```python
from datetime import datetime
from airflow import DAG
from airflow.operators.python import PythonOperator
default_args = {
"owner": "airflow",
"depends_on_past": False,
"start_date": datetime(2021, 6, 18),
"retries": 0,
}
def failing_python_function():
print("Things are going well!")
raise Exception("Down bad rn")
def nested_function():
failing_python_function()
def nested_function_2():
nested_function()
with DAG(
"test_error",
default_args=default_args,
schedule=None,
catchup=False,
) as dag:
PythonOperator(
task_id="run_entrypoint",
python_callable=nested_function_2,
)
```
### Operating System
Debian
### Versions of Apache Airflow Providers
_No response_
### Deployment
Astronomer
### 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)
Contributor guide
Research direction
Reproduce the problem with the provided DAG and compare the Airflow 3 task log with the expected traceback, including its source lines. Trace the task-log and exception-rendering entry points; done means the complete traceback shows the relevant source-code lines for nested Python task failures.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- backend, observability
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Needs clarification
- Newbie friendliness
- 48/100