@@ -50,14 +50,15 @@ def execute_script(
5050 timeout : Optional [int ] = None ,
5151) -> tuple [int , str , Optional [str ]]:
5252 temp_file_path = None
53+ script_timeout = timeout if timeout is not None else SCRIPT_EXECUTION_TIMEOUT
5354 try :
5455 start_time = time .time ()
5556 result = subprocess .run (
5657 [file_utils .add_current_path_if_no_path (script )] + scripts_args ,
5758 stdout = subprocess .PIPE ,
5859 stderr = subprocess .STDOUT ,
5960 text = True ,
60- timeout = timeout if timeout is not None else SCRIPT_EXECUTION_TIMEOUT ,
61+ timeout = script_timeout ,
6162 )
6263 elapsed_time = time .time () - start_time
6364 # Log the info about the script execution
@@ -95,19 +96,19 @@ def execute_script(
9596 # Store timeout output in a temporary file
9697 if verbose :
9798 with tempfile .NamedTemporaryFile (mode = "w+" , delete = False , suffix = ".script_timeout" ) as temp_file :
98- temp_file .write (f"{ script_type } script { script } timed out after { SCRIPT_EXECUTION_TIMEOUT } seconds." )
99+ temp_file .write (f"{ script_type } script { script } timed out after { script_timeout } seconds." )
99100 if e .stdout :
100101 decoded_output = e .stdout .decode ("utf-8" ) if isinstance (e .stdout , bytes ) else e .stdout
101102 temp_file .write (f"{ script_type } script partial output before the timeout:\n { decoded_output } " )
102103 else :
103104 temp_file .write (f"{ script_type } script did not produce any output before the timeout." )
104105 temp_file_path = temp_file .name
105106 console .warning (
106- f"The { script_type } script timed out after { SCRIPT_EXECUTION_TIMEOUT } seconds. { script_type } script output stored in: { temp_file_path } "
107+ f"The { script_type } script timed out after { script_timeout } seconds. { script_type } script output stored in: { temp_file_path } "
107108 )
108109
109110 return (
110111 TIMEOUT_ERROR_EXIT_CODE ,
111- f"{ script_type } script did not finish in { SCRIPT_EXECUTION_TIMEOUT } seconds." ,
112+ f"{ script_type } script did not finish in { script_timeout } seconds." ,
112113 temp_file_path ,
113114 )
0 commit comments