TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #425 · 20 апр.

Недавно делал быстрый прототип асинхронного приложения в котором требовалось вызывать много синхронного кода. Да, я знаю, что это не лучший дизайн, но нужно было быстрое решение на один процесс и без очередей. Поэтому я выполнял код в потоках. Выглядело это примерно так: from fastapi.concurrency import run_in_threadpool async def execute(data: DataRequest) -> DataResponse: try: result = await run_in_threadpool(sync_function, data) return DataResponse(data=result) except Exception as e: return DataResponse( error=str(e), success=False, ) В общем работает нормально. Для всех вызовов под капотом используется общий тредпул, всё работает предсказуемо. Но потребовалось изменить количество запускаемых в пуле потоков (по умолчанию создается 40 воркеров). Так как дело происходит с FastAPI, делается это через lifespan используя настройки anyio: import anyio @asynccontextmanager async def lifespan(app: FastAPI): limiter = anyio.to_thread.current_default_thread_limiter() limiter.total_tokens = 100 yield # если вдруг нужно вернуть обратно limiter.total_tokens = 40 Зачем менять количество воркеров? - уменьшить, если оперативки мало (один тред занимает ~8мб) - увеличить чтобы выдержать нагрузку Если есть предложения получше при тех же вводных - предлагайте😉 #async

Hashtags

Резултати

Пронајдени 2 слични објави

Пребарај: #peptides

当前筛选 #peptides清除筛选
Venture Village Wall 🦄

@venturevillagewall · Post #3629 · 21.12.2024 г., 10:22

$4.07M Funding for PeptiSystems PeptiSystems secured $4.07M in funding on December 20, 2024. The company develops advanced instruments for solid-phase synthesis in peptide and oligonucleotide therapeutics, catering to both GMP and non-GMP manufacturing. Discover more: PeptiSystems #Funding#PeptiSystems#Therapeutics#Peptides#Oligonucleotides#GMP#Manufacturing#Synthesis#Biotechnology#Pharmaceuticals#MedicalDevices#FlowthroughColumnTechnology#ProcessDevelopment#LifeSciences

Venture Village Wall 🦄

@venturevillagewall · Post #3665 · 21.12.2024 г., 11:00

Funding News: December 2024 🚀 Major funding rounds announced: - Alvie: $2.19M for HUGO digital assistant - Buildpeer: $2.50M for construction project optimization - Island Passage: $2.50M in funding - TIXiMED: $2.65M for diabetes treatment - The Pad Climbing: $3M for climbing community project - PeptiSystems: $4.07M for peptide and oligonucleotide therapeutics - Greenlight Health: $4.20M for data solutions - TripSuite: $5M for agency growth tools - DuckChain: $5M for blockchain solutions - Nexa Finance: $5.04M for investment opportunities - Tenor: $5.40M for management training with AI - Smartr365: $6.33M for mortgage brokerage platform - Astraveus: $7.40M for cell therapies - EditPep: $8.20M in funding - Jrnys: $8.65M for personalized healthcare solutions - Hoji: $8.94M for ecological solutions - Hauler Hero: $10M for waste management software - Trinity College, Dublin: $10.46M in funding - PeproMene Bio: $11M for cancer therapies - Hervolution Therapeutics: $11.70M for immunotherapies For more details, visit the respective websites. #Funding#Healthcare#Biotech#AI#Construction#Therapeutics#WasteManagement#Investment#DigitalAssistant#CellTherapies#EcoDesign#Mortgage#Finance#Diabetes#Peptides#Community#Climbing#Software#PersonalizedHealthcare#Blockchain