Skip to content

[SPARK-41410][K8S][FOLLOWUP] Skip splitSlots and requestNewExecutors in case of 0 snapshot#39079

Closed
dongjoon-hyun wants to merge 2 commits intoapache:masterfrom
dongjoon-hyun:SPARK-41410
Closed

[SPARK-41410][K8S][FOLLOWUP] Skip splitSlots and requestNewExecutors in case of 0 snapshot#39079
dongjoon-hyun wants to merge 2 commits intoapache:masterfrom
dongjoon-hyun:SPARK-41410

Conversation

@dongjoon-hyun
Copy link
Member

@dongjoon-hyun dongjoon-hyun commented Dec 15, 2022

What changes were proposed in this pull request?

This PR is a follow-up to skip allocation code block (splitSlots and requestNewExecutors) completely when the notified snapshots are an empty array.

Why are the changes needed?

When there is no change from K8s control plane side, the notified snapshot is empty like the following. In that case, we still need to do executor clean up, but we don't need to try to create a new executor if we are waiting for new PVCs.

22/12/15 18:08:24 INFO ExecutorPodsAllocator: Going to request 1 executors from Kubernetes for ResourceProfile Id: 0, target: 15, known: 14, sharedSlotFromPendingPods: 2147483646.
22/12/15 18:08:24 INFO ExecutorPodsAllocator: Found 0 reusable PVCs from 15 PVCs
22/12/15 18:08:24 INFO ExecutorPodsAllocator: Wait to reuse one of the existing 15 PVCs.
22/12/15 18:08:25 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:26 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:27 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:28 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:29 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:30 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:31 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:32 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:33 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:34 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:35 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:36 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:37 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:38 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:39 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:40 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:41 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:42 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:43 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:44 INFO ExecutorPodsAllocator: Received 0 snapshots
22/12/15 18:08:45 INFO ExecutorPodsAllocator: Received 0 snapshots

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Pass the CIs.

applicationId: String,
schedulerBackend: KubernetesClusterSchedulerBackend,
snapshots: Seq[ExecutorPodsSnapshot]): Unit = {
logDebug(s"Received ${snapshots.size} snapshots")
Copy link
Member Author

Choose a reason for hiding this comment

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

I added this as DEBUG level because Received 0 snapshots is too verbose.

Comment on lines 356 to +358
val remainingSlotFromPendingPods = maxPendingPods - totalNotRunningPodCount
if (remainingSlotFromPendingPods > 0 && podsToAllocateWithRpId.size > 0) {
if (remainingSlotFromPendingPods > 0 && podsToAllocateWithRpId.size > 0 &&
!(snapshots.isEmpty && podAllocOnPVC && maxPVCs <= PVC_COUNTER.get())) {
Copy link
Member

Choose a reason for hiding this comment

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

This condition is getting complicated now. Can we add a comment on it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure, @viirya

@dongjoon-hyun
Copy link
Member Author

I added comments, @viirya . Since that's comment only change, I'll merge this.
Merged to master for Apache Spark 3.4.0.

@viirya
Copy link
Member

viirya commented Dec 15, 2022

Agreed. Thank you @dongjoon-hyun !

@dongjoon-hyun dongjoon-hyun deleted the SPARK-41410 branch December 16, 2022 00:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants