Skip to content

Commit 78c9daa

Browse files
Refactor code
1 parent 0ffcd88 commit 78c9daa

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

cwltool/command_line_tool.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1216,6 +1216,7 @@ def collect_output_ports(
12161216
if cwl_version != "v1.0":
12171217
builder.resources["exitCode"] = rcode
12181218
try:
1219+
expected_schema = cast(RecordSchema, self.names.get_name("outputs_record_schema", None))
12191220
fs_access = builder.make_fs_access(outdir)
12201221
custom_output = fs_access.join(outdir, "cwl.output.json")
12211222
if fs_access.exists(custom_output):
@@ -1227,6 +1228,20 @@ def collect_output_ports(
12271228
custom_output,
12281229
json_dumps(ret, indent=4),
12291230
)
1231+
if ORDERED_VERSIONS.index(cast(str, cwl_version)) >= ORDERED_VERSIONS.index(
1232+
"v1.3.0-dev1"
1233+
):
1234+
for k in list(ret):
1235+
found = False
1236+
for field in expected_schema.fields:
1237+
if k == field.name:
1238+
found = True
1239+
break
1240+
if not found:
1241+
_logger.warning(
1242+
f"Discarded undeclared output named {k!r} from {custom_output}."
1243+
)
1244+
ret.pop(k)
12301245
else:
12311246
for i, port in enumerate(ports):
12321247
with SourceLine(
@@ -1257,21 +1272,6 @@ def collect_output_ports(
12571272

12581273
if compute_checksum:
12591274
adjustFileObjs(ret, partial(compute_checksums, fs_access))
1260-
expected_schema = cast(RecordSchema, self.names.get_name("outputs_record_schema", None))
1261-
if ORDERED_VERSIONS.index(cast(str, cwl_version)) >= ORDERED_VERSIONS.index(
1262-
"v1.3.0-dev1"
1263-
):
1264-
for k in list(ret):
1265-
found = False
1266-
for field in expected_schema.fields:
1267-
if k == field.name:
1268-
found = True
1269-
break
1270-
if not found:
1271-
_logger.warning(
1272-
f"Discarded undeclared output named {k!r} from {custom_output}."
1273-
)
1274-
ret.pop(k)
12751275
validate_ex(
12761276
expected_schema,
12771277
ret,

0 commit comments

Comments
 (0)