Return-Path: X-Original-To: apmail-giraph-user-archive@www.apache.org Delivered-To: apmail-giraph-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 409B617F88 for ; Thu, 2 Oct 2014 20:12:33 +0000 (UTC) Received: (qmail 21703 invoked by uid 500); 2 Oct 2014 20:12:32 -0000 Delivered-To: apmail-giraph-user-archive@giraph.apache.org Received: (qmail 21653 invoked by uid 500); 2 Oct 2014 20:12:32 -0000 Mailing-List: contact user-help@giraph.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@giraph.apache.org Delivered-To: mailing list user@giraph.apache.org Received: (qmail 21643 invoked by uid 99); 2 Oct 2014 20:12:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Oct 2014 20:12:32 +0000 X-ASF-Spam-Status: No, hits=1.5 required=5.0 tests=HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of charith.dhanushka@gmail.com designates 209.85.218.48 as permitted sender) Received: from [209.85.218.48] (HELO mail-oi0-f48.google.com) (209.85.218.48) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 02 Oct 2014 20:12:28 +0000 Received: by mail-oi0-f48.google.com with SMTP id g201so2435902oib.7 for ; Thu, 02 Oct 2014 13:12:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=gagllj/9HuTm2HRFuKcxo72tpr9XNIrI6ajzZwJT3PM=; b=jFz0lkdPYB/iMWT85w47yLEmIACKylP4KTL9NFqksNA+zxfTOY6maixZnS6K1XtQBy 4hm7brbMZiODSxzyDxWxhHHO0PuCElLozuh1YEuWT9sPdczxMETDpJPE5q9Ho1YLNLA9 Z61/IjWmUs5s4bu4htWOxydv8zsN4GRxJuHw03d7R3GbBychwAGubySD9i3n2XxYMCkU wxuY8xhpgDsxUBigAuelAziUINbKXJV17re24Bdt3dXfO2PJ9jLoqHuhL1COwCvuDw9y n27PmA9MkFImxtfagbukHpjHAzs+r3jnLw3kY6Ey6+wo7m0uSyt5vAcdTGyw4YvuvkZ9 kXfA== MIME-Version: 1.0 X-Received: by 10.182.20.146 with SMTP id n18mr1591291obe.26.1412280728038; Thu, 02 Oct 2014 13:12:08 -0700 (PDT) Received: by 10.202.71.23 with HTTP; Thu, 2 Oct 2014 13:12:07 -0700 (PDT) In-Reply-To: References: Date: Thu, 2 Oct 2014 13:12:07 -0700 Message-ID: Subject: Re: Using a custom graph partitioning stratergy with giraph From: Charith Wickramarachchi To: user Content-Type: multipart/mixed; boundary=e89a8f83a13f1f0ff60504763be1 X-Virus-Checked: Checked by ClamAV on apache.org --e89a8f83a13f1f0ff60504763be1 Content-Type: multipart/alternative; boundary=e89a8f83a13f1f0ff20504763bdf --e89a8f83a13f1f0ff20504763bdf Content-Type: text/plain; charset=UTF-8 Hi Pavan, Thanks a lot. That will be great. Based on your inputs I wrote an implementation to support my scenario. Which include writing a mapping input format. But I am not clear how to get input into this mapping input format.(How to specify an input path for a MappingInputformat). I looked into ConfigurationUtils but It did not have any option to do that. It will be great if you could give me some input on how to handle this matter. I am attaching my mapping input format just in case that is helpful. Thanks, Charith On Wed, Oct 1, 2014 at 7:42 PM, Pavan Kumar A wrote: > I will write a detailed explanation in weekend. thanks for your interest. > > ------------------------------ > Date: Wed, 1 Oct 2014 10:56:16 -0700 > > Subject: Re: Using a custom graph partitioning stratergy with giraph > From: charith.dhanushka@gmail.com > To: user@giraph.apache.org > > Thanks Pavan, > > I get the high level level idea. I am still new to Giraph code base so I > am still trying to understand the overall design. > > So I have few questions regarding this feature. > > Can we use this feature with a vertex input format without using edge > translation? > (Since getPartition in MappingStoreOps can be used to get the > partition of any target vertex) > > Also, since I have mapping information in a separate file do I need to > embed target information in the vertex? > > It will be great if you could explain your scenario with dataformat you > used and what extension points you used so that I can understand it better > and adapt to my scenario. > > > Thanks, > Charith > > > > > On Mon, Sep 29, 2014 at 3:34 PM, Pavan Kumar A > wrote: > > we have two inputs - vertex & edges > if we partition edges vertices based on a map, then when we want to send > messages we should be able to know which partition a vertex is on. > > typically we send messages to targetIds of outgoing edges, edge transation > helps encode mapping information into targetIds, so knowing which partition > to send a message can be done by just looking at the targetid > ------------------------------ > Date: Mon, 29 Sep 2014 14:37:22 -0700 > > Subject: Re: Using a custom graph partitioning stratergy with giraph > From: charith.dhanushka@gmail.com > To: user@giraph.apache.org > > Hi Pavan, > > Thanks for the details. I went through the code specially the > extension points you mentioned. > I am not clear about the function of the edge Translation (org.apache. > giraph.mapping.translate.TranslateEdge) class. Could you please explain > the idea of this translation process. > > In my case I will have a mapping file which maps each vertex to a > partition. > > ex: > > v1 part1 > v2 part2 > v3 part3 > . > . > . > > So I was thinking of passing this as a parameter and reading inside my own > MappingStore Implementation > -Dgiraph.mappingFilePath=/user/charith/input/mapping.txt > > Is there a better approach? > > Thanks, > Charith > > > > > > > > > On Sun, Sep 28, 2014 at 8:29 AM, Pavan Kumar A > wrote: > > I worked on this feature sometime back - but I only worked on inputting > hive file & not hdfs > > You can use logic outside giraph to select which partition file to use - > this is possible because you input the number of workers anyway. > For instance in the script that you use to launch a giraph job have a > selection logic for the partition file > > You can take a look at : https://issues.apache.org/jira/browse/GIRAPH-908 > You might have to extend upon the jira for your specific use case - I only > added support for case when id = longwritable > > Here is a list of options you might want to explore > > # Mapping Store related information > > -Dgiraph.mappingStoreClass=org.apache.giraph.mapping.LongByteMappingStore > -Dgiraph.lbMappingStoreUpper=1987000 > -Dgiraph.lbMappingStoreLower=4096 > # Mapping tore ops information > > -Dgiraph.mappingStoreOpsClass=org.apache.giraph.mapping.DefaultEmbeddedLongByteOps > # Embed mapping information > > -Dgiraph.edgeTranslationClass=org.apache.giraph.mapping.translate.LongByteTranslateEdge > # PartitionerFactory to be used > > -Dgiraph.graphPartitionerFactoryClass=org.apache.giraph.partition.LongMappingStorePartitionerFactory > > So the partition map is stored here as map of byte arrays. with .lbMappingStoreUpper > being size of map and lbMappingStoreLower being size of individual arrays > > Please explore code & tell me what else you need. > Thanks > ------------------------------ > Date: Sat, 27 Sep 2014 22:51:29 -0700 > Subject: Re: Using a custom graph partitioning stratergy with giraph > From: charith.dhanushka@gmail.com > To: user@giraph.apache.org > > > Also adding some more information. > > My current understanding is I should be able to do this by my own > org.apache.giraph.partition.WorkerGraphPartitioner implementation. > > But my question is, Is there are a way to get some outside input inside > the WorkerGraphPartitioner?In my case it will be an hdfs file location. > > Thanks, > Charith > > > > > > > > > > > On Sat, Sep 27, 2014 at 10:13 PM, Charith Wickramarachchi < > charith.dhanushka@gmail.com> wrote: > > Hi, > > I m trying to use giraph with a custom graph partitioner that I have. In > my case i want to assign vertices to workers based on a custom partitioner > input. > > In my case partitioner will take number of workers as an input parameter > and give me a file which maps each vertex id to a worker. I m trying load > this file to a hdfs location and use it as an input to the giraph and do > the vertex assignment. > > Any suggestions or pointers on best way to this will be highly appricated > (Use the current extention points of giraph as much as possible to avoid > random hacks). > > I m currently using giraph-1.0.0. > > Thanks, > Charith > > > > > -- > Charith Dhanushka Wickramaarachchi > > Tel +1 213 447 4253 > Web http://apache.org/~charith > > Blog http://charith.wickramaarachchi.org/ > > Twitter @charithwiki > > This communication may contain privileged or other confidential information > and is intended exclusively for the addressee/s. If you are not the > intended recipient/s, or believe that you may have > received this communication in error, please reply to the sender indicating > that fact and delete the copy you received and in addition, you should > not print, copy, retransmit, disseminate, or otherwise use the > information contained in this communication. Internet communications > cannot be guaranteed to be timely, secure, error or virus-free. The > sender does not accept liability for any errors or omissions > > > > > -- > Charith Dhanushka Wickramaarachchi > > Tel +1 213 447 4253 > Web http://apache.org/~charith > > Blog http://charith.wickramaarachchi.org/ > > Twitter @charithwiki > > This communication may contain privileged or other confidential information > and is intended exclusively for the addressee/s. If you are not the > intended recipient/s, or believe that you may have > received this communication in error, please reply to the sender indicating > that fact and delete the copy you received and in addition, you should > not print, copy, retransmit, disseminate, or otherwise use the > information contained in this communication. Internet communications > cannot be guaranteed to be timely, secure, error or virus-free. The > sender does not accept liability for any errors or omissions > > > > > -- > Charith Dhanushka Wickramaarachchi > > Tel +1 213 447 4253 > Web http://apache.org/~charith > > Blog http://charith.wickramaarachchi.org/ > > Twitter @charithwiki > > This communication may contain privileged or other confidential information > and is intended exclusively for the addressee/s. If you are not the > intended recipient/s, or believe that you may have > received this communication in error, please reply to the sender indicating > that fact and delete the copy you received and in addition, you should > not print, copy, retransmit, disseminate, or otherwise use the > information contained in this communication. Internet communications > cannot be guaranteed to be timely, secure, error or virus-free. The > sender does not accept liability for any errors or omissions > > > > > -- > Charith Dhanushka Wickramaarachchi > > Tel +1 213 447 4253 > Web http://apache.org/~charith > > Blog http://charith.wickramaarachchi.org/ > > Twitter @charithwiki > > This communication may contain privileged or other confidential information > and is intended exclusively for the addressee/s. If you are not the > intended recipient/s, or believe that you may have > received this communication in error, please reply to the sender indicating > that fact and delete the copy you received and in addition, you should > not print, copy, retransmit, disseminate, or otherwise use the > information contained in this communication. Internet communications > cannot be guaranteed to be timely, secure, error or virus-free. The > sender does not accept liability for any errors or omissions > -- Charith Dhanushka Wickramaarachchi Tel +1 213 447 4253 Web http://apache.org/~charith Blog http://charith.wickramaarachchi.org/ Twitter @charithwiki This communication may contain privileged or other confidential information and is intended exclusively for the addressee/s. If you are not the intended recipient/s, or believe that you may have received this communication in error, please reply to the sender indicating that fact and delete the copy you received and in addition, you should not print, copy, retransmit, disseminate, or otherwise use the information contained in this communication. Internet communications cannot be guaranteed to be timely, secure, error or virus-free. The sender does not accept liability for any errors or omissions --e89a8f83a13f1f0ff20504763bdf Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Pavan,=C2=A0

