From ab41eb703824711c696060083329aa627a08d616 Mon Sep 17 00:00:00 2001 From: Samuel Lampa Date: Thu, 10 Sep 2015 17:24:48 +0200 Subject: [PATCH] Handle problem with multiple jobs checking the same folder at the same time, by sleeping randomly up to 1 sec --- sciluigi/audit.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sciluigi/audit.py b/sciluigi/audit.py index b0d72a3..462921d 100644 --- a/sciluigi/audit.py +++ b/sciluigi/audit.py @@ -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):