Instead of environment vars, couldn't we do everything through system properties? SparkConf already initializes from system properties by default, and any environment vars that we might need to set could be given a system property to do the same thing (some YARN settings might currently only use env vars). For setting env vars on the workers it's possible to do it in all of the cluster managers that Spark supports.