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

Резултати

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

Пребарај: #economicdata

当前筛选 #economicdata清除筛选
America 🇺🇸 News & Politics

@America · Post #10518 · 18.04.2026 г., 18:04

📊🇺🇸US JOBS REPORT — UNEMPLOYMENT HOLDS AT 4.3% MARCH 2026 🔹178,000 new nonfarm jobs added in March beating economist expectations — labor market remains resilient despite economic headwinds 📈 🏆"America's job market continues to defy economic gravity and global uncertainties" — Labor Secretary commenting on sustained employment strength 📈Wall Street responds positively — major indices rise as investors welcome balanced growth without overheating concerns ✨ More breaking stories coming soon 🚀 #USJobs#Employment#Economy#LaborMarket#America#EconomicData#JobsReport#UnemploymentRate🎯

America 🇺🇸 News & Politics

@America · Post #10520 · 18.04.2026 г., 18:07

📊🇺🇸US MARCH JOBS DATA — LABOR MARKET STRENGTH CONTINUES 🔹Unemployment rate steady at 4.3% — maintaining near-historic low levels as economy shows resilience against global headwinds 📈 🔹Job creation beats expectations — one hundred seventy-eight thousand new positions added across diverse sectors nationwide 💼 🎯"American workers are experiencing the strongest job market in decades" — Bureau of Labor Statistics economist analysis 📈Market confidence rises — employment data supports continued economic expansion expectations through 2026 #JobsReport#USEconomy#Employment#LaborMarket#America#WageGrowth#EconomicData#BusinessGrowth🙌

Crypto M - Crypto News

@CryptoM · Post #65055 · 10.04.2026 г., 16:51

🚀 Bitcoin Rises Over 1.5% Following March CPI Data Release The Bureau of Labor Statistics (BLS) reported that the Consumer Price Index (CPI) for March increased by 0.9% from the previous month and 3.3% compared to the same period last year, slightly below analyst expectations. According to NS3.AI, the energy index saw a significant rise of nearly 11%, driven by a 21.2% increase in gasoline prices. The CME Group's FedWatch tool indicated a 0% probability of an interest rate cut in April, with a 98.4% likelihood of rates remaining unchanged. In response to the CPI data release, Bitcoin's value increased by more than 1.5%, briefly reaching $73,000. #Bitcoin#CPI#Inflation#GasPrices#FederalReserve#InterestRates#CryptoNews#FinancialMarkets#BLS#EconomicData#BTC

Crypto M - Crypto News

@CryptoM · Post #64958 · 10.04.2026 г., 12:23

🚀 Upcoming Release of U.S. and Canadian Economic Data The U.S. March seasonally adjusted CPI and core CPI monthly rates, along with the unadjusted CPI and core CPI annual rates, are set to be released shortly. According to Jin10, Canada's March employment figures will also be announced in ten minutes. #US#Canada#EconomicData#CPI#CoreCPI#Employment#MarchData#Inflation

Crypto M - Crypto News

@CryptoM · Post #65315 · 12.04.2026 г., 22:05

🚀 U.S. Stock Futures Open Lower by Over 1% U.S. stock futures for the three major indices opened lower by more than 1% on Monday. According to Jin10, this decline reflects growing investor concerns over potential market volatility and economic uncertainties. The drop in futures suggests a cautious start to the trading week, as market participants assess the impact of recent economic data and geopolitical developments. Analysts are closely monitoring these trends to gauge their potential effects on the broader market. #USStockFutures#MarketVolatility#EconomicUncertainties#StockMarket#GeopoliticalDevelopments#Investors#EconomicData#MarketTrends

Crypto M - Crypto News

@CryptoM · Post #64899 · 10.04.2026 г., 08:03

🚀 Italy's February Industrial Output Shows Modest Growth Italy's industrial production for February recorded a modest increase, with a seasonally adjusted monthly growth rate of 0.1%. According to Jin10, this figure fell short of the anticipated 0.5% growth and follows a previous decline of 0.60% in January. The data suggests a slower-than-expected recovery in Italy's industrial sector. #Italy#industrialproduction#February#growth#Jin10#economicdata#Italyeconomy#slowrecovery

Crypto M - Crypto News

@CryptoM · Post #64976 · 10.04.2026 г., 12:39

