|
13 | 13 | from wes_service.util import visit
|
14 | 14 | import urllib
|
15 | 15 | import ruamel.yaml as yaml
|
16 |
| - |
| 16 | +import schema_salad.ref_resolver |
17 | 17 |
|
18 | 18 | def main(argv=sys.argv[1:]):
|
19 | 19 | parser = argparse.ArgumentParser(description='Workflow Execution Service')
|
@@ -75,22 +75,20 @@ def main(argv=sys.argv[1:]):
|
75 | 75 | json.dump(response.result(), sys.stdout, indent=4)
|
76 | 76 | return 0
|
77 | 77 |
|
78 |
| - with open(args.job_order) as f: |
79 |
| - input = yaml.safe_load(f) |
80 |
| - basedir = os.path.dirname(args.job_order) |
81 |
| - |
82 |
| - def fixpaths(d): |
83 |
| - if isinstance(d, dict) and "path" in d: |
84 |
| - local_path = os.path.normpath( |
85 |
| - os.path.join(os.getcwd(), basedir, d["path"])) |
86 |
| - del d["path"] |
87 |
| - d["location"] = urllib.pathname2url(local_path) |
88 |
| - if isinstance(d, dict) and "location" in d: |
89 |
| - if ":" not in d["location"]: |
90 |
| - local_path = os.path.normpath( |
91 |
| - os.path.join(os.getcwd(), basedir, d["location"])) |
92 |
| - d["location"] = urllib.pathname2url(local_path) |
93 |
| - visit(input, fixpaths) |
| 78 | + loader = schema_salad.ref_resolver.Loader({ |
| 79 | + "location": {"@type": "@id"} |
| 80 | + }) |
| 81 | + input, _ = loader.resolve_ref(args.job_order) |
| 82 | + |
| 83 | + basedir = os.path.dirname(args.job_order) |
| 84 | + |
| 85 | + def fixpaths(d): |
| 86 | + if isinstance(d, dict) and "path" in d: |
| 87 | + local_path = os.path.normpath( |
| 88 | + os.path.join(os.getcwd(), basedir, d["path"])) |
| 89 | + del d["path"] |
| 90 | + d["location"] = urllib.pathname2url(local_path) |
| 91 | + visit(input, fixpaths) |
94 | 92 |
|
95 | 93 | workflow_url = args.workflow_url
|
96 | 94 | if not workflow_url.startswith("/") and ":" not in workflow_url:
|
@@ -130,7 +128,7 @@ def fixpaths(d):
|
130 | 128 | del s["outputs"]["fields"]
|
131 | 129 | json.dump(s["outputs"], sys.stdout, indent=4)
|
132 | 130 |
|
133 |
| - if r["state"] == "Complete": |
| 131 | + if r["state"] == "COMPLETE": |
134 | 132 | return 0
|
135 | 133 | else:
|
136 | 134 | return 1
|
|
0 commit comments