Sorry for late response, Karthik Kambatla. getDemand() - getResourceUsage() is another choice, but i think SchedulerApplicationAttempt.getAppAttemptResourceUsage().getPending() would be better, because the pending information is immediately updated as the request is update/fulfilled, while the former was derived from request in another update thread. The request is changed when there's resource request update. If AM submits resource requests
and then it is fulfilled on node1, the request becomes
Later the AM doesn't submit a new request (in which the #container set to 0), this app will also participate scheduling, even though it's demand has been fulfilled.
Besides, when i try use getDemand() - getResourceUsage(), i got some test failures. Now i was checking the cause.