-
Notifications
You must be signed in to change notification settings - Fork 13.8k
[FLINK-19151][yarn]Fix the unit value according to different yarn scheduler #13347
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
Conversation
|
Thanks a lot for your contribution to the Apache Flink project. I'm the @flinkbot. I help the community Automated ChecksLast check on commit 08cde36 (Tue Sep 08 02:57:45 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. DetailsThe 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:
|
xintongsong
left a comment
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 preparing this PR, @Manbuyun.
I have some comments, which would be good to address before merging this.
In addition to the inline comment:
- There's no testing cases that verify the changes
- The commit messages are not following the community's conventions. Please refer to "Commit Naming Conventions" in this page
flink-yarn/src/main/java/org/apache/flink/yarn/WorkerSpecContainerResourceAdapter.java
Outdated
Show resolved
Hide resolved
flink-yarn/src/main/java/org/apache/flink/yarn/YarnResourceManager.java
Outdated
Show resolved
Hide resolved
flink-yarn/src/main/java/org/apache/flink/yarn/YarnResourceManager.java
Outdated
Show resolved
Hide resolved
xintongsong
left a comment
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 addressing my comments, @Manbuyun.
The PR already looks quite good to me now. I'll take over from here.
I have only a few minor comments, which I will address myself while merging this.
| } | ||
|
|
||
| /** | ||
| * Normalize to the minimum integer that is greater or equal to 'value' and is positive integer multiple of 'unitValue'. |
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.
JavaDoc needs update.
| public void testGetUnitResource() { | ||
| YarnConfiguration yarnConfig = new YarnConfiguration(); | ||
|
|
||
| yarnConfig.set("yarn.resourcemanager.scheduler.class", "org.apache.hadoop.yarn.server.resourcemanager.scheduler.fair.FairScheduler"); |
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.
We should always try to avoid magic string literals if possible.
| final int unitMemMB1 = 150; | ||
| final int unitVcore1 = 15; | ||
| final WorkerSpecContainerResourceAdapter adapter1 = | ||
| new WorkerSpecContainerResourceAdapter( | ||
| getConfigProcessSpecEqualsWorkerSpec(), | ||
| minMemMB, | ||
| minVcore, | ||
| Integer.MAX_VALUE, | ||
| Integer.MAX_VALUE, | ||
| unitMemMB1, | ||
| unitVcore1, | ||
| Collections.emptyMap()); | ||
|
|
||
| final Resource containerResource4 = Resource.newInstance(150, 15); | ||
|
|
||
| assertThat(adapter1.getWorkerSpecs(containerResource1, strategy), empty()); | ||
| assertThat(adapter1.getWorkerSpecs(containerResource2, strategy), empty()); | ||
|
|
||
| assertThat(adapter1.tryComputeContainerResource(workerSpec1).get(), is(containerResource4)); | ||
| assertThat(adapter1.tryComputeContainerResource(workerSpec2).get(), is(containerResource4)); | ||
| assertThat(adapter1.tryComputeContainerResource(workerSpec3).get(), is(containerResource4)); | ||
| assertThat(adapter1.tryComputeContainerResource(workerSpec4).get(), is(containerResource4)); | ||
|
|
||
| assertThat(adapter1.getWorkerSpecs(containerResource4, strategy), containsInAnyOrder(workerSpec1, workerSpec2, workerSpec3, workerSpec4)); |
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.
I'm not sure whether it is necessary to introduce another adapter. Should be good enough to tune the parameters of existing cases.
I guess the problem is that the original test case did not make its intention explicit.
| final int unitMemMB1 = 150; | ||
| final int unitVcore1 = 15; | ||
| final WorkerSpecContainerResourceAdapter adapter1 = | ||
| new WorkerSpecContainerResourceAdapter( | ||
| getConfigProcessSpecEqualsWorkerSpec(), | ||
| minMemMB, | ||
| minVcore, | ||
| Integer.MAX_VALUE, | ||
| Integer.MAX_VALUE, | ||
| unitMemMB1, | ||
| unitVcore1, | ||
| Collections.emptyMap()); | ||
|
|
||
| final Resource containerResource6 = Resource.newInstance(150, 15); | ||
|
|
||
| assertThat(adapter1.tryComputeContainerResource(workerSpec1).get(), is(containerResource6)); | ||
| assertThat(adapter1.tryComputeContainerResource(workerSpec2).get(), is(containerResource6)); | ||
| assertThat(adapter1.tryComputeContainerResource(workerSpec3).get(), is(containerResource6)); | ||
| assertThat(adapter1.tryComputeContainerResource(workerSpec4).get(), is(containerResource6)); | ||
|
|
||
| assertThat(adapter1.getEquivalentContainerResource(containerResource4, strategy), empty()); | ||
| assertThat(adapter1.getEquivalentContainerResource(containerResource5, strategy), contains(containerResource6)); | ||
|
|
||
| assertThat(adapter1.getWorkerSpecs(containerResource3, strategy), containsInAnyOrder(workerSpec1, workerSpec2, workerSpec3, workerSpec4)); |
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.
Same here.
…, with respect to Yarn FairScheduler.
…, with respect to Yarn FairScheduler. This closes #13347.
What is the purpose of the change
*Currently, Flink matches the allocated containers to the original requests by reading the Yarn configurations and calculate how the requested resources should be normalized.
What has been overlooked is that, Yarn FairScheduler (and its subclass SLSFairScheduler) has overridden the normalization behavior.
Flink should be good enough to cover behaviors of all the schedulers that Yarn currently provides*
Brief change log
Verifying this change
This change is already covered by existing tests.
Does this pull request potentially affect one of the following parts:
@Public(Evolving): (no)Documentation