I Tried the following...It gets compiled but the value of result seems to be
0 always.

        RunningJob running = JobClient.runJob(conf);

         Counters ct = new Counters();
             ct = running.getCounters();

        long     result =
ct.findCounter("org.apache.hadoop.mapred.Task$Counter", 0,
"*MyCounter*").getCounter();
//even tried MyCounter.Key1



Does anyone know whay that is happening?

Thanks,

Sharath



On Thu, Feb 5, 2009 at 5:59 AM, some speed <[email protected]> wrote:

> Hi Tom,
>
> I get the error :
>
> Cannot find Symbol* "**MyCounter.ct_key1 " *
>
>
>
>
>
>
> On Thu, Feb 5, 2009 at 5:51 AM, Tom White <[email protected]> wrote:
>
>> Hi Sharath,
>>
>> The code you posted looks right to me. Counters#getCounter() will
>> return the counter's value. What error are you getting?
>>
>> Tom
>>
>> On Thu, Feb 5, 2009 at 10:09 AM, some speed <[email protected]> wrote:
>> > Hi,
>> >
>> > Can someone help me with the usage of counters please? I am incrementing
>> a
>> > counter in Reduce method but I am unable to collect the counter value
>> after
>> > the job is completed.
>> >
>> > Its something like this:
>> >
>> > public static class Reduce extends MapReduceBase implements
>> Reducer<Text,
>> > FloatWritable, Text, FloatWritable>
>> >    {
>> >        static enum MyCounter{ct_key1};
>> >
>> >         public void reduce(..............) throws IOException
>> >        {
>> >
>> >            reporter.incrCounter(MyCounter.ct_key1, 1);
>> >
>> >            output.collect(......);
>> >
>> >        }
>> > }
>> >
>> > -----main method----
>> > {
>> >            RunningJob running = null;
>> >            running=JobClient.runJob(conf);
>> >
>> >            Counters ct = running.getCounters();
>> > /*********  How do I Collect the ct_key1 value ????***********/
>> >            long res = ct.getCounter(MyCounter.ct_key1);
>> >
>> > }
>> >
>> >
>> >
>> >
>> >
>> > Thanks,
>> >
>> > Sharath
>> >
>>
>
>

Reply via email to