Thanks a lot. That will= be great.=C2=A0
Based on your inputs I wrote an implementation t= o support my scenario. Which include writing a mapping input format.=C2=A0<= /div>

But I am not clear how=C2=A0to get input into this= mapping input format.(How to specify=C2=A0an input path for a= MappingInputformat).=C2=A0

I looked into=C2=A0Con= figurationUtils but It did not have any option to do that.=C2=A0
=
It will be great if you could give me some input on how to h= andle this matter. I am=C2=A0attaching my mapping input format just in case= that is helpful.=C2=A0

Thanks,
Ch= arith






On Wed, Oct 1, 2014 at 7:42 PM, Pavan Kumar A <= pavanka@outlook.co= m> wrote:
I will write a detailed explanation in weekend. thank= s for your interest.


Date: Wed, 1 Oct 2014 10:56:16 -0700

Subject: Re: Using a custom graph partitioning str= atergy with giraph
From: charith.dhanushka@gmail.com
To: user@giraph.apache.org
Thanks Pavan,=C2=A0

I get the high lev= el level idea. I am=C2=A0still new to Giraph code base so I am still trying= to understand the overall design.=C2=A0

So I have= few questions regarding this feature.=C2=A0

Can w= e use this feature with a vertex input format without using edge translatio= n?=C2=A0
(Since =C2=A0=C2=A0getPartition=C2=A0in Map= pingStoreOps =C2=A0can be used to get the partition of any target vertex)

