Concurrent http requests using asyncio and aiohttp
by Jerry Su, post on Jul 13, 2023import aiohttp
import asyncio
from typing import Dict
async def async_post_request(url: str, data: Dict) -> Dict:
"""async post.
"""
async with aiohttp.ClientSession() as session:
async with session.post(url, json=data) as resp:
response = await resp.json()
return response
model_url_dict={
"scene1": "http://0.0.0.0:8781/classify/utcx",
"scene2 …
Multiprocessing in FastAPI
by Jerry Su, post on Jul 28, 2022Reason is the light and the light of life.
asyncio get_event_loop vs get_running_loop
by Jerry Su, post on Jul 28, 2022Reason is the light and the light of life.
FastAPI for CPU-Bound Task
by Jerry Su, post on Jul 19, 2022Reason is the light and the light of life.
Docker Python Mysql
by Jerry Su, post on Sep 16, 2021docker pull mysql:5.7
docker run -itd -p 8070:3306 -v /hadoop-data/work/sl/project/mysql/data:/var/lib/mysql -v /hadoop-data/work/sl/project/mysql/conf.d:/etc/mysql/conf.d --name=qa_mysql -e MYSQL_ROOT_PASSWORD=123456 mysql:5.7
mysql -h host_ip -P port -u root -p123456
show …