本文整理汇总了Java中org.apache.hadoop.yarn.api.records.ContainerReport类的典型用法代码示例。如果您正苦于以下问题:Java ContainerReport类的具体用法?Java ContainerReport怎么用?Java ContainerReport使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ContainerReport类属于org.apache.hadoop.yarn.api.records包,在下文中一共展示了ContainerReport类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: ContainerInfo
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
public ContainerInfo(ContainerReport container) {
containerId = container.getContainerId().toString();
if (container.getAllocatedResource() != null) {
allocatedMB = container.getAllocatedResource().getMemory();
allocatedVCores = container.getAllocatedResource().getVirtualCores();
allocatedGCores = container.getAllocatedResource().getGpuCores();
}
if (container.getAssignedNode() != null) {
assignedNodeId = container.getAssignedNode().toString();
}
priority = container.getPriority().getPriority();
startedTime = container.getCreationTime();
finishedTime = container.getFinishTime();
elapsedTime = Times.elapsed(startedTime, finishedTime);
diagnosticsInfo = container.getDiagnosticsInfo();
logUrl = container.getLogUrl();
containerExitStatus = container.getContainerExitStatus();
containerState = container.getContainerState();
nodeHttpAddress = container.getNodeHttpAddress();
}
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:ContainerInfo.java
示例2: createContainerReport
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Override
public ContainerReport createContainerReport() {
this.readLock.lock();
ContainerReport containerReport = null;
try {
containerReport = ContainerReport.newInstance(this.getContainerId(),
this.getAllocatedResource(), this.getAllocatedNode(),
this.getAllocatedPriority(), this.getCreationTime(),
this.getFinishTime(), this.getDiagnosticsInfo(), this.getLogURL(),
this.getContainerExitStatus(), this.getContainerState(),
this.getNodeHttpAddress());
} finally {
this.readLock.unlock();
}
return containerReport;
}
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:RMContainerImpl.java
示例3: convertToContainerReport
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
private ContainerReport convertToContainerReport(
ContainerHistoryData containerHistory, String user) {
// If the container has the aggregated log, add the server root url
String logUrl = WebAppUtils.getAggregatedLogURL(
serverHttpAddress,
containerHistory.getAssignedNode().toString(),
containerHistory.getContainerId().toString(),
containerHistory.getContainerId().toString(),
user);
return ContainerReport.newInstance(containerHistory.getContainerId(),
containerHistory.getAllocatedResource(),
containerHistory.getAssignedNode(), containerHistory.getPriority(),
containerHistory.getStartTime(), containerHistory.getFinishTime(),
containerHistory.getDiagnosticsInfo(), logUrl,
containerHistory.getContainerExitStatus(),
containerHistory.getContainerState(), null);
}
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:ApplicationHistoryManagerImpl.java
示例4: getContainers
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Override
public Map<ContainerId, ContainerReport> getContainers(
ApplicationAttemptId appAttemptId) throws IOException {
ApplicationReport app =
getApplication(appAttemptId.getApplicationId());
Map<ContainerId, ContainerHistoryData> histData =
historyStore.getContainers(appAttemptId);
HashMap<ContainerId, ContainerReport> containersReport =
new HashMap<ContainerId, ContainerReport>();
for (Entry<ContainerId, ContainerHistoryData> entry : histData.entrySet()) {
containersReport.put(entry.getKey(),
convertToContainerReport(entry.getValue(),
app == null ? null : app.getUser()));
}
return containersReport;
}
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:ApplicationHistoryManagerImpl.java
示例5: getContainer
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Override
public ContainerReport getContainer(ContainerId containerId)
throws YarnException, IOException {
ApplicationReportExt app = getApplication(
containerId.getApplicationAttemptId().getApplicationId(),
ApplicationReportField.USER_AND_ACLS);
checkAccess(app);
TimelineEntity entity = timelineDataManager.getEntity(
ContainerMetricsConstants.ENTITY_TYPE,
containerId.toString(), EnumSet.allOf(Field.class),
UserGroupInformation.getLoginUser());
if (entity == null) {
throw new ContainerNotFoundException(
"The entity for container " + containerId +
" doesn't exist in the timeline store");
} else {
return convertToContainerReport(
entity, serverHttpAddress, app.appReport.getUser());
}
}
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:ApplicationHistoryManagerOnTimelineStore.java
示例6: getContainers
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Override
public Map<ContainerId, ContainerReport> getContainers(
ApplicationAttemptId appAttemptId) throws YarnException, IOException {
ApplicationReportExt app = getApplication(
appAttemptId.getApplicationId(), ApplicationReportField.USER_AND_ACLS);
checkAccess(app);
TimelineEntities entities = timelineDataManager.getEntities(
ContainerMetricsConstants.ENTITY_TYPE,
new NameValuePair(
ContainerMetricsConstants.PARENT_PRIMARIY_FILTER,
appAttemptId.toString()), null, null, null,
null, null, Long.MAX_VALUE, EnumSet.allOf(Field.class),
UserGroupInformation.getLoginUser());
Map<ContainerId, ContainerReport> containers =
new LinkedHashMap<ContainerId, ContainerReport>();
if (entities != null && entities.getEntities() != null) {
for (TimelineEntity entity : entities.getEntities()) {
ContainerReport container = convertToContainerReport(
entity, serverHttpAddress, app.appReport.getUser());
containers.put(container.getContainerId(), container);
}
}
return containers;
}
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:ApplicationHistoryManagerOnTimelineStore.java
示例7: testContainerReport
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Test
public void testContainerReport() throws IOException, YarnException {
ApplicationId appId = ApplicationId.newInstance(0, 1);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
GetContainerReportRequest request =
GetContainerReportRequest.newInstance(containerId);
GetContainerReportResponse response =
clientService.getContainerReport(request);
ContainerReport container = response.getContainerReport();
Assert.assertNotNull(container);
Assert.assertEquals(containerId, container.getContainerId());
Assert.assertEquals("http://0.0.0.0:8188/applicationhistory/logs/" +
"test host:100/container_0_0001_01_000001/" +
"container_0_0001_01_000001/user1", container.getLogUrl());
}
开发者ID:naver,项目名称:hadoop,代码行数:18,代码来源:TestApplicationHistoryClientService.java
示例8: testContainers
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Test
public void testContainers() throws IOException, YarnException {
ApplicationId appId = ApplicationId.newInstance(0, 1);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(appId, 1);
ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
ContainerId containerId1 = ContainerId.newContainerId(appAttemptId, 2);
GetContainersRequest request =
GetContainersRequest.newInstance(appAttemptId);
GetContainersResponse response =
clientService.getContainers(request);
List<ContainerReport> containers = response.getContainerList();
Assert.assertNotNull(containers);
Assert.assertEquals(containerId, containers.get(0).getContainerId());
Assert.assertEquals(containerId1, containers.get(1).getContainerId());
}
开发者ID:naver,项目名称:hadoop,代码行数:17,代码来源:TestApplicationHistoryClientService.java
示例9: getContainerReport
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Override
public ContainerReport getContainerReport(ContainerId containerId)
throws YarnException, IOException {
try {
GetContainerReportRequest request = Records
.newRecord(GetContainerReportRequest.class);
request.setContainerId(containerId);
GetContainerReportResponse response = rmClient
.getContainerReport(request);
return response.getContainerReport();
} catch (YarnException e) {
if (!historyServiceEnabled) {
// Just throw it as usual if historyService is not enabled.
throw e;
}
// Even if history-service is enabled, treat all exceptions still the same
// except the following
if (e.getClass() != ApplicationNotFoundException.class
&& e.getClass() != ContainerNotFoundException.class) {
throw e;
}
return historyClient.getContainerReport(containerId);
}
}
开发者ID:naver,项目名称:hadoop,代码行数:25,代码来源:YarnClientImpl.java
示例10: listContainers
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
/**
* Lists the containers matching the given application attempts
*
* @param appAttemptId
* @throws YarnException
* @throws IOException
*/
private void listContainers(String appAttemptId) throws YarnException,
IOException {
PrintWriter writer = new PrintWriter(
new OutputStreamWriter(sysout, Charset.forName("UTF-8")));
List<ContainerReport> appsReport = client
.getContainers(ConverterUtils.toApplicationAttemptId(appAttemptId));
writer.println("Total number of containers " + ":" + appsReport.size());
writer.printf(CONTAINER_PATTERN, "Container-Id", "Start Time",
"Finish Time", "State", "Host", "Node Http Address", "LOG-URL");
for (ContainerReport containerReport : appsReport) {
writer.printf(
CONTAINER_PATTERN,
containerReport.getContainerId(),
Times.format(containerReport.getCreationTime()),
Times.format(containerReport.getFinishTime()),
containerReport.getContainerState(), containerReport
.getAssignedNode(), containerReport.getNodeHttpAddress() == null
? "N/A" : containerReport.getNodeHttpAddress(),
containerReport.getLogUrl());
}
writer.flush();
}
开发者ID:naver,项目名称:hadoop,代码行数:31,代码来源:ApplicationCLI.java
示例11: testGetContainers
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Test(timeout = 10000)
public void testGetContainers() throws YarnException, IOException {
Configuration conf = new Configuration();
final AHSClient client = new MockAHSClient();
client.init(conf);
client.start();
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(applicationId, 1);
List<ContainerReport> reports = client.getContainers(appAttemptId);
Assert.assertNotNull(reports);
Assert.assertEquals(reports.get(0).getContainerId(),
(ContainerId.newContainerId(appAttemptId, 1)));
Assert.assertEquals(reports.get(1).getContainerId(),
(ContainerId.newContainerId(appAttemptId, 2)));
client.stop();
}
开发者ID:naver,项目名称:hadoop,代码行数:19,代码来源:TestAHSClient.java
示例12: testGetContainerReport
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Test(timeout = 10000)
public void testGetContainerReport() throws YarnException, IOException {
Configuration conf = new Configuration();
final AHSClient client = new MockAHSClient();
client.init(conf);
client.start();
List<ApplicationReport> expectedReports =
((MockAHSClient) client).getReports();
ApplicationId applicationId = ApplicationId.newInstance(1234, 5);
ApplicationAttemptId appAttemptId =
ApplicationAttemptId.newInstance(applicationId, 1);
ContainerId containerId = ContainerId.newContainerId(appAttemptId, 1);
ContainerReport report = client.getContainerReport(containerId);
Assert.assertNotNull(report);
Assert.assertEquals(report.getContainerId().toString(), (ContainerId
.newContainerId(expectedReports.get(0).getCurrentApplicationAttemptId(), 1))
.toString());
client.stop();
}
开发者ID:naver,项目名称:hadoop,代码行数:22,代码来源:TestAHSClient.java
示例13: getContainer
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
private ContainerReport getContainer(
ContainerId containerId,
HashMap<ApplicationAttemptId, List<ContainerReport>> containersToAppAttemptMapping)
throws YarnException, IOException {
List<ContainerReport> containersForAppAttempt =
containersToAppAttemptMapping.get(containerId
.getApplicationAttemptId());
if (containersForAppAttempt == null) {
throw new ApplicationNotFoundException(containerId
.getApplicationAttemptId().getApplicationId() + " is not found ");
}
Iterator<ContainerReport> iterator = containersForAppAttempt.iterator();
while (iterator.hasNext()) {
ContainerReport next = iterator.next();
if (next.getContainerId().equals(containerId)) {
return next;
}
}
throw new ContainerNotFoundException(containerId + " is not found ");
}
开发者ID:naver,项目名称:hadoop,代码行数:21,代码来源:TestYarnClient.java
示例14: ContainerInfo
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
public ContainerInfo(ContainerReport container) {
containerId = container.getContainerId().toString();
if (container.getAllocatedResource() != null) {
allocatedMB = container.getAllocatedResource().getMemory();
allocatedVCores = container.getAllocatedResource().getVirtualCores();
}
if (container.getAssignedNode() != null) {
assignedNodeId = container.getAssignedNode().toString();
}
priority = container.getPriority().getPriority();
startedTime = container.getCreationTime();
finishedTime = container.getFinishTime();
elapsedTime = Times.elapsed(startedTime, finishedTime);
diagnosticsInfo = container.getDiagnosticsInfo();
logUrl = container.getLogUrl();
containerExitStatus = container.getContainerExitStatus();
containerState = container.getContainerState();
nodeHttpAddress = container.getNodeHttpAddress();
}
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:20,代码来源:ContainerInfo.java
示例15: getContainerReport
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Override
public ContainerReport getContainerReport() {
if (this.containerReport != null) {
return this.containerReport;
}
GetContainerReportResponseProtoOrBuilder p = viaProto ? proto : builder;
if (!p.hasContainerReport()) {
return null;
}
this.containerReport = convertFromProtoFormat(p.getContainerReport());
return this.containerReport;
}
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:GetContainerReportResponsePBImpl.java
示例16: setContainerReport
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Override
public void setContainerReport(ContainerReport containerReport) {
maybeInitBuilder();
if (containerReport == null) {
builder.clearContainerReport();
}
this.containerReport = containerReport;
}
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:GetContainerReportResponsePBImpl.java
示例17: setContainerList
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
@Override
public void setContainerList(List<ContainerReport> containers) {
maybeInitBuilder();
if (containers == null) {
builder.clearContainers();
}
this.containerList = containers;
}
开发者ID:naver,项目名称:hadoop,代码行数:9,代码来源:GetContainersResponsePBImpl.java
示例18: initLocalContainerList
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
private void initLocalContainerList() {
if (this.containerList != null) {
return;
}
GetContainersResponseProtoOrBuilder p = viaProto ? proto : builder;
List<ContainerReportProto> list = p.getContainersList();
containerList = new ArrayList<ContainerReport>();
for (ContainerReportProto c : list) {
containerList.add(convertFromProtoFormat(c));
}
}
开发者ID:naver,项目名称:hadoop,代码行数:13,代码来源:GetContainersResponsePBImpl.java
示例19: addLocalContainersToProto
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
private void addLocalContainersToProto() {
maybeInitBuilder();
builder.clearContainers();
if (containerList == null) {
return;
}
Iterable<ContainerReportProto> iterable =
new Iterable<ContainerReportProto>() {
@Override
public Iterator<ContainerReportProto> iterator() {
return new Iterator<ContainerReportProto>() {
Iterator<ContainerReport> iter = containerList.iterator();
@Override
public boolean hasNext() {
return iter.hasNext();
}
@Override
public ContainerReportProto next() {
return convertToProtoFormat(iter.next());
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
}
};
builder.addAllContainers(iterable);
}
开发者ID:naver,项目名称:hadoop,代码行数:36,代码来源:GetContainersResponsePBImpl.java
示例20: hasAMContainer
import org.apache.hadoop.yarn.api.records.ContainerReport; //导入依赖的package包/类
private boolean hasAMContainer(ContainerId containerId,
Collection<ContainerReport> containers) {
for (ContainerReport container : containers) {
if (containerId.equals(container.getContainerId())) {
return true;
}
}
return false;
}
开发者ID:naver,项目名称:hadoop,代码行数:10,代码来源:AppAttemptBlock.java
注:本文中的org.apache.hadoop.yarn.api.records.ContainerReport类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论