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

Резултати

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

Пребарај: #labs

当前筛选 #labs清除筛选
@belajarnetworking

@belajarnetworking · Post #382 · 08.03.2017 г., 12:02

#labs[.pka] Part 1: Basic Networking - 1-1 Basic Configuration http://www.ranet.co.th/packetlab/ccna/NA-1-1-BasicConfig.pka - 1-2 IPv4 Addressing http://www.ranet.co.th/packetlab/ccna/NA-1-2-IPv4addressing.pka - 1-3 IPv6 Addressing http://www.ranet.co.th/packetlab/ccna/NA-1-3-IPv6addressing.pka Part 2: LAN Technology - 2-1 InterVLAN Routing http://www.ranet.co.th/packetlab/ccna/NA-2-1-InterVLAN.pka - 2-2 VTP http://www.ranet.co.th/packetlab/ccna/NA-2-2-VTP.pka - 2-3 STP http://www.ranet.co.th/packetlab/ccna/NA-2-3-STP.pka Part 3: WAN Technology - 3-1 PPP - PAP http://www.ranet.co.th/packetlab/ccna/NA-3-1-PPP-PAP.pka - 3-2 PPP - CHAP http://www.ranet.co.th/packetlab/ccna/NA-3-2-PPP-CHAP.pka - 3-3 Frame Relay - Multipoint http://www.ranet.co.th/packetlab/ccna/NA-3-3-FR-Multipoint.pka - 3-4 Frame Relay - Point-to-Point http://www.ranet.co.th/packetlab/ccna/NA-3-4-FR-P2P.pka Part 4: IP Routing and Services - 4-1 Static and Default Route http://www.ranet.co.th/packetlab/ccna/NA-4-1-Static-Default-Route.pka - 4-2 RIP http://www.ranet.co.th/packetlab/ccna/NA-4-2-RIP.pka - 4-3 OSPF http://www.ranet.co.th/packetlab/ccna/NA-4-3-OSPF.pka - 4-4 EIGRP http://www.ranet.co.th/packetlab/ccna/NA-4-4-EIGRP.pka - 4-5 Port Security http://www.ranet.co.th/packetlab/ccna/NA-4-5-PortSecurity.pka - 4-6 Access Control List http://www.ranet.co.th/packetlab/ccna/NA-4-6-AccessList.pka - 4-7 NAT http://www.ranet.co.th/packetlab/ccna/NA-4-7-NAT.pka - 4-8 VPN-IPsec http://www.ranet.co.th/packetlab/ccna/NA-4-8-VPN.pka - 4-9 DHCP http://www.ranet.co.th/packetlab/ccna/NA-4-9-DHCP.pka

Hashtags

@belajarnetworking

@belajarnetworking · Post #181 · 21.01.2017 г., 12:05

r e u p l o a d ‌ #labsCCNA Full Labs .pka "File activity labs yang saat ini sedang rutin dikerjakan, silakan di download. Ada 5 buah folder: dan ebook guide nya" Content: - I: Network Fundamentals - II: Routing Protocols and Concepts - III: LAN Switching and Wireless - IV: Accessing the WAN - ++ Completed Activities

Hashtags

Venture Village Wall 🦄

@venturevillagewall · Post #3381 · 18.12.2024 г., 12:09

Fight Disinformation with AI INAR .IA Labs & Technologies has raised $1.21M for its innovative SaaS platform aimed at automating the detection and verification of disinformation across online content. Scheduled to launch on December 18, 2024, this multimodal and multilingual tool is set to enhance online security and information integrity. More details can be found at TrueFlag. #Funding#Technology#AI#SaaS#Disinformation#Verification#OnlineSafety#Security#Innovation#Automation#Multimodal#Multilingual#Integrity#Content#Platform#Launch #2024 #INAR#TrueFlag#Labs

GitHub Trends

@githubtrending · Post #14895 · 02.07.2025 г., 12:00

#python#copilot#csharp#dotnet#github#github_copilot#github_copilot_chat#github_copilot_for_azure#github_copilot_free#github_copilot_training#javascript#lab#labs#microsoft#python#sql#tutorial#tutorial_code#tutorial_exercises#visual_studio_code#vscode GitHub Copilot’s new Agent Mode is a powerful AI coding partner that goes beyond just suggesting code—it can independently write, debug, and improve your code, handle complex workflows, and even fix its own mistakes automatically. It works with multiple programming languages and integrates with popular development tools, helping you save time on repetitive tasks like testing, deployment, and refactoring. By using natural language prompts, you can guide it to complete multi-step projects, making coding faster and easier whether you’re a beginner or an expert. This course teaches you how to fully use these features, boosting your productivity and coding skills. https://github.com/microsoft/Mastering-GitHub-Copilot-for-Paired-Programming