Skip to content

[SPARK-60018] Add ApplicationStateSummary.Suspended and ApplicationStatus#resume - #946

Closed
dongjoon-hyun wants to merge 2 commits into
apache:mainfrom
dongjoon-hyun:SPARK-60018
Closed

dongjoon-hyun wants to merge 2 commits into
apache:mainfrom
dongjoon-hyun:SPARK-60018

Conversation

@dongjoon-hyun

Copy link
Copy Markdown
Member

What changes were proposed in this pull request?

This PR aims to add ApplicationStateSummary.Suspended and ApplicationStatus#resume.

  • Add Suspended to ApplicationStateSummary, and make isStopping() exclude it. Otherwise, AppCleanUpStep would end a suspended application. The result for the existing states is unchanged.
  • Add ApplicationStatus#resume, which starts the next attempt of a Suspended application from Submitted. Unlike a restart, it does not increase the restart counters, and it resets only schedulingFailureRestartCounter.
  • Add Suspended to the SparkApplication CRD of spark.apache.org/v1, and update docs/migration_guide.md.

Why are the changes needed?

To support spec.suspend for a running SparkApplication in a follow-up PR. Currently, it takes effect only before the driver is requested.

Does this PR introduce any user-facing change?

Yes, in the API only. Unlike 1.0.0 (2026-07-23), the SparkApplication CRD accepts the Suspended state, an exhaustive switch over ApplicationStateSummary needs a case for Suspended, and ApplicationStatus has the new public method resume. There is no behavior change, since nothing uses them until the follow-up PR.

How was this patch tested?

Pass the CIs with the newly added test cases.

Was this patch authored or co-authored using generative AI tooling?

Generated-by: Claude Opus 5.5

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Could you review this PR when you have some time, @viirya ?

@viirya viirya left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The API changes look reasonable to me. Appending Suspended preserves the existing enum ordinals, and the revised isStopping() preserves the classification of all existing states. Extracting startNextAttempt() also keeps the existing restart history handling intact.

The distinction between resuming and restarting is clear: resuming advances the attempt ID without consuming the restart budget, while resetting the consecutive scheduling-failure counter. The tests cover both history modes and useful interactions with subsequent failures.

No blocking concerns found in this API-only change. For the separate PR that wires up running-application suspension, please cover reconciliation of persisted Suspended states (the current reconciler routes them to the unknown-state handler) and decide whether explicit resumption should bypass restart backoff (AppInitStep currently applies it whenever previousAttemptSummary is non-null, including after resume()). These are follow-up integration notes, not requests to expand this PR.

}

/**
* Starts a new attempt of a suspended application which is resumed. Like a restart, the new

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Non-blocking documentation suggestion: could we explicitly state that this method only constructs the next status and that callers must complete the required cleanup of the suspended attempt before starting the next one? This would make the caller's responsibility clear, similar to the resource-release precondition documented on terminateOrRestart().

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thank you, @viirya. I added a paragraph saying that it only creates the status of the new attempt, and that the resources of the suspended attempt are expected to be released already, like terminateOrRestart.

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you for the review and approval, @viirya. Both notes are covered by the follow-up PR.

  • SparkAppReconciler will route Suspended to a new AppSuspendStep instead of AppUnknownStateStep.
  • AppInitStep will apply the restart backoff only in ScheduledToRestart, so an attempt which resume starts from Submitted will not wait for it.

@viirya

viirya commented Oct 7, 2026

Copy link
Copy Markdown
Member

Thank you @dongjoon-hyun !

@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Thank you always, @viirya !

@dongjoon-hyun dongjoon-hyun added this to the 1.1.0 milestone Oct 7, 2026
@dongjoon-hyun

Copy link
Copy Markdown
Member Author

Merged to main

@dongjoon-hyun
dongjoon-hyun deleted the SPARK-60018 branch October 7, 2026 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants