Skip to content

Commit

Permalink
Improve active code logic
Browse files Browse the repository at this point in the history
  • Loading branch information
edan-bainglass committed Dec 26, 2024
1 parent 212df84 commit da3b50a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/aiidalab_qe/app/submission/global_settings/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def add_global_model(
description=name,
default_calc_job_plugin=default_calc_job_plugin,
)
base_code_model.activate()
else:
base_code_model = CodeModel(
name=name,
Expand Down
1 change: 0 additions & 1 deletion src/aiidalab_qe/app/submission/global_settings/setting.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ def render(self):
self.rendered = True

# Render any active codes
self._model.get_model("quantumespresso.pw").activate()
for _, code_model in self._model.get_models():
if code_model.is_active:
self._toggle_code(code_model)
Expand Down
8 changes: 7 additions & 1 deletion src/aiidalab_qe/common/panel.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ def get_model_state(self):
"codes": {
identifier: code_model.get_model_state()
for identifier, code_model in self.get_models()
if code_model.is_ready
},
}

Expand Down Expand Up @@ -357,6 +358,10 @@ class PluginResourceSettingsModel(ResourceSettingsModel):

override = tl.Bool(False)

def add_model(self, identifier, model: CodeModel):
super().add_model(identifier, model)
model.activate()

def update(self):
"""Updates the code models from the global resources.
Expand Down Expand Up @@ -441,7 +446,8 @@ def render(self):

# Render any active codes
for _, code_model in self._model.get_models():
self._toggle_code(code_model)
if code_model.is_active:
self._toggle_code(code_model)

return self.code_widgets_container

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,6 @@ codes:
nodes: 1
ntasks_per_node: 2
parallelization: {}
quantumespresso.xspectra:
code: null
cpus: 1
cpus_per_task: 1
max_wallclock_seconds: 43200
nodes: 1
ntasks_per_node: 1
pdos:
codes:
dos:
Expand Down

0 comments on commit da3b50a

Please sign in to comment.