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


##########
sdks/python/apache_beam/runners/portability/job_server.py:
##########
@@ -175,8 +175,8 @@ def subprocess_cmd_and_endpoint(self):
         self._artifacts_dir if self._artifacts_dir else self.local_temp_dir(
             prefix='artifacts'))
     job_port, = subprocess_server.pick_port(self._job_port)
-    subprocess_cmd = [self._java_launcher, '-jar'] + self._jvm_properties + [
-        jar_path
+    subprocess_cmd = [self._java_launcher] + list(self._jvm_properties) + [
+        '-jar', jar_path

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   If `self._jvm_properties` is `None`, calling `list(self._jvm_properties)` 
will raise a `TypeError`. Using `self._jvm_properties or []` provides a safe 
fallback to prevent potential runtime errors.
   
   ```suggestion
       subprocess_cmd = [self._java_launcher] + list(self._jvm_properties or 
[]) + [
           '-jar', jar_path
   ```



##########
sdks/python/apache_beam/runners/portability/spark_runner.py:
##########
@@ -84,6 +91,10 @@ def __init__(self, options):
     self._jar = options.spark_job_server_jar
     self._master_url = options.spark_master_url
     self._spark_version = options.spark_version
+    self._jvm_properties = list(self._jvm_properties)
+    for arg in SPARK_JAR_JOB_SERVER_JVM_ARGS:
+      if arg not in self._jvm_properties:
+        self._jvm_properties.append(arg)

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   If `self._jvm_properties` is `None`, calling `list(self._jvm_properties)` 
will raise a `TypeError`. Using `self._jvm_properties or []` ensures the code 
is robust against `None` values.
   
   ```suggestion
       self._jvm_properties = list(self._jvm_properties or [])
       for arg in SPARK_JAR_JOB_SERVER_JVM_ARGS:
         if arg not in self._jvm_properties:
           self._jvm_properties.append(arg)
   ```



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