Skip to content

Commit 83e8834

Browse files
Fix blocker system
1 parent bb0d104 commit 83e8834

26 files changed

Lines changed: 116 additions & 123 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ output-format = "full"
2727
target-version = "py39"
2828

2929
[tool.ruff.lint]
30-
ignore = ["E501", "E402", "TRY003", "RUF012", "N806"]
30+
ignore = ["ARG002", "E501", "E402", "TRY003", "RUF012", "N806"]
3131
select = [
3232
"A", # flake8-builtins
3333
"ARG", # flake8-unused-arguments

src/aiidalab_qe/app/configuration/advanced/convergence/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class ConvergenceConfigurationSettingsModel(
5050

5151
include = True # build-in panel
5252

53-
def update(self, specific=""):
53+
def _update(self, specific=""):
5454
if specific == "structure":
5555
self._update_help_message()
5656
if specific in {"structure", "protocol"}:

src/aiidalab_qe/app/configuration/advanced/hubbard/hubbard.py

Lines changed: 21 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def _on_hubbard_activation(self, _):
8686
def _on_eigenvalues_definition(self, _):
8787
self._toggle_eigenvalues_widget()
8888

89-
def _update(self):
89+
def _update_ui(self):
9090
self._show_loading()
9191
self._build_hubbard_widget()
9292
self._toggle_hubbard_widget()
@@ -171,18 +171,20 @@ def update(index, spin, state, symbol, value):
171171
[
172172
lambda eigenvalues,
173173
kind_index=kind_index,
174-
state_index=state_index: str(
175-
int(eigenvalues[kind_index][0][state_index][-1])
174+
state_index=state_index: (
175+
str(int(eigenvalues[kind_index][0][state_index][-1]))
176176
),
177177
lambda value,
178178
kind_index=kind_index,
179179
state_index=state_index,
180-
kind_name=kind_name: update(
181-
kind_index,
182-
1,
183-
state_index,
184-
kind_name,
185-
float(value),
180+
kind_name=kind_name: (
181+
update(
182+
kind_index,
183+
1,
184+
state_index,
185+
kind_name,
186+
float(value),
187+
)
186188
),
187189
],
188190
)
@@ -204,18 +206,20 @@ def update(index, spin, state, symbol, value):
204206
[
205207
lambda eigenvalues,
206208
kind_index=kind_index,
207-
state_index=state_index: str(
208-
int(eigenvalues[kind_index][1][state_index][-1])
209+
state_index=state_index: (
210+
str(int(eigenvalues[kind_index][1][state_index][-1]))
209211
),
210212
lambda value,
211213
kind_index=kind_index,
212214
state_index=state_index,
213-
kind_name=kind_name: update(
214-
kind_index,
215-
2,
216-
state_index,
217-
kind_name,
218-
float(value),
215+
kind_name=kind_name: (
216+
update(
217+
kind_index,
218+
2,
219+
state_index,
220+
kind_name,
221+
float(value),
222+
)
219223
),
220224
],
221225
)

src/aiidalab_qe/app/configuration/advanced/hubbard/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class HubbardConfigurationSettingsModel(
4747
def needs_eigenvalues_widget(self):
4848
return len(self.applicable_kind_names) > 0
4949

50-
def update(self, specific=""): # noqa: ARG002
50+
def _update(self, specific=""):
5151
if not self.has_structure:
5252
self.applicable_kind_names = []
5353
self.orbital_labels = []

src/aiidalab_qe/app/configuration/advanced/magnetization/magnetization.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def _on_magnetization_type_change(self, _):
128128
self._toggle_widgets()
129129
self._model.update_type_help()
130130

131-
def _update(self):
131+
def _update_ui(self):
132132
self._show_loading()
133133
self._build_moments_list()
134134
self._switch_widgets()

src/aiidalab_qe/app/configuration/advanced/magnetization/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ def __init__(self, *args, **kwargs):
6464
lambda spin_type: spin_type == "collinear",
6565
)
6666

67-
def update(self, specific=""): # noqa: ARG002
67+
def _update(self, specific=""):
6868
if self.spin_type == "none" or not self.has_structure:
6969
self._defaults["moments"] = {}
7070
else:

src/aiidalab_qe/app/configuration/advanced/pseudos/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class PseudosConfigurationSettingsModel(
106106

107107
include = True # build-in panel
108108

109-
def update(self, specific=""):
109+
def _update(self, specific=""):
110110
if not self.has_structure:
111111
return
112112
family = self.family

src/aiidalab_qe/app/configuration/advanced/pseudos/pseudos.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ def _on_cutoffs_change(self, change):
255255
def _on_ecut_change(self, _):
256256
self._model.update_blockers()
257257

258-
def _update(self):
258+
def _update_ui(self):
259259
self._build_pseudos_list()
260260
self._model.update_family_header()
261261

src/aiidalab_qe/app/configuration/advanced/smearing/model.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class SmearingConfigurationSettingsModel(PanelModel):
3030

3131
include = True # build-in panel
3232

33-
def update(self, specific=""): # noqa: ARG002
33+
def _update(self, specific=""):
3434
parameters = (
3535
PwBaseWorkChain.get_protocol_inputs(self.protocol)
3636
.get("pw", {})

src/aiidalab_qe/app/configuration/model.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,8 @@ def __init__(self, *args, **kwargs):
6060
</div>
6161
"""
6262

63-
def update(self):
63+
def _update(self, specific=""):
6464
self.update_relaxation_options()
65-
self.update_blockers()
6665

6766
def update_relaxation_options(self):
6867
if self.has_pbc:
@@ -127,7 +126,9 @@ def set_model_state(self, state: dict):
127126
model.set_model_state(state[identifier])
128127

129128
def update_state(self):
130-
if self.confirmed:
129+
if self.is_blocked:
130+
self.state = State.BLOCKED
131+
elif self.confirmed:
131132
self.state = State.SUCCESS
132133
elif self.is_previous_step_successful and self.has_all_dependencies:
133134
self.state = State.CONFIGURED
@@ -173,7 +174,3 @@ def _get_default_relax_type(self):
173174
def _check_blockers(self):
174175
if not self.has_structure:
175176
yield "No selected input structure"
176-
177-
for _, model in self.get_models():
178-
if model.is_blocked:
179-
yield from model.blockers

0 commit comments

Comments
 (0)