Skip to content

Commit

Permalink
YARN-3974. Refactor the reservation system test cases to use paramete…
Browse files Browse the repository at this point in the history
…rized base test. (subru via curino)
  • Loading branch information
curino committed Aug 2, 2015
1 parent f4c523b commit 8572a5a
Show file tree
Hide file tree
Showing 11 changed files with 338 additions and 401 deletions.
3 changes: 3 additions & 0 deletions hadoop-yarn-project/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,9 @@ Release 2.8.0 - UNRELEASED
YARN-4019. Add JvmPauseMonitor to ResourceManager and NodeManager. (Robert Kanter
via junping_du)

YARN-3974. Refactor the reservation system test cases to use parameterized
base test. (subru via curino)

OPTIMIZATIONS

YARN-3339. TestDockerContainerExecutor should pull a single image and not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
package org.apache.hadoop.yarn.server.resourcemanager.reservation;

import org.apache.hadoop.yarn.api.records.ReservationDefinition;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent;

/**
* A Plan represents the central data structure of a reservation system that
Expand All @@ -28,7 +27,7 @@
* previously accepted will be honored.
*
* {@link ReservationDefinition} submitted by the users through the RM public
* APIs are passed to appropriate {@link ReservationAgent}s, which in turn will
* APIs are passed to appropriate {@code ReservationAgent}s, which in turn will
* consult the Plan (via the {@link PlanView} interface) and try to determine
* whether there are sufficient resources available in this Plan to satisfy the
* temporal and resource constraints of a {@link ReservationDefinition}. If a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,14 @@
*/
package org.apache.hadoop.yarn.server.resourcemanager.reservation;

import java.util.Set;

import org.apache.hadoop.yarn.api.records.ReservationId;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent;

import java.util.Set;

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

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

/**
* Gets the time (UTC in ms) at which the first reservation starts
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@
import org.apache.hadoop.classification.InterfaceAudience;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.Planner;

public abstract class ReservationSchedulerConfiguration extends Configuration {

Expand Down Expand Up @@ -64,7 +62,7 @@ public ReservationSchedulerConfiguration(

/**
* Checks if the queue participates in reservation based scheduling
* @param queue
* @param queue name of the queue
* @return true if the queue participates in reservation based scheduling
*/
public abstract boolean isReservable(String queue);
Expand Down Expand Up @@ -110,10 +108,10 @@ public String getReservationAdmissionPolicy(String queue) {
}

/**
* Gets the name of the {@link ReservationAgent} class associated with the
* Gets the name of the {@code ReservationAgent} class associated with the
* queue
* @param queue name of the queue
* @return the class name of the {@link ReservationAgent}
* @return the class name of the {@code ReservationAgent}
*/
public String getReservationAgent(String queue) {
return DEFAULT_RESERVATION_AGENT_NAME;
Expand All @@ -129,10 +127,10 @@ public boolean getShowReservationAsQueues(String queuePath) {
}

/**
* Gets the name of the {@link Planner} class associated with the
* Gets the name of the {@code Planner} class associated with the
* queue
* @param queue name of the queue
* @return the class name of the {@link Planner}
* @return the class name of the {@code Planner}
*/
public String getReplanner(String queue) {
return DEFAULT_RESERVATION_PLANNER_NAME;
Expand All @@ -150,7 +148,7 @@ public boolean getMoveOnExpiry(String queue) {
}

/**
* Gets the time in milliseconds for which the {@link Planner} will verify
* Gets the time in milliseconds for which the {@code Planner} will verify
* the {@link Plan}s satisfy the constraints
* @param queue name of the queue
* @return the time in milliseconds for which to check constraints
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@

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

import java.util.Map;

import org.apache.hadoop.classification.InterfaceAudience.LimitedPrivate;
import org.apache.hadoop.classification.InterfaceStability.Unstable;
import org.apache.hadoop.conf.Configuration;
Expand All @@ -28,16 +26,15 @@
import org.apache.hadoop.yarn.server.resourcemanager.RMContext;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.Queue;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.ResourceScheduler;
import org.apache.hadoop.yarn.server.resourcemanager.ResourceManager;
import org.apache.hadoop.yarn.api.records.Resource;
import org.apache.hadoop.yarn.server.resourcemanager.reservation.planning.ReservationAgent;

import java.util.Map;

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

/**
* Re-initialize the {@link ReservationSystem}.
*
* @param conf configuration
* @param rmContext current context of the {@link ResourceManager}
* @param rmContext current context of the {@code ResourceManager}
* @throws YarnException
*/
void reinitialize(Configuration conf, RMContext rmContext)
Expand Down
Loading

0 comments on commit 8572a5a

Please sign in to comment.