File tree Expand file tree Collapse file tree 2 files changed +18
-7
lines changed
src/aiida_sssp_workflow/workflows Expand file tree Collapse file tree 2 files changed +18
-7
lines changed Original file line number Diff line number Diff line change
1
+ from builtins import ConnectionError
1
2
from typing import Optional
3
+ from paramiko import ssh_exception
4
+
2
5
3
6
from aiida import orm
4
7
@@ -40,8 +43,12 @@ def clean_workdir(node: orm.CalcJobNode) -> Optional[int]:
40
43
# other subsequent calcjob as `parent_folder`, i.e PH calculation.
41
44
cached_from = node .base .extras .get ("_aiida_cached_from" , None )
42
45
if not cached_from :
43
- node .outputs .remote_folder ._clean () # pylint: disable=protected-access
44
- return node .pk
46
+ try :
47
+ node .outputs .remote_folder ._clean () # pylint: disable=protected-access
48
+ except ssh_exception .SSHException as exc :
49
+ raise ConnectionError ("ssh error" ) from exc
50
+ else :
51
+ return node .pk
45
52
else :
46
53
return None
47
54
Original file line number Diff line number Diff line change @@ -194,11 +194,15 @@ def finalize(self):
194
194
"""set ecutwfc and ecutrho"""
195
195
196
196
if self .inputs .clean_workdir .value is True :
197
- cleaned_calcs = operate_calcjobs (
198
- self .node , operator = clean_workdir , all_same_nodes = False
199
- )
200
-
201
- if cleaned_calcs :
197
+ try :
198
+ cleaned_calcs = operate_calcjobs (
199
+ self .node , operator = clean_workdir , all_same_nodes = False
200
+ )
201
+ except ConnectionError as exc :
202
+ self .logger .warning (
203
+ f"clean remote workdir folder { self .inputs .clean_workir } failed: { exc } "
204
+ )
205
+ else :
202
206
self .report (
203
207
f"cleaned remote folders of calculations: { ' ' .join (map (str , cleaned_calcs ))} "
204
208
)
You can’t perform that action at this time.
0 commit comments