Add cyclic dependence detection.
If a depends on b which depends on a, redo would just freeze. Now it aborts with a somewhat helpful error message. [Updated by apenwarr for coding style and to add a test.]
This commit is contained in:
parent
63f9dcb640
commit
7dd63efb37
8 changed files with 32 additions and 1 deletions
11
vars.py
11
vars.py
|
|
@ -28,3 +28,14 @@ os.environ['REDO_UNLOCKED'] = '' # not inheritable by subprocesses
|
|||
|
||||
NO_OOB = os.environ.get('REDO_NO_OOB', '') and 1 or 0
|
||||
os.environ['REDO_NO_OOB'] = '' # not inheritable by subprocesses
|
||||
|
||||
|
||||
def get_locks():
|
||||
"""Get the list of held locks."""
|
||||
return os.environ.get('REDO_LOCKS', '').split(':')
|
||||
|
||||
def add_lock(name):
|
||||
"""Add a lock to the list of held locks."""
|
||||
locks = set(get_locks())
|
||||
locks.add(name)
|
||||
os.environ['REDO_LOCKS'] = ':'.join(list(locks))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue