This PR cleans up the start_task async method. Most of the changes are code readability changes and do not affect functionality.
There has been a change in the control logic concerning interrupt. Previously all the futures where being cancelled. This is fine for the JobTasks as this triggers them to shutdown as expected. However it also cancels the main future which is running start_tasks. This will kill the event loop prematurely and makes the callback behaviour of the other futures difficult to predict.
Instead the start_tasks will catch the CancelledError and still shutdown as per normal. This prevents additional futures from starting BUT allows currently running (/recently cancelled) futures to shutdown gracefully.
Based on #176
This PR cleans up the
start_task
async method. Most of the changes are code readability changes and do not affect functionality.There has been a change in the control logic concerning interrupt. Previously all the futures where being cancelled. This is fine for the
JobTask
s as this triggers them to shutdown as expected. However it also cancels the main future which is runningstart_tasks
. This will kill the event loop prematurely and makes the callback behaviour of the other futures difficult to predict.Instead the
start_tasks
will catch theCancelledError
and still shutdown as per normal. This prevents additional futures from starting BUT allows currently running (/recently cancelled) futures to shutdown gracefully.