If a user tries to remove a wf from the Wf Runs Component that is still being executed - they will we warned that this is not recommended but if they wish to proceed with deletion they can. The deletion of data will begin immediately - this can potentially lead to problems since we cannot actually stop the wf run - we can only remove it from the Wf Runs Component and delete data from Ref. Manager's store. Deleting data from Ref. Manager's store for a wf that is still running in the background (though not being shown in the GUI) could cause exceptions but the user has been warned. These exceptions should be ignored by the user since this is what they wanted. I have not seen such problems while testing but they could (logically) arise.
There are several cases where a wf run needs to be deleted.
(1) Explicit action by the user from the Wf Runs Component - deletion is started immediately on a separate deletion thread. If stopping of this thread is requested - the runs not yet deleted are scheduled for deletion and persisted to a file and will be deleted the next time Taverna starts.
(2) Cases when provenance is OFF, or provenance is ON but Ref. Manager uses IN-MEMORY storage. Implicit deletion is started on Taverna shutdown by placing such runs in the deletion queue and persisting it to a file from where they will be deleted the next time Taverna starts up.
This logic seems to be working fine and I am yet to experience database lock even when deleting currently running wfs; quitting Taverna while wfs are running; or quitting Taverna while wfs are scheduled for deletion.