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


##########
runners/spark/job-server/spark_job_server.gradle:
##########
@@ -280,6 +280,13 @@ def sparkJobServerJvmArgs() {
   return []
 }
 
+// TestPortableRunner starts SparkJobServerDriver in-process in the test JVM.
+['validatesPortableRunnerDocker', 'validatesPortableRunnerBatch', 
'validatesPortableRunnerStreaming'].each { taskName ->
+  tasks.named(taskName) {
+    jvmArgs += sparkJobServerJvmArgs()
+  }
+}

Review Comment:
   ![medium](https://www.gstatic.com/codereviewagent/medium-priority.svg)
   
   Using `tasks.named(taskName)` will throw an `UnknownTaskException` during 
Gradle's configuration phase if any of these tasks are not registered (for 
example, if certain plugins are conditionally applied or if the tasks are 
defined in a different order/subproject).
   
   Using `tasks.matching { ... }.configureEach { ... }` is safer and more 
robust as it supports configuration avoidance and will not fail if a task is 
not present.
   
   ```
   tasks.matching { it.name in ['validatesPortableRunnerDocker', 
'validatesPortableRunnerBatch', 'validatesPortableRunnerStreaming'] 
}.configureEach {
     jvmArgs += sparkJobServerJvmArgs()
   }
   ```



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