Github user aarondav commented on a diff in the pull request:
https://github.com/apache/spark/pull/621#discussion_r12252315
--- Diff: core/src/main/scala/org/apache/spark/deploy/SparkHadoopUtil.scala
---
@@ -24,25 +24,30 @@ import org.apache.hadoop.mapred.JobConf
import org.apache.hadoop.security.Credentials
import org.apache.hadoop.security.UserGroupInformation
-import org.apache.spark.{SparkContext, SparkException}
+import org.apache.spark.{Logging, SparkContext, SparkException}
import scala.collection.JavaConversions._
/**
* Contains util methods to interact with Hadoop from Spark.
*/
-class SparkHadoopUtil {
+class SparkHadoopUtil extends Logging {
val conf: Configuration = newConfiguration()
UserGroupInformation.setConfiguration(conf)
+ // IMPORTANT NOTE: If this function is going to be called repeated in
the same process
+ // you need to look https://issues.apache.org/jira/browse/HDFS-3545 and
possibly
+ // do a FileSystem.closeAllForUGI in order to avoid leaking Filesystems
def runAsUser(user: String)(func: () => Unit) {
--- End diff --
Since the usage of this is now distributed to many places throughout Spark,
can we add a comment for people who have no clue why it's there? Just something
like "Runs the given function with a Hadoop UserGroupInformation as a thread
local variable (distributed to child threads), used for authenticating HDFS and
YARN calls."
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---