Skip to content

Commit

Permalink
Error handling when clean remote folder failed (#245)
Browse files Browse the repository at this point in the history
For convergence `_base`
  • Loading branch information
unkcpz authored Dec 14, 2024
1 parent 38e5ebd commit 75d72b3
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/aiida_sssp_workflow/protocol/convergence.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fine:

base: # base parameters is inherit by other process
occupations: smearing
degauss: 0.0125
degauss: 0.0125
smearing: fd
conv_thr_per_atom: 1.0e-9
kpoints_distance: 0.1 # fine protocol of qe -> gabriel
Expand Down
2 changes: 1 addition & 1 deletion src/aiida_sssp_workflow/protocol/criteria.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ efficiency:

eos:
mode: 0
bounds: [0.0, 0.2]
bounds: [0.0, 0.2]
eps: 1.0e-3

phonon_frequencies:
Expand Down
11 changes: 9 additions & 2 deletions src/aiida_sssp_workflow/workflows/common.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from builtins import ConnectionError
from typing import Optional
from paramiko import ssh_exception


from aiida import orm

Expand Down Expand Up @@ -40,8 +43,12 @@ def clean_workdir(node: orm.CalcJobNode) -> Optional[int]:
# other subsequent calcjob as `parent_folder`, i.e PH calculation.
cached_from = node.base.extras.get("_aiida_cached_from", None)
if not cached_from:
node.outputs.remote_folder._clean() # pylint: disable=protected-access
return node.pk
try:
node.outputs.remote_folder._clean() # pylint: disable=protected-access
except ssh_exception.SSHException as exc:
raise ConnectionError("ssh error") from exc
else:
return node.pk
else:
return None

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -194,11 +194,15 @@ def finalize(self):
"""set ecutwfc and ecutrho"""

if self.inputs.clean_workdir.value is True:
cleaned_calcs = operate_calcjobs(
self.node, operator=clean_workdir, all_same_nodes=False
)

if cleaned_calcs:
try:
cleaned_calcs = operate_calcjobs(
self.node, operator=clean_workdir, all_same_nodes=False
)
except ConnectionError as exc:
self.logger.warning(
f"clean remote workdir folder {self.inputs.clean_workir} failed: {exc}"
)
else:
self.report(
f"cleaned remote folders of calculations: {' '.join(map(str, cleaned_calcs))}"
)
Expand Down

0 comments on commit 75d72b3

Please sign in to comment.