You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-user@hadoop.apache.org by Gang Luo <lg...@yahoo.com.cn> on 2010/07/19 21:48:22 UTC

manipulate counters in new api

Hi all,
I find the map/reduce method in the new api look like map/reduce(Object, 
Iterable, Context). No Reporter appears here as in the old api. How to add and 
modify counters in the new api?

Thanks,
-Gang



      

RE: manipulate counters in new api

Posted by Michael Segel <mi...@hotmail.com>.


> Date: Tue, 20 Jul 2010 03:48:22 +0800
> From: lgpublic@yahoo.com.cn
> Subject: manipulate counters in new api
> To: common-user@hadoop.apache.org
> 
> Hi all,
> I find the map/reduce method in the new api look like map/reduce(Object, 
> Iterable, Context). No Reporter appears here as in the old api. How to add and 
> modify counters in the new api?
> 
> Thanks,
> -Gang
> 

This is pretty similar to my post to general-hadoop.

The idea is how to create dynamic counters vs enum counters.

To answer Gang's question ... if you are using enum counters, you can get the counters from the context 
and then increment them.

-Mike

 		 	   		  
_________________________________________________________________
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3

Re: manipulate counters in new api

Posted by Gang Luo <lg...@yahoo.com.cn>.
Thanks Asif. 

One more question here. Can I access the same counter through new and old API? 
Say I increase the counter to some value using new api, and get it back using 
old api (the group and counter name are the same), can I see the value I want? 
Pig seems mess up the new and old api and I have to access the counter through 
both of them.

Thanks.
-Gang




----- 原始邮件 ----
发件人: Asif Jan <As...@unige.ch>
收件人: common-user@hadoop.apache.org
发送日期: 2010/7/19 (周一) 4:41:28 下午
主   题: Re: manipulate counters in new api

context.getCounter(Status.failed).increment(1);    


cheers




On Jul 19, 2010, at 9:48 PM, Gang Luo wrote:

> Hi all,
> I find the map/reduce method in the new api look like map/reduce(Object,
> Iterable, Context). No Reporter appears here as in the old api. How to add and
> modify counters in the new api?
> 
> Thanks,
> -Gang
> 
> 
> 
> 


      

Re: manipulate counters in new api

Posted by Asif Jan <As...@unige.ch>.
context.getCounter(Status.failed).increment(1);	


cheers




On Jul 19, 2010, at 9:48 PM, Gang Luo wrote:

> Hi all,
> I find the map/reduce method in the new api look like map/ 
> reduce(Object,
> Iterable, Context). No Reporter appears here as in the old api. How  
> to add and
> modify counters in the new api?
>
> Thanks,
> -Gang
>
>
>
>