You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@giraph.apache.org by Etienne Dumoulin <et...@idiro.com> on 2012/07/22 22:16:48 UTC
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
Re: How to use an aggregator to halt ?
Posted by Etienne Dumoulin <et...@idiro.com>.
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 <al...@fb.com> 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 <et...@idiro.com>
> Reply-To: "user@giraph.apache.org" <us...@giraph.apache.org>
> Date: Sunday, July 22, 2012 9:16 PM
> To: "giraph-user@incubator.apache.org" <gi...@incubator.apache.org>
> 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
>
>
Re: How to use an aggregator to halt ?
Posted by Alessandro Presta <al...@fb.com>.
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 <et...@idiro.com>>
Reply-To: "user@giraph.apache.org<ma...@giraph.apache.org>" <us...@giraph.apache.org>>
Date: Sunday, July 22, 2012 9:16 PM
To: "giraph-user@incubator.apache.org<ma...@incubator.apache.org>" <gi...@incubator.apache.org>>
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