Currently on the NM, we have the AMRMProxy framework to intercept the AM <-> RM communication and enforce policies. This is used both by YARN federation (
YARN-2915) as well as Distributed Scheduling ( YARN-2877).
This JIRA proposes to introduce a similar framework on the the RM side, so that pluggable policies can be enforced on ApplicationMasterService centrally as well.
This would be similar in spirit to a Java Servlet Filter Chain. Where the order of the interceptors can declared externally.
Once possible usecase would be:
the OpportunisticContainerAllocatorAMService is implemented as a wrapper over the ApplicationMasterService. It would probably be better to implement it as an Interceptor.