class MRJob(object): INPUT_PROTOCOL = protocol.JSONValueProtocol INTERNAL_PROTOCOL = protocol.JSONProtocol OUTPUT_PROTOCOL = protocol.JSONValueProtocol def __init__(self, counters=None): self._settings = self.settings() self._steps = self.steps() self._counters = MRCounter() @classmethod def run(cls): mapreduce(cls) @abstractmethod def steps(self): """define steps necessary to run the job""" @abstractmethod def settings(self): """define settings""" def increment_counter(self, group, counter, amount=1): self._counters.incr(group, counter, amount) def get_step(self, step_idx): return self.steps()[step_idx]