shunping commented on code in PR #34310: URL: https://github.com/apache/beam/pull/34310#discussion_r1998962935
########## sdks/python/apache_beam/ml/anomaly/specifiable.py: ########## @@ -195,14 +189,19 @@ def to_spec(self) -> Spec: f"'{type(self).__name__}' not registered as Specifiable. " f"Decorate ({type(self).__name__}) with @specifiable") - args = {k: self._to_spec_helper(v) for k, v in self.init_kwargs.items()} + args = {k: _to_spec_helper(v) for k, v in self.init_kwargs.items()} - return Spec(type=self.__class__.spec_type, config=args) + return Spec(type=self.spec_type(), config=args) def run_original_init(self) -> None: """Invoke the original __init__ method with original keyword arguments""" pass + @classmethod + def unspecifiable(cls) -> None: + """Resume the class structure prior to specifiable""" Review Comment: This is needed for making tests in #34311 pass. It seems the test runner executes multiple tests in the same process. If we make a `SklearnModelHandlerNumpy` specifiable, some tests under the RunInference test suite will fail since we modify the cached `SklearnModelHandlerNumpy` class. In this case, we will need turn it back to original by making it unspecifiable again. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: github-unsubscr...@beam.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org