def run(self): storm_conf, context = read_handshake() self.__current_tup = None # used for auto-anchoring try: self.initialize(storm_conf, context) while True: self.__current_tup = read_tuple() self.process(self.__current_tup) self.ack(self.__current_tup) except Exception as e: self.raise_exception(e, self.__current_tup)
def run(self): global _ANCHOR_TUPLE storm_conf, context = read_handshake() tup = None try: self.initialize(storm_conf, context) while True: tup = read_tuple() _ANCHOR_TUPLE = tup self.process(tup) self.ack(tup) except Exception as e: self.raise_exception(e, tup)
def run(self): """Main run loop for all bolts. Performs initial handshake with Storm and reads tuples handing them off to subclasses. Any exceptions are caught and logged back to Storm prior to the Python process exits. Subclasses should not override this method. """ storm_conf, context = read_handshake() tup = None try: self.initialize(storm_conf, context) while True: tup = read_tuple() self.process(tup) except Exception as e: self.raise_exception(e, tup)
def run(self): """Main run loop for all spouts. Performs initial handshake with Storm and reads tuples handing them off to subclasses. Any exceptions are caught and logged back to Storm prior to the Python process exits. Subclasses should not override this method. """ storm_conf, context = read_handshake() try: self.initialize(storm_conf, context) while True: cmd = read_command() if cmd['command'] == 'next': self.next_tuple() if cmd['command'] == 'ack': self.ack(cmd['id']) if cmd['command'] == 'fail': self.fail(cmd['id']) send_message({'command': 'sync'}) except Exception as e: self.raise_exception(e)