From 6d24a37bbc1e36d0793b1ce841749ece7126f55e Mon Sep 17 00:00:00 2001 From: Daniel Hollas Date: Tue, 20 Sep 2022 09:28:19 +0100 Subject: [PATCH] CalcJobOutputFollower: Fetch retrieved output file if available (#269) Besides performance reasons, this work better when the remote folder is cleared. --- aiidalab_qe/widgets.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/aiidalab_qe/widgets.py b/aiidalab_qe/widgets.py index 0c09154ac..9bef38a8a 100644 --- a/aiidalab_qe/widgets.py +++ b/aiidalab_qe/widgets.py @@ -296,7 +296,15 @@ def _follow_output(self, calcjob): def _fetch_output(self, calcjob): assert isinstance(calcjob, CalcJobNode) - if "remote_folder" in calcjob.outputs: + if "retrieved" in calcjob.outputs: + try: + self.filename = calcjob.attributes["output_filename"] + with calcjob.outputs.retrieved.open(self.filename) as f: + return f.read().splitlines() + except OSError: + return list() + + elif "remote_folder" in calcjob.outputs: try: fn_out = calcjob.attributes["output_filename"] self.filename = fn_out