Skip to content

Commit

Permalink
debug file lock
Browse files Browse the repository at this point in the history
  • Loading branch information
ericzundel committed Oct 18, 2016
1 parent 478cd34 commit 755d840
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
revision.major.org.pantsbuild%args4j=0
revision.minor.org.pantsbuild%args4j=0
revision.patch.org.pantsbuild%args4j=12
revision.patch.org.pantsbuild%args4j=13
revision.snapshot.org.pantsbuild%args4j=false
revision.named_is_latest.org.pantsbuild%args4j=false
revision.sha.org.pantsbuild%args4j=0dbaded79cbfafe4b55834b0d7d3c90b4a32e74b
revision.fingerprint.org.pantsbuild%args4j=225695d9bb8eb994b159110bdedc6a7324a336a7
revision.sha.org.pantsbuild%args4j=478cd348eef6a45ac2c84760b2f6692c173c1c2d
revision.fingerprint.org.pantsbuild%args4j=aeed6ff94f6d01c34f2d77101e783f1908ed133c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
revision.major.org.pantsbuild%junit-runner=1
revision.minor.org.pantsbuild%junit-runner=0
revision.patch.org.pantsbuild%junit-runner=14
revision.patch.org.pantsbuild%junit-runner=15
revision.snapshot.org.pantsbuild%junit-runner=false
revision.named_is_latest.org.pantsbuild%junit-runner=false
revision.sha.org.pantsbuild%junit-runner=f46e0702f4409d982b79cab9a3789b35090d46a4
revision.fingerprint.org.pantsbuild%junit-runner=ea8278577c776320bad1d3491f4fbd55a322a597
revision.sha.org.pantsbuild%junit-runner=857ffbdadda3d6123587273fdfedf9e3404e552b
revision.fingerprint.org.pantsbuild%junit-runner=2cb43ca53478341411202cb4559f761cdaaea8a8
7 changes: 4 additions & 3 deletions src/python/pants/process/lock.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import errno
import logging
import os
import sys

import psutil
Expand All @@ -30,8 +31,8 @@ def message_path(self):
@property
def missing_message_output(self):
return (
'Waiting for a file lock ({}), but there was no message at {} indicating who is holding it.'
.format(self.path, self.message_path)
'Pid {} waiting for a file lock ({}), but there was no message at {} indicating who is holding it.'
.format(os.getpid(), self.path, self.message_path)
)

def acquire(self, message_fn=print_to_stderr, **kwargs):
Expand All @@ -40,7 +41,7 @@ def acquire(self, message_fn=print_to_stderr, **kwargs):
try:
with open(self.message_path, 'rb') as f:
message = f.read().decode('utf-8', 'replace')
output = 'Waiting for a file lock ({}) held by: {}'.format(self.path, message)
output = 'PID {} waiting for a file lock ({}) held by: {}'.format(os.getpid(), self.path, message)
except IOError as e:
if e.errno == errno.ENOENT:
output = self.missing_message_output
Expand Down

0 comments on commit 755d840

Please sign in to comment.