From 0e4691be221852804263cc41abfc4dc974ad1c3c Mon Sep 17 00:00:00 2001 From: Rohith Sharma K S Date: Thu, 22 Feb 2018 16:40:59 +0530 Subject: [PATCH] YARN-7933 --- .../records/timelineservice/TimelineDomain.java | 194 +++++++++++++++++++++ .../records/timelineservice/TimelineEntity.java | 22 +++ .../hadoop/yarn/client/api/TimelineV2Client.java | 15 ++ .../yarn/client/api/impl/TimelineV2ClientImpl.java | 9 + .../client/api/impl/TestTimelineClientV2Impl.java | 64 ++++++- .../storage/HBaseTimelineWriterImpl.java | 8 + .../collector/TimelineCollector.java | 32 ++++ .../collector/TimelineCollectorWebService.java | 49 ++++++ .../storage/FileSystemTimelineWriterImpl.java | 8 + .../timelineservice/storage/TimelineWriter.java | 16 ++ 10 files changed, 416 insertions(+), 1 deletion(-) create mode 100644 hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/TimelineDomain.java diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/TimelineDomain.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/TimelineDomain.java new file mode 100644 index 00000000000..e3524b94b3f --- /dev/null +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/TimelineDomain.java @@ -0,0 +1,194 @@ +/** + * 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.timelineservice; + +import org.apache.hadoop.classification.InterfaceAudience.Public; +import org.apache.hadoop.classification.InterfaceStability.Evolving; + +import javax.xml.bind.annotation.XmlAccessType; +import javax.xml.bind.annotation.XmlAccessorType; +import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlRootElement; + +/** + *

+ * This class contains the information about a timeline service domain, which is + * used to a user to host a number of timeline entities, isolating them from + * others'. The user can also define the reader and writer users/groups for + * the domain, which is used to control the access to its entities. + *

+ * + *

+ * The reader and writer users/groups pattern that the user can supply is the + * same as what AccessControlList takes. + *

+ * + */ +@XmlRootElement(name = "domain") +@XmlAccessorType(XmlAccessType.NONE) +@Public +@Evolving +public class TimelineDomain { + + private String id; + private String description; + private String owner; + private String readers; + private String writers; + private Long createdTime; + private Long modifiedTime; + + public TimelineDomain() { + } + + /** + * Get the domain ID + * + * @return the domain ID + */ + @XmlElement(name = "id") + public String getId() { + return id; + } + + /** + * Set the domain ID + * + * @param id the domain ID + */ + public void setId(String id) { + this.id = id; + } + + /** + * Get the domain description + * + * @return the domain description + */ + @XmlElement(name = "description") + public String getDescription() { + return description; + } + + /** + * Set the domain description + * + * @param description the domain description + */ + public void setDescription(String description) { + this.description = description; + } + + /** + * Get the domain owner + * + * @return the domain owner + */ + @XmlElement(name = "owner") + public String getOwner() { + return owner; + } + + /** + * Set the domain owner. The user doesn't need to set it, which will + * automatically set to the user who puts the domain. + * + * @param owner the domain owner + */ + public void setOwner(String owner) { + this.owner = owner; + } + + /** + * Get the reader (and/or reader group) list string + * + * @return the reader (and/or reader group) list string + */ + @XmlElement(name = "readers") + public String getReaders() { + return readers; + } + + /** + * Set the reader (and/or reader group) list string + * + * @param readers the reader (and/or reader group) list string + */ + public void setReaders(String readers) { + this.readers = readers; + } + + /** + * Get the writer (and/or writer group) list string + * + * @return the writer (and/or writer group) list string + */ + @XmlElement(name = "writers") + public String getWriters() { + return writers; + } + + /** + * Set the writer (and/or writer group) list string + * + * @param writers the writer (and/or writer group) list string + */ + public void setWriters(String writers) { + this.writers = writers; + } + + /** + * Get the created time of the domain + * + * @return the created time of the domain + */ + @XmlElement(name = "createdtime") + public Long getCreatedTime() { + return createdTime; + } + + /** + * Set the created time of the domain + * + * @param createdTime the created time of the domain + */ + public void setCreatedTime(Long createdTime) { + this.createdTime = createdTime; + } + + /** + * Get the modified time of the domain + * + * @return the modified time of the domain + */ + @XmlElement(name = "modifiedtime") + public Long getModifiedTime() { + return modifiedTime; + } + + /** + * Set the modified time of the domain + * + * @param modifiedTime the modified time of the domain + */ + public void setModifiedTime(Long modifiedTime) { + this.modifiedTime = modifiedTime; + } + +} diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/TimelineEntity.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/TimelineEntity.java index 0af5ea47694..5ec242d1180 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/TimelineEntity.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-api/src/main/java/org/apache/hadoop/yarn/api/records/timelineservice/TimelineEntity.java @@ -148,6 +148,7 @@ public boolean equals(Object obj) { private HashMap> relatesToEntities = new HashMap<>(); private Long createdTime; private long idPrefix; + private String domainId; public TimelineEntity() { identifier = new Identifier(); @@ -608,4 +609,25 @@ public void setIdPrefix(long entityIdPrefix) { real.setIdPrefix(entityIdPrefix); } } + + /** + * Get the ID of the domain that the entity is to be put + * + * @return the domain ID + */ + @XmlElement(name = "domain") + public String getDomainId() { + return domainId; + } + + /** + * Set the ID of the domain that the entity is to be put + * + * @param domainId + * the name space ID + */ + @JsonSetter("domain") + public void setDomainId(String domainId) { + this.domainId = domainId; + } } \ No newline at end of file diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/TimelineV2Client.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/TimelineV2Client.java index 423c059319c..06cbdebbec2 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/TimelineV2Client.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/TimelineV2Client.java @@ -24,6 +24,7 @@ import org.apache.hadoop.service.CompositeService; import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.CollectorInfo; +import org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity; import org.apache.hadoop.yarn.client.api.impl.TimelineV2ClientImpl; import org.apache.hadoop.yarn.exceptions.YarnException; @@ -93,4 +94,18 @@ public abstract void putEntitiesAsync(TimelineEntity... entities) * address and timeline delegation token. */ public abstract void setTimelineCollectorInfo(CollectorInfo collectorInfo); + + /** + *

+ * Send the information of a domain to the timeline server. It is a + * blocking API. The method will not return until it gets the response from + * the timeline server. + *

+ * + * @param domain an {@link TimelineDomain} object + * @throws IOException + * @throws YarnException + */ + @Public public abstract void putDomain(TimelineDomain domain) + throws IOException, YarnException; } diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineV2ClientImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineV2ClientImpl.java index 02c9519d9be..1a82f22921c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineV2ClientImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/main/java/org/apache/hadoop/yarn/client/api/impl/TimelineV2ClientImpl.java @@ -48,6 +48,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.CollectorInfo; import org.apache.hadoop.yarn.api.records.Token; +import org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity; import org.apache.hadoop.yarn.client.api.TimelineV2Client; @@ -173,6 +174,14 @@ public void setTimelineCollectorInfo(CollectorInfo collectorInfo) { } } + @Override + public void putDomain(TimelineDomain domain) + throws IOException, YarnException { + MultivaluedMap params = new MultivaluedMapImpl(); + params.add("appid", getContextAppId().toString()); + putObjects("domain",params , domain); + } + private void setTimelineDelegationToken(Token delegationToken, String collectorAddr) { // Checks below are to ensure that an invalid token is not updated in UGI. diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClientV2Impl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClientV2Impl.java index 95595a9f4c4..e42da86c003 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClientV2Impl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-common/src/test/java/org/apache/hadoop/yarn/client/api/impl/TestTimelineClientV2Impl.java @@ -37,6 +37,7 @@ import org.apache.hadoop.yarn.api.records.ApplicationId; import org.apache.hadoop.yarn.api.records.CollectorInfo; import org.apache.hadoop.yarn.api.records.Token; +import org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity; import org.apache.hadoop.yarn.conf.YarnConfiguration; @@ -114,6 +115,7 @@ protected void putObjects(URI base, String path, private boolean sleepBeforeReturn; private List publishedEntities; + private TimelineDomain timelineDomain; public TimelineEntities getPublishedEntities(int putIndex) { Assert.assertTrue("Not So many entities Published", @@ -129,6 +131,10 @@ public int getNumOfTimelineEntitiesPublished() { return publishedEntities.size(); } + public TimelineDomain getPublishedTimelineDomain() { + return timelineDomain; + } + public TestV2TimelineClient(ApplicationId id) { super(id); publishedEntities = new ArrayList(); @@ -140,7 +146,11 @@ protected void putObjects(String path, if (isThrowYarnException()) { throw new YarnException("ActualException"); } - publishedEntities.add((TimelineEntities) obj); + if (path.equals("domain")) { + timelineDomain = (TimelineDomain) obj; + } else { + publishedEntities.add((TimelineEntities) obj); + } if (sleepBeforeReturn) { try { Thread.sleep(TIME_TO_SLEEP); @@ -230,6 +240,38 @@ public void testASyncCallMerge() throws Exception { } @Test + public void testPutDomain() throws Exception { + try { + TimelineDomain domainSent = + generateDomain("id", "desc", "owner", "reader1,reader2", "writer", 0L, + 1L); + client.putDomain(domainSent); + client.putEntities(generateEntity("1", domainSent.getId())); + + TimelineDomain domainPublished = client.getPublishedTimelineDomain(); + Assert.assertEquals(domainSent.getId(), domainPublished.getId()); + Assert.assertEquals(domainSent.getDescription(), + domainPublished.getDescription()); + Assert.assertEquals(domainSent.getOwner(), domainPublished.getOwner()); + Assert + .assertEquals(domainSent.getReaders(), domainPublished.getReaders()); + Assert + .assertEquals(domainSent.getWriters(), domainPublished.getWriters()); + Assert.assertEquals(domainSent.getCreatedTime(), + domainPublished.getCreatedTime()); + Assert.assertEquals(domainSent.getModifiedTime(), + domainPublished.getModifiedTime()); + + List entities = + client.getPublishedEntities(0).getEntities(); + Assert.assertEquals(1, entities.size()); + Assert.assertEquals(domainSent.getId(), entities.get(0).getDomainId()); + } catch (YarnException e) { + Assert.fail("Exception is not expected"); + } + } + + @Test public void testSyncCall() throws Exception { try { // sync entity should not be be merged with Async @@ -416,13 +458,33 @@ private void printReceivedEntities() { } private static TimelineEntity generateEntity(String id) { + return generateEntity(id, null); + } + + private static TimelineEntity generateEntity(String id, String domain) { TimelineEntity entity = new TimelineEntity(); entity.setId(id); entity.setType("testEntity"); entity.setCreatedTime(System.currentTimeMillis()); + if (domain != null) { + entity.setDomainId(domain); + } return entity; } + private static TimelineDomain generateDomain(String id, String desc, + String owner, String reader, String writer, Long cTime, Long mTime) { + TimelineDomain domain = new TimelineDomain(); + domain.setId(id); + domain.setDescription(desc); + domain.setOwner(owner); + domain.setReaders(reader); + domain.setWriters(writer); + domain.setCreatedTime(cTime); + domain.setModifiedTime(mTime); + return domain; + } + @After public void tearDown() { if (client != null) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/hadoop-yarn-server-timelineservice-hbase-client/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/hadoop-yarn-server-timelineservice-hbase-client/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java index 027505b5601..b5644334289 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/hadoop-yarn-server-timelineservice-hbase-client/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice-hbase/hadoop-yarn-server-timelineservice-hbase-client/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/HBaseTimelineWriterImpl.java @@ -29,6 +29,7 @@ import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.service.AbstractService; import org.apache.hadoop.yarn.api.records.timelineservice.ApplicationEntity; +import org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEvent; @@ -230,6 +231,13 @@ public TimelineWriteResponse write(TimelineCollectorContext context, return putStatus; } + @Override + public TimelineWriteResponse write(TimelineCollectorContext context, + TimelineDomain domain, UserGroupInformation callerUgi) + throws IOException { + return null; + } + private void onApplicationCreated(FlowRunRowKey flowRunRowKey, String clusterId, String appId, String userId, String flowVersion, TimelineEntity te, long appCreatedTimeStamp) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollector.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollector.java index 8202431459d..9987ac382e5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollector.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollector.java @@ -31,6 +31,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.service.CompositeService; +import org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineMetricOperation; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity; @@ -153,6 +154,37 @@ public TimelineWriteResponse putEntities(TimelineEntities entities, return response; } + /** + * Add or update an domain. If the domain already exists, only the owner + * and the admin can update it. + * + * @param domain domain to post + * @param callerUgi the caller UGI + * @return the response that contains the result of the post. + * @throws IOException if there is any exception encountered while putting + * domain. + */ + public TimelineWriteResponse putDomain(TimelineDomain domain, + UserGroupInformation callerUgi) throws IOException { + if (LOG.isDebugEnabled()) { + LOG.debug( + "putDomain(domain=" + domain + ", callerUgi=" + callerUgi + ")"); + } + + TimelineWriteResponse response = new TimelineWriteResponse(); + synchronized (writer) { + final TimelineCollectorContext context = getTimelineEntityContext(); + /** + * TODO Before writing domain, check for existence of domain. If it exist + * already then ACLs need to be checked. + */ + response = writer.write(context, domain, callerUgi); + flushBufferedTimelineEntities(); + } + + return response; + } + private TimelineWriteResponse writeTimelineEntities( TimelineEntities entities, UserGroupInformation callerUgi) throws IOException { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java index efb5d6bf04c..ce576bbb853 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/collector/TimelineCollectorWebService.java @@ -48,6 +48,7 @@ import org.apache.hadoop.yarn.api.records.timelineservice.ContainerEntity; import org.apache.hadoop.yarn.api.records.timelineservice.FlowRunEntity; import org.apache.hadoop.yarn.api.records.timelineservice.QueueEntity; +import org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntityType; @@ -182,6 +183,54 @@ public Response putEntities( } } + /** + * @param req Servlet request. + * @param res Servlet response. + * @param domain timeline domain to be put. + * @param appId Application Id to which the domain to be put belong to. If + * appId is not there or it cannot be parsed, HTTP 400 will be sent back. + * @return a Response with appropriate HTTP status. + */ + @PUT @Path("/domain") + @Consumes({ MediaType.APPLICATION_JSON /* , MediaType.APPLICATION_XML */ }) + public Response putDomain( + @Context HttpServletRequest req, + @Context HttpServletResponse res, + @QueryParam("appid") String appId, + TimelineDomain domain) { + init(res); + UserGroupInformation callerUgi = getUser(req); + if (callerUgi == null) { + String msg = "The owner of the posted timeline entities is not set"; + LOG.error(msg); + throw new ForbiddenException(msg); + } + + try { + ApplicationId appID = parseApplicationId(appId); + if (appID == null) { + return Response.status(Response.Status.BAD_REQUEST).build(); + } + NodeTimelineCollectorManager collectorManager = + (NodeTimelineCollectorManager) context.getAttribute( + NodeTimelineCollectorManager.COLLECTOR_MANAGER_ATTR_KEY); + TimelineCollector collector = collectorManager.get(appID); + if (collector == null) { + LOG.error("Application: " + appId + " is not found"); + throw new NotFoundException(); // different exception? + } + + domain.setOwner(callerUgi.getShortUserName()); + collector.putDomain(domain, callerUgi); + + return Response.ok().build(); + } catch (Exception e) { + LOG.error("Error putting entities", e); + throw new WebApplicationException(e, + Response.Status.INTERNAL_SERVER_ERROR); + } + } + private static ApplicationId parseApplicationId(String appId) { try { if (appId != null) { diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java index ee4197000bf..f07f3d458d5 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/FileSystemTimelineWriterImpl.java @@ -30,6 +30,7 @@ import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.service.AbstractService; +import org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineWriteResponse; @@ -88,6 +89,13 @@ public TimelineWriteResponse write(TimelineCollectorContext context, return response; } + @Override + public TimelineWriteResponse write(TimelineCollectorContext context, + TimelineDomain domain, UserGroupInformation callerUgi) + throws IOException { + return null; + } + private synchronized void write(String clusterId, String userId, String flowName, String flowVersion, long flowRun, String appId, TimelineEntity entity, TimelineWriteResponse response) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/TimelineWriter.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/TimelineWriter.java index 12bc1cb3f0e..5220c80a592 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/TimelineWriter.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-timelineservice/src/main/java/org/apache/hadoop/yarn/server/timelineservice/storage/TimelineWriter.java @@ -23,6 +23,7 @@ import org.apache.hadoop.classification.InterfaceStability; import org.apache.hadoop.security.UserGroupInformation; import org.apache.hadoop.service.Service; +import org.apache.hadoop.yarn.api.records.timelineservice.TimelineDomain; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntities; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineEntity; import org.apache.hadoop.yarn.api.records.timelineservice.TimelineWriteResponse; @@ -51,6 +52,21 @@ TimelineWriteResponse write(TimelineCollectorContext context, TimelineEntities data, UserGroupInformation callerUgi) throws IOException; /** + * Stores {@link TimelineDomain} object to the timeline + * store. Any errors occurring for individual write request objects will be + * reported in the response. + * + * @param context a {@link TimelineCollectorContext} + * @param domain a {@link TimelineDomain} object. + * @param callerUgi {@link UserGroupInformation}. + * @return a {@link TimelineWriteResponse} object. + * @throws IOException if there is any exception encountered while storing or + * writing entities to the back end storage. + */ + TimelineWriteResponse write(TimelineCollectorContext context, + TimelineDomain domain, UserGroupInformation callerUgi) throws IOException; + + /** * Aggregates the entity information to the timeline store based on which * track this entity is to be rolled up to The tracks along which aggregations * are to be done are given by {@link TimelineAggregationTrack} -- 2.13.6 (Apple Git-96)