Skip to content

Commit ed18c59

Browse files
Remove ingestor.spark.app.name (#268)
Signed-off-by: Kevin Wallimann <[email protected]>
1 parent 4029684 commit ed18c59

12 files changed

+2
-50
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ to identify which configuration options belong to a certain transformer instance
9898
##### Spark settings
9999
| Property Name | Required | Description |
100100
| :--- | :---: | :--- |
101-
| `ingestor.spark.app.name` | Yes | User-defined name of the Spark application. See Spark property `spark.app.name` |
102101
| `ingestor.spark.termination.method` | No | Either `processAllAvailable` (stop query when no more messages are incoming) or `awaitTermination` (stop query on signal, e.g. Ctrl-C). Default: `awaitTermination`. See also [Combination of trigger and termination method](#combination-of-trigger-and-termination-method) |
103102
| `ingestor.spark.await.termination.timeout` | No | Timeout in milliseconds. Stops query when timeout is reached. This option is only valid with termination method `awaitTermination` |
104103

driver/src/main/resources/Ingestion.properties.template

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ component.transformer.id.0=[avro.decoder]
2424
component.transformer.class.[avro.decoder]=za.co.absa.hyperdrive.ingestor.implementation.transformer.avro.confluent.ConfluentAvroDecodingTransformer
2525
component.writer=za.co.absa.hyperdrive.ingestor.implementation.writer.parquet.ParquetStreamWriter
2626

27-
# Spark settings
28-
ingestor.spark.app.name=ingestor-app-pane
29-
3027
# Source(Kafka) settings
3128
reader.kafka.topic=souce-payload-topic
3229
reader.kafka.brokers=PLAINTEXT\://broker1\:9091,SSL\://broker2:9092

driver/src/main/scala/za/co/absa/hyperdrive/driver/SparkIngestor.scala

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ object SparkIngestor extends SparkIngestorAttributes {
104104

105105
def apply(conf: Configuration): SparkIngestor = {
106106
ComponentFactoryUtil.validateConfiguration(conf, getProperties)
107-
val spark = getSparkSession(conf)
107+
val spark = SparkSession.builder().getOrCreate()
108108
val terminationMethod = getTerminationMethod(conf)
109109
val awaitTerminationTimeout = getAwaitTerminationTimeoutMs(conf)
110110

@@ -138,10 +138,4 @@ object SparkIngestor extends SparkIngestorAttributes {
138138
}
139139
)
140140
}
141-
142-
private def getSparkSession(conf: Configuration): SparkSession = {
143-
val name = ConfigUtils.getOrThrow(KEY_APP_NAME, conf)
144-
SparkSession.builder().appName(name).getOrCreate()
145-
}
146-
147141
}

driver/src/main/scala/za/co/absa/hyperdrive/driver/SparkIngestorAttributes.scala

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import za.co.absa.hyperdrive.ingestor.api.{HasComponentAttributes, PropertyMetad
2020

2121
trait SparkIngestorAttributes extends HasComponentAttributes {
2222
val keysPrefix = "ingestor.spark"
23-
val KEY_APP_NAME = s"$keysPrefix.app.name"
2423
val KEY_TERMINATION_METHOD = s"$keysPrefix.termination.method"
2524
val KEY_AWAIT_TERMINATION_TIMEOUT = s"$keysPrefix.await.termination.timeout"
2625

@@ -29,7 +28,6 @@ trait SparkIngestorAttributes extends HasComponentAttributes {
2928
override def getDescription: String = "Component that invokes Spark for the ingestion"
3029

3130
override def getProperties: Map[String, PropertyMetadata] = Map(
32-
KEY_APP_NAME -> PropertyMetadata("Name of Spark application", None, required = true),
3331
KEY_TERMINATION_METHOD -> PropertyMetadata("Termination method",
3432
Some(s"Either '$ProcessAllAvailable' (stop when no more messages arrive) or '$AwaitTermination' (stop on signal)." +
3533
s" Default is '$ProcessAllAvailable'"), required = false),

driver/src/test/resources/ingestion.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
# limitations under the License.
1414
#
1515

16-
ingestor.spark.app.name=any_name
1716
reader.kafka.brokers=localhost:9092,otherhost:9093
1817
ssl.keystore.password=any-keystore!!@#$% password
1918
ssl.truststore.password=kd9910))383(((*-+

driver/src/test/scala/za/co/absa/hyperdrive/driver/TestSparkIngestor.scala

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,7 @@ class TestSparkIngestor extends FlatSpec with BeforeAndAfterEach with MockitoSug
3838

3939
private val dataFrame: DataFrame = mock[DataFrame]
4040
private val streamingQuery: StreamingQuery = mock[StreamingQuery]
41-
private val configuration = {
42-
val config = new BaseConfiguration
43-
config.addProperty(SparkIngestor.KEY_APP_NAME, "my-app-name")
44-
config
45-
}
41+
private val configuration = new BaseConfiguration
4642

4743
override def beforeEach(): Unit = {
4844
reset(
@@ -100,23 +96,8 @@ class TestSparkIngestor extends FlatSpec with BeforeAndAfterEach with MockitoSug
10096
verify(streamingQuery).awaitTermination()
10197
}
10298

103-
it should "use the configured app name" in {
104-
val config = new BaseConfiguration
105-
config.addProperty(SparkIngestor.KEY_APP_NAME, "my-app-name")
106-
val sparkIngestor = SparkIngestor(config)
107-
108-
sparkIngestor.spark.conf.get("spark.app.name") shouldBe "my-app-name"
109-
}
110-
111-
it should "throw if no app name is configured" in {
112-
val throwable = intercept[IllegalArgumentException](SparkIngestor(new BaseConfiguration))
113-
114-
throwable.getMessage should include(SparkIngestor.KEY_APP_NAME)
115-
}
116-
11799
it should "use terminationMethod awaitTermination if configured" in {
118100
val config = new BaseConfiguration
119-
config.addProperty(SparkIngestor.KEY_APP_NAME, "my-spark-app")
120101
val sparkIngestor = SparkIngestor(config)
121102
when(streamReader.read(any[SparkSession])).thenReturn(dataFrame)
122103
when(streamTransformer.transform(dataFrame)).thenReturn(dataFrame)
@@ -129,7 +110,6 @@ class TestSparkIngestor extends FlatSpec with BeforeAndAfterEach with MockitoSug
129110

130111
it should "use timeout if configured with terminationMethod awaitTermination" in {
131112
val config = new BaseConfiguration
132-
config.addProperty(SparkIngestor.KEY_APP_NAME, "my-spark-app")
133113
config.addProperty(s"${SparkIngestor.KEY_AWAIT_TERMINATION_TIMEOUT}", "10000")
134114
val sparkIngestor = SparkIngestor(config)
135115
when(streamReader.read(any[SparkSession])).thenReturn(dataFrame)
@@ -143,7 +123,6 @@ class TestSparkIngestor extends FlatSpec with BeforeAndAfterEach with MockitoSug
143123

144124
it should "throw if an invalid terminationMethod is configured" in {
145125
val config = new BaseConfiguration
146-
config.addProperty(SparkIngestor.KEY_APP_NAME, "my-spark-app")
147126
config.addProperty(s"${SparkIngestor.KEY_TERMINATION_METHOD}", "non-existent")
148127
val throwable = intercept[IllegalArgumentException](SparkIngestor(config))
149128

@@ -152,7 +131,6 @@ class TestSparkIngestor extends FlatSpec with BeforeAndAfterEach with MockitoSug
152131

153132
it should "throw if a timeout is not a number" in {
154133
val config = new BaseConfiguration
155-
config.addProperty(SparkIngestor.KEY_APP_NAME, "my-spark-app")
156134
config.addProperty(s"${SparkIngestor.KEY_AWAIT_TERMINATION_TIMEOUT}", "nan")
157135
val throwable = intercept[IllegalArgumentException](SparkIngestor(config))
158136

driver/src/test/scala/za/co/absa/hyperdrive/driver/drivers/KafkaToKafkaDeduplicationAfterRetryDockerTest.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ class KafkaToKafkaDeduplicationAfterRetryDockerTest extends FlatSpec with Matche
162162
"component.writer" -> "za.co.absa.hyperdrive.ingestor.implementation.writer.kafka.KafkaStreamWriter",
163163

164164
// Spark settings
165-
"ingestor.spark.app.name" -> "ingestor-app",
166165
"ingestor.spark.termination.timeout" -> "60000",
167166

168167
// Source(Kafka) settings

driver/src/test/scala/za/co/absa/hyperdrive/driver/drivers/KafkaToKafkaDockerTest.scala

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ class KafkaToKafkaDockerTest extends FlatSpec with Matchers with SparkTestBase w
9393
"component.writer" -> "za.co.absa.hyperdrive.ingestor.implementation.writer.kafka.KafkaStreamWriter",
9494

9595
// Spark settings
96-
"ingestor.spark.app.name" -> "ingestor-app",
9796
"ingestor.spark.termination.method" -> "ProcessAllAvailable",
9897

9998
// Source(Kafka) settings

driver/src/test/scala/za/co/absa/hyperdrive/driver/drivers/KafkaToParquetDockerTest.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,6 @@ class KafkaToParquetDockerTest extends FlatSpec with Matchers with SparkTestBase
7878
"component.transformer.class.column.selector" -> "za.co.absa.hyperdrive.ingestor.implementation.transformer.column.selection.ColumnSelectorStreamTransformer",
7979
"component.writer" -> "za.co.absa.hyperdrive.ingestor.implementation.writer.parquet.ParquetStreamWriter",
8080

81-
// Spark settings
82-
"ingestor.spark.app.name" -> "ingestor-app",
83-
8481
// Source(Kafka) settings
8582
"reader.kafka.topic" -> topic,
8683
"reader.kafka.brokers" -> kafkaSchemaRegistryWrapper.kafkaUrl,

driver/src/test/scala/za/co/absa/hyperdrive/driver/drivers/KafkaToParquetIncrementingVersionDockerTest.scala

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,6 @@ class KafkaToParquetIncrementingVersionDockerTest extends FlatSpec with Matchers
6868
"component.transformer.class.[column.renamer]" -> "za.co.absa.hyperdrive.ingestor.implementation.transformer.column.renaming.ColumnRenamingStreamTransformer",
6969
"component.writer" -> "za.co.absa.hyperdrive.ingestor.implementation.writer.parquet.ParquetStreamWriter",
7070

71-
// Spark settings
72-
"ingestor.spark.app.name" -> "ingestor-app",
73-
7471
// Source(Kafka) settings
7572
"reader.kafka.topic" -> topic,
7673
"reader.kafka.brokers" -> kafkaSchemaRegistryWrapper.kafkaUrl,

0 commit comments

Comments
 (0)