interesting question.
I know that you can use the SparkListener to collect info, f.e. here.
Mind that the class is written in Scala, so my first thought was that it is not possible in python/pyspark.
But SO says it is possible, but with a lot of overhead tbh.
So far from optimal, Iยดd try to use scala instead.