filter unfinished examples and add timer to ensure upper limit of each example

This commit is contained in:
Jason Lee
2024-03-15 16:52:17 +08:00
parent f6b96165e2
commit 815c7ab67c
5 changed files with 166 additions and 59 deletions

16
demo.py Normal file
View File

@@ -0,0 +1,16 @@
import signal
import time
def handler(signo, frame):
raise RuntimeError("Timeout")
signal.signal(signal.SIGALRM, handler)
while True:
try:
signal.alarm(5) # seconds
time.sleep(10)
print("Working...")
except Exception as e :
print(e)
continue