-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Triggerer: Support loading triggers from zip archives #52091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contributors' Guide (https://github.com/apache/airflow/blob/main/contributing-docs/README.rst)
|
Is this necessary? Python supports importing from a zip file out of the box, so as long as you structure the zip file correctly, importing the trigger class normally should just work. |
@uranusjr Yes, it is necessary. In the documentation you linked, it reads:
What this means is that in order for This is how the scheduler currently handles zip files, from which I derived my triggerer implementation. Note lines 493-500. airflow/airflow-core/src/airflow/models/dagbag.py Lines 468 to 516 in e1d9be4
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks legit and thanks for the explanation. @uranusjr - are you happy with it ?
BTW. It would be really good if there are tests added - we very rarely merge changes that have no tests, because it means that the change is not tested and is prone to regression. So I retract my approval - and "require changes" for tests |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs tests
@potiuk Acknowledged. I will add tests. FYI I will be on vacation these next two weeks so it'll be some time before I get to it. Thanks for the feedback 👍 . |
Currently airflow's scheduler supports executing DAGs defined in a zip archive. However the triggerer does not yet support this functionality. We propose these changes so that triggerer can support loading/executing triggers from a specified zip archive, similar to how scheduler does it.
The sys.modules cache is cleared of relevant libraries before performing an import, so that if there are multiple zip archives which contain the same library with different versions, the correct version will be loaded from disk instead of the global sys.modules cache.