From 07fbae5d67ffa59e0b3a04f995c67885cf360a09 Mon Sep 17 00:00:00 2001 From: Jusong Yu Date: Mon, 13 Jun 2022 16:58:20 +0200 Subject: [PATCH] Propagate clean_workchain to evaluation workchain (#159) The evaluate workchains of every properties are also all inherit from `SelfCleanWorkChain` to to the remote workdir clean after single evaluation step is done. This immediate clean will keep remote machine quato avaliable with many verification at the same time. However, the `clean_workchain` flag setting from parent workchain which calls the evaluate workchain are not properly propagate this parameter to evaluate workchain, lead to that evaluate workchain always get cleaned as default. --- aiida_sssp_workflow/workflows/convergence/bands.py | 1 + aiida_sssp_workflow/workflows/convergence/cohesive_energy.py | 1 + aiida_sssp_workflow/workflows/convergence/delta.py | 1 + .../workflows/convergence/phonon_frequencies.py | 3 ++- aiida_sssp_workflow/workflows/convergence/pressure.py | 1 + aiida_sssp_workflow/workflows/measure/bands.py | 1 + aiida_sssp_workflow/workflows/measure/delta.py | 1 + aiida_sssp_workflow/workflows/verifications.py | 4 ++-- examples/example_verification.py | 4 ++-- 9 files changed, 12 insertions(+), 5 deletions(-) diff --git a/aiida_sssp_workflow/workflows/convergence/bands.py b/aiida_sssp_workflow/workflows/convergence/bands.py index fad9c235..b499f853 100644 --- a/aiida_sssp_workflow/workflows/convergence/bands.py +++ b/aiida_sssp_workflow/workflows/convergence/bands.py @@ -149,6 +149,7 @@ def _get_inputs(self, ecutwfc, ecutrho): "run_bands_structure": orm.Bool( False ), # for convergence with no band structure evaluate + "clean_workchain": self.inputs.clean_workchain, } return inputs diff --git a/aiida_sssp_workflow/workflows/convergence/cohesive_energy.py b/aiida_sssp_workflow/workflows/convergence/cohesive_energy.py index 0d07c3e1..ac622809 100644 --- a/aiida_sssp_workflow/workflows/convergence/cohesive_energy.py +++ b/aiida_sssp_workflow/workflows/convergence/cohesive_energy.py @@ -197,6 +197,7 @@ def _get_inputs(self, ecutwfc, ecutrho): }, "kpoints": atom_kpoints, }, + "clean_workchain": self.inputs.clean_workchain, } return inputs diff --git a/aiida_sssp_workflow/workflows/convergence/delta.py b/aiida_sssp_workflow/workflows/convergence/delta.py index f02989f7..456bc52f 100644 --- a/aiida_sssp_workflow/workflows/convergence/delta.py +++ b/aiida_sssp_workflow/workflows/convergence/delta.py @@ -118,6 +118,7 @@ def _get_inputs(self, ecutwfc, ecutrho): }, "element": orm.Str(self.ctx.element), "configuration": orm.Str(self.ctx.configuration), + "clean_workchain": self.inputs.clean_workchain, } return inputs diff --git a/aiida_sssp_workflow/workflows/convergence/phonon_frequencies.py b/aiida_sssp_workflow/workflows/convergence/phonon_frequencies.py index 92b8c0d5..af669839 100644 --- a/aiida_sssp_workflow/workflows/convergence/phonon_frequencies.py +++ b/aiida_sssp_workflow/workflows/convergence/phonon_frequencies.py @@ -210,7 +210,8 @@ def _get_inputs(self, ecutwfc, ecutrho): }, "settings": orm.Dict(dict={"CMDLINE": cmdline_list}), }, - } + }, + "clean_workchain": self.inputs.clean_workchain, } return inputs diff --git a/aiida_sssp_workflow/workflows/convergence/pressure.py b/aiida_sssp_workflow/workflows/convergence/pressure.py index eb769c55..5bf884ee 100644 --- a/aiida_sssp_workflow/workflows/convergence/pressure.py +++ b/aiida_sssp_workflow/workflows/convergence/pressure.py @@ -150,6 +150,7 @@ def _get_inputs(self, ecutwfc, ecutrho): "parallelization": orm.Dict(dict=self.ctx.parallelization), }, "kpoints_distance": orm.Float(self.ctx.kpoints_distance), + "clean_workchain": self.inputs.clean_workchain, } return inputs diff --git a/aiida_sssp_workflow/workflows/measure/bands.py b/aiida_sssp_workflow/workflows/measure/bands.py index 98b48b0d..d19a6549 100644 --- a/aiida_sssp_workflow/workflows/measure/bands.py +++ b/aiida_sssp_workflow/workflows/measure/bands.py @@ -218,6 +218,7 @@ def _get_inputs(self, pseudos): "fermi_shift": orm.Float(self.ctx.fermi_shift), "run_bands_structure": orm.Bool(True), "kpoints_distance_band_structure": orm.Float(self.ctx.kpoints_distance_band_structure), + "clean_workchain": self.inputs.clean_workchain, } return inputs diff --git a/aiida_sssp_workflow/workflows/measure/delta.py b/aiida_sssp_workflow/workflows/measure/delta.py index c0ab214e..58f4bbfc 100644 --- a/aiida_sssp_workflow/workflows/measure/delta.py +++ b/aiida_sssp_workflow/workflows/measure/delta.py @@ -284,6 +284,7 @@ def _get_inputs(self, structure, configuration): }, "element": orm.Str(self.ctx.element), "configuration": orm.Str(configuration), + "clean_workchain": self.inputs.clean_workchain, } return inputs diff --git a/aiida_sssp_workflow/workflows/verifications.py b/aiida_sssp_workflow/workflows/verifications.py index dbe522b1..0309be8c 100644 --- a/aiida_sssp_workflow/workflows/verifications.py +++ b/aiida_sssp_workflow/workflows/verifications.py @@ -76,9 +76,9 @@ def define(cls, spec): super().define(spec) # yapf: disable spec.expose_inputs(_BaseMeasureWorkChain, namespace='accuracy', - exclude=['code', 'pseudo', 'options', 'parallelization']) + exclude=['code', 'pseudo', 'options', 'parallelization', 'clean_workchain']) spec.expose_inputs(_BaseConvergenceWorkChain, namespace='convergence', - exclude=['code', 'pseudo', 'options', 'parallelization']) + exclude=['code', 'pseudo', 'options', 'parallelization', 'clean_workchain']) spec.input('pw_code', valid_type=orm.Code, help='The `pw.x` code use for the `PwCalculation`.') spec.input('ph_code', valid_type=orm.Code, diff --git a/examples/example_verification.py b/examples/example_verification.py index 867a2f14..252ec409 100644 --- a/examples/example_verification.py +++ b/examples/example_verification.py @@ -51,8 +51,8 @@ def run_verification( "withmpi": True, } ), - "parallelization": orm.Dict(dict={"npool": 2}), - "clean_workchain": orm.Bool(True), + "parallelization": orm.Dict(dict={"npool": 1}), + "clean_workchain": orm.Bool(clean_workchain), } res, node = run_get_node(VerificationWorkChain, **inputs)