@TestFlightX · Post #34125 · 23.09.2024 г., 18:24
#FLIP#FLASHCARDS https://testflight.apple.com/join/J2B2WMZY
Hashtags
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
Пребарај: #flashcards
@TestFlightX · Post #34125 · 23.09.2024 г., 18:24
#FLIP#FLASHCARDS https://testflight.apple.com/join/J2B2WMZY
Hashtags
@testflightynoti · Post #37537 · 03.05.2026 г., 21:56
#Cruxly#AI#Quiz#amp#Flashcards Join the Cruxly AI - Quiz & Flashcards beta on ✈️#TestFlight 🔗 Link: https://testflight.apple.com/join/muAr9ASt Shared by Dimitri
@githubtrending · Post #14651 · 01.05.2025 г., 11:30
#python#agplv3#education#flashcards#foreign_language#hacktoberfest#hacktoberfest2022#language_learning#python#second_language_acquisition#spaced_repetition#svelte LibreLingo is a free, community-driven language-learning platform offering courses like Spanish, German, and French through interactive exercises, spaced repetition, and progress tracking across devices, while allowing users to contribute and modify content for a collaborative learning experience[1][4][5]. https://github.com/kantord/LibreLingo
@githubtrending · Post #15549 · 08.03.2026 г., 12:00
#python#ai_automation#api#audio_overview#claude#cli_tool#flashcards#google_notebooklm#notebooklm#notebooklm_api#notebookln#podcast_generator#python#python_api#quiz_generator#sdk#skills#study_tools notebooklm-py is a free Python tool and CLI for full access to Google NotebookLM's features, like creating notebooks, adding sources (URLs, PDFs, YouTube), chatting, deep research, and generating podcasts, videos, quizzes, slides, mind maps in formats like MP3, MP4, JSON. It offers extras the web lacks, such as batch downloads, editable PPTX, and mind map data. You benefit by automating research, content creation, and exports programmatically for faster prototypes, pipelines, or AI agents—saving time on manual UI work. https://github.com/teng-lin/notebooklm-py