diff --git a/dynamometer-infra/src/main/java/com/linkedin/dynamometer/ApplicationMaster.java b/dynamometer-infra/src/main/java/com/linkedin/dynamometer/ApplicationMaster.java index 7fde3b1afc..d7b86c8413 100644 --- a/dynamometer-infra/src/main/java/com/linkedin/dynamometer/ApplicationMaster.java +++ b/dynamometer-infra/src/main/java/com/linkedin/dynamometer/ApplicationMaster.java @@ -47,6 +47,7 @@ import org.apache.hadoop.yarn.api.ApplicationConstants; import org.apache.hadoop.yarn.api.ApplicationConstants.Environment; import org.apache.hadoop.yarn.api.ContainerManagementProtocol; +import org.apache.hadoop.yarn.api.records.ApplicationAccessType; import org.apache.hadoop.yarn.api.records.ApplicationAttemptId; import org.apache.hadoop.yarn.api.records.Container; import org.apache.hadoop.yarn.api.records.ContainerId; @@ -143,6 +144,8 @@ public class ApplicationMaster { // Directory to use for remote storage (a location on the remote FS which // can be accessed by all components) private Path remoteStoragePath; + // The ACLs to view the launched containers + private Map applicationAcls; // The container the NameNode is running within private volatile Container namenodeContainer; // Map of the containers that the DataNodes are running within @@ -210,6 +213,8 @@ public boolean init(String[] args) throws ParseException, IOException { Map envs = System.getenv(); remoteStoragePath = new Path(envs.get(DynoConstants.REMOTE_STORAGE_PATH_ENV)); + applicationAcls = new HashMap<>(); + applicationAcls.put(ApplicationAccessType.VIEW_APP, envs.get(DynoConstants.JOB_ACL_VIEW_ENV)); launchingUser = envs.get(Environment.USER.name()); if (envs.containsKey(DynoConstants.REMOTE_NN_RPC_ADDR_ENV)) { launchNameNode = false; @@ -653,6 +658,7 @@ public void run() { // Set the environment ctx.setEnvironment(amOptions.getShellEnv()); + ctx.setApplicationACLs(applicationAcls); try { ctx.setLocalResources(getLocalResources()); diff --git a/dynamometer-infra/src/main/java/com/linkedin/dynamometer/Client.java b/dynamometer-infra/src/main/java/com/linkedin/dynamometer/Client.java index b2bd610e41..fcdfc8ebcd 100644 --- a/dynamometer-infra/src/main/java/com/linkedin/dynamometer/Client.java +++ b/dynamometer-infra/src/main/java/com/linkedin/dynamometer/Client.java @@ -52,6 +52,7 @@ import org.apache.hadoop.io.IOUtils; import org.apache.hadoop.mapreduce.Job; import org.apache.hadoop.mapreduce.JobStatus; +import org.apache.hadoop.mapreduce.MRJobConfig; import org.apache.hadoop.security.Credentials; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.security.token.Token; @@ -61,6 +62,7 @@ import org.apache.hadoop.yarn.api.ApplicationConstants; import org.apache.hadoop.yarn.api.ApplicationConstants.Environment; import org.apache.hadoop.yarn.api.protocolrecords.GetNewApplicationResponse; +import org.apache.hadoop.yarn.api.records.ApplicationAccessType; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.ApplicationReport; import org.apache.hadoop.yarn.api.records.ApplicationSubmissionContext; @@ -438,6 +440,10 @@ public boolean run() throws IOException, YarnException { // Set up the container launch context for the application master ContainerLaunchContext amContainer = Records.newRecord(ContainerLaunchContext.class); + Map acls = new HashMap<>(); + acls.put(ApplicationAccessType.VIEW_APP, getConf().get( + MRJobConfig.JOB_ACL_VIEW_JOB, MRJobConfig.DEFAULT_JOB_ACL_VIEW_JOB)); + amContainer.setApplicationACLs(acls); FileSystem fs = FileSystem.get(getConf()); fs.mkdirs(getRemoteStoragePath(getConf(), infraAppId)); @@ -529,6 +535,8 @@ private Map setupRemoteResourcesGetEnv() throws IOException { setupRemoteResource(appMasterJar, infraAppId, DynoConstants.DYNO_JAR, env); env.put(DynoConstants.BLOCK_LIST_PATH_ENV, blockListPath); + env.put(DynoConstants.JOB_ACL_VIEW_ENV, + getConf().get(MRJobConfig.JOB_ACL_VIEW_JOB, MRJobConfig.DEFAULT_JOB_ACL_VIEW_JOB)); env.put(DynoConstants.REMOTE_STORAGE_PATH_ENV, getRemoteStoragePath(getConf(), infraAppId).toString()); diff --git a/dynamometer-infra/src/main/java/com/linkedin/dynamometer/DynoConstants.java b/dynamometer-infra/src/main/java/com/linkedin/dynamometer/DynoConstants.java index e4d82073d7..6082d11568 100644 --- a/dynamometer-infra/src/main/java/com/linkedin/dynamometer/DynoConstants.java +++ b/dynamometer-infra/src/main/java/com/linkedin/dynamometer/DynoConstants.java @@ -64,6 +64,9 @@ public boolean accept(Path path) { // internally by this application public static final String REMOTE_NN_RPC_ADDR_ENV = "REMOTE_NN_RPC_ADDR"; + // Environment variable which will contain the view ACLs for the launched containers. + public static final String JOB_ACL_VIEW_ENV = "JOB_ACL_VIEW"; + /* The following used for AM -> DN, NN communication */ // The name of the file which will store information about the NameNode