Skip to main content

Questions tagged [python-asyncio]

This tag is to be used for the asyncio Python package which provides mechanisms for writing single-threaded concurrent code. The asyncio package provides asynchronous I/O, event loop, coroutines and tasks beginning with Python 3.4.

0 votes
1 answer
26 views

Apply async batching to Dataframe.apply()?

I have already checked out this url: Can I execute a function in "apply" to pandas dataframe asynchronously?(Can I execute a function in "apply" to pandas dataframe asynchronously?)...
Poojan Naik's user avatar
0 votes
1 answer
53 views

how to run data processing tasks asynchronously in fast api? [duplicate]

I have a route in my fast api application, (sample code below). my root route calls an async function called read_root. in this function , i want to query database , gets some result and upload it to ...
kishi's user avatar
  • 125
0 votes
0 answers
38 views

GUI unable to send messages through Manager().Queue() to the processes

Please guide me in the right direction if this is already answered. I have a GUI script that has several buttons and when I click the start button, it needs to send a message to a process which is ...
Keerthan Rao's user avatar
0 votes
0 answers
70 views

Understanding sync_to_async method in Django?

I have never worked with asyncio and/or asynchronous methods with django and am having a little difficulty understanding. I am trying to convert a synchronous utility function (create_email_record) ...
master_j02's user avatar
0 votes
0 answers
26 views

qasync with IPython hangs on run_until_complete

I would like to have an asynchronous gui with PyQt5. The synchronous version of what I want would look like this: from PyQt5.QtWidgets import QPushButton, QMainWindow import asyncio import time import ...
Marc's user avatar
  • 1
1 vote
1 answer
20 views

When using AsyncClients in Google Cloud Python SDK, got future attached to a different loop

I'm quite new to using asyncio in Python. Originally I have a sync function speak: from google.cloud import texttospeech client = texttospeech.TextToSpeechClient() def speak(*args): # omitted ...
Henry M's user avatar
  • 85
0 votes
1 answer
43 views

Best approach to object creation in the background without using a task queue system?

I have been thinking of the best approach to a record creation in the background without using django signals, or celery, etc. I do not want to use signals due to the fact that the sender Model would ...
master_j02's user avatar
1 vote
0 answers
35 views

Why can't I call Run from asyncio twice in the same function?

I am using Celery to process background tasks in my application. Sometimes, I need to process asynchronous functions within those tasks, for which I use asyncio. And in this case, I also need to ...
Diego L's user avatar
  • 816
0 votes
1 answer
18 views

Archtecture/Design pattern for communication between asyncio and non-asyncio context

I am writing a TCP-based client which do both req/rep pattern communication and push/pull pattern communication. I tried to employ asyncio and its transport/protocol structure to handle the low-level ...
Holmes Conan's user avatar
  • 1,230
2 votes
3 answers
60 views

asyncio how to chain coroutines

I have the following test code, where I am trying to chain together different coroutines. The idea is that I want to have one coroutine that downloads data, and as soon as data is downloaded I want to ...
Tue's user avatar
  • 411
1 vote
1 answer
34 views

aiohttp showing 403 Forbidden but requests.get giving 200 OK response

I'm using aiohttp to asynchronously scrap some price from an url. Before, I used requests.get to synchronously do the same. I am able successfully able to scrap using requests.get but the same URL ...
Gbn's user avatar
  • 73
1 vote
0 answers
39 views

Print API objects/ Payload received via POST/GET on response with asyncio [closed]

I want to print out every API object I receive on an event or the whole payload respectively (POST/GET). The code works and looks like below Code: async def main(): async with client_session() as ...
cd4user's user avatar
  • 93
0 votes
1 answer
47 views

Python asyncio + multiprocessing [duplicate]

I am trying to create a server with fastapi with multiprocessing, where you can send an image to a given endpoint, and it will be processed concurrently via 3 different ocr models to recognize text. ...
ReYaN WTF's user avatar
0 votes
0 answers
18 views

pytest anyio - create a mongodb motor fixture that lasts throughout session

I want to create a mongodb session with motor that will start and end with the tests with pytest and the anyio pytest plugin. But after tests are run, the entries persist in the database. # db.py ...
ffempegging's user avatar
0 votes
0 answers
31 views

How to resolve "RuntimeError: There is no current event loop in thread 'MainThread'" for Tortoise ORM and Celery in FastAPI

I have just started working with Tortoise ORM in FastAPI. This is also the first time I am using an ORM in FastAPI. I have a Celery task that performs some actions and then updates the database using ...
Neha's user avatar
  • 97

15 30 50 per page
1
2 3 4 5
516