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

Резултати

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

Пребарај: #facadedesign

当前筛选 #facadedesign清除筛选

Ørsted Gardens. Ørsted Gardens transformed a dilapidated building (see third image) into a new social space with semi-private decks for the individual residents. Ørsted Gardens by Tegnestuen Lokal – "If we want to achieve a sustainable future, we cannot rely on only building sustainable buildings going forward. We need to have a visionary method of transforming and adapting existing buildings to meet our changing needs. Ørsted Gardens is an example of a project that brings a generic renovation to a new level, improving the visual and social environment for residents and visitors alike." #arch_shovel#architecture#archdaily#facadedesign

3XN Architect’s proposal for SRPJ in Tokyo. The design for The Shibuya Upper West project, 𝗧𝗵𝗲 𝗪𝗮𝘃𝗲𝘀, began from the inside out – understanding the target user groups, identifying key project aspirations for this new ecosystem nestled within Shibuya and Tokyo, and ensuring a clear, uncomplicated method of articulation that amplifies the spatial qualities within, without compromising the functionality and efficiency of a retail development. Taking cues from nature as a means of creating balance between the more hard edge, urban environment of Shibuya, the simple massing articulation, or gesture mimics the pattern of waves and their undulating movement, with imagery that also evokes the contemplative and soothing gestures of raked brush strokes seen in tranquil rock gardens, evoking a sense of calm and excitement, easily recognisable and yet able to stand apart from the surrounding context. Huge congratulations to Snohetta for their winning design! #3xnarchitects#tokyo#facadedesign #facade#arch_shovel

‘Where’s House Warehouse’ by pbm Architects defies typical warehouse stereotypes with an ethereal design in Bangkok. The architects crafted a multi-use space blending office and storage functions. Its facade, made of glass cuboids, breaks the monotony of industrial contexts. The concept evolved from merging living, working, and storage areas seamlessly, fostering interaction and fluidity. Architecture: PBM Architects Images: Spaceshift Studio 📍Bangkok, Thailand . #facadedesign#glassarchitecture#thaiarchitecture#industrialarchitecture#arch_shovel

Facades for the OPPO Super Flagship Store. Bamboo inspired the facade design for the OPPO Super Flagship Store in the city of Guangzhou. An important source of food, clothing, housing, and transportation for people in Guangzhou in ancient times, the design adds a contemporary twist to the vernacular architecture of the city. Photos: CreatAR images Architecture: UnStudio #unstudio#benvanberkel#materialmonth#architecture#facadedesign#arch_shovel

Do you know how many silver spheres are on the facade of the Hanjie Wanda Square in Wuhan, China? 42,333. While they all may look identical, their specific positions involving each other recreate the effect of movement and reflection in water or the sensuous folds of silk fabric. Photos: Edmon Leong / UNStudio #unstudio#facades#facadedesign#architecture#retaildesign#lightingdesign#arch_shovel

Can you guess what inspired Unstudio architecture’s design for the facade elements of the Shenzhen Maritime Museum? Comment your answer below! #unstudio#ceramicdesign#facadedesign#worldmuseums#museumsoftheworld#museumdesign#architecture#architecturaldesign#arch_shovel