diff --git hadoop-project/pom.xml hadoop-project/pom.xml index 3a6519c..6a8fdfa 100644 --- hadoop-project/pom.xml +++ hadoop-project/pom.xml @@ -425,6 +425,11 @@ com.sun.jersey + jersey-client + ${jersey.version} + + + com.sun.jersey jersey-server ${jersey.version} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntities.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntities.java deleted file mode 100644 index ed02cac..0000000 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntities.java +++ /dev/null @@ -1,88 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.api.records.apptimeline; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.apache.hadoop.classification.InterfaceAudience.Public; -import org.apache.hadoop.classification.InterfaceStability.Unstable; - -/** - * The class that hosts a list of application timeline entities. - */ -@XmlRootElement(name = "entities") -@XmlAccessorType(XmlAccessType.NONE) -@Public -@Unstable -public class ATSEntities { - - private List entities = - new ArrayList(); - - public ATSEntities() { - - } - - /** - * Get a list of entities - * - * @return a list of entities - */ - @XmlElement(name = "entities") - public List getEntities() { - return entities; - } - - /** - * Add a single entity into the existing entity list - * - * @param entity - * a single entity - */ - public void addEntity(ATSEntity entity) { - entities.add(entity); - } - - /** - * All a list of entities into the existing entity list - * - * @param entities - * a list of entities - */ - public void addEntities(List entities) { - this.entities.addAll(entities); - } - - /** - * Set the entity list to the given list of entities - * - * @param entities - * a list of entities - */ - public void setEntities(List entities) { - this.entities = entities; - } - -} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntity.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntity.java deleted file mode 100644 index 6b3ea10..0000000 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEntity.java +++ /dev/null @@ -1,313 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.api.records.apptimeline; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.apache.hadoop.classification.InterfaceAudience.Public; -import org.apache.hadoop.classification.InterfaceStability.Unstable; - -/** - *

- * The class that contains the the meta information of some conceptual entity of - * an application and its related events. The entity can be an application, an - * application attempt, a container or whatever the user-defined object. - *

- * - *

- * Primary filters will be used to index the entities in - * ApplicationTimelineStore, such that users should carefully - * choose the information they want to store as the primary filters. The - * remaining can be stored as other information. - *

- */ -@XmlRootElement(name = "entity") -@XmlAccessorType(XmlAccessType.NONE) -@Public -@Unstable -public class ATSEntity { - - private String entityType; - private String entityId; - private Long startTime; - private List events = new ArrayList(); - private Map> relatedEntities = - new HashMap>(); - private Map primaryFilters = - new HashMap(); - private Map otherInfo = - new HashMap(); - - public ATSEntity() { - - } - - /** - * Get the entity type - * - * @return the entity type - */ - @XmlElement(name = "entitytype") - public String getEntityType() { - return entityType; - } - - /** - * Set the entity type - * - * @param entityType - * the entity type - */ - public void setEntityType(String entityType) { - this.entityType = entityType; - } - - /** - * Get the entity Id - * - * @return the entity Id - */ - @XmlElement(name = "entity") - public String getEntityId() { - return entityId; - } - - /** - * Set the entity Id - * - * @param entityId - * the entity Id - */ - public void setEntityId(String entityId) { - this.entityId = entityId; - } - - /** - * Get the start time of the entity - * - * @return the start time of the entity - */ - @XmlElement(name = "starttime") - public Long getStartTime() { - return startTime; - } - - /** - * Set the start time of the entity - * - * @param startTime - * the start time of the entity - */ - public void setStartTime(Long startTime) { - this.startTime = startTime; - } - - /** - * Get a list of events related to the entity - * - * @return a list of events related to the entity - */ - @XmlElement(name = "events") - public List getEvents() { - return events; - } - - /** - * Add a single event related to the entity to the existing event list - * - * @param event - * a single event related to the entity - */ - public void addEvent(ATSEvent event) { - events.add(event); - } - - /** - * Add a list of events related to the entity to the existing event list - * - * @param events - * a list of events related to the entity - */ - public void addEvents(List events) { - this.events.addAll(events); - } - - /** - * Set the event list to the given list of events related to the entity - * - * @param events - * events a list of events related to the entity - */ - public void setEvents(List events) { - this.events = events; - } - - /** - * Get the related entities - * - * @return the related entities - */ - @XmlElement(name = "relatedentities") - public Map> getRelatedEntities() { - return relatedEntities; - } - - /** - * Add an entity to the existing related entity map - * - * @param entityType - * the entity type - * @param entityId - * the entity Id - */ - public void addRelatedEntity(String entityType, String entityId) { - List thisRelatedEntity = relatedEntities.get(entityType); - if (thisRelatedEntity == null) { - thisRelatedEntity = new ArrayList(); - relatedEntities.put(entityType, thisRelatedEntity); - } - thisRelatedEntity.add(entityId); - } - - /** - * Add a map of related entities to the existing related entity map - * - * @param relatedEntities - * a map of related entities - */ - public void addRelatedEntities(Map> relatedEntities) { - for (Entry> relatedEntity : - relatedEntities.entrySet()) { - List thisRelatedEntity = - this.relatedEntities.get(relatedEntity.getKey()); - if (thisRelatedEntity == null) { - this.relatedEntities.put( - relatedEntity.getKey(), relatedEntity.getValue()); - } else { - thisRelatedEntity.addAll(relatedEntity.getValue()); - } - } - } - - /** - * Set the related entity map to the given map of related entities - * - * @param relatedEntities - * a map of related entities - */ - public void setRelatedEntities( - Map> relatedEntities) { - this.relatedEntities = relatedEntities; - } - - /** - * Get the primary filters - * - * @return the primary filters - */ - @XmlElement(name = "primaryfilters") - public Map getPrimaryFilters() { - return primaryFilters; - } - - /** - * Add a single piece of primary filter to the existing primary filter map - * - * @param key - * the primary filter key - * @param value - * the primary filter value - */ - public void addPrimaryFilter(String key, Object value) { - primaryFilters.put(key, value); - } - - /** - * Add a map of primary filters to the existing primary filter map - * - * @param primaryFilters - * a map of primary filters - */ - public void addPrimaryFilters(Map primaryFilters) { - this.primaryFilters.putAll(primaryFilters); - } - - /** - * Set the primary filter map to the given map of primary filters - * - * @param primaryFilters - * a map of primary filters - */ - public void setPrimaryFilters(Map primaryFilters) { - this.primaryFilters = primaryFilters; - } - - /** - * Get the other information of the entity - * - * @return the other information of the entity - */ - @XmlElement(name = "otherinfo") - public Map getOtherInfo() { - return otherInfo; - } - - /** - * Add one piece of other information of the entity to the existing other info - * map - * - * @param key - * the other information key - * @param value - * the other information value - */ - public void addOtherInfo(String key, Object value) { - this.otherInfo.put(key, value); - } - - /** - * Add a map of other information of the entity to the existing other info map - * - * @param otherInfo - * a map of other information - */ - public void addOtherInfo(Map otherInfo) { - this.otherInfo.putAll(otherInfo); - } - - /** - * Set the other info map to the given map of other information - * - * @param otherInfo - * a map of other information - */ - public void setOtherInfo(Map otherInfo) { - this.otherInfo = otherInfo; - } - -} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEvent.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEvent.java deleted file mode 100644 index 27bac16..0000000 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEvent.java +++ /dev/null @@ -1,172 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.api.records.apptimeline; - -import java.util.HashMap; -import java.util.Map; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.apache.hadoop.classification.InterfaceAudience.Public; -import org.apache.hadoop.classification.InterfaceStability.Unstable; - -/** - * The class that contains the information of an event that is related to some - * conceptual entity of an application. Users are free to define what the event - * means, such as starting an application, getting allocated a container and - * etc. - */ -@XmlRootElement(name = "event") -@XmlAccessorType(XmlAccessType.NONE) -@Public -@Unstable -public class ATSEvent implements Comparable { - - private long timestamp; - private String eventType; - private Map eventInfo = new HashMap(); - - public ATSEvent() { - } - - /** - * Get the timestamp of the event - * - * @return the timestamp of the event - */ - @XmlElement(name = "timestamp") - public long getTimestamp() { - return timestamp; - } - - /** - * Set the timestamp of the event - * - * @param timestamp - * the timestamp of the event - */ - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - /** - * Get the event type - * - * @return the event type - */ - @XmlElement(name = "eventtype") - public String getEventType() { - return eventType; - } - - /** - * Set the event type - * - * @param eventType - * the event type - */ - public void setEventType(String eventType) { - this.eventType = eventType; - } - - /** - * Set the information of the event - * - * @return the information of the event - */ - @XmlElement(name = "eventinfo") - public Map getEventInfo() { - return eventInfo; - } - - /** - * Add one piece of the information of the event to the existing information - * map - * - * @param key - * the information key - * @param value - * the information value - */ - public void addEventInfo(String key, Object value) { - this.eventInfo.put(key, value); - } - - /** - * Add a map of the information of the event to the existing information map - * - * @param eventInfo - * a map of of the information of the event - */ - public void addEventInfo(Map eventInfo) { - this.eventInfo.putAll(eventInfo); - } - - /** - * Set the information map to the given map of the information of the event - * - * @param eventInfo - * a map of of the information of the event - */ - public void setEventInfo(Map eventInfo) { - this.eventInfo = eventInfo; - } - - @Override - public int compareTo(ATSEvent other) { - if (timestamp > other.timestamp) { - return -1; - } else if (timestamp < other.timestamp) { - return 1; - } else { - return eventType.compareTo(other.eventType); - } - } - - @Override - public boolean equals(Object o) { - if (this == o) - return true; - if (o == null || getClass() != o.getClass()) - return false; - - ATSEvent atsEvent = (ATSEvent) o; - - if (timestamp != atsEvent.timestamp) - return false; - if (!eventType.equals(atsEvent.eventType)) - return false; - if (eventInfo != null ? !eventInfo.equals(atsEvent.eventInfo) : - atsEvent.eventInfo != null) - return false; - - return true; - } - - @Override - public int hashCode() { - int result = (int) (timestamp ^ (timestamp >>> 32)); - result = 31 * result + eventType.hashCode(); - result = 31 * result + (eventInfo != null ? eventInfo.hashCode() : 0); - return result; - } -} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEvents.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEvents.java deleted file mode 100644 index a08537d..0000000 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSEvents.java +++ /dev/null @@ -1,189 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.apache.hadoop.yarn.api.records.apptimeline; - -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -import org.apache.hadoop.classification.InterfaceAudience.Public; -import org.apache.hadoop.classification.InterfaceStability.Unstable; - -/** - * The class that hosts a list of events, which are categorized according to - * their related entities. - */ -@XmlRootElement(name = "events") -@XmlAccessorType(XmlAccessType.NONE) -@Public -@Unstable -public class ATSEvents { - - private List allEvents = - new ArrayList(); - - public ATSEvents() { - - } - - /** - * Get a list of {@link ATSEventsOfOneEntity} instances - * - * @return a list of {@link ATSEventsOfOneEntity} instances - */ - @XmlElement(name = "events") - public List getAllEvents() { - return allEvents; - } - - /** - * Add a single {@link ATSEventsOfOneEntity} instance into the existing list - * - * @param eventsOfOneEntity - * a single {@link ATSEventsOfOneEntity} instance - */ - public void addEvent(ATSEventsOfOneEntity eventsOfOneEntity) { - allEvents.add(eventsOfOneEntity); - } - - /** - * Add a list of {@link ATSEventsOfOneEntity} instances into the existing list - * - * @param allEvents - * a list of {@link ATSEventsOfOneEntity} instances - */ - public void addEvents(List allEvents) { - this.allEvents.addAll(allEvents); - } - - /** - * Set the list to the given list of {@link ATSEventsOfOneEntity} instances - * - * @param allEvents - * a list of {@link ATSEventsOfOneEntity} instances - */ - public void setEvents(List allEvents) { - this.allEvents.clear(); - this.allEvents.addAll(allEvents); - } - - /** - * The class that hosts a list of events that are only related to one entity. - */ - @XmlRootElement(name = "events") - @XmlAccessorType(XmlAccessType.NONE) - @Public - @Unstable - public static class ATSEventsOfOneEntity { - - private String entityId; - private String entityType; - private List events = new ArrayList(); - - public ATSEventsOfOneEntity() { - - } - - /** - * Get the entity Id - * - * @return the entity Id - */ - @XmlElement(name = "entity") - public String getEntityId() { - return entityId; - } - - /** - * Set the entity Id - * - * @param entityId - * the entity Id - */ - public void setEntityId(String entityId) { - this.entityId = entityId; - } - - /** - * Get the entity type - * - * @return the entity type - */ - @XmlElement(name = "entitytype") - public String getEntityType() { - return entityType; - } - - /** - * Set the entity type - * - * @param entityType - * the entity type - */ - public void setEntityType(String entityType) { - this.entityType = entityType; - } - - /** - * Get a list of events - * - * @return a list of events - */ - @XmlElement(name = "events") - public List getEvents() { - return events; - } - - /** - * Add a single event to the existing event list - * - * @param event - * a single event - */ - public void addEvent(ATSEvent event) { - events.add(event); - } - - /** - * Add a list of event to the existing event list - * - * @param events - * a list of events - */ - public void addEvents(List events) { - this.events.addAll(events); - } - - /** - * Set the event list to the given list of events - * - * @param events - * a list of events - */ - public void setEvents(List events) { - this.events = events; - } - - } - -} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSPutErrors.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSPutErrors.java deleted file mode 100644 index 91458e1..0000000 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/ATSPutErrors.java +++ /dev/null @@ -1,163 +0,0 @@ -/** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.hadoop.yarn.api.records.apptimeline; - -import org.apache.hadoop.classification.InterfaceAudience.Public; -import org.apache.hadoop.classification.InterfaceStability.Unstable; - -import javax.xml.bind.annotation.XmlAccessType; -import javax.xml.bind.annotation.XmlAccessorType; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import java.util.ArrayList; -import java.util.List; - -/** - * A class that holds a list of put errors. This is the response returned - * when a list of {@link ATSEntity} objects is added to the application - * timeline. If there are errors in storing individual entity objects, - * they will be indicated in the list of errors. - */ -@XmlRootElement(name = "errors") -@XmlAccessorType(XmlAccessType.NONE) -@Public -@Unstable -public class ATSPutErrors { - - private List errors = new ArrayList(); - - public ATSPutErrors() { - - } - - /** - * Get a list of {@link ATSPutError} instances - * - * @return a list of {@link ATSPutError} instances - */ - @XmlElement(name = "errors") - public List getErrors() { - return errors; - } - - /** - * Add a single {@link ATSPutError} instance into the existing list - * - * @param error - * a single {@link ATSPutError} instance - */ - public void addError(ATSPutError error) { - errors.add(error); - } - - /** - * Add a list of {@link ATSPutError} instances into the existing list - * - * @param errors - * a list of {@link ATSPutError} instances - */ - public void addErrors(List errors) { - this.errors.addAll(errors); - } - - /** - * Set the list to the given list of {@link ATSPutError} instances - * - * @param errors - * a list of {@link ATSPutError} instances - */ - public void setErrors(List errors) { - this.errors.clear(); - this.errors.addAll(errors); - } - - /** - * A class that holds the error code for one entity. - */ - @XmlRootElement(name = "error") - @XmlAccessorType(XmlAccessType.NONE) - @Public - @Unstable - public static class ATSPutError { - private String entityId; - private String entityType; - private Integer errorCode; - - /** - * Get the entity Id - * - * @return the entity Id - */ - @XmlElement(name = "entity") - public String getEntityId() { - return entityId; - } - - /** - * Set the entity Id - * - * @param entityId - * the entity Id - */ - public void setEntityId(String entityId) { - this.entityId = entityId; - } - - /** - * Get the entity type - * - * @return the entity type - */ - @XmlElement(name = "entitytype") - public String getEntityType() { - return entityType; - } - - /** - * Set the entity type - * - * @param entityType - * the entity type - */ - public void setEntityType(String entityType) { - this.entityType = entityType; - } - - /** - * Get the error code - * - * @return an error code - */ - @XmlElement(name = "errorcode") - public Integer getErrorCode() { - return errorCode; - } - - /** - * Set the error code to the given error code - * - * @param errorCode - * an error code - */ - public void setErrorCode(Integer errorCode) { - this.errorCode = errorCode; - } - - } - -} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Entities.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Entities.java new file mode 100644 index 0000000..2b4c074 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Entities.java @@ -0,0 +1,88 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.api.records.apptimeline; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; + +/** + * The class that hosts a list of application timeline entities. + */ +@XmlRootElement(name = "entities") +@XmlAccessorType(XmlAccessType.NONE) +@Public +@Unstable +public class Entities { + + private List entities = + new ArrayList(); + + public Entities() { + + } + + /** + * Get a list of entities + * + * @return a list of entities + */ + @XmlElement(name = "entities") + public List getEntities() { + return entities; + } + + /** + * Add a single entity into the existing entity list + * + * @param entity + * a single entity + */ + public void addEntity(Entity entity) { + entities.add(entity); + } + + /** + * All a list of entities into the existing entity list + * + * @param entities + * a list of entities + */ + public void addEntities(List entities) { + this.entities.addAll(entities); + } + + /** + * Set the entity list to the given list of entities + * + * @param entities + * a list of entities + */ + public void setEntities(List entities) { + this.entities = entities; + } + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Entity.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Entity.java new file mode 100644 index 0000000..bc8c459 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Entity.java @@ -0,0 +1,401 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.api.records.apptimeline; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; + +/** + *

+ * The class that contains the the meta information of some conceptual entity of + * an application and its related events. The entity can be an application, an + * application attempt, a container or whatever the user-defined object. + *

+ * + *

+ * Primary filters will be used to index the entities in + * ApplicationTimelineStore, such that users should carefully + * choose the information they want to store as the primary filters. The + * remaining can be stored as other information. + *

+ */ +@XmlRootElement(name = "entity") +@XmlAccessorType(XmlAccessType.NONE) +@Public +@Unstable +public class Entity implements Comparable { + + private String entityType; + private String entityId; + private Long startTime; + private List events = new ArrayList(); + private Map> relatedEntities = + new HashMap>(); + private Map primaryFilters = + new HashMap(); + private Map otherInfo = + new HashMap(); + + public Entity() { + + } + + /** + * Get the entity type + * + * @return the entity type + */ + @XmlElement(name = "entitytype") + public String getEntityType() { + return entityType; + } + + /** + * Set the entity type + * + * @param entityType + * the entity type + */ + public void setEntityType(String entityType) { + this.entityType = entityType; + } + + /** + * Get the entity Id + * + * @return the entity Id + */ + @XmlElement(name = "entity") + public String getEntityId() { + return entityId; + } + + /** + * Set the entity Id + * + * @param entityId + * the entity Id + */ + public void setEntityId(String entityId) { + this.entityId = entityId; + } + + /** + * Get the start time of the entity + * + * @return the start time of the entity + */ + @XmlElement(name = "starttime") + public Long getStartTime() { + return startTime; + } + + /** + * Set the start time of the entity + * + * @param startTime + * the start time of the entity + */ + public void setStartTime(Long startTime) { + this.startTime = startTime; + } + + /** + * Get a list of events related to the entity + * + * @return a list of events related to the entity + */ + @XmlElement(name = "events") + public List getEvents() { + return events; + } + + /** + * Add a single event related to the entity to the existing event list + * + * @param event + * a single event related to the entity + */ + public void addEvent(Event event) { + events.add(event); + } + + /** + * Add a list of events related to the entity to the existing event list + * + * @param events + * a list of events related to the entity + */ + public void addEvents(List events) { + this.events.addAll(events); + } + + /** + * Set the event list to the given list of events related to the entity + * + * @param events + * events a list of events related to the entity + */ + public void setEvents(List events) { + this.events = events; + } + + /** + * Get the related entities + * + * @return the related entities + */ + @XmlElement(name = "relatedentities") + public Map> getRelatedEntities() { + return relatedEntities; + } + + /** + * Add an entity to the existing related entity map + * + * @param entityType + * the entity type + * @param entityId + * the entity Id + */ + public void addRelatedEntity(String entityType, String entityId) { + List thisRelatedEntity = relatedEntities.get(entityType); + if (thisRelatedEntity == null) { + thisRelatedEntity = new ArrayList(); + relatedEntities.put(entityType, thisRelatedEntity); + } + thisRelatedEntity.add(entityId); + } + + /** + * Add a map of related entities to the existing related entity map + * + * @param relatedEntities + * a map of related entities + */ + public void addRelatedEntities(Map> relatedEntities) { + for (Entry> relatedEntity : + relatedEntities.entrySet()) { + List thisRelatedEntity = + this.relatedEntities.get(relatedEntity.getKey()); + if (thisRelatedEntity == null) { + this.relatedEntities.put( + relatedEntity.getKey(), relatedEntity.getValue()); + } else { + thisRelatedEntity.addAll(relatedEntity.getValue()); + } + } + } + + /** + * Set the related entity map to the given map of related entities + * + * @param relatedEntities + * a map of related entities + */ + public void setRelatedEntities( + Map> relatedEntities) { + this.relatedEntities = relatedEntities; + } + + /** + * Get the primary filters + * + * @return the primary filters + */ + @XmlElement(name = "primaryfilters") + public Map getPrimaryFilters() { + return primaryFilters; + } + + /** + * Add a single piece of primary filter to the existing primary filter map + * + * @param key + * the primary filter key + * @param value + * the primary filter value + */ + public void addPrimaryFilter(String key, Object value) { + primaryFilters.put(key, value); + } + + /** + * Add a map of primary filters to the existing primary filter map + * + * @param primaryFilters + * a map of primary filters + */ + public void addPrimaryFilters(Map primaryFilters) { + this.primaryFilters.putAll(primaryFilters); + } + + /** + * Set the primary filter map to the given map of primary filters + * + * @param primaryFilters + * a map of primary filters + */ + public void setPrimaryFilters(Map primaryFilters) { + this.primaryFilters = primaryFilters; + } + + /** + * Get the other information of the entity + * + * @return the other information of the entity + */ + @XmlElement(name = "otherinfo") + public Map getOtherInfo() { + return otherInfo; + } + + /** + * Add one piece of other information of the entity to the existing other info + * map + * + * @param key + * the other information key + * @param value + * the other information value + */ + public void addOtherInfo(String key, Object value) { + this.otherInfo.put(key, value); + } + + /** + * Add a map of other information of the entity to the existing other info map + * + * @param otherInfo + * a map of other information + */ + public void addOtherInfo(Map otherInfo) { + this.otherInfo.putAll(otherInfo); + } + + /** + * Set the other info map to the given map of other information + * + * @param otherInfo + * a map of other information + */ + public void setOtherInfo(Map otherInfo) { + this.otherInfo = otherInfo; + } + + @Override + public int hashCode() { + // generated by eclipse + final int prime = 31; + int result = 1; + result = prime * result + ((entityId == null) ? 0 : entityId.hashCode()); + result = + prime * result + ((entityType == null) ? 0 : entityType.hashCode()); + result = prime * result + ((events == null) ? 0 : events.hashCode()); + result = prime * result + ((otherInfo == null) ? 0 : otherInfo.hashCode()); + result = + prime * result + + ((primaryFilters == null) ? 0 : primaryFilters.hashCode()); + result = + prime * result + + ((relatedEntities == null) ? 0 : relatedEntities.hashCode()); + result = prime * result + ((startTime == null) ? 0 : startTime.hashCode()); + return result; + } + + @Override + public boolean equals(Object obj) { + // generated by eclipse + if (this == obj) + return true; + if (obj == null) + return false; + if (getClass() != obj.getClass()) + return false; + Entity other = (Entity) obj; + if (entityId == null) { + if (other.entityId != null) + return false; + } else if (!entityId.equals(other.entityId)) + return false; + if (entityType == null) { + if (other.entityType != null) + return false; + } else if (!entityType.equals(other.entityType)) + return false; + if (events == null) { + if (other.events != null) + return false; + } else if (!events.equals(other.events)) + return false; + if (otherInfo == null) { + if (other.otherInfo != null) + return false; + } else if (!otherInfo.equals(other.otherInfo)) + return false; + if (primaryFilters == null) { + if (other.primaryFilters != null) + return false; + } else if (!primaryFilters.equals(other.primaryFilters)) + return false; + if (relatedEntities == null) { + if (other.relatedEntities != null) + return false; + } else if (!relatedEntities.equals(other.relatedEntities)) + return false; + if (startTime == null) { + if (other.startTime != null) + return false; + } else if (!startTime.equals(other.startTime)) + return false; + return true; + } + + @Override + public int compareTo(Entity other) { + int comparison = entityType.compareTo(other.entityType); + if (comparison == 0) { + long thisStartTime = + startTime == null ? Long.MIN_VALUE : startTime; + long otherStartTime = + other.startTime == null ? Long.MIN_VALUE : other.startTime; + if (thisStartTime > otherStartTime) { + return -1; + } else if (thisStartTime < otherStartTime) { + return 1; + } else { + return entityId.compareTo(other.entityId); + } + } else { + return comparison; + } + } + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Event.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Event.java new file mode 100644 index 0000000..ac45c83 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Event.java @@ -0,0 +1,172 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.api.records.apptimeline; + +import java.util.HashMap; +import java.util.Map; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; + +/** + * The class that contains the information of an event that is related to some + * conceptual entity of an application. Users are free to define what the event + * means, such as starting an application, getting allocated a container and + * etc. + */ +@XmlRootElement(name = "event") +@XmlAccessorType(XmlAccessType.NONE) +@Public +@Unstable +public class Event implements Comparable { + + private long timestamp; + private String eventType; + private Map eventInfo = new HashMap(); + + public Event() { + } + + /** + * Get the timestamp of the event + * + * @return the timestamp of the event + */ + @XmlElement(name = "timestamp") + public long getTimestamp() { + return timestamp; + } + + /** + * Set the timestamp of the event + * + * @param timestamp + * the timestamp of the event + */ + public void setTimestamp(long timestamp) { + this.timestamp = timestamp; + } + + /** + * Get the event type + * + * @return the event type + */ + @XmlElement(name = "eventtype") + public String getEventType() { + return eventType; + } + + /** + * Set the event type + * + * @param eventType + * the event type + */ + public void setEventType(String eventType) { + this.eventType = eventType; + } + + /** + * Set the information of the event + * + * @return the information of the event + */ + @XmlElement(name = "eventinfo") + public Map getEventInfo() { + return eventInfo; + } + + /** + * Add one piece of the information of the event to the existing information + * map + * + * @param key + * the information key + * @param value + * the information value + */ + public void addEventInfo(String key, Object value) { + this.eventInfo.put(key, value); + } + + /** + * Add a map of the information of the event to the existing information map + * + * @param eventInfo + * a map of of the information of the event + */ + public void addEventInfo(Map eventInfo) { + this.eventInfo.putAll(eventInfo); + } + + /** + * Set the information map to the given map of the information of the event + * + * @param eventInfo + * a map of of the information of the event + */ + public void setEventInfo(Map eventInfo) { + this.eventInfo = eventInfo; + } + + @Override + public int compareTo(Event other) { + if (timestamp > other.timestamp) { + return -1; + } else if (timestamp < other.timestamp) { + return 1; + } else { + return eventType.compareTo(other.eventType); + } + } + + @Override + public boolean equals(Object o) { + if (this == o) + return true; + if (o == null || getClass() != o.getClass()) + return false; + + Event event = (Event) o; + + if (timestamp != event.timestamp) + return false; + if (!eventType.equals(event.eventType)) + return false; + if (eventInfo != null ? !eventInfo.equals(event.eventInfo) : + event.eventInfo != null) + return false; + + return true; + } + + @Override + public int hashCode() { + int result = (int) (timestamp ^ (timestamp >>> 32)); + result = 31 * result + eventType.hashCode(); + result = 31 * result + (eventInfo != null ? eventInfo.hashCode() : 0); + return result; + } +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Events.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Events.java new file mode 100644 index 0000000..76688ea --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/Events.java @@ -0,0 +1,189 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.api.records.apptimeline; + +import java.util.ArrayList; +import java.util.List; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; + +/** + * The class that hosts a list of events, which are categorized according to + * their related entities. + */ +@XmlRootElement(name = "events") +@XmlAccessorType(XmlAccessType.NONE) +@Public +@Unstable +public class Events { + + private List allEvents = + new ArrayList(); + + public Events() { + + } + + /** + * Get a list of {@link EventsOfOneEntity} instances + * + * @return a list of {@link EventsOfOneEntity} instances + */ + @XmlElement(name = "events") + public List getAllEvents() { + return allEvents; + } + + /** + * Add a single {@link EventsOfOneEntity} instance into the existing list + * + * @param eventsOfOneEntity + * a single {@link EventsOfOneEntity} instance + */ + public void addEvent(EventsOfOneEntity eventsOfOneEntity) { + allEvents.add(eventsOfOneEntity); + } + + /** + * Add a list of {@link EventsOfOneEntity} instances into the existing list + * + * @param allEvents + * a list of {@link EventsOfOneEntity} instances + */ + public void addEvents(List allEvents) { + this.allEvents.addAll(allEvents); + } + + /** + * Set the list to the given list of {@link EventsOfOneEntity} instances + * + * @param allEvents + * a list of {@link EventsOfOneEntity} instances + */ + public void setEvents(List allEvents) { + this.allEvents.clear(); + this.allEvents.addAll(allEvents); + } + + /** + * The class that hosts a list of events that are only related to one entity. + */ + @XmlRootElement(name = "events") + @XmlAccessorType(XmlAccessType.NONE) + @Public + @Unstable + public static class EventsOfOneEntity { + + private String entityId; + private String entityType; + private List events = new ArrayList(); + + public EventsOfOneEntity() { + + } + + /** + * Get the entity Id + * + * @return the entity Id + */ + @XmlElement(name = "entity") + public String getEntityId() { + return entityId; + } + + /** + * Set the entity Id + * + * @param entityId + * the entity Id + */ + public void setEntityId(String entityId) { + this.entityId = entityId; + } + + /** + * Get the entity type + * + * @return the entity type + */ + @XmlElement(name = "entitytype") + public String getEntityType() { + return entityType; + } + + /** + * Set the entity type + * + * @param entityType + * the entity type + */ + public void setEntityType(String entityType) { + this.entityType = entityType; + } + + /** + * Get a list of events + * + * @return a list of events + */ + @XmlElement(name = "events") + public List getEvents() { + return events; + } + + /** + * Add a single event to the existing event list + * + * @param event + * a single event + */ + public void addEvent(Event event) { + events.add(event); + } + + /** + * Add a list of event to the existing event list + * + * @param events + * a list of events + */ + public void addEvents(List events) { + this.events.addAll(events); + } + + /** + * Set the event list to the given list of events + * + * @param events + * a list of events + */ + public void setEvents(List events) { + this.events = events; + } + + } + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/PutErrors.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/PutErrors.java new file mode 100644 index 0000000..9b77906 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/apptimeline/PutErrors.java @@ -0,0 +1,163 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.hadoop.yarn.api.records.apptimeline; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; +import java.util.ArrayList; +import java.util.List; + +/** + * A class that holds a list of put errors. This is the response returned + * when a list of {@link Entity} objects is added to the application + * timeline. If there are errors in storing individual entity objects, + * they will be indicated in the list of errors. + */ +@XmlRootElement(name = "errors") +@XmlAccessorType(XmlAccessType.NONE) +@Public +@Unstable +public class PutErrors { + + private List errors = new ArrayList(); + + public PutErrors() { + + } + + /** + * Get a list of {@link PutError} instances + * + * @return a list of {@link PutError} instances + */ + @XmlElement(name = "errors") + public List getErrors() { + return errors; + } + + /** + * Add a single {@link PutError} instance into the existing list + * + * @param error + * a single {@link PutError} instance + */ + public void addError(PutError error) { + errors.add(error); + } + + /** + * Add a list of {@link PutError} instances into the existing list + * + * @param errors + * a list of {@link PutError} instances + */ + public void addErrors(List errors) { + this.errors.addAll(errors); + } + + /** + * Set the list to the given list of {@link PutError} instances + * + * @param errors + * a list of {@link PutError} instances + */ + public void setErrors(List errors) { + this.errors.clear(); + this.errors.addAll(errors); + } + + /** + * A class that holds the error code for one entity. + */ + @XmlRootElement(name = "error") + @XmlAccessorType(XmlAccessType.NONE) + @Public + @Unstable + public static class PutError { + private String entityId; + private String entityType; + private Integer errorCode; + + /** + * Get the entity Id + * + * @return the entity Id + */ + @XmlElement(name = "entity") + public String getEntityId() { + return entityId; + } + + /** + * Set the entity Id + * + * @param entityId + * the entity Id + */ + public void setEntityId(String entityId) { + this.entityId = entityId; + } + + /** + * Get the entity type + * + * @return the entity type + */ + @XmlElement(name = "entitytype") + public String getEntityType() { + return entityType; + } + + /** + * Set the entity type + * + * @param entityType + * the entity type + */ + public void setEntityType(String entityType) { + this.entityType = entityType; + } + + /** + * Get the error code + * + * @return an error code + */ + @XmlElement(name = "errorcode") + public Integer getErrorCode() { + return errorCode; + } + + /** + * Set the error code to the given error code + * + * @param errorCode + * an error code + */ + public void setErrorCode(Integer errorCode) { + this.errorCode = errorCode; + } + + } + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml index 54da659..6091686 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/pom.xml @@ -79,6 +79,10 @@ org.mortbay.jetty jetty-util + + com.sun.jersey + jersey-client + diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/TimelineClient.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/TimelineClient.java new file mode 100644 index 0000000..9b3f195 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/TimelineClient.java @@ -0,0 +1,66 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.client.api; + +import java.io.IOException; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.service.AbstractService; +import org.apache.hadoop.yarn.api.records.apptimeline.Entity; +import org.apache.hadoop.yarn.client.api.impl.TimelineClientImpl; +import org.apache.hadoop.yarn.exceptions.YarnException; + +/** + * The client library that can be used to post the information of a number of + * conceptual entities of an application. + */ +@Public +@Unstable +public abstract class TimelineClient extends AbstractService { + + @Public + public static TimelineClient createTimelineClient() { + TimelineClient client = new TimelineClientImpl(); + return client; + } + + @Private + protected TimelineClient(String name) { + super(name); + } + + /** + *

+ * Post the information of a number of conceptual entities of an application + * to the application timeline server. It is a blocking API. The method will + * not return until it gets the response from the application timeline server. + *

+ * + * @param entities + * the collection of {@link Entity} + * @throws IOException + * @throws YarnException + */ + @Public + public abstract void postEntities( + Entity... entities) throws IOException, YarnException; + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java new file mode 100644 index 0000000..d9e8860 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineClientImpl.java @@ -0,0 +1,103 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.client.api.impl; + +import java.io.IOException; +import java.net.URI; +import java.util.Arrays; + +import javax.ws.rs.core.MediaType; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.http.HttpConfig; +import org.apache.hadoop.yarn.api.records.apptimeline.Entities; +import org.apache.hadoop.yarn.api.records.apptimeline.Entity; +import org.apache.hadoop.yarn.client.api.TimelineClient; +import org.apache.hadoop.yarn.conf.YarnConfiguration; +import org.apache.hadoop.yarn.exceptions.YarnException; +import org.apache.hadoop.yarn.webapp.YarnJacksonJaxbJsonProvider; + +import com.google.common.annotations.VisibleForTesting; +import com.google.common.base.Joiner; +import com.sun.jersey.api.client.Client; +import com.sun.jersey.api.client.ClientResponse; +import com.sun.jersey.api.client.WebResource; +import com.sun.jersey.api.client.config.ClientConfig; +import com.sun.jersey.api.client.config.DefaultClientConfig; + +@Private +@Unstable +public class TimelineClientImpl extends TimelineClient { + + private static final Log LOG = LogFactory.getLog(TimelineClientImpl.class); + private static final String RESOURCE_URI_STR = "/ws/v1/apptimeline/"; + private static final Joiner JOINER = Joiner.on(""); + + private Client client; + private URI resURI; + + public TimelineClientImpl() { + super(TimelineClientImpl.class.getName()); + ClientConfig cc = new DefaultClientConfig(); + cc.getClasses().add(YarnJacksonJaxbJsonProvider.class); + client = Client.create(cc); + } + + protected void serviceInit(Configuration conf) throws Exception { + resURI = new URI(JOINER.join(HttpConfig.getSchemePrefix(), + HttpConfig.isSecure() ? conf.get( + YarnConfiguration.AHS_WEBAPP_HTTPS_ADDRESS, + YarnConfiguration.DEFAULT_AHS_WEBAPP_HTTPS_ADDRESS) : conf.get( + YarnConfiguration.AHS_WEBAPP_ADDRESS, + YarnConfiguration.DEFAULT_AHS_WEBAPP_ADDRESS), RESOURCE_URI_STR)); + super.serviceInit(conf); + } + + @Override + public void postEntities( + Entity... entities) throws IOException, YarnException { + Entities entitiesContainer = new Entities(); + entitiesContainer.addEntities(Arrays.asList(entities)); + ClientResponse resp = doPostingEntities(entitiesContainer); + if (resp.getStatus() != ClientResponse.Status.OK.getStatusCode()) { + String msg = "Failed to post application timeline entities."; + LOG.error(msg); + if (LOG.isDebugEnabled()) { + String output = resp.getEntity(String.class); + LOG.debug("HTTP error code: " + resp.getStatus() + + " Server response : \n" + output); + } + throw new YarnException(msg); + } + } + + @Private + @VisibleForTesting + public ClientResponse doPostingEntities(Entities entities) { + WebResource webResource = client.resource(resURI); + return webResource.accept(MediaType.APPLICATION_JSON) + .type(MediaType.APPLICATION_JSON) + .post(ClientResponse.class, entities); + } + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClient.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClient.java new file mode 100644 index 0000000..3ac79c8 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-client/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClient.java @@ -0,0 +1,109 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.client.api.impl; + +import static org.mockito.Matchers.any; +import static org.mockito.Mockito.doReturn; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.spy; +import static org.mockito.Mockito.when; +import junit.framework.Assert; + +import org.apache.hadoop.yarn.api.records.apptimeline.Entities; +import org.apache.hadoop.yarn.api.records.apptimeline.Entity; +import org.apache.hadoop.yarn.api.records.apptimeline.Event; +import org.apache.hadoop.yarn.client.api.TimelineClient; +import org.apache.hadoop.yarn.conf.YarnConfiguration; +import org.apache.hadoop.yarn.exceptions.YarnException; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import com.sun.jersey.api.client.ClientResponse; + +public class TestTimelineClient { + + private TimelineClientImpl client; + + @Before + public void setup() { + client = spy((TimelineClientImpl) TimelineClient.createTimelineClient()); + client.init(new YarnConfiguration()); + client.start(); + } + + @After + public void tearDown() { + client.stop(); + } + + @Test + public void testPostEntities() throws Exception { + mockClientResponse(ClientResponse.Status.OK.getStatusCode()); + try { + client.postEntities(generateEntity()); + } catch (YarnException e) { + Assert.fail("Exception is not expected"); + } + } + + @Test + public void testPostEntitiesError() throws Exception { + mockClientResponse(ClientResponse.Status.INTERNAL_SERVER_ERROR + .getStatusCode()); + try { + client.postEntities(generateEntity()); + Assert.fail("Exception is expected"); + } catch (YarnException e) { + Assert.assertTrue(e.getMessage().contains( + "Failed to post application timeline entities.")); + } + } + + private ClientResponse mockClientResponse(int statusCode) { + ClientResponse response = mock(ClientResponse.class); + doReturn(response).when(client) + .doPostingEntities(any(Entities.class)); + when(response.getStatus()).thenReturn(statusCode); + return response; + } + + private static Entity generateEntity() { + Entity entity = new Entity(); + entity.setEntityId("entity id"); + entity.setEntityType("entity type"); + entity.setStartTime(System.currentTimeMillis()); + for (int i = 0; i < 2; ++i) { + Event event = new Event(); + event.setTimestamp(System.currentTimeMillis()); + event.setEventType("test event type " + i); + event.addEventInfo("key1", "val1"); + event.addEventInfo("key2", "val2"); + entity.addEvent(event); + } + entity.addRelatedEntity("test ref type 1", "test ref id 1"); + entity.addRelatedEntity("test ref type 2", "test ref id 2"); + entity.addPrimaryFilter("pkey1", "pval1"); + entity.addPrimaryFilter("pkey2", "pval2"); + entity.addOtherInfo("okey1", "oval1"); + entity.addOtherInfo("okey2", "oval2"); + return entity; + } + +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnJacksonJaxbJsonProvider.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnJacksonJaxbJsonProvider.java new file mode 100644 index 0000000..f0f1779 --- /dev/null +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/webapp/YarnJacksonJaxbJsonProvider.java @@ -0,0 +1,62 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.hadoop.yarn.webapp; + +import javax.ws.rs.core.MediaType; +import javax.ws.rs.ext.Provider; + +import org.apache.hadoop.classification.InterfaceAudience.Private; +import org.apache.hadoop.classification.InterfaceStability.Unstable; +import org.codehaus.jackson.jaxrs.JacksonJaxbJsonProvider; +import org.codehaus.jackson.map.AnnotationIntrospector; +import org.codehaus.jackson.map.ObjectMapper; +import org.codehaus.jackson.map.SerializationConfig.Feature; +import org.codehaus.jackson.map.annotate.JsonSerialize.Inclusion; +import org.codehaus.jackson.xc.JaxbAnnotationIntrospector; + +import com.google.inject.Singleton; + +/** + * YARN's implementation of JAX-RS abstractions based on + * {@link JacksonJaxbJsonProvider} needed for deserialize JSON content to or + * serialize it from POJO objects. + */ +@Singleton +@Provider +@Unstable +@Private +public class YarnJacksonJaxbJsonProvider extends JacksonJaxbJsonProvider { + + public YarnJacksonJaxbJsonProvider() { + super(); + } + + @Override + public ObjectMapper locateMapper(Class type, MediaType mediaType) { + ObjectMapper mapper = super.locateMapper(type, mediaType); + mapper.configure(Feature.WRAP_ROOT_VALUE, true); + AnnotationIntrospector introspector = new JaxbAnnotationIntrospector(); + // TODO: change to use non-deprecated methods + mapper.setAnnotationIntrospector(introspector); + mapper.setAnnotationIntrospector(introspector); + mapper.getSerializationConfig() + .setSerializationInclusion(Inclusion.NON_NULL); + return mapper; + } +} diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/apptimeline/TestApplicationTimelineRecords.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/apptimeline/TestApplicationTimelineRecords.java index f2a6d3e..0b69827 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/apptimeline/TestApplicationTimelineRecords.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/api/records/apptimeline/TestApplicationTimelineRecords.java @@ -19,26 +19,25 @@ package org.apache.hadoop.yarn.api.records.apptimeline; import java.util.ArrayList; -import java.util.Arrays; import java.util.List; import junit.framework.Assert; -import org.apache.hadoop.yarn.api.records.apptimeline.ATSPutErrors.ATSPutError; +import org.apache.hadoop.yarn.api.records.apptimeline.PutErrors.PutError; import org.junit.Test; public class TestApplicationTimelineRecords { @Test - public void testATSEntities() { - ATSEntities entities = new ATSEntities(); + public void testEntities() { + Entities entities = new Entities(); for (int j = 0; j < 2; ++j) { - ATSEntity entity = new ATSEntity(); + Entity entity = new Entity(); entity.setEntityId("entity id " + j); entity.setEntityType("entity type " + j); entity.setStartTime(System.currentTimeMillis()); for (int i = 0; i < 2; ++i) { - ATSEvent event = new ATSEvent(); + Event event = new Event(); event.setTimestamp(System.currentTimeMillis()); event.setEventType("event type " + i); event.addEventInfo("key1", "val1"); @@ -54,14 +53,14 @@ public void testATSEntities() { entities.addEntity(entity); } Assert.assertEquals(2, entities.getEntities().size()); - ATSEntity entity1 = entities.getEntities().get(0); + Entity entity1 = entities.getEntities().get(0); Assert.assertEquals("entity id 0", entity1.getEntityId()); Assert.assertEquals("entity type 0", entity1.getEntityType()); Assert.assertEquals(2, entity1.getRelatedEntities().size()); Assert.assertEquals(2, entity1.getEvents().size()); Assert.assertEquals(2, entity1.getPrimaryFilters().size()); Assert.assertEquals(2, entity1.getOtherInfo().size()); - ATSEntity entity2 = entities.getEntities().get(1); + Entity entity2 = entities.getEntities().get(1); Assert.assertEquals("entity id 1", entity2.getEntityId()); Assert.assertEquals("entity type 1", entity2.getEntityType()); Assert.assertEquals(2, entity2.getRelatedEntities().size()); @@ -71,15 +70,15 @@ public void testATSEntities() { } @Test - public void testATSEvents() { - ATSEvents events = new ATSEvents(); + public void testEvents() { + Events events = new Events(); for (int j = 0; j < 2; ++j) { - ATSEvents.ATSEventsOfOneEntity partEvents = - new ATSEvents.ATSEventsOfOneEntity(); + Events.EventsOfOneEntity partEvents = + new Events.EventsOfOneEntity(); partEvents.setEntityId("entity id " + j); partEvents.setEntityType("entity type " + j); for (int i = 0; i < 2; ++i) { - ATSEvent event = new ATSEvent(); + Event event = new Event(); event.setTimestamp(System.currentTimeMillis()); event.setEventType("event type " + i); event.addEventInfo("key1", "val1"); @@ -89,55 +88,55 @@ public void testATSEvents() { events.addEvent(partEvents); } Assert.assertEquals(2, events.getAllEvents().size()); - ATSEvents.ATSEventsOfOneEntity partEvents1 = events.getAllEvents().get(0); + Events.EventsOfOneEntity partEvents1 = events.getAllEvents().get(0); Assert.assertEquals("entity id 0", partEvents1.getEntityId()); Assert.assertEquals("entity type 0", partEvents1.getEntityType()); Assert.assertEquals(2, partEvents1.getEvents().size()); - ATSEvent event11 = partEvents1.getEvents().get(0); + Event event11 = partEvents1.getEvents().get(0); Assert.assertEquals("event type 0", event11.getEventType()); Assert.assertEquals(2, event11.getEventInfo().size()); - ATSEvent event12 = partEvents1.getEvents().get(1); + Event event12 = partEvents1.getEvents().get(1); Assert.assertEquals("event type 1", event12.getEventType()); Assert.assertEquals(2, event12.getEventInfo().size()); - ATSEvents.ATSEventsOfOneEntity partEvents2 = events.getAllEvents().get(1); + Events.EventsOfOneEntity partEvents2 = events.getAllEvents().get(1); Assert.assertEquals("entity id 1", partEvents2.getEntityId()); Assert.assertEquals("entity type 1", partEvents2.getEntityType()); Assert.assertEquals(2, partEvents2.getEvents().size()); - ATSEvent event21 = partEvents2.getEvents().get(0); + Event event21 = partEvents2.getEvents().get(0); Assert.assertEquals("event type 0", event21.getEventType()); Assert.assertEquals(2, event21.getEventInfo().size()); - ATSEvent event22 = partEvents2.getEvents().get(1); + Event event22 = partEvents2.getEvents().get(1); Assert.assertEquals("event type 1", event22.getEventType()); Assert.assertEquals(2, event22.getEventInfo().size()); } @Test - public void testATSPutErrors() { - ATSPutErrors atsPutErrors = new ATSPutErrors(); - ATSPutError error1 = new ATSPutError(); + public void testPutErrors() { + PutErrors putErrors = new PutErrors(); + PutError error1 = new PutError(); error1.setEntityId("entity id 1"); error1.setEntityId("entity type 1"); error1.setErrorCode(1); - atsPutErrors.addError(error1); - List errors = new ArrayList(); + putErrors.addError(error1); + List errors = new ArrayList(); errors.add(error1); - ATSPutError error2 = new ATSPutError(); + PutError error2 = new PutError(); error2.setEntityId("entity id 2"); error2.setEntityId("entity type 2"); error2.setErrorCode(2); errors.add(error2); - atsPutErrors.addErrors(errors); + putErrors.addErrors(errors); - Assert.assertEquals(3, atsPutErrors.getErrors().size()); - ATSPutError e = atsPutErrors.getErrors().get(0); + Assert.assertEquals(3, putErrors.getErrors().size()); + PutError e = putErrors.getErrors().get(0); Assert.assertEquals(error1.getEntityId(), e.getEntityId()); Assert.assertEquals(error1.getEntityType(), e.getEntityType()); Assert.assertEquals(error1.getErrorCode(), e.getErrorCode()); - e = atsPutErrors.getErrors().get(1); + e = putErrors.getErrors().get(1); Assert.assertEquals(error1.getEntityId(), e.getEntityId()); Assert.assertEquals(error1.getEntityType(), e.getEntityType()); Assert.assertEquals(error1.getErrorCode(), e.getErrorCode()); - e = atsPutErrors.getErrors().get(2); + e = putErrors.getErrors().get(2); Assert.assertEquals(error2.getEntityId(), e.getEntityId()); Assert.assertEquals(error2.getEntityType(), e.getEntityType()); Assert.assertEquals(error2.getErrorCode(), e.getErrorCode()); diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/ApplicationTimelineReader.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/ApplicationTimelineReader.java index 97a217d..bc13bb6 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/ApplicationTimelineReader.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/ApplicationTimelineReader.java @@ -25,9 +25,9 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.yarn.api.records.apptimeline.ATSEntities; -import org.apache.hadoop.yarn.api.records.apptimeline.ATSEntity; -import org.apache.hadoop.yarn.api.records.apptimeline.ATSEvents; +import org.apache.hadoop.yarn.api.records.apptimeline.Entities; +import org.apache.hadoop.yarn.api.records.apptimeline.Entity; +import org.apache.hadoop.yarn.api.records.apptimeline.Events; /** * This interface is for retrieving application timeline information. @@ -54,8 +54,9 @@ final long DEFAULT_LIMIT = 100; /** - * This method retrieves a list of entity information, {@link ATSEntity}, - * sorted by the starting timestamp for the entity, descending. + * This method retrieves a list of entity information, {@link Entity}, + * sorted by the starting timestamp for the entity in descending order and + * entity id in alphabetical order. * * @param entityType The type of entities to return (required). * @param limit A limit on the number of entities to return. If null, @@ -79,9 +80,9 @@ * contains {@link Field#LAST_EVENT_ONLY} and not * {@link Field#EVENTS}, the most recent event for * each entity is retrieved. - * @return An {@link ATSEntities} object. + * @return An {@link Entities} object. */ - ATSEntities getEntities(String entityType, + Entities getEntities(String entityType, Long limit, Long windowStart, Long windowEnd, NameValuePair primaryFilter, Collection secondaryFilters, EnumSet fieldsToRetrieve); @@ -96,15 +97,15 @@ ATSEntities getEntities(String entityType, * fields contains {@link Field#LAST_EVENT_ONLY} and * not {@link Field#EVENTS}, the most recent event * for each entity is retrieved. - * @return An {@link ATSEntity} object. + * @return An {@link Entity} object. */ - ATSEntity getEntity(String entity, String entityType, EnumSet + Entity getEntity(String entity, String entityType, EnumSet fieldsToRetrieve); /** * This method retrieves the events for a list of entities all of the same * entity type. The events for each entity are sorted in order of their - * timestamps, descending. + * timestamps in descending order and their event type in alphabetical order. * * @param entityType The type of entities to retrieve events for. * @param entityIds The entity IDs to retrieve events for. @@ -117,9 +118,9 @@ ATSEntity getEntity(String entity, String entityType, EnumSet * given time (inclusive) * @param eventTypes Restricts the events returned to the given types. If * null, events of all types will be returned. - * @return An {@link ATSEvents} object. + * @return An {@link Events} object. */ - ATSEvents getEntityTimelines(String entityType, + Events getEntityTimelines(String entityType, SortedSet entityIds, Long limit, Long windowStart, Long windowEnd, Set eventTypes); } diff --git hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/ApplicationTimelineWriter.java hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/ApplicationTimelineWriter.java index b7bd070..86fa20d 100644 --- hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/ApplicationTimelineWriter.java +++ hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-applicationhistoryservice/src/main/java/org/apache/hadoop/yarn/server/applicationhistoryservice/apptimeline/ApplicationTimelineWriter.java @@ -20,8 +20,8 @@ import org.apache.hadoop.classification.InterfaceAudience; import org.apache.hadoop.classification.InterfaceStability; -import org.apache.hadoop.yarn.api.records.apptimeline.ATSEntities; -import org.apache.hadoop.yarn.api.records.apptimeline.ATSPutErrors; +import org.apache.hadoop.yarn.api.records.apptimeline.Entities; +import org.apache.hadoop.yarn.api.records.apptimeline.PutErrors; /** * This interface is for storing application timeline information. @@ -35,9 +35,9 @@ * occurring for individual put request objects will be reported in the * response. * - * @param data An {@link ATSEntities} object. - * @return An {@link ATSPutErrors} object. + * @param data An {@link Entities} object. + * @return An {@link PutErrors} object. */ - ATSPutErrors put(ATSEntities data); + PutErrors put(Entities data); }