Skip to content

Commit

Permalink
More explicit error handling for operate_calcjobs when connection reset
Browse files Browse the repository at this point in the history
  • Loading branch information
unkcpz committed Dec 17, 2024
1 parent 75d72b3 commit 060706d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
15 changes: 9 additions & 6 deletions src/aiida_sssp_workflow/workflows/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,15 @@ def on_terminated(self):
self.report(f"{type(self)}: remote folders will not be cleaned")
return

# The clen_wordir is modified to not clean the remote folder of the caching node.
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 RuntimeError 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))}"
)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
WorkChain calculate phonon frequencies at Gamma
"""

from builtins import RuntimeError
from aiida import orm
from aiida.common import NotExistentAttributeError
from aiida.engine import ToContext, while_
Expand Down Expand Up @@ -198,7 +199,7 @@ def finalize(self):
cleaned_calcs = operate_calcjobs(
self.node, operator=clean_workdir, all_same_nodes=False
)
except ConnectionError as exc:
except RuntimeError as exc:
self.logger.warning(
f"clean remote workdir folder {self.inputs.clean_workir} failed: {exc}"
)
Expand Down

0 comments on commit 060706d

Please sign in to comment.