Skip to content

Commit e094388

Browse files
syntronadeas31
andauthored
improve OMCSessionPort (#388)
* [OMCSessionPort] add missing function / catch possible errors OMCSessionPort is a limited version as we do not know how OMC is run. * [OMCSessionPort] fix exception message --------- Co-authored-by: Adeel Asghar <adeel.asghar@liu.se>
1 parent 16150c7 commit e094388

1 file changed

Lines changed: 17 additions & 1 deletion

File tree

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("OMCSessionPort 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)