bored-art-40741
03/23/2016, 10:21 PMbored-art-40741
03/23/2016, 10:26 PM@contextmanager
def owner_printing_file_lock(path):
lock = InterProcessLock(path)
lock.acquire(blocking=False)
if not lock.acquired:
with open(lock.path, 'rb') as f:
lockfile_contents = f.read().decode('utf-8', 'replace')
print('Waiting on pants process to complete: {}'.format(lockfile_contents), file=sys.stderr)
lock.acquire()
with open(lock.path, 'wb') as f:
current_process = psutil.Process()
message = '{} ({})'.format(current_process.pid, ' '.join(current_process.cmdline()))
f.write(message.encode('utf-8'))
yield lock
with open(lock.path, 'w'):
pass
lock.release()
bored-art-40741
03/23/2016, 10:28 PMbored-art-40741
03/23/2016, 10:28 PMbored-art-40741
03/23/2016, 10:28 PMInterProcessLock
themselvesbored-art-40741
03/23/2016, 10:30 PMwitty-crayon-22786
03/23/2016, 10:30 PMmammoth-pharmacist-54215
03/23/2016, 11:34 PMwitty-crayon-22786
03/23/2016, 11:36 PMcreate_file
should be finewitty-crayon-22786
03/23/2016, 11:36 PMwitty-crayon-22786
03/23/2016, 11:36 PMmammoth-pharmacist-54215
03/23/2016, 11:37 PMwitty-crayon-22786
03/23/2016, 11:37 PM*.tools
witty-crayon-22786
03/23/2016, 11:37 PMmammoth-pharmacist-54215
03/23/2016, 11:38 PMwitty-crayon-22786
03/23/2016, 11:40 PMwitty-crayon-22786
03/23/2016, 11:41 PMmammoth-pharmacist-54215
03/23/2016, 11:41 PMmammoth-pharmacist-54215
03/23/2016, 11:41 PMwitty-crayon-22786
03/23/2016, 11:41 PMmammoth-pharmacist-54215
03/23/2016, 11:41 PMwitty-crayon-22786
03/23/2016, 11:41 PM//
means root, but it's not required.witty-crayon-22786
03/23/2016, 11:42 PM//:blah
is a target named blah at the rootwitty-crayon-22786
03/23/2016, 11:42 PMtestprojects:blah
insteadwitty-crayon-22786
03/23/2016, 11:42 PMwitty-crayon-22786
03/23/2016, 11:42 PMwitty-crayon-22786
03/23/2016, 11:42 PMmammoth-pharmacist-54215
03/23/2016, 11:43 PMwitty-crayon-22786
03/23/2016, 11:44 PMmammoth-pharmacist-54215
03/23/2016, 11:44 PM