YARN-6173. Add artifact info and privileged container details to the container info in API GET response. Contributed by Gour Saha
This commit is contained in:
parent
68940ab8f6
commit
e34ca6b02d
|
@ -1000,6 +1000,19 @@ public class ApplicationApiService implements ApplicationApi {
|
||||||
resource.setCpus(jsonGetAsInt(componentRole, "yarn.vcores"));
|
resource.setCpus(jsonGetAsInt(componentRole, "yarn.vcores"));
|
||||||
resource.setMemory(jsonGetAsString(componentRole, "yarn.memory"));
|
resource.setMemory(jsonGetAsString(componentRole, "yarn.memory"));
|
||||||
container.setResource(resource);
|
container.setResource(resource);
|
||||||
|
Artifact artifact = new Artifact();
|
||||||
|
String dockerImageName = jsonGetAsString(componentRole,
|
||||||
|
"docker.image");
|
||||||
|
if (StringUtils.isNotEmpty(dockerImageName)) {
|
||||||
|
artifact.setId(dockerImageName);
|
||||||
|
artifact.setType(Artifact.TypeEnum.DOCKER);
|
||||||
|
} else {
|
||||||
|
// Might have to handle tarballs here
|
||||||
|
artifact.setType(null);
|
||||||
|
}
|
||||||
|
container.setArtifact(artifact);
|
||||||
|
container.setPrivilegedContainer(
|
||||||
|
jsonGetAsBoolean(componentRole, "docker.usePrivileged"));
|
||||||
// TODO: add container property - for response only?
|
// TODO: add container property - for response only?
|
||||||
app.addContainer(container);
|
app.addContainer(container);
|
||||||
}
|
}
|
||||||
|
@ -1057,6 +1070,11 @@ public class ApplicationApiService implements ApplicationApi {
|
||||||
: object.get(key).isJsonNull() ? null : object.get(key).getAsInt();
|
: object.get(key).isJsonNull() ? null : object.get(key).getAsInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Boolean jsonGetAsBoolean(JsonObject object, String key) {
|
||||||
|
return object.get(key) == null ? null
|
||||||
|
: object.get(key).isJsonNull() ? null : object.get(key).getAsBoolean();
|
||||||
|
}
|
||||||
|
|
||||||
private JsonObject jsonGetAsObject(JsonObject object, String key) {
|
private JsonObject jsonGetAsObject(JsonObject object, String key) {
|
||||||
return object.get(key) == null ? null : object.get(key).getAsJsonObject();
|
return object.get(key) == null ? null : object.get(key).getAsJsonObject();
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,6 +48,8 @@ public class Container extends BaseResource {
|
||||||
private ContainerState state = null;
|
private ContainerState state = null;
|
||||||
private String componentName = null;
|
private String componentName = null;
|
||||||
private Resource resource = null;
|
private Resource resource = null;
|
||||||
|
private Artifact artifact = null;
|
||||||
|
private Boolean privilegedContainer = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unique container id of a running application, e.g.
|
* Unique container id of a running application, e.g.
|
||||||
|
@ -204,6 +206,42 @@ public class Container extends BaseResource {
|
||||||
this.resource = resource;
|
this.resource = resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Artifact used for this container.
|
||||||
|
**/
|
||||||
|
public Container artifact(Artifact artifact) {
|
||||||
|
this.artifact = artifact;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "Artifact used for this container.")
|
||||||
|
@JsonProperty("artifact")
|
||||||
|
public Artifact getArtifact() {
|
||||||
|
return artifact;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setArtifact(Artifact artifact) {
|
||||||
|
this.artifact = artifact;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Container running in privileged mode or not.
|
||||||
|
**/
|
||||||
|
public Container privilegedContainer(Boolean privilegedContainer) {
|
||||||
|
this.privilegedContainer = privilegedContainer;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "null", value = "Container running in privileged mode or not.")
|
||||||
|
@JsonProperty("privileged_container")
|
||||||
|
public Boolean getPrivilegedContainer() {
|
||||||
|
return privilegedContainer;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPrivilegedContainer(Boolean privilegedContainer) {
|
||||||
|
this.privilegedContainer = privilegedContainer;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(java.lang.Object o) {
|
public boolean equals(java.lang.Object o) {
|
||||||
if (this == o) {
|
if (this == o) {
|
||||||
|
@ -213,20 +251,12 @@ public class Container extends BaseResource {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Container container = (Container) o;
|
Container container = (Container) o;
|
||||||
return Objects.equals(this.id, container.id)
|
return Objects.equals(this.id, container.id);
|
||||||
&& Objects.equals(this.launchTime, container.launchTime)
|
|
||||||
&& Objects.equals(this.ip, container.ip)
|
|
||||||
&& Objects.equals(this.hostname, container.hostname)
|
|
||||||
&& Objects.equals(this.bareHost, container.bareHost)
|
|
||||||
&& Objects.equals(this.state, container.state)
|
|
||||||
&& Objects.equals(this.componentName, container.componentName)
|
|
||||||
&& Objects.equals(this.resource, container.resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(id, launchTime, ip, hostname, bareHost, state,
|
return Objects.hash(id);
|
||||||
componentName, resource);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -244,6 +274,9 @@ public class Container extends BaseResource {
|
||||||
sb.append(" componentName: ").append(toIndentedString(componentName))
|
sb.append(" componentName: ").append(toIndentedString(componentName))
|
||||||
.append("\n");
|
.append("\n");
|
||||||
sb.append(" resource: ").append(toIndentedString(resource)).append("\n");
|
sb.append(" resource: ").append(toIndentedString(resource)).append("\n");
|
||||||
|
sb.append(" artifact: ").append(toIndentedString(artifact)).append("\n");
|
||||||
|
sb.append(" privilegedContainer: ")
|
||||||
|
.append(toIndentedString(privilegedContainer)).append("\n");
|
||||||
sb.append("}");
|
sb.append("}");
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
|
@ -379,6 +379,12 @@ definitions:
|
||||||
resource:
|
resource:
|
||||||
description: Resource used for this container.
|
description: Resource used for this container.
|
||||||
$ref: '#/definitions/Resource'
|
$ref: '#/definitions/Resource'
|
||||||
|
artifact:
|
||||||
|
description: Artifact used for this container.
|
||||||
|
$ref: '#/definitions/Artifact'
|
||||||
|
privileged_container:
|
||||||
|
type: boolean
|
||||||
|
description: Container running in privileged mode or not.
|
||||||
ApplicationState:
|
ApplicationState:
|
||||||
description: The current state of an application.
|
description: The current state of an application.
|
||||||
properties:
|
properties:
|
||||||
|
|
Loading…
Reference in New Issue