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

Пребарај: #aigovernment

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

@ai_and_law · Post #817 · 30.04.2026 г., 07:04

🇦🇪UAE Targets 50% of Government Operations for Agentic AI The United Arab Emirates announced a plan to move 50% of government sectors, services, and operations to agentic AI within two years. The initiative presents AI not as a support tool, but as a system capable of analyzing, deciding, executing, and improving in real time. Sheikh Mohammed bin Rashid Al Maktoum described AI as an “executive partner” intended to enhance services, accelerate decisions, and increase efficiency. The strategy builds on prior UAE investments in digital identity infrastructure, smart government services, sovereign cloud capacity, data strategies, and national AI programs. Experts noted that infrastructure readiness is comparatively strong, but implementation will depend on redesigning workflows, policies, and administrative processes across government institutions. Analysts also pointed to legal and governance constraints. While AI-assisted services for high-volume, low-complexity tasks may enable the 50% target, fully autonomous decision-making in complex public sector functions remains limited by trust, accountability, fragmented legacy systems, and uneven data readiness. #AIRegulation#AIGovernment#AgenticAI#PublicSector#UAE