Skip to content

Commit

Permalink
Enhance json output (#240)
Browse files Browse the repository at this point in the history
* enhance json output

* review AW

Co-authored-by: Anika Weinmann <37300249+anikaweinmann@users.noreply.github.com>
  • Loading branch information
mmacata and anikaweinmann authored Sep 7, 2021
1 parent 4f19f96 commit 15be8b9
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/actinia_core/rest/ephemeral_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -1676,10 +1676,20 @@ def _parse_module_outputs(self):
key, value = row.split(delimiter, 1)
result[key.strip()] = value.strip()
elif "json" in format:
result = None
try:
result = json.loads(stdout)
result = {i[0]: i[1] for i in [
entry.split(delimiter, 1) for entry in
stdout.strip('\n').split('\n')]
}
except Exception:
result = stdout
try:
result = json.loads(stdout)
except Exception:
pass
finally:
if not result:
result = stdout
else:
raise AsyncProcessError("Wrong stdout parser format")

Expand Down

0 comments on commit 15be8b9

Please sign in to comment.