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-14405][runtime] Align ResourceProfile/ResourceSpec fields with the new TaskExecutor memory setups. #9910

Conversation

xintongsong
Copy link
Contributor

@xintongsong xintongsong commented Oct 16, 2019

What is the purpose of the change

This PR updates fields of ResourceProfile and ResourceSpec to align with FLIP-49 TaskExecutor resources.

Brief change log

  • 1917ca8..11b699b: Hot-fixes and clean-ups that should not introduce behavior changes.
    • 1917ca8: Introduce MemorySize constants of special values that are reused a lot.
    • 69c49f3: Move SimpleSlotContext to test scope. There's no usage in production codes. This change will allow us to annotate ResourceProfile#ANY as for test purpose only.
    • 2407804: Fix misusage of ResourceProfile#UNKNOWN and ResourceProfile#ANY.
    • 265ebd9: Deduplicate operator resource / parallelism argument checks.
    • 41be21c: Disable numerical comparing ResourceProfile#UNKNOWN.
    • 11b699b: Make MemorySize Comparable.
  • 02a54db: Update ResourceProfile and ResourceSpec fields to align with FLIP-49 TaskExecutor resources.
  • d2493bf: Restrict ResourceSpec to always have cpu cores and task heap memory size specified, unless is UNKNOWN.

Verifying this change

This change is already covered by existing tests, such as ResourceProfileTest and ResourceSpecTest. This PR updates the existing tests to align with the new fields.

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): (yes)
  • The serializers: (no)
  • The runtime per-record code paths (performance sensitive): (no)
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, 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

flinkbot commented Oct 16, 2019

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 e3f278e (Wed Dec 04 15:06:07 UTC 2019)

Warnings:

  • No documentation files were touched! Remember to keep the Flink docs up to date!

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

@xintongsong xintongsong changed the title [FLINK-14406] Align ResourceProfile/ResourceSpec fields with the new TaskExecutor memory setups. [FLINK-14406][runtime][core] Align ResourceProfile/ResourceSpec fields with the new TaskExecutor memory setups. Oct 16, 2019
@xintongsong xintongsong changed the title [FLINK-14406][runtime][core] Align ResourceProfile/ResourceSpec fields with the new TaskExecutor memory setups. [FLINK-14406][runtime] Align ResourceProfile/ResourceSpec fields with the new TaskExecutor memory setups. Oct 16, 2019
@xintongsong xintongsong marked this pull request as ready for review October 16, 2019 10:41
@flinkbot
Copy link
Collaborator

flinkbot commented Oct 16, 2019

CI report:

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

@yanghua
Copy link
Contributor

yanghua commented Oct 16, 2019

Hi @xintongsong It seems the correct JIRA id of this PR should be FLINK-14405?

@xintongsong xintongsong changed the title [FLINK-14406][runtime] Align ResourceProfile/ResourceSpec fields with the new TaskExecutor memory setups. [FLINK-14405][runtime] Align ResourceProfile/ResourceSpec fields with the new TaskExecutor memory setups. Oct 16, 2019
@xintongsong
Copy link
Contributor Author

Thanks for the correction, @yanghua. Just fixed.

Copy link
Contributor

@azagrebin azagrebin left a 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.

@xintongsong xintongsong force-pushed the FLINK-14405-flip49-resource-profile-spec branch from 8d1696b to bd54289 Compare October 17, 2019 11:55
@xintongsong
Copy link
Contributor Author

@azagrebin,
I've updated the PR addresses some of your comments (of which conversations are resolved). For the rest of them, I need your feedback to proceed. Thanks

@xintongsong xintongsong force-pushed the FLINK-14405-flip49-resource-profile-spec branch 3 times, most recently from 90c4d2d to d2493bf Compare October 18, 2019 06:24
@xintongsong
Copy link
Contributor Author

@azagrebin,
I've updated the PR. Could you please take another look.
Travis passed: https://travis-ci.org/xintongsong/flink/builds/599486641

Copy link
Contributor

@azagrebin azagrebin left a 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.

@@ -416,56 +480,56 @@ public ResourceProfile subtract(ResourceProfile other) {

return new ResourceProfile(
subtractDoublesConsideringInf(cpuCores, other.cpuCores),
Copy link
Contributor

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

Copy link
Contributor Author

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"),
Copy link
Contributor

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?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes

Copy link
Contributor

@KarmaGYZ KarmaGYZ left a 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?

@xintongsong
Copy link
Contributor Author

It generally LGTM.
One comment, is the usage of UNKNOWN correct in Dispatcher#isPartialResourceConfigured?

Yes, I think so.

@xintongsong xintongsong force-pushed the FLINK-14405-flip49-resource-profile-spec branch from d2493bf to 0d09297 Compare November 7, 2019 03:52
@xintongsong xintongsong force-pushed the FLINK-14405-flip49-resource-profile-spec branch 2 times, most recently from 8d1671e to e34903f Compare November 7, 2019 05:22
@xintongsong
Copy link
Contributor Author

Thanks for the review, @azagrebin, @zhuzhurk, @KarmaGYZ.
The comments are addressed.

@xintongsong
Copy link
Contributor Author

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.
…notate constructors used only in testing codes as VisibleForTestting for ResourceProfile.
@xintongsong xintongsong force-pushed the FLINK-14405-flip49-resource-profile-spec branch from e34903f to e3f278e Compare November 11, 2019 15:27
Copy link
Contributor

@azagrebin azagrebin left a 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

@azagrebin
Copy link
Contributor

merged into master by b872f19 .. 36d1b62

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