本文整理汇总了Java中org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl类的典型用法代码示例。如果您正苦于以下问题:Java ApplicationIdPBImpl类的具体用法?Java ApplicationIdPBImpl怎么用?Java ApplicationIdPBImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationIdPBImpl类属于org.apache.hadoop.yarn.api.records.impl.pb包,在下文中一共展示了ApplicationIdPBImpl类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: getJob
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; //导入依赖的package包/类
private Job getJob() {
Job job = mock(Job.class);
JobId jobId = new JobIdPBImpl();
ApplicationId appId = ApplicationIdPBImpl.newInstance(System.currentTimeMillis(),4);
jobId.setAppId(appId);
jobId.setId(1);
when(job.getID()).thenReturn(jobId);
JobReport report = mock(JobReport.class);
when(report.getStartTime()).thenReturn(100010L);
when(report.getFinishTime()).thenReturn(100015L);
when(job.getReport()).thenReturn(report);
when(job.getName()).thenReturn("JobName");
when(job.getUserName()).thenReturn("UserName");
when(job.getQueueName()).thenReturn("QueueName");
when(job.getState()).thenReturn(JobState.SUCCEEDED);
when(job.getTotalMaps()).thenReturn(3);
when(job.getCompletedMaps()).thenReturn(2);
when(job.getTotalReduces()).thenReturn(2);
when(job.getCompletedReduces()).thenReturn(1);
when(job.getCompletedReduces()).thenReturn(1);
return job;
}
开发者ID:naver,项目名称:hadoop,代码行数:27,代码来源:TestBlocks.java
示例2: getTask
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; //导入依赖的package包/类
private Task getTask(long timestamp) {
JobId jobId = new JobIdPBImpl();
jobId.setId(0);
jobId.setAppId(ApplicationIdPBImpl.newInstance(timestamp,1));
TaskId taskId = new TaskIdPBImpl();
taskId.setId(0);
taskId.setTaskType(TaskType.REDUCE);
taskId.setJobId(jobId);
Task task = mock(Task.class);
when(task.getID()).thenReturn(taskId);
TaskReport report = mock(TaskReport.class);
when(report.getProgress()).thenReturn(0.7f);
when(report.getTaskState()).thenReturn(TaskState.SUCCEEDED);
when(report.getStartTime()).thenReturn(100001L);
when(report.getFinishTime()).thenReturn(100011L);
when(task.getReport()).thenReturn(report);
when(task.getType()).thenReturn(TaskType.REDUCE);
return task;
}
开发者ID:naver,项目名称:hadoop,代码行数:23,代码来源:TestBlocks.java
示例3: writeLog
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; //导入依赖的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();
}
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:TestAggregatedLogsBlock.java
示例4: getApplicationId
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; //导入依赖的package包/类
private ApplicationId getApplicationId(int applicationId) {
ApplicationIdPBImpl appId = new ApplicationIdPBImpl() {
public ApplicationIdPBImpl setParameters(int id, long timestamp) {
setClusterTimestamp(timestamp);
setId(id);
build();
return this;
}
}.setParameters(applicationId, 1000);
return new ApplicationIdPBImpl(appId.getProto());
}
开发者ID:naver,项目名称:hadoop,代码行数:12,代码来源:TestYarnServerApiClasses.java
示例5: buildAppProto
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; //导入依赖的package包/类
private ContainerManagerApplicationProto buildAppProto(ApplicationId appId,
String user, Credentials credentials,
Map<ApplicationAccessType, String> appAcls,
LogAggregationContext logAggregationContext) {
ContainerManagerApplicationProto.Builder builder =
ContainerManagerApplicationProto.newBuilder();
builder.setId(((ApplicationIdPBImpl) appId).getProto());
builder.setUser(user);
if (logAggregationContext != null) {
builder.setLogAggregationContext((
(LogAggregationContextPBImpl)logAggregationContext).getProto());
}
builder.clearCredentials();
if (credentials != null) {
DataOutputBuffer dob = new DataOutputBuffer();
try {
credentials.writeTokenStorageToStream(dob);
builder.setCredentials(ByteString.copyFrom(dob.getData()));
} catch (IOException e) {
// should not occur
LOG.error("Cannot serialize credentials", e);
}
}
builder.clearAcls();
if (appAcls != null) {
for (Map.Entry<ApplicationAccessType, String> acl : appAcls.entrySet()) {
ApplicationACLMapProto p = ApplicationACLMapProto.newBuilder()
.setAccessType(ProtoUtils.convertToProtoFormat(acl.getKey()))
.setAcl(acl.getValue())
.build();
builder.addAcls(p);
}
}
return builder.build();
}
开发者ID:naver,项目名称:hadoop,代码行数:41,代码来源:ContainerManagerImpl.java
示例6: testLogDirWithDriveLetter
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; //导入依赖的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);
}
开发者ID:naver,项目名称:hadoop,代码行数:28,代码来源:TestContainerLogsPage.java
示例7: mergeLocalToBuilder
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; //导入依赖的package包/类
private void mergeLocalToBuilder() {
if (this.applicationId != null
&& !((ApplicationIdPBImpl) this.applicationId).getProto().equals(
builder.getApplicationId())) {
builder.setApplicationId(convertToProtoFormat(this.applicationId));
}
}
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:ApplicationStartDataPBImpl.java
示例8: mergeLocalToBuilder
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; //导入依赖的package包/类
private synchronized void mergeLocalToBuilder() {
if (this.applicationId != null
&& !((ApplicationIdPBImpl) this.applicationId).getProto().equals(
builder.getAppId())) {
builder.setAppId(convertToProtoFormat(this.applicationId));
}
}
开发者ID:naver,项目名称:hadoop,代码行数:8,代码来源:JobIdPBImpl.java
示例9: testLogDirWithDriveLetter
import org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl; //导入依赖的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);
}
开发者ID:Nextzero,项目名称:hadoop-2.6.0-cdh5.4.3,代码行数:28,代码来源:TestContainerLogsPage.java
注:本文中的org.apache.hadoop.yarn.api.records.impl.pb.ApplicationIdPBImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论