private ContainerLaunchContextPBImpl convertFromProtoFormat( ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
private ContainerLaunchContextProto convertToProtoFormat( ContainerLaunchContext t) { return ((ContainerLaunchContextPBImpl)t).getProto(); }
private void mergeLocalToBuilder() { if (this.localResources != null) { addLocalResourcesToProto(); } if (this.tokens != null) { builder.setTokens(convertToProtoFormat(this.tokens)); } if (this.serviceData != null) { addServiceDataToProto(); } if (this.environment != null) { addEnvToProto(); } if (this.commands != null) { addCommandsToProto(); } if (this.applicationACLS != null) { addApplicationACLs(); } }
@Test public void testCLCPBImplNullEnv() throws IOException { Map<String, LocalResource> localResources = Collections.emptyMap(); Map<String, String> environment = new HashMap<String, String>(); List<String> commands = Collections.emptyList(); Map<String, ByteBuffer> serviceData = Collections.emptyMap(); Credentials containerCreds = new Credentials(); DataOutputBuffer dob = new DataOutputBuffer(); containerCreds.writeTokenStorageToStream(dob); ByteBuffer containerTokens = ByteBuffer.wrap(dob.getData(), 0, dob.getLength()); Map<ApplicationAccessType, String> acls = Collections.emptyMap(); environment.put("testCLCPBImplNullEnv", null); ContainerLaunchContext clc = ContainerLaunchContext.newInstance(localResources, environment, commands, serviceData, containerTokens, acls); ContainerLaunchContext clcProto = new ContainerLaunchContextPBImpl( ((ContainerLaunchContextPBImpl) clc).getProto()); Assert.assertEquals("", clcProto.getEnvironment().get("testCLCPBImplNullEnv")); }
private void initLocalResources() { if (this.localResources != null) { return; } ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder; List<StringLocalResourceMapProto> list = p.getLocalResourcesList(); this.localResources = new HashMap<String, LocalResource>(); for (StringLocalResourceMapProto c : list) { this.localResources.put(c.getKey(), convertFromProtoFormat(c.getValue())); } }
private void pruneAppState(ApplicationStateData appState) { ApplicationSubmissionContext srcCtx = appState.getApplicationSubmissionContext(); ApplicationSubmissionContextPBImpl context = new ApplicationSubmissionContextPBImpl(); // most fields in the ApplicationSubmissionContext are not needed, // but the following few need to be present for recovery to succeed context.setApplicationId(srcCtx.getApplicationId()); context.setResource(srcCtx.getResource()); context.setQueue(srcCtx.getQueue()); context.setAMContainerResourceRequests( srcCtx.getAMContainerResourceRequests()); context.setApplicationName(srcCtx.getApplicationName()); context.setPriority(srcCtx.getPriority()); context.setApplicationTags(srcCtx.getApplicationTags()); context.setApplicationType(srcCtx.getApplicationType()); context.setUnmanagedAM(srcCtx.getUnmanagedAM()); context.setNodeLabelExpression(srcCtx.getNodeLabelExpression()); ContainerLaunchContextPBImpl amContainerSpec = new ContainerLaunchContextPBImpl(); amContainerSpec.setApplicationACLs( srcCtx.getAMContainerSpec().getApplicationACLs()); context.setAMContainerSpec(amContainerSpec); appState.setApplicationSubmissionContext(context); } }
ctx.setQueue("a_queue"); ContainerLaunchContextPBImpl containerLaunchCtx = new ContainerLaunchContextPBImpl(); containerLaunchCtx.setCommands(Collections.singletonList("a_command")); ctx.setAMContainerSpec(containerLaunchCtx); Resource resource = new ResourcePBImpl();
@Override public Map<ApplicationAccessType, String> getApplicationACLs() { initApplicationACLs(); return this.applicationACLS; }
private void initServiceData() { if (this.serviceData != null) { return; } ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder; List<StringBytesMapProto> list = p.getServiceDataList(); this.serviceData = new HashMap<String, ByteBuffer>(); for (StringBytesMapProto c : list) { this.serviceData.put(c.getKey(), convertFromProtoFormat(c.getValue())); } }
@Override public Map<ApplicationAccessType, String> getApplicationACLs() { initApplicationACLs(); return this.applicationACLS; }
private void mergeLocalToBuilder() { if (this.localResources != null) { addLocalResourcesToProto(); } if (this.tokens != null) { builder.setTokens(convertToProtoFormat(this.tokens)); } if (this.serviceData != null) { addServiceDataToProto(); } if (this.environment != null) { addEnvToProto(); } if (this.commands != null) { addCommandsToProto(); } if (this.applicationACLS != null) { addApplicationACLs(); } }
private ContainerLaunchContextPBImpl convertFromProtoFormat( ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
private ContainerLaunchContextProto convertToProtoFormat( ContainerLaunchContext t) { return ((ContainerLaunchContextPBImpl)t).getProto(); }
public ContainerRetryContext getContainerRetryContext() { ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder; if (this.containerRetryContext != null) { return this.containerRetryContext; } if (!p.hasContainerRetryContext()) { return null; } this.containerRetryContext = convertFromProtoFormat( p.getContainerRetryContext()); return this.containerRetryContext; }
@Override public Map<ApplicationAccessType, String> getApplicationACLs() { initApplicationACLs(); return this.applicationACLS; }
private void mergeLocalToBuilder() { if (this.localResources != null) { addLocalResourcesToProto(); } if (this.tokens != null) { builder.setTokens(convertToProtoFormat(this.tokens)); } if (this.tokensConf != null) { builder.setTokensConf(convertToProtoFormat(this.tokensConf)); } if (this.serviceData != null) { addServiceDataToProto(); } if (this.environment != null) { addEnvToProto(); } if (this.commands != null) { addCommandsToProto(); } if (this.applicationACLS != null) { addApplicationACLs(); } if (this.containerRetryContext != null) { builder.setContainerRetryContext( convertToProtoFormat(this.containerRetryContext)); } }
private ContainerLaunchContextPBImpl convertFromProtoFormat(ContainerLaunchContextProto p) { return new ContainerLaunchContextPBImpl(p); }
private ContainerLaunchContextProto convertToProtoFormat( ContainerLaunchContext t) { return ((ContainerLaunchContextPBImpl)t).getProto(); }
@Override public ByteBuffer getTokens() { ContainerLaunchContextProtoOrBuilder p = viaProto ? proto : builder; if (this.tokens != null) { return this.tokens; } if (!p.hasTokens()) { return null; } this.tokens = convertFromProtoFormat(p.getTokens()); return this.tokens; }
@Override public void setApplicationACLs( final Map<ApplicationAccessType, String> appACLs) { if (appACLs == null) return; initApplicationACLs(); this.applicationACLS.clear(); this.applicationACLS.putAll(appACLs); }