[Bf-committers] Blender and Asyncio

Sybren A. Stüvel sybren at stuvel.eu
Mon Mar 27 10:48:56 CEST 2017

Hi Andreas,

On Sat, Mar 25, 2017 at 11:26:36PM +0100, Andreas Klostermann wrote:
> As I mentioned recently, I'd like to show you a couple of
> experiments of using asyncio in Blender. This project has a simple
> web server, a way of handling events/handlers, and using dialogs
> asynchronously.
> https://github.com/akloster/blender-asyncio

Your experiments look quite interesting. It's hard to say something
about the whole, though, since you combine so many different things in
one experiment:

    - A different way to use dialogs; from just browsing through the
      code it's hard to see the end-user's benefit here. I also don't
      quite understand the need to define and register operators from
      inside an async function.

    - The _run_once() function is interesting, since it allows running
      asyncio tasks for a short period of time. This hooks into:

    - The web server acts as an example of an asyncio task. Have you
      compared the web server's performance with an aiohttp server
      running outside of Blender? And have you compared your aiohttp
      approach to running some other HTTP server implementation in,
      say, another thread or process? I'm also very interested in
      seeing the effect on Blender itself when the asyncio webserver
      is being stressed.

I really like asyncio, but I think personal interest is not enough to
warrant building things into Blender. Building web servers into
Blender isn't something I see a wide need for. However, downloading
things asynchronously is something we certainly have a use for:

    - the package manager
    - Blender Cloud add-on
    - add-ons that now bundle large datasets in their scripts
      directory (which they shouldn't)

And even though I think asyncio is a good candidate for this, I think
we should make a stronger case in favour of it and against
multithreaded approaches.

Sybren A. Stüvel

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
Url : http://lists.blender.org/pipermail/bf-committers/attachments/20170327/fa73a6e9/attachment.pgp 

More information about the Bf-committers mailing list