I just copied that from the existing checks in SparkEnv to keep it consistent. It looks like the Yarn client sets both.  It sets the property before creating the client and then the env later to be passed to the app master and workers.  I would think the env would be enough.  I can look into it more, but perhaps that is a separate issue?