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

Пребарај: #communicationskills

当前筛选 #communicationskills清除筛选
Andijan Development Center

@adceducate · Post #8453 · 09.04.2024 г., 12:58

🎤 Great news! 🌟 We are excited to announce the launch of our new public speaking course at ADC! 🏫 If you want to overcome the fear of public speaking, improve your presentation skills, or simply become a more effective communicator, our course is designed for you. With experienced instructors, a supportive environment, and a program focused on real-life success, we are here to help you find your voice and make an impact. 👩‍🏫👨‍🏫 Join us on a journey of development, confidence, and empowerment. Classes are starting soon, and spaces are limited, so book your spot today! ☎️For more details: 74 2261078 74 2281121 74 2281666 74 2276163 74 2252536 #PublicSpeaking#FindYourVoice#Empowerment#CommunicationSkills#Education#NewCourse#JoinUs

Teach For Uzbekistan | Official

@teachforuzbekistan · Post #275 · 30.07.2025 г., 06:43

Mass-media fondi direktori bilan darslar 📚 Mass-media fondi direktori, tajribali media mutaxassisi Jahongir Azimov “Yozgi institut”imizda ishtirokchilarga maxsus darslar o‘tdilar. 💬 Mashg‘ulotlarda “Teamwork and Collaboration” (Jamoaviy ish va hamkorlik) hamda “Effective Communication Techniques” (Samarali muloqot usullari) mavzulari yoritildi. Ishtirokchilar jamoada samarali ishlash, o‘z fikrini ravon yetkazish va professional muomala ko‘nikmalarini amaliy mashqlar orqali rivojlantirdilar. 🤝 Bu darslar bilim boʻlibgina qolmay, kelgusida ishtirokchilarimiz uchun amalda eng foydali tajribalarga ham ega boʻlishdek imkoniyatni yaratdi. Jahongir Azimovga vaqtlarini ayamay kelgani va biz bilan ulashgan bilimlari uchun samimiy minnatdorchiligimizni bildiramiz! 💬💬💬🗣 Sessions with the Director of the Mass Media Foundation 📚 The Director of the National Mass Media Foundation and experienced media specialist Jahongir Azimov held special sessions for participants at our “Summer Institute”. 💬 The sessions covered the topics of “Teamwork and Collaboration” and “Effective Communication Techniques.” Participants enhanced their skills in effective teamwork, clear self-expression, and professional communication through practical exercises. 🤝 These sessions not only provided knowledge but also created an opportunity for our participants to gain valuable experiences that will be beneficial in their future careers. We sincerely thank Jahongir Azimov for taking the time to visit and share his knowledge with us! #TeachForUzbekistan#SummerInstitute#MediaLeadership#CommunicationSkills#Teamwork#JahongirAzimov#MassMediaSupport#YozgiInstitut#IlhomVaTajriba