Skip to content

Draft: enable `await` in catalyst scripts

depends on !332 and !333 (merged)

This MR updates the core classes related to catalyst 2.0. This involves initializing the event loop before any catalyst calls and binding the python event loop to the async paraview event loop so that tasks can be added from both ways. One key difference with the existing implementations in async paraview is that we need to be able to orchestrate everything from the C++ side where the catalyst library is instead of inside the python script itself as we do currently in tests or in trame applications.

The requirement for async paraview calls to be able to be called from catalyst scripts is that the catalyst family of calls catalyst_initialize,execute,... needs to be coroutines ie. async def.

The high-level view of the changes required for this include:

  1. Add infrastructure to initialize python asyncio loop from C++. In particular during vtkInSituInitializationHelper::Initialize which is called from catalyst_initialize.
  2. Allow async functions in catalyst scripts which requires to update all python methods in the callstack to be async.
  3. Adapt vtkCPPythonScriptV2Helper::Catalyst{Initialize,Execute,...} (which act as a bridge between C++ and Python) to call the coroutines introduced in 2.
  4. Bring and adapt catalyst examples to expose and test the new functionality
Edited by Christos Tsolakis

Merge request reports