From 072fc14327dab54b671965e92227f83d2db9ebfc Mon Sep 17 00:00:00 2001 From: Paul RASCLE Date: Thu, 1 Mar 2018 15:19:08 +0100 Subject: [PATCH] fix for concurrent access in yacs schemas --- src/KERNEL_PY/salome_study.py | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/KERNEL_PY/salome_study.py b/src/KERNEL_PY/salome_study.py index c08437325..4b2cd3669 100755 --- a/src/KERNEL_PY/salome_study.py +++ b/src/KERNEL_PY/salome_study.py @@ -396,14 +396,22 @@ def salome_study_init(theStudyPath=None): pass # get active study Id, ref and name - myStudy = None - myStudyId = getActiveStudy() - if myStudyId == None : - import types - if theStudyPath and type(theStudyPath) == types.StringType: - myStudyId = openStudy(theStudyPath) + concurrentCreate=True + while(concurrentCreate): + myStudy = None + myStudyId = getActiveStudy() + if myStudyId == None : + import types + if theStudyPath and type(theStudyPath) == types.StringType: + myStudyId = openStudy(theStudyPath) + else: + try: + myStudyId = createNewStudy() + concurrentCreate=False + except: + print "concurrent createNewStudy, retry" else: - myStudyId = createNewStudy() + concurrentCreate=False if verbose(): print "myStudyId", myStudyId if myStudy == None: -- 2.39.2