Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

assgin clean_workdir to plugin's builder #667

Merged
merged 3 commits into from
Apr 8, 2024
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
2 changes: 1 addition & 1 deletion src/aiidalab_qe/plugins/bands/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,6 @@ def get_builder(codes, structure, parameters, **kwargs):

workchain_and_builder = {
"workchain": PwBandsWorkChain,
"exclude": ("clean_workdir", "structure", "relax"),
"exclude": ("structure", "relax"),
"get_builder": get_builder,
}
2 changes: 1 addition & 1 deletion src/aiidalab_qe/plugins/pdos/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,6 @@ def get_builder(codes, structure, parameters, **kwargs):

workchain_and_builder = {
"workchain": PdosWorkChain,
"exclude": ("clean_workdir", "structure", "relax"),
"exclude": ("structure", "relax"),
"get_builder": get_builder,
}
2 changes: 1 addition & 1 deletion src/aiidalab_qe/plugins/xas/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,6 @@ def get_builder(codes, structure, parameters, **kwargs):

workchain_and_builder = {
"workchain": XspectraCrystalWorkChain,
"exclude": ("clean_workdir", "structure", "relax"),
"exclude": ("structure", "relax"),
"get_builder": get_builder,
}
2 changes: 1 addition & 1 deletion src/aiidalab_qe/plugins/xps/workchain.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,6 @@ def get_builder(codes, structure, parameters, **kwargs):

workchain_and_builder = {
"workchain": XpsWorkChain,
"exclude": ("clean_workdir", "structure", "relax"),
"exclude": ("structure", "relax"),
"get_builder": get_builder,
}
12 changes: 7 additions & 5 deletions src/aiidalab_qe/workflows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,21 +158,23 @@ def get_builder_from_protocol(
if properties is None:
properties = []
builder.properties = orm.List(list=properties)
# clean workdir
clean_workdir = orm.Bool(parameters["advanced"]["clean_workdir"])
builder.clean_workdir = clean_workdir
# add plugin workchain
for name, entry_point in plugin_entries.items():
if name in properties:
plugin_builder = entry_point["get_builder"](
codes, structure, copy.deepcopy(parameters), **kwargs
)
# check if the plugin has a clean_workdir input
plugin_workchain = entry_point["workchain"]
if plugin_workchain.spec().has_input("clean_workdir"):
plugin_builder.clean_workdir = clean_workdir
setattr(builder, name, plugin_builder)
else:
builder.pop(name, None)

# XXX (unkcpz) I smell not proper design here since I have to look at
# configuration step to know what show be set here.
clean_workdir = parameters["advanced"]["clean_workdir"]
builder.clean_workdir = orm.Bool(clean_workdir)

return builder

def setup(self):
Expand Down
Loading