class DBLoader(Bolt): def initialize(self, storm_conf, context): self.db_adaptor = DataBaseAdaptor() #TODO: stub def process(self, tup): try: if (tup.stream == "pro"): self.db_adaptor.postPositive(*tup.values) elif (tup.stream == "con"): self.db_adaptor.postNegative(*tup.values) else: self.logger.log("ERROR: got bad tuple") except: import sys, traceback msg = "Unexpected DBLoader (action: %d) error:%s" % (action_num, "\n".join(traceback.format_exception(*sys.exc_info()))) self.logger.error(msg)
def initialize(self, storm_conf, context): self.db_adaptor = DataBaseAdaptor()