@@ -488,8 +488,6 @@ class OMCSessionRunData:
488488 cmd_model_executable : Optional [str ] = None
489489 # additional library search path; this is mainly needed if OMCProcessLocal is run on Windows
490490 cmd_library_path : Optional [str ] = None
491- # command timeout
492- cmd_timeout : Optional [float ] = 10.0
493491
494492 # working directory to be used on the *local* system
495493 cmd_cwd_local : Optional [str ] = None
@@ -564,13 +562,12 @@ def omc_run_data_update(self, omc_run_data: OMCSessionRunData) -> OMCSessionRunD
564562 """
565563 return self .omc_process .omc_run_data_update (omc_run_data = omc_run_data )
566564
567- @staticmethod
568- def run_model_executable (cmd_run_data : OMCSessionRunData ) -> int :
565+ def run_model_executable (self , cmd_run_data : OMCSessionRunData ) -> int :
569566 """
570567 Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to
571568 keep instances of over classes around.
572569 """
573- return OMCSession .run_model_executable (cmd_run_data = cmd_run_data )
570+ return self . omc_process .run_model_executable (cmd_run_data = cmd_run_data )
574571
575572 def execute (self , command : str ):
576573 return self .omc_process .execute (command = command )
@@ -727,6 +724,19 @@ def __del__(self):
727724 finally :
728725 self ._omc_process = None
729726
727+ def set_timeout (self , timeout : Optional [float ] = None ) -> float :
728+ """
729+ Set the timeout to be used for OMC communication (OMCSession).
730+
731+ The defined value is set and the current value is returned. If None is provided as argument, nothing is changed.
732+ """
733+ retval = self ._timeout
734+ if timeout is not None :
735+ if timeout <= 0.0 :
736+ raise OMCSessionException (f"Invalid timeout value: { timeout } !" )
737+ self ._timeout = timeout
738+ return retval
739+
730740 @staticmethod
731741 def escape_str (value : str ) -> str :
732742 """
@@ -778,11 +788,9 @@ def omcpath_tempdir(self, tempdir_base: Optional[OMCPath] = None) -> OMCPath:
778788
779789 return tempdir
780790
781- @staticmethod
782- def run_model_executable (cmd_run_data : OMCSessionRunData ) -> int :
791+ def run_model_executable (self , cmd_run_data : OMCSessionRunData ) -> int :
783792 """
784- Run the command defined in cmd_run_data. This class is defined as static method such that there is no need to
785- keep instances of over classes around.
793+ Run the command defined in cmd_run_data.
786794 """
787795
788796 my_env = os .environ .copy ()
@@ -799,7 +807,7 @@ def run_model_executable(cmd_run_data: OMCSessionRunData) -> int:
799807 text = True ,
800808 env = my_env ,
801809 cwd = cmd_run_data .cmd_cwd_local ,
802- timeout = cmd_run_data . cmd_timeout ,
810+ timeout = self . _timeout ,
803811 check = True ,
804812 )
805813 stdout = cmdres .stdout .strip ()
0 commit comments