You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@giraph.apache.org by "Schweiger, Tom" <th...@ebay.com> on 2014/04/19 01:36:18 UTC
Starting a second computation
Hello Giraph list,
I have a problem that has two steps. Step 2 needs to start after step 1 completes. Step 1 is completed when all the vertices have voted to halt and there are no more messages.
I know I can switch my computes using a MasterCompute, but it is unclear how I re-awaken all the vertices.
Has anyone else solved a problem like this? If so, how did you do it? Is there an easier way to do this?
Basically I'm thinking this:
class TwoStep {
class TwoStepMaster extends DefaultMasterCompute {
public final void compute() {
//
// switch from StepOne to StepTwo if StepOne is done
//
if (this .isHalted && this.getComputation().equals(StepOne.class);) {
setComputation(StepTwo.class());
// send a message to all vertices???
// unhalt somehow??
// suggestions anyone??
}
}
}
class StepOne extends BasicComputation {
public void compute(...) {
// do step one stuff
vertex.voteToHalt();
}
}
class StepTwo extends BasicComputation {
public void compute(...) {
// do step two stuff
vertex.voteTpHalt();
}
}
}
Re: Starting a second computation
Posted by Claudio Martella <cl...@gmail.com>.
Hi,
there is currently now way to re-active the vertices from the master. One
thing you could do is use an aggregator, instead of actually voting to
halt. For example, with a sum aggregator VERTEX_FINISHED, where vertices
add 1 when they would vote to halt, you can see from the master when all
the vertices are finished, and then switch to a new computation.
On Sat, Apr 19, 2014 at 1:36 AM, Schweiger, Tom <th...@ebay.com>wrote:
>
> Hello Giraph list,
>
> I have a problem that has two steps. Step 2 needs to start after step 1
> completes. Step 1 is completed when all the vertices have voted to halt
> and there are no more messages.
>
> I know I can switch my computes using a MasterCompute, but it is unclear
> how I re-awaken all the vertices.
>
> Has anyone else solved a problem like this? If so, how did you do it? Is
> there an easier way to do this?
>
> Basically I'm thinking this:
>
> class TwoStep {
>
> class TwoStepMaster extends DefaultMasterCompute {
>
> public final void compute() {
> //
> // switch from StepOne to StepTwo if StepOne is done
> //
> if (this .isHalted &&
> this.getComputation().equals(StepOne.class);) {
> setComputation(StepTwo.class());
> // send a message to all vertices???
> // unhalt somehow??
> // suggestions anyone??
> }
> }
> }
>
> class StepOne extends BasicComputation {
> public void compute(...) {
> // do step one stuff
> vertex.voteToHalt();
> }
> }
>
> class StepTwo extends BasicComputation {
> public void compute(...) {
> // do step two stuff
> vertex.voteTpHalt();
> }
> }
>
> }
>
>
>
>
>
--
Claudio Martella