Also, since I have mapping information in a sep= arate file =C2=A0do I=C2=A0need to embed=C2=A0target information in the ver= tex? =C2=A0

It will be great if you could explain = your scenario with dataformat=C2=A0you used and what extension= =C2=A0points you used so that I can understand it better and adapt to my sc= enario.=C2=A0


Thanks,
Charith



<= div>
On Mon, Sep 29, 2014 at 3:34 PM, Pavan Kumar A <pavanka@out= look.com> wrote:
we have two inputs - vertex & edges
if we par= tition edges vertices based on a map, then when we want to send messages we= should be able to know which partition a vertex is on.

typically we send messages to targetIds of outgoing edges, edge trans= ation helps encode mapping information into targetIds, so knowing which par= tition to send a message can be done by just looking at the targetid

Date: Mon, 29 Sep 2014 14:37:22 -0700

Subject: Re: Using= a custom graph partitioning stratergy with giraph
From: charith.dhanushka@gmail.c= om
To: u= ser@giraph.apache.org

Hi Pavan,=C2=A0

<= /div>
Thanks for the details. I went through the code specially the ext= ension=C2=A0points you mentioned.=C2=A0
I am=C2=A0not clear about= the function of the edge Translation (org.apache.giraph.mapping.translate.TranslateEdge) class. Could you please explain the idea of this translat= ion process.=C2=A0

