def trans(txn): self.assertFalse(threadable.isInIOThread(), "Transactions must not run in main thread") yield Transaction(name="TEST1").save() yield Transaction(name="TEST2").save() barrier.wait() # wait here to delay commit returnValue("return value")
def trans(txn): yield Transaction(name="TEST1").save() yield Transaction(name="TEST2").save() barrier.wait() # wait here to delay commit raise ZeroDivisionError()
def trans1(txn): yield Transaction(name="TEST3").save() with transaction() as txn2: yield Transaction(name="TEST4").save() txn2.rollback()
def trans2(txn): yield Transaction(name="TEST1").save() with nested_transaction(): yield Transaction(name="TEST2").save() yield trans1() yield Transaction(name="TEST5").save()
def trans(txn, i): yield Transaction(name=str(i)).save() if i % 2 == 1: txn.rollback() else: txn.commit()
def trans1(txn): yield Transaction(name="TEST1").save() with nested_transaction() as txn2: yield Transaction(name="TEST2").save() txn2.rollback() yield Transaction(name="TEST3").save()
def trans2(txn): threadIds.append(threadable.getThreadID()) on_trans1_insert.wait() yield Transaction(name="TEST1").save() barrier2.wait() # wait here to delay commit
def trans2(txn): yield Transaction(name="TEST2").save() yield trans1() barrier.wait() # wait here to delay commit
def trans1(txn): yield Transaction(name="TEST1").save() txn.rollback() # should propagate to the root transaction
def trans2(txn): threadIds.append(threadable.getThreadID()) yield trans1() yield Transaction(name="TEST2").save() barrier.wait() # wait here to delay commit
def trans1(txn): threadIds.append(threadable.getThreadID()) yield Transaction(name="TEST1").save()