Skip to content

Commit 8f1f965

Browse files
committed
Fix failed tests due to the side effect of lazy init on model handlers.
1 parent 3bd93c7 commit 8f1f965

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

sdks/python/apache_beam/ml/anomaly/detectors/pyod_adapter.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,15 @@
3636
from apache_beam.ml.inference.utils import _convert_to_result
3737
from pyod.models.base import BaseDetector as PyODBaseDetector
3838

39-
# Turn the used ModelHandler into specifiable
40-
KeyedModelHandler = specifiable(KeyedModelHandler) # type: ignore[misc]
41-
_PostProcessingModelHandler = specifiable(_PostProcessingModelHandler) # type: ignore[misc]
39+
# Turn the used ModelHandler into specifiable, but without lazy init.
40+
KeyedModelHandler = specifiable( # type: ignore[misc]
41+
KeyedModelHandler,
42+
on_demand_init=False,
43+
just_in_time_init=False)
44+
_PostProcessingModelHandler = specifiable( # type: ignore[misc]
45+
_PostProcessingModelHandler,
46+
on_demand_init=False,
47+
just_in_time_init=False)
4248

4349

4450
@specifiable

0 commit comments

Comments
 (0)