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


##########
sdks/python/apache_beam/runners/worker/sdk_worker_main.py:
##########
@@ -93,8 +93,22 @@ def create_harness(environment, dry_run=False):
   else:
     fn_log_handler = None
 
-  pipeline_options_dict = _load_pipeline_options(
-      environment.get('PIPELINE_OPTIONS'))
+  options_json = environment.get('PIPELINE_OPTIONS')
+
+  # We check if options are stored in the file.
+  if 'PIPELINE_OPTIONS_FILE' in environment:
+    options_file = environment['PIPELINE_OPTIONS_FILE']
+    try:
+      with open(options_file, 'r') as f:
+        options_json = f.read()
+        _LOGGER.info('Load pipeline options from file: %s', options_file)
+    except:
+      _LOGGER.error(
+          'Failed to load pipeline options from file: %s', options_file)
+      raise

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using a bare `except:` is generally discouraged as it can catch 
system-exiting exceptions like `SystemExit` or `KeyboardInterrupt`. It's better 
to catch a more specific exception, such as `Exception`. Additionally, 
including the exception details in the log message by using `exc_info=True` 
would be helpful for debugging.
   
   ```suggestion
       except Exception:
         _LOGGER.error(
             'Failed to load pipeline options from file: %s',
             options_file,
             exc_info=True)
         raise
   ```



-- 
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