In my case I will have a ma= pping file which maps each vertex to a partition.
=C2=A0
ex:

v1 part1
v2 part2
v3 part3=C2=A0
.
.
.

So I was thinking of passing this as a parameter and reading inside= my own MappingStore Implementation=C2=A0
-Dgiraph.mappingFilePath=3D/user/charith/input/mapping.txt<= /div>

Is there a better approach?=C2=A0

Thanks,
Charith






On Sun, Sep 28, 2014 at 8:29 AM, Pavan Kumar A = <pavanka@outlook.com> wrote:
I worked on this feature sometime back - but I only w= orked on inputting hive file & not hdfs

You can use logic = outside giraph to select which partition file to use - this is possible bec= ause you input the number of workers anyway.
For instance in the = script that you use to launch a giraph job have a selection logic for the p= artition file

You might have= to extend upon the jira for your specific use case - I only added support = for case when id =3D longwritable

Here is a list o= f options you might want to explore

=C2=A0# M= apping Store related information
=C2=A0 =C2=A0 -Dgiraph.mappingSt= oreClass=3Dorg.apache.giraph.mapping.LongByteMappingStore
=C2=A0 = =C2=A0 -Dgiraph.lbMappingStoreUpper=3D1987000
=C2=A0 =C2=A0 -Dgir= aph.lbMappingStoreLower=3D4096
=C2=A0 =C2=A0 # Mapping tore ops i= nformation
=C2=A0 =C2=A0 -Dgiraph.mappingStoreOpsClass=3Dorg.apac= he.giraph.mapping.DefaultEmbeddedLongByteOps
=C2=A0 =C2=A0 # Embe= d mapping information
=C2=A0 =C2=A0 -Dgiraph.edgeTranslationClass= =3Dorg.apache.giraph.mapping.translate.LongByteTranslateEdge
=C2= =A0 =C2=A0 # PartitionerFactory to be used
=C2=A0 =C2=A0 -Dgiraph= .graphPartitionerFactoryClass=3Dorg.apache.giraph.partition.LongMappingStor= ePartitionerFactory

So the partition map is stored= here as map of byte arrays. with=C2=A0.lbMa= ppingStoreUpper being size of map and=C2=A0lbMappingStoreLower being size of individual arrays
=
Please explore code &a= mp; tell me what else you need.
Thanks

