Can you give a task submitted to a client a timeout. As in if task X didnt complete in Y seconds terminate?
I see the use of dask.distributed.wait but does the timeout actually stop tasks from continuing to run?
Can you give a task submitted to a client a timeout. As in if task X didnt complete in Y seconds terminate?
I see the use of dask.distributed.wait but does the timeout actually stop tasks from continuing to run?
Hi @Niphemy,
As far as I know, you can’t.
No it doesn’t.
So what you can do here, is using the wait
functionality, and cancel the task if it throws the exception.
Something like:
import dask
from distributed import Client
import time
from distributed import wait
def my_long_running_task():
time.sleep(120)
client = Client()
future = client.submit(my_long_running_task)
try:
wait(future, '10s')
except:
client.cancel(future)