YARN-7203. Add container ExecutionType into ContainerReport. (Botong Huang via asuresh)
This commit is contained in:
parent
3cf3540f19
commit
56ef5279c1
@ -52,6 +52,18 @@ public static ContainerReport newInstance(ContainerId containerId,
|
|||||||
long creationTime, long finishTime, String diagnosticInfo, String logUrl,
|
long creationTime, long finishTime, String diagnosticInfo, String logUrl,
|
||||||
int containerExitStatus, ContainerState containerState,
|
int containerExitStatus, ContainerState containerState,
|
||||||
String nodeHttpAddress) {
|
String nodeHttpAddress) {
|
||||||
|
return newInstance(containerId, allocatedResource, assignedNode, priority,
|
||||||
|
creationTime, finishTime, diagnosticInfo, logUrl, containerExitStatus,
|
||||||
|
containerState, nodeHttpAddress, ExecutionType.GUARANTEED);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Private
|
||||||
|
@Unstable
|
||||||
|
public static ContainerReport newInstance(ContainerId containerId,
|
||||||
|
Resource allocatedResource, NodeId assignedNode, Priority priority,
|
||||||
|
long creationTime, long finishTime, String diagnosticInfo, String logUrl,
|
||||||
|
int containerExitStatus, ContainerState containerState,
|
||||||
|
String nodeHttpAddress, ExecutionType executionType) {
|
||||||
ContainerReport report = Records.newRecord(ContainerReport.class);
|
ContainerReport report = Records.newRecord(ContainerReport.class);
|
||||||
report.setContainerId(containerId);
|
report.setContainerId(containerId);
|
||||||
report.setAllocatedResource(allocatedResource);
|
report.setAllocatedResource(allocatedResource);
|
||||||
@ -64,6 +76,7 @@ public static ContainerReport newInstance(ContainerId containerId,
|
|||||||
report.setContainerExitStatus(containerExitStatus);
|
report.setContainerExitStatus(containerExitStatus);
|
||||||
report.setContainerState(containerState);
|
report.setContainerState(containerState);
|
||||||
report.setNodeHttpAddress(nodeHttpAddress);
|
report.setNodeHttpAddress(nodeHttpAddress);
|
||||||
|
report.setExecutionType(executionType);
|
||||||
return report;
|
return report;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,4 +222,17 @@ public static ContainerReport newInstance(ContainerId containerId,
|
|||||||
@Private
|
@Private
|
||||||
@Unstable
|
@Unstable
|
||||||
public abstract void setNodeHttpAddress(String nodeHttpAddress);
|
public abstract void setNodeHttpAddress(String nodeHttpAddress);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the execution type of the container.
|
||||||
|
*
|
||||||
|
* @return the execution type of the container
|
||||||
|
*/
|
||||||
|
@Public
|
||||||
|
@Unstable
|
||||||
|
public abstract ExecutionType getExecutionType();
|
||||||
|
|
||||||
|
@Private
|
||||||
|
@Unstable
|
||||||
|
public abstract void setExecutionType(ExecutionType executionType);
|
||||||
}
|
}
|
||||||
|
@ -137,6 +137,7 @@ message ContainerReportProto {
|
|||||||
optional int32 container_exit_status = 9;
|
optional int32 container_exit_status = 9;
|
||||||
optional ContainerStateProto container_state = 10;
|
optional ContainerStateProto container_state = 10;
|
||||||
optional string node_http_address = 11;
|
optional string node_http_address = 11;
|
||||||
|
optional ExecutionTypeProto executionType = 12 [default = GUARANTEED];
|
||||||
}
|
}
|
||||||
|
|
||||||
enum YarnApplicationStateProto {
|
enum YarnApplicationStateProto {
|
||||||
|
@ -601,6 +601,7 @@ public void testGetContainerReport() throws YarnException, IOException {
|
|||||||
Assert.assertEquals(report.getContainerId().toString(),
|
Assert.assertEquals(report.getContainerId().toString(),
|
||||||
(ContainerId.newContainerId(expectedReports.get(0)
|
(ContainerId.newContainerId(expectedReports.get(0)
|
||||||
.getCurrentApplicationAttemptId(), 3)).toString());
|
.getCurrentApplicationAttemptId(), 3)).toString());
|
||||||
|
Assert.assertNotNull(report.getExecutionType());
|
||||||
client.stop();
|
client.stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
import org.apache.hadoop.yarn.api.records.ContainerId;
|
import org.apache.hadoop.yarn.api.records.ContainerId;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
import org.apache.hadoop.yarn.api.records.ContainerReport;
|
||||||
import org.apache.hadoop.yarn.api.records.ContainerState;
|
import org.apache.hadoop.yarn.api.records.ContainerState;
|
||||||
|
import org.apache.hadoop.yarn.api.records.ExecutionType;
|
||||||
import org.apache.hadoop.yarn.api.records.NodeId;
|
import org.apache.hadoop.yarn.api.records.NodeId;
|
||||||
import org.apache.hadoop.yarn.api.records.Priority;
|
import org.apache.hadoop.yarn.api.records.Priority;
|
||||||
import org.apache.hadoop.yarn.api.records.Resource;
|
import org.apache.hadoop.yarn.api.records.Resource;
|
||||||
@ -355,4 +356,23 @@ public void setNodeHttpAddress(String nodeHttpAddress) {
|
|||||||
}
|
}
|
||||||
builder.setNodeHttpAddress(nodeHttpAddress);
|
builder.setNodeHttpAddress(nodeHttpAddress);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExecutionType getExecutionType() {
|
||||||
|
ContainerReportProtoOrBuilder p = viaProto ? proto : builder;
|
||||||
|
if (!p.hasExecutionType()) {
|
||||||
|
return ExecutionType.GUARANTEED; // default value
|
||||||
|
}
|
||||||
|
return ProtoUtils.convertFromProtoFormat(p.getExecutionType());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setExecutionType(ExecutionType executionType) {
|
||||||
|
maybeInitBuilder();
|
||||||
|
if (executionType == null) {
|
||||||
|
builder.clearExecutionType();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
builder.setExecutionType(ProtoUtils.convertToProtoFormat(executionType));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -756,7 +756,7 @@ public ContainerReport createContainerReport() {
|
|||||||
this.getAllocatedSchedulerKey().getPriority(), this.getCreationTime(),
|
this.getAllocatedSchedulerKey().getPriority(), this.getCreationTime(),
|
||||||
this.getFinishTime(), this.getDiagnosticsInfo(), this.getLogURL(),
|
this.getFinishTime(), this.getDiagnosticsInfo(), this.getLogURL(),
|
||||||
this.getContainerExitStatus(), this.getContainerState(),
|
this.getContainerExitStatus(), this.getContainerState(),
|
||||||
this.getNodeHttpAddress());
|
this.getNodeHttpAddress(), this.getExecutionType());
|
||||||
} finally {
|
} finally {
|
||||||
this.readLock.unlock();
|
this.readLock.unlock();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user