🚀 U.S. March CPI Rises Sharply Amid Conflict with Iran The U.S. Consumer Price Index (CPI) for March showed a significant increase, driven by soaring gasoline prices due to the ongoing conflict with Iran. According to Jin10, the seasonally adjusted CPI rose by 0.9% month-on-month, marking the largest increase since 2022. Data released on Friday indicated that the CPI climbed 0.9% from February, with the year-on-year growth rate accelerating to 3.3%, the fastest pace since 2024. The U.S. Bureau of Labor Statistics noted that the record surge in gasoline prices contributed nearly three-quarters of the monthly CPI increase. Meanwhile, the core CPI, which excludes food and energy costs, saw a more modest rise of 0.2% month-on-month. #USCPI#MarchCPI#gasolineprices#Iranconflict#consumerpriceindex#economicdata#inflation#BureauofLaborStatistics#coreCPI#economicgrowth

Crypto M - Crypto News

@CryptoM · Post #65447 · 13.04.2026 г., 09:14

🚀 Investors May Shift Focus from Geopolitical News to Economic Data, Analyst Suggests On April 13, Christian Gattiker, Head of Research at Bank Julius Baer, indicated in a research report that investors might be becoming less sensitive to daily Middle Eastern headlines. According to Jin10, Gattiker noted that after weeks of geopolitical dominance in the markets, there is a significant possibility that investors will cautiously return to a more 'normal' market mechanism, focusing on macroeconomic data and corporate fundamentals. Upcoming U.S. producer price data, industrial output figures, and the Federal Reserve's Beige Book are expected to provide insights into inflation dynamics and potential economic momentum. #Investors#GeopoliticalNews#EconomicData#Macroeconomics#CorporateFundamentals#USProducerPriceData#IndustrialOutput#FederalReserve#Inflation#EconomicMomentum

Crypto M - Crypto News

@CryptoM · Post #64983 · 10.04.2026 г., 12:50

🚀 U.S. CPI Watch: U.S. CPI Jumps 0.9% in March, Highest Since 2022 as Oil Drives Inflation Surge Key TakeawaysU.S. CPI rose 0.9% MoM, largest increase since 2022.Inflation hit 3.3% YoY, fastest pace since 2024.Gasoline accounted for ~75% of the monthly increase.Core CPI (ex-food & energy) slowed to 0.2% MoM.Inflation Surges on Energy ShockLatest data from the U.S. Bureau of Labor Statistics shows a sharp acceleration in inflation for March, with headline CPI rising 0.9% month-on-month.This marks the largest monthly increase since 2022, highlighting the growing impact of energy prices on the broader economy.Gasoline Prices Drive Majority of IncreaseThe surge in inflation was overwhelmingly driven by rising fuel costs linked to geopolitical tensions.Key detail:Gasoline contributed nearly three-quarters (~75%) of the CPI increaseThe spike reflects the ripple effects of higher oil prices amid the Iran conflict, which has tightened global energy supply.Yearly Inflation Accelerates to 3.3%On a yearly basis:CPI rose 3.3% YoY, the fastest pace since 2024This suggests inflation pressures are re-accelerating after a period of relative stabilization.Core Inflation Shows Signs of CoolingDespite the headline surge, underlying inflation remains more contained:Core CPI (excluding food and energy): +0.2% MoMThis indicates that:Price pressures are still largely energy-drivenBroader inflation may not yet be fully entrenchedMarket ImplicationsThe data presents a mixed signal for markets:Bullish for rates / USD:Strong headline inflationReinforces “higher-for-longer” Fed stanceNeutral-to-positive for risk assets (conditionally):Core inflation remains controlledSuggests inflation spike may be temporary if energy stabilizesEnergy vs Core Inflation BattleThe key question going forward is whether energy-driven inflation spills into the broader economy.Markets will closely watch:Wage growth trendsCore inflation trajectoryOil price stabilityIf energy pressures persist, inflation could remain elevated. If not, the spike may prove temporary.For now, the data reinforces a macro environment of elevated uncertainty, with inflation increasingly tied to geopolitical developments. #USCPI#InflationSurge#EnergyShock#GasolinePrices#OilPrices#CoreCPI#GeopoliticalTensions#USInflation#EconomicData#MarketImplications#HigherForLonger#WageGrowth#RiskAssets#OilPriceStability#2024Inflation