elastic/elasticsearch-py

Helpers for `bulk` method such as `async_bulk` sleep in blocking manner, preventing graceful shutdown

开放

#2,484 创建于 2024年3月22日

 (5 条评论) (0 个反应) (0 位负责人)Python (1,206 个派生)batch import
Area: HelpersCategory: Enhancementgood first issuetracking

仓库指标

星标
 (4,060 个星标)
PR 合并指标
 (平均合并 1天 15小时) (30 天内合并 6 个 PR)

描述

We tried using async_bulk and async_streaming_bulk helpers to ingest data into Elasticsearch and they work great, but we've found out that they prevent our code from gracefully shutting down when CTRL+C is pressed.

Example code that sleeps: https://github.com/elastic/elasticsearch-py/blob/e1603f4f25888ca7fee03ee977abafb00d512601/elasticsearch/_async/helpers.py#L249-L251

It would be great to have a way to:

  • Either define how the sleep happens by passing sleep function into the client
  • Make Elasticsearch client internally cancel all sleeps when the client is closed

贡献者指南