[runtime] Support async execution for cross language resources.#571
Open
wenjin272 wants to merge 1 commit intoapache:mainfrom
Open
[runtime] Support async execution for cross language resources.#571wenjin272 wants to merge 1 commit intoapache:mainfrom
wenjin272 wants to merge 1 commit intoapache:mainfrom
Conversation
4ae7f02 to
d6497a7
Compare
Collaborator
Author
|
After the code review is complete with no issues, I will add the corresponding documentation updates to this PR. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked issue: #448
Purpose of change
When invoking a Java method via Pemja from a Python async thread, if that Java method creates objects using reflection, a
ClassNotFoundExceptionmay occur because the Python async thread lacks the necessary Java environment context.In Flink agents, this issue occurs when the Python API calls a Java resource that depends on other Java resources in async thread. For example, the python chat model action call
chatof a java chat model setup, and the setup will get the correspond chat model connection, which will construct the connection object by reflection.To resolve this issue, this patch moves the construction from the python async thread to the python pemja thread.
This patch depends on alibaba/pemja#95 in pemja. Therefore, we need to wait for the fix versions for Pemja and Flink 1.20, 2.0, 2.1, and 2.2.
Tests
existed e2e test for cross language resources
API
Yes. Add
openforResourceDocumentation
doc-neededdoc-not-neededdoc-included