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-17264][scripts] Fix broken taskmanager.sh by using -eq to compare num_lines #11820

Closed

Conversation

wangyang0918
Copy link
Contributor

What is the purpose of the change

Start a taskmanager on Mac via taskmanager.sh will get the following error.

wangyang-pc:build-target danrtsey.wy$ ./bin/taskmanager.sh start-foreground [ERROR] Unexpected result ( 1 lines): BASH_JAVA_UTILS_EXEC_RESULT:-Xmx536870902 -Xms536870902 -XX:MaxDirectMemorySize=268435458 -XX:MaxMetaspaceSize=268435456 [ERROR] extractExecutionParams only accepts exactly one line as the input [ERROR] Could not get JVM parameters properly.

The root cause is FLINK-17023 introduce the following change and it could not work as expected.

local num_lines=$(echo "$execution_config" | wc -l)

On linux environment, the output is "1". However, on Mac, it is " 1". Maybe we need to add tr -d '[:space:]' after wc.

Brief change log

  • Add tr -d '[:space:]'

Verifying this change

  • Manually test on Mac
  • Covered by existing test on linux

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

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

Documentation

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

@wangyang0918
Copy link
Contributor Author

cc @zentol Could you help to review this simple PR?

@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 a75e89f (Mon Apr 20 10:33:30 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 20, 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

@wangyang0918 wangyang0918 changed the title [FLINK-17264][scripts] Fix broken taskmanager.sh by trimming space of wc command output [FLINK-17264][scripts] Fix broken taskmanager.sh by using -eq to compare num_lines Apr 20, 2020
@wangyang0918
Copy link
Contributor Author

@zentol I have updated the PR as @aljoscha's suggestion. Use -eq instead of == for the num comparison.

@aljoscha
Copy link
Contributor

I did mean -ne. The current code is if ! [[ ${num_lines} -eq 1 ]]; then, the ! is important.

My suggestion was if [[ ${num_lines} -ne 1 ]]; then.

Copy link
Contributor

@leonardBang leonardBang left a comment

Choose a reason for hiding this comment

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

Thanks @wangyang0918
if [[ ${num_lines} -ne 1 ]] is better

@wangyang0918
Copy link
Contributor Author

Thanks @aljoscha @leonardBang, i have updated the PR to use -ne.

@tsreaper
Copy link
Contributor

Sorry for introducing this bug in the code. I discover that there are also other scripts (mostly e2e test scripts, for example test_cli.sh and shade.sh) uses wc -l and == to compare numbers. Shall we fix them too?

@leonardBang
Copy link
Contributor

Sorry for introducing this bug in the code. I discover that there are also other scripts (mostly e2e test scripts, for example test_cli.sh and shade.sh) uses wc -l and == to compare numbers. Shall we fix them too?

The root cause is that tabs alignment https://apple.stackexchange.com/questions/370366/why-is-wc-c-printing-spaces-before-the-number
If these e2e tests fails in macOS(mostly dev environment), I think we should open a jira to track and repair too.

@wangyang0918
Copy link
Contributor Author

I am not sure how many users are running e2e tests on the Mac. And how many incompatible commands do we have in e2e tests. So maybe we need to create another ticket and have the discussion there.

@tillrohrmann
Copy link
Contributor

Thanks for creating this PR @wangyang0918. LGTM. +1 for merging this PR.

@tillrohrmann
Copy link
Contributor

Merging this PR now.

@aljoscha
Copy link
Contributor

@wangyang0918 I regularly run e2e tests on my mac when debugging issues, so it would be good to also fix those usages. Do you want to open an issue and cut a PR for that? Please ping me if you do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
8 participants