Skip to content
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

Merged
merged 8 commits into from
Jan 5, 2023
Merged

Conversation

rkarish
Copy link
Contributor

@rkarish rkarish commented Dec 15, 2022

Closes: #27930

@boring-cyborg boring-cyborg bot added provider:cncf-kubernetes Kubernetes provider related issues area:Scheduler including HA (high availability) scheduler labels Dec 15, 2022
@rkarish rkarish changed the title AIP-51 - Misc. Compatibility Checks #27930 AIP-51 - Misc. Compatibility Checks Dec 15, 2022
Copy link
Contributor

@o-nikolas o-nikolas left a 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
Copy link
Contributor

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 = (
Copy link
Contributor

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.

Copy link
Contributor Author

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.

Copy link
Member

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.


job_id: None | int | str = None
callback_sink: BaseCallbackSink | None = None

is_local: bool = False
is_picklable: bool = False
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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)


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"))
Copy link
Contributor

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()

@rkarish
Copy link
Contributor Author

rkarish commented Dec 17, 2022

Thanks for the feedback Niko! I will clean this up and let you know when I am finished.

@rkarish rkarish requested review from o-nikolas and removed request for ashb, kaxil, XD-DENG, dstandish and jedcunningham December 17, 2022 21:58
@rkarish
Copy link
Contributor Author

rkarish commented Dec 18, 2022

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.

@o-nikolas
Copy link
Contributor

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.

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 🙏

@rkarish
Copy link
Contributor Author

rkarish commented Jan 4, 2023

You're welcome and Happy New Year! I figured you were on vacation, no rush on the review!

Copy link
Contributor

@o-nikolas o-nikolas left a 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.

@rkarish
Copy link
Contributor Author

rkarish commented Jan 4, 2023

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 😄 .

Copy link
Member

@pierrejeambrun pierrejeambrun left a 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 = (
Copy link
Member

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.

@o-nikolas o-nikolas merged commit aa4858d into apache:main Jan 5, 2023
@o-nikolas
Copy link
Contributor

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 😄.

Thanks @rkarish! And thanks to you for helping on AIP-51 😀

@pierrejeambrun pierrejeambrun added this to the Airflow 2.6.0 milestone Jan 9, 2023
@pierrejeambrun pierrejeambrun added the type:misc/internal Changelog: Misc changes that should appear in change log label Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Scheduler including HA (high availability) scheduler provider:cncf-kubernetes Kubernetes provider related issues type:misc/internal Changelog: Misc changes that should appear in change log
Development

Successfully merging this pull request may close these issues.

AIP-51 - Misc. Compatibility Checks
3 participants