All Questions
Tagged with python-asyncio concurrency
180 questions
1
vote
1
answer
45
views
Asynchronously running a function in the background while sending results in Python
I have a Python script which I would like to a) Continuously listen for requests from an API, and b) Run an expensive algorithm continuously in the background. The results from the algorithm are saved ...
2
votes
0
answers
103
views
Asyncio coroutine execution stopped and didn't return any error
I'm facing an odd behavior on one of my applications. So I have an application that has an POST entrypoint that receives a list of order id's and after processing each order it must inform an external ...
0
votes
2
answers
95
views
Creating a stoppable background task in Python
I want to run some function in the background, but be able to shut it down at will. I tried a bunch of solutions, the most obvious of which is asyncio tasks:
# Data source
DataSource = Generator[int, ...
0
votes
0
answers
41
views
Approaches and problems with massively concurrent processing using concurrent.futures and/or asyncio
I want to run billions of IO-bound tasks across a pool of thousands of threads. These are my challenges:
Reduce memory usage. The thread pool from concurrent.futures uses an unbound queue. Too many ...
2
votes
3
answers
69
views
Run Python coroutine functions concurrently, but start additional coroutines as soon as particular coroutines have completed
I have four total coroutines (async def functions): A, B, C, and D. C can't be called until I know the result of A, and D can't be called until I know the result of A and B. See the attached diagram. ...
1
vote
1
answer
51
views
How to run dependence tasks concurrently with non-dependence ones, and tasks inside for loop?
I am learning asyncio and there is a problem of running a dependence task concurrently with non-dependence ones. So far I couldn't make it work. This is my code:
import asyncio
import random
def ...
0
votes
0
answers
54
views
Is this correct to run a CPU-bound operation using ProcessPoolExecutor in asyncio loop?
I'm trying to run CPU-bound operations in non-blocking style using ProcessPoolExecutor from concurrent.futures module and asyncio.get_running_loop() functions.
I have my function that runs CPU-bound ...
0
votes
2
answers
55
views
Handling multiple IO blocking services using asyncio
This doesn't necessarily have to be a question about Python, it could rather be about asynchronous programming in general. To keep it short, I have an undefined number of objects where each executes ...
0
votes
1
answer
76
views
How to combine asynchronous I/O and CPU-bound tasks efficiently in Python?
I'm working on a Python project where I need to handle both asynchronous I/O tasks (like reading from a file or making API requests) and CPU-bound tasks (like data processing or calculations). I’m ...
0
votes
1
answer
71
views
Implementing a context-switching mechanism in asyncio
I wish to create something similar to a context switching mechanism, that allows using a shared resource one at a time.
In my case it's a single session object connecting to a website, and each ...
0
votes
0
answers
83
views
Running Concurrent Asynchronous Requests Efficiently using Refinitiv's Data Platform APIs
This question is kind of me seeking advice on this process based off of my knowledge.
What I am doing right now, is that I am trying to pull data asyncrhonously using Refinitiv (financial Platform ...
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 ...
0
votes
1
answer
49
views
Running an async task in the background after others finished
I have X asynchronous tasks that are executed using asyncio.gather(), and they are created in a loop. Once these tasks are finished, I need to run a single asynchronous task to perform some actions. ...
0
votes
1
answer
177
views
Run multiple async blocking functions simultaneously - Python
I am new to Python and coroutines, I am trying to leverage Python's asyncio library to parallel process a blocking function. I am using python 3.8.6. I have a blocking function that takes in a ...
1
vote
0
answers
38
views
Optimizing Custom Double Release Lock and Semaphore in Python asyncio
I am currently working on a project involving file operations that need to be handled by multiple processors concurrently, but not by other threads simultaneously. For this, I've devised a concept ...