def incr_counter(self, *args, **kwargs):
        """
        Increments a Hadoop counter.

        Since counters can be a bit slow to update, this batches the updates.
        """
        threshold = kwargs.get("threshold", self.batch_counter_default)
        if len(args) == 2:
            # backwards compatibility with existing hadoop jobs
            group_name, count = args
            key = (group_name,)
        else:
            group, name, count = args
            key = (group, name)

        ct = self._counter_dict.get(key, 0)
        ct += count
        if ct >= threshold:
            new_arg = list(key) + [ct]
            self._incr_counter(*new_arg)
            ct = 0
        self._counter_dict[key] = ct
def incr_counter ( self , * args , ** kwargs ) : threshold = kwargs . get ( "threshold" , self . batch_counter_default ) if len ( args ) == 2 : group_name , count = args key = ( group_name , ) else : group , name , count = args key = ( group , name ) ct = self . _counter_dict . get ( key , 0 ) ct += count if ct >= threshold : new_arg = list ( key ) + [ ct ] self . _incr_counter ( * new_arg ) ct = 0 self . _counter_dict [ key ] = ct
Increments a Hadoop counter.

        Since counters can be a bit slow to update, this batches the updates.