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
[FLINK-16248][python][ml] Add interfaces for MLEnvironment and MLEnvironmentFactory #11198
Conversation
@becketqin @walterddr Would be great if you can also take a look. |
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 2683ef7 (Mon Feb 24 07:31:21 UTC 2020) Warnings:
Mention the bot in a comment to re-run the automated checks. Review Progress
Please see the Pull Request Review Guide for a full explanation of the review process. The Bot is tracking the review progress through labels. Labels are applied according to the order of the review items. For consensus, approval by a Flink committer of PMC member is required Bot commandsThe @flinkbot bot supports the following commands:
|
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.
Made a quick pass. LGTM in general. Just two minor comments.
_inited = False | ||
|
||
@staticmethod | ||
def _ensure_path(pattern): |
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.
Should this method be in pyflink.testing.test_case_util
?
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.
It sounds like a good idea. I will move it there.
@@ -76,14 +76,24 @@ class TableEnvironment(object): | |||
|
|||
__metaclass__ = ABCMeta | |||
|
|||
def __init__(self, j_tenv, is_blink_planner, serializer=PickleSerializer()): | |||
def __init__(self, j_tenv, serializer=PickleSerializer()): |
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.
Are the changes in this class relevant to the MLEnvironment
and MLEnvironmentFactory
?
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.
Yes, it will be more friendly to create the corresponding table environment in MLEnvironmentFactory.get_default()
, e.g., we don not need to pass the is_blink_planner variable when creating StreamTableEnvironment
.
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 expect others to construct TableEnvironment
? Isn't this a public constructor?
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.
It is an internal constructor which takes a java table environment object as a parameter. For users, the StreamTableEnvironment.create()
is called to create the Environment.
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.
Got it. Thanks for the explanation.
@becketqin Thanks a lot for your review. I have updated the PR according to your comments. (Have also fixed some checkstyle problems.) |
The patch LGTM. |
@flinkbot approve all |
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 contribution @hequn8128 . The patch looks good to me overall.
I am not expert in python, but I have one question left. please kindly take a look.
_map = {_default_ml_environment_id: None} | ||
|
||
@staticmethod | ||
def get(ml_env_id: int) -> Optional[MLEnvironment]: |
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.
Looks like the ID in Java is Long
type?
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.
Hi, appreciate your feedback! There is no Long
type in Python3 and we drop Python2 support a few months ago. Integers in Python 3 are of unlimited size.
@becketqin @walterddr Hi, thanks a lot for your review and nice feedback. 👍 Best, Hequn |
What is the purpose of the change
Align interface for MLEnvironment and MLEnvironmentFactory, so Python users can use Python MLEnvironmentFactory to maintain execution environment and table environment.
Brief change log
Verifying this change
This change added tests and can be verified as follows:
Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (Yes)Documentation