Skip to content

Commit d42e051

Browse files
committed
[OMCSessionPort] add missing function / catch possible errors
OMCSessionPort is a limited version as we do not know how OMC is run.
1 parent 298245d commit d42e051

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

OMPython/OMCSession.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1051,11 +1051,27 @@ def __init__(
10511051
super().__init__()
10521052
self._omc_port = omc_port
10531053

1054+
@staticmethod
1055+
def run_model_executable(cmd_run_data: OMCSessionRunData) -> int:
1056+
"""
1057+
Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to
1058+
keep instances of over classes around.
1059+
"""
1060+
raise OMCSessionException(f"({self.__class__.__name__}) does not support run_model_executable()!")
1061+
1062+
def get_log(self) -> str:
1063+
"""
1064+
Get the log file content of the OMC session.
1065+
"""
1066+
log = f"No log available if OMC session is defined by port ({self.__class__.__name__})"
1067+
1068+
return log
1069+
10541070
def omc_run_data_update(self, omc_run_data: OMCSessionRunData) -> OMCSessionRunData:
10551071
"""
10561072
Update the OMCSessionRunData object based on the selected OMCSession implementation.
10571073
"""
1058-
raise OMCSessionException("OMCSessionPort does not support omc_run_data_update()!")
1074+
raise OMCSessionException(f"({self.__class__.__name__}) does not support omc_run_data_update()!")
10591075

10601076

10611077
class OMCSessionLocal(OMCSession):

0 commit comments

Comments
 (0)