-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Move TaskInstanceKey to a separate file to fix circular import from kubernetes_helper_functions.py #31033
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 Contribution Guide (https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst)
|
Nice. I like it - this is a simple solution and I think It is also generally a practice we are implementing more and more - splitting modules in order to get rid unnecessary coupling - especially with introducing more type hinting, some of the implicit couplings have been made explicit - like this one. One thing to add though: https://github.com/apache/airflow/blob/main/docs/conf.py#L248 should also include taskinstancekey and it should also be added in https://github.com/apache/airflow/blob/main/docs/apache-airflow/public-airflow-interface.rst nest to taskinstance package as they are part of the public Airflow interface. I also think it is backwards-compatible since TaskInstanceKey is imported in taskinstance.py (so if someone imports it from there, it will continue to work). I would love another maintainer opinion, but it looks good to me. |
Another problem with that is that it causes import errors when collecting tests - it has to be fixed. |
And you will have to rebase to latest main @LipuFei in order to make some changes I pointed out (fixes to docs were merged yesterday). |
You need a |
6e441c2
to
2553ddc
Compare
I have done a rebase. Hope it works. :) Thanks @potiuk |
2553ddc
to
d336340
Compare
Done:
|
d336340
to
5fd2976
Compare
I just added |
5fd2976
to
23e72cc
Compare
7f31bc5
to
ccf788d
Compare
closes: apache#30988 Fixes a circular import of DagRun -> TaskInstance -> Sentry -> KubernetesExexcutor -> kubernetes_helper_functions.py (*) -> TaskInstanceKey. Moving TaskInstanceKey out to a separate file will break the cycle from kubernetes_helper_functions.py -> taskinstances.py
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.
Note: This will conflict with some changes I have had in PR for a couple weeks now #30727, last to merge will have to resolve it
BTW. One of my first responses to this one (I did not send it) started with:
I am looking at #30727 now. |
General comment here. Honestly I think we should merge that one first - because it is very likely we are going to cherry-pick this one to 2.6.1 while #30727 is much more risky to cherry-pick to bugfix branch. This one should cherry-pick cleanly if we merge it first, whereas if we merge it after #30727 it will require manually applying the same fix to 2.6.1 branch. This is also why I hesitated a bit with #30727 refactoring and where my comment about possibly splitting it even further came from @o-nikolas. This is a nice example how such refactorings are impacting our bug-fixing releases. Something to consider when we decide to merge #30727 (also something for @ephraimbuddy and @pierrejeambrun to take a look I guess) - for me the kind of more complex refactors in "core" parts of Airflow are better done closer to the end of cherry-picking cycle when we are preparing to cut-off a new minor branch (this is one of the reasons why the base_job refactor of mine was done when it was done - after the last cherry-pickign round for 2.5.*) |
Awesome work, congrats on your first merged pull request! You are invited to check our Issue Tracker for additional contributions. |
closes: #30988 Fixes a circular import of DagRun -> TaskInstance -> Sentry -> KubernetesExexcutor -> kubernetes_helper_functions.py (*) -> TaskInstanceKey. Moving TaskInstanceKey out to a separate file will break the cycle from kubernetes_helper_functions.py -> taskinstances.py Co-authored-by: Lipu Fei <[email protected]> (cherry picked from commit ac46902)
related: apache#30988, apache#31033 The root-level import of TaskInstance will still cause a circular import problem when both Kubernetes and Sentry are enabled. This will show up in the DB migration job if I use the official Helm chart 1.9.0 to deploy.
related: #30988, #31033 The root-level import of TaskInstance will still cause a circular import problem when both Kubernetes and Sentry are enabled. This will show up in the DB migration job if I use the official Helm chart 1.9.0 to deploy. Co-authored-by: Lipu Fei <[email protected]>
related: #30988, #31033 The root-level import of TaskInstance will still cause a circular import problem when both Kubernetes and Sentry are enabled. This will show up in the DB migration job if I use the official Helm chart 1.9.0 to deploy. Co-authored-by: Lipu Fei <[email protected]> (cherry picked from commit be8f96b)
Fixes #30988
Fixes a circular import of
DagRun -> TaskInstance -> Sentry -> KubernetesExexcutor -> kubernetes_helper_functions.py (*) -> TaskInstanceKey.
Moving
TaskInstanceKey
out to a separate file will break the cycle fromkubernetes_helper_functions.py -> taskinstances.py