org.apache.hadoop.yarn.server.resourcemanager.reservation
Class AbstractReservationSystem

java.lang.Object
  extended by org.apache.hadoop.service.AbstractService
      extended by org.apache.hadoop.yarn.server.resourcemanager.reservation.AbstractReservationSystem
All Implemented Interfaces:
Closeable, org.apache.hadoop.service.Service, ReservationSystem
Direct Known Subclasses:
CapacityReservationSystem

@InterfaceAudience.LimitedPrivate(value="yarn")
@InterfaceStability.Unstable
public abstract class AbstractReservationSystem
extends org.apache.hadoop.service.AbstractService
implements ReservationSystem

This is the implementation of ReservationSystem based on the ResourceScheduler


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE
 
Field Summary
protected  org.apache.hadoop.conf.Configuration conf
           
protected  long planStepSize
           
 
Constructor Summary
AbstractReservationSystem(String name)
          Construct the service.
 
Method Summary
protected abstract  SharingPolicy getAdmissionPolicy(String queueName)
           
protected abstract  ReservationAgent getAgent(String queueName)
           
 Map<String,Plan> getAllPlans()
          Return a map containing all the plans known to this ReservationSystem (useful for UI)
static String getDefaultReservationSystem(ResourceScheduler scheduler)
          Get the default reservation system corresponding to the scheduler
 org.apache.hadoop.yarn.api.records.ReservationId getNewReservationId()
          Get a new unique ReservationId.
 Plan getPlan(String planName)
          Get an existing Plan that has been initialized.
 long getPlanFollowerTimeStep()
          Return the time step (ms) at which the PlanFollower is invoked
 String getQueueForReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId)
          Get the Queue that an existing ReservationId is associated with.
protected abstract  Planner getReplanner(String planQueueName)
           
protected abstract  Plan initializePlan(String planQueueName)
           
 void reinitialize(org.apache.hadoop.conf.Configuration conf, RMContext rmContext)
          Re-initialize the ReservationSystem.
 void serviceInit(org.apache.hadoop.conf.Configuration conf)
           
 void serviceStart()
           
 void serviceStop()
           
 void setQueueForReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId, String queueName)
          Set the Queue that an existing ReservationId should be associated with.
 void setRMContext(RMContext rmContext)
          Set RMContext for ReservationSystem.
 void synchronizePlan(String planName)
          Invokes PlanFollower to synchronize the specified Plan with the ResourceScheduler
 
Methods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, toString, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

conf

protected org.apache.hadoop.conf.Configuration conf

planStepSize

protected long planStepSize
Constructor Detail

AbstractReservationSystem

public AbstractReservationSystem(String name)
Construct the service.

Parameters:
name - service name
Method Detail

setRMContext

public void setRMContext(RMContext rmContext)
Description copied from interface: ReservationSystem
Set RMContext for ReservationSystem. This method should be called immediately after instantiating a reservation system once.

Specified by:
setRMContext in interface ReservationSystem
Parameters:
rmContext - created by ResourceManager

reinitialize

public void reinitialize(org.apache.hadoop.conf.Configuration conf,
                         RMContext rmContext)
                  throws org.apache.hadoop.yarn.exceptions.YarnException
Description copied from interface: ReservationSystem
Re-initialize the ReservationSystem.

Specified by:
reinitialize in interface ReservationSystem
Parameters:
conf - configuration
rmContext - current context of the ResourceManager
Throws:
org.apache.hadoop.yarn.exceptions.YarnException

getPlan

public Plan getPlan(String planName)
Description copied from interface: ReservationSystem
Get an existing Plan that has been initialized.

Specified by:
getPlan in interface ReservationSystem
Parameters:
planName - the name of the Plan
Returns:
the Plan identified by name

getPlanFollowerTimeStep

public long getPlanFollowerTimeStep()
Description copied from interface: ReservationSystem
Return the time step (ms) at which the PlanFollower is invoked

Specified by:
getPlanFollowerTimeStep in interface ReservationSystem
Returns:
the planStepSize

synchronizePlan

public void synchronizePlan(String planName)
Description copied from interface: ReservationSystem
Invokes PlanFollower to synchronize the specified Plan with the ResourceScheduler

Specified by:
synchronizePlan in interface ReservationSystem
Parameters:
planName - the name of the Plan to be synchronized

serviceInit

public void serviceInit(org.apache.hadoop.conf.Configuration conf)
                 throws Exception
Overrides:
serviceInit in class org.apache.hadoop.service.AbstractService
Throws:
Exception

serviceStart

public void serviceStart()
                  throws Exception
Overrides:
serviceStart in class org.apache.hadoop.service.AbstractService
Throws:
Exception

serviceStop

public void serviceStop()
Overrides:
serviceStop in class org.apache.hadoop.service.AbstractService

getQueueForReservation

public String getQueueForReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId)
Description copied from interface: ReservationSystem
Get the Queue that an existing ReservationId is associated with.

Specified by:
getQueueForReservation in interface ReservationSystem
Parameters:
reservationId - the unique id of the reservation
Returns:
the name of the associated Queue

setQueueForReservation

public void setQueueForReservation(org.apache.hadoop.yarn.api.records.ReservationId reservationId,
                                   String queueName)
Description copied from interface: ReservationSystem
Set the Queue that an existing ReservationId should be associated with.

Specified by:
setQueueForReservation in interface ReservationSystem
Parameters:
reservationId - the unique id of the reservation
queueName - the name of Queue to associate the reservation with

getNewReservationId

public org.apache.hadoop.yarn.api.records.ReservationId getNewReservationId()
Description copied from interface: ReservationSystem
Get a new unique ReservationId.

Specified by:
getNewReservationId in interface ReservationSystem
Returns:
a new unique ReservationId

getAllPlans

public Map<String,Plan> getAllPlans()
Description copied from interface: ReservationSystem
Return a map containing all the plans known to this ReservationSystem (useful for UI)

Specified by:
getAllPlans in interface ReservationSystem
Returns:
a Map of Plan names and Plan objects

getDefaultReservationSystem

public static String getDefaultReservationSystem(ResourceScheduler scheduler)
Get the default reservation system corresponding to the scheduler

Parameters:
scheduler - the scheduler for which the reservation system is required

initializePlan

protected abstract Plan initializePlan(String planQueueName)
                                throws org.apache.hadoop.yarn.exceptions.YarnException
Throws:
org.apache.hadoop.yarn.exceptions.YarnException

getReplanner

protected abstract Planner getReplanner(String planQueueName)

getAgent

protected abstract ReservationAgent getAgent(String queueName)

getAdmissionPolicy

protected abstract SharingPolicy getAdmissionPolicy(String queueName)


Copyright © 2014 Apache Software Foundation. All Rights Reserved.