Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Batch: re-added rate-limited objects stay in results.objs.all_responses as errors

オープン 初心者向け
#2,179 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@inchang-ing がすでに取り組んでいます。

2026年10月2日 から。

  • #2180 @inchang-ing による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
82/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
api

調査の方向性

weaviate/collections/batch/base.py の _BatchBase.__send_batch から始め、mock gRPC fixture を使って mock_tests/test_probe_readd_dep020.py で再現します。retry によって古い ErrorObject が削除され、Dep020 警告が出力されず、非推奨の all_responses を読み取ることなく 4 つの結果エントリが残ることを確認します。

索引モデルが issue の本文から書いたものです。

説明

A rate-limited batch emits Dep020 in code that never reads all_responses, because the re-add in _BatchBase.__send_batch reads the deprecated property (weaviate/collections/batch/base.py:720). That line also filters by list position, while errors and uuids filter by the batch-wide index of the object. From the second chunk on the two differ, and the ErrorObject of the re-added object stays in _all_responses after its retry succeeds.

Mock gRPC server at 38f30c1 with the mock_tests/conftest.py fixtures, 4 objects through fixed_size(batch_size=2, concurrent_requests=1), the first object of the second chunk rate-limited once. The test never reads all_responses:

$ pytest mock_tests/test_probe_readd_dep020.py -q -s
Dep020 during batch=1 errors=0 len(_all_responses)=5 stale=1
mock_tests/test_probe_readd_dep020.py
import warnings
import weaviate
from weaviate.collections.classes.batch import ErrorObject
from weaviate.proto.v1 import batch_pb2, weaviate_pb2_grpc
from .conftest import MOCK_IP, MOCK_PORT, MOCK_PORT_GRPC, mock_class


class Svc(weaviate_pb2_grpc.WeaviateServicer):
    calls = 0

    def BatchObjects(self, request, context):
        self.calls += 1
        if self.calls == 2:  # second chunk, once: rate-limit its first object
            return batch_pb2.BatchObjectsReply(errors=[{"index": 0, "error": "failed with status: 503 error"}])
        return batch_pb2.BatchObjectsReply()


def test_readd(weaviate_mock, start_grpc_server):
    weaviate_mock.expect_request(f"/v1/schema/{mock_class['class']}").respond_with_json(mock_class)
    weaviate_pb2_grpc.add_WeaviateServicer_to_server(Svc(), start_grpc_server)
    client = weaviate.connect_to_local(port=MOCK_PORT, host=MOCK_IP, grpc_port=MOCK_PORT_GRPC)
    try:
        col = client.collections.use(mock_class["class"])
        with warnings.catch_warnings(record=True) as w:
            warnings.simplefilter("always")
            with col.batch.fixed_size(batch_size=2, concurrent_requests=1) as b:
                for i in range(4):
                    b.add_object({"name": f"o{i}"})
        r = col.batch.results.objs
        dep = [x for x in w if "all_responses" in str(x.message)]
        stale = [x for x in r._all_responses if isinstance(x, ErrorObject)]
        print(f"\nDep020 during batch={len(dep)} errors={len(r.errors)} "
              f"len(_all_responses)={len(r._all_responses)} stale={len(stale)}")
    finally:
        client.close()

Expected: no warning and 4 entries. Reading _all_responses and filtering on err.object_.index fixes both. #2166 already edits this function.

@tsmith023, you added Dep020. Would you rather take that one-line fix, or remove all_responses now that its Q4 2024 date has passed?

主要言語
Python
スター
228
フォーク
161
平均マージ
2日 9時間
マージ済み PR(30日)
12

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

weaviate/weaviate-python-client のほかの issue

weaviate/weaviate-python-client の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。