Ibraitas opened a new issue, #48145:
URL: https://github.com/apache/airflow/issues/48145
### Apache Airflow version
Other Airflow 2 version (please specify below)
### If "Other Airflow 2 version" selected, which one?
2.10.2
### What happened?
When importing a variable to a DAG from another DAG file, the fileloc of the
imported DAG sometimes changes when parsing occurs. This happens
inconsistently, but it affects both the Airflow UI and the metadata database
(fileloc column in dag table, for example).
Despite this issue, tasks parsing and execution remain correct, and DAGs
execute as expected.
### What you think should happen instead?
Each DAG should retain its original fileloc, regardless of imports from
other DAG files.
### How to reproduce
1. Use the following DAG files:
import_producer_test.py
```python
import datetime as dt
from airflow import DAG
from airflow.operators.empty import EmptyOperator
VARIABLE = 'some_variable'
with DAG(
'import_producer_test',
schedule='0 * * * *',
start_date=dt.datetime(2025, 1, 1),
catchup=False,
) as dag:
task = EmptyOperator(task_id='produce_data')
```
import_consumer_test.py
```python
import datetime as dt
from airflow import DAG
from airflow.operators.empty import EmptyOperator
from import_issue_test.import_producer_test import VARIABLE
with DAG(
'import_consumer_test',
schedule='0 * * * *',
start_date=dt.datetime(2025, 1, 1),
catchup=False,
) as dag:
task = EmptyOperator(task_id='consume_data')
```
2. Place both files in the DAGs folder.
3. Restart the scheduler or trigger a parse.
4. Observe that sometimes fileloc of import_producer_test changes in the
metadata database and UI.
### Operating System
Linux, MacOS, Windows
### Versions of Apache Airflow Providers
_No response_
### Deployment
Docker-Compose
### Deployment details
The problem is reproduced both with docker compose and with docker swarm,
both in Amazon EC2 and on local laptops
### Anything else?
Video of reproducing with example files:
https://github.com/user-attachments/assets/c6efdfdc-d734-482c-b4fa-9b242b428454
And sometimes fileloc can change to other files if there is a chained
import, but I don't attach examples to keep it simple
### 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)
--
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]