alces-software / adminware

A sandbox CLI for running commands remotely across nodes
1 stars 0 forks source link

Clean up the async `start_task` #178

Closed WilliamMcCumstie closed 5 years ago

WilliamMcCumstie commented 5 years ago

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 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.

WilliamMcCumstie commented 5 years ago

Also errors from closing the ssh connection are being caught. This should hopefully fix #177