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

[SPARK-50824][PYTHON] Avoid importing optional Python packages for checking #49500

Closed
wants to merge 3 commits into from

Conversation

HyukjinKwon
Copy link
Member

@HyukjinKwon HyukjinKwon commented Jan 15, 2025

What changes were proposed in this pull request?

This PR proposes to avoid importing optional Python packages for checking, by using importlib.util.find_spec instead of actually loading/importing the package.

Why are the changes needed?

a409199 changed to import optional dependencies in main code. After that, technically f223b8d broke the Python Spark Core tests, (because now we will import pyspark.testing, and it will import optional dependencies) but it did not run the tests.

By importing deepspeed, via logger, it can show stdout (https://github.com/microsoft/DeepSpeed/blob/master/accelerator/real_accelerator.py#L182). This broke the test in pyspark.conf. After that, the real test failure was found when core change was triggered at 6f3b778. In the PR, build passed because it was before f223b8d was merged.

Does this PR introduce any user-facing change?

Technically yes. There might be some side effects by importing optional dependencies, and this PR avoid them.

How was this patch tested?

CI in this PR should verify it.

Was this patch authored or co-authored using generative AI tooling?

No.

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM. Thank you, @HyukjinKwon .

Copy link
Contributor

@LuciferYang LuciferYang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1, LGTM
Thanks @HyukjinKwon

@HyukjinKwon
Copy link
Member Author

let me trigger the core test ..

@HyukjinKwon
Copy link
Member Author

@HyukjinKwon
Copy link
Member Author

Merged to master.

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.

5 participants