Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 12 additions & 5 deletions src/ansys/mapdl/core/mapdl_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

"""Module to control interaction with MAPDL through Python"""

from enum import StrEnum
from functools import wraps
import glob
import logging
Expand Down Expand Up @@ -233,6 +234,12 @@
]


class STATUS(StrEnum):
EXITED = "exited"
EXITING = "exiting"
RUNNING = "running"


def parse_to_short_cmd(command):
"""Takes any MAPDL command and returns the first 4 characters of
the command
Expand Down Expand Up @@ -472,18 +479,18 @@ def chain_commands(self):
return self._chain_commands(self)

@property
def check_status(self):
def check_status(self) -> STATUS:
"""Return MAPDL status.
* 'exited' if MAPDL is exited
* 'exiting' if MAPDL is exiting
* Otherwise returns 'OK'.
* Otherwise returns 'running'.
"""
if self.exited:
return "exited"
return STATUS.EXITED
elif self.exiting:
return "exiting"
return STATUS.EXITING
else:
return "OK"
return STATUS.RUNNING

@property
def components(self) -> "ComponentManager":
Expand Down
Loading