Re: Problem with psycopg2 and asyncio

Поиск
Список
Период
Сортировка
От Frank Millman
Тема Re: Problem with psycopg2 and asyncio
Дата
Msg-id 7F9386DEC8DD4C9B9ECF106A81A2E9CC@FrankLaptop
обсуждение исходный текст
Ответ на Re: Problem with psycopg2 and asyncio  (Daniele Varrazzo <daniele.varrazzo@gmail.com>)
Ответы Re: Problem with psycopg2 and asyncio  ("Frank Millman" <frank@chagford.com>)
Список psycopg
On 01/03/16 17:24, Daniele Varrazzo wrote:
 
>
>> On Mon, Feb 29, 2016 at 2:52 PM, Frank Millman <frank@chagford.com> wrote:
>>
>> > Of course I may just be doing something silly, in which case I would be
>> > delighted if someone pointed it out.
>>
>> Are you running psycopg in async mode or in green mode?
>>
> To be honest, I don’t know what that means, so I am probably running in
> green mode.

> I think you should have that under control if you want psycopg to
> perform ok in asynchronous environment.

> Call psycopg2.extensions.get_wait_callback(). If it returns None, then
> psycopg is simply blocking.
 
 
Either I am misunderstanding you, or you are misunderstanding me – I am not sure which.
 
I am not running psycopg ‘in an asynchronous environment’. It is running in its own thread, and is unaware that there is an event loop running in a different thread.
 
It boils down to the fact that psycopg running in one thread is blocking another thread from executing. Running pyodbc and sqlite3 in exactly the same conditions do not have this effect. Therefore my (quite possibly wrong) suspicion is that the GIL is not being released timeously, or at least psycopg is doing something different from the others.
 
If I have misunderstood, I would appreciate it if you would clarify how you see the problem. That should give me a clearer idea of the best way forward from here.
 
Thanks
 
Frank
 

В списке psycopg по дате отправления:

Предыдущее
От: Daniele Varrazzo
Дата:
Сообщение: Re: Problem with psycopg2 and asyncio
Следующее
От: "Frank Millman"
Дата:
Сообщение: Re: Problem with psycopg2 and asyncio