@social_justice_watch · Post #17905 · 09.02.2023 г., 18:44
And this is one of the many reasons why self-identification is a thing. (Applicable to ADHDers as well.) #Autism#autistic#ActuallyAutistic#ADHD#AuDHDsource
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
Пребарај: #audhd
@social_justice_watch · Post #17905 · 09.02.2023 г., 18:44
And this is one of the many reasons why self-identification is a thing. (Applicable to ADHDers as well.) #Autism#autistic#ActuallyAutistic#ADHD#AuDHDsource
@social_justice_watch · Post #17968 · 07.03.2023 г., 22:50
Ableist stereotypes are bullshit. Also, we know our neurokin when we see them. 👀😉 #Autism#autistic#ActuallyAutistic#AuDHD#Neurodivergent#AutismAcceptancesource
@social_justice_watch · Post #17902 · 09.02.2023 г., 18:13
It’s like watching a slow-motion train wreck from the conductor’s seat. #Autism#Autistic#ActuallyAutistic#adhd#adhdtwitter#AuDHDsource
@social_justice_watch · Post #18069 · 18.05.2023 г., 00:28
I will always explain my jokes to you. 😘#autistic#ActuallyAutistic#AuDHD#ADHD#Neurodivergent#AutismAcceptancesource
@social_justice_watch · Post #17903 · 09.02.2023 г., 18:34
Facing judgment to provide accommodations can be hard. I see you, though, and maybe someone else does too. #Autism#autistic#ActuallyAutistic#ADHD#AuDHD#parentingstruggles#AutismAcceptancesource
@social_justice_watch · Post #18093 · 31.05.2023 г., 22:12
Alexithymia anyone? #Autism#autistic#ActuallyAutistic#audhd#ADHD#alexithymia #Emotionssource
@social_justice_watch · Post #17983 · 23.03.2023 г., 00:20
Trust me, I would LOVE for my kid’s struggles to be as much in my power to fix as schools seem to think they are. #parentblame#Autism#ADHD#AuDHD#pda#notfineinschool#schoolrefusalsource
@social_justice_watch · Post #18106 · 08.06.2023 г., 21:47
If it ain’t broke - let’s break it again and see what happens! #iep#504plan#ehcp#specialeducation#Autism#autistic#ADHD#AuDHDsource
@social_justice_watch · Post #17899 · 09.02.2023 г., 17:54
Go ahead and call me "anti-science' then. #Autism#autistic#ActuallyAutistic#ADHD#AuDHD#pda#aba#pbs#pbissource
@social_justice_watch · Post #18116 · 20.06.2023 г., 21:11
Pick your battles…but not this one. Put this one back. #Autism#autistic#actuallyautistic#ADHD#AuDHD#sensoryprocessing#SPD#arfid#neurodivergencesource