Skip to main content

All 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 ...
Zaid's user avatar
  • 87
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. ...
Relys's user avatar
  • 65
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 ...
Shreyas Kulkarni's user avatar
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 ...
Azmisov's user avatar
  • 7,329
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 ...
Simarra's user avatar
  • 13
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 ...
TimesAndPlaces's user avatar
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 ...
Bilal Ahmed Karbelkar's user avatar
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): ...
sam's user avatar
  • 41
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 ...
Sukombu's user avatar
  • 157
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. ...
Igor Mendes's user avatar
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 ...
Aces's user avatar
  • 37
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 ...
stucash's user avatar
  • 1,268
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 ...
Piotr's user avatar
  • 1
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 ...
abraguez's user avatar
  • 375
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 ...
Jim's user avatar
  • 45

15 30 50 per page