|
36 | 36 | "MultipleInputFeatureRequirement",
|
37 | 37 | "InlineJavascriptRequirement",
|
38 | 38 | "ShellCommandRequirement",
|
39 |
| - "StepInputExpressionRequirement"] |
| 39 | + "StepInputExpressionRequirement", |
| 40 | + "ResourceRequirement"] |
40 | 41 |
|
41 | 42 | cwl_files = ("Workflow.yml",
|
42 | 43 | "CommandLineTool.yml",
|
@@ -114,15 +115,15 @@ def open(self, fn, mode):
|
114 | 115 | def exists(self, fn):
|
115 | 116 | return os.path.exists(self._abs(fn))
|
116 | 117 |
|
| 118 | +class UnsupportedRequirement(Exception): |
| 119 | + pass |
| 120 | + |
117 | 121 | def checkRequirements(rec, supportedProcessRequirements):
|
118 | 122 | if isinstance(rec, dict):
|
119 | 123 | if "requirements" in rec:
|
120 | 124 | for r in rec["requirements"]:
|
121 | 125 | if r["class"] not in supportedProcessRequirements:
|
122 |
| - raise Exception("Unsupported requirement %s" % r["class"]) |
123 |
| - if "scatter" in rec: |
124 |
| - if isinstance(rec["scatter"], list) and rec["scatter"] > 1: |
125 |
| - raise Exception("Unsupported complex scatter type '%s'" % rec.get("scatterMethod")) |
| 126 | + raise UnsupportedRequirement("Unsupported requirement %s" % r["class"]) |
126 | 127 | for d in rec:
|
127 | 128 | checkRequirements(rec[d], supportedProcessRequirements)
|
128 | 129 | if isinstance(rec, list):
|
@@ -211,6 +212,7 @@ def __init__(self, toolpath_object, **kwargs):
|
211 | 212 | else:
|
212 | 213 | self.formatgraph = None
|
213 | 214 |
|
| 215 | + checkRequirements(self.tool, supportedProcessRequirements) |
214 | 216 | self.validate_hints(self.tool.get("hints", []), strict=kwargs.get("strict"))
|
215 | 217 |
|
216 | 218 | self.schemaDefs = {}
|
@@ -270,10 +272,6 @@ def _init_job(self, joborder, input_basedir, **kwargs):
|
270 | 272 | if d not in builder.job and "default" in i:
|
271 | 273 | builder.job[d] = i["default"]
|
272 | 274 |
|
273 |
| - for r in self.requirements: |
274 |
| - if r["class"] not in supportedProcessRequirements: |
275 |
| - raise WorkflowException("Unsupported process requirement %s" % (r["class"])) |
276 |
| - |
277 | 275 | # Validate job order
|
278 | 276 | try:
|
279 | 277 | validate.validate_ex(self.names.get_name("input_record_schema", ""), builder.job)
|
@@ -363,6 +361,9 @@ def validate_hints(self, hints, strict):
|
363 | 361 | def get_requirement(self, feature):
|
364 | 362 | return get_feature(self, feature)
|
365 | 363 |
|
| 364 | + def visit(self, op): |
| 365 | + self.tool = op(self.tool) |
| 366 | + |
366 | 367 | def empty_subtree(dirpath):
|
367 | 368 | # Test if a directory tree contains any files (does not count empty
|
368 | 369 | # subdirectories)
|
|
0 commit comments