Draft: Add support for aborting in client/server mode
ParaView (kinda) supports aborting filters in built-in mode.
This rework this abort feature by adding client/server support to it. It is based on vtk/vtk#18463 and the c/s communication is described here: https://discourse.paraview.org/t/paraview-client-server-communication-and-abort-support/17430
Both are must-read before reviewing.
In essence:
- In
vtkPVSessionServer::ExecuteStream/vtkSMSessionClient::ExecuteStream, add an optional argsend_replyso that the server send a reply to the client executing the stream, this avoid the client executing other things after sending - Override
vtkSMProxy::ExecuteStreamandvtkSMSourceProxy::ExecuteStreamto use the newsend_replyarg - In
pqProgressManager, instead of usingGetClientSideObject()to abort, instead set a flag in usingvtkPVProgressHandler::Abort(gid) - In
vtkPVProgressHandler, add aAbort(gid)method that just store the info - in
vtkPVProgressHandler, add aCheckAbortmethod, that is intended to be called by both Server and Client after respectively sending/receiving progress - in
vtkPVProgressHandler::CheckAbort, send the abort flag stored previously from client to server, the server then callSetAbortExecuteAndUpdateTimeon the algorithm server side - In
vtkSISourceProxy, connect to theAbortCheckEvent(invoked byvtkAlgorithm::CheckAbort) to callReduceAbort - Add
vtkSISourceProxt::ReduceAbort, that reduce abort flag with a logical "OR" and then callSetAbortExecuteAndUpdateTimeon all processes if needed (only in MPI mode) - in pqApplyBehavior, when applying again, ClearAbort flags using dedicated API in SM/SI source proxy
- in pqApplyBehavior, handle enableAbort properly
Here is how to test the feature:
- Wavelet, -1000,1000,-1000,1000,-100,100, Apply
- Wait for a progress event to come in
- Press abort button multiple times until it get registered
- Abort should work and the filter should stop
Tested in:
- builtin
- c/s
- c/r/s
- distributed c/s
- distributed c/r/s
- any source in the pipeline that have progress events
- uneven distribution
TODO:
- Testing ?
- Option for the MPI part for stability
- Cleanup
- check on macOS manually
- add doc
- check each filter from vtk/vtk#18463
- check each important filter
Edited by Mathieu Westphal (Kitware)