Skip to main content

All Questions

-1 votes
0 answers
65 views

Python Async loop freezes when checking task.done()

I am running multiple asyncio. Task to execute user request faster on my fastAPI websocket server. However occasionally (once per week), my whole async loop freezes on line where I check if one of my ...
Beku Ch's user avatar
  • 77
0 votes
0 answers
67 views

Confused with scoped_session, async_scoped_session from SQLAlchemy

Been reading the documentation from SQLAlchemy, and I still can't get it. What are the purpose of scoped_session / async_scoped_session. I prefer to use this syntax in my code, and as my understand. ...
tbog357's user avatar
0 votes
0 answers
17 views

PySimpleGUI - working of two windows at the same time [duplicate]

I have a project using the PySimpleGUI library. The application has many windows. The project is built as follows: def window_nr_2(): layout2 = [[sg.Button ('But A'), sg.Button ('But B')]] ...
Branc's user avatar
  • 1
0 votes
1 answer
77 views

Using subscribe() method in an asyncio stack

I want to use pubsub in an application that uses asyncio as a basic way of achieving I/O concurrency. The default Google SDK, however doesn't offer async methods (I have tried gcloud-aio-pubsub, but ...
zefciu's user avatar
  • 2,057
0 votes
2 answers
288 views

Is it safe to create asyncio event loop in one thread and run it in another thread while having ability to cancel it from outside the thread (python3)

I want to know if it's safe to create an asyncio event loop in one thread and run the loop in another while having the ability to cancel it from outside the thread in which the event loop is running. ...
Jishnu's user avatar
  • 130
0 votes
0 answers
60 views

How to parallelize long-running IO operations in a multi-threaded Python application with asyncio?

I am building a Python application that uses an event loop (via the asyncio library) to listen for tick data from a cryptocurrency exchange via a WebSocket. The tick data comes for various symbols, ...
elaspog's user avatar
  • 1,719
0 votes
1 answer
52 views

call same function in python recursively and parallelly with list of strings

I have a list of users i.e user_list=["user1","user2","user3"] I have a function called search which search the user and their manager and then manager's manager and so ...
witty_minds's user avatar
1 vote
1 answer
264 views

Why we need sync_to_async in Django?

The document said: The reason this is needed in Django is that many libraries, specifically database adapters, require that they are accessed in the same thread that they were created in. Also a lot ...
PaleNeutron's user avatar
  • 3,235
0 votes
1 answer
70 views

Is there an issue if two asyncio tasks, one reads and one writes, uses one single websocket at the same time?

I have the following simplified code: import asyncio import websockets async def read_from_ws(websocket): async for message in websocket: print(f"Received message: {message}") ...
Viet Than's user avatar
  • 320
0 votes
1 answer
338 views

Race Condition in Confluent Kafka Consumer with Asyncio and ThreadPoolExecutor in Python

I'm working on a Python application where I need to consume messages from a Kafka topic, process them by making an async API request, and produce a response to an outbound Kafka topic. Since the Kafka ...
Abhay's user avatar
  • 526
2 votes
2 answers
254 views

Python Async Thread-safe Semaphore

I'm looking for a thread-safe implementation of a Semaphore I can use in Python. The standard libraries asyncio.Semaphore isn't thread-safe. The standard libraries threading.Semaphore doesn't have ...
freebie's user avatar
  • 1,977
1 vote
1 answer
74 views

Keep a variable between two threads in python [duplicate]

I'm using python Fastapi. I am running an application that at one point launches a job to an external service. The service then sends a webhook with the job's status, a status I receive in an endpoint ...
Ingrid5's user avatar
  • 11
1 vote
0 answers
71 views

Why is my transferred data being written into disk out-of-order after passing a certain number of asynchronous tasks running?

So I have those two scripts that are meant to be used for extremely fast file transfers in local networks Receiver Script: import asyncio import logging import sys import time import aiofiles import ...
LuckyCoder3607's user avatar
0 votes
0 answers
388 views

Task exception was never retrieved future: <Task finished name='Task-7' coro=<testu() done

I am using fast api and I above is a test setup I did in which on the route test, I want to create a background task using asyncio and it would make a POST request to my another javascript server ...
Zaid's user avatar
  • 87
0 votes
0 answers
41 views

How to run 2 functions (calling themselves at specific frequencies and sharing variables) in parallell

I would like to run 2 functions, as such each function is calling itself: f1 is calling itself every second to 1) get back z 2) update y(x, z). f2 is calling itself every 5 minutes to 1) publish y 2) ...
TJenn's user avatar
  • 1

15 30 50 per page
1
2 3 4 5
28