spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Peter Rudenko <>
Subject [Yarn] How to set user in ContainerLaunchContext?
Date Mon, 02 Nov 2015 16:02:45 GMT
Hi, i have an ApplicationMaster which accepts requests and launches 
container on which it launches spark-submit --master yarn. In request i 
have a field "username" - the user i want to laucnh a job from. How can 
i set a user which will be run conmmand on a container? Currently they 
all running as yarn user even though AM is running as a root user.

Here's my code:

private def setupTokens(username:String): ByteBuffer = {
   val credentials = UserGroupInformation.createProxyUser(username, UserGroupInformation.getCurrentUser).getCredentials
   val dob =new DataOutputBuffer();
   ByteBuffer.wrap(dob.getData(),0, dob.getLength()).duplicate();

val cCLC = Records.newRecord(classOf[ContainerLaunchContext])

cCLC.setCommands(List("spark-submit --master yarn ..."))


Thanks, Peter Rudenko

View raw message