Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions amorphouspy_api/src/amorphouspy_api/routers/jobs_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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


Expand Down
2 changes: 1 addition & 1 deletion amorphouspy_api/src/amorphouspy_api/workflows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
Loading