We modified this from numTasks to tasksSuccessful for following reasons :
In our case, we wanted to aggressively speculate in case of stragglers - and we have high numTasks per stage, and we set SPECULATION_QUANTILE low enough to kick start speculative execution as soon as possible for running tasks.
Given this, we observed that medianDuration almost always remained duration(duration.size - 1) - which was not really the median, but worst duration of the executing tasks.

I am not sure if this change works for other cases - so please do review it.