# coding=utf-8 """ @Time :2026/6/24 @Author :tao.chen """ from common.logging import logger from spark_executor.core.job_writer import write_job_file def generate_job_file(code: str) -> dict[str, str]: """Write a PySpark code string to disk; return its absolute path. Use the returned path as the `script_path` argument of prepare_submit_job. The output directory is controlled by the SPARK_EXECUTOR_JOBS_DIR env var (default: ./data/jobs/). """ logger.debug(f"generate_job_file enter code_bytes={len(code)}") path = write_job_file(code) logger.info(f"generate_job_file ok script_path={path}") return {"script_path": path}