@@ -128,9 +128,17 @@ def __run_ret_code_with_retry(
128128 # TODO: remove_timestamp can be implemented in a shallower way...
129129 for retry_index in range (self .conf .retry_count + 1 ):
130130 try :
131- return self ._run_ret_code (
131+ start = time .time ()
132+ log_output , return_code = self ._run_ret_code (
132133 entry , local_path , env , running_extra_volume = running_extra_volume , remove_timestamp = remove_timestamp
133134 )
135+ end = time .time ()
136+ if end - start >= self .conf .running_timeout_period :
137+ print (
138+ f"[red]The running time exceeds { self .conf .running_timeout_period } seconds, so the process is killed.[/red]"
139+ )
140+ log_output += f"\n \n The running time exceeds { self .conf .running_timeout_period } seconds, so the process is killed."
141+ return log_output , return_code
134142 except Exception as e :
135143 if retry_index == self .conf .retry_count :
136144 raise
@@ -331,6 +339,7 @@ def _run_ret_code(
331339 "env" : env ,
332340 "volumes" : volumns ,
333341 }
342+ print (Rule ("[bold green]LocalEnv Logs Begin[/bold green]" , style = "dark_orange" ))
334343 print (Pretty (summary ))
335344
336345 cwd = None
@@ -340,6 +349,7 @@ def _run_ret_code(
340349 result = subprocess .run (entry , cwd = cwd , env = {** os .environ , ** env }, capture_output = True , text = True , shell = True )
341350 combined_output = result .stderr + result .stdout # Combine stdout and stderr
342351 print (combined_output ) # Display the combined output in the console
352+ print (Rule ("[bold green]LocalEnv Logs End[/bold green]" , style = "dark_orange" ))
343353
344354 return combined_output , result .returncode
345355
@@ -604,7 +614,6 @@ def _run_ret_code(
604614 log_output = ""
605615
606616 try :
607- start = time .time ()
608617 container : docker .models .containers .Container = client .containers .run ( # type: ignore[no-any-unimported]
609618 image = self .conf .image ,
610619 command = entry ,
@@ -638,12 +647,6 @@ def _run_ret_code(
638647 exit_status = container .wait ()["StatusCode" ]
639648 container .stop ()
640649 container .remove ()
641- end = time .time ()
642- if end - start >= self .conf .running_timeout_period :
643- print (
644- f"[red]The running time exceeds { self .conf .running_timeout_period } seconds, so the process is killed.[/red]"
645- )
646- log_output += f"\n \n The running time exceeds { self .conf .running_timeout_period } seconds, so the process is killed."
647650 print (Rule ("[bold green]Docker Logs End[/bold green]" , style = "dark_orange" ))
648651 return log_output , exit_status
649652 except docker .errors .ContainerError as e :
0 commit comments