Skip to content

YARN-12023. Make TestCapacityOverTimePolicy independent of the time of day - #8814

Open
joseluisll wants to merge 2 commits into
apache:trunkfrom
joseluisll:YARN-12023-upstream
Open

joseluisll wants to merge 2 commits into
apache:trunkfrom
joseluisll:YARN-12023-upstream

Conversation

@joseluisll

Copy link
Copy Markdown
Contributor

Description of PR

JIRA: https://issues.apache.org/jira/browse/YARN-12023

BaseSharingPolicyTest#generateRLEAlloc folded a reservation onto its period starting at initTime % period, with initTime taken from the wall clock. Its wrap-around arithmetic dropped one full period whenever the rest of the duration wrapped past the end of the period. For example, a 25h reservation on a 1-day period produced only about 1h of allocation when the test ran between 23:00 and 24:00 UTC, so the expected PlanningQuotaException for that case was never thrown.

This change:

  • Generates floor(duration / period) full periods plus the remainder, starting at initTime % period and wrapping when needed, so the generated allocation always adds up to duration.
  • Uses a fixed initTime. At a few specific times of day, PeriodicRLESparseResourceAllocation#getRangeOverlapping can return an open-ended allocation when a step lands exactly on the range end (tracked separately as YARN-12022). CapacityOverTimePolicy then rejects some cases for that reason instead of the one under test.

This is a test-only change in BaseSharingPolicyTest, which affects TestCapacityOverTimePolicy and TestNoOverCommitPolicy.

How was this patch tested?

Test-only change; covered by TestCapacityOverTimePolicy and TestNoOverCommitPolicy in hadoop-yarn-server-resourcemanager.

For code changes:

  • Does the title of this PR start with the corresponding JIRA issue id (e.g. 'HADOOP-17799. Your PR title ...')?
  • Object storage: Have the integration tests been executed and the endpoint declared according to the connector-specific documentation? (N/A)
  • If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under ASF 2.0? (N/A, no new dependencies)
  • If applicable, have you updated the LICENSE, LICENSE-binary, NOTICE-binary files? (N/A)

AI Tooling

Contains content generated by Claude Code.

…f day.

BaseSharingPolicyTest#generateRLEAlloc folded a reservation onto its
period starting at initTime % period, with initTime taken from the wall
clock. Its wrap-around arithmetic lost one full period whenever the
remainder of the duration wrapped past the period end, e.g. a 25h
reservation on a 1-day period generated only ~1h of allocation when the
test ran between 23:00 and 24:00 UTC, so the expected
PlanningQuotaException for that case was not thrown.

Generate floor(duration / period) full periods plus the remainder
starting at initTime % period, wrapping it if needed, so the generated
allocation always amounts to duration. Also use a fixed initTime, as
PeriodicRLESparseResourceAllocation#getRangeOverlapping can return an
open-ended allocation when a step lands exactly on the range end, which
makes CapacityOverTimePolicy reject some cases for that reason (YARN-12022) instead
of the one under test at a few specific times of day.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@hadoop-yetus

Copy link
Copy Markdown

🎊 +1 overall

Vote Subsystem Runtime Logfile Comment
+0 🆗 reexec 0m 23s Docker mode activated.
_ Prechecks _
+1 💚 dupname 0m 0s No case conflicting files found.
+0 🆗 codespell 0m 0s codespell was not available.
+0 🆗 detsecrets 0m 0s detect-secrets was not available.
+1 💚 @author 0m 0s The patch does not contain any @author tags.
+1 💚 test4tests 0m 0s The patch appears to include 1 new or modified test files.
_ trunk Compile Tests _
+1 💚 mvninstall 27m 51s trunk passed
+1 💚 compile 0m 52s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 compile 0m 54s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 checkstyle 0m 54s trunk passed
+1 💚 mvnsite 0m 55s trunk passed
+1 💚 javadoc 0m 51s trunk passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 47s trunk passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 1m 35s trunk passed
+1 💚 shadedclient 16m 48s branch has no errors when building and testing our client artifacts.
_ Patch Compile Tests _
+1 💚 mvninstall 0m 37s the patch passed
+1 💚 compile 0m 31s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javac 0m 31s the patch passed
+1 💚 compile 0m 35s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 javac 0m 35s the patch passed
+1 💚 blanks 0m 0s The patch has no blanks issues.
+1 💚 checkstyle 0m 29s the patch passed
+1 💚 mvnsite 0m 34s the patch passed
+1 💚 javadoc 0m 26s the patch passed with JDK Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu
+1 💚 javadoc 0m 28s the patch passed with JDK Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
+1 💚 spotbugs 1m 16s the patch passed
+1 💚 shadedclient 16m 5s patch has no errors when building and testing our client artifacts.
_ Other Tests _
+1 💚 unit 90m 48s hadoop-yarn-server-resourcemanager in the patch passed.
+1 💚 asflicense 0m 25s The patch does not generate ASF License warnings.
164m 28s
Subsystem Report/Notes
Docker ClientAPI=1.56 ServerAPI=1.56 base: https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8814/3/artifact/out/Dockerfile
GITHUB PR #8814
Optional Tests dupname asflicense compile javac javadoc mvninstall mvnsite unit shadedclient spotbugs checkstyle codespell detsecrets
uname Linux 8e2dbc0f0841 5.15.0-190-generic #200-Ubuntu SMP Fri Aug 7 15:06:04 UTC 2026 x86_64 x86_64 x86_64 GNU/Linux
Build tool maven
Personality dev-support/bin/hadoop.sh
git revision trunk / 4a302aa
Default Java Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Multi-JDK versions /usr/lib/jvm/java-21-openjdk-amd64:Ubuntu-21.0.12.1+1-1-24.04.4-Ubuntu /usr/lib/jvm/java-17-openjdk-amd64:Ubuntu-17.0.20.1+1-1-24.04-Ubuntu
Test Results https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8814/3/testReport/
Max. process+thread count 966 (vs. ulimit of 10000)
modules C: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager U: hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager
Console output https://ci-hadoop.apache.org/job/hadoop-multibranch/job/PR-8814/3/console
versions git=2.43.0 maven=3.9.15 spotbugs=4.9.7
Powered by Apache Yetus 0.14.1 https://yetus.apache.org

This message was automatically generated.

This branch has not been deployed

No deployments
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.

2 participants