File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 11# SPDX-License-Identifier: Apache-2.0
22# Copyright (c) 2024, Ampere Computing LLC
33import os
4+ import signal
45import time
56import unittest
67import subprocess
1112from multiprocessing import Process , Queue
1213
1314TIMEOUT = 3 * 60 * 60
15+ pid = os .getpid ()
1416
1517
1618def run_process (wrapper , kwargs ):
19+ def wrapper_outer (** kwargs ):
20+ try :
21+ wrapper (** kwargs )
22+ except Exception as e :
23+ print (f"\n Exception encountered: { e } " )
24+ os .kill (pid , signal .SIGTERM )
25+
1726 start = time .time ()
1827 output_queue = Queue ()
1928 kwargs .update ({"q" : output_queue })
20- p = Process (target = wrapper , kwargs = kwargs )
29+ p = Process (target = wrapper_outer , kwargs = kwargs )
2130 p .start ()
2231 output = output_queue .get (block = True , timeout = max (0 , int (TIMEOUT - (time .time () - start ))))
2332 p .join (timeout = max (0 , int (TIMEOUT - (time .time () - start ))))
You can’t perform that action at this time.
0 commit comments