Skip to content

Commit

Permalink
Apply static solution to counts
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Jan 10, 2025
1 parent 596ce1e commit 735919e
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/aiidalab_qe/app/result/components/status/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,13 @@ def _render(self):
self.children = [
self.collapse_button,
self.trunk,
ipw.HTML(
value="*workflow will re-submit failed calculations",
layout=ipw.Layout(
margin="5px 0 0",
font_style="italic",
),
),
]

def _update(self):
Expand All @@ -94,6 +101,7 @@ class ProcessTreeNode(ipw.VBox, t.Generic[ProcessNodeType]):
"QeAppWorkChain": "Quantum ESPRESSO app workflow",
"BandsWorkChain": "Electronic band structure workflow",
"PwBandsWorkChain": "Electronic band structure workflow",
"ProjwfcBandsWorkChain": "Electronic band structure workflow",
"PwRelaxWorkChain": "Structural relaxation workflow",
"PdosWorkChain": "Projected density of states workflow",
"DosCalculation": "Compute density of states",
Expand All @@ -116,7 +124,7 @@ class ProcessTreeNode(ipw.VBox, t.Generic[ProcessNodeType]):
"PwCalculation": "Compute bands",
},
"relax": {
"PwBaseWorkChain": "Relaxation workflow",
"PwBaseWorkChain": "Structure relaxation workflow",
"PwCalculation": "Optimize structure geometry",
},
}
Expand All @@ -128,8 +136,6 @@ def __init__(
on_inspect: t.Callable[[str], None] | None = None,
**kwargs,
):
# if not (node and isinstance(node, orm.ProcessNode)):
# raise ValueError("Process node required")
self.uuid = node.uuid
self.level = level
self.on_inspect = on_inspect
Expand Down Expand Up @@ -304,12 +310,11 @@ def _add_branches(self, node=None):
self.pks.add(child.pk)

def _get_tally(self):
total = self._get_current_total(self.node)
total = max(total, self.expected_jobs["count"])
total = self.expected_jobs["count"]
dynamic = self.expected_jobs["dynamic"]
finished = self._count_finished(self.node)
tally = f"{finished}/{total}"
tally += "*" if dynamic and total != finished else ""
tally += "*" if dynamic else ""
tally += " job" if total == 1 else " jobs"
return tally

Expand All @@ -335,7 +340,6 @@ def _get_expected(self, inputs: dict[str, dict]) -> dict:
expected = {}
count = 0
dynamic = False
has_dynamic_workflows = False

for key, sub_inputs in inputs.items():
if "metadata" in sub_inputs and "options" in sub_inputs["metadata"]:
Expand All @@ -345,13 +349,12 @@ def _get_expected(self, inputs: dict[str, dict]) -> dict:
elif key != "metadata":
# This is a workflow
nested = self._get_expected(sub_inputs)
has_dynamic_workflows = nested["dynamic"]
count += nested["count"]
expected[key] = nested

expected |= {
"count": count,
"dynamic": dynamic or has_dynamic_workflows,
"dynamic": dynamic,
}

return expected
Expand Down

0 comments on commit 735919e

Please sign in to comment.