feat(submit): update_pending_job tool for editing PENDING submissions
Add an update_pending_job MCP tool that lets callers modify parameters of a PENDING submission before confirm_submit_job: - queue, executor_memory, executor_cores, num_executors - app_name - extra_args - script_path (re-validates file existence and SQL guard) Only PENDING submissions can be updated; SUBMITTED/CANCELLED/FAILED are rejected with HTTP 400.
This commit is contained in:
@@ -27,6 +27,7 @@ from spark_executor.tools.requests import (
|
||||
ReadJobFileRequest,
|
||||
SaveConnectionRequest,
|
||||
UpdateJobFileRequest,
|
||||
UpdatePendingJobRequest,
|
||||
)
|
||||
from spark_executor.tools.status import get_job_status
|
||||
from spark_executor.tools.submit import (
|
||||
@@ -35,6 +36,7 @@ from spark_executor.tools.submit import (
|
||||
get_pending_job,
|
||||
list_pending_jobs,
|
||||
prepare_submit_job,
|
||||
update_pending_job,
|
||||
)
|
||||
|
||||
from spark_executor.tools.result import get_job_result
|
||||
@@ -138,6 +140,19 @@ def _get_pending_job(req: PendingIdRequest):
|
||||
return get_pending_job(req.pending_id)
|
||||
|
||||
|
||||
@app.post(
|
||||
"/update_pending_job",
|
||||
summary="Update an unsubmitted pending submission",
|
||||
description=(
|
||||
"Modify parameters of a PENDING submission before confirm_submit_job. "
|
||||
"Only the provided fields are changed. If script_path is changed, the "
|
||||
"new file must exist and pass the SQL guard."
|
||||
),
|
||||
)
|
||||
def _update_pending_job(req: UpdatePendingJobRequest):
|
||||
return update_pending_job(**req.model_dump(exclude_none=True))
|
||||
|
||||
|
||||
@app.post(
|
||||
"/cancel_pending_job",
|
||||
summary="Cancel a pending submission",
|
||||
|
||||
Reference in New Issue
Block a user