YARN-6353. Clean up OrderingPolicy javadoc (Daniel Templeton via Varun Saxena)

(cherry picked from commit 35034653d0)
This commit is contained in:
Varun Saxena 2017-03-20 23:29:09 +05:30
parent 0cfa6ec6c8
commit e2cabb4d21
1 changed files with 61 additions and 44 deletions

View File

@ -19,15 +19,13 @@
package org.apache.hadoop.yarn.server.resourcemanager.scheduler.policy; package org.apache.hadoop.yarn.server.resourcemanager.scheduler.policy;
import java.util.*; import java.util.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer; import org.apache.hadoop.yarn.server.resourcemanager.rmcontainer.RMContainer;
import org.apache.hadoop.yarn.server.resourcemanager.scheduler.*;
/** /**
* OrderingPolicy is used by the scheduler to order SchedulableEntities for * OrderingPolicy is used by the scheduler to order SchedulableEntities for
* container assignment and preemption * container assignment and preemption.
* @param <S> the type of {@link SchedulableEntity} that will be compared
*/ */
public interface OrderingPolicy<S extends SchedulableEntity> { public interface OrderingPolicy<S extends SchedulableEntity> {
/* /*
@ -35,80 +33,99 @@ public interface OrderingPolicy<S extends SchedulableEntity> {
* synchronization of all use of the SchedulableEntity Collection and * synchronization of all use of the SchedulableEntity Collection and
* Iterators for correctness and to avoid concurrent modification issues * Iterators for correctness and to avoid concurrent modification issues
*/ */
/** /**
* Get the collection of SchedulableEntities which are managed by this * Get the collection of {@link SchedulableEntity} Objects which are managed
* OrderingPolicy - should include processes returned by the Assignment and * by this OrderingPolicy - should include processes returned by the
* Preemption iterator with no guarantees regarding order * Assignment and Preemption iterator with no guarantees regarding order.
* @return a collection of {@link SchedulableEntity} objects
*/ */
public Collection<S> getSchedulableEntities(); public Collection<S> getSchedulableEntities();
/** /**
* Return an iterator over the collection of SchedulableEntities which orders * Return an iterator over the collection of {@link SchedulableEntity}
* them for container assignment * objects which orders them for container assignment.
* @return an iterator over the collection of {@link SchedulableEntity}
* objects
*/ */
public Iterator<S> getAssignmentIterator(); public Iterator<S> getAssignmentIterator();
/** /**
* Return an iterator over the collection of SchedulableEntities which orders * Return an iterator over the collection of {@link SchedulableEntity}
* them for preemption * objects which orders them for preemption.
* @return an iterator over the collection of {@link SchedulableEntity}
*/ */
public Iterator<S> getPreemptionIterator(); public Iterator<S> getPreemptionIterator();
/** /**
* Add a SchedulableEntity to be managed for allocation and preemption * Add a {@link SchedulableEntity} to be managed for allocation and preemption
* ordering * ordering.
* @param s the {@link SchedulableEntity} to add
*/ */
public void addSchedulableEntity(S s); public void addSchedulableEntity(S s);
/** /**
* Remove a SchedulableEntity from management for allocation and preemption * Remove a {@link SchedulableEntity} from management for allocation and
* ordering * preemption ordering.
* @param s the {@link SchedulableEntity} to remove
* @return whether the {@link SchedulableEntity} was present before this
* operation
*/ */
public boolean removeSchedulableEntity(S s); public boolean removeSchedulableEntity(S s);
/** /**
* Add a collection of SchedulableEntities to be managed for allocation * Add a collection of {@link SchedulableEntity} objects to be managed for
* and preemption ordering * allocation and preemption ordering.
* @param sc the collection of {@link SchedulableEntity} objects to add
*/ */
public void addAllSchedulableEntities(Collection<S> sc); public void addAllSchedulableEntities(Collection<S> sc);
/** /**
* Get the number of SchedulableEntities managed for allocation and * Get the number of {@link SchedulableEntity} objects managed for allocation
* preemption ordering * and preemption ordering.
* @return the number of {@link SchedulableEntity} objects
*/ */
public int getNumSchedulableEntities(); public int getNumSchedulableEntities();
/** /**
* Provides configuration information for the policy from the scheduler * Provides configuration information for the policy from the scheduler
* configuration * configuration.
* @param conf a map of scheduler configuration properties and values
*/ */
public void configure(Map<String, String> conf); public void configure(Map<String, String> conf);
/** /**
* The passed SchedulableEntity has been allocated the passed Container, * Notify the {@code OrderingPolicy} that the {@link SchedulableEntity}
* take appropriate action (depending on comparator, a reordering of the * has been allocated the given {@link RMContainer}, enabling the
* SchedulableEntity may be required) * {@code OrderingPolicy} to take appropriate action. Depending on the
* comparator, a reordering of the {@link SchedulableEntity} may be required.
* @param schedulableEntity the {@link SchedulableEntity}
* @param r the allocated {@link RMContainer}
*/ */
public void containerAllocated(S schedulableEntity, public void containerAllocated(S schedulableEntity, RMContainer r);
RMContainer r);
/** /**
* The passed SchedulableEntity has released the passed Container, * Notify the {@code OrderingPolicy} that the {@link SchedulableEntity}
* take appropriate action (depending on comparator, a reordering of the * has released the given {@link RMContainer}, enabling the
* SchedulableEntity may be required) * {@code OrderingPolicy} to take appropriate action. Depending on the
* comparator, a reordering of the {@link SchedulableEntity} may be required.
* @param schedulableEntity the {@link SchedulableEntity}
* @param r the released {@link RMContainer}
*/ */
public void containerReleased(S schedulableEntity, public void containerReleased(S schedulableEntity, RMContainer r);
RMContainer r);
/** /**
* Demand Updated for the passed schedulableEntity, reorder if needed. * Notify the {@code OrderingPolicy} that the demand for the
* {@link SchedulableEntity} has been updated, enabling the
* {@code OrderingPolicy} to reorder the {@link SchedulableEntity} if needed.
* @param schedulableEntity the updated {@link SchedulableEntity}
*/ */
void demandUpdated(S schedulableEntity); void demandUpdated(S schedulableEntity);
/** /**
* Display information regarding configuration and status * Return information regarding configuration and status.
* @return configuration and status information
*/ */
public String getInfo(); public String getInfo();
} }