All Questions
23 questions
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 ...
2
votes
2
answers
4k
views
How to convert a Python generator to async generator?
I have a generator function in Python which is IO bound. I'd like to convert it to an async generator, where the generator loop is running in a separate process or thread. For example, loading chunks ...
1
vote
1
answer
4k
views
How to increase asyncio thread limits in an existing co-routine
I am currently working on a program using concurrency with asyncio.
The code here is over simplified in order to show the problem.
It is runnable without any dependencies if you need so.
You have two ...
0
votes
1
answer
114
views
Create a specific amount of function duplicates and run them simultaneously
I have an async program based around a set of multiple infinitely-running functions that run simultaneously.
I want to allow users to run a specific amount of specific function duplicates.
A code ...
2
votes
1
answer
418
views
Not getting any response from the server in case of some requests with asyncio and aiohttp
I am trying to send asynchronous requests in python using asyncio and aiohttp. While I am trying to make multiple requests all at once and sending them all at once to the server I am getting back ...
0
votes
1
answer
381
views
Run async task in class that extends Threading - python
I've created a python class that extends threading and uses a library that runs asyncio tasks.
import threading
from app.food import recipes
class Mixer(threading.Thread):
def __init__(self):
...
1
vote
2
answers
1k
views
Replace 'While-True'-Loop with something more efficient
Problem
It's very common for beginners to solve IO waiting while concurrent processing in an similar way like here:
#!/usr/bin/env python3
"""Loop example."""
from time ...
2
votes
0
answers
400
views
Concurrency: multiprocessing, threading, greenthreads and asyncio
I'm currently working on Python project that receives a lot os AWS SQS messages (more than 1 million each day), process these messages, and send then to another SQS queue with additional data. ...
3
votes
1
answer
835
views
Why does my process list show multiple threads when running aiohttp?
I'm currently using aiohttp in one of my projects which uses asyncio. After searching for reasons why I'm getting a high amount of memory usage I detected that aiohttp seem to create threads in the ...
1
vote
1
answer
916
views
Add a coroutine after some coroutines have finished, in an already running event loop (same loop, same thread)
I've read through a few similar questions on SO, for adding a coroutine to an already running event loop, some answers were tailored to the questions asked therefore didn't quite apply in my case; the ...
0
votes
1
answer
112
views
Concurrent execution of two python methods
I'm creating a script that is posting a message to both discord and twitter, depending on some input. I have to methods (in separate .py files), post_to_twitter and post_to_discord. What I want to ...
9
votes
2
answers
13k
views
Python module 'asyncio' has no attribute 'to_thread'
From python's asyncio examples:
import asyncio
import time
def blocking_io():
print(f"start blocking_io at {time.strftime('%X')}")
# Note that time.sleep() can be replaced with any ...
0
votes
1
answer
357
views
True Concurrency in Python
I am relatively new to concurrency in Python and I am working on some code that has to call functions outside of my code. I cannot edit those functions but I need them to run concurrently. I've tried ...