Skip to content

Commit

Permalink
Merge pull request #72 from roocs/fix-json-parameter
Browse files Browse the repository at this point in the history
added workaround for cdata issue
  • Loading branch information
cehbrecht committed Dec 8, 2020
2 parents 8581306 + c1b8639 commit e4d79db
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
9 changes: 8 additions & 1 deletion rook/processes/wps_orchestrate.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@

from rook import workflow

import logging
LOGGER = logging.getLogger()


class Orchestrate(Process):
def __init__(self):
Expand Down Expand Up @@ -47,9 +50,13 @@ def __init__(self):

def _handler(self, request, response):
try:
wfdata = request.inputs['workflow'][0].data
# workaround for CDATA issue in pywps
wfdata = wfdata.replace("<![CDATA[", "").replace("]]>", "")
LOGGER.debug(f"wfdata={wfdata}")
wf = workflow.WorkflowRunner(
output_dir=self.workdir)
output = wf.run(request.inputs['workflow'][0].file)
output = wf.run(wfdata)
except Exception as e:
raise ProcessError(f"{e}")
# metalink document with collection of netcdf files
Expand Down
8 changes: 6 additions & 2 deletions rook/workflow.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os
import yaml
from copy import deepcopy
import networkx as nx
Expand All @@ -10,8 +11,11 @@
LOGGER = logging.getLogger()


def load_wfdoc(path):
wfdoc = yaml.load(open(path, "rb"))
def load_wfdoc(data):
if os.path.isfile(data):
wfdoc = yaml.load(open(data, "rb"))
else:
wfdoc = yaml.load(data)
return wfdoc


Expand Down

0 comments on commit e4d79db

Please sign in to comment.