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 arg send_reply so that the server send a reply to the client executing the stream, this avoid the client executing other things after sending
  • Override vtkSMProxy::ExecuteStream and vtkSMSourceProxy::ExecuteStream to use the new send_reply arg
  • In pqProgressManager, instead of using GetClientSideObject() to abort, instead set a flag in using vtkPVProgressHandler::Abort(gid)
  • In vtkPVProgressHandler, add a Abort(gid) method that just store the info
  • in vtkPVProgressHandler, add a CheckAbort method, 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 call SetAbortExecuteAndUpdateTime on the algorithm server side
  • In vtkSISourceProxy, connect to the AbortCheckEvent (invoked by vtkAlgorithm::CheckAbort) to call ReduceAbort
  • Add vtkSISourceProxt::ReduceAbort, that reduce abort flag with a logical "OR" and then call SetAbortExecuteAndUpdateTime on 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)

Merge request reports

Loading