Date: Sat, 2= 7 Sep 2014 22:51:29 -0700
Subject: Re: Using a custom graph partitioning= stratergy with giraph
From: charith.dhanushka@gmail.com
To: user@giraph.apache.org


Also adding some more information.=C2=A0
My current understanding is I should be able to do this by= =C2=A0my own org.apache.giraph.partition.WorkerGraphPartitioner implementa= tion.

But my question is, Is there are a way to ge= t some outside input inside the WorkerGraphPartitioner?In my case it will b= e an hdfs file location.=C2=A0

Thanks,
Charith








=C2=A0

On Sat, Sep 27, 2014 at 10:13 PM, Charith Wickramara= chchi <charith.dhanushka@gmail.com> wrote:
Hi,=C2=A0

I m trying to use giraph with a custom gra= ph partitioner that I have. In my case i want to assign vertices to workers= based on a custom partitioner input.=C2=A0

In my = case partitioner will take number of workers as an input parameter and give= me a file which maps each vertex id to a worker. I m trying load this file= to a hdfs location and use it as an input to the giraph and do the vertex = assignment. =C2=A0

Any suggestions or pointers on = best way to this will be highly appricated (Use the current extention point= s of giraph as much as possible to avoid random hacks).=C2=A0
I m currently using giraph-1.0.0.

Than= ks,
Charith




--
Charith Dhanushka Wickramaarachchi

Tel=C2=A0=C2=A0+1 213 447 4253
Twitter=C2=A0=C2=A0@charithwiki
<= /div>

This communication may = contain privileged or other confidential=C2=A0information and is intended exclusively for the addressee/s. = If you=C2=A0are not the intended= recipient/s, or believe that you may have
received this comm= unication in error, please reply to the sender=C2=A0indicating that fact and delete the copy you received a= nd in addition,=C2=A0you should = not print, copy, retransmit, disseminate, or otherwise use=C2=A0the information contained in this communica= tion. Internet=C2=A0communicatio= ns cannot be guaranteed to be timely, secure, error or=C2=A0virus-free. The sender does not accept liabilit= y for any errors or=C2=A0omissio= ns



--
Charith Dhanushka Wickramaarachchi




--
Charith Dhanushka Wickramaarachchi




--
Charith Dhanushka Wickramaarachchi




--
Charith Dhanushka Wickramaarachchi


