Hi Alessandro, Thanks, look like the API evolved since the 0.1 version which was the version I used...
Etienne On 22 July 2012 21:21, Alessandro Presta <[email protected]> wrote: > Hi, > > The right place to unilaterally halt the computation is MasterCompute, > of which only one instance exists for the whole job. > I haven't had any experience with aggregators yet, but you should be able > to read their values from inside MasterCompute#compute(). > > Alessandro > > From: Etienne Dumoulin <[email protected]> > Reply-To: "[email protected]" <[email protected]> > Date: Sunday, July 22, 2012 9:16 PM > To: "[email protected]" <[email protected]> > Subject: How to use an aggregator to halt ? > > Hi everyone, > > I implement a pagerank very similar to the one given > in the example package. > > However I would like to do a halt condition with an aggregator: > I am calculating the sum of all the vertex values at each step. > I am stopping when the average of the difference is bellow a certain > point. > > So I have extended a WorkerContext class. It does not look like > I can stop the process from the method postSuperStep(), so I try > to set a boolean somewhere readable by the vertex. > Where can I set it? > > -I tried to do a getWorkerContext, cast into my type and then call my own > method: > if ( ((MyWorkerContext)getWorkerContext()).isEnd(); > ) { > voteToHalt(); > }else{... > } > > -I tried to set a boolean into the Configuration from the WorkerContext and > get it back into the Vertex. > if ( getWorkerContext().getContext().getConfiguration().getBoolean("end", > false) > ) { > voteToHalt(); > }else{... > } > > Thanks, > > Etienne > >
