@@ -620,14 +620,14 @@ def _multi_connect(self, n_attempts=5, timeout=15):
620620 # Start monitoring thread to check if MAPDL is alive
621621 monitor_stop_event = threading .Event ()
622622 monitor_exception = {"error" : None }
623-
623+
624624 def monitor_mapdl_alive ():
625625 """Monitor thread to check if MAPDL process is alive."""
626626 from ansys .mapdl .core .launcher import (
627627 _check_file_error_created ,
628628 _check_process_is_alive ,
629629 )
630-
630+
631631 try :
632632 while not monitor_stop_event .is_set ():
633633 # Only monitor if we have a local process
@@ -641,10 +641,10 @@ def monitor_mapdl_alive():
641641 monitor_exception ["error" ] = e
642642 monitor_stop_event .set ()
643643 break
644-
644+
645645 # Check every 0.5 seconds
646646 monitor_stop_event .wait (0.5 )
647-
647+
648648 except Exception as e :
649649 self ._log .debug (f"Monitor thread encountered error: { e } " )
650650 monitor_exception ["error" ] = e
@@ -662,19 +662,23 @@ def monitor_mapdl_alive():
662662 while time .time () < max_time and i <= n_attempts :
663663 # Check if monitoring thread detected a problem
664664 if monitor_exception ["error" ] is not None :
665- self ._log .debug ("Monitor detected MAPDL process issue, stopping connection attempts" )
665+ self ._log .debug (
666+ "Monitor detected MAPDL process issue, stopping connection attempts"
667+ )
666668 raise monitor_exception ["error" ]
667-
669+
668670 self ._log .debug ("Connection attempt %d" , i )
669671 connected = self ._connect (timeout = attempt_timeout )
670672 i += 1
671673 if connected :
672674 self ._log .debug ("Connected" )
673675 break
674-
676+
675677 # Check again after connection attempt
676678 if monitor_exception ["error" ] is not None :
677- self ._log .debug ("Monitor detected MAPDL process issue after connection attempt" )
679+ self ._log .debug (
680+ "Monitor detected MAPDL process issue after connection attempt"
681+ )
678682 raise monitor_exception ["error" ]
679683 else :
680684 # Check if mapdl process is alive
0 commit comments