hama-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Behroz Sikander <behro...@gmail.com>
Subject Re: BSPClass with parameters
Date Tue, 14 Jul 2015 20:28:50 GMT
Hi,
conf.setClass(name, theClass, xface); <-- This worked. Thanks :)

On Thu, Jul 9, 2015 at 4:18 AM, Behroz Sikander <behroz89@gmail.com> wrote:

> thanks :D
>
> On Thu, Jul 9, 2015 at 4:16 AM, Edward J. Yoon <edwardyoon@apache.org>
> wrote:
>
>> Good luck! :-)
>>
>> On Thu, Jul 9, 2015 at 11:15 AM, Behroz Sikander <behroz89@gmail.com>
>> wrote:
>> > Ok great. Thanks. I will have a look at this.
>> >
>> > On Thu, Jul 9, 2015 at 4:10 AM, Edward J. Yoon <edwardyoon@apache.org>
>> > wrote:
>> >
>> >> Here's simple example for you:
>> >>
>> >> HamaConfiguration conf = new HamaConfiguration();
>> >> conf.setClass(name, theClass, xface);
>> >>
>> >> BSPJob bsp = new BSPJob(conf, MyBSPProgram.class);
>> >>
>> >>
>> >> On Thu, Jul 9, 2015 at 11:08 AM, Behroz Sikander <behroz89@gmail.com>
>> >> wrote:
>> >> > *>>You can set not only String but also Object. :-)*
>> >> > Well, strange because I only see String data type.
>> *BSPJ**ob.set(String
>> >> name,
>> >> > String value);*
>> >> >
>> >> > *>>If f and g functions should be provided as a user-defined
>> function,*
>> >> >
>> >> >
>> >> > *Above code will be helpful. And also, you can create your
>> ownframework
>> >> > atop Hama like BSP-based vertex-centric graph computingframework.*
>> >> > That is a good idea. I will try to understand the graph engine code.
>> >> >
>> >> > Thanks,
>> >> > Behroz
>> >> >
>> >> > On Thu, Jul 9, 2015 at 4:00 AM, Edward J. Yoon <
>> edwardyoon@apache.org>
>> >> > wrote:
>> >> >
>> >> >> Hi,
>> >> >>
>> >> >> You can set not only String but also Object. :-)
>> >> >>
>> >> >>   /**
>> >> >>    * Set the Vertex class for the job.
>> >> >>    */
>> >> >>   public void setVertexClass(
>> >> >>       Class<? extends Vertex<? extends Writable, ? extends
>> Writable, ?
>> >> >> extends Writable>> cls)
>> >> >>       throws IllegalStateException {
>> >> >>     conf.setClass(VERTEX_CLASS_ATTR, cls, Vertex.class);
>> >> >>     setInputKeyClass(cls);
>> >> >>     setInputValueClass(NullWritable.class);
>> >> >>   }
>> >> >>
>> >> >> See also
>> >> >>
>> >>
>> http://svn.apache.org/repos/asf/hama/trunk/graph/src/main/java/org/apache/hama/graph/GraphJob.java
>> >> >>
>> >> >> If f and g functions should be provided as a user-defined function,
>> >> >> Above code will be helpful. And also, you can create your own
>> >> >> framework atop Hama like BSP-based vertex-centric graph computing
>> >> >> framework.
>> >> >>
>> >> >> Thanks!
>> >> >>
>> >> >>
>> >> >> On Thu, Jul 9, 2015 at 10:53 AM, Behroz Sikander <
>> behroz89@gmail.com>
>> >> >> wrote:
>> >> >> > Hi,
>> >> >> > I know about the set method of BSPJob but the problem is that
it
>> takes
>> >> >> key
>> >> >> > and value in *String. *In my case, I want to pass a value
of type
>> >> >> *IFunction
>> >> >> > (which is an interface).*
>> >> >> >
>> >> >> > *Regards,*
>> >> >> > *Behroz*
>> >> >> >
>> >> >> > On Thu, Jul 9, 2015 at 3:14 AM, Edward J. Yoon <
>> >> edward.yoon@samsung.com>
>> >> >> > wrote:
>> >> >> >
>> >> >> >> Hi Behroz,
>> >> >> >>
>> >> >> >> You should specify the job parameters using BSPJob's get/set
>> methods
>> >> >> like
>> >> >> >> below:
>> >> >> >>
>> >> >> >> BSPJob admm = new BSPJob();
>> >> >> >>
>> >> >> >> admm.set("param1", "value");
>> >> >> >> admm.setBspClass(ExchangeADMMSolver.class);
>> >> >> >>
>> >> >> >> Then,
>> >> >> >>
>> >> >> >> public class ExchangeADMMSolver extends BSP {
>> >> >> >>
>> >> >> >> String param1;
>> >> >> >>
>> >> >> >> @Override
>> >> >> >>     public void setup(BSPPeer peer) {
>> >> >> >>       this.param1 = peer.getConfiguration().get("param1");
>> >> >> >>    }
>> >> >> >>
>> >> >> >> }
>> >> >> >>
>> >> >> >> Thanks.
>> >> >> >>
>> >> >> >> --
>> >> >> >> Best Regards, Edward J. Yoon
>> >> >> >>
>> >> >> >> -----Original Message-----
>> >> >> >> From: Behroz Sikander [mailto:behroz89@gmail.com]
>> >> >> >> Sent: Thursday, July 09, 2015 9:02 AM
>> >> >> >> To: dev@hama.apache.org
>> >> >> >> Subject: BSPClass with parameters
>> >> >> >>
>> >> >> >> Hi,
>> >> >> >> I was recently working on something and need your suggestion.
I
>> am
>> >> >> building
>> >> >> >> a small framework on top of Hama. Using my framework,
users will
>> >> submit
>> >> >> a
>> >> >> >> job to my framework and my framework will internally run
the Hama
>> >> job.
>> >> >> Here
>> >> >> >> is a sample code of what user might submit to my framework.
>> >> >> >>
>> >> >> >> //Extra Hama related Params here like JobName, output
Path etc
>> >> >> >> IFunction f = new MasterFunction(<inputPath>, <extra
params>);
>> >> >> >> IFunction g = new SlaveFunction(<inputPath>, <extra
params>);
>> >> >> >> ExchangeADMMSolver admm = new ExchangeADMMSolver(f, g);
//Problem
>> >> here
>> >> >> >> admm.solve();
>> >> >> >>
>> >> >> >> Here ExchangeADMMSolver will be a BSP class (this is what
I am
>> >> hoping to
>> >> >> >> acheive) and *"solve" *method will internally create a
HamaJob
>> and
>> >> will
>> >> >> >> submit it to Hama.
>> >> >> >>
>> >> >> >> I am a little confused here that how will I pass all the
>> parameters
>> >> to
>> >> >> the
>> >> >> >> BSP class (e.g f,g) ? because in Hama if I want to set
the bsp
>> class
>> >> I
>> >> >> do
>> >> >> >> the following
>> >> >> >>
>> >> >> >> HamaJob. setBspClass(ExchangeADMMSolver.class);
>> >> >> >>
>> >> >> >> So, Instead of this I am looking for something like
>> >> >> >>
>> >> >> >> HamaJob.setBspObject(admm);
>> >> >> >>
>> >> >> >> I might need to override some Hama classes but before
doing that
>> I
>> >> need
>> >> >> >> some suggestions that what can be the best solution.
>> >> >> >>
>> >> >> >> Regards,
>> >> >> >> Behroz Sikander
>> >> >> >>
>> >> >> >>
>> >> >> >>
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Best Regards, Edward J. Yoon
>> >> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Best Regards, Edward J. Yoon
>> >>
>>
>>
>>
>> --
>> Best Regards, Edward J. Yoon
>>
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message