From 55e98ea9f6db0f68d79e14f11a7be28abe3784e7 Mon Sep 17 00:00:00 2001 From: Leopold Talirz Date: Mon, 1 Jun 2026 13:51:03 +0200 Subject: [PATCH] fix: show correct status for base steps melt_quench was shown as "running" while still waiting for structure generation. --- .../src/amorphouspy_api/routers/jobs_helpers.py | 13 +++++++------ .../src/amorphouspy_api/workflows/__init__.py | 2 +- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/amorphouspy_api/src/amorphouspy_api/routers/jobs_helpers.py b/amorphouspy_api/src/amorphouspy_api/routers/jobs_helpers.py index 9cd10075..004c5abf 100644 --- a/amorphouspy_api/src/amorphouspy_api/routers/jobs_helpers.py +++ b/amorphouspy_api/src/amorphouspy_api/routers/jobs_helpers.py @@ -331,15 +331,16 @@ def _probe_step_caches( partial_results: dict[str, object] = dict(job.result_data or {}) has_failure = False errors: dict[str, str] = {} - # Track whether the base pipeline (structure_generation + melt_quench) is done. - # Analysis steps depend on it, so they should stay "pending" until it completes. - base_done = True + # Track whether all preceding base steps have completed. + # Later base steps and analysis steps should stay "pending" until their + # predecessors finish (executor creates futures early, so they look "running"). + prev_base_done = True for step_name in all_steps: status, result, error = _probe_single_step(cache_dir, job.request_hash, step_name, job.job_id) is_analysis = step_name not in BASE_STEPS - # An analysis step reported as "running" while the base hasn't finished + # A step reported as "running" while its predecessor hasn't finished # is actually just waiting — show "pending" instead. - if status == "running" and is_analysis and not base_done: + if status == "running" and not prev_base_done: status = "pending" progress[step_name] = status if result is not None: @@ -349,7 +350,7 @@ def _probe_step_caches( if error: errors[step_name] = error if not is_analysis and status != "completed": - base_done = False + prev_base_done = False return progress, partial_results, has_failure, errors diff --git a/amorphouspy_api/src/amorphouspy_api/workflows/__init__.py b/amorphouspy_api/src/amorphouspy_api/workflows/__init__.py index 0f465740..33d3e5ab 100644 --- a/amorphouspy_api/src/amorphouspy_api/workflows/__init__.py +++ b/amorphouspy_api/src/amorphouspy_api/workflows/__init__.py @@ -19,7 +19,7 @@ "elastic": run_elastic, } -BASE_STEPS = {"structure_generation", "melt_quench"} +BASE_STEPS = ("structure_generation", "melt_quench") ANALYSES: dict[str, AnalysisFn] = {k: v for k, v in STEPS.items() if k not in BASE_STEPS} if TYPE_CHECKING: