-
Notifications
You must be signed in to change notification settings - Fork 14.7k
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
AIP-51 - Misc. Compatibility Checks #28375
Conversation
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.
Thanks for the PR! I've left some comments and requests :)
@@ -38,6 +38,7 @@ class CeleryKubernetesExecutor(LoggingMixin): | |||
otherwise, CeleryExecutor is used. | |||
""" | |||
|
|||
is_picklable: bool = True |
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.
You'll also need to set a value for supports_sentry
in this class as well since it does not implement the BaseExecutor
interface (see the discussion starting from here for more context). You'll need to ensure both new fields are set on all the executors which don't inherit from BaseExecutor
(LocalKubernetesExecutor
as well) and add the appropriate unit tests for those.
@@ -167,10 +167,3 @@ def __load_local_kubernetes_executor(cls) -> BaseExecutor: | |||
|
|||
local_kubernetes_executor_cls = import_string(cls.executors[LOCAL_KUBERNETES_EXECUTOR]) | |||
return local_kubernetes_executor_cls(local_executor, kubernetes_executor) | |||
|
|||
|
|||
UNPICKLEABLE_EXECUTORS = ( |
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.
I wonder if we should actually keep this in for backwards compatibility (with a comment describing that it is deprecated) 🤔 i.e. someone in the community could be depending on this list existing. I wonder what others think about this.
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.
I searched the repository for references and it looked like it was safe to delete, but I didn't think about other users in the community being dependent on this. I think that adding a comment here and waiting to clean this up at a later time is a safer approach.
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.
Maybe add a # TODO: Remove in Airflow 3.0
. We have a couple of those in the repo and will help to not miss this spot when releasing the next major.
airflow/executors/base_executor.py
Outdated
|
||
job_id: None | int | str = None | ||
callback_sink: BaseCallbackSink | None = None | ||
|
||
is_local: bool = False | ||
is_picklable: bool = False |
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.
I think we want the default to be True, no? The previous code assumed all executors were picklable unless it was present in the list of UNPICKLEABLE_EXECUTORS
. So any executor that goes through that code should be assumed to be picklable unless it says otherwise. WDYT?
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.
I agree that this makes more sense. For some reason I went with the opposite 🙃
@@ -38,6 +38,7 @@ class LocalKubernetesExecutor(LoggingMixin): | |||
otherwise, LocalExecutor is used. | |||
""" | |||
|
|||
is_picklable: bool = True |
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.
Do we actually want this to be True? The LocalExecutor
is not picklable and so far we've gone with True for these only if all sub executors are True. WDYT?
There is some context in a PR comment here (from @pierrejeambrun's PR for is_local
)
airflow/sentry.py
Outdated
|
||
sentry_flask = FlaskIntegration() | ||
|
||
# LoggingIntegration is set by default. | ||
integrations = [sentry_flask] | ||
|
||
if executor_name == "CeleryExecutor": | ||
executor_class, _ = ExecutorLoader.import_executor_cls(conf.get("core", "EXECUTOR")) |
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.
You can use the helper method I added for this ExecutorLoader.import_default_executor_cls()
Thanks for the feedback Niko! I will clean this up and let you know when I am finished. |
77ec0b9
to
76f9d98
Compare
Hey Niko, I've submitted some more changes based on the feedback and requests. I reworked the pickling support attribute, switched to using your get executor class helper method, and implemented tests for pickling and sentry support for all of the executors. CI pipeline failed so I rebased the branch off main which fixed a failure in integration tests, but it's still failing static checks. Pre-commit was passing for me locally before rebasing, seems like something changed here. When I ran it locally after rebase it was changing several files so I didn't commit those changes. Also, I didn't mean to remove all of the other reviewers, I clicked on request re-review and it did it automatically. |
…y Executor attribute (apache#27930)
76f9d98
to
e6b2451
Compare
Thanks @rkarish! Sorry for the delayed response but I have been on year end/holiday vacation. I'm just trying to get caught up now. I'll have a look at this PR very soon 🙏 |
You're welcome and Happy New Year! I figured you were on vacation, no rush on the review! |
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.
The changes look great! Perhaps @pierrejeambrun can be the second reviewer/approver, he's been very involved in the executor decoupling work.
That would be great to get another set of eyes on this. Congratulations on becoming a Committer by the way! Would love for you to do the honors on this one 😄 . |
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.
Just one suggestion, otherwise LGTM :)
@@ -167,10 +167,3 @@ def __load_local_kubernetes_executor(cls) -> BaseExecutor: | |||
|
|||
local_kubernetes_executor_cls = import_string(cls.executors[LOCAL_KUBERNETES_EXECUTOR]) | |||
return local_kubernetes_executor_cls(local_executor, kubernetes_executor) | |||
|
|||
|
|||
UNPICKLEABLE_EXECUTORS = ( |
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.
Maybe add a # TODO: Remove in Airflow 3.0
. We have a couple of those in the repo and will help to not miss this spot when releasing the next major.
Thanks @rkarish! And thanks to you for helping on AIP-51 😀 |
Closes: #27930