From 416fb6f5b4d8ce51728e9e71e0eed0ba0668b83d Mon Sep 17 00:00:00 2001 From: Xing Wang Date: Fri, 10 Jan 2025 11:00:22 +0100 Subject: [PATCH] [Fix] Remove empty namespace from plugins' builder (#1073) In principle, the plugin's workchain should validate whether an input namespace is empty or not, but not all developers are doing this. We assume all empty namespaces are not used, which is by default when submitting a builder in the aiida-core. Here, we simply remove the empty namespace. --- src/aiidalab_qe/workflows/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/aiidalab_qe/workflows/__init__.py b/src/aiidalab_qe/workflows/__init__.py index 0a4ab0bbb..c87a72408 100644 --- a/src/aiidalab_qe/workflows/__init__.py +++ b/src/aiidalab_qe/workflows/__init__.py @@ -221,7 +221,9 @@ def get_builder_from_protocol( plugin_workchain = entry_point["workchain"] if plugin_workchain.spec().has_input("clean_workdir"): plugin_builder.clean_workdir = clean_workdir - setattr(builder, name, plugin_builder) + # some plugin's logic depend on whether a input exist or not, but not check if it is empty. + # here we remove the empty namespace for safety. + setattr(builder, name, plugin_builder._inputs(prune=True)) else: builder.pop(name, None)