gemini-code-assist[bot] commented on code in PR #35965:
URL: https://github.com/apache/beam/pull/35965#discussion_r2305792756


##########
sdks/python/apache_beam/transforms/core.py:
##########
@@ -2289,8 +2300,17 @@ def __init__(
     self._timeout = timeout
     self._error_handler = error_handler
     self._on_failure_callback = on_failure_callback
+    self._allow_unsafe_userstate_in_process = allow_unsafe_userstate_in_process
 
   def expand(self, pcoll):
+    if self._allow_unsafe_userstate_in_process:
+      if self._use_subprocess or self._timeout:
+        # TODO(https://github.com/apache/beam/issues/35976): Implement this
+        raise Exception(
+            'allow_unsafe_userstate_in_process is incompatible with ' +
+            'exception handling done with subprocesses or timeouts. If you ' +
+            'need this feature, comment in ' +
+            'https://github.com/apache/beam/issues/35976')

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `NotImplementedError` would be more idiomatic here instead of a 
generic `Exception`, as this functionality is planned but not yet implemented, 
as indicated by the TODO comment.
   
   ```suggestion
           raise NotImplementedError(
               'allow_unsafe_userstate_in_process is incompatible with ' +
               'exception handling done with subprocesses or timeouts. If you ' 
+
               'need this feature, comment in ' +
               'https://github.com/apache/beam/issues/35976')
   ```



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to