Curio kernel as singleton?


#1

I’m using curio and I have a factory function to that implements a singleton pattern. This is, I believe, what was suggested in earlier documentation. Then I call, generally, like this: get_kernel().run(…)

So, is this still a good idea?

Also, if I run it with shutdown=True I will later get:

AttributeError: 'Kernel' object has no attribute '_runner'

So, it seems that this is a bug on my part? I should never call the singleton kernel from anywhere with shutdown=True?


#2

Hmmm. That looks like a bug (in Curio) to me. I’ll look into that.

As for whether the Kernel should be a singleton or not, I don’t really know. I’m not sure the kernel can be reused after it’s been shutdown so that would need to be checked.


#3

OK, thanks. I’ll keep that in mind.