Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"comment": "Modify this file in a trivial way to cause this test suite to run",
"modification": 5
"modification": 6
}
7 changes: 7 additions & 0 deletions runners/spark/job-server/spark_job_server.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}
Comment on lines +284 to +288

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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()
}


def setupTask = project.tasks.register("sparkJobServerSetup", Exec) {
dependsOn shadowJar
def pythonDir = project.project(":sdks:python").projectDir
Expand Down
Loading