]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
Modifications from Erwan Adam for bug PAL12406 : Improvement of batchmode_salome. V2_2_0_maintainance_FINAL
authormkr <mkr@opencascade.com>
Thu, 18 May 2006 10:54:23 +0000 (10:54 +0000)
committermkr <mkr@opencascade.com>
Thu, 18 May 2006 10:54:23 +0000 (10:54 +0000)
src/SALOME_SWIG_WITHOUTIHM/batchmode_salome.py

index 3897916229c63a52fb4a1cbdcbf50c6918c353a1..8ec4c6865a290984a19e4405f3c0bab2ea79763f 100755 (executable)
@@ -216,10 +216,16 @@ def FindFileInDataDir(filename):
 orb = None
 
 step = 0
-while step < 100 and orb is None:
+sleeping_time = 0.01
+sleeping_time_max = 1.0
+while 1:
     orb = CORBA.ORB_init([''], CORBA.ORB_ID)
+    if orb is not None: break
     step = step + 1
-    time.sleep(4)
+    if step > 100: break
+    time.sleep(sleeping_time)
+    sleeping_time = max(sleeping_time_max, 2*sleeping_time)
+    pass
 
 if orb is None:
     print "Warning: ORB has not been initialized !!!"
@@ -228,11 +234,17 @@ if orb is None:
 lcc = LifeCycleCORBA(orb)
 
 step = 0
-while step < 100 and lcc._catalog is None:
+sleeping_time = 0.01
+sleeping_time_max = 1.0
+while 1:
     lcc = LifeCycleCORBA(orb)
+    if lcc._catalog is not None: break
     step = step + 1
-    time.sleep(4)
-    
+    if step > 100: break
+    time.sleep(sleeping_time)
+    sleeping_time = max(sleeping_time_max, 2*sleeping_time)
+    pass
+
 if lcc._catalog is None:
     print "Warning: LifeCycleCORBA object is incomplete !!!"
     
@@ -243,11 +255,17 @@ naming_service = SALOME_NamingServicePy_i(orb)
 obj = None
 
 step = 0
-while step < 100 and obj == None:
+sleeping_time = 0.01
+sleeping_time_max = 1.0
+while 1:
     obj = naming_service.Resolve('myStudyManager')
+    if obj is not None:break
     step = step + 1
-    time.sleep(4)
-     
+    if step > 100: break
+    time.sleep(sleeping_time)
+    sleeping_time = max(sleeping_time_max, 2*sleeping_time)
+    pass
+
 myStudyManager = obj._narrow(SALOMEDS.StudyManager)
 
 if myStudyManager is None:
@@ -265,5 +283,5 @@ else:
 myStudyName = myStudy._get_Name()
 
 myStudyId = myStudy._get_StudyId()
-print myStudyId
+print myStudyId