[SPARK-3286] - Cannot view ApplicationMaster UI when Yarn’s url scheme is ...

...https
So for older versions , we need to  pass the url as before and for newer versions, we pass the url with the scheme. What's the best way to check the Hadoop/Yarn version? Could you please point me to code snippet ?