@@ -517,8 +517,6 @@ class OMCSessionRunData:
517517 cmd_model_executable : Optional [str ] = None
518518 # additional library search path; this is mainly needed if OMCProcessLocal is run on Windows
519519 cmd_library_path : Optional [str ] = None
520- # command timeout
521- cmd_timeout : Optional [float ] = 10.0
522520
523521 # working directory to be used on the *local* system
524522 cmd_cwd_local : Optional [str ] = None
@@ -593,13 +591,12 @@ def omc_run_data_update(self, omc_run_data: OMCSessionRunData) -> OMCSessionRunD
593591 """
594592 return self .omc_process .omc_run_data_update (omc_run_data = omc_run_data )
595593
596- @staticmethod
597- def run_model_executable (cmd_run_data : OMCSessionRunData ) -> int :
594+ def run_model_executable (self , cmd_run_data : OMCSessionRunData ) -> int :
598595 """
599596 Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to
600597 keep instances of over classes around.
601598 """
602- return OMCSession .run_model_executable (cmd_run_data = cmd_run_data )
599+ return self . omc_process .run_model_executable (cmd_run_data = cmd_run_data )
603600
604601 def execute (self , command : str ):
605602 return self .omc_process .execute (command = command )
@@ -756,6 +753,19 @@ def __del__(self):
756753 finally :
757754 self ._omc_process = None
758755
756+ def set_timeout (self , timeout : Optional [float ] = None ) -> float :
757+ """
758+ Set the timeout to be used for OMC communication (OMCSession).
759+
760+ The defined value is set and the current value is returned. If None is provided as argument, nothing is changed.
761+ """
762+ retval = self ._timeout
763+ if timeout is not None :
764+ if timeout <= 0.0 :
765+ raise OMCSessionException (f"Invalid timeout value: { timeout } !" )
766+ self ._timeout = timeout
767+ return retval
768+
759769 @staticmethod
760770 def escape_str (value : str ) -> str :
761771 """
@@ -807,11 +817,9 @@ def omcpath_tempdir(self, tempdir_base: Optional[OMCPath] = None) -> OMCPath:
807817
808818 return tempdir
809819
810- @staticmethod
811- def run_model_executable (cmd_run_data : OMCSessionRunData ) -> int :
820+ def run_model_executable (self , cmd_run_data : OMCSessionRunData ) -> int :
812821 """
813- Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to
814- keep instances of over classes around.
822+ Run the command defined in cmd_run_data.
815823 """
816824
817825 my_env = os .environ .copy ()
@@ -828,7 +836,7 @@ def run_model_executable(cmd_run_data: OMCSessionRunData) -> int:
828836 text = True ,
829837 env = my_env ,
830838 cwd = cmd_run_data .cmd_cwd_local ,
831- timeout = cmd_run_data . cmd_timeout ,
839+ timeout = self . _timeout ,
832840 check = True ,
833841 )
834842 stdout = cmdres .stdout .strip ()
0 commit comments