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

Пребарај: #ukdataprotection

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

@ai_and_law · Post #183 · 07.12.2023 г., 08:04

UK Information Commissioner Appeals Clearview AI Judgment Hi everyone! The UK Information Commissioner is seeking permission to appeal a recent judgment by the First Tier Tribunal (Information Rights) regarding Clearview AI Inc, a US-based company specializing in facial recognition technology. The Tribunal supported the Information Commissioner's Office (ICO) stance that Clearview's processing of personal information, involving the monitoring of individuals through the collection of billions of facial images for access and analysis using AI, falls under UK data protection legislation. While the ICO welcomes the clarity the judgment brings to UK data protection legislation, it contends that the Tribunal incorrectly interpreted the law regarding Clearview's activities. The Commissioner argues that the Tribunal's decision to consider Clearview's processing as falling outside the scope of UK data protection law due to its services for foreign law enforcement agencies is a misinterpretation. John Edwards, the UK Information Commissioner, emphasizes the importance of protecting the data rights of UK citizens, particularly in the context of Clearview's extensive scraping of personal information. He expresses concern about the scale and intrusiveness of Clearview's operations and underscores the need to ensure that commercial enterprises processing digital images of UK residents cannot claim exemption from UK law on the grounds of "law enforcement" purposes. As AI technologies continue to evolve, the case with Clearview highlights the ongoing challenge of striking a balance between fostering innovation in AI solutions and safeguarding individuals' privacy rights. The ICO's appeal seeks to address these nuanced issues and establish clearer boundaries for AI companies operating in the UK. #ClearviewAI#UKDataProtection#AIandPrivacy