...probably a little better performance:

val shuffleRead = listener.stageToShuffleRead.get(stageId).exists(_ > 0)
val shuffleWrite = listener.stageToShuffleWrite.get(stageId).exists(_ > 0)