From ea4c992fc0c5aa91bfaa9a944d3604a18b04d11d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20S=C3=A9n=C3=A9si?= Date: Tue, 8 Aug 2023 15:10:31 +0200 Subject: [PATCH] Fix concurrency issue in makedirs(tmpdir); don't use pdfjam at TGCC and IDRIS os.makedirs(tmpdir) more robust --- env/environment.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/env/environment.py b/env/environment.py index d0af77bf..3bb41a58 100644 --- a/env/environment.py +++ b/env/environment.py @@ -124,9 +124,10 @@ def my_which(soft): if "TMPDIR" in os.environ and not os.path.isdir(os.environ["TMPDIR"]): # raise OSError("TMPDIR points to a non existing directory! Change the value of the variable to go on.") tmpdir = os.environ["TMPDIR"] - if os.path.exists(tmpdir): + if os.path.isfile(tmpdir): os.remove(tmpdir) - os.makedirs(tmpdir) + # Account for the case where concurrent jobs execute this line almost simultaneously + os.makedirs(tmpdir, exist_OK=True) # Check dependencies try: @@ -224,7 +225,7 @@ def my_which(soft): stamping = None clogger.info("---") -if atCNRM or atIPSL: +if atCNRM or onSpirit or atTGCC or atIDRIS: pdf_page_builder = os.sep.join([os.path.dirname( os.path.abspath(__file__)), "..", "scripts", "generate_pdf.py"]) else: