runner_utils¶
runner_utils ¶
PyAERMOD runner UX helpers.
Additions on top of runner.py / BatchRunner:
extract_errmsg/tail_output/summarize_failure: pull useful diagnostics from AERMOD's ERRMSG.TMP and .OUT files when a run fails.ProgressReporterprotocol withTqdmProgress(if tqdm is installed) andLoggingProgress/NoOpProgressfallbacks.resume_batch: given a list of input files and an output dir, return which already have valid.outfiles and which still need to run.RunManifest: JSON-backed batch state for resume / inspection.generate_slurm_script: produce a SLURM job-array template for a directory of .inp files.
ERRMSGInfo
dataclass
¶
Parsed contents of AERMOD's ERRMSG.TMP (or equivalent).
NoOpProgress ¶
Silent progress reporter.
LoggingProgress ¶
Progress reporter that emits INFO-level log lines.
TqdmProgress ¶
Progress reporter using tqdm. Only works if tqdm is installed.
RunManifest
dataclass
¶
Tracks a batch's per-run state in a JSON file.
Use-cases: - Persist partial batch progress across restarts - Post-hoc inspection of which inputs succeeded / failed
extract_errmsg ¶
Parse an AERMOD ERRMSG.TMP-style file.
Returns None if the file doesn't exist.
tail_output ¶
Return the last n_lines of a file as a list of strings.
summarize_failure ¶
Return a human-readable failure summary.
Gathers ERRMSG.TMP content plus the tail of the .OUT file.
resume_batch ¶
resume_batch(input_files: Sequence[Union[str, Path]], output_dir: Union[str, Path]) -> Dict[str, List[Path]]
Partition input_files into 'done' and 'todo' lists.
An input is 'done' if a sibling .out in output_dir has the
AERMOD success marker.
generate_slurm_script ¶
generate_slurm_script(input_files: Sequence[Union[str, Path]], output_dir: Union[str, Path], script_path: Union[str, Path], input_list_path: Union[str, Path], *, aermod_exe: str = 'aermod', job_name: str = 'pyaermod', log_dir: str = 'logs', partition: str = 'general', cpus: int = 1, mem: str = '4G', wallclock: str = '02:00:00', max_concurrent: Optional[int] = None) -> Path
Write a SLURM job-array script + input-list file for a batch.
Returns the path to the generated script.