@Override public void setApplicationACLs(Map<ApplicationAccessType, String> acls) { launchContext.setApplicationACLs(acls); } }
@Override public void setApplicationACLs(Map<ApplicationAccessType, String> acls) { launchContext.setApplicationACLs(acls); } }
@Override public void setApplicationACLs(Map<ApplicationAccessType, String> acls) { launchContext.setApplicationACLs(acls); } }
public static void setupUserACLs(ContainerLaunchContext launchContext, String userName, Configuration conf) throws IOException { logger.debug("Setup login acls {}", userName); if (areACLsRequired(conf)) { logger.debug("Configuring ACLs for {}", userName); Map<ApplicationAccessType, String> acls = Maps.newHashMap(); acls.put(ApplicationAccessType.VIEW_APP, userName); acls.put(ApplicationAccessType.MODIFY_APP, userName); launchContext.setApplicationACLs(acls); } }
public void setACLs(ContainerLaunchContext containerLaunchContext) { boolean mrAclsEnabled = launcherConf.getBoolean(MRConfig.MR_ACLS_ENABLED, true); // This is checked for backward compatibility if (mrAclsEnabled) { Map<ApplicationAccessType, String> aclDefinition = new HashMap<>(); String viewAcl = launcherConf.get(JavaActionExecutor.LAUNCER_VIEW_ACL); if (viewAcl != null) { aclDefinition.put(ApplicationAccessType.VIEW_APP, viewAcl); } String modifyAcl = launcherConf.get(JavaActionExecutor.LAUNCER_MODIFY_ACL); if (modifyAcl != null) { aclDefinition.put(ApplicationAccessType.MODIFY_APP, modifyAcl); } if (!aclDefinition.isEmpty()) { containerLaunchContext.setApplicationACLs(aclDefinition); } } else { LOG.info("Not setting ACLs because {0} is set to false", MRConfig.MR_ACLS_ENABLED); } } }
public void setACLs(ContainerLaunchContext containerLaunchContext) { boolean mrAclsEnabled = launcherConf.getBoolean(MRConfig.MR_ACLS_ENABLED, true); // This is checked for backward compatibility if (mrAclsEnabled) { Map<ApplicationAccessType, String> aclDefinition = new HashMap<>(); String viewAcl = launcherConf.get(JavaActionExecutor.LAUNCER_VIEW_ACL); if (viewAcl != null) { aclDefinition.put(ApplicationAccessType.VIEW_APP, viewAcl); } String modifyAcl = launcherConf.get(JavaActionExecutor.LAUNCER_MODIFY_ACL); if (modifyAcl != null) { aclDefinition.put(ApplicationAccessType.MODIFY_APP, modifyAcl); } if (!aclDefinition.isEmpty()) { containerLaunchContext.setApplicationACLs(aclDefinition); } } else { LOG.info("Not setting ACLs because {0} is set to false", MRConfig.MR_ACLS_ENABLED); } } }
@SuppressWarnings("unchecked") private void assertNoACLset() { verify(contextMock, never()).setApplicationACLs(any(Map.class)); }
private static ContainerLaunchContext mockContainerLaunchContext( RecordFactory recordFactory) { ContainerLaunchContext amContainer = recordFactory.newRecordInstance( ContainerLaunchContext.class); amContainer.setApplicationACLs(new HashMap<ApplicationAccessType, String>());; return amContainer; }
private static ContainerLaunchContext mockContainerLaunchContext( RecordFactory recordFactory) { ContainerLaunchContext amContainer = recordFactory.newRecordInstance( ContainerLaunchContext.class); amContainer.setApplicationACLs(new HashMap<ApplicationAccessType, String>());; return amContainer; }
private static ContainerLaunchContext mockContainerLaunchContext( RecordFactory recordFactory) { ContainerLaunchContext amContainer = recordFactory.newRecordInstance( ContainerLaunchContext.class); amContainer .setApplicationACLs(new HashMap<ApplicationAccessType, String>()); return amContainer; } }
private void verifyACLset(String aclMessage, String aclValue, ApplicationAccessType aclType) { verify(contextMock).setApplicationACLs(captor.capture()); Map<ApplicationAccessType, String> aclDefinition = captor.getValue(); assertEquals("ACL size", 1, aclDefinition.size()); assertEquals(aclMessage, aclValue, aclDefinition.get(aclType)); } }
public ContainerLaunchContext createAMContainerSpec(long amMemory, String taskParams, String pythonBinaryPath, String executes, ByteBuffer tokens) throws IOException { ContainerLaunchContext amContainer = Records.newRecord(ContainerLaunchContext.class); FileSystem fs = FileSystem.get(hdfsConf); Map<String, LocalResource> localResources = new HashMap<>(); addResource(fs, tonyFinalConfPath, LocalResourceType.FILE, Constants.TONY_FINAL_XML, localResources); // Add AM resources String[] amResources = tonyConf.getStrings(TonyConfigurationKeys.getResourcesKey(Constants.AM_NAME)); Utils.addResources(amResources, localResources, fs); // Add resources for all containers amResources = tonyConf.getStrings(TonyConfigurationKeys.getContainerResourcesKey()); Utils.addResources(amResources, localResources, fs); setAMEnvironment(localResources, fs); // Set logs to be readable by everyone. Set app to be modifiable only by app owner. Map<ApplicationAccessType, String> acls = new HashMap<>(2); acls.put(ApplicationAccessType.VIEW_APP, "*"); acls.put(ApplicationAccessType.MODIFY_APP, " "); amContainer.setApplicationACLs(acls); String command = TonyClient.buildCommand(amMemory, taskParams, pythonBinaryPath, executes, shellEnv, containerEnv); LOG.info("Completed setting up Application Master command " + command); amContainer.setCommands(ImmutableList.of(command)); if (tokens != null) { amContainer.setTokens(tokens); } amContainer.setEnvironment(containerEnv); amContainer.setLocalResources(localResources); return amContainer; }
public static ContainerLaunchContext newContainerLaunchContext( Map<String, LocalResource> localResources, Map<String, String> environment, List<String> commands, Map<String, ByteBuffer> serviceData, ByteBuffer tokens, Map<ApplicationAccessType, String> acls) { ContainerLaunchContext container = recordFactory .newRecordInstance(ContainerLaunchContext.class); container.setLocalResources(localResources); container.setEnvironment(environment); container.setCommands(commands); container.setServiceData(serviceData); container.setTokens(tokens); container.setApplicationACLs(acls); return container; }
public static ContainerLaunchContext newContainerLaunchContext( Map<String, LocalResource> localResources, Map<String, String> environment, List<String> commands, Map<String, ByteBuffer> serviceData, ByteBuffer tokens, Map<ApplicationAccessType, String> acls) { ContainerLaunchContext container = recordFactory .newRecordInstance(ContainerLaunchContext.class); container.setLocalResources(localResources); container.setEnvironment(environment); container.setCommands(commands); container.setServiceData(serviceData); container.setTokens(tokens); container.setApplicationACLs(acls); return container; }
public static ContainerLaunchContext newContainerLaunchContext( Map<String, LocalResource> localResources, Map<String, String> environment, List<String> commands, Map<String, ByteBuffer> serviceData, ByteBuffer tokens, Map<ApplicationAccessType, String> acls) { ContainerLaunchContext container = recordFactory .newRecordInstance(ContainerLaunchContext.class); container.setLocalResources(localResources); container.setEnvironment(environment); container.setCommands(commands); container.setServiceData(serviceData); container.setTokens(tokens); container.setApplicationACLs(acls); return container; }
@Public @Stable public static ContainerLaunchContext newInstance( Map<String, LocalResource> localResources, Map<String, String> environment, List<String> commands, Map<String, ByteBuffer> serviceData, ByteBuffer tokens, Map<ApplicationAccessType, String> acls) { ContainerLaunchContext container = Records.newRecord(ContainerLaunchContext.class); container.setLocalResources(localResources); container.setEnvironment(environment); container.setCommands(commands); container.setServiceData(serviceData); container.setTokens(tokens); container.setApplicationACLs(acls); return container; }
@Public @Stable public static ContainerLaunchContext newInstance( Map<String, LocalResource> localResources, Map<String, String> environment, List<String> commands, Map<String, ByteBuffer> serviceData, ByteBuffer tokens, Map<ApplicationAccessType, String> acls) { ContainerLaunchContext container = Records.newRecord(ContainerLaunchContext.class); container.setLocalResources(localResources); container.setEnvironment(environment); container.setCommands(commands); container.setServiceData(serviceData); container.setTokens(tokens); container.setApplicationACLs(acls); return container; }
@Public @Stable public static ContainerLaunchContext newInstance( Map<String, LocalResource> localResources, Map<String, String> environment, List<String> commands, Map<String, ByteBuffer> serviceData, ByteBuffer tokens, Map<ApplicationAccessType, String> acls) { ContainerLaunchContext container = Records.newRecord(ContainerLaunchContext.class); container.setLocalResources(localResources); container.setEnvironment(environment); container.setCommands(commands); container.setServiceData(serviceData); container.setTokens(tokens); container.setApplicationACLs(acls); return container; }
@Public @Unstable public static ContainerLaunchContext newInstance( Map<String, LocalResource> localResources, Map<String, String> environment, List<String> commands, Map<String, ByteBuffer> serviceData, ByteBuffer tokens, Map<ApplicationAccessType, String> acls, ContainerRetryContext containerRetryContext) { ContainerLaunchContext container = Records.newRecord(ContainerLaunchContext.class); container.setLocalResources(localResources); container.setEnvironment(environment); container.setCommands(commands); container.setServiceData(serviceData); container.setTokens(tokens); container.setApplicationACLs(acls); container.setContainerRetryContext(containerRetryContext); return container; }
@SuppressWarnings("deprecation") private ApplicationId submitAppAndGetAppId(AccessControlList viewACL, AccessControlList modifyACL) throws Exception { SubmitApplicationRequest submitRequest = recordFactory .newRecordInstance(SubmitApplicationRequest.class); ApplicationSubmissionContext context = recordFactory .newRecordInstance(ApplicationSubmissionContext.class); ApplicationId applicationId = rmClient.getNewApplication( recordFactory.newRecordInstance(GetNewApplicationRequest.class)) .getApplicationId(); context.setApplicationId(applicationId); Map<ApplicationAccessType, String> acls = new HashMap<ApplicationAccessType, String>(); acls.put(ApplicationAccessType.VIEW_APP, viewACL.getAclString()); acls.put(ApplicationAccessType.MODIFY_APP, modifyACL.getAclString()); ContainerLaunchContext amContainer = recordFactory .newRecordInstance(ContainerLaunchContext.class); Resource resource = BuilderUtils.newResource(1024, 1); context.setResource(resource); amContainer.setApplicationACLs(acls); context.setAMContainerSpec(amContainer); submitRequest.setApplicationSubmissionContext(context); rmClient.submitApplication(submitRequest); resourceManager.waitForState(applicationId, RMAppState.ACCEPTED); return applicationId; }