feat(submit): require explicit confirmation for all prepare_submit_job params

Remove defaults from queue, executor_memory, executor_cores,
num_executors, and app_name in prepare_submit_job. All must now be
explicitly confirmed by the caller.

Also add extra_args to the PendingSubmission snapshot so users can
confirm non-conf spark-submit flags (e.g. --jars, --py-files) at
prepare time; confirm_submit_job passes them through to
build_spark_submit_command.

This is an intentional breaking change to the MCP tool contract:
callers can no longer rely on implicit defaults.
This commit is contained in:
Claude
2026-06-26 15:12:14 +08:00
parent da9ba657f3
commit 4b07617af0
9 changed files with 330 additions and 49 deletions
+9 -6
View File
@@ -64,17 +64,18 @@ def prepare_submit_job(
*,
connection: str,
script_path: str,
queue: str = "default",
executor_memory: str = "4G",
executor_cores: int = 2,
num_executors: int = 2,
app_name: str | None = None,
queue: str,
executor_memory: str,
executor_cores: int,
num_executors: int,
app_name: str,
extra_args: dict[str, str] | None = None,
) -> dict[str, object]:
"""Snapshot connection params and persist a PendingSubmission. Does NOT submit."""
logger.debug(
f"prepare_submit_job enter connection={connection} script_path={script_path} "
f"queue={queue} executor_memory={executor_memory} executor_cores={executor_cores} "
f"num_executors={num_executors}"
f"num_executors={num_executors} app_name={app_name}"
)
# Order of checks matters for the error the agent sees:
# 1. Unknown connection -> 404 (KeyError -> 404 in server.py)
@@ -121,6 +122,7 @@ def prepare_submit_job(
executor_cores=executor_cores,
num_executors=num_executors,
spark_conf=dict(conn.spark_conf),
extra_args=dict(extra_args or {}),
created_at=datetime.utcnow(),
status="PENDING",
)
@@ -164,6 +166,7 @@ def confirm_submit_job(*, pending_id: str) -> SubmitResult:
executor_cores=pending.executor_cores,
num_executors=pending.num_executors,
spark_conf=pending.spark_conf,
extra_args=pending.extra_args,
)
logger.info(
f"confirm_submit_job start pending_id={pending_id} "