Skip to content

Commit

Permalink
cwl-runner: ensure return of a json string
Browse files Browse the repository at this point in the history
* Depending on client and server versions it can happen that strings
  come/are parsed in different ways, but we should ensure that we
  return JSON since cwltest expects valid JSON.
  • Loading branch information
Diego Rodriguez committed Sep 21, 2018
1 parent 791b531 commit ef8fc67
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion reana_client/cli/cwl_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,16 @@ def cwl_runner(ctx, quiet, outdir, basedir, processfile, jobfile,
try:
out = re.search("success{[\S\s]*",
logs).group().replace("success", "")
import ast
import json
json_output = json.dumps(ast.literal_eval(str(out)))
except AttributeError:
logging.error("Workflow execution failed")
sys.exit(1)
sys.stdout.write(out)
except Exception as e:
logging.error(traceback.format_exc())
sys.exit(1)
sys.stdout.write(json_output)
sys.stdout.write("\n")
sys.stdout.flush()

Expand Down

0 comments on commit ef8fc67

Please sign in to comment.