Skip to content

Commit 8572a5a

Browse files
committed
YARN-3974. Refactor the reservation system test cases to use parameterized base test. (subru via curino)
1 parent f4c523b commit 8572a5a

File tree

11 files changed

+338
-401
lines changed

11 files changed

+338
-401
lines changed

hadoop-yarn-project/CHANGES.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,9 @@ Release 2.8.0 - UNRELEASED
377377
YARN-4019. Add JvmPauseMonitor to ResourceManager and NodeManager. (Robert Kanter
378378
via junping_du)
379379

380+
YARN-3974. Refactor the reservation system test cases to use parameterized
381+
base test. (subru via curino)
382+
380383
OPTIMIZATIONS
381384

382385
YARN-3339. TestDockerContainerExecutor should pull a single image and not

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/Plan.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.apache.hadoop.yarn.server.resourcemanager.reservation;
2020

2121
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
22-
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent;
2322

2423
/**
2524
* A Plan represents the central data structure of a reservation system that
@@ -28,7 +27,7 @@
2827
* previously accepted will be honored.
2928
*
3029
* {@link ReservationDefinition} submitted by the users through the RM public
31-
* APIs are passed to appropriate {@link ReservationAgent}s, which in turn will
30+
* APIs are passed to appropriate {@code ReservationAgent}s, which in turn will
3231
* consult the Plan (via the {@link PlanView} interface) and try to determine
3332
* whether there are sufficient resources available in this Plan to satisfy the
3433
* temporal and resource constraints of a {@link ReservationDefinition}. If a

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/PlanView.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,14 @@
1717
*/
1818
package org.apache.hadoop.yarn.server.resourcemanager.reservation;
1919

20-
import java.util.Set;
21-
2220
import org.apache.hadoop.yarn.api.records.ReservationId;
2321
import org.apache.hadoop.yarn.api.records.Resource;
24-
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent;
22+
23+
import java.util.Set;
2524

2625
/**
2726
* This interface provides a read-only view on the allocations made in this
28-
* plan. This methods are used for example by {@link ReservationAgent}s to
27+
* plan. This methods are used for example by {@code ReservationAgent}s to
2928
* determine the free resources in a certain point in time, and by
3029
* PlanFollowerPolicy to publish this plan to the scheduler.
3130
*/
@@ -66,7 +65,7 @@ public interface PlanView extends PlanContext {
6665
* @return the total {@link Resource} reserved for all users at the specified
6766
* time
6867
*/
69-
public Resource getTotalCommittedResources(long tick);
68+
Resource getTotalCommittedResources(long tick);
7069

7170
/**
7271
* Returns the total {@link Resource} reserved for a given user at the
@@ -88,7 +87,7 @@ public interface PlanView extends PlanContext {
8887
* @return the overall capacity in terms of {@link Resource} assigned to this
8988
* plan
9089
*/
91-
public Resource getTotalCapacity();
90+
Resource getTotalCapacity();
9291

9392
/**
9493
* Gets the time (UTC in ms) at which the first reservation starts

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/ReservationSchedulerConfiguration.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@
2121
import org.apache.hadoop.classification.InterfaceAudience;
2222
import org.apache.hadoop.conf.Configuration;
2323
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
24-
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent;
25-
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.Planner;
2624

2725
public abstract class ReservationSchedulerConfiguration extends Configuration {
2826

@@ -64,7 +62,7 @@ public ReservationSchedulerConfiguration(
6462

6563
/**
6664
* Checks if the queue participates in reservation based scheduling
67-
* @param queue
65+
* @param queue name of the queue
6866
* @return true if the queue participates in reservation based scheduling
6967
*/
7068
public abstract boolean isReservable(String queue);
@@ -110,10 +108,10 @@ public String getReservationAdmissionPolicy(String queue) {
110108
}
111109

112110
/**
113-
* Gets the name of the {@link ReservationAgent} class associated with the
111+
* Gets the name of the {@code ReservationAgent} class associated with the
114112
* queue
115113
* @param queue name of the queue
116-
* @return the class name of the {@link ReservationAgent}
114+
* @return the class name of the {@code ReservationAgent}
117115
*/
118116
public String getReservationAgent(String queue) {
119117
return DEFAULT_RESERVATION_AGENT_NAME;
@@ -129,10 +127,10 @@ public boolean getShowReservationAsQueues(String queuePath) {
129127
}
130128

131129
/**
132-
* Gets the name of the {@link Planner} class associated with the
130+
* Gets the name of the {@code Planner} class associated with the
133131
* queue
134132
* @param queue name of the queue
135-
* @return the class name of the {@link Planner}
133+
* @return the class name of the {@code Planner}
136134
*/
137135
public String getReplanner(String queue) {
138136
return DEFAULT_RESERVATION_PLANNER_NAME;
@@ -150,7 +148,7 @@ public boolean getMoveOnExpiry(String queue) {
150148
}
151149

152150
/**
153-
* Gets the time in milliseconds for which the {@link Planner} will verify
151+
* Gets the time in milliseconds for which the {@code Planner} will verify
154152
* the {@link Plan}s satisfy the constraints
155153
* @param queue name of the queue
156154
* @return the time in milliseconds for which to check constraints

hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/reservation/ReservationSystem.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818

1919
package org.apache.hadoop.yarn.server.resourcemanager.reservation;
2020

21-
import java.util.Map;
22-
2321
import org.apache.hadoop.classification.InterfaceAudience.LimitedPrivate;
2422
import org.apache.hadoop.classification.InterfaceStability.Unstable;
2523
import org.apache.hadoop.conf.Configuration;
@@ -28,16 +26,15 @@
2826
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
2927
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Queue;
3028
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
31-
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
32-
import org.apache.hadoop.yarn.api.records.Resource;
33-
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent;
29+
30+
import java.util.Map;
3431

3532
/**
3633
* This interface is the one implemented by any system that wants to support
37-
* Reservations i.e. make {@link Resource} allocations in future. Implementors
34+
* Reservations i.e. make {@code Resource} allocations in future. Implementors
3835
* need to bootstrap all configured {@link Plan}s in the active
3936
* {@link ResourceScheduler} along with their corresponding
40-
* {@link ReservationAgent} and {@link SharingPolicy}. It is also responsible
37+
* {@code ReservationAgent} and {@link SharingPolicy}. It is also responsible
4138
* for managing the {@link PlanFollower} to ensure the {@link Plan}s are in sync
4239
* with the {@link ResourceScheduler}.
4340
*/
@@ -49,15 +46,15 @@ public interface ReservationSystem {
4946
* Set RMContext for {@link ReservationSystem}. This method should be called
5047
* immediately after instantiating a reservation system once.
5148
*
52-
* @param rmContext created by {@link ResourceManager}
49+
* @param rmContext created by {@code ResourceManager}
5350
*/
5451
void setRMContext(RMContext rmContext);
5552

5653
/**
5754
* Re-initialize the {@link ReservationSystem}.
5855
*
5956
* @param conf configuration
60-
* @param rmContext current context of the {@link ResourceManager}
57+
* @param rmContext current context of the {@code ResourceManager}
6158
* @throws YarnException
6259
*/
6360
void reinitialize(Configuration conf, RMContext rmContext)

0 commit comments

Comments
 (0)