def do(self): try: self.lookFor4dFiles() self.lookForBackSync() return True except: tb_text = errorLog(self.processName) gnrlogger.error(tb_text) raise
def do(self): try: self.lookFor4dFiles() self.lookForBackSync() return True except: tb_text = errorLog(self.processName) gnrlogger.error(tb_text) raise
def checkTransactions(self, notify=None): try: todo = True while todo: self._doNoQueue() todo = self._doQueue() except: config = self.config tb_text = errorLog(self.processName) gnrlogger.error(tb_text) raise return self.running
def checkTransactions(self, notify=None): try: todo = True while todo: self._doNoQueue() todo = self._doQueue() except: config = self.config tb_text = errorLog(self.processName) gnrlogger.error(tb_text) raise return self.running
def checkTransactions(self, notify=None): print "Checking -- [%i-%i-%i %02i:%02i:%02i]" % (time.localtime()[:6]) try: todo = True while todo: self._doNoQueue() todo = self._doQueue() except: config = self.config tb_text = errorLog(self.processName) gnrlogger.error(tb_text) raise return self.running
def checkTransactions(self, notify=None): print "Checking -- [%i-%i-%i %02i:%02i:%02i]" % (time.localtime()[:6]) try: todo = True while todo: self._doNoQueue() todo = self._doQueue() except: config = self.config tb_text = errorLog(self.processName) gnrlogger.error(tb_text) raise return self.running
def expandTransaction(self, transaction): trargs = {'id': transaction['id'], 'execution_start': datetime.now()} print transaction['id'] try: tablepath = transaction['maintable'] data = Bag(transaction['data']) action = transaction['action'].strip() mode = transaction['mode'].strip() implementor = transaction['implementor'] if implementor: implementor = implementor.strip() gnrlogger.info("%s -> %s" % (action, tablepath)) if mode == 'import': self.transaction4d.do_import(data, tablepath) elif mode == 'sync': pkg, table = tablepath.split('.', 1) self.transaction4d.do_sync_trigger(data, pkg, table, action) elif implementor: self.executeTransaction(implementor, data) else: raise "unknown mode: '%s' %s" % (str(mode), str(mode == 'import')) trargs['execution_end'] = datetime.now() #self.db.execute("UPDATE gnr.gnr_transaction SET execution_start=:ts_start, execution_end=:ts_end WHERE id=:id;", ts_end=datetime.now(), **trargs) self.db.table(self.transaction_tname).update(trargs) self.db.commit( ) # commit all: before was: actually commit only modification to the transaction. do_ methods commits by themself result = True except: self.db.rollback() errtbl = self.db.table(self.error_tname) errid = errtbl.newPkeyValue() trargs['error_id'] = errid trargs['execution_end'] = datetime.now() #self.db.execute("UPDATE gnr.gnr_transaction SET error_id=:err_id, execution_start=:ts_start, execution_end=:ts_end WHERE id=:id;", err_id=err_id, ts_end=ts_end, **trargs) self.db.table(self.transaction_tname).update(trargs) tb_text = errorLog(self.processName) gnrlogger.error(tb_text) #self.db.execute("INSERT INTO gnr.gnr_error (id, ts, data) VALUES (:id, :ts, :data);", id=err_id, ts=ts_end, data=tb_text) errtbl.insert( dict(id=errid, ts=trargs['execution_end'], data=tb_text)) self.db.commit() result = False self.db.clearCurrentEnv() return result
def expandTransaction(self, transaction): trargs = {'id': transaction['id'], 'execution_start': datetime.now()} print transaction['id'] try: tablepath = transaction['maintable'] data = Bag(transaction['data']) action = transaction['action'].strip() mode = transaction['mode'].strip() implementor = transaction['implementor'] if implementor: implementor = implementor.strip() gnrlogger.info("%s -> %s" % (action, tablepath)) if mode == 'import': self.transaction4d.do_import(data, tablepath) elif mode == 'sync': pkg, table = tablepath.split('.', 1) self.transaction4d.do_sync_trigger(data, pkg, table, action) elif implementor: self.executeTransaction(implementor, data) else: raise "unknown mode: '%s' %s" % (str(mode), str(mode == 'import')) trargs['execution_end'] = datetime.now() #self.db.execute("UPDATE gnr.gnr_transaction SET execution_start=:ts_start, execution_end=:ts_end WHERE id=:id;", ts_end=datetime.now(), **trargs) self.db.table(self.transaction_tname).update(trargs) self.db.commit() # commit all: before was: actually commit only modification to the transaction. do_ methods commits by themself result = True except: self.db.rollback() errtbl = self.db.table(self.error_tname) errid = errtbl.newPkeyValue() trargs['error_id'] = errid trargs['execution_end'] = datetime.now() #self.db.execute("UPDATE gnr.gnr_transaction SET error_id=:err_id, execution_start=:ts_start, execution_end=:ts_end WHERE id=:id;", err_id=err_id, ts_end=ts_end, **trargs) self.db.table(self.transaction_tname).update(trargs) tb_text = errorLog(self.processName) gnrlogger.error(tb_text) #self.db.execute("INSERT INTO gnr.gnr_error (id, ts, data) VALUES (:id, :ts, :data);", id=err_id, ts=ts_end, data=tb_text) errtbl.insert(dict(id=errid, ts=trargs['execution_end'], data=tb_text)) self.db.commit() result = False self.db.clearCurrentEnv() return result