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-17023][scripts] Fix format checking of extractExecutionParams in config.sh #11764

Merged
merged 2 commits into from
Apr 17, 2020
Merged

[FLINK-17023][scripts] Fix format checking of extractExecutionParams in config.sh #11764

merged 2 commits into from
Apr 17, 2020

Conversation

tsreaper
Copy link
Contributor

@tsreaper tsreaper commented Apr 16, 2020

What is the purpose of the change

In FLINK-15727 BashJavaUtils now returns multiple lines of results to avoid using BashJavaUtils twice. But now the format checking for the last line is incorrect.

This PR fixes the format checking for the last line in extractExecutionParams in config.sh.

Brief change log

  • Fix format checking of extractExecutionParams in config.sh

Verifying this change

This change is a trivial rework / code cleanup without any test coverage.

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

@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 59e7e20 (Thu Apr 16 03:15:22 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 Apr 16, 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

@zentol
Copy link
Contributor

zentol commented Apr 16, 2020

Not sure I understand the problem, extractExecutionParams is only ever called for a single line.

jvm_params=$(extractExecutionParams "$(echo "$params_output" | head -n 1)")
dynamic_configs=$(extractExecutionParams "$(echo "$params_output" | tail -n 1)")

@tsreaper
Copy link
Contributor Author

Not sure I understand the problem, extractExecutionParams is only ever called for a single line.

jvm_params=$(extractExecutionParams "$(echo "$params_output" | head -n 1)")
dynamic_configs=$(extractExecutionParams "$(echo "$params_output" | tail -n 1)")

OK I didn't notice that extractExecutionParams is only called for a single line. So shall we add this restriction to extractExecutionParams and change its error message? I'm submitting this PR because I feed multiple lines to extractExecutionParams in my code and get the error message saying that the format of my last line is incorrect, which is not the case.

@zentol
Copy link
Contributor

zentol commented Apr 16, 2020

that would make more sense, yes.

flink-dist/src/main/flink-bin/bin/config.sh Outdated Show resolved Hide resolved
flink-dist/src/main/flink-bin/bin/config.sh Outdated Show resolved Hide resolved
flink-dist/src/main/flink-bin/bin/config.sh Outdated Show resolved Hide resolved
@zentol zentol merged commit 0c9ced4 into apache:master Apr 17, 2020
@tsreaper tsreaper deleted the format-checking branch April 18, 2020 05:18
Comment on lines +647 to +652
local num_lines=$(echo "$execution_config" | wc -l)
if ! [[ ${num_lines} == 1 ]]; then
echo "[ERROR] Unexpected result ($num_lines lines): $execution_config" 1>&2
echo "[ERROR] extractExecutionParams only accepts exactly one line as the input" 1>&2
exit 1
fi
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this change broke my local setup. If I build from master I can no longer start a cluster via bin/start-cluster.sh.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the problem is that we don't do proper trimming.

@tillrohrmann
Copy link
Contributor

I think this change broke the standalone cluster setup because wc -l returns a number with a preceding tab.

@tillrohrmann
Copy link
Contributor

An easy fix could be to prepend | xargs echo but I'm not sure whether we can assume that xargs is installed on all systems.

@leonardBang
Copy link
Contributor

@tillrohrmann same error in my macOS ...
I think using if ! [[ ${num_lines} -eq 1 ]] to check number also works
I'd like to fix the soon

@leonardBang
Copy link
Contributor

@wangyang0918 has opened a PR #11820

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.

6 participants