dongjoon-hyun opened a new pull request, #58294:
URL: https://github.com/apache/spark/pull/58294

   ### What changes were proposed in this pull request?
   
   This PR adds a read-only REST API endpoint that reports whether an 
application is held by
   `SparkContext.holdExecutors()` (SPARK-58828):
   
   ```
   $ curl -s "http://localhost:4040/api/v1/applications/$APP_ID/holdstatus";
   {"supported":true,"held":true,"draining":2}
   ```
   
   `supported` is whether the deployment allows holding, `held` is whether the 
executors are
   currently held, and `draining` is the number of executors that have not 
exited yet (`0` when
   the application is not held).
   
   Holding and resuming stay on the existing `/jobs/hold/` and `/jobs/resume/` 
POST endpoints,
   which require modify permissions, while reading this status only requires 
view permissions.
   Like the thread dump endpoints, it is live-only and returns `503` on the 
history server.
   
   ### Why are the changes needed?
   
   `holdExecutors()` is asynchronous: the executors keep running their tasks 
and exit afterwards.
   That state is rendered only as HTML on the Jobs page today, and the 
`/jobs/hold/` POST answers
   with a `302` redirect carrying no outcome, so automation has to scrape the 
UI. With this
   endpoint a client can hold an application and then poll until `held && 
draining == 0`, and can
   check `supported` beforehand instead of requesting a hold that silently does 
nothing.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes, this adds a new REST API endpoint, 
`/api/v1/applications/[app-id]/holdstatus`, documented
   in `docs/monitoring.md`. No existing endpoint or behavior changes.
   
   ### How was this patch tested?
   
   Pass the CIs with the new unit tests in `UISeleniumSuite` (the reported 
status across a hold
   and the following drain, and `supported = false` on a local backend) and 
`HistoryServerSuite`
   (the `503` through the history server).
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   Generated-by: Claude Opus 5


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to