Skip to content

Conversation

@uranusjr
Copy link
Member

@uranusjr uranusjr commented May 9, 2025

Instead of adding the dags folder into sys.path globally, each dag file parser now only adds the dag bundle’s root path to sys.path for that specific parsing job.

Fix #49838.

@uranusjr uranusjr force-pushed the bundle-root-sys-path branch 3 times, most recently from ec61652 to 0f04dab Compare May 11, 2025 15:31
@uranusjr uranusjr marked this pull request as ready for review May 11, 2025 15:32
@uranusjr uranusjr force-pushed the bundle-root-sys-path branch from 0f04dab to 8770ae6 Compare May 11, 2025 15:32
@uranusjr uranusjr force-pushed the bundle-root-sys-path branch from 8770ae6 to abb7b7b Compare May 11, 2025 15:34
@kaxil kaxil added this to the Airflow 3.0.2 milestone May 12, 2025
@jedcunningham jedcunningham added the type:bug-fix Changelog: Bug Fixes label May 12, 2025
@jedcunningham jedcunningham merged commit 3b93650 into apache:main May 12, 2025
52 checks passed
@jedcunningham jedcunningham deleted the bundle-root-sys-path branch May 12, 2025 19:03
github-actions bot pushed a commit that referenced this pull request May 12, 2025
(cherry picked from commit 3b93650)

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@github-actions
Copy link

Backport successfully created: v3-0-test

Status Branch Result
v3-0-test PR Link

jedcunningham pushed a commit that referenced this pull request May 12, 2025
…0509)

(cherry picked from commit 3b93650)

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
@gbonazzoli
Copy link

@uranusjr

I've applied the patch to my 3.0.1 installation (processor.py and settings.py) and I think that the problem in not completely solved.

After the patch the module is found, but now if the module's code on the git repository has "import requirements", I think that those requirements are not inherited from the virtual enviroment on which Airflow is running.

This is the new error:

Screenshot 2025-05-16 at 06 27 37

But the pyvmomi package is already installed has you can see:

(venv) root@airflow-tre:~# pip install pyvmomi
Requirement already satisfied: pyvmomi in ./venv/lib/python3.12/site-packages (8.0.3.0.1)
Requirement already satisfied: six>=1.7.3 in ./venv/lib/python3.12/site-packages (from pyvmomi) (1.17.0)
(venv) root@airflow-tre:~# python3
Python 3.12.3 (main, Feb  4 2025, 14:48:35) [GCC 13.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyVim.connect import Connect, Disconnect
>>> 
(venv) root@airflow-tre:~# 

@uranusjr
Copy link
Member Author

Can you open a new issue for this?

@gbonazzoli
Copy link

@uranusjr

Yes, sure.

Created #50681

@codenamelxl
Copy link
Contributor

I port this fix to our Airflow 3.0.1 installation, it works for Dag Processor but fail with same error for worker. Created #51282

kaxil pushed a commit that referenced this pull request Jun 3, 2025
…0509)

(cherry picked from commit 3b93650)

Co-authored-by: Tzu-ping Chung <uranusjr@gmail.com>
sanederchik pushed a commit to sanederchik/airflow that referenced this pull request Jun 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bundle root should be added to import path

8 participants