Skip to content

Commit

Permalink
[SPARK-38802][K8S][TESTS] Add Support for `spark.kubernetes.test.(dri…
Browse files Browse the repository at this point in the history
…ver|executor)RequestCores`

### What changes were proposed in this pull request?
This patch adds support for `spark.kubernetes.test.(driver|executor)RequestCores`, this help devs set specific cores info for (driver|executor)RequestCores.

### Why are the changes needed?
In some cases (such as resource limited case), we want to set specifc `RequestCores`.
See also: apache#35830 (review)

### Does this PR introduce _any_ user-facing change?
No, test only

### How was this patch tested?
IT passed

Closes apache#36087 from Yikun/SPARK-38802.

Authored-by: Yikun Jiang <yikunkero@gmail.com>
Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
  • Loading branch information
Yikun committed Sep 20, 2022
1 parent d616da7 commit 8258bad
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
16 changes: 16 additions & 0 deletions resource-managers/kubernetes/integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,22 @@ to the wrapper scripts and using the wrapper scripts will simply set these appro
</td>
<td></td>
</tr>
<tr>
<td><code>spark.kubernetes.test.driverRequestCores</code></td>
<td>
Set cpu resource for each driver pod in test, this is currently only for test on cpu resource limited cluster,
it's not recommended for other scenarios.
</td>
<td></td>
</tr>
<tr>
<td><code>spark.kubernetes.test.executorRequestCores</code></td>
<td>
Set cpu resource for each executor pod in test, this is currently only for test on cpu resource limited cluster,
it's not recommended for other scenarios.
</td>
<td></td>
</tr>
</table>

# Running the Kubernetes Integration Tests with SBT
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,12 @@ class KubernetesSuite extends SparkFunSuite
.set("spark.kubernetes.driver.label.spark-app-locator", appLocator)
.set("spark.kubernetes.executor.label.spark-app-locator", appLocator)
.set(NETWORK_AUTH_ENABLED.key, "true")
sys.props.get(CONFIG_DRIVER_REQUEST_CORES).map { cpu =>
sparkAppConf.set("spark.kubernetes.driver.request.cores", cpu)
}
sys.props.get(CONFIG_EXECUTOR_REQUEST_CORES).map { cpu =>
sparkAppConf.set("spark.kubernetes.executor.request.cores", cpu)
}
if (!kubernetesTestComponents.hasUserSpecifiedNamespace) {
kubernetesTestComponents.createNamespace()
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ object TestConstants {
val CONFIG_KEY_IMAGE_TAG_FILE = "spark.kubernetes.test.imageTagFile"
val CONFIG_KEY_IMAGE_REPO = "spark.kubernetes.test.imageRepo"
val CONFIG_KEY_UNPACK_DIR = "spark.kubernetes.test.unpackSparkDir"
val CONFIG_DRIVER_REQUEST_CORES = "spark.kubernetes.test.driverRequestCores"
val CONFIG_EXECUTOR_REQUEST_CORES = "spark.kubernetes.test.executorRequestCores"
}

0 comments on commit 8258bad

Please sign in to comment.