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

Резултати

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

Пребарај: #bankprojections

当前筛选 #bankprojections清除筛选
Crypto M - Crypto News

@CryptoM · Post #64905 · 10.04.2026 г., 08:43

🚀 U.S. March Core CPI Projections Vary Among Financial Institutions According to Jin10, various financial institutions have released their projections for the U.S. March unadjusted core Consumer Price Index (CPI) year-on-year rate. The previous value was 2.5%, while Reuters had forecasted a 2.7% increase. Norway's DNB projects a 3.0% rise, while BNP Paribas, Capital Economics, Lloyds Bank, and ANZ Bank all forecast a 2.8% increase. Other institutions, including DekaBank, Goldman Sachs, Barclays, ING, JPMorgan, Nomura Securities, Jefferies, RBC, Standard Chartered, TD Securities, SEB, UBS, and Wells Fargo, predict a 2.7% rise. Citigroup and Morgan Stanley expect a 2.6% increase. For the U.S. March seasonally adjusted core CPI month-on-month rate, which had a previous value of 0.2% and a Reuters forecast of 0.3%, BNP Paribas, Lloyds, and Spartan Capital predict a 0.4% increase. ANZ Bank, Capital Economics, Commerzbank, Barclays, Deutsche Bank, Goldman Sachs, ING, JPMorgan, Nomura Securities, Moody's Analytics, RBC, Société Générale, Jefferies, Standard Chartered, TD Securities, UBS, and Wells Fargo forecast a 0.3% rise. Citigroup, Mizuho Securities, FHN Financial, and Morgan Stanley expect a 0.2% increase. #US#CPI#financialinstitutions#inflation#forecast#economicprojections#coreCPI#March2026#consumerprices#bankprojections