Open barsa-net opened 1 year ago
Cool idea @barsa-net . I'm not against supporting this, though rather than explicitly hardcoding support for gevent
I'd prefer to be able to just pass in one's own compatible class. Your idea of EXECUTOR_TYPE = 'custom'
and EXECUTOR_POOL_CLASS = gevent.threadpool.ThreadPoolExecutor
could certainly work.
I don't know what the implications would be of gevent
's different Future
objects. Perhaps you can test out your approach of allowing a custom executor pool class to be used, and see if you run into trouble. If it did work, then we could include gevent
as a testing requirement and write some tests for that example of the feature.
I'm working on a project using
gevent
and I'd need to usegevent.threadpool.ThreadPoolExecutor
sincegevent
patch theconcurrent.futures.ThreadPoolExecutor
class.I'd be more than happy to open a pull request, but I'm not sure how would fit best the library.
Simplest way would be to just add something inside
_make_executor
like:Another way would be to enable users to pass their own implementation, adding 'custom' as
EXECUTOR_TYPE
and passing the actual executor class viaEXECUTOR_POOL_CLASS
Last way I can think of, would be modifying
_make_executor
making it gevent-aware to something like:There are some cavet though,
gevent.threadpool.ThreadPoolExecutor
uses a slightly modifiedFuture
object which doesn't have the following methods: