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

Пребарај: #supercomputing

当前筛选 #supercomputing清除筛选
AI & Law

@ai_and_law · Post #340 · 27.06.2024 г., 07:04

EU Council Adopts Regulation to Boost AI Development with Supercomputing Power The Council of the EU has officially adopted an amendment to the regulation on the European High-Performance Computing (EuroHPC) joint undertaking, paving the way for the creation of AI factories. With this regulation, the EuroHPC initiative will promote AI factories that include AI supercomputers, associated data centers, and specialized supercomputing services. These facilities will provide both public and private users with access, with specific conditions tailored for startups and SMEs. Host entities of AI factories will receive EU financial support, covering up to 50% of both acquisition and operating costs of AI supercomputers. The regulation will be published in the Official Journal of the European Union and will enter into force 20 days later, marking a significant step towards enhancing AI development and innovation across Europe. #AI#Supercomputing

科技&趣闻&杂记

@kejiqu · Post #4338 · 09.04.2026 г., 10:13

黑客声称从中国国家超级计算中心窃取 10 PB 敏感数据,此举将成为中国历史上最大规模的网络攻击,涉及科学、国防等领域 6,000 个客户 黑客声称已从中国国家超级计算中心窃取高达 10 petabytes 的敏感数据,如果属实,这将成为中国历史上规模最大的网络攻击事件。此次攻击影响范围广泛,涉及约 6,000 个客户,涵盖科学、国防等多个领域。目前事件的真实性尚未得到独立验证,但黑客声称掌握了大量敏感信息。安全专家正在对此事件进行分析。Tom's Hardware 🏷#China#National#Supercomputing#Center#petabytes#data#breach 📢频道👥群组📝投稿