Skip to content

Supports fully asynchronous Engine initialization #7020

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

HanShuhang
Copy link

Why are the changes needed?

When SESSION_ENGINE_LAUNCH_ASYNC is set to True, the client should not block while waiting for the engine to initialize. This is particularly important in scenarios where cluster resources are constrained, as engine initialization can be significantly delayed, potentially causing the client to block during execute calls. This can lead to serious issues—for example, we found that PyHive may lose connection with Kyuubi under such circumstances. This PR enables fully asynchronous engine startup, thereby reducing client response latency and improving the overall user experience.

How was this patch tested?

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

@HanShuhang HanShuhang force-pushed the async-engine branch 6 times, most recently from edf3079 to 3a2aa38 Compare April 15, 2025 05:58
@codecov-commenter
Copy link

codecov-commenter commented Apr 15, 2025

Codecov Report

Attention: Patch coverage is 0% with 22 lines in your changes missing coverage. Please review.

Project coverage is 0.00%. Comparing base (ba854d3) to head (219a1cf).
Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
.../org/apache/kyuubi/session/KyuubiSessionImpl.scala 0.00% 11 Missing ⚠️
...org/apache/kyuubi/operation/ExecuteStatement.scala 0.00% 10 Missing ⚠️
.../org/apache/kyuubi/operation/KyuubiOperation.scala 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##           master   #7020   +/-   ##
======================================
  Coverage    0.00%   0.00%           
======================================
  Files         695     695           
  Lines       42819   42830   +11     
  Branches     5830    5832    +2     
======================================
- Misses      42819   42830   +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cfmcgrady cfmcgrady requested review from cxzl25 and pan3793 April 15, 2025 12:23
@cxzl25 cxzl25 requested a review from lsm1 April 16, 2025 03:42
@cfmcgrady cfmcgrady changed the base branch from branch-1.10 to master April 24, 2025 06:34
@turboFei
Copy link
Member

could you check the UT failure?

@turboFei turboFei requested a review from Copilot April 27, 2025 06:19
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot wasn't able to review any files in this pull request.

Files not reviewed (3)
  • kyuubi-server/src/main/scala/org/apache/kyuubi/operation/ExecuteStatement.scala: Language not supported
  • kyuubi-server/src/main/scala/org/apache/kyuubi/operation/KyuubiOperation.scala: Language not supported
  • kyuubi-server/src/main/scala/org/apache/kyuubi/session/KyuubiSessionImpl.scala: Language not supported

@cfmcgrady cfmcgrady closed this Apr 27, 2025
@cfmcgrady cfmcgrady reopened this Apr 27, 2025
@turboFei
Copy link
Member

turboFei commented Apr 27, 2025

This PR is a little tricky for me.

Did you test whether this PR resolve the issue?

Could you check the KyuubiConnection?

if (!isBeeLineMode) {
showLaunchEngineLog();
waitLaunchEngineToComplete();
executeInitSql();
}

Was your issue caused by waitLaunchEngineToComplete?

@HanShuhang
Copy link
Author

Our users connect to kyuubi by pyhive with CONNECTION mode. If the engine is not started for a long time (maybe dozens of minutes) due to waiting for resources, the client's execute sql will be blocked in kyuubi. The final phenomenon is that even if the spark engine is successfully started finally, the client can not receive any response. This PR solved this problem, execute request (async) from pyhive can return quickly without blocking while waiting for the engine to start.
In addition, asynchronous execution should not be blocked waiting for resources in theory, which is obviously not asynchronous enough.

@turboFei turboFei requested a review from yaooqinn April 27, 2025 08:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants