From 563a517f7bd1eef20e39aa3cb04a88e63f275f11 Mon Sep 17 00:00:00 2001 From: Matthew Rocklin Date: Wed, 12 Aug 2015 13:31:48 -0700 Subject: [PATCH] call finish callbacks on keyboard interrupt --- dask/async.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dask/async.py b/dask/async.py index 896ae6cbe05..abedb3e3a17 100644 --- a/dask/async.py +++ b/dask/async.py @@ -473,7 +473,11 @@ def fire_task(): # Main loop, wait on tasks to finish, insert new ones while state['waiting'] or state['ready'] or state['running']: - key, res, tb, worker_id = queue.get() + try: + key, res, tb, worker_id = queue.get() + except KeyboardInterrupt: + for f in finish_cbs: + f(dsk, state, True) if isinstance(res, Exception): for f in finish_cbs: f(dsk, state, True)