本文整理汇总了Java中org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl类的典型用法代码示例。如果您正苦于以下问题:Java ApplicationAttemptIdPBImpl类的具体用法?Java ApplicationAttemptIdPBImpl怎么用?Java ApplicationAttemptIdPBImpl使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationAttemptIdPBImpl类属于org.apache.hadoop.yarn.api.records.impl.pb包,在下文中一共展示了ApplicationAttemptIdPBImpl类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NMTokenIdentifier
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
public NMTokenIdentifier(ApplicationAttemptId appAttemptId,
NodeId nodeId, String applicationSubmitter, int masterKeyId) {
NMTokenIdentifierProto.Builder builder = NMTokenIdentifierProto.newBuilder();
if (appAttemptId != null) {
builder.setAppAttemptId(
((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
}
if (nodeId != null) {
builder.setNodeId(((NodeIdPBImpl)nodeId).getProto());
}
builder.setAppSubmitter(applicationSubmitter);
builder.setKeyId(masterKeyId);
proto = builder.build();
}
示例2: getUser
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
@Override
public UserGroupInformation getUser() {
String appAttemptId = null;
if (proto.hasAppAttemptId()) {
appAttemptId = new ApplicationAttemptIdPBImpl(
proto.getAppAttemptId()).toString();
}
return UserGroupInformation.createRemoteUser(appAttemptId);
}
示例3: AMRMTokenIdentifier
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
public AMRMTokenIdentifier(ApplicationAttemptId appAttemptId,
int masterKeyId) {
AMRMTokenIdentifierProto.Builder builder =
AMRMTokenIdentifierProto.newBuilder();
if (appAttemptId != null) {
builder.setAppAttemptId(
((ApplicationAttemptIdPBImpl)appAttemptId).getProto());
}
builder.setKeyId(masterKeyId);
proto = builder.build();
}
示例4: getApplicationAttemptId
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
@Private
public ApplicationAttemptId getApplicationAttemptId() {
if (!proto.hasAppAttemptId()) {
return null;
}
return new ApplicationAttemptIdPBImpl(proto.getAppAttemptId());
}
示例5: getUser
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
@Override
public UserGroupInformation getUser() {
String appAttemptId = null;
if (proto.hasAppAttemptId()) {
appAttemptId =
new ApplicationAttemptIdPBImpl(proto.getAppAttemptId()).toString();
}
return UserGroupInformation.createRemoteUser(appAttemptId);
}
示例6: ClientToAMTokenIdentifier
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
public ClientToAMTokenIdentifier(ApplicationAttemptId id, String client) {
ClientToAMTokenIdentifierProto.Builder builder =
ClientToAMTokenIdentifierProto.newBuilder();
if (id != null) {
builder.setAppAttemptId(((ApplicationAttemptIdPBImpl)id).getProto());
}
if (client != null) {
builder.setClientName(client);
}
proto = builder.build();
}
示例7: writeLog
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
private void writeLog(Configuration configuration, String user)
throws Exception {
ApplicationId appId = ApplicationIdPBImpl.newInstance(0, 1);
ApplicationAttemptId appAttemptId = ApplicationAttemptIdPBImpl.newInstance(appId, 1);
ContainerId containerId = ContainerIdPBImpl.newContainerId(appAttemptId, 1);
String path = "target/logs/" + user
+ "/logs/application_0_0001/localhost_1234";
File f = new File(path);
if (!f.getParentFile().exists()) {
assertTrue(f.getParentFile().mkdirs());
}
List<String> rootLogDirs = Arrays.asList("target/logs/logs");
UserGroupInformation ugi = UserGroupInformation.getCurrentUser();
AggregatedLogFormat.LogWriter writer = new AggregatedLogFormat.LogWriter(
configuration, new Path(path), ugi);
writer.writeApplicationOwner(ugi.getUserName());
Map<ApplicationAccessType, String> appAcls = new HashMap<ApplicationAccessType, String>();
appAcls.put(ApplicationAccessType.VIEW_APP, ugi.getUserName());
writer.writeApplicationACLs(appAcls);
writer.append(new AggregatedLogFormat.LogKey("container_0_0001_01_000001"),
new AggregatedLogFormat.LogValue(rootLogDirs, containerId,UserGroupInformation.getCurrentUser().getShortUserName()));
writer.close();
}
示例8: testLogDirWithDriveLetter
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
@Test
public void testLogDirWithDriveLetter() throws Exception {
//To verify that logs paths which include drive letters (Windows)
//do not lose their drive letter specification
LocalDirsHandlerService localDirs = mock(LocalDirsHandlerService.class);
List<String> logDirs = new ArrayList<String>();
logDirs.add("F:/nmlogs");
when(localDirs.getLogDirsForRead()).thenReturn(logDirs);
ApplicationIdPBImpl appId = mock(ApplicationIdPBImpl.class);
when(appId.toString()).thenReturn("app_id_1");
ApplicationAttemptIdPBImpl appAttemptId =
mock(ApplicationAttemptIdPBImpl.class);
when(appAttemptId.getApplicationId()).thenReturn(appId);
ContainerId containerId = mock(ContainerIdPBImpl.class);
when(containerId.getApplicationAttemptId()).thenReturn(appAttemptId);
List<File> logDirFiles = ContainerLogsUtils.getContainerLogDirs(
containerId, localDirs);
Assert.assertTrue("logDir lost drive letter " +
logDirFiles.get(0),
logDirFiles.get(0).toString().indexOf("F:" + File.separator +
"nmlogs") > -1);
}
示例9: mergeLocalToBuilder
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
private void mergeLocalToBuilder() {
if (this.attemptId != null) {
builder.setAttemptId(((ApplicationAttemptIdPBImpl)attemptId).getProto());
}
if(this.masterContainer != null) {
builder.setMasterContainer(((ContainerPBImpl)masterContainer).getProto());
}
if(this.appAttemptTokens != null) {
builder.setAppAttemptTokens(ProtoUtils.convertToProtoFormat(
this.appAttemptTokens));
}
}
示例10: mergeLocalToBuilder
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
private void mergeLocalToBuilder() {
if (this.applicationAttemptId != null
&& !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
.equals(builder.getApplicationAttemptId())) {
builder
.setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
}
if (this.masterContainerId != null
&& !((ContainerIdPBImpl) this.masterContainerId).getProto().equals(
builder.getMasterContainerId())) {
builder
.setMasterContainerId(convertToProtoFormat(this.masterContainerId));
}
}
示例11: mergeLocalToBuilder
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
private void mergeLocalToBuilder() {
if (this.applicationAttemptId != null
&& !((ApplicationAttemptIdPBImpl) this.applicationAttemptId).getProto()
.equals(builder.getApplicationAttemptId())) {
builder
.setApplicationAttemptId(convertToProtoFormat(this.applicationAttemptId));
}
}
示例12: mergeLocalToBuilder
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
private synchronized void mergeLocalToBuilder() {
if (this.appAttemptId != null
&& !((ApplicationAttemptIdPBImpl) this.appAttemptId).getProto().equals(
builder.getApplicationAttemptId())) {
builder.setApplicationAttemptId(convertToProtoFormat(this.appAttemptId));
}
if (this.getContainerId() != null
&& !((ContainerIdPBImpl) this.containerId).getProto().equals(
builder.getContainerId())) {
builder.setContainerId(convertToProtoFormat(this.containerId));
}
}
示例13: testApplicationAttemptIdPBImpl
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
@Test
@Ignore
// ignore cause ApplicationIdPBImpl is immutable
public void testApplicationAttemptIdPBImpl() throws Exception {
validatePBImplRecord(ApplicationAttemptIdPBImpl.class,
ApplicationAttemptIdProto.class);
}
示例14: testLogDirWithDriveLetter
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationAttemptIdPBImpl; //导入依赖的package包/类
@Test
public void testLogDirWithDriveLetter() throws Exception {
//To verify that logs paths which include drive letters (Windows)
//do not lose their drive letter specification
LocalDirsHandlerService localDirs = mock(LocalDirsHandlerService.class);
List<String> logDirs = new ArrayList<String>();
logDirs.add("F:/nmlogs");
when(localDirs.getLogDirs()).thenReturn(logDirs);
ApplicationIdPBImpl appId = mock(ApplicationIdPBImpl.class);
when(appId.toString()).thenReturn("app_id_1");
ApplicationAttemptIdPBImpl appAttemptId =
mock(ApplicationAttemptIdPBImpl.class);
when(appAttemptId.getApplicationId()).thenReturn(appId);
ContainerId containerId = mock(ContainerIdPBImpl.class);
when(containerId.getApplicationAttemptId()).thenReturn(appAttemptId);
List<File> logDirFiles = ContainerLogsUtils.getContainerLogDirs(
containerId, localDirs);
Assert.assertTrue("logDir lost drive letter " +
logDirFiles.get(0),
logDirFiles.get(0).toString().indexOf("F:" + File.separator +
"nmlogs") > -1);
}