valska.external_tools.pyuvsim.submit

Submission helpers for pyuvsim prepared run directories.

Functions

build_submit_plan(run_dir)

Create a submission plan from an existing prepared run_dir.

load_jobs(run_dir)

load_manifest(run_dir)

Load and parse manifest.json from a prepared run directory.

submit_pyuvsim_run(run_dir, *[, stage, ...])

Submit pyuvsim prepared scripts for a run_dir.

write_jobs(run_dir, jobs)

Classes

SubmitPlan(run_dir, manifest_path, ...)

Resolved paths needed to submit a prepared pyuvsim run.

Exceptions

InvalidArgumentError

Raised when CLI arguments are invalid for submission.

MissingDependencyError

Raised when required inputs or artefacts are missing.

SbatchError

Raised when sbatch fails or returns unparseable output.

SubmissionError

Raised when submission cannot proceed safely or sbatch fails.

exception valska.external_tools.pyuvsim.submit.InvalidArgumentError

Raised when CLI arguments are invalid for submission.

exception valska.external_tools.pyuvsim.submit.MissingDependencyError

Raised when required inputs or artefacts are missing.

exception valska.external_tools.pyuvsim.submit.SbatchError

Raised when sbatch fails or returns unparseable output.

exception valska.external_tools.pyuvsim.submit.SubmissionError

Raised when submission cannot proceed safely or sbatch fails.

class valska.external_tools.pyuvsim.submit.SubmitPlan(run_dir: Path, manifest_path: Path, simulate_script: Path)

Resolved paths needed to submit a prepared pyuvsim run.

manifest_path: Path
run_dir: Path
simulate_script: Path
valska.external_tools.pyuvsim.submit._ensure_script_exists(path: Path, label: str) None
valska.external_tools.pyuvsim.submit._jobs_path(run_dir: Path) Path
valska.external_tools.pyuvsim.submit._merge_jobs_record(existing: dict[str, Any] | None, new_result: dict[str, Any]) dict[str, Any]

Merge a new submission result into an existing jobs.json record.

  • Keeps stable top-level metadata (run_dir, manifest)

  • Updates “jobs” by stage (simulate)

  • Appends to “history” so we don’t lose what happened

valska.external_tools.pyuvsim.submit._run_sbatch(script: Path, *, sbatch_exe: str = 'sbatch', cwd: Path | None = None, dry_run: bool = False) tuple[str | None, str]

Returns (job_id, command_str). If dry_run=True, job_id is None.

valska.external_tools.pyuvsim.submit._utc_now_iso() str
valska.external_tools.pyuvsim.submit.build_submit_plan(run_dir: Path) SubmitPlan

Create a submission plan from an existing prepared run_dir.

This reads manifest.json and uses manifest[‘artefacts’] paths rather than guessing filenames.

valska.external_tools.pyuvsim.submit.load_jobs(run_dir: Path) dict[str, Any] | None
valska.external_tools.pyuvsim.submit.load_manifest(run_dir: Path) dict[str, Any]

Load and parse manifest.json from a prepared run directory.

valska.external_tools.pyuvsim.submit.submit_pyuvsim_run(run_dir: Path, *, stage: Literal['simulate', 'all'] = 'all', sbatch_exe: str = 'sbatch', dry_run: bool = False, force: bool = False, record: Literal['jobs.json', 'manifest'] = 'jobs.json') dict[str, Any]

Submit pyuvsim prepared scripts for a run_dir.

Parameters

run_dir

Prepared run directory.

stage

Which stage(s) to submit: “simulate” or “all”.

sbatch_exe

sbatch executable to invoke.

dry_run

If True, do not submit jobs; return the command that would run.

force

If True, allow resubmission even if jobs.json indicates prior submissions.

record

Where to record submission metadata. Currently only “jobs.json” is supported.

Returns

dict

A jobs.json-style record of the submission (merged if not dry_run).

valska.external_tools.pyuvsim.submit.write_jobs(run_dir: Path, jobs: dict[str, Any]) Path