[Bug]: [RunInference] max_models_per_worker_hint is not enforced
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
研究方向
Start in sdks/python/apache_beam/ml/inference/base.py around the max-workers logic at lines 852–857, and trace how locks and deserialized RunInference handlers interact with the shared _ModelHandlerManager. Use the issue’s reproduction as a starting point and check existing Python SDK inference tests. Done when the model limit remains at the configured hint across multiple handler copies and the regression is covered by a test.
由索引模型根據 Issue 內容生成。
描述
What happened?
The intent of max_models_per_worker hint is to limit the number of models that will be loaded per SDK process.
The logic to increment allowed max number of workers https://github.com/apache/beam/blob/dabcf50ffbf532bb30a1233927cd1edb6ae067bb/sdks/python/apache_beam/ml/inference/base.py#L852-L857 appears to be flawed since:
- The lock acquisition always succeeds (it's a new lock instance)
- If there is more than 1 process bundle descriptor over the life time of the SDK process, we might have more than 1 copy of the deserialized RunInference DoFn with unpickled ModelHandler instance, which won't persist
self._max_models_per_worker_hint = Nonefrom a prior initialization:
AI repro:
from apache_beam.internal import pickler
from apache_beam.ml.inference import base
class Model:
def predict(self, x):
return x
class Handler(base.ModelHandler):
def load_model(self):
return Model()
def run_inference(self, batch, model, inference_args=None):
return [model.predict(x) for x in batch]
mhs = [base.KeyModelMapping([k], Handler()) for k in ('a', 'b', 'c')]
keyed_handler = base.KeyedModelHandler(mhs, max_models_per_worker_hint=1)
# RunInference shares one _ModelHandlerManager per transform across all
# DoFn instances (and processes) via MultiProcessShared.
manager = keyed_handler.load_model()
# 5 DoFn instances in one process (harness threads, re-created bundle
# processors); each deserializes its own copy of the model handler.
for _ in range(5):
handler_copy = pickler.roundtrip(keyed_handler)
handler_copy.override_metrics('ns')
handler_copy.run_inference([('a', 1), ('b', 2), ('c', 3)], manager)
print('model limit:', manager._max_models) # 5, expected 1
print('models in memory:', len(manager._tag_map)) # 3
Issue Priority
Priority: 2 (default / most bugs should be filed as P2)
Issue Components
- Component: Python SDK
- Component: Java SDK
- Component: Go SDK
- Component: Typescript SDK
- Component: IO connector
- Component: Beam YAML
- Component: Beam examples
- Component: Beam playground
- Component: Beam katas
- Component: Website
- Component: Infrastructure
- Component: Spark Runner
- Component: Flink Runner
- Component: Prism Runner
- Component: Twister2 Runner
- Component: Hazelcast Jet Runner
- Component: Google Cloud Dataflow Runner
- 主要語言
- Java
- 星號
- 8.7k
- 分支
- 4.7k
- 平均合併
- 2 天 8 小時
- 30 天內合併 PR
- 246
環境準備
- 沒有 Dockerfile 或 Docker Compose 檔案
- 有 Pull Request 範本
- 閱讀貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
apache/beam 的其他 Issue
-
[Bug]: Row.toString throws for an ITERABLE field that is not backed by a List可能已有人在做 @PDGGK 於 56 天前認領。 未關閉java P3
難度 2/5 1-3 小時 新手友好度 76/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
apache/beam#39624 · 2 個 reaction ·
維護者通常 1 天內回覆
-
[Failing Test]: JmsIOTest. testCheckpointMark flaky可能已有人在做 @mxtymoshyk 於 14 天前認領。 未關閉bug failing test flake P2 pinned tests
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆
-
[Bug]: PubsubIO used in batch incorrect batch cutoff size可能已有人在做 @1fanwang 於 45 天前認領。 未關閉bug io P3 pinned pubsub
難度 2/5 1-3 小時 新手友好度 78/100
維護者通常 1 天內回覆
-
build P3 sub-task
難度 1/5 1 小時以內 新手友好度 68/100
維護者通常 1 天內回覆
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 60/100
維護者通常 1 天內回覆
-
[BUG] S3 CORS responses omit Access-Control-Allow-Credentials for matched origins可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
securityHeaders replaces a route's own Content-Security-Policy (0.9.9; weakens embedders' pages)未關閉bug
難度 2/5 1-3 小時 新手友好度 72/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 72/100
sqlcipher/sqlcipher-android#97 · 1 則留言 ·
-
area-integrations
難度 2/5 1-3 小時 新手友好度 68/100
維護者通常 1 天內回覆