This communication may contain privileged or other confidential= =C2=A0information and is intende= d exclusively for the addressee/s. If you=C2=A0are not the intended recipient/s, or believe that you may ha= ve
received this communication in error, please reply to the = sender=C2=A0indicating that fact= and delete the copy you received and in addition,=C2=A0you should not print, copy, retransmit, disseminat= e, or otherwise use=C2=A0the inf= ormation contained in this communication. Internet=C2=A0communications cannot be guaranteed to be timely, = secure, error or=C2=A0virus-free= . The sender does not accept liability for any errors or=C2=A0omissions
--e89a8f83a13f1f0ff20504763bdf-- --e89a8f83a13f1f0ff60504763be1 Content-Type: text/x-java; charset=US-ASCII; name="LongDoubleFloatLongMappingInputFormat.java" Content-Disposition: attachment; filename="LongDoubleFloatLongMappingInputFormat.java" Content-Transfer-Encoding: base64 X-Attachment-Id: f_i0sjfs1z0 cGFja2FnZSBvcmcuYXBhY2hlLmdpcmFwaC5pby5mb3JtYXRzOwoKaW1wb3J0IGNvbS5nb29nbGUu Y29tbW9uLmNvbGxlY3QuTGlzdHM7CmltcG9ydCBvcmcuYXBhY2hlLmdpcmFwaC5lZGdlLkVkZ2U7 CmltcG9ydCBvcmcuYXBhY2hlLmdpcmFwaC5lZGdlLkVkZ2VGYWN0b3J5OwppbXBvcnQgb3JnLmFw YWNoZS5naXJhcGguZ3JhcGguVmVydGV4OwppbXBvcnQgb3JnLmFwYWNoZS5naXJhcGguaW8uTWFw cGluZ0lucHV0Rm9ybWF0OwppbXBvcnQgb3JnLmFwYWNoZS5naXJhcGguaW8uTWFwcGluZ1JlYWRl cjsKaW1wb3J0IG9yZy5hcGFjaGUuZ2lyYXBoLm1hcHBpbmcuTWFwcGluZ0VudHJ5OwppbXBvcnQg b3JnLmFwYWNoZS5oYWRvb3AuY29uZi5Db25maWd1cmF0aW9uOwppbXBvcnQgb3JnLmFwYWNoZS5o YWRvb3AuaW8uKjsKaW1wb3J0IG9yZy5hcGFjaGUuaGFkb29wLm1hcHJlZHVjZS5JbnB1dFNwbGl0 OwppbXBvcnQgb3JnLmFwYWNoZS5oYWRvb3AubWFwcmVkdWNlLkpvYkNvbnRleHQ7CmltcG9ydCBv cmcuYXBhY2hlLmhhZG9vcC5tYXByZWR1Y2UuUmVjb3JkUmVhZGVyOwppbXBvcnQgb3JnLmFwYWNo ZS5oYWRvb3AubWFwcmVkdWNlLlRhc2tBdHRlbXB0Q29udGV4dDsKCmltc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Bpbml0aWFsaXplKElucHV0U3BsaXQgaW5wdXRTcGxpdCwgVGFza0F0dGVtcHRD b250ZXh0IGNvbnRleHQpIHRocm93cyBJT0V4Y2VwdGlvbiwgSW50ZXJydXB0ZWRFeGNlcHRpb24g ewoKICAgICAgIC8vICAgICB0aGlzLmNvbnRleHQgPSBjb250ZXh0OwogICAgICAgICAgICBsaW5l UmVjb3JkUmVhZGVyID0gY3JlYXRlTGluZVJlY29yZFJlYWRlcihpbnB1dFNwbGl0LGNvbnRleHQp OwogICAgICAgICAgICBsaW5lUmVjb3JkUmVhZGVyLmluaXRpYWxpemUoaW5wdXRTcGxpdCwgY29u dGV4dCk7CgogICAgICAgIH0KCgogICAgICAgIC8qKgogICAgICAgICAqIENyZWF0ZSB0aGUgbGlu ZSByZWNvcmQgcmVhZGVyLiBPdmVycmlkZSB0aGlzIHRvIHVzZSBhIGRpZmZlcmVudAogICAgICAg ICAqIHVuZGVybHlpbmcgcmVjb3JkIHJlYWRlciAodXNlZnVsIGZvciB0ZXN0aW5nKS4KICAgICAg ICAgKgogICAgICAgICAqIEBwYXJhbSBpbnB1dFNwbGl0CiAgICAgICAgICogICAgICAgICAgdGhl IHNwbGl0IHRvIHJlYWQKICAgICAgICAgKiBAcGFyYW0gY29udGV4dAogICAgICAgICAqICAgICAg ICAgIHRoZSBjb250ZXh0IHBhc3NlZCB0byBpbml0aWFsaXplCiAgICAgICAgICogQHJldHVybgog ICAgICAgICAqICAgICAgICAgdGhlIHJlY29yZCByZWFkZXIgdG8gYmUgdXNlZAogICAgICAgICAq IEB0aHJvd3MgSU9FeGNlcHRpb24KICAgICAgICAgKiAgICAgICAgICAgZXhjZXB0aW9uIHRoYXQg Y2FuIGJlIHRocm93biBkdXJpbmcgY3JlYXRpb24KICAgICAgICAgKiBAdGhyb3dzIEludGVycnVw dGVkRXhjZXB0aW9uCiAgICAgICAgICogICAgICAgICAgIGV4Y2VwdGlvbiB0aGF0IGNhbiBiZSB0 aHJvd24gZHVyaW5nI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ICAgICAgICBAT3ZlcnJpZGUKICAgICAgICBwdWJsaWMgZmxvYXQg Z2V0UHJvZ3Jlc3MoKSB0aHJvd3MgSU9FeGNlcHRpb24sIEludGVycnVwdGVkRXhjZXB0aW9uIHsK ICAgICAgICAgICAgcmV0dXJuIGxpbmVSZWNvcmRSZWFkZXIuZ2V0UHJvZ3Jlc3MoKTsKICAgICAg ICB9CiAgICB9CgoKfQo= --e89a8f83a13f1f0ff60504763be1--