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.
24 lines
692 B
Python
24 lines
692 B
Python
# coding=utf-8
|
|
import pytest
|
|
|
|
from spark_executor.tools.requests import PrepareSubmitJobRequest
|
|
|
|
|
|
def test_prepare_submit_job_request_requires_all_confirmed_parameters():
|
|
with pytest.raises(ValueError):
|
|
PrepareSubmitJobRequest(connection="prod", script_path="/tmp/x.py")
|
|
|
|
|
|
def test_prepare_submit_job_request_accepts_extra_args():
|
|
req = PrepareSubmitJobRequest(
|
|
connection="prod",
|
|
script_path="/tmp/x.py",
|
|
queue="default",
|
|
executor_memory="4G",
|
|
executor_cores=2,
|
|
num_executors=2,
|
|
app_name="test-app",
|
|
extra_args={"jars": "hdfs:///lib/foo.jar"},
|
|
)
|
|
assert req.extra_args == {"jars": "hdfs:///lib/foo.jar"}
|