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

[FLINK-17612][python][sql-client] add the parse logic of Python command line options to CliOptionsParser in SQL Client. #12077

Merged
merged 3 commits into from
May 13, 2020

Conversation

WeiZhong94
Copy link
Contributor

What is the purpose of the change

This pull request adds the parse logic of Python command line options to CliOptionsParser in SQL Client.

Brief change log

  • Add the parse logic of Python command line options to CliOptionsParser in SQL Client.
  • Append the Python configurations from CliOptions to Session Environment.

Verifying this change

This change can be verified as follows:

  • Start a local standalone flink cluster.
  • Prepare a sql client session environment file with python UDF declaration.
  • Added test that validates that TaskInfo is transferred only once across recoveries
  • Launch the sql client with command line option "-pyfs xxx.py", "xxx.py" is the path of the python file that defines the python UDF.
  • The sql client should up without any exception.

NOTE: After adding the PyFlink e2e test, the changes in this PR will be automatically verified.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): (no)
  • The public API, i.e., is any changed class annotated with @Public(Evolving): (no)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn/Mesos, ZooKeeper: (no)
  • The S3 file system connector: (no)

Documentation

  • Does this pull request introduce a new feature? (no)
  • If yes, how is the feature documented? (not applicable)

…nd line options to CliOptionsParser in SQL Client.
@flinkbot
Copy link
Collaborator

Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community
to review your pull request. We will use this comment to track the progress of the review.

Automated Checks

Last check on commit a0ce130 (Mon May 11 09:50:43 UTC 2020)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!
  • This pull request references an unassigned Jira ticket. According to the code contribution guide, tickets need to be assigned before starting with the implementation work.

Mention the bot in a comment to re-run the automated checks.

Review Progress

  • ❓ 1. The [description] looks good.
  • ❓ 2. There is [consensus] that the contribution should go into to Flink.
  • ❓ 3. Needs [attention] from.
  • ❓ 4. The change fits into the overall [architecture].
  • ❓ 5. Overall code [quality] is good.

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 commands
The @flinkbot bot supports the following commands:

  • @flinkbot approve description to approve one or more aspects (aspects: description, consensus, architecture and quality)
  • @flinkbot approve all to approve all aspects
  • @flinkbot approve-until architecture to approve everything until architecture
  • @flinkbot attention @username1 [@username2 ..] to require somebody's attention
  • @flinkbot disapprove architecture to remove an approval you gave earlier

@flinkbot
Copy link
Collaborator

flinkbot commented May 11, 2020

CI report:

Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run travis re-run the last Travis build
  • @flinkbot run azure re-run the last Azure build

clazz.getMethod("parsePythonDependencyConfiguration", CommandLine.class);
return (Configuration) parsePythonDependencyConfiguration.invoke(null, line);
} catch (ClassNotFoundException | NoSuchMethodException | IllegalAccessException | InvocationTargetException e) {
throw new SqlClientException("Parse the Python command line options failed.", e);
Copy link
Contributor

@dianfu dianfu May 12, 2020

Choose a reason for hiding this comment

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

Change to Failed to parse the Python command line options?

@@ -90,6 +96,7 @@ private void start() {

// create CLI client with session environment
final Environment sessionEnv = readSessionEnvironment(options.getEnvironment());
appendPythonConfig(sessionEnv, options.getPythonConfiguration());
Copy link
Contributor

Choose a reason for hiding this comment

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

could use the enrich method defined in Environment as following:
final Environment sessionEnvWithPythonConfiguration = Environment.enrich( sessionEnv, options.getPythonConfiguration().toMap(), Collections.emptyMap());

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It seems the enrich() method of the ConfigurationEntry only accepts the configurations that start with "table.". As the python configurations all start with "python.", the enrich method does not work for python configurations.

@WeiZhong94
Copy link
Contributor Author

@dianfu Thanks for your review! I have updated this PR.

Copy link
Contributor

@dianfu dianfu left a comment

Choose a reason for hiding this comment

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

LGTM.

@dianfu dianfu merged commit 722f844 into apache:master May 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants