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

Резултати

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

Пребарај: #ola

当前筛选 #ola清除筛选
Addis Standard

@addisstandardeng · Post #21274 · 02.02.2026 г., 07:20

‘Executions, torture, abductions, rape': #Ethiopia’s hidden conflict Wanted by the Ethiopian government, rebel military leader Jaal Marroo moves constantly to stay ahead of drones hunting him from the skies. The rebel commander leads the Oromo Liberation Army (#OLA) from a series of remote forest outpost in #Oromia, the country’s biggest region with a population of roughly 40 million people. The government has designated the former student as a terrorist, accusing the OLA of massacring civilians in ethnically motivated attacks. But in a rare interview from one of his hideouts, Marroo rejected accusations that his fighters target civilians. “Our war is not against the people,” he told The Associated Press. “It is against the brutal regime that has occupied and oppressed the nation for generations.” He added: “We are fighting to correct a system that treats the Oromo as subjects,.... https://web.facebook.com/AddisstandardEng/posts/pfbid02LchK3yaEF3X7SqibhSvj53rCitjKBMKJdagBKhHcwVG65YxSm5eSUkdXGzXaSDhFl

Borkena

@borkena · Post #5934 · 06.03.2026 г., 05:50

Ethiopia: Authorities must investigate sexual violence, summary killings and torture by OLA fighters. Read more. https://borkena.com/2026/03/06/amnesty-international-ethiopian-authorities-must-investigate-sexual-violence-summary-killings-and-torture-by-ola-fighters/#Ethiopia#News#OLA#humanrights

Borkena

@borkena · Post #5916 · 04.03.2026 г., 05:22

Oromo Liberation Army Points Finger At Abiy Ahmed’s Admin. Over Arsi Massacre. Read more. https://borkena.com/2026/03/04/ethiopia-oromo-liberation-army-points-finger-at-abiy-ahmeds-admin-over-arsi-massacre/#Ethiopia#OLA#Arsi

Borkena

@borkena · Post #5940 · 06.03.2026 г., 15:20

“የኦሮሞ ነጻነት ሰራዊት" የሚያደርሰው የአስገድዶ መድረፈ ወንጀል መጋለጡ ፤ ኤርትራ የፕሮቴስታንት እምነት ተክታይ እስረኞችን መፍታቷ ፤ በትግራይ የተጀመረው አዲስ አስገዳጂ ህግ እና ሌሎች ዜናዎች… https://youtu.be/GOLVh2OE2Ik#Ethiopia#news#Oromia#Tigray#Eritrea#OLA

Addis Standard

@addisstandardeng · Post #21815 · 24.03.2026 г., 09:43

News: OLF-OLA joins #Fano in criticizing #Ethiopia’s upcoming election, calls it a ‘hollow ritual’ A week after the #Amhara Fano National Movement issued warnings over participation, the Oromo Liberation Front–Oromo Liberation Army (#OLF-#OLA) has also dismissed Ethiopia’s upcoming national election as lacking credibility, claiming that much of the country remains beyond the reach of a meaningful electoral process. In a press release issued on March 23, the group said the election has been reduced to “a performance staged for foreign consumption,” with over seventy percent of the country inaccessible for credible voting. According to the statement, major opposition parties have either withdrawn or are participating solely to avoid deregistration or to expose what it described as flaws in the process. “All remaining parties in the process are either created by or colluding with the regime,” the group added. Last week, Addis Standard reported, citing the….. Read more: https://addisstandard.com/?p=56026

Addis Standard

@addisstandardeng · Post #21635 · 06.03.2026 г., 17:56

#Ethiopia: OLA outlines factual error in #Amnesty report; calls for independent investigation The Oromo Liberation Army (#OLA) has rejected findings of a recent report by Amnesty International accusing its fighters of gang rape and sexual slavery against women in #western_Oromia, alleging that the report contains “serious methodological flaws and factual errors,” and calling for an independent investigation into abuses committed in the region. In a press release issued on 06 March, the OLA said that while it condemns all forms of gender-based violence and supports efforts to document abuses against civilians, Amnesty’s report titled “No One Came to My Rescue” suffers from investigative shortcomings & fails to conclusively identify the perpetrators of the crimes described. The armed group argued that Amnesty itself acknowledged in the report that it could not verify the identities of the alleged perpetrators at the time of publication, a point the OLA said.. Read more: https://addisstandard.com/?p=55634

Addis Standard

@addisstandardeng · Post #21666 · 10.03.2026 г., 11:03

#Op_ed: Breaking Silence, Demanding Accountability: Confronting war crimes in #Oromia Ewnetu B. Debela cites a report by #Amnesty_International documenting grave atrocities in #Ethiopia’s Oromia region, including gang rape and sexual slavery. He writes, “Under international humanitarian law, these abuses—as well as acts such as the summary execution of civilians and the large-scale forced displacement of populations—constitute war crimes and demand urgent investigation and accountability.” Ewnetu adds that “international observers have also documented widespread abuses… allegedly committed by both government forces and the Oromo Liberation Army (#OLA).” He emphasizes, “Documentation alone, however, is not justice,” warning that “history will judge… those who knew of these atrocities and chose silence over action.” https://addisstandard.com/?p=55692

Addis Standard

@addisstandardeng · Post #21593 · 03.03.2026 г., 13:59

#Ethiopia: Religious councils, OLA condemn killing of civilians in #East_Arsi, call for swift accountability The Permanent Synod of the Ethiopian #Orthodox Tewahedo Church, the #Inter-Religious Council of Ethiopia, and the Ethiopian #Islamic Affairs Supreme Council have issued separate statements condemning the killing of 21 civilians in #Shirka Woreda, East Arsi Zone of #Oromia Region, urging authorities to take immediate action to bring perpetrators to justice and strengthen protection for residents. In their respective statements, the religious institutions denounced the attack and called for swift, transparent investigations, warning against attempts to exploit the incident to incite further violence. The Oromo Liberation Army (#OLA), for its part, accused what it described as “mercenaries” of moving through Arsi Zone and deliberately targeting Orthodox Christian civilians in an effort to inflame inter-religious and inter-ethnic tensions........ Read more: https://addisstandard.com/?p=55518

12
ПретходнаСтраница 1 од 2Следна