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 слични објави

Пребарај: #ai16z

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

@venturevillagewall · Post #4101 · 08.02.2025 г., 19:00

Weekly AI News Highlights 🔹 Presearch launches chatbot PreGPT 2.0: Read more 🔹 Sberbank plans collaboration with Chinese researchers on AI projects: Read more 🔹 List of countries restricting Chinese AI DeepSeek prepared: Read more 🔹 Tether's Data department developing various AI applications for Bitcoin wallets: Read more 🔹 Figure creator terminates partnership with OpenAI after AI breakthrough: Read more 🔹 Binance analyzes meme coins and AI tokens market trends: Read more 🔹 Google unveils flagship AI model Gemini 2.0 Pro Experimental: Read more 🔹 AI tokens AI16Z and VVV see significant drop post-Binance listing: Read more 🔹 OpenAI introduces Deep Research mode in ChatGPT: Read more 🔹 List of cheap and free alternatives to OpenAI's Deep Research revealed: Read more #AI#Presearch#Sberbank#DeepSeek#Tether#Figure#Binance#Google#Gemini#AI16Z#VVV#ChatGPT#OpenAI#Crypto#VC#memecoins#tokens#research

Venture Village Wall 🦄

@venturevillagewall · Post #3813 · 07.01.2025 г., 16:00

Major USDC Burn & USDT Transfer News 🔥 50,000,000 #USDC burned at USDC Treasury. Full details here. 🚨 Nearly 500M #USDT transferred from #HTX to Tether Treasury, confirming strong liquidity movements. 🤑 MicroStrategy bought 258,320 BTC for over $22B in 2024, averaging $85,450 per BTC. Potential profit of $14B if BTC reaches $100,000. More info here. 🚀 Czech National Bank considers Bitcoin for reserve asset diversification. Details: link. 🔥 Total market cap for AI tokens approaches $17B, witnessing a 4% increase. Top tokens include #FET, #VIRTUAL, #AI16Z. 🔧 Solana developers aim to resolve scalability issues, targeting optimal performance as user base grows. Learn more here. 💡 Ripple partners with Chainlink to launch #RLUSD in DeFi, currently ranked 724 on CoinGecko with a market cap of $72.2M. 📉 Coinbase premium drops to a 12-month low, signaling potential short-term pressures for Bitcoin with analysts noting need for renewed institutional interest. More details here. #USDC#USDT#MicroStrategy#Bitcoin#Crypto#Ripple#Chainlink#AI#DeFi#Solana#CzechRepublic#Liquidity#MarketCap#Investing#Institutional#Trends#CryptoQuant#RLUSD#VIRTUAL#FET#AI16Z

Venture Village Wall 🦄

@venturevillagewall · Post #3921 · 19.01.2025 г., 13:00

Trump Meme Token Sparks Controversy Discussions intensify over the safety and ethicality of the TRUMP meme token, which has surged to $70. Concerns arise from its tokenomics, where 80% is held by Trump-affiliated firms. The first unlock phase is just three months away. Crypto investor Scott Melker criticizes the project as a money grab. For more insights, check the full article here. #TRUMP#Crypto#AI#Blockchain#Solana#DEX#MemeToken#Tokenomics#Investing#CryptoInvestor#Raydium#Moonshot#DeFi#GenerativeAI#Bittensor#AI16Z#Freysa#AIXBT#Eliza