Re: Asynchronous execution of synchronous functions

2022-09-26 Thread Inada Naoki
On Tue, Sep 27, 2022 at 3:19 AM Axy via Python-list wrote: > > > Did you check the ThreadPoolExecutor or the ProcessPoolExecutor? They > > won't give you atomic writes unless you add a Lock or a Condition, but > > they will execute your code in another thread or process. > > Yes, I did, but they a

Re: Asynchronous execution of synchronous functions

2022-09-26 Thread Jon Ribbens via Python-list
On 2022-09-26, Stefan Ram wrote: > So, I wanted to try to download all pages in parallel with > processes to avoid any GIL effect, while I don't understand > what the GIL actuall is. But processes didn't work here, so > I tried threads. This worked and now the total run time is > down to

Re: Asynchronous execution of synchronous functions

2022-09-26 Thread Axy via Python-list
Did you check the ThreadPoolExecutor or the ProcessPoolExecutor? They won't give you atomic writes unless you add a Lock or a Condition, but they will execute your code in another thread or process. Yes, I did, but they are too complicated to use. I'd like something for humans, such as asynch

RE: Asynchronous execution of synchronous functions

2022-09-26 Thread Diego Souza
de Janeiro - Brasil On Mon, Sep 26, 2022 at 1:01 PM wrote: > From: Axy > To: Python List > Date: Mon, 26 Sep 2022 12:17:47 +0100 > Subject: Asynchronous execution of synchronous functions > Hi there, > > is there a library to call functions in context of a thread? For > exam

Asynchronous execution of synchronous functions

2022-09-26 Thread Axy via Python-list
Hi there, is there a library to call functions in context of a thread? For example, as in asyncsqlite which has a thread and a queue I mean has anyone generalized such an approach already? If not, I'll do it myself, no problem. It's a kind of tiny stuff, like atomicwrites, which is quite dif