This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Implementation of 2 Phase Commit as explained at Wikipedia: | |
https://en.wikipedia.org/wiki/Two-phase_commit_protocol | |
''' | |
import random, logging, time | |
from threading import Thread, Semaphore, Lock | |
_fmt = '%(user)s:%(levelname)s >>> %(message)s' | |
logging.basicConfig(format=_fmt) | |
LOG = logging.getLogger(__name__) |