Skip to content

Commit 4e5a338

Browse files
authored
#677: Curly brace is lost from workflow app properties. See https://issues.apache.org/jira/browse/SPARK-17814 (#679)
1 parent 271d152 commit 4e5a338

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/main/scala/za/co/absa/hyperdrive/trigger/scheduler/executors/spark/SparkYarnClusterServiceImpl.scala

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class SparkYarnClusterServiceImpl @Inject()(
7474
.setAppResource(jobParameters.jobJar)
7575
.setAppName(jobName)
7676
.setConf("spark.yarn.tags", id)
77-
.addAppArgs(jobParameters.appArguments.toSeq:_*)
77+
.addAppArgs(jobParameters.appArguments.toSeq.map(fix_json_for_yarn):_*)
7878
.addSparkArg("--verbose")
7979
config.filesToDeploy.foreach(file => sparkLauncher.addFile(file))
8080
config.additionalConfs.foreach(conf => sparkLauncher.setConf(conf._1, conf._2))
@@ -86,4 +86,13 @@ class SparkYarnClusterServiceImpl @Inject()(
8686

8787
sparkLauncher
8888
}
89+
90+
/*
91+
Fixed inspired by https://stackoverflow.com/questions/43040793/scala-via-spark-with-yarn-curly-brackets-string-missing
92+
See https://issues.apache.org/jira/browse/SPARK-17814
93+
Due to YARN bug above, we need to replace all occurrences of {{ or }}, with { { or } }
94+
*/
95+
private def fix_json_for_yarn(arg: String): String = {
96+
arg.replace("}}", "} }").replace("{{", "{ {")
97+
}
8998
}

0 commit comments

Comments
 (0)