put lock file in project root dir

This commit is contained in:
Chris Meyers 2017-04-11 16:53:13 -04:00
parent 648aa470d7
commit 7919c47370
2 changed files with 4 additions and 4 deletions

View File

@ -210,9 +210,9 @@ class ProjectOptions(models.Model):
def get_lock_file(self):
proj_path = self.get_project_path()
if proj_path:
return os.path.join(proj_path, 'tower_sync.lock')
return None
if not proj_path:
return None
return proj_path + '.lock'
class Project(UnifiedJobTemplate, ProjectOptions, ResourceMixin):

View File

@ -1326,7 +1326,7 @@ class RunProjectUpdate(BaseTask):
def acquire_lock(self, instance, blocking=True):
lock_path = instance.get_lock_file()
if lock_path is None:
raise RuntimeError(u'Invalid file %s' % instance.get_lock_file())
raise RuntimeError(u'Invalid lock file path')
# May raise IOError
self.lock_fd = os.open(lock_path, os.O_RDONLY | os.O_CREAT)