althonos / pronto

A Python frontend to (Open Biomedical) Ontologies.
https://pronto.readthedocs.io
MIT License
226 stars 47 forks source link

Implement optional single-threaded pronto #208

Closed jday1 closed 10 months ago

jday1 commented 11 months ago

This PR comes from me attempting to use pronto in AWS Lambda. AWS Lambda does not support the python multiprocessing module because AWS Lambda operates in a stateless environment and does not support threading.

I have modified the code to not use the multiprocessing module if the kwarg threads == 1.

This will allow pronto to operate in both a single-threaded and multi-threaded mode.

althonos commented 10 months ago

Hi @jday1, sorry for dragging this (and not responding to your mail earlier). I have implemented this using an abstract interface to allow having to check for the presence/absence of multiprocessing.pool every time I need to create a ThreadPool. The release v2.5.5 should now work on AWS Lambda, hopefully.