Skip to content

Commit ee5aa21

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 0e6ff4f commit ee5aa21

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
@@ -1022,11 +1022,27 @@ def __init__(
10221022
super().__init__()
10231023
self._omc_port = omc_port
10241024

1025+
@staticmethod
1026+
def run_model_executable(cmd_run_data: OMCSessionRunData) -> int:
1027+
"""
1028+
Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to
1029+
keep instances of over classes around.
1030+
"""
1031+
raise OMCSessionException(f"({self.__class__.__name__}) does not support run_model_executable()!")
1032+
1033+
def get_log(self) -> str:
1034+
"""
1035+
Get the log file content of the OMC session.
1036+
"""
1037+
log = f"No log available if OMC session is defined by port ({self.__class__.__name__})"
1038+
1039+
return log
1040+
10251041
def omc_run_data_update(self, omc_run_data: OMCSessionRunData) -> OMCSessionRunData:
10261042
"""
10271043
Update the OMCSessionRunData object based on the selected OMCSession implementation.
10281044
"""
1029-
raise OMCSessionException("OMCSessionPort does not support omc_run_data_update()!")
1045+
raise OMCSessionException(f"({self.__class__.__name__}) does not support omc_run_data_update()!")
10301046

10311047

10321048
class OMCSessionLocal(OMCSession):

0 commit comments

Comments
 (0)