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

Резултати

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

Пребарај: #lilium

当前筛选 #lilium清除筛选
[NSFW] 每日百合本推送

@YuriYuriManga · Post #1579 · 17.09.2024 г., 11:11

女性: #舔阴#纯女性⚢ #狐女#兽耳#接吻💏#尾巴#贝合#虚拟主播#百合 原作: #Hololive 角色: #白上吹雪 语言: #汉语#翻译 团队: #LILIUM 原始地址:https://exhentai.org/g/3048271/a0b0e220ef 预览:[りーりうむ (アイガ)] 同居人との暑い休日 (白上フブキ、黒上フブキ) [中国翻訳] [DL版]

Venture Village Wall 🦄

@venturevillagewall · Post #3680 · 24.12.2024 г., 08:10

Investments Surge in Innovative Platforms A startup has raised nearly $50 million after seven years of self-funding, initiating a trend of significant investment in platforms that facilitate companies selling third-party services. Notably, similar platforms across various sectors have also attracted large funding this year, signaling a ripe market for investment in this area. In addition, recent reports highlight key developments in the tech sector, such as a sharp decline in YouTube traffic in Russia, the purchase of advertising services by ‘Avito’ and T2, and the closure of electric aircraft startup Lilium after failing to secure funding. Moreover, European AI startups have attracted $13.7 billion in venture capital this year, comprising 25% of the continent's VC funding. Read more about these developments here: https://fastfounder.ru/takaja-shema-raboty-rezko-stala-vostrebovannoj/ #Startup#Investment#Funding#Platforms#AI#Tech#YouTube#AdTech#Lilium#VentureCapital#Ethereum#Tether#Rumble#Advertising#MarketTrends#Growth#FinTech#Crypto#Inflow#Development#EuropeanMarket

Venture Village Wall 🦄

@venturevillagewall · Post #3711 · 25.12.2024 г., 10:00

Edtech Investments Hit 2014 Low 📉 Global investment in Edtech startups plummets to $3 billion this year, the lowest since 2014. Startups are distancing themselves from the Edtech label, impacting investor interest. 🧑‍🦼 'Моторика' acquires 51% of a wheelchair manufacturer, positioning itself in assistive technology ahead of an IPO planned for 2026. 🤖 OpenAI considers creating a humanoid robot, but new AI models remain the priority. ✈️ Lilium, the electric aircraft developer, may be saved by a consortium after announcing closures and layoffs. Read more: Financial Times, Vedomosti, The Information, TechCrunch #Edtech#Investment#Startups#AI#Robot#AssistiveTechnology#Lilium#MOTORIKA#FinancialTimes#Vedomosti#TheInformation#TechCrunch#Singapore#Cryptocurrency#UserExperience#MarketTrends#Technology#Innovation#Business#Funding