All Questions
16 questions
0
votes
1
answer
75
views
asyncio ftp push from 1 client to n servers simultaniously in parallel
I tried "everything" but with no luck... probably am I misusing/misunderstanding asyncio.
[my goal/use case]
Push games from 1 computer (1Gb nic) to 16 xboxs (100Mb nic) in chunks of 10 (to ...
0
votes
1
answer
121
views
Is Python Asynchronous asyncio parallelism?
async def task():
async def func():
'''takes forever to run the calculation, not doing requests'''
return something
result = await func()
When loop meets await, it ...
-3
votes
3
answers
605
views
python asynchronous map function that apply a function to every element of a list [closed]
I have a list of elements in python that I want to apply an API call to. The API involves web requests and I want to apply it synchronously. Since it is a third party API I can't really modify the ...
0
votes
1
answer
523
views
How to run parallel, asynchronous tasks in a non-blocking way inside a class in Python
I am running an iterative main block of code, which now we can assume runs forever, say loop A.
After a given condition inside this loop is met, I want to spawn N asynchronous and parallel processes ...
0
votes
1
answer
329
views
Unable to get multiple response requests on aiohttp
I am trying to pull multiple responses requests using aiohttp but I am getting an attribute error.
My code looks like this, I had to obscure it because I am using a private api.
import aiohttp
import ...
0
votes
1
answer
679
views
How to run a list of task in by X a time? And wait for each group to finish
I have a group of 1000 tasks.
import asyncio
async def my_task(x):
await asyncio.sleep(0.1)
print(f"done: {x}")
async def main():
my_tasks = []
for x in range(1000):
...
0
votes
0
answers
56
views
Run the same function in parallel n times (while loop)
My program retrieves a data file and then runs the same function n times (in this example, 100) to process that data differently each time (with randomly generated ranges), and then maps the results ...
0
votes
2
answers
2k
views
Run two functions concurrently in python
I have the two functions below and I want them to run in parallel just like we use go routines in Go. Currently these do not run in parallel.
Please note that there is no async code in each of the ...
0
votes
1
answer
40
views
Control a recurring detection task using asynchronous or concurrent techniques in python
I am working on a detection tool and I want to be able to control it over the web. The web service should support the tool to start and stop and modify the detection configuration. But I don't know ...
-1
votes
1
answer
834
views
asyncio methods not executing asynchronously
I have a following code:
def a:
parts = asyncio.run(b())
print(parts)
async def b():
res = await asyncio.gather(*c(i) for i in range(4))
async def c(i):
for j in range(5):
...
0
votes
2
answers
1k
views
Does a loop.run_in_executor functions need asyncio.lock() or threading.Lock()?
I copied the following code for my project and it's worked quite well for me but I don't really understand how the following code runs my blocking_function:
@client.event
async def on_message(message):...
0
votes
2
answers
733
views
How to wait on multiple conditions simultaneously until any of them returns true
This is my code:
async def fun1():
result=False
#Some time-consuming operations...
return result
async def fun2():
result=False
#Some time-consuming operations...
return result
if ...
1
vote
1
answer
1k
views
Requests / Asyncio: Is there a drawback for making pool_maxsize=1000 with a Python requests session?
I am using the following code to increase the pool maxsize with requests:
import requests
session = requests.Session()
session.mount("https://", requests.adapters.HTTPAdapter(pool_maxsize=50))
...
3
votes
1
answer
5k
views
How to call asynchronous functions without expecting returns from them?
In the code below I'd like to call task1 and task2 but WITHOUT expecting returns from these methods, is it possible?
import asyncio
async def say(something, delay):
await asyncio.sleep(delay)
...
3
votes
1
answer
463
views
How to not waste time waiting for many network-bound tasks in Python?
In my Python console app, I have a simple for loop that looks like this:
for package in page.packages:
package.load()
# do stuff with package
Every time it's called, package.load() makes a ...