From 35a193daddaf487f561a431ae56b5d1b41ef995f Mon Sep 17 00:00:00 2001 From: Daniel Vickers Date: Tue, 25 Aug 2026 10:26:43 -0400 Subject: [PATCH 1/2] Updated the toolchain to not run preprocess unless specifically called on restart. This is a preventative measure against deleting all of your restart data. --- docs/documentation/case.md | 2 ++ toolchain/mfc/args.py | 4 +++- toolchain/mfc/lint_docs.py | 2 ++ toolchain/mfc/run/run.py | 7 ++++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/documentation/case.md b/docs/documentation/case.md index 23463f15b0..562cb29f9d 100644 --- a/docs/documentation/case.md +++ b/docs/documentation/case.md @@ -682,6 +682,8 @@ The value of `dt` needs to be sufficiently small to satisfy the Courant-Friedric `t_step_save` is the time step interval for data output during simulation. To newly start the simulation, set `t_step_start = 0`. To restart the simulation from $k$-th time step, set `t_step_start = k`; see @ref running "Restarting Cases". +When `t_step_start > 0`, `./mfc.sh run` skips `pre_process` by default, since it would otherwise overwrite the +restart data being resumed from. Pass `-t pre_process` explicitly (as in the restart workflow) if regenerating it is intended. ##### Adaptive Time-Stepping diff --git a/toolchain/mfc/args.py b/toolchain/mfc/args.py index c72e895f99..7691336b5c 100644 --- a/toolchain/mfc/args.py +++ b/toolchain/mfc/args.py @@ -86,8 +86,10 @@ def custom_error(message): subparser.error = custom_error - args: dict = vars(parser.parse_args(sys.argv[1:extra_index])) + cli_argv = sys.argv[1:extra_index] + args: dict = vars(parser.parse_args(cli_argv)) args["--"] = sys.argv[extra_index + 1 :] + args["targets_explicit"] = any(tok in ("-t", "--targets") for tok in cli_argv) # Handle --help at top level if args.get("help") and args["command"] is None: diff --git a/toolchain/mfc/lint_docs.py b/toolchain/mfc/lint_docs.py index e4752932bd..6eff9185da 100644 --- a/toolchain/mfc/lint_docs.py +++ b/toolchain/mfc/lint_docs.py @@ -69,6 +69,8 @@ "zeros_default", # Analytic expression language: module name (not a case param) "m_constants", + # Build/run target name (not a case param) + "pre_process", } # Docs to check for parameter references, with per-file skip sets diff --git a/toolchain/mfc/run/run.py b/toolchain/mfc/run/run.py index cd6987cd90..94d946d3d9 100644 --- a/toolchain/mfc/run/run.py +++ b/toolchain/mfc/run/run.py @@ -9,7 +9,7 @@ from mako.lookup import TemplateLookup from mako.template import Template -from ..build import REQUIRED_TARGETS, SIMULATION, build, get_targets +from ..build import PRE_PROCESS, REQUIRED_TARGETS, SIMULATION, build, get_targets from ..common import MFC_ROOT_DIR, MFC_TEMPLATE_DIR, MFCException, does_command_exist, file_dump_yaml, file_read, file_write, format_list_to_string, isspace, system from ..printer import cons from ..state import ARG, ARGS, CFG, gpuConfigOptions @@ -157,9 +157,14 @@ def __execute_job_script(qsystem: queues.QueueSystem): def run(targets=None, case=None): + targets_explicit = targets is not None or ARG("targets_explicit", False) targets = get_targets(list(REQUIRED_TARGETS) + (targets or ARG("targets"))) case = case or input.load(ARG("input"), ARG("--")) + if not targets_explicit and PRE_PROCESS in targets and int(case.params.get("t_step_start", 0)) > 0: + cons.print("[yellow]t_step_start > 0: skipping pre_process so it doesn't overwrite the restart data being resumed from. Pass -t pre_process explicitly to force it.[/yellow]") + targets = [t for t in targets if t is not PRE_PROCESS] + build(targets) verbosity = ARG("verbose") From c3a27fefe7c3655b1fe81e5115061ac6e6381165 Mon Sep 17 00:00:00 2001 From: "Daniel J. Vickers" Date: Tue, 25 Aug 2026 17:11:56 -0400 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- toolchain/mfc/run/run.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/toolchain/mfc/run/run.py b/toolchain/mfc/run/run.py index 94d946d3d9..ce7394b26b 100644 --- a/toolchain/mfc/run/run.py +++ b/toolchain/mfc/run/run.py @@ -161,7 +161,7 @@ def run(targets=None, case=None): targets = get_targets(list(REQUIRED_TARGETS) + (targets or ARG("targets"))) case = case or input.load(ARG("input"), ARG("--")) - if not targets_explicit and PRE_PROCESS in targets and int(case.params.get("t_step_start", 0)) > 0: + if not targets_explicit and PRE_PROCESS in targets and (int(case.params.get("t_step_start", 0)) > 0 or int(case.params.get("n_start", 0)) > 0): cons.print("[yellow]t_step_start > 0: skipping pre_process so it doesn't overwrite the restart data being resumed from. Pass -t pre_process explicitly to force it.[/yellow]") targets = [t for t in targets if t is not PRE_PROCESS]