SPARK-4214. With dynamic allocation, avoid outstanding requests for more...

... executors than pending tasks need.

WIP. Still need to add and fix tests.
I noticed that, but couldn't figure out a better way to pass this through information through.  `SparkListener` can give us the total pending tasks at the start of a stage, but, as far as I could tell, only the TaskSetManagers know the pending tasks as a stage progresses.  Reconstituting this info from onTaskStart and onTaskEnd events isn't easy because tasks can need to be resubmitted.  Am I missing anything?