Skip to content

Commit

Permalink
fix: test and adding more logging
Browse files Browse the repository at this point in the history
  • Loading branch information
germa89 committed Aug 8, 2024
1 parent 70ef0d0 commit 6d886c9
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions src/ansys/mapdl/core/mapdl_grpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -2559,17 +2559,35 @@ def _download_as_raw(self, target_name: str) -> str:
@property
def is_alive(self) -> bool:
"""True when there is an active connect to the gRPC server"""
if self.channel_state not in ["IDLE", "READE"]:
if self.channel_state not in ["IDLE", "READY"]:
self._log.debug(
"MAPDL instance is not alive because the channel is not 'IDLE' o 'READY'."
)
return False

if self._exited:
self._log.debug("MAPDL instance is not alive because it is exited.")
return False
if self.busy:
self._log.debug("MAPDL instance is alive because it is busy.")
return True

try:
return bool(self._ctrl("VERSION"))
except Exception:
check = bool(self._ctrl("VERSION"))
if check:
self._log.debug(
"MAPDL instance is alive because version was retrieved."
)
else:
self._log.debug(
"MAPDL instance is not alive because version was not retrieved. Maybe output is muted?."
)
return check

except Exception as error:
self._log.debug(
f"MAPDL instance is not alive because retrieving version failed with:\n{error}"
)
return False

@property
Expand Down

0 comments on commit 6d886c9

Please sign in to comment.