Skip to content

Commit

Permalink
Handle problem with multiple jobs checking the same folder at the sam…
Browse files Browse the repository at this point in the history
…e time, by sleeping randomly up to 1 sec
  • Loading branch information
samuell committed Sep 10, 2015
1 parent 1e028c3 commit ab41eb7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sciluigi/audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ def add_auditinfo(self, infotype, infoval):

def _add_auditinfo(self, instance_name, infotype, infoval):
dirpath = self.workflow_task.get_auditdirpath()
if not os.path.exists(dirpath):
os.makedirs(dirpath)
if not os.path.isdir(dirpath):
time.sleep(random.random())
if not os.path.isdir(dirpath):
os.makedirs(dirpath)

auditfile = os.path.join(dirpath, instance_name)
if not os.path.exists(auditfile):
Expand Down

0 comments on commit ab41eb7

Please sign in to comment.