Commit 10849d9
committed
[SPARK-49034][CORE] Support server-side
### What changes were proposed in this pull request?
Like SPARK-49033, this PR aims to support server-side `sparkProperties` replacement in REST Submission API.
- For example, ephemeral Spark clusters with server-side environment variables can provide backend-resource and information without touching client-side applications and configurations.
- The place holder pattern is `{{SERVER_ENVIRONMENT_VARIABLE_NAME}}` style like the following.
https://github.com/apache/spark/blob/163e512c53208301a8511310023d930d8b77db96/docs/configuration.md?plain=1#L694
https://github.com/apache/spark/blob/163e512c53208301a8511310023d930d8b77db96/core/src/main/scala/org/apache/spark/deploy/rest/StandaloneRestServer.scala#L233-L234
### Why are the changes needed?
A user can submits an environment variable holder like `{{AWS_ENDPOINT_URL}}` in order to use server-wide environment variables of Spark Master.
```
$ SPARK_MASTER_OPTS="-Dspark.master.rest.enabled=true" \
AWS_ENDPOINT_URL=ENDPOINT_FOR_THIS_CLUSTER \
sbin/start-master.sh
$ sbin/start-worker.sh spark://$(hostname):7077
```
```
curl -s -k -XPOST http://localhost:6066/v1/submissions/create \
--header "Content-Type:application/json;charset=UTF-8" \
--data '{
"appResource": "",
"sparkProperties": {
"spark.master": "spark://localhost:7077",
"spark.app.name": "",
"spark.submit.deployMode": "cluster",
"spark.hadoop.fs.s3a.endpoint": "{{AWS_ENDPOINT_URL}}",
"spark.jars": "/Users/dongjoon/APACHE/spark-merge/examples/target/scala-2.13/jars/spark-examples_2.13-4.0.0-SNAPSHOT.jar"
},
"clientSparkVersion": "",
"mainClass": "org.apache.spark.examples.SparkPi",
"environmentVariables": {},
"action": "CreateSubmissionRequest",
"appArgs": [ "10000" ]
}'
```
- http://localhost:4040/environment/

### Does this PR introduce _any_ user-facing change?
No. This is a new feature and disabled by default via `spark.master.rest.enabled (default: false)`
### How was this patch tested?
Pass the CIs with newly added test case.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes apache#47511 from dongjoon-hyun/SPARK-49034-2.
Authored-by: Dongjoon Hyun <dhyun@apple.com>
Signed-off-by: Dongjoon Hyun <dhyun@apple.com>sparkProperties replacement in REST Submission API1 parent 388ca1e commit 10849d9
File tree
2 files changed
+13
-0
lines changed- core/src
- main/scala/org/apache/spark/deploy/rest
- test/scala/org/apache/spark/deploy/rest
2 files changed
+13
-0
lines changedLines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
201 | 201 | | |
202 | 202 | | |
203 | 203 | | |
| 204 | + | |
204 | 205 | | |
205 | 206 | | |
206 | 207 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
457 | 457 | | |
458 | 458 | | |
459 | 459 | | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
460 | 472 | | |
461 | 473 | | |
462 | 474 | | |
| |||
0 commit comments