]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
End of management of foreground in SSL context
authorAnthony Geay <anthony.geay@edf.fr>
Mon, 21 Feb 2022 07:39:32 +0000 (08:39 +0100)
committerAnthony Geay <anthony.geay@edf.fr>
Mon, 21 Feb 2022 07:39:32 +0000 (08:39 +0100)
bin/runSalome.py

index e0c800e33d2b70bfeeee63236d9bc2e1da08e9b6..c190da15cae949918c240926d3c3d693c5621940 100755 (executable)
@@ -193,38 +193,53 @@ def main(exeName=None):
 
 def foreGround(args, ior_fakens_filename):
     # --
+    gui_detected = False
+    dt = 0.1
+    nbtot = 100
+    nb = 0
     if ior_fakens_filename is None:
+        logger.warn("No file set to host IOR of the fake naming server")
         return
     if not os.path.exists(ior_fakens_filename):
+        logger.warn("No file {} set to host IOR of the fake naming server does not exit !")
         return
     import CORBA
     import Engines
+    import SALOME
+    from time import sleep
     orb = CORBA.ORB_init([''], CORBA.ORB_ID)
     ior_fakens = None
-    try:
-        ior_fakens = orb.string_to_object(open(ior_fakens_filename).read())
-    except Exception:
-        pass
-    session = orb.string_to_object(ior_fakens.Resolve("/Kernel/Session").decode())
+    session = None
+    while True:
+        try:
+            ior_fakens = orb.string_to_object(open(ior_fakens_filename).read())
+            session = orb.string_to_object(ior_fakens.Resolve("/Kernel/Session").decode())
+        except Exception:
+            pass
+        if ( session is not None ) and (not CORBA.is_nil(session)):
+            logger.debug("Session in child process has been found ! yeah ! {}".format(str(session)))
+            break
+        sleep(dt)
+        nb += 1
+        logger.debug("Unfortunately Session not found into {} : Sleep and retry. {}/{}".format(ior_fakens_filename,nb,nbtot))
+        if nb == nbtot:
+            break
+    nb = 0
     # --
     # Wait until gui is arrived
     # tmax = nbtot * dt
     # --
-    gui_detected = False
-    dt = 0.1
-    nbtot = 100
-    nb = 0
     session_pid = None
     while 1:
         try:
             status = session.GetStatSession()
             gui_detected = status.activeGUI
             session_pid = session.getPID()
+            logger.debug("Process of the session under monitoring {}".format(session_pid))
         except Exception:
             pass
         if gui_detected:
             break
-        from time import sleep
         sleep(dt)
         nb += 1
         if nb == nbtot: