|
@@ -21,6 +21,7 @@ package org.apache.hadoop.yarn.server.resourcemanager.reservation.planning;
|
|
|
import java.util.LinkedList;
|
|
|
import java.util.List;
|
|
|
|
|
|
+import org.apache.hadoop.conf.Configuration;
|
|
|
import org.apache.hadoop.yarn.api.records.ReservationDefinition;
|
|
|
import org.apache.hadoop.yarn.api.records.ReservationId;
|
|
|
import org.apache.hadoop.yarn.server.resourcemanager.reservation.Plan;
|
|
@@ -35,22 +36,25 @@ import org.slf4j.LoggerFactory;
|
|
|
public class AlignedPlannerWithGreedy implements ReservationAgent {
|
|
|
|
|
|
// Default smoothness factor
|
|
|
- private static final int DEFAULT_SMOOTHNESS_FACTOR = 10;
|
|
|
+ public static final int DEFAULT_SMOOTHNESS_FACTOR = 10;
|
|
|
+ public static final String SMOOTHNESS_FACTOR =
|
|
|
+ "yarn.resourcemanager.reservation-system.smoothness-factor";
|
|
|
|
|
|
// Log
|
|
|
private static final Logger LOG = LoggerFactory
|
|
|
.getLogger(AlignedPlannerWithGreedy.class);
|
|
|
|
|
|
// Smoothness factor
|
|
|
- private final ReservationAgent planner;
|
|
|
+ private ReservationAgent planner;
|
|
|
|
|
|
// Constructor
|
|
|
public AlignedPlannerWithGreedy() {
|
|
|
- this(DEFAULT_SMOOTHNESS_FACTOR);
|
|
|
}
|
|
|
|
|
|
- // Constructor
|
|
|
- public AlignedPlannerWithGreedy(int smoothnessFactor) {
|
|
|
+ @Override
|
|
|
+ public void init(Configuration conf) {
|
|
|
+ int smoothnessFactor =
|
|
|
+ conf.getInt(SMOOTHNESS_FACTOR, DEFAULT_SMOOTHNESS_FACTOR);
|
|
|
|
|
|
// List of algorithms
|
|
|
List<ReservationAgent> listAlg = new LinkedList<ReservationAgent>();
|
|
@@ -71,7 +75,6 @@ public class AlignedPlannerWithGreedy implements ReservationAgent {
|
|
|
// 1. Attempt to execute algAligned
|
|
|
// 2. If failed, fall back to algGreedy
|
|
|
planner = new TryManyReservationAgents(listAlg);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
@Override
|
|
@@ -119,5 +122,4 @@ public class AlignedPlannerWithGreedy implements ReservationAgent {
|
|
|
return planner.deleteReservation(reservationId, user, plan);
|
|
|
|
|
|
}
|
|
|
-
|
|
|
}
|