Skip to content

Error on socket shutdown: [Errno 107] Transport endpoint is not connected #2

@pochenok

Description

@pochenok

GCP - 24 CPU, 32 RAM.
Semaphore - just 4
Query is fast enough

Script starts running well but after some time I start getting this error:
Error on socket shutdown: [Errno 107] Transport endpoint is not connected

Before I was getting another error - OSError: [Errno 24] Too many open files
I fixed by raising limits - ulimit -n 100000

async def get_result(comb):
    sem = asyncio.Semaphore(4)
    async with sem:
        client = Client('localhost', database='sna_gandalf')
        num = await client.execute(
            'select count(distinct id_follower)*20 from followers_women sample 0.05 where arrayExists(x -> x = id_blogger, ' + str(comb) + ') = 1  select sum(followers) from bloggers_tmp_price where arrayExists(x -> x = id, ' + str(comb) + ') = 1 select sum(money) from bloggers_tmp_price where arrayExists(x -> x = id, ' + str(comb) + ') = 1')
        combinations_dict[str(comb)] = str(num[0][0]) + ', ' + str(num[1][0]) + ', ' + str(num[2][0])


combinations_dict = {}
for i in range(1, 8):
    print('range ', i, ' done')
    loop = asyncio.get_event_loop()
    loop.run_until_complete(asyncio.wait(
        [get_result(list(comb)) for comb in itertools.combinations(list(followers_df.id_blogger.unique()), i)]))

Google does not help me =(

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions