bluechi icon indicating copy to clipboard operation
bluechi copied to clipboard

[FEA] add async methods to Python binding

Open jwmelto opened this issue 9 months ago • 1 comments

Please describe what you would like to see

Modern Python uses async (asyncio) to prevent potentially long-running operations from holding the Global Interpreter Lock (GIL).

Since BlueChi employs a network interface between the Controller and the Agent(s), these operations are potentially time consuming. Providing async methods would allow applications to code efficiently, even in the presence of slow clients or network delays.

Please describe the solution you'd like

Implement async equivalents to any potentially long-running operation

(this is a nice-to-have, and not an urgent need)

jwmelto avatar Mar 22 '25 00:03 jwmelto

Hi @jwmelto, Thanks for opening the issue. The python bindings are auto-generated based on the dbus specification. Distinguishing between long- and short-running API calls is not possible there - at least without diverging from the specification format. The communication between bluechi-controller and bluechi-agent also use async communcation most of the time, e.g. starting a unit will create a job which can be watched. I think only for ListUnit(Files) this could make sense. Because of these two reasons I think it's better to create async function wrappers on the fly if needed.

engelmi avatar May 05 '25 14:05 engelmi

Because of the mentioned reasons, I am closing this issue. If this should still be a feature, please reopen it.

engelmi avatar May 13 '25 12:05 engelmi