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-14405][runtime] Align ResourceProfile/ResourceSpec fields with the new TaskExecutor memory setups. #9910
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 e3f278e (Wed Dec 04 15:06:07 UTC 2019) 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:
|
CI report:
Bot commandsThe @flinkbot bot supports the following commands:
|
Hi @xintongsong It seems the correct JIRA id of this PR should be FLINK-14405? |
Thanks for the correction, @yanghua. Just fixed. |
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 PR @xintongsong
I left small comments and one to discuss about the case where the operator does not care about the type of the requested managed memory.
flink-java/src/main/java/org/apache/flink/api/java/operators/DataSink.java
Outdated
Show resolved
Hide resolved
...k-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
Outdated
Show resolved
Hide resolved
...k-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
Outdated
Show resolved
Hide resolved
flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
Outdated
Show resolved
Hide resolved
flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
Show resolved
Hide resolved
flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
Show resolved
Hide resolved
...k-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
Show resolved
Hide resolved
...k-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
Show resolved
Hide resolved
...k-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
Outdated
Show resolved
Hide resolved
...blink/src/main/java/org/apache/flink/table/planner/plan/nodes/resource/NodeResourceUtil.java
Show resolved
Hide resolved
8d1696b
to
bd54289
Compare
@azagrebin, |
90c4d2d
to
d2493bf
Compare
@azagrebin, |
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 the comments @xintongsong
I have left some smaller comments to resolve before merge.
For future, it would be also nice to have changes for spec and profile in separate commits in this kind of PR.
.../src/test/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManagerImplTest.java
Outdated
Show resolved
Hide resolved
.../src/test/java/org/apache/flink/runtime/resourcemanager/slotmanager/SlotManagerImplTest.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/api/common/operators/util/OperatorResourceParallelismUtils.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/api/common/operators/util/OperatorResourceParallelismUtils.java
Outdated
Show resolved
Hide resolved
...c/main/java/org/apache/flink/api/common/operators/util/OperatorResourceParallelismUtils.java
Outdated
Show resolved
Hide resolved
...k-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
Outdated
Show resolved
Hide resolved
@@ -416,56 +480,56 @@ public ResourceProfile subtract(ResourceProfile other) { | |||
|
|||
return new ResourceProfile( | |||
subtractDoublesConsideringInf(cpuCores, other.cpuCores), |
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.
Can we actually subtract a resource with some bigger field?
Like, we can get negative CPU which we do not check in the constructor anymore
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.
There's a checkArgument
to make sure that this
is larger than other
, if this is what you are concerning.
MemorySize.MAX_VALUE, | ||
MemorySize.MAX_VALUE, | ||
// TODO: before operators separate on-heap/off-heap managed memory, we use on-heap managed memory to denote total managed memory | ||
MemorySize.parse(managedMemoryPerSlotMB + "m"), |
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.
This should basically be adjusted with the #9801, right?
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
flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
Outdated
Show resolved
Hide resolved
...k-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
Show resolved
Hide resolved
flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
Outdated
Show resolved
Hide resolved
flink-core/src/main/java/org/apache/flink/api/common/operators/ResourceSpec.java
Outdated
Show resolved
Hide resolved
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 generally LGTM.
One comment, is the usage of UNKNOWN
correct in Dispatcher#isPartialResourceConfigured
?
...k-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
Outdated
Show resolved
Hide resolved
Yes, I think so. |
d2493bf
to
0d09297
Compare
...k-runtime/src/main/java/org/apache/flink/runtime/clusterframework/types/ResourceProfile.java
Outdated
Show resolved
Hide resolved
8d1671e
to
e34903f
Compare
Thanks for the review, @azagrebin, @zhuzhurk, @KarmaGYZ. |
Travis Passed: https://travis-ci.org/xintongsong/flink/builds/608570964 |
This class is for the legacy code, and there's no usage of this class in production codes.
- UNKNOWN should be used for describing: - A resource requirement (SlotRequest, SlotProfile, ExecutionJobVertex, etc.) that the exact amount of resource needed is not specified. - Remaining resource of a multi task slot (SlotInfoAndResources) that contains tasks with unknown resource profiles. - UNKNOWN should not be used for describing total resource of a slot / task executor (TaskSlot, SlotOffer, SlotReport, etc.), which should always be specific with FLIP-49. - ANY should be used for describing a set of resource (SlotOffer, SlotReport, TaskSlot, etc.) that is large enough to match any request. It's for testability purpose only. With FLIP-49, task executors / slots should always have specific resource profiles in production. This commit fix misusages of the two constants.
…d task heap memory size, unless it UNKNOWN.
…notate constructors used only in testing codes as VisibleForTestting for ResourceProfile.
e34903f
to
e3f278e
Compare
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 @xintongsong
LGTM, merging it when the Travis is green
What is the purpose of the change
This PR updates fields of
ResourceProfile
andResourceSpec
to align with FLIP-49TaskExecutor
resources.Brief change log
MemorySize
constants of special values that are reused a lot.SimpleSlotContext
to test scope. There's no usage in production codes. This change will allow us to annotateResourceProfile#ANY
as for test purpose only.ResourceProfile#UNKNOWN
andResourceProfile#ANY
.ResourceProfile#UNKNOWN
.MemorySize
Comparable
.ResourceProfile
andResourceSpec
fields to align with FLIP-49TaskExecutor
resources.ResourceSpec
to always have cpu cores and task heap memory size specified, unless isUNKNOWN
.Verifying this change
This change is already covered by existing tests, such as
ResourceProfileTest
andResourceSpecTest
. This PR updates the existing tests to align with the new fields.Does this pull request potentially affect one of the following parts:
@Public(Evolving)
: (yes)Documentation