simpleflow
simpleflow copied to clipboard
Add timeout around execution of external Python program
It would be useful to let the user define a timeout value when using the decorator @execute.python().
Eg:
import time
def sleep_and_return(seconds):
time.sleep(seconds)
return seconds
func = execute.python(timeout=0.5)(sleep_and_return) # <== adding a new "timeout" parameter
result = func(10) # <== It would be nice to raise after 0.